当前位置: 首页>>代码示例>>PHP>>正文


PHP Device::get_list方法代码示例

本文整理汇总了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);
}
开发者ID:alj56,项目名称:emoncms,代码行数:53,代码来源:device_controller.php

示例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>";
开发者ID:jhbsz,项目名称:ossimTest,代码行数:31,代码来源:getdevice.php

示例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
开发者ID:jhbsz,项目名称:ossimTest,代码行数:31,代码来源:modifydevice.php


注:本文中的Device::get_list方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。