function getArray($pSearch) { $pSearch = trim($pSearch); $array; $pluginManager = new PluginManager(); $pluginArray = json_decode($pluginManager->getPlugins()); $pluginArray = $pluginManager->getPluginTags(); foreach ($pluginArray as $plugin) { $name = $plugin['name']; if (!empty($plugin['icon'])) { $icon = $plugin['icon']; } else { $icon = 'images/th-small.png'; } $id = $plugin['id']; if ($this->isIn($pSearch, $name)) { $array[] = array("title" => $name, "icon" => $icon, "click" => "openPlugin('{$id}','','')"); } if (!empty($plugin['tags'])) { $tags = $plugin['tags']; foreach ($tags as $tag) { if (is_array($tag) && count($tag) == 2 && count($tag[1]) == 2) { if ($this->isIn($pSearch, $tag[0])) { $description = $name . ' - ' . $tag[0]; $array[] = array("title" => $description, "icon" => $icon, "click" => "openPlugin('{$id}','" . $tag[1][0] . "','" . $tag[1][1] . "')"); } } else { if ($this->isIn($pSearch, $tag)) { $description = $name . ' - ' . $tag; $array[] = array("title" => $description, "icon" => $icon, "click" => "openPlugin('{$id}','','')"); } } } } } if (!empty($array)) { return $array; } return null; }
function assignCategoryControllers($tpl) { $action = isset($_REQUEST["a"]) ? $_REQUEST["a"] : "list"; if ($action == "list") { $sth = $this->pdo->prepare("SELECT id, name, alarm_count, enabled FROM controllers"); $sth->execute(); $res = $sth->fetchAll(); $tpl->assign('controllers_data', $res); $tpl->assign('view', 'view_dashboard_controllers'); } else { if ($action == "add") { $item = array("id" => -1, "name" => "", "descr" => "", "enabled" => 1, "strict" => 0, "control_type" => "", "control_code" => "", "alarm_id" => 1); // Request for alarms $sth = $this->pdo->prepare("SELECT id, name FROM alarms"); $sth->execute(); $alarms = $sth->fetchAll(); // Request for controls $pm = new PluginManager(PluginManager::PLUGIN_TYPE_CONTROL); $plugins = $pm->getPlugins(); // Request current control $key = array_keys($plugins); $key = $key[0]; $plugin = $plugins[$key]; $ffh = new FieldFormHelper(); $ffh->putFields($plugin->loadForm()); $subformHtml = $ffh->getHTML(); $tpl->assign('action', $action); $tpl->assign('item', $item); $tpl->assign('alarms_data', $alarms); $tpl->assign('controls_data', $plugins); $tpl->assign('subform_html', $subformHtml); $tpl->assign('view', 'view_dashboard_controllers_form'); } else { if ($action == "edit") { $sth = $this->pdo->prepare("SELECT id, name, descr, enabled, strict, control_type, control_code, alarm_id FROM controllers WHERE id = ?"); $sth->execute(array($_REQUEST["id"])); $res = $sth->fetch(PDO::FETCH_ASSOC); $item = $res; // Request for alarms $sth = $this->pdo->prepare("SELECT id, name FROM alarms"); $sth->execute(); $alarms = $sth->fetchAll(); // Request for controls $pm = new PluginManager(PluginManager::PLUGIN_TYPE_CONTROL); $plugins = $pm->getPlugins(); // Request current control $plugin = $pm->getPlugin($item["control_type"]); $plugin->loadConfig($item["control_code"]); $ffh = new FieldFormHelper(); $ffh->putFields($plugin->loadForm()); $subformHtml = $ffh->getHTML(); $tpl->assign('action', $action); $tpl->assign('item', $item); $tpl->assign('alarms_data', $alarms); $tpl->assign('controls_data', $plugins); $tpl->assign('subform_html', $subformHtml); $tpl->assign('view', 'view_dashboard_controllers_form'); } } } }
function getUrl($idConference, $room_type) { $conference = $this->roomInfo($idConference); $plugin_conference = $this->PluginConferenceAdm->getElement($room_type, "code"); $classname = PluginManager::getPlugins($plugin_conference['name']); $classconference = new $classname(); $url = $classconference->getUrl($idConference, $room_type); return $url; }
<?php header('Content-Type: application/json'); require dirname(dirname(__FILE__)) . '/includes/PluginManager.php'; require dirname(dirname(__FILE__)) . '/includes/LoginManager.php'; $pluginManager = new PluginManager(); echo $pluginManager->getPlugins();