예제 #1
0
 private function getModuleParams($moduleId)
 {
     static $params;
     if (!isset($params)) {
         $app = JFactory::getApplication();
         $clientid = (int) $app->getClientId();
         $userAccessLevels = JoaktreeHelper::getUserAccessLevels();
         if (!isset($moduleId) || $moduleId == 0) {
             $moduleId = JoaktreeHelper::getModuleId();
         } else {
             $moduleId = (int) $moduleId;
         }
         $query = $this->_db->getQuery(true);
         $query->select(' m.id ');
         $query->select(' m.params ');
         $query->from(' #__modules AS m ');
         $query->where(' m.published =  1 ');
         $query->where(' m.access    IN ' . $userAccessLevels . ' ');
         $query->where(' m.client_id =  ' . $clientid . ' ');
         $query->where(' m.module = ' . $this->_db->Quote('mod_joaktree_todaymanyyearsago') . ' ');
         $this->_db->setQuery($query);
         $temp = $this->_db->loadObjectList();
         $params = new JRegistry();
         foreach ($temp as $module) {
             if ($module->id == $moduleId) {
                 $params->loadString($module->params, 'JSON');
             }
         }
     }
     return $params;
 }