本文整理汇总了PHP中Device::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Device::get方法的具体用法?PHP Device::get怎么用?PHP Device::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Device
的用法示例。
在下文中一共展示了Device::get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$data = array();
$devices = new Device();
$data['devices'] = $devices->get()->all;
$data['breadcrumbs'] = array('Devices' => '');
$data['content'] = 'devices/viewall';
$this->load->view('layouts/main/index', $data);
}
示例2: 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);
}
示例3: list
// Add this item to end of array
$log->lwrite("main: Queue: cmd: " . $item['cmd'], 1);
}
}
continue;
// End this iteration of the loop
} else {
$log->lwrite("main:: Action: time: " . $items[$i]['secs'] . ", scene: " . $items[$i]['scene'] . ", cmd: " . $items[$i]['cmd'], 2);
$cmd = $items[$i]['cmd'];
}
// If we have all devices, $devices contains list of devices
// It is possible to look the device up through room and device combination!!
list($room, $dev, $value) = sscanf($items[$i]['cmd'], "!R%dD%dF%s\n");
$log->lwrite("main:: room: " . $room . " ,device: " . $dev . " value: " . $value, 1);
// Search the correct unit in the room. Thus dev is here the unit number
$device = $dlist->get($room, $dev);
// For which room, device is it, and what is the action?
if (substr($value, 0, 2) == "dP") {
$value = substr($value, 2);
$device['val'] = $value;
$device['lastval'] = $value;
$sndval = $value;
} else {
if ($value == '1') {
// in case F1
if ($device['type'] == "switch") {
$device['val'] = '1';
} else {
$device['val'] = $device['lastval'];
}
$sndval = "on";
示例4: getDevice
public static function getDevice($key = null, $val = null)
{
if (is_null($key)) {
$c = Device::get();
self::$device = $c;
return new self();
} else {
$c = Device::where($key, '=', $val)->first();
self::$device = $c;
return $c;
}
}