Пример #1
0
 /**
  * Creates the category with the help of the interface class
  *
  * @param   array $user Holds the user data
  * @return  void
  * @since   1.5
  */
 protected function _createCategory($user)
 {
     // Get the interface
     require_once JPATH_ROOT . '/components/com_joomgallery/interface.php';
     $jinterface = new JoomInterface();
     // Create the category
     switch ($this->params->get('categoryname')) {
         case 0:
             if ($jinterface->getJConfig('jg_realname')) {
                 $category->name = $user['name'];
             } else {
                 $category->name = $user['username'];
             }
             break;
         case 1:
             $category->name = $user['name'];
             break;
         default:
             $category->name = $user['username'];
             break;
     }
     $category->owner = $user['id'];
     if ($parent = $this->params->get('parent')) {
         $category->parent_id = intval($parent);
     }
     if ($access = $this->params->get('access')) {
         $category->access = $access;
     }
     $category->published = $this->params->get('published');
     $jinterface->createCategory($category);
 }
Пример #2
0
 /**
  * Constructor
  *
  * @param   object  $params     backend parameters
  * @param   int     $module_id  the id of the module
  */
 public function __construct(&$params, $moduleid)
 {
     // Call the parent constructor
     parent::__construct();
     // Get the parameters
     $this->_getParams($params);
     // Include Javascripts if AJAX search activated
     if ($this->getConfig('ajaxsearch') == 1) {
         $searchurl = JURI::Base();
         $doc = JFactory::getDocument();
         // Include javascripts if not already done
         JHtml::_('behavior.framework', true);
         $doc->addScript(JURI::base() . 'media/mod_joomsearch/mod_joomsearch.js');
         $jsstart = "    window.addEvent('domready', function(){\n        jsmod" . $moduleid . "=new JoomSearchModule({searchurl: '" . $searchurl . "', moduleid:" . $moduleid . ", noresultstxt:'" . JText::_('JSNORESULTS') . "', baseURL: '" . JURI::base() . "'});\n        jsmod" . $moduleid . ".initoptions();\n      });";
         $doc->addScriptDeclaration($jsstart);
     }
     // Include common css
     // TODO
     // #js_searchform and #js_searchresults
     // $doc->addStyleSheet(JURI::base().'modules/mod_joomsearch/assets/mod_joomsearch.css');
     // Generate and include css
     $this->_renderCSS($moduleid);
     // Check cookie and fill the params for user panel
     // first view = default backend parameters
     // or existing cookie vars
     $this->_checkCookie($moduleid);
 }