function smarty_cms_function_module_available($params, &$template)
{
    $smarty = $template->smarty;
    $name = '';
    if (isset($params['name'])) {
        $name = trim($params['name']);
    }
    if (isset($params['m'])) {
        $name = trim($params['m']);
    }
    if (isset($params['module'])) {
        $name = trim($params['module']);
    }
    $out = FALSE;
    if ($name) {
        $out = cms_utils::module_available($name);
    }
    if (isset($params['assign'])) {
        $smarty->assign(trim($params['assign']), $out);
        return;
    }
    return $out;
}
Esempio n. 2
0
 /**
  * Get a list of all of the known events
  *
  * @return mixed If successful, a list of all the known events.  If it fails, false
  */
 public static function ListEvents()
 {
     $gCms = cmsms();
     $db = $gCms->GetDb();
     //$q = "SELECT * FROM ".cms_db_prefix()."events ORDER BY originator,event_name";
     $q = 'SELECT e.*, count(eh.event_id) as usage_count FROM ' . cms_db_prefix() . 'events e left outer join ' . cms_db_prefix() . 'event_handlers eh on e.event_id=eh.event_id GROUP BY e.event_id ORDER BY originator,event_name';
     $dbresult = $db->Execute($q);
     if ($dbresult == false) {
         return false;
     }
     $result = array();
     while ($row = $dbresult->FetchRow()) {
         if (!cms_utils::module_available($row['originator']) && $row['originator'] !== 'Core') {
             continue;
         }
         $result[] = $row;
     }
     return $result;
 }