Inheritance: implements Gdn_IPlugin
Example #1
0
 public function testAllHooks()
 {
     $hooks = DashboardHooks::genHooks(array());
     return;
     $allhooks = array();
     foreach ($hooks as $page) {
         foreach ($page['entries'] as $item) {
             $allhooks[] = $item['func'];
         }
     }
     foreach ($allhooks as $hookname) {
         $this->assertNotNull(DashboardHooks::runHook($hookname), "Hook {$hookname} returned null");
     }
 }
Example #2
0
 public function ajaxHandler()
 {
     if (!class_exists('DashboardHooks')) {
         include 'classes/DashboardHooks.class.php';
     }
     switch ($_REQUEST['command']) {
         case "deletemessage":
             \FreePBX::create()->Notifications->safe_delete($_REQUEST['raw'], $_REQUEST['id']);
             return array("status" => true);
             break;
         case "resetmessage":
             \FreePBX::create()->Notifications->reset($_REQUEST['raw'], $_REQUEST['id']);
             return array("status" => true);
             break;
         case "saveorder":
             $this->setConfig('visualorder', $_REQUEST['order']);
             return array("status" => true);
             break;
         case "getcontent":
             if (file_exists(__DIR__ . '/sections/' . $_REQUEST['rawname'] . '.class.php')) {
                 include __DIR__ . '/sections/' . $_REQUEST['rawname'] . '.class.php';
                 $class = '\\FreePBX\\modules\\Dashboard\\Sections\\' . $_REQUEST['rawname'];
                 $class = new $class();
                 return array("status" => true, "content" => $class->getContent($_REQUEST['section']));
             } else {
                 return array("status" => false, "message" => "Missing Class Object!");
             }
             break;
         case "gethooks":
             if (!$this->getConfig('allhooks')) {
                 $this->doDialplanHook($foo = null, null, null);
                 // Avoid warnings.
             }
             // Remove next line to enable caching.
             // $this->doDialplanHook($foo = null, null, null); // Avoid warnings.
             $config = $this->getConfig('allhooks');
             $order = $this->getConfig('visualorder');
             if (!empty($order)) {
                 foreach ($config as &$page) {
                     $entries = array();
                     foreach ($page['entries'] as $k => $e) {
                         $o = isset($order[$e['section']]) ? $order[$e['section']] : $k;
                         $entries[$o] = $e;
                     }
                     ksort($entries);
                     $page['entries'] = $entries;
                 }
             }
             return $config;
             break;
         case "sysstat":
             if (!class_exists('Statistics')) {
                 include 'classes/Statistics.class.php';
             }
             $s = new Statistics();
             return $s->getStats();
             break;
         default:
             return DashboardHooks::runHook($_REQUEST['command']);
             break;
     }
 }
Example #3
0
<?php

// vim: set ai ts=4 sw=4 ft=phtml:
// New Dashboard
//	License for all code of this FreePBX module can be found in the license file inside the module directory
//	Copyright 2013 Schmooze Com Inc.
//
if (!class_exists('DashboardHooks')) {
    include 'classes/DashboardHooks.class.php';
}
$allhooks = DashboardHooks::genHooks(FreePBX::Dashboard()->getConfig('visualorder'));
FreePBX::Dashboard()->setConfig('allhooks', $allhooks);
show_view(__DIR__ . '/views/main.php', array("brand" => FREEPBX::Config()->get('DASHBOARD_FREEPBX_BRAND')));