本文整理汇总了PHP中Plugin::callHook方法的典型用法代码示例。如果您正苦于以下问题:PHP Plugin::callHook方法的具体用法?PHP Plugin::callHook怎么用?PHP Plugin::callHook使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plugin
的用法示例。
在下文中一共展示了Plugin::callHook方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAllUsers
static function getAllUsers()
{
$userManager = new User();
$users = $userManager->populate();
Plugin::callHook("user_get_all", array(&$users));
usort($users, "User::userorder");
return $users;
}
示例2: handleData
function handleData($client, $data)
{
$_ = json_decode($data, true);
if (!isset($_['action'])) {
$_['action'] = '';
}
switch ($_['action']) {
case 'CLIENT_INFOS':
$client->type = $_['type'];
$client->location = $_['location'];
$this->log('setting infos ' . $client->location . ' for ' . $client->name);
break;
case 'GET_SPEECH_COMMANDS':
$response = array();
Plugin::callHook("vocal_command", array(&$response, YANA_URL));
$this->send($this->connected[$client->id]->socket, '{"action":"ADD_COMMANDS","commands":' . json_encode($response['commands']) . '}');
break;
case 'CATCH_COMMAND':
$response = array();
Plugin::callHook("vocal_command", array(&$response, ''));
foreach ($response['commands'] as $command) {
if ($command['command'] != $_['command']) {
continue;
}
if (isset($command['url'])) {
$this->url(YANA_URL . '/action.php' . $command['url']);
}
}
Plugin::callHook('listen', array($_['command'], $_['text'], $_['confidence']));
break;
case '':
default:
//$this->talk("Coucou");
//$this->sound("C:/poule.wav");
//$this->execute("C:\Program Files (x86)\PuTTY\putty.exe");
$this->log($client->name . '(' . $client->type . ') send ' . $data);
break;
}
$this->updateClient($client);
//system('php '.realpath(dirname(__FILE__)).'\action.php '.$json['action'],$out);
//$this->send($socket,$out);
}
示例3: room_plugin_page
function room_plugin_page($_)
{
if (isset($_['module']) && $_['module'] == 'room') {
$roomManager = new Room();
$rooms = $roomManager->populate();
//if (!isset($_['id']) && count($rooms)>0) $_['id'] = $rooms[0]->getId();
$currentRoom = new Room();
?>
<div class="row">
<div class="span12">
<ul class="nav nav-tabs">
<li <?php
if (!isset($_['id'])) {
?>
class="active" <?php
}
?>
><a href="index.php?module=room"><i class="fa fa-angle-right"></i> Toutes les pièces</a></li>
<?php
foreach ($rooms as $room) {
if (isset($_['id']) && $room->getId() == $_['id']) {
$currentRoom = $room;
}
?>
<li <?php
echo isset($_['id']) && $room->getId() == $_['id'] ? 'class="active"' : '';
?>
><a href="index.php?module=room&id=<?php
echo $room->getId();
?>
"><i class="fa fa-angle-right"></i> <?php
echo $room->getName();
?>
</a></li>
<?php
}
?>
</ul>
</div>
</div>
<div class="row">
<div class="span12">
<?php
if ($currentRoom->getId() != 0) {
Plugin::callHook("node_display", array($currentRoom));
} else {
foreach ($rooms as $room) {
Plugin::callHook("node_display", array($room));
}
}
?>
</div>
</div>
<?php
}
}
示例4: dirname
<?php
require_once dirname(__FILE__) . '/common.php';
$menuItems = array();
Plugin::callHook("menubar_pre_home", array(&$menuItems));
uasort($menuItems, function ($a, $b) {
return $a['sort'] > $b['sort'] ? 1 : -1;
});
$tpl->assign('menuItems', $menuItems);
?>
示例5: handleData
function handleData($client, $data)
{
$this->log("Try to parse received data : " . $data);
try {
$datas = explode('<EOF>', $data);
foreach ($datas as $data) {
$_ = json_decode($data, true);
if (!$_) {
throw new Exception("Unable to parse data : " . $data);
}
if (!isset($_['action'])) {
$_['action'] = '';
}
$this->log("Parsed action : " . $_['action']);
switch ($_['action']) {
case 'TALK':
$this->talkAnimate();
$this->talk($_['parameter']);
break;
case 'TALK_FINISHED':
$this->muteAnimate();
break;
case 'EMOTION':
$this->emotion($_['parameter']);
break;
case 'IMAGE':
$this->image($_['parameter']);
break;
case 'SOUND':
$this->sound($_['parameter']);
break;
case 'EXECUTE':
$this->execute($_['parameter']);
break;
case 'CLIENT_INFOS':
$client->type = $_['type'];
$client->location = $_['location'];
$userManager = new User();
$myUser = $userManager->load(array('token' => $_['token']));
if (isset($myUser) && $myUser != false) {
$myUser->loadRight();
}
$client->user = !$myUser ? new User() : $myUser;
$this->log('setting infos ' . $client->type . ' - ' . $client->location . ' for ' . $client->name . ' with user:' . $client->user->getLogin());
break;
case 'GET_SPEECH_COMMANDS':
$response = array();
Plugin::callHook("vocal_command", array(&$response, YANA_URL));
$commands = array();
foreach ($response['commands'] as $command) {
unset($command['url']);
$this->send($this->connected[$client->id]->socket, '{"action":"ADD_COMMAND","command":' . json_encode($command) . '}');
}
$this->send($this->connected[$client->id]->socket, '{"action":"UPDATE_COMMANDS"}');
break;
case 'CATCH_COMMAND':
$response = "";
$this->log("Call listen hook (v2.0 plugins) with params " . $_['command'] . " > " . $_['text'] . " > " . $_['confidence']);
Plugin::callHook('listen', array($_['command'], trim(str_replace($_['command'], '', $_['text'])), $_['confidence']));
break;
case '':
default:
//$this->talk("Coucou");
//$this->sound("C:/poule.wav");
//$this->execute("C:\Program Files (x86)\PuTTY\putty.exe");
$this->log($client->name . '(' . $client->type . ') send ' . $data);
break;
}
$this->updateClient($client);
}
} catch (Exception $e) {
$this->log("ERROR : " . $e->getMessage());
}
//system('php '.realpath(dirname(__FILE__)).'\action.php '.$json['action'],$out);
//$this->send($socket,$out);
}
示例6: isset
$page = isset($_['page']) ? $_['page'] : 1;
$pages = $articlePerPages > 0 ? ceil($numberOfItem / $articlePerPages) : 1;
$startArticle = ($page - 1) * $articlePerPages;
if ($articleDisplayHomeSort) {
$order = 'pubdate desc';
} else {
$order = 'pubdate asc';
}
if ($optionFeedIsVerbose) {
$events = $eventManager->loadAllOnlyColumn($target, $filter, $order, $startArticle . ',' . $articlePerPages);
} else {
$events = $eventManager->getEventsNotVerboseFeed($startArticle, $articlePerPages, $order, $target);
}
$tpl->assign('numberOfItem', $numberOfItem);
break;
}
$tpl->assign('pages', $pages);
$tpl->assign('page', $page);
for ($i = $page - PAGINATION_SCALE <= 0 ? 1 : $page - PAGINATION_SCALE; $i < ($page + PAGINATION_SCALE > $pages + 1 ? $pages + 1 : $page + PAGINATION_SCALE); $i++) {
$pagesArray[] = $i;
}
$tpl->assign('pagesArray', $pagesArray);
$tpl->assign('previousPages', $page - PAGINATION_SCALE < 0 ? -1 : $page - PAGINATION_SCALE - 1);
$tpl->assign('nextPages', $page + PAGINATION_SCALE > $pages + 1 ? -1 : $page + PAGINATION_SCALE);
Plugin::callHook("index_post_treatment", array(&$events));
$tpl->assign('events', $events);
$tpl->assign('time', $_SERVER['REQUEST_TIME']);
$tpl->assign('hightlighted', 0);
$tpl->assign('scroll', false);
$view = 'index';
require_once 'footer.php';
示例7: dash_monitoring_plugin_actions
function dash_monitoring_plugin_actions()
{
global $myUser, $_, $conf;
switch ($_['action']) {
case 'dash_monitoring_plugin_load':
if ($myUser == false) {
exit('Vous devez vous connecter pour cette action.');
}
header('Content-type: application/json');
$response = array();
switch ($_['bloc']) {
case 'ram':
$response['title'] = 'RAM';
$hdds = Monitoring::ram();
$response['content'] = '
<div style="width: 100%">
<canvas id="RAM_PIE"></canvas>
<br/><br/>
<ul class="graphic_pane">
<li class="pane_orange">
<h1>RAM UTILISEE</h1>
<h2>' . $hdds['percentage'] . '%</h2>
</li><li class="pane_cyan">
<h1>RAM LIBRE</h1>
<h2>' . $hdds['free'] . ' Mo</h2>
</li><li class="pane_red">
<h1>RAM TOTALE</h1>
<h2>' . $hdds['total'] . ' Mo</h2>
</li>
</ul>
</div>
<script>
$("#RAM_PIE:visible").chart({
type : "doughnut",
label : ["RAM UTILISEE","RAM LIBRE"],
backgroundColor : ["' . ($hdds['percentage'] > 80 ? '#E64C65' : '#FCB150') . '","#4FC4F6"],
segmentShowStroke:false,
data : [' . $hdds['percentage'] . ',' . (100 - $hdds['percentage']) . ']
});
</script>';
break;
case 'system':
$response['title'] = 'Système';
if (PHP_OS != 'WINNT') {
$heat = Monitoring::heat();
$cpu = Monitoring::cpu();
}
$response['content'] = '<ul class="yana-list">
<li><strong>Distribution :</strong> ' . Monitoring::distribution() . '</li>
<li><strong>Kernel :</strong> ' . Monitoring::kernel() . '</li>
<li><strong>HostName :</strong> ' . Monitoring::hostname() . '</li>
<li><strong>Température :</strong> <span class="label ' . $heat["label"] . '">' . $heat["degrees"] . '°C</span></li>
<li><strong>Temps de marche :</strong> ' . Monitoring::uptime() . '</li>
<li><strong>CPU :</strong> <span class="label label-info">' . $cpu['current_frequency'] . ' Mhz</span> (Max ' . $cpu['maximum_frequency'] . ' Mhz/ Min ' . $cpu['minimum_frequency'] . ' Mhz)</li>
<li><strong>Charge :</strong> <span class="label label-info">' . $cpu['loads'] . ' </span> | ' . $cpu['loads5'] . ' 5min | ' . $cpu['loads15'] . ' 15min</li>
</ul>';
break;
case 'vocal':
if ($myUser->getId() == '') {
exit('{"error":"invalid or missing token"}');
}
if (!$myUser->can('vocal', 'r')) {
exit('{"error":"insufficient permissions for this account"}');
}
list($host, $port) = explode(':', $_SERVER['HTTP_HOST']);
$actionUrl = 'http://' . $host . ':' . $_SERVER['SERVER_PORT'] . $_SERVER['REQUEST_URI'];
$actionUrl = substr($actionUrl, 0, strpos($actionUrl, '?'));
Plugin::callHook("vocal_command", array(&$response, $actionUrl));
$response['title'] = count($response['commands']) . ' Commandes vocales';
$response['content'] = '<ul class="yana-list">';
foreach ($response['commands'] as $command) {
$response['content'] .= '<li title="Sensibilité : ' . $command['confidence'] . '">' . $command['command'] . '</li>';
}
$response['content'] .= '</ul>';
break;
case 'logs':
if ($myUser->getId() == '') {
exit('{"error":"invalid or missing token"}');
}
$response['title'] = 'Logs';
$logs = dirname(__FILE__) . '/../../' . LOG_FILE;
$response['content'] = '<div style="overflow:auto;max-height:200px;"><ul class="yana-list" style="margin:0px;">';
if (file_exists($logs)) {
$lines = file($logs);
foreach ($lines as $i => $line) {
$response['content'] .= '<li style="font-size:8px;' . ($i % 2 == 0 ? 'background-color:#F4F4F4;' : '') . '">' . $line . '</li>';
}
} else {
$response['content'] .= '<li>Aucun logs</li>';
}
$response['content'] .= '</ul></div>';
break;
case 'network':
$response['title'] = 'Réseau';
$ethernet = array();
$lan = '';
$wan = '';
//.........这里部分代码省略.........
示例8: Exception
} else {
Gpio::write($_["pin"], $_["state"], true);
}
break;
// Gestion des interfaces de seconde génération
// Gestion des interfaces de seconde génération
case 'SUBSCRIBE_TO_CLIENT':
Action::write(function ($_, &$response) {
global $myUser, $conf;
if (!isset($_['ip'])) {
throw new Exception("IP invalide");
}
if (!isset($_['port']) || !is_numeric($_['port'])) {
throw new Exception("Port invalide");
}
$url = Functions::getBaseUrl('action.php') . '/action.php';
$client = new CLient($_['ip'], $_['port']);
Plugin::callHook("vocal_command", array(&$vocal, $url));
$conf = array('VOCAL_ENTITY_NAME' => $conf->put('VOCAL_ENTITY_NAME', 'YANA'), 'SPEECH_COMMAND' => $vocal);
if (!$client->suscribe($url, $myUser->getToken())) {
throw new Exception("Appairage impossible");
}
if (!$client->configure($conf)) {
throw new Exception("Configuration impossible");
}
}, array('user' => 'u'));
break;
default:
Plugin::callHook("action_post_case", array());
break;
}
示例9: common_listen
function common_listen($command, $text, $confidence)
{
echo "\n" . 'diction de la commande : ' . $command;
$response = array();
Plugin::callHook("vocal_command", array(&$response, YANA_URL));
$commands = array();
echo "\n" . 'Test de comparaison avec ' . count($response['commands']) . ' commandes';
foreach ($response['commands'] as $cmd) {
if ($command != $cmd['command']) {
continue;
}
if (!isset($cmd['parameters'])) {
$cmd['parameters'] = array();
}
if (isset($cmd['callback'])) {
echo "\n" . 'Commande trouvée, execution de la fonction plugin ' . $cmd['callback'];
call_user_func($cmd['callback'], $text, $confidence, $cmd['parameters']);
}
}
}
示例10: dash_monitoring_plugin_actions
function dash_monitoring_plugin_actions()
{
global $myUser, $_, $conf;
switch ($_['action']) {
case 'dash_monitoring_plugin_load':
if ($myUser == false) {
exit('Vous devez vous connecter pour cette action.');
}
header('Content-type: application/json');
$response = array();
switch ($_['bloc']) {
case 'ram':
$response['title'] = 'RAM';
$hdds = Monitoring::ram();
$response['content'] = '
<div style="width: 100%">
<canvas id="RAM_PIE"></canvas>
<br/><br/>
<ul class="graphic_pane">
<li class="pane_orange">
<h1>RAM UTILISEE</h1>
<h2>' . $hdds['percentage'] . '%</h2>
</li><li class="pane_cyan">
<h1>RAM LIBRE</h1>
<h2>' . $hdds['free'] . ' Mo</h2>
</li><li class="pane_red">
<h1>RAM TOTALE</h1>
<h2>' . $hdds['total'] . ' Mo</h2>
</li>
</ul>
</div>
<script>
$("#RAM_PIE:visible").chart({
type : "doughnut",
label : ["RAM UTILISEE","RAM LIBRE"],
backgroundColor : ["' . ($hdds['percentage'] > 80 ? '#E64C65' : '#FCB150') . '","#4FC4F6"],
segmentShowStroke:false,
data : [' . $hdds['percentage'] . ',' . (100 - $hdds['percentage']) . ']
});
</script>';
break;
case 'system':
$response['title'] = 'Système';
if (PHP_OS != 'WINNT') {
$heat = Monitoring::heat();
$cpu = Monitoring::cpu();
}
$response['content'] = '<ul>
<li><strong>Distribution :</strong> ' . Monitoring::distribution() . '</li>
<li><strong>Kernel :</strong> ' . Monitoring::kernel() . '</li>
<li><strong>HostName :</strong> ' . Monitoring::hostname() . '</li>
<li><strong>Température :</strong> <span class="label ' . $heat["label"] . '">' . $heat["degrees"] . '°C</span></li>
<li><strong>Temps de marche :</strong> ' . Monitoring::uptime() . '</li>
<li><strong>CPU :</strong> <span class="label label-info">' . $cpu['current_frequency'] . ' Mhz</span> (Max ' . $cpu['maximum_frequency'] . ' Mhz/ Min ' . $cpu['minimum_frequency'] . ' Mhz)</li>
<li><strong>Charge :</strong> <span class="label label-info">' . $cpu['loads'] . ' </span> | ' . $cpu['loads5'] . ' 5min | ' . $cpu['loads15'] . ' 15min</li>
<li><strong>Version WiringPi : </strong> ' . exec("gpio -v | grep 'gpio version' | cut -c15-") . '</li>
<li><strong>Raspberry Pi Details : </strong> ' . exec("gpio -v") . '</li>
</ul>';
break;
case 'vocal':
if ($myUser->getId() == '') {
exit('{"error":"invalid or missing token"}');
}
if (!$myUser->can('vocal', 'r')) {
exit('{"error":"insufficient permissions for this account"}');
}
list($host, $port) = explode(':', $_SERVER['HTTP_HOST']);
$actionUrl = 'http://' . $host . ':' . $_SERVER['SERVER_PORT'] . $_SERVER['REQUEST_URI'];
$actionUrl = substr($actionUrl, 0, strpos($actionUrl, '?'));
Plugin::callHook("vocal_command", array(&$response, $actionUrl));
$response['title'] = count($response['commands']) . ' Commandes vocales';
$response['content'] = '<ul>';
foreach ($response['commands'] as $command) {
$response['content'] .= '<li title="Sensibilité : ' . $command['confidence'] . '">' . $command['command'] . '</li>';
}
$response['content'] .= '</ul>';
break;
case 'network':
$response['title'] = 'Réseau';
$ethernet = array();
$lan = '';
$wan = '';
$http = '';
$connections = '';
if (PHP_OS != 'WINNT') {
$ethernet = Monitoring::ethernet();
$lan = Monitoring::internalIp();
$wan = Monitoring::externalIp();
$http = Monitoring::webServer();
$connections = Monitoring::connections();
}
$response['content'] = '<ul>
<li><strong>IP LAN :</strong> <code>' . $lan . '</code></li>
<li><strong>IP WAN :</strong> <code>' . $wan . '</code></li>
<li><strong>Serveur HTTP :</strong> ' . $http . '</li>
<li><strong>Ethernet :</strong> ' . $ethernet['up'] . ' Montant / ' . $ethernet['down'] . ' Descendant</li>
<li><strong>Connexions :</strong> <span class="label label-info">' . $connections . '</span></li>
//.........这里部分代码省略.........
示例11: Event
exit;
}
// chargement du content de l'article souhaité
$newEvent = new Event();
$event = $newEvent->getById($_['event_id']);
if ($_['articleDisplayMode'] == 'content') {
//error_log(print_r($_SESSION['events'],true));
$content = $event->getContent();
} else {
$content = $event->getDescription();
}
echo $content;
break;
default:
require_once "SimplePie.class.php";
Plugin::callHook("action_post_case", array(&$_, $myUser));
//exit('0');
break;
//Installation d'un nouveau plugin
//Installation d'un nouveau plugin
case 'installPlugin':
$tempZipName = 'plugins/' . md5(microtime());
echo '<br/>Téléchargement du plugin...';
file_put_contents($tempZipName, file_get_contents(urldecode($_['zip'])));
if (file_exists($tempZipName)) {
echo '<br/>Plugin téléchargé <span class="label label-success">OK</span>';
echo '<br/>Extraction du plugin...';
$zip = new ZipArchive();
$res = $zip->open($tempZipName);
if ($res === TRUE) {
$tempZipFolder = $tempZipName . '_';
示例12: array
</button></li>
<li><button <?php
if ($event->getFavorite()) {
?>
class="eventFavorite"<?php
}
?>
onclick="favorize(this,<?php
echo $_GET['event'] . ',\'' . $rootPath . '\'';
?>
);"><?php
echo !$event->getFavorite() ? 'Favoriser' : 'Défavoriser';
?>
</button></li>
<?php
Plugin::callHook("leed_browser_toolbar", array(&$events));
?>
<li><button onclick="window.location='<?php
echo $_GET['link'];
?>
';">Sortir</button></li>
</ul>
</div>
<iframe id="browser-content" src="<?php
echo $_GET['link'];
?>
"></iframe>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
<script src="js/main.js"></script>
</body>
</html>
示例13: preference_plugin_page
function preference_plugin_page()
{
global $myUser, $_;
if (isset($_['section']) && $_['section'] == 'preference' || !isset($_['section'])) {
if ($myUser != false) {
?>
<div class="span9 userBloc">
<h1>Préférence</h1>
<p>Gestion des préférences du programme</p>
<ul class="nav nav-tabs">
<li <?php
echo isset($_['block']) && $_['block'] == 'global' ? 'class="active"' : '';
?>
><a href="setting.php?section=preference&block=global"><i class="fa fa-angle-right"></i> Général</a></li>
<?php
Plugin::callHook("preference_menu", array());
?>
</ul>
<?php
if (isset($_['section']) && $_['section'] == 'preference' && @$_['block'] == 'global' || !isset($_['section'])) {
if ($myUser != false) {
?>
<div class="span9 userBloc">
<table class="table table-striped table-bordered" id="setting_table">
<tr><th>Clé</th><th>Valeur</th><tr>
<?php
$conf = new Configuration();
$confs = $conf->populate();
foreach ($confs as $value) {
$ns = 'conf';
$key = $value->getKey();
$infos = explode(':', $key);
if (count($infos) == 2) {
list($ns, $key) = $infos;
}
if ($ns != 'conf') {
continue;
}
echo '<tr><td>' . $key . '</td><td><input class="input-xxlarge" type="text" value="' . $value->getValue() . '" id="' . $value->getId() . '"></td></tr>';
}
?>
<tr><td colspan="2"><button type="submit" onclick="save_settings();" class="btn">Modifier</button></td></tr>
</table>
</div>
<?php
} else {
?>
<div id="main" class="wrapper clearfix">
<article>
<h3>Vous devez être connecté</h3>
</article>
</div>
<?php
}
}
Plugin::callHook("preference_content", array());
?>
</div>
<?php
} else {
?>
<div id="main" class="wrapper clearfix">
<article>
<h3>Vous devez être connecté</h3>
</article>
</div>
<?php
}
}
}
示例14: array
<?php
require_once 'header.php';
Plugin::callHook("index_pre_treatment", array(&$_));
if (!$myUser) {
$view = 'login';
} else {
$view = 'index';
//if($conf->get('HOME_PAGE') != '' && $conf->get('HOME_PAGE')!='index.php')
//header('location: '.$conf->get('HOME_PAGE'));
}
require_once 'footer.php';
示例15: dashboard_plugin_actions
function dashboard_plugin_actions()
{
global $myUser, $_, $conf;
switch ($_['action']) {
case 'GET_WIDGETS':
header('Content-type: application/json');
require_once dirname(__FILE__) . '/Dashboard.class.php';
require_once dirname(__FILE__) . '/Widget.class.php';
$dashManager = new Dashboard();
$dashManager->change(array('default' => '0'));
$dashManager->change(array('default' => '1'), array('id' => $_['dashboard']));
$widgetManager = new Widget();
$model = array();
Plugin::callHook("widgets", array(&$model));
$widgets = $widgetManager->loadAll(array('dashboard' => $_['dashboard']), 'cell');
$data = array();
foreach ($widgets as $widget) {
$data[] = array('data' => $widget->data, 'column' => $widget->column, 'id' => $widget->id, 'cell' => $widget->cell, 'minified' => $widget->minified, 'model' => $widget->model);
}
echo json_encode(array('model' => $model, 'data' => $data));
break;
case 'ADD_WIDGET':
header('Content-type: application/json');
require_once dirname(__FILE__) . '/Widget.class.php';
$response = array();
$widget = new Widget();
$widget->data = json_encode($_POST['data']);
$widget->column = $_['column'];
$widget->cell = $_['cell'];
$widget->model = $_['model'];
$widget->dashboard = $_['view'];
$widget->save();
$response['id'] = $widget->id;
echo json_encode($response);
break;
case 'MINIMIZE_WIDGET':
header('Content-type: application/json');
require_once dirname(__FILE__) . '/Widget.class.php';
$response = array();
$widgetManager = new Widget();
$widgetManager = $widgetManager->getById($_['id']);
$widgetManager->minified = 1;
$widgetManager->save();
echo json_encode($response);
break;
case 'MAXIMIZE_WIDGET':
header('Content-type: application/json');
require_once dirname(__FILE__) . '/Widget.class.php';
$response = array();
$widgetManager = new Widget();
$widgetManager = $widgetManager->getById($_['id']);
$widgetManager->minified = 0;
$widgetManager->save();
echo json_encode($response);
break;
case 'MOVE_WIDGET':
header('Content-type: application/json');
require_once dirname(__FILE__) . '/Widget.class.php';
$response = array();
$widgetManager = new Widget();
foreach ($_['sort']['cells'] as $id => $sort) {
$widgetManager->change(array('cell' => $sort['cell'], 'column' => $sort['column']), array('id' => $id));
}
echo json_encode($response);
break;
case 'DELETE_WIDGET':
header('Content-type: application/json');
require_once dirname(__FILE__) . '/Widget.class.php';
$response = array();
$widgetManager = new Widget();
$widgetManager->delete(array('id' => $_['id']));
echo json_encode($response);
break;
case 'DASH_ADD_VIEW':
global $_, $myUser;
require_once dirname(__FILE__) . '/Dashboard.class.php';
$entity = new Dashboard();
$entity->user = $myUser->getId();
$entity->label = $_['viewName'];
$entity->default = 0;
$entity->save();
header('location: setting.php?section=preference&block=dashboard');
break;
case 'DASH_DELETE_VIEW':
global $_, $myUser;
require_once dirname(__FILE__) . '/Dashboard.class.php';
$entity = new Dashboard();
$entity->delete(array('id' => $_['id']));
header('location: setting.php?section=preference&block=dashboard');
break;
}
}