Copyright (C) 2008-2012 All Rights Reserved. Contributor(s): Mark J Crane */ require_once "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; if (permission_exists('device_view')) { //access granted } else { echo "access denied"; exit; } //add multi-lingual support require_once "app_languages.php"; foreach($text as $key => $value) { $text[$key] = $value[$_SESSION['domain']['language']['code']]; } //get variables used to control the order $order_by = $_GET["order_by"]; $order = $_GET["order"]; //additional includes require_once "resources/header.php"; require_once "resources/paging.php"; //show the content echo "
"; echo "
"; echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
".$text['header-devices']." 
\n"; echo " ".$text['description-devices']."

\n"; echo "
\n"; //prepare to page the results $sql = "select count(*) as num_rows from v_devices "; $sql .= "where domain_uuid = '$domain_uuid' "; //if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } $prep_statement = $db->prepare($sql); if ($prep_statement) { $prep_statement->execute(); $row = $prep_statement->fetch(PDO::FETCH_ASSOC); if ($row['num_rows'] > 0) { $num_rows = $row['num_rows']; } else { $num_rows = '0'; } } //prepare to page the results $rows_per_page = 150; $param = ""; $page = $_GET['page']; if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page); $offset = $rows_per_page * $page; //get the list $sql = "select * from v_devices "; $sql .= "where domain_uuid = '$domain_uuid' "; if (strlen($order_by) == 0) { $sql .= "order by device_mac_address asc "; } else { $sql .= "order by $order_by $order "; } $sql .= "limit $rows_per_page offset $offset "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); $result_count = count($result); unset ($prep_statement, $sql); $c = 0; $row_style["0"] = "row_style0"; $row_style["1"] = "row_style1"; echo "
\n"; echo "\n"; echo "\n"; //echo th_order_by('device_uuid', $text['label-device_uuid'], $order_by, $order); echo th_order_by('device_mac_address', $text['label-device_mac_address'], $order_by, $order); echo th_order_by('device_label', $text['label-device_label'], $order_by, $order); echo th_order_by('device_vendor', $text['label-device_vendor'], $order_by, $order); //echo th_order_by('device_model', $text['label-device_model'], $order_by, $order); //echo th_order_by('device_firmware_version', $text['label-device_firmware_version'], $order_by, $order); echo th_order_by('device_provision_enable', $text['label-device_provision_enable'], $order_by, $order); echo th_order_by('device_template', $text['label-device_template'], $order_by, $order); //echo th_order_by('device_username', $text['label-device_username'], $order_by, $order); //echo th_order_by('device_password', $text['label-device_password'], $order_by, $order); //echo th_order_by('device_time_zone', $text['label-device_time_zone'], $order_by, $order); echo th_order_by('device_description', $text['label-device_description'], $order_by, $order); echo "\n"; echo "\n"; if ($result_count > 0) { foreach($result as $row) { $device_mac_address = $row[device_mac_address]; $device_mac_address = substr($device_mac_address, 0,2).'-'.substr($device_mac_address, 2,2).'-'.substr($device_mac_address, 4,2).'-'.substr($device_mac_address, 6,2).'-'.substr($device_mac_address, 8,2).'-'.substr($device_mac_address, 10,2); echo "\n"; //echo " \n"; echo " \n"; echo " \n"; echo " \n"; //echo " \n"; //echo " \n"; echo " \n"; echo " \n"; //echo " \n"; //echo " \n"; //echo " \n"; echo " \n"; echo " \n"; echo "\n"; if ($c==0) { $c=1; } else { $c=0; } } //end foreach unset($sql, $result, $row_count); } //end if results echo "\n"; echo "\n"; echo "\n"; echo "
\n"; if (permission_exists('device_add')) { echo " $v_link_label_add\n"; } else { echo "  \n"; } echo "
".$row['device_uuid']." ".$row['device_mac_address']." ".$row['device_label']." ".$row['device_vendor']." ".$row['device_model']." ".$row['device_firmware_version']." ".$row['device_provision_enable']." ".$row['device_template']." ".$row['device_username']." ".$row['device_password']." ".$row['device_time_zone']." ".$row['device_description']." "; if (permission_exists('device_edit')) { echo "$v_link_label_edit"; } if (permission_exists('device_delete')) { echo "$v_link_label_delete"; } echo "
\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
   $paging_controls"; if (permission_exists('device_add')) { echo "$v_link_label_add"; } else { echo " "; } echo "
\n"; echo "
"; echo "
"; echo "

"; //include the footer require_once "resources/footer.php"; ?>