本文整理汇总了PHP中Device::loadAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Device::loadAll方法的具体用法?PHP Device::loadAll怎么用?PHP Device::loadAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Device
的用法示例。
在下文中一共展示了Device::loadAll方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
} else {
if ($control == Controls::Delete) {
$Category->delete();
$delete = true;
}
}
} else {
require_once '../helper/Utils.php';
$url = "categories.php";
Utils::Redirect($url);
}
}
}
//Load danh mục thiết bị
$ListDevices = array();
$ListDevices = Device::loadAll();
$ListBrands = array();
$ListBrands = Brand::loadAll();
?>
<div class="page-header">
<div class="pull-right">
<span class="btn btn-default btn-file">
<span><i class="entypo-upload"></i></span>
<input type="file" id="files" name="exportExcel[]"/>
</span>
<span class="btn btn-default btn-file">
<span><i class="entypo-upload"></i></span>
<input type="file" id="files" name="importExcel"/>
</span>
<a type="button" class="btn btn-primary pull-right" data-placement="top" title="Thêm" name="btnAdd"
id="btnAdd" data-toggle="modal" data-target="#modalCat" data-backdrop="static"
示例2: story_plugin_action
function story_plugin_action()
{
global $_, $myUser;
switch ($_['action']) {
case 'plugin_story_get_type_template':
Action::write(function ($_, &$response) {
$templates = array_merge(Cause::types(), Effect::types());
$template = $templates[$_['type']];
preg_match_all("/(\\{)(.*?)(\\})/", $template['template'], $matches, PREG_SET_ORDER);
foreach ($matches as $match) {
$template['template'] = str_replace($match[0], $_['data'][$match[2]], $template['template']);
}
/*
$matches = preg_split("/\[(.*?)\]/", $template['template'],-1,PREG_SPLIT_DELIM_CAPTURE);
$tpl = '';
for($i=0;$i<count($matches);$i+=2){
$start = $matches[$i];
$var = $matches[$i+1];
list($name,$value) = explode(':',$var);
if($_['data'][$name] == $value) {
$tpl.= 'selected="selected"';
}
$tpl.= $start;
}
$template['template'] = $tpl;
*/
$response['html'] = '<li class="line" data-type="' . $_['type'] . '">
<i class="fa ' . $template['icon'] . '"></i> <strong>' . $template['label'] . '</strong> ' . $template['template'] . ' <div class="delete"><i onclick="deleteLine(this);" class="fa fa-times"></i></div>
</li>';
}, array());
break;
case 'plugin_story_get_causes_effects':
Action::write(function ($_, &$response) {
$cause = new Cause();
$effect = new Effect();
$effects = $effect->loadAll(array('story' => $_['id']), 'sort');
$causes = $cause->loadAll(array('story' => $_['id']), 'sort');
foreach ($causes as $caus) {
$data = $caus->getValues();
$response['results'][] = array('type' => $caus->type, 'panel' => "CAUSE", 'data' => array('value' => $data->value, 'target' => $data->target, 'operator' => $data->operator, 'union' => $data->union));
}
foreach ($effects as $eff) {
$data = $eff->getValues();
$response['results'][] = array('type' => $eff->type, 'panel' => "EFFECT", 'data' => array('value' => $data->value, 'target' => $data->target, 'operator' => $data->operator, 'union' => $data->union));
}
}, array());
break;
case 'plugin_story_get_captors_plugins':
Action::write(function ($_, &$response) {
$deviceManager = new Device();
$devices = $deviceManager->loadAll(array('state' => 1, 'type' => Device::CAPTOR));
$response['plugins'] = array();
foreach ($devices as $device) {
if (!isset($response['plugins'][$device->plugin])) {
$response['plugins'][] = $device->plugin;
}
}
}, array());
break;
case 'plugin_story_get_captors':
Action::write(function ($_, &$response) {
$deviceManager = new Device();
$devices = $deviceManager->loadAll(array('state' => 1, 'plugin' => $_['plugin'], 'type' => Device::CAPTOR));
foreach ($devices as $device) {
$response['devices'][] = array('plugin' => $device->plugin, 'label' => $device->label, 'id' => $device->id);
}
}, array());
break;
case 'plugin_story_get_captor_values':
Action::write(function ($_, &$response) {
$deviceManager = new Device();
$device = $deviceManager->getById($_['id']);
$response['values'] = $device->getValues();
}, array());
break;
case 'plugin_story_delete_story':
Action::write(function ($_, &$response) {
$storyManager = new Story();
$causeManager = new Cause();
$effectManager = new Effect();
$storyManager->delete(array('id' => $_['id']));
$causeManager->delete(array('story' => $_['id']));
$effectManager->delete(array('story' => $_['id']));
}, array());
break;
case 'plugin_story_check':
require_once dirname(__FILE__) . '/Cause.class.php';
$vocal = new Cause();
$vocal = $vocal->getById($_['event']);
Story::check($vocal);
break;
case 'plugin_story_save_story':
Action::write(function ($_, &$response) {
$causeManager = new Cause();
$effectManager = new Effect();
//.........这里部分代码省略.........
示例3: story_plugin_action
function story_plugin_action()
{
global $_, $myUser;
switch ($_['action']) {
case 'plugin_story_get_type_template':
Action::write(function ($_, &$response) {
$templates = array_merge(Cause::types(), Effect::types());
$template = $templates[$_['type']];
$response['html'] = '<li class="line" data-type="' . $_['type'] . '">
<i class="fa ' . $template['icon'] . '"></i> <strong>' . $template['label'] . '</strong> ' . $template['template'] . ' <div class="delete"><i onclick="deleteLine(this);" class="fa fa-times"></i></div>
</li>';
}, array());
break;
case 'plugin_story_get_captors_plugins':
Action::write(function ($_, &$response) {
$deviceManager = new Device();
$devices = $deviceManager->loadAll(array('state' => 1, 'type' => Device::CAPTOR));
$response['plugins'] = array();
foreach ($devices as $device) {
if (!isset($response['plugins'][$device->plugin])) {
$response['plugins'][] = $device->plugin;
}
}
}, array());
break;
case 'plugin_story_get_captors':
Action::write(function ($_, &$response) {
$deviceManager = new Device();
$devices = $deviceManager->loadAll(array('state' => 1, 'plugin' => $_['plugin'], 'type' => Device::CAPTOR));
foreach ($devices as $device) {
$response['devices'][] = array('plugin' => $device->plugin, 'label' => $device->label, 'id' => $device->id);
}
}, array());
break;
case 'plugin_story_get_captor_values':
Action::write(function ($_, &$response) {
$deviceManager = new Device();
$device = $deviceManager->getById($_['id']);
$response['values'] = $device->getValues();
}, array());
break;
case 'plugin_story_delete_story':
Action::write(function ($_, &$response) {
$storyManager = new Story();
$causeManager = new Cause();
$effectManager = new Effect();
$storyManager->delete(array('id' => $_['id']));
$causeManager->delete(array('story' => $_['id']));
$effectManager->delete(array('story' => $_['id']));
}, array());
break;
case 'plugin_story_check':
require_once dirname(__FILE__) . '/Cause.class.php';
$vocal = new Cause();
$vocal = $vocal->getById($_['event']);
Story::check($vocal);
break;
case 'plugin_story_save_story':
Action::write(function ($_, &$response) {
$causeManager = new Cause();
$effectManager = new Effect();
$story = new Story();
if (isset($_['story']['id']) && $_['story']['id'] != '0') {
$story = $story->getById($_['story']['id']);
$causeManager->delete(array('story' => $story->id));
$effectManager->delete(array('story' => $story->id));
}
$story->label = $_['story']['label'];
$story->date = time();
$story->state = 1;
$story->save();
$i = 0;
foreach ($_['story']['causes'] as $cause) {
$current = new Cause();
$current->type = $cause['type'];
$current->operator = @$cause['operator'];
$current->setValues($cause);
$current->sort = $i;
$current->union = $cause['union'];
$current->story = $story->id;
$current->save();
$i++;
}
$i = 0;
foreach ($_['story']['effects'] as $effect) {
$current = new Effect();
$current->type = $effect['type'];
$current->setValues($effect);
$current->sort = $i;
$current->union = $cause['union'];
$current->story = $story->id;
$current->save();
$i++;
}
}, array());
break;
}
}