Example #1
0
 /**
  * Get currently active modules
  *
  * @return array
  * @static 
  */
 public static function getActiveModules()
 {
     // Nifty little bit of caching to save a database query or two (or fifty). If the active
     // modules are not already stored then get them from the DB and cache them using the
     // static keyword variable.
     if (is_null(self::$activeModules)) {
         $sql = 'select * from modules where status="active" order by sort_order asc';
         $modules = Database::singleton()->query_fetch_all($sql);
         $active = array();
         foreach ($modules as $mod) {
             $active[$mod['id']] = $mod;
         }
         self::$activeModules = $active;
     }
     return self::$activeModules;
 }