<?php if(!defined('IN_RAINTPL')){exit('Hacker attempt');}?><!-- devices_manager | generated by RainTPL v 1.7.5 | www.RainTPL.com -->
<?php
$RainTPL_include_obj = new RainTPL();
$RainTPL_include_obj->assign( $var );
$RainTPL_directory_template_temp = $RainTPL_include_obj->tpl_dir;
$this->tpl_dir = $GLOBALS[ 'RainTPL_tpl_dir' ] = $RainTPL_include_obj->tpl_dir . "/" . dirname( "global_header" );
$RainTPL_include_obj->draw( "global_header" );
$this->tpl_dir = $GLOBALS[ 'RainTPL_tpl_dir' ] = $RainTPL_directory_template_temp;
?>
<h2 align='center'><?php echo $var["error"];?></h2>
<?php
	if( isset($var["id"]) ){
?>
<input type='hidden' name='id' value='<?php echo $var["id"];?>'>
<?php
	}
?>
<br>
<center>
	<?php
	if( isset($var["message"]) ){
?>
	<h3 align='center'><?php echo $var["message"];?></h3>
	<?php
	}
?>
	<?php
	if( $var["no_add"] == FALSE ){
?>
	<form action='config.php<?php echo $var["web_var"];?>&display=epm_devices' method='POST'>
  <label><?=_('Search for new devices in netmask')?>
    <input name="netmask" type="text" value="<?php echo $var["srvip"];?>/24">
    <input type="Submit" name="button_go" value="<?=_('Go')?>">
  </label>
  <label>
    <input name="nmap" type="checkbox" value="1" checked><?=_('Use NMAP')?>
  </label>
	</form>
	<?php
	}
?>
</center>
<table align='center' width='90%'>
  <tr>
<td align='center' width='5px'></td>
<td width="11%" align='center'><h3><?=_('Mac Address')?></h3></td>
<td width="13%" align='center'><h3><?=_('Brand')?></h3></td>
<td width="25%" align='center'><h3><?=_('Model of Phone')?></h3></td>
<td width="19%" align='center'><h3><?=_('Extension Number')?></h3></td>
<td width="18%" align='center'><h3><?=_('Template')?></h3></td>

<td width="9%" align='center'></td>
</tr><tr>
	<?php
	if( $var["no_add"] == FALSE ){
?>
	<form action='config.php<?php echo $var["web_var"];?>&display=epm_devices' method='POST'>
		<td align='center' width='5px'><input type="checkbox" name="checkbox" id="checkbox" disabled></td>
		
<td align='center'>
	<?php
		if( $var["mode"] == 'EDIT' ){
?>
	<?php echo $var["mac"];?>
	<?php
		}
		else{
?>
	<input name='mac' type='text' tabindex='1' size="17" maxlength="17">
	<?php
		}
?></td>
<td align='center'>  <label>
	<?php
		if( $var["mode"] == 'EDIT' ){
?>
            <?php echo $var["name"];?>
	<?php
		}
		else{
?>
    <select name="brand_list" id="brand_edit">
    <?php
			if( isset( $var["brand_ava"] ) ){
				$counter1 = 0;
				foreach( $var["brand_ava"] as $key1 => $value1 ){ 
?>
      <option value="<?php echo $value1["value"];?>" <?php
				if( isset($value1["selected"]) ){
?>selected<?php
				}
?>><?php echo $value1["text"];?></option>
      <?php
					$counter1++;
				}
			}
?>
    </select>
	<?php
		}
?>
</td>
<td align='center'>  
  <label>
	<?php
		if( $var["mode"] == 'EDIT' ){
?>
	<input name="edit_id" type="hidden" value="<?php echo $var["edit_id"];?>">
	<input name="display" type="hidden" value="epm_devices">
	<select name="model_list">
    <?php
			if( isset( $var["models_ava"] ) ){
				$counter1 = 0;
				foreach( $var["models_ava"] as $key1 => $value1 ){ 
?>
      <option value="<?php echo $value1["value"];?>" <?php
				if( !empty($value1["selected"]) ){
?>selected<?php
				}
?>><?php echo $value1["text"];?></option>
      <?php
					$counter1++;
				}
			}
?>
    </select>
	<?php
		}
		else{
?>
	<select name="model_list" id="model_new"><option></option></select>
	<?php
		}
?> 
  </label></td>
<td align='center'> 
    <select name="ext_list" id="select">
    <?php
		if( isset( $var["display_ext"] ) ){
			$counter1 = 0;
			foreach( $var["display_ext"] as $key1 => $value1 ){ 
?>
      <option value="<?php echo $value1["value"];?>" <?php
			if( isset($value1["selected"]) ){
?>selected<?php
			}
?>><?php echo $value1["text"];?></option>
      <?php
				$counter1++;
			}
		}
?>
    </select>
  </label>
</td>
<td align='center'>  <select name="template_list" id="template_list">
  <?php
		if( isset( $var["display_templates"] ) ){
			$counter1 = 0;
			foreach( $var["display_templates"] as $key1 => $value1 ){ 
?>
    <option value="<?php echo $value1["value"];?>" <?php
			if( isset($value1["selected"]) ){
?>selected<?php
			}
?>><?php echo $value1["text"];?></option>
    <?php
				$counter1++;
			}
		}
?>
  </select>	<input type='Submit' name='button_edit' value='<?=_('Edit')?>'>
</label></td>
<td align='center'>
	<?php
		if( $var["mode"] == 'EDIT' ){
?>
	<input type='Submit' name='button_save' value='<?=_('Save')?>'>
	<?php
		}
		else{
?>
	<input type='Submit' name='button_add' value='<?=_('Add')?>'>
	<?php
		}
?>
</td>
<?php echo $var["edit"];?>
<td width="5%" align='center'><input type='reset' value='<?=_('Reset')?>'></td>
</tr>
</table>
</form>
<?php
	}
?>
<?php
	if( $var["searched"] == 1 ){
?>
<table width='90%' align='center'>
	<tr>
	  <td align='center'>&nbsp;</td>
	  <td align='center'>&nbsp;</td>
	  <td align='center'>&nbsp;</td>
	  <td colspan="2" align='center'><h3><?=_('Unmanaged Extensions')?></h3></td>
	  <td align='center'>&nbsp;</td>
	  <td align='center'>&nbsp;</td>
	  <td align='center'>&nbsp;</td>
  </tr>
	<?php
		if( is_array($var["unmanaged"]) ){
?>
		<form action='config.php<?php echo $var["web_var"];?>&display=epm_devices' method='POST'>
		<input name="devices_cached" type="hidden" value="<?php echo $var["cached_devices"];?>">
		<?php
			if( isset( $var["unmanaged"] ) ){
				$counter1 = 0;
				foreach( $var["unmanaged"] as $key1 => $value1 ){ 
?>
		<input name="mac_<?php echo $value1["id"];?>" type="hidden" value="<?php echo $value1["mac_strip"];?>">
		<tr>
		<td align='center' width='5px'><input type="checkbox" name="add[]" value="<?php echo $value1["id"];?>"></td>
		<td align='center' width='11%'><?php echo $value1["mac_strip"];?></td>
		<td width="13%" align='center'><?php echo $value1["brand"];?></td>
		<td width="25%" align='center'>
	
		<select name="model_list_<?php echo $value1["id"];?>">
	  
	    <?php
				if( isset( $value1["list"] ) ){
					$counter2 = 0;
					foreach( $value1["list"] as $key2 => $value2 ){ 
?>
      
		  <option value="<?php echo $value2["id"];?>"><?php echo $value2["model"];?></option>
	  
	      <?php
						$counter2++;
					}
				}
?>
    
		  </select></td>
		<td width="19%" align='center'>
			<select name="ext_list_<?php echo $value1["id"];?>" id="ext">
	  
	    <?php
				if( isset( $var["display_ext"] ) ){
					$counter2 = 0;
					foreach( $var["display_ext"] as $key2 => $value2 ){ 
?>
      
		  <option value="<?php echo $value2["value"];?>"><?php echo $value2["text"];?></option>
	  
	      <?php
						$counter2++;
					}
				}
?>
    
		  </select></td>
		<td align='center' width='18%'>&nbsp;</td>
		<td align='center' width='9%'></td>
		<td align='center' width='5%'>&nbsp;</td>
		</tr>
		<?php
					$counter1++;
				}
			}
?>
		<tr>
			<table width="90%" border="0" cellspacing="0" cellpadding="0">
			  <tr>
			    <td><center><input type="submit" name="button_add_selected_phones" value="<?=_('Add Selected Phones')?>"></center></td>
			  </tr>
			</table>
		</tr>
		</form>
	<?php
		}
?>
</table>
<?php
	}
?>

<table width='90%' align='center'>
	<tr>
	  <td align='center'>&nbsp;</td>
	  <td align='center'>&nbsp;</td>
	  <td align='center'>&nbsp;</td>
	  <td colspan="2" align='center'><h3><?=_('Current Managed Extensions')?></h3></td>
	  <td align='center'>&nbsp;</td>
	  <td align='center'><h3>Edit</h3></td>
	  <td align='center'><h3>Delete</h3></td>
  </tr>
	<form action='config.php<?php echo $var["web_var"];?>&display=epm_devices' method='POST'>
	<?php
	if( isset( $var["list"] ) ){
		$counter1 = 0;
		foreach( $var["list"] as $key1 => $value1 ){ 
?>
	<tr>
	<td align='center' width='5px'><input type="checkbox" name="selected[]" value="<?php echo $value1["id"];?>"></td>
	<td align='center' width='11%'><?php echo $value1["mac"];?></td>
	<td width="13%" align='center'><?php echo $value1["name"];?></td>
	<td width="25%" align='center'><?php echo $value1["model"];?></td>
	<td width="19%" align='center'><?php echo $value1["ext"];?> - <?php echo $value1["description"];?></td>
	<td align='center' width='18%'><?php echo $value1["template_name"];?></td>
	<td align='center' width='9%'><a href=config.php?type=tool&display=epm_devices&editready=true&display=epm_devices&id=<?php echo $value1["id"];?>><img src='<?php echo $var["web_path"];?>templates/images/edit.gif' ALT='<?=_('Edit')?>' border='0'></a></td>
	<td align='center' width='5%'><a href=config.php?type=tool&display=epm_devices&deleteready=true&display=epm_devices&id=<?php echo $value1["id"];?>><img src='<?php echo $var["web_path"];?>templates/images/delete.gif' ALT='<?=_('Delete')?>' border='0'></a></td>
	</tr>
	<?php
			$counter1++;
		}
	}
?>
</table>
<hr>
<center>
<h4>
<?=_('Selected Phone(s) Options')?>
</h4>
</center>
<table width='90%' align='center'>
  <tr>
    <td width="26%" align='center'><input type="submit" name="button_delete_selected_phones" value="<?=('Delete Selected Phones')?>"></td>
    <td width="26%" align='center'><input type="submit" name="button_rebuild_selected" value="<?=_('Rebuild Configs for Selected Phones')?>"></td>
    <td width="32%" align='center'><?=_('Change Selected Phones to')?>: <br /><?=_('Brand')?>:<select name="brand_list_selected" id="brand_list_selected">
    <?php
	if( isset( $var["brand_ava"] ) ){
		$counter1 = 0;
		foreach( $var["brand_ava"] as $key1 => $value1 ){ 
?>
      <option value="<?php echo $value1["value"];?>" <?php
		if( isset($value1["selected"]) ){
?>selected<?php
		}
?>><?php echo $value1["text"];?></option>
      <?php
			$counter1++;
		}
	}
?>
    </select> <?=_('Model')?>: <select name="model_list_selected" id="model_list_selected"><option></option></select><br /><input type="submit" name="button_update_phones" value="<?=_('Update Phones')?>"></td>
  </tr>
</table>
</form>
<hr>
<center>
<h4><?=_('Global Phone Options')?></h4>
</center>
<table width='90%' align='center'>
<tr>
<td width="26%" align='center'><form action='' method='POST'><input type='Submit' name='button_rebuild_configs_for_all_phones' value='<?=_('Rebuild Configs for All Phones')?>'></form></td>
<td width="32%" align='center'><form action='' method='POST'><select name="rb_brand">
	<?php
	if( isset( $var["brand_ava"] ) ){
		$counter1 = 0;
		foreach( $var["brand_ava"] as $key1 => $value1 ){ 
?>
	<option value="<?php echo $value1["value"];?>"><?php echo $value1["text"];?></option>
	<?php
			$counter1++;
		}
	}
?>
</select>
  <input type='Submit' name='button_reboot_this_brand' value='<?=_('Reboot This Brand')?>'></form></td>
<td width="42%" align='center'><form action='' method='POST'><?=_('Reconfigure all')?> <select name="product_select" id="product_select">
	<?php
	if( isset( $var["product_list"] ) ){
		$counter1 = 0;
		foreach( $var["product_list"] as $key1 => $value1 ){ 
?>
	<option value="<?php echo $value1["value"];?>"><?php echo $value1["text"];?></option>
	<?php
			$counter1++;
		}
	}
?>
</select> <?=_('with')?>  
  <label>
    <select name="template_selector" id="template_selector">
      <option></option>
    </select> 
    <input type="submit" name="button_rebuild_reboot" value="<?=_('Rebuild & Reboot')?>">
  </label></td>
</tr>
</table>
</form>
<?php
$RainTPL_include_obj = new RainTPL();
$RainTPL_include_obj->assign( $var );
$RainTPL_directory_template_temp = $RainTPL_include_obj->tpl_dir;
$this->tpl_dir = $GLOBALS[ 'RainTPL_tpl_dir' ] = $RainTPL_include_obj->tpl_dir . "/" . dirname( "global_footer" );
$RainTPL_include_obj->draw( "global_footer" );
$this->tpl_dir = $GLOBALS[ 'RainTPL_tpl_dir' ] = $RainTPL_directory_template_temp;
?>
<!--/ devices_manager -->
