<?php


/**
 * Klasse Rebres
 * Reboot und Reset
 */

class Rebres {
	/*
	 * Funktion display erzeugt den Inhalt von der HTML-Seite
	 */
	function display($args) {

		require_once "./includes/amifunc.php";
		include('./includes/header.php');

		
		if ($_POST['v']!="Yes"){
			$ret.= "<br/>
				<table  width='50%' class='contenttoc' >
				    <tr>
				        <th>
				        	".REBOOT_RESET_MESSAGE_REB_DIS."
				        </th>
				    </tr>
				    <tr>
				    	<td><form class='beroari_form' action='' method='POST' name='reboot' onsubmit='return confirm(\"".REBOOT_RESET_CONFIRM_REBOOT_DIS."\");'>
							<input type='hidden' name='action' value='reboot'>
							<input type='hidden' name='v' value='Yes'>
							<input type='submit' class='resetB' name='submit' style='margin-top:5px;'  value='".REBOOT_RESET_BUTTON_REBOOT_DIS."'>
							</form>
						</td>
				    </tr>
				</table>";
			$ret.= "<br/><br/>
				<table class='contenttoc' id='table' width='50%'>
				    <tr>
				        <th>
							".REBOOT_RESET_MESSAGE_RESET_DIS."							
						</th>
					</tr>
					<tr>
				        <td>
				        <form class='beroari_form' action='misc/recreate.php?val=yes' method='POST' name='reset' onsubmit='return confirm(\"".REBOOT_RESET_CONFIRM_RESET_DIS."\");'>
							<table class='contenttoc' align='center' style='margin-top:10px; margin-bottom:10px;'>
							<tr><td colspan=2>".REBOOT_RESET_KEEP_SETTINGS_DIS.":</td></tr>
							<tr><td>".REBOOT_RESET_KEEP_SETTINGS_RES_DIS."</td><td><input type='checkbox' name='keep_set' style='margin-top:5px;' checked></td></tr>
							<tr><td>".REBOOT_RESET_KEEP_CLOUD_SETTINGS_RES_DIS."</td><td><input type='checkbox' name='keep_cloud_set' style='margin-top:5px;' checked></td></tr>
							<tr><td>".REBOOT_RESET_KEEP_SIP_SETTINGS_RES_DIS."</td><td><input type='checkbox' name='keep_sip_set' id='keep_sip_set' style='margin-top:5px;'></td></tr>
							<tr><td style='border:0px;'><input type='submit' name='v' class='resetB' value='".REBOOT_RESET_BUTTON_FACT_RES_DIS."'></td><td style='border:0px;'><input class='resetB' id='wizard' type='submit' name='v' value='Wizard'></td></tr>
							</table>
							</form>
						</td>
					</tr>
				</table>
				<script>
					$('#keep_sip_set').change(function() {
						if ($(this).attr('checked')) $('#wizard').attr('style','display:none;');
						else $('#wizard').attr('style','display:inline;');
					});
				</script>";
		}
		if (isset($_GET['li1Old'])){
			$li1=exec('/bin/sed -ne "s/type: \(.*\)/\1/p" /proc/li1');
			$ret.= "<br/><br/>
				<table class='contenttoc' id='table' width='50%'>
				    <tr>
				        <th>
							".REBOOT_RESET_MESSAGE_MIGRATE_DIS.
							REBOOT_RESET_OLD_LI_DIS.":".$_GET['li1Old']."<br/>".
							REBOOT_RESET_NEW_LI_DIS.":".Helper::getLiName($li1)."							
						</th>
					</tr>
					<tr>
				        <td>
				        <form class='beroari_form' action=index.php?m=rebres method='POST' name='migrate' onsubmit='return confirm(\"".REBOOT_RESET_CONFIRM_MIGRATE_DIS."\");'>
							<input type='hidden' name='action' class='resetB' value='updatedb'>
							<input type='submit' name='v' class='resetB' value='".REBOOT_RESET_BUTTON_MIGRATE_DB_DIS."'>
							
							</form>
						</td>
					</tr>
				</table>
				";
		}
		if ($_POST['v']=="Yes"){
			$ret.='<br/>'.REBOOT_RESET_REBOOTING_DIS;
		}
		
		
	//Rückgabe: Der Inhalt von der HTML-Seite  
		return $ret;
	}

}
?>
