本文整理匯總了PHP中Device::get_list方法的典型用法代碼示例。如果您正苦於以下問題:PHP Device::get_list方法的具體用法?PHP Device::get_list怎麽用?PHP Device::get_list使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Device
的用法示例。
在下文中一共展示了Device::get_list方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: device_controller
function device_controller()
{
global $session, $route, $mysqli, $user, $redis;
$result = false;
require_once "Modules/device/device_model.php";
$device = new Device($mysqli, $redis);
if ($route->format == 'html') {
if ($route->action == "view" && $session['write']) {
$devices_templates = $device->get_templates();
$result = view("Modules/device/Views/device_view.php", array('devices_templates' => $devices_templates));
}
if ($route->action == 'api') {
$result = view("Modules/device/Views/device_api.php", array());
}
}
if ($route->format == 'json') {
if ($route->action == 'list') {
if ($session['userid'] > 0 && $session['write']) {
$result = $device->get_list($session['userid']);
}
} elseif ($route->action == "create") {
if ($session['userid'] > 0 && $session['write']) {
$result = $device->create($session['userid']);
}
} elseif ($route->action == "listtemplates") {
if ($session['userid'] > 0 && $session['write']) {
$result = $device->get_templates();
}
} else {
$deviceid = (int) get('id');
if ($device->exist($deviceid)) {
$deviceget = $device->get($deviceid);
if (isset($session['write']) && $session['write'] && $session['userid'] > 0 && $deviceget['userid'] == $session['userid']) {
if ($route->action == "get") {
$result = $deviceget;
}
if ($route->action == "delete") {
$result = $device->delete($deviceid);
}
if ($route->action == 'set') {
$result = $device->set_fields($deviceid, get('fields'));
}
if ($route->action == 'inittemplate') {
$result = $device->init_template($deviceid);
}
}
} else {
$result = array('success' => false, 'message' => 'Device does not exist');
}
}
}
return array('content' => $result);
}
示例2: ossim_valid
ossim_valid($page, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("page"));
ossim_valid($rp, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("rp"));
ossim_valid($search, OSS_NULLABLE, OSS_SPACE, OSS_SCORE, OSS_ALPHA, OSS_DOT, OSS_DIGIT, 'illegal:' . _("search"));
ossim_valid($field, OSS_ALPHA, OSS_SPACE, OSS_PUNC, OSS_NULLABLE, 'illegal:' . _("field"));
if (ossim_error()) {
die(ossim_error());
}
if (empty($order)) {
$order = "ip";
}
$start = ($page - 1) * $rp;
$limit = "LIMIT {$start}, {$rp}";
$db = new ossim_db();
$conn = $db->connect();
$xml = "";
$device_list = Device::get_list($conn, "{$filter} ORDER BY {$order} {$limit}");
if ($device_list[0]) {
$total = $device_list[0]->get_foundrows();
if ($total == 0) {
$total = count($device_list);
}
} else {
$total = 0;
}
$xml .= "<rows>\n";
$xml .= "<page>{$page}</page>\n";
$xml .= "<total>{$total}</total>\n";
foreach ($device_list as $device) {
$ip = $device->get_ip();
$xml .= "<row id='{$ip}'>";
$xml .= "<cell><![CDATA[" . $ip . "]]></cell>";
示例3: GET
<body>
<?php
if (!(GET('withoutmenu') == 1 || POST('withoutmenu') == 1)) {
include "../hmenu.php";
}
$ip = "";
$community = "";
$descr = "";
$ip = GET('ip') != "" ? GET('ip') : POST('ip');
ossim_valid($ip, OSS_IP_ADDR, OSS_NULLABLE, 'illegal:' . _("ip"));
if (ossim_error()) {
die(ossim_error());
}
if (GET('ip') != "") {
$devices = Device::get_list($conn, "where ip='" . Host::ip2ulong(GET('ip')) . "'");
foreach ($devices as $device) {
$community = $device->get_community();
$descr = $device->get_descr();
}
} else {
$community = POST('community');
ossim_valid($community, OSS_ALPHA, OSS_SPACE, OSS_SCORE, OSS_PUNC, OSS_NULLABLE, 'illegal:' . _("name"));
$descr = POST('descr');
ossim_valid($descr, OSS_ALPHA, OSS_NULLABLE, OSS_SPACE, OSS_PUNC, OSS_AT, 'illegal:' . _("Description"));
if (ossim_error()) {
die(ossim_error());
}
}
if ($community != "" && GET('ip') == "") {
// only with POST