コード例 #1
0
ファイル: controller.php プロジェクト: adjaika/J3Base
 /**
  * Method to display a view.
  *
  * @param   boolean        $cachable   If true, the view output will be cached
  * @param   array|boolean  $urlparams  An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}
  *
  * @return  JController    This object to support chaining.
  *
  * @since   1.5
  */
 public function display($cachable = false, $urlparams = false)
 {
     $id = $this->input->getInt('id');
     $document = JFactory::getDocument();
     // For JSON requests
     if ($document->getType() == 'json') {
         $view = new ModulesViewModule();
         // Get/Create the model
         if ($model = new ModulesModelModule()) {
             // Checkin table entry
             if (!$model->checkout($id)) {
                 JFactory::getApplication()->enqueueMessage(JText::_('JLIB_APPLICATION_ERROR_CHECKIN_USER_MISMATCH'), 'error');
                 return false;
             }
             // Push the model into the view (as default)
             $view->setModel($model, true);
         }
         $view->document = $document;
         return $view->display();
     }
     JLoader::register('ModulesHelper', JPATH_ADMINISTRATOR . '/components/com_modules/helpers/modules.php');
     $layout = $this->input->get('layout', 'edit');
     $id = $this->input->getInt('id');
     // Check for edit form.
     if ($layout == 'edit' && !$this->checkEditId('com_modules.edit.module', $id)) {
         // Somehow the person just went to the form - we don't allow that.
         $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
         $this->setMessage($this->getError(), 'error');
         $this->setRedirect(JRoute::_('index.php?option=com_modules&view=modules', false));
         return false;
     }
     // Load the submenu.
     ModulesHelper::addSubmenu($this->input->get('view', 'modules'));
     return parent::display();
 }
コード例 #2
0
ファイル: controller.php プロジェクト: knigherrant/decopatio
 /**
  * Method to display a view.
  *
  * @param   boolean       $cachable  If true, the view output will be cached
  * @param   array|boolean $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}
  *
  * @return  JController    This object to support chaining.
  *
  * @since   1.5
  */
 public function display($cachable = false, $urlparams = false)
 {
     $view = $this->input->get('view', 'modules');
     $layout = $this->input->get('layout', 'default');
     $id = $this->input->getInt('id');
     $document = JFactory::getDocument();
     // For JSON requests
     if ($document->getType() == 'json') {
         $view = new ModulesViewModule();
         // Get/Create the model
         if ($model = new ModulesModelModule()) {
             // Checkin table entry
             if (!$model->checkout($id)) {
                 JFactory::getApplication()->enqueueMessage(JText::_('JLIB_APPLICATION_ERROR_CHECKIN_USER_MISMATCH'), 'error');
                 return false;
             }
             // Push the model into the view (as default)
             $view->setModel($model, true);
         }
         $view->document = $document;
         return $view->display();
     }
     require_once JPATH_COMPONENT . '/helpers/modules.php';
     // Load the submenu.
     ModulesHelper::addSubmenu($this->input->get('view', 'modules'));
     return parent::display();
 }
コード例 #3
0
ファイル: view.html.php プロジェクト: joebushi/joomla
 /**
  * Setup the Toolbar
  *
  * @since	1.6
  */
 protected function _setToolbar()
 {
     JRequest::setVar('hidemainmenu', true);
     $user = JFactory::getUser();
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
     $canDo = ModulesHelper::getActions($this->state->get('filter.category_id'), $this->item->id);
     $client = $this->get('client');
     JToolBarHelper::title(JText::_('Modules_Manager_Module'));
     if ($this->item->module == 'mod_custom') {
         JToolBarHelper::Preview('index.php?option=com_modules&tmpl=component&client=' . $client->id . '&pollid=' . $this->item->id);
     }
     // If not checked out, can save the item.
     if (!$checkedOut && $canDo->get('core.edit')) {
         JToolBarHelper::apply('module.apply', 'JToolbar_Apply');
         JToolBarHelper::save('module.save', 'JToolbar_Save');
         JToolBarHelper::addNew('module.save2new', 'JToolbar_Save_and_new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolBarHelper::custom('module.save2copy', 'copy.png', 'copy_f2.png', 'JToolbar_Save_as_Copy', false);
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('module.cancel', 'JToolbar_Cancel');
     } else {
         JToolBarHelper::cancel('module.cancel', 'JToolbar_Close');
     }
     JToolBarHelper::help('screen.module.edit');
 }
コード例 #4
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     $state = $this->get('State');
     $canDo = ModulesHelper::getActions();
     Toolbar::title(Lang::txt('COM_MODULES_MANAGER_MODULES'), 'module.png');
     if ($canDo->get('core.create')) {
         //Toolbar::addNew('module.add');
         Toolbar::appendButton('Popup', 'new', 'JTOOLBAR_NEW', 'index.php?option=com_modules&view=select&tmpl=component', 850, 400);
     }
     if ($canDo->get('core.edit')) {
         Toolbar::editList('module.edit');
     }
     if ($canDo->get('core.create')) {
         Toolbar::custom('modules.duplicate', 'copy.png', 'copy_f2.png', 'JTOOLBAR_DUPLICATE', true);
     }
     if ($canDo->get('core.edit.state')) {
         Toolbar::divider();
         Toolbar::publish('modules.publish', 'JTOOLBAR_PUBLISH', true);
         Toolbar::unpublish('modules.unpublish', 'JTOOLBAR_UNPUBLISH', true);
         Toolbar::divider();
         Toolbar::checkin('modules.checkin');
     }
     if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
         Toolbar::deleteList('', 'modules.delete', 'JTOOLBAR_EMPTY_TRASH');
         Toolbar::divider();
     } elseif ($canDo->get('core.edit.state')) {
         Toolbar::trash('modules.trash');
         Toolbar::divider();
     }
     if ($canDo->get('core.admin')) {
         Toolbar::preferences('com_modules');
         Toolbar::divider();
     }
     Toolbar::help('modules');
 }
コード例 #5
0
ファイル: view.html.php プロジェクト: joebushi/joomla
 /**
  * Setup the Toolbar.
  */
 protected function _setToolbar()
 {
     $state = $this->get('State');
     $canDo = ModulesHelper::getActions();
     JToolBarHelper::title(JText::_('Modules_Manager_Modules'), 'module.png');
     if ($canDo->get('core.create')) {
         //JToolBarHelper::addNew('module.add');
         $bar =& JToolBar::getInstance('toolbar');
         $bar->appendButton('Popup', 'new', 'New', 'index.php?option=com_modules&view=select&tmpl=component', 850, 400);
     }
     if ($canDo->get('core.edit')) {
         JToolBarHelper::editList('module.edit');
     }
     if ($canDo->get('core.create')) {
         JToolBarHelper::custom('modules.duplicate', 'copy.png', 'copy_f2.png', 'JToolbar_Duplicate', true);
     }
     if ($canDo->get('core.edit')) {
         JToolBarHelper::custom('modules.publish', 'publish.png', 'publish_f2.png', 'JToolbar_Enable', true);
         JToolBarHelper::custom('modules.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JToolbar_Disable', true);
     }
     if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
         JToolBarHelper::deleteList('', 'modules.delete');
     } else {
         if ($canDo->get('core.edit.state')) {
             JToolBarHelper::trash('modules.trash');
         }
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_modules');
     }
     JToolBarHelper::help('screen.module');
 }
コード例 #6
0
ファイル: controller.php プロジェクト: AxelFG/ckbran-inf
 /**
  * Method to display a view.
  *
  * @param	boolean			If true, the view output will be cached
  * @param	array			An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  *
  * @return	JController		This object to support chaining.
  * @since	1.5
  */
 public function display($cachable = false, $urlparams = false)
 {
     require_once JPATH_COMPONENT . '/helpers/modules.php';
     // Load the submenu.
     ModulesHelper::addSubmenu($this->input->get('view', 'modules'));
     $view = $this->input->get('view', 'modules');
     $layout = $this->input->get('layout', 'default');
     $id = $this->input->getInt('id');
     // Check for edit form.
     if ($view == 'module' && $layout == 'edit') {
         if (!$this->checkEditId('com_advancedmodules.edit.module', $id)) {
             // Somehow the person just went to the form - we don't allow that.
             $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
             $this->setMessage($this->getError(), 'error');
             $this->setRedirect(JRoute::_('index.php?option=com_advancedmodules&view=modules', false));
             return false;
         }
         // Check general edit permission first.
         if (!JFactory::getUser()->authorise('core.edit', 'com_advancedmodules.module.' . $id)) {
             $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
             $this->setMessage($this->getError(), 'error');
             $this->setRedirect(JRoute::_('index.php?option=com_advancedmodules&view=modules', false));
             return false;
         }
     }
     parent::display();
 }
コード例 #7
0
 /**
  * @param   int $clientId	The client id
  * @param   string $state 	The state of the template
  */
 public static function templates($clientId = 0, $state = '')
 {
     $templates = ModulesHelper::getTemplates($clientId, $state);
     foreach ($templates as $template) {
         $options[] = JHtml::_('select.option', $template->element, $template->name);
     }
     return $options;
 }
コード例 #8
0
 /**
 * Method to display a view.
 *
 * @param   boolean         $cachable       If true, the view output will be cached
 * @param   array|boolean   $urlparams      An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}
 	.
 *
 * @return  JController        This object to support chaining.
 * @since   1.5
 */
 public function display($cachable = false, $urlparams = false)
 {
     require_once JPATH_COMPONENT . '/helpers/modules.php';
     // Load the submenu.
     ModulesHelper::addSubmenu($this->input->get('view', 'modules'));
     $view = $this->input->get('view', 'modules');
     $layout = $this->input->get('layout', 'default');
     $id = $this->input->getInt('id');
     return parent::display();
 }
コード例 #9
0
 /**
  * Add the page title and toolbar.
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $user = JFactory::getUser();
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
     $canDo = ModulesHelper::getActions($this->item->id);
     JToolbarHelper::title(JText::sprintf('COM_MODULES_MANAGER_MODULE', JText::_($this->item->module)), 'cube module');
     // For new records, check the create permission.
     if ($isNew && $canDo->get('core.create')) {
         JToolbarHelper::apply('module.apply');
         JToolbarHelper::save('module.save');
         JToolbarHelper::save2new('module.save2new');
         JToolbarHelper::cancel('module.cancel');
     } else {
         // Can't save the record if it's checked out.
         if (!$checkedOut) {
             // Since it's an existing record, check the edit permission.
             if ($canDo->get('core.edit')) {
                 JToolbarHelper::apply('module.apply');
                 JToolbarHelper::save('module.save');
                 // We can save this record, but check the create permission to see if we can return to make a new one.
                 if ($canDo->get('core.create')) {
                     JToolbarHelper::save2new('module.save2new');
                 }
             }
         }
         // If checked out, we can still save
         if ($canDo->get('core.create')) {
             JToolbarHelper::save2copy('module.save2copy');
         }
         JToolbarHelper::cancel('module.cancel', 'JTOOLBAR_CLOSE');
     }
     // Get the help information for the menu item.
     $lang = JFactory::getLanguage();
     $help = $this->get('Help');
     if ($lang->hasKey($help->url)) {
         $debug = $lang->setDebug(false);
         $url = JText::_($help->url);
         $lang->setDebug($debug);
     } else {
         $url = null;
     }
     JToolbarHelper::help($help->key, false, $url);
 }
コード例 #10
0
ファイル: controller.php プロジェクト: carmerin/cesae-web
 /**
  * Method to display a view.
  *
  * @param	boolean			If true, the view output will be cached
  * @param	array			An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  *
  * @return	JController		This object to support chaining.
  * @since	1.5
  */
 public function display($cachable = false, $urlparams = false)
 {
     require_once JPATH_COMPONENT . '/helpers/modules.php';
     // Load the submenu.
     ModulesHelper::addSubmenu(JRequest::getCmd('view', 'modules'));
     $view = JRequest::getCmd('view', 'modules');
     $layout = JRequest::getCmd('layout', 'default');
     $id = JRequest::getInt('id');
     // Check for edit form.
     if ($view == 'module' && $layout == 'edit' && !$this->checkEditId('com_modules.edit.module', $id)) {
         // Somehow the person just went to the form - we don't allow that.
         $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
         $this->setMessage($this->getError(), 'error');
         $this->setRedirect(JRoute::_('index.php?option=com_modules&view=modules', false));
         return false;
     }
     parent::display();
 }
コード例 #11
0
 /**
  * Method to get the templates module styles.
  *
  * @return  array  The array of styles, grouped by templates.
  *
  * @since   3.0
  */
 protected function getTemplateModuleStyles()
 {
     $moduleStyles = array();
     $templates = array($this->getSystemTemplate());
     $templates = array_merge($templates, ModulesHelper::getTemplates('site'));
     foreach ($templates as $template) {
         $modulesFilePath = JPATH_SITE . '/templates/' . $template->element . '/html/modules.php';
         // Is there modules.php for that template?
         if (file_exists($modulesFilePath)) {
             $modulesFileData = file_get_contents($modulesFilePath);
             preg_match_all('/function[\\s\\t]*modChrome\\_([a-z0-9\\-\\_]*)[\\s\\t]*\\(/i', $modulesFileData, $styles);
             if (!array_key_exists($template->element, $moduleStyles)) {
                 $moduleStyles[$template->element] = array();
             }
             $moduleStyles[$template->element] = $styles[1];
         }
     }
     return $moduleStyles;
 }
コード例 #12
0
ファイル: controller.php プロジェクト: TeamCodeStudio/fpmoz
 /**
  * Method to display a view.
  *
  * @param bool $cachable
  * @param bool $urlparams
  *
  * @internal param \If $boolean true, the view output will be cached
  * @internal param \An $array array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  *
  * @return    JController        This object to support chaining.
  * @since    1.5
  */
 public function display($cachable = false, $urlparams = false)
 {
     require_once JPATH_ADMINISTRATOR . '/components/com_modules/helpers/modules.php';
     // Load the submenu.
     ModulesHelper::addSubmenu(JFactory::getApplication()->input->getCmd('view', 'modules'));
     $view = JFactory::getApplication()->input->getCmd('view', 'modules');
     $layout = JFactory::getApplication()->input->getCmd('layout', 'default');
     $id = JFactory::getApplication()->input->getInt('id', null);
     // Check for edit form.
     if ($view == 'module' && $layout == 'edit' && !$this->checkEditId('com_roksprocket.edit.module', $id)) {
         // Somehow the person just went to the form - we don't allow that.
         $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
         $this->setMessage($this->getError(), 'error');
         $this->setRedirect(JRoute::_(sprintf('index.php?option=%s&view=modules', RokSprocket_Helper::getRedirectionOption()), false));
         return false;
     }
     if (RokCommon_Session::get('roksprocket.' . $id, false)) {
         RokCommon_Session::clear('roksprocket.' . $id);
     }
     parent::display();
 }
コード例 #13
0
ファイル: view.html.php プロジェクト: akksi/jcg
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     $state = $this->get('State');
     $canDo = ModulesHelper::getActions();
     JToolBarHelper::title(JText::_('COM_MODULES_MANAGER_MODULES'), 'module.png');
     if ($canDo->get('core.create')) {
         //JToolBarHelper::addNew('module.add');
         $bar = JToolBar::getInstance('toolbar');
         $bar->appendButton('Popup', 'new', 'JTOOLBAR_NEW', 'index.php?option=com_modules&view=select&tmpl=component', 850, 400);
     }
     if ($canDo->get('core.edit')) {
         JToolBarHelper::editList('module.edit', 'JTOOLBAR_EDIT');
     }
     if ($canDo->get('core.create')) {
         JToolBarHelper::custom('modules.duplicate', 'copy.png', 'copy_f2.png', 'JTOOLBAR_DUPLICATE', true);
     }
     if ($canDo->get('core.edit.state')) {
         JToolBarHelper::divider();
         JToolBarHelper::custom('modules.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
         JToolBarHelper::custom('modules.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true);
         JToolBarHelper::divider();
         JToolBarHelper::custom('modules.checkin', 'checkin.png', 'checkin_f2.png', 'JTOOLBAR_CHECKIN', true);
     }
     if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
         JToolBarHelper::deleteList('', 'modules.delete', 'JTOOLBAR_EMPTY_TRASH');
         JToolBarHelper::divider();
     } else {
         if ($canDo->get('core.edit.state')) {
             JToolBarHelper::trash('modules.trash', 'JTOOLBAR_TRASH');
             JToolBarHelper::divider();
         }
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_modules');
         JToolBarHelper::divider();
     }
     JToolBarHelper::help('JHELP_EXTENSIONS_MODULE_MANAGER');
 }
コード例 #14
0
ファイル: view.html.php プロジェクト: Nechoj23/SVI-Homepage
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     JRequest::setVar('hidemainmenu', true);
     $user = JFactory::getUser();
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
     $canDo = ModulesHelper::getActions($this->state->get('filter.category_id'), $this->item->id);
     $item = $this->get('Item');
     JToolBarHelper::title(JText::sprintf('COM_MODULES_MANAGER_MODULE', JText::_($this->item->module)), 'module.png');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
         JToolBarHelper::apply('module.apply');
         JToolBarHelper::save('module.save');
     }
     if (!$checkedOut && $canDo->get('core.create')) {
         JToolBarHelper::save2new('module.save2new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolBarHelper::save2copy('module.save2copy');
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('module.cancel');
     } else {
         JToolBarHelper::cancel('module.cancel', 'JTOOLBAR_CLOSE');
     }
     // Get the help information for the menu item.
     $lang = JFactory::getLanguage();
     $help = $this->get('Help');
     if ($lang->hasKey($help->url)) {
         $debug = $lang->setDebug(false);
         $url = JText::_($help->url);
         $lang->setDebug($debug);
     } else {
         $url = null;
     }
     JToolBarHelper::help($help->key, false, $url);
 }
コード例 #15
0
ファイル: controller.php プロジェクト: joebushi/joomla
 /**
  * Method to display a view.
  */
 public function display()
 {
     require_once JPATH_COMPONENT . '/helpers/modules.php';
     // Get the document object.
     $document = JFactory::getDocument();
     // Set the default view name and format from the Request.
     $vName = JRequest::getWord('view', 'modules');
     $vFormat = $document->getType();
     $lName = JRequest::getWord('layout', 'default');
     // Get and render the view.
     if ($view =& $this->getView($vName, $vFormat)) {
         // Get the model for the view.
         $model =& $this->getModel($vName);
         // Push the model into the view (as default).
         $view->setModel($model, true);
         $view->setLayout($lName);
         // Push document object into the view.
         $view->assignRef('document', $document);
         $view->display();
         // Load the submenu.
         ModulesHelper::addSubmenu($vName);
     }
 }
コード例 #16
0
 /**
  * Display a batch widget for the module position selector.
  *
  * @param   integer  $clientId          The client ID.
  * @param   integer  $state             The state of the module (enabled, unenabled, trashed).
  * @param   string   $selectedPosition  The currently selected position for the module.
  *
  * @return  string   The necessary positions for the widget.
  *
  * @since   2.5
  */
 public static function positions($clientId, $state = 1, $selectedPosition = '')
 {
     require_once JPATH_ADMINISTRATOR . '/components/com_templates/helpers/templates.php';
     $templates = array_keys(ModulesHelper::getTemplates($clientId, $state));
     $templateGroups = array();
     // Add an empty value to be able to deselect a module position
     $option = ModulesHelper::createOption();
     $templateGroups[''] = ModulesHelper::createOptionGroup('', array($option));
     // Add positions from templates
     $isTemplatePosition = false;
     foreach ($templates as $template) {
         $options = array();
         $positions = TemplatesHelper::getPositions($clientId, $template);
         if (is_array($positions)) {
             foreach ($positions as $position) {
                 $text = ModulesHelper::getTranslatedModulePosition($clientId, $template, $position) . ' [' . $position . ']';
                 $options[] = ModulesHelper::createOption($position, $text);
                 if (!$isTemplatePosition && $selectedPosition === $position) {
                     $isTemplatePosition = true;
                 }
             }
         }
         $templateGroups[$template] = ModulesHelper::createOptionGroup(ucfirst($template), $options);
     }
     // Add custom position to options
     $customGroupText = JText::_('COM_MODULES_CUSTOM_POSITION');
     $editPositions = true;
     $customPositions = ModulesHelper::getPositions($clientId, $editPositions);
     $templateGroups[$customGroupText] = ModulesHelper::createOptionGroup($customGroupText, $customPositions);
     return $templateGroups;
 }
コード例 #17
0
ファイル: view.html.php プロジェクト: AxelFG/ckbran-inf
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     $state = $this->get('State');
     $canDo = ModulesHelper::getActions();
     // Get the toolbar object instance
     $bar = JToolBar::getInstance('toolbar');
     JToolbarHelper::title(JText::_($this->config->list_title ? 'COM_MODULES_MANAGER_MODULES' : 'AMM_ADVANCED_MODULES_MANAGER'), 'module.png');
     if ($canDo->get('core.create')) {
         $title = JText::_('JTOOLBAR_NEW');
         $dhtml = "<button onClick=\"location.href='index.php?option=com_advancedmodules&amp;view=select'\" class=\"btn btn-small btn-success\">\n\t\t\t\t\t\t<i class=\"icon-plus icon-white\" title=\"{$title}\"></i>\n\t\t\t\t\t\t{$title}</button>";
         $bar->appendButton('Custom', $dhtml, 'new');
     }
     if ($canDo->get('core.edit')) {
         JToolbarHelper::editList('module.edit');
     }
     if ($canDo->get('core.create')) {
         JToolbarHelper::custom('modules.duplicate', 'copy.png', 'copy_f2.png', 'JTOOLBAR_DUPLICATE', true);
     }
     if ($canDo->get('core.edit.state')) {
         JToolbarHelper::publish('modules.publish', 'JTOOLBAR_PUBLISH', true);
         JToolbarHelper::unpublish('modules.unpublish', 'JTOOLBAR_UNPUBLISH', true);
         JToolbarHelper::checkin('modules.checkin');
     }
     if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
         JToolbarHelper::deleteList('', 'modules.delete', 'JTOOLBAR_EMPTY_TRASH');
     } elseif ($canDo->get('core.edit.state')) {
         JToolbarHelper::trash('modules.trash');
     }
     // Add a batch button
     if ($canDo->get('core.edit')) {
         JHtml::_('bootstrap.modal', 'collapseModal');
         $title = JText::_('JTOOLBAR_BATCH');
         $dhtml = "<button data-toggle=\"modal\" data-target=\"#collapseModal\" class=\"btn btn-small\">\n\t\t\t\t\t\t<i class=\"icon-checkbox-partial\" title=\"{$title}\"></i>\n\t\t\t\t\t\t{$title}</button>";
         $bar->appendButton('Custom', $dhtml, 'batch');
     }
     if ($canDo->get('core.admin')) {
         JToolbarHelper::preferences('com_advancedmodules', 600, 900);
     }
     JToolbarHelper::help('JHELP_EXTENSIONS_MODULE_MANAGER');
     JHtmlSidebar::addEntry(JText::_('JSITE'), 'index.php?option=com_advancedmodules&filter_client_id=0', $this->state->get('filter.client_id') == 0);
     JHtmlSidebar::addEntry(JText::_('JADMINISTRATOR'), 'index.php?option=com_advancedmodules&filter_client_id=1', $this->state->get('filter.client_id') == 1);
     JHtmlSidebar::setAction('index.php?option=com_modules');
     JHtmlSidebar::addFilter('', 'filter_client_id', JHtml::_('select.options', ModulesHelper::getClientOptions(), 'value', 'text', $this->state->get('filter.client_id')), false);
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_state', JHtml::_('select.options', ModulesHelper::getStateOptions(), 'value', 'text', $this->state->get('filter.state')));
     JHtmlSidebar::addFilter(JText::_('COM_MODULES_OPTION_SELECT_POSITION'), 'filter_position', JHtml::_('select.options', ModulesHelper::getPositions($this->state->get('filter.client_id')), 'value', 'text', $this->state->get('filter.position')));
     JHtmlSidebar::addFilter(JText::_('COM_MODULES_OPTION_SELECT_MODULE'), 'filter_module', JHtml::_('select.options', ModulesHelper::getModules($this->state->get('filter.client_id')), 'value', 'text', $this->state->get('filter.module')));
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_ACCESS'), 'filter_access', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')));
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_LANGUAGE'), 'filter_language', JHtml::_('select.options', JHtml::_('contentlanguage.existing', true, true), 'value', 'text', $this->state->get('filter.language')));
     $this->sidebar = JHtmlSidebar::render();
 }
コード例 #18
0
			}
		</script>

		<fieldset class="adminform">
			<legend><?php 
echo JText::_('COM_MODULES_MENU_ASSIGNMENT');
?>
</legend>
			<label id="jform_menus-lbl" for="jform_menus"><?php 
echo JText::_('COM_MODULES_MODULE_ASSIGN');
?>
</label>

			<fieldset id="jform_menus" class="radio">
				<?php 
$options = ModulesHelper::getAssignmentOptions($that->item->client_id);
$displayValue = $displayText = $list = "";
foreach ($options as $option) {
    $text = JText::_($option->text);
    if ((string) $that->item->assignment == (string) $option->value) {
        $displayValue = $option->value;
        $displayText = $text;
    }
    $list .= '<li data-value="' . $option->value . '" data-text="' . $text . '" data-icon="" data-dynamic="">' . "\n";
    $list .= '	<a href="#"><span>' . $text . '</span></a>' . "\n";
    $list .= '</li>' . "\n";
}
?>
				<div class="sprocket-dropdown">
					<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
						<span><?php 
コード例 #19
0
ファイル: modules.php プロジェクト: jdrzaic/joomla-dummy
 /**
  * Get list of module position.
  *
  * @param   integer  $clientId  Client ID.
  *
  * @return  array
  */
 static function getPositions($clientId)
 {
     jimport('joomla.filesystem.folder');
     try {
         $app = JFactory::getApplication('administrator');
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select('DISTINCT(position)');
         $query->from('#__modules');
         $query->where($db->quoteName('client_id') . ' = ' . (int) $clientId);
         $template = $app->getUserState('com_modules.modules.filter.template', null);
         if ($template) {
             $listPosition = ModulesHelper::getPositionsByTemplate();
             if (!empty($listPosition)) {
                 $query->where('position in (' . $listPosition . ')');
             }
         }
         $query->order('position');
         $db->setQuery($query);
         $positions = $db->loadColumn();
         $positions = is_array($positions) ? $positions : array();
     } catch (Exception $e) {
         throw $e;
     }
     // Build the list
     $options = array();
     foreach ($positions as $position) {
         if (!$position) {
             $options[] = JHtml::_('select.option', 'none', ':: ' . JText::_('JNONE') . ' ::');
         } else {
             $options[] = JHtml::_('select.option', $position, $position);
         }
     }
     return $options;
 }
コード例 #20
0
ファイル: view.html.php プロジェクト: jputz12/OneNow-Vshop
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     $state = $this->get('State');
     $canDo = JHelperContent::getActions('com_modules');
     $user = JFactory::getUser();
     // Get the toolbar object instance
     $bar = JToolBar::getInstance('toolbar');
     if ($this->config->list_title) {
         JToolbarHelper::title(JText::_('COM_MODULES_MANAGER_MODULES'), 'cube module');
     } else {
         JToolbarHelper::title(JText::_('AMM_ADVANCED_MODULE_MANAGER'), 'advancedmodulemanager icon-nonumber');
     }
     if ($canDo->get('core.create')) {
         // Instantiate a new JLayoutFile instance and render the layout
         $layout = new JLayoutFile('toolbar.newmodule');
         $bar->appendButton('Custom', $layout->render(array()), 'new');
     }
     if ($canDo->get('core.edit')) {
         JToolbarHelper::editList('module.edit');
     }
     if ($canDo->get('core.create')) {
         JToolbarHelper::custom('modules.duplicate', 'copy', 'copy_f2', 'JTOOLBAR_DUPLICATE', true);
     }
     if ($canDo->get('core.edit.state')) {
         JToolbarHelper::publish('modules.publish', 'JTOOLBAR_PUBLISH', true);
         JToolbarHelper::unpublish('modules.unpublish', 'JTOOLBAR_UNPUBLISH', true);
         JToolbarHelper::checkin('modules.checkin');
     }
     if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
         JToolbarHelper::deleteList('', 'modules.delete', 'JTOOLBAR_EMPTY_TRASH');
     } elseif ($canDo->get('core.edit.state')) {
         JToolbarHelper::trash('modules.trash');
     }
     // Add a batch button
     if ($user->authorise('core.create', 'com_modules') && $user->authorise('core.edit', 'com_modules') && $user->authorise('core.edit.state', 'com_modules')) {
         JHtml::_('bootstrap.modal', 'collapseModal');
         $title = JText::_('JTOOLBAR_BATCH');
         // Instantiate a new JLayoutFile instance and render the batch button
         $layout = new JLayoutFile('joomla.toolbar.batch');
         $dhtml = $layout->render(array('title' => $title));
         $bar->appendButton('Custom', $dhtml, 'batch');
     }
     if ($canDo->get('core.admin')) {
         JToolbarHelper::preferences('com_advancedmodules', 600, 900);
     }
     JToolbarHelper::help('JHELP_EXTENSIONS_MODULE_MANAGER');
     JHtmlSidebar::setAction('index.php?option=com_advancedmodules');
     JHtmlSidebar::addFilter(JText::_('NN_OPTION_SELECT_CLIENT'), 'filter_client_id', JHtml::_('select.options', ModulesHelper::getClientOptions(), 'value', 'text', $this->state->get('filter.client_id')), false);
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_state', JHtml::_('select.options', ModulesHelper::getStateOptions(), 'value', 'text', $this->state->get('filter.state')));
     JHtmlSidebar::addFilter(JText::_('COM_MODULES_OPTION_SELECT_POSITION'), 'filter_position', JHtml::_('select.options', ModulesHelper::getPositions($this->state->get('filter.client_id')), 'value', 'text', $this->state->get('filter.position')));
     JHtmlSidebar::addFilter(JText::_('COM_MODULES_OPTION_SELECT_MODULE'), 'filter_module', JHtml::_('select.options', ModulesHelper::getModules($this->state->get('filter.client_id')), 'value', 'text', $this->state->get('filter.module')));
     JHtmlSidebar::addFilter(JText::_('AMM_OPTION_SELECT_MENU_ID'), 'filter_menuid', JHtml::_('select.options', ModulesHelper::getMenuItemAssignmentOptions($this->state->get('filter.client_id')), 'value', 'text', $this->state->get('filter.menuid')));
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_ACCESS'), 'filter_access', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')));
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_LANGUAGE'), 'filter_language', JHtml::_('select.options', JHtml::_('contentlanguage.existing', true, true), 'value', 'text', $this->state->get('filter.language')));
     $this->sidebar = JHtmlSidebar::render();
 }
コード例 #21
0
ファイル: modules.php プロジェクト: jmangarret/webtuagencia24
    function render($type)
    {
        $sliders =& JPane::getInstance('sliders');
        echo $sliders->startPane('params');
        TranslateParams_xml::renderDoublecolumnParams($this->form, 'params', 'com_modules', $sliders);
        echo $sliders->endPane();
        // menu assignments
        // Initiasile related data.
        if (!class_exists('MenusHelper')) {
            JLoader::register('MenusHelper', JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php', true);
        }
        if (!class_exists('ModulesHelper')) {
            JLoader::register('ModulesHelper', JPATH_ADMINISTRATOR . '/components/com_modules/helpers/modules.php', true);
        }
        $menuTypes = MenusHelper::getMenuLinks();
        ?>
		<script type="text/javascript">
			window.addEvent('domready', function(){
				validate();
				document.getElements('select').addEvent('change', function(e){validate();});
			});
			function validate(){
				var value	= document.id('jform_assignment').value;
				var list	= document.id('menu-assignment');
				if(value == '-' || value == '0'){
					$$('.jform-assignments-button').each(function(el) {el.setProperty('disabled', true); });
					list.getElements('input').each(function(el){
						el.setProperty('disabled', true);
						if (value == '-'){
							el.setProperty('checked', false);
						} else {
							el.setProperty('checked', true);
						}
					});
				} else {
					$$('.jform-assignments-button').each(function(el) {el.setProperty('disabled', false); });
					list.getElements('input').each(function(el){
						el.setProperty('disabled', false);
					});
				}
			}
		</script>
		<div class="width-100 fltlft">
		<fieldset class="adminform">
			<legend><?php 
        echo JText::_('COM_MODULES_MENU_ASSIGNMENT');
        ?>
</legend>
			<label id="jform_menus-lbl" for="jform_menus"><?php 
        echo JText::_('COM_MODULES_MODULE_ASSIGN');
        ?>
</label>

			<fieldset id="jform_menus" class="radio">
				<select name="jform[assignment]" id="jform_assignment">
					<?php 
        echo JHtml::_('select.options', ModulesHelper::getAssignmentOptions($this->item->client_id), 'value', 'text', $this->item->assignment, true);
        ?>
				</select>

			</fieldset>

			<label id="jform_menuselect-lbl" for="jform_menuselect"><?php 
        echo JText::_('JGLOBAL_MENU_SELECTION');
        ?>
</label>

			<button type="button" class="jform-assignments-button jform-rightbtn" onclick="$$('.chk-menulink').each(function(el) { el.checked = !el.checked; });">
				<?php 
        echo JText::_('JGLOBAL_SELECTION_INVERT');
        ?>
			</button>

			<button type="button" class="jform-assignments-button jform-rightbtn" onclick="$$('.chk-menulink').each(function(el) { el.checked = false; });">
				<?php 
        echo JText::_('JGLOBAL_SELECTION_NONE');
        ?>
			</button>

			<button type="button" class="jform-assignments-button jform-rightbtn" onclick="$$('.chk-menulink').each(function(el) { el.checked = true; });">
				<?php 
        echo JText::_('JGLOBAL_SELECTION_ALL');
        ?>
			</button>

			<div class="clr"></div>

			<div id="menu-assignment">

			<?php 
        echo JHtml::_('tabs.start', 'module-menu-assignment-tabs', array('useCookie' => 1));
        ?>

			<?php 
        foreach ($menuTypes as &$type) {
            echo JHtml::_('tabs.panel', $type->title ? $type->title : $type->menutype, $type->menutype . '-details');
            $count = count($type->links);
            $i = 0;
            if ($count) {
                ?>
				<ul class="menu-links">
					<?php 
                foreach ($type->links as $link) {
                    if (trim($this->item->assignment) == '-') {
                        $checked = '';
                    } elseif ($this->item->assignment == 0) {
                        $checked = ' checked="checked"';
                    } elseif ($this->item->assignment < 0) {
                        $checked = in_array(-$link->value, $this->item->assigned) ? ' checked="checked"' : '';
                    } elseif ($this->item->assignment > 0) {
                        $checked = in_array($link->value, $this->item->assigned) ? ' checked="checked"' : '';
                    }
                    ?>
					<li class="menu-link">
						<input type="checkbox" class="chk-menulink" name="jform[assigned][]" value="<?php 
                    echo (int) $link->value;
                    ?>
" id="link<?php 
                    echo (int) $link->value;
                    ?>
"<?php 
                    echo $checked;
                    ?>
/>
						<label for="link<?php 
                    echo (int) $link->value;
                    ?>
">
							<?php 
                    echo $link->text;
                    ?>
						</label>
					</li>
					<?php 
                    if ($count > 20 && ++$i == ceil($count / 2)) {
                        ?>
					</ul><ul class="menu-links">
					<?php 
                    }
                    ?>
					<?php 
                }
                ?>
				</ul>
				<div class="clr"></div>
				<?php 
            }
            ?>
			<?php 
        }
        ?>

			<?php 
        echo JHtml::_('tabs.end');
        ?>

			</div>
		</fieldset>
		</div>
		<?php 
        return;
    }
コード例 #22
0
JHtml::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_modules/helpers/html');
$clientId = $this->item->client_id;
$appliedPosition = JRequest::getVar('position', '');
$templates = array_keys(ModulesHelper::getTemplates($clientId));
$templateGroups = array();
// Add an empty value to be able to deselect a module position
$option = ModulesHelper::createOption();
$templateGroups[''] = ModulesHelper::createOptionGroup('', array($option));
// Add positions from templates
$isTemplatePosition = false;
foreach ($templates as $template) {
    $options = array();
    $positions = TemplatesHelper::getPositions($clientId, $template);
    foreach ($positions as $position) {
        $text = ModulesHelper::getTranslatedModulePosition($clientId, $template, $position) . ' [' . $position . ']';
        $options[] = ModulesHelper::createOption($position, $text);
        if (!$isTemplatePosition && $this->item->position === $position) {
            $isTemplatePosition = true;
        }
    }
    $templateGroups[$template] = ModulesHelper::createOptionGroup(ucfirst($template), $options);
}
// Add custom position to options
$customGroupText = JText::_('COM_MODULES_CUSTOM_POSITION');
if (!empty($this->item->position) && !$isTemplatePosition) {
    $option = ModulesHelper::createOption($this->item->position);
    $templateGroups[$customGroupText] = ModulesHelper::createOptionGroup($customGroupText, array($option));
}
// Build field
$attr = array('id' => 'jform_position', 'list.select' => $appliedPosition);
echo JHtml::_('select.groupedlist', $templateGroups, 'jform[position]', $attr);
コード例 #23
0
ファイル: modules.php プロジェクト: jdrzaic/joomla-dummy
 /**
  * Build an SQL query to load the list data.
  *
  * @return	JDatabaseQuery
  */
 protected function getListQuery()
 {
     // Create a new query object.
     $db = $this->getDbo();
     $query = $db->getQuery(true);
     // Select the required fields from the table.
     $query->select($this->getState('list.select', 'a.id, a.title, a.note, a.position, a.module, a.language,' . 'a.checked_out, a.checked_out_time, a.published+2*(e.enabled-1) as published, a.access, a.ordering, a.publish_up, a.publish_down'));
     $query->from($db->quoteName('#__modules') . ' AS a');
     // Join over the language
     $query->select('l.title AS language_title');
     $query->join('LEFT', $db->quoteName('#__languages') . ' AS l ON l.lang_code = a.language');
     // Join over the users for the checked out user.
     $query->select('uc.name AS editor');
     $query->join('LEFT', '#__users AS uc ON uc.id=a.checked_out');
     // Join over the asset groups.
     $query->select('ag.title AS access_level');
     $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
     // Join over the module menus
     $query->select('MIN(mm.menuid) AS pages');
     $query->join('LEFT', '#__modules_menu AS mm ON mm.moduleid = a.id');
     // Join over the extensions
     $query->select('e.name AS name');
     $query->join('LEFT', '#__extensions AS e ON e.element = a.module');
     $query->group('a.id, a.title, a.note, a.position, a.module, a.language,a.checked_out,' . 'a.checked_out_time, a.published, a.access, a.ordering,l.title, uc.name, ag.title, e.name,' . 'l.lang_code, uc.id, ag.id, mm.moduleid, e.element, a.publish_up, a.publish_down,e.enabled');
     // Filter by access level.
     if ($access = $this->getState('filter.access')) {
         $query->where('a.access = ' . (int) $access);
     }
     // Filter by client.
     $clientId = $this->getState('filter.client_id');
     if (is_numeric($clientId)) {
         $query->where('a.client_id = ' . (int) $clientId . ' AND e.client_id =' . (int) $clientId);
     }
     // Filter by template
     $template = $this->getState('filter.template');
     if ($template) {
         $listPosition = ModulesHelper::getPositionsByTemplate();
         if (!empty($listPosition)) {
             $query->where('a.position in (' . $listPosition . ')');
         }
     }
     // Filter by published state
     $state = $this->getState('filter.state');
     if (is_numeric($state)) {
         $query->where('a.published = ' . (int) $state);
     } elseif ($state === '') {
         $query->where('(a.published IN (0, 1))');
     }
     // Filter by position
     $position = $this->getState('filter.position');
     if ($position && $position != 'none') {
         $query->where('a.position = ' . $db->Quote($position));
     } elseif ($position == 'none') {
         $query->where('a.position = ' . $db->Quote(''));
     }
     // Filter by module
     $module = $this->getState('filter.module');
     if ($module) {
         $query->where('a.module = ' . $db->Quote($module));
     }
     // Filter by search in title
     $search = $this->getState('filter.search');
     if (!empty($search)) {
         if (stripos($search, 'id:') === 0) {
             $query->where('a.id = ' . (int) substr($search, 3));
         } else {
             $search = $db->Quote('%' . $db->escape($search, true) . '%');
             $query->where('(' . 'a.title LIKE ' . $search . ' OR a.note LIKE ' . $search . ')');
         }
     }
     // Filter on the language.
     if ($language = $this->getState('filter.language')) {
         $query->where('a.language = ' . $db->quote($language));
     }
     //echo nl2br(str_replace('#__','jos_',$query));
     return $query;
 }
コード例 #24
0
		</script>

		<fieldset class="adminform">
			<legend><?php 
echo JText::_('COM_MODULES_MENU_ASSIGNMENT');
?>
</legend>
			<label id="jform_menus-lbl" for="jform_menus"><?php 
echo JText::_('COM_MODULES_MODULE_ASSIGN');
?>
</label>

			<fieldset id="jform_menus" class="radio">
				<select name="jform[assignment]" id="jform_assignment">
					<?php 
echo JHtml::_('select.options', ModulesHelper::getAssignmentOptions($this->item->client_id), 'value', 'text', $this->item->assignment, true);
?>
				</select>

			</fieldset>

			<label id="jform_menuselect-lbl" for="jform_menuselect"><?php 
echo JText::_('JGLOBAL_MENU_SELECTION');
?>
</label>

			<button type="button" class="jform-assignments-button jform-rightbtn" onclick="$$('.chkbox').each(function(el) { el.checked = !el.checked; });">
				<?php 
echo JText::_('JGLOBAL_SELECTION_INVERT');
?>
			</button>
コード例 #25
0
ファイル: default_batch.php プロジェクト: alxstuart/ajfs.me
<?php

/**
 * @package     Joomla.Administrator
 * @subpackage  com_modules
 *
 * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;
$clientId = $this->state->get('filter.client_id');
$published = $this->state->get('filter.published');
$positions = JHtml::_('modules.positions', $clientId, $published);
$positions['']['items'][] = ModulesHelper::createOption('nochange', JText::_('COM_MODULES_BATCH_POSITION_NOCHANGE'));
$positions['']['items'][] = ModulesHelper::createOption('noposition', JText::_('COM_MODULES_BATCH_POSITION_NOPOSITION'));
// Add custom position to options
$customGroupText = JText::_('COM_MODULES_CUSTOM_POSITION');
// Build field
$attr = array('id' => 'batch-position-id', 'list.attr' => 'class="chzn-custom-value input-xlarge" ' . 'data-custom_group_text="' . $customGroupText . '" ' . 'data-no_results_text="' . JText::_('COM_MODULES_ADD_CUSTOM_POSITION') . '" ' . 'data-placeholder="' . JText::_('COM_MODULES_TYPE_OR_SELECT_POSITION') . '" ');
?>
<div class="modal hide fade" id="collapseModal">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal">&#215;</button>
		<h3><?php 
echo JText::_('COM_MODULES_BATCH_OPTIONS');
?>
</h3>
	</div>
	<div class="modal-body">
		<p><?php 
echo JText::_('COM_MODULES_BATCH_TIP');
コード例 #26
0
ファイル: menuid.php プロジェクト: ranrolls/ras-full-portal
 protected function getOptions()
 {
     $model = new AdvancedModulesModelModules();
     $client_id = $model->getState('stfilter.client_id');
     return array_merge(JFormFieldList::getOptions(), ModulesHelper::getMenuItemAssignmentOptions($client_id));
 }
コード例 #27
0
ファイル: default.php プロジェクト: rvsjoen/joomla-cms
				<option value=""><?php 
echo JText::_('COM_MODULES_OPTION_SELECT_POSITION');
?>
</option>
				<?php 
echo JHtml::_('select.options', ModulesHelper::getPositions($this->state->get('filter.client_id')), 'value', 'text', $this->state->get('filter.position'));
?>
			</select>

            <select name="filter_module" class="inputbox" onchange="this.form.submit()">
				<option value=""><?php 
echo JText::_('COM_MODULES_OPTION_SELECT_MODULE');
?>
</option>
				<?php 
echo JHtml::_('select.options', ModulesHelper::getModules($this->state->get('filter.client_id')), 'value', 'text', $this->state->get('filter.module'));
?>
			</select>



			<select name="filter_access" class="inputbox" onchange="this.form.submit()">
				<option value=""><?php 
echo JText::_('JOPTION_SELECT_ACCESS');
?>
</option>
				<?php 
echo JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'));
?>
			</select>
コード例 #28
0
ファイル: modulesmodule.php プロジェクト: SysBind/joomla-cms
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  *
  * @since   3.4.2
  */
 public function getOptions()
 {
     $clientId = JFactory::getApplication()->input->get('client_id', 0, 'int');
     $options = ModulesHelper::getModules($clientId);
     return array_merge(parent::getOptions(), $options);
 }
コード例 #29
0
ファイル: positions.php プロジェクト: knigherrant/decopatio
 /**
  * Method to get an array of data items.
  *
  * @return  mixed  An array of data items on success, false on failure.
  *
  * @since   1.6
  */
 public function getItems()
 {
     if (!isset($this->items)) {
         $lang = JFactory::getLanguage();
         $search = trim($this->getState('filter.search'));
         $state = $this->getState('filter.state');
         $clientId = $this->getState('filter.client_id');
         $filter_template = $this->getState('filter.template');
         $type = $this->getState('filter.type');
         $ordering = $this->getState('list.ordering');
         $direction = $this->getState('list.direction');
         $limitstart = $this->getState('list.start');
         $limit = $this->getState('list.limit');
         $client = JApplicationHelper::getClientInfo($clientId);
         if ($type != 'template') {
             // Get the database object and a new query object.
             $query = $this->_db->getQuery(true)->select('DISTINCT(m.position) as value')->from('#__modules as m')->where('m.client_id = ' . (int) $clientId);
             if ($search) {
                 $search = $this->_db->quote('%' . str_replace(' ', '%', $this->_db->escape(trim($search), true) . '%'));
                 $query->where('m.position LIKE ' . $search);
             }
             $this->_db->setQuery($query);
             try {
                 $positions = $this->_db->loadObjectList('value');
             } catch (RuntimeException $e) {
                 $this->setError($e->getMessage());
                 return false;
             }
             foreach ($positions as $value => $position) {
                 $positions[$value] = array();
             }
         } else {
             $positions = array();
         }
         // Load the positions from the installed templates.
         foreach (ModulesHelper::getTemplates($clientId) as $template) {
             $path = JPath::clean($client->path . '/templates/' . $template->element . '/templateDetails.xml');
             if (file_exists($path)) {
                 $xml = simplexml_load_file($path);
                 if (isset($xml->positions[0])) {
                     $lang->load('tpl_' . $template->element . '.sys', $client->path, null, false, true) || $lang->load('tpl_' . $template->element . '.sys', $client->path . '/templates/' . $template->element, null, false, true);
                     foreach ($xml->positions[0] as $position) {
                         $value = (string) $position['value'];
                         $label = (string) $position;
                         if (!$value) {
                             $value = $label;
                             $label = preg_replace('/[^a-zA-Z0-9_\\-]/', '_', 'TPL_' . $template->element . '_POSITION_' . $value);
                             $altlabel = preg_replace('/[^a-zA-Z0-9_\\-]/', '_', 'COM_MODULES_POSITION_' . $value);
                             if (!$lang->hasKey($label) && $lang->hasKey($altlabel)) {
                                 $label = $altlabel;
                             }
                         }
                         if ($type == 'user' || $state != '' && $state != $template->enabled) {
                             unset($positions[$value]);
                         } elseif (preg_match(chr(1) . $search . chr(1) . 'i', $value) && ($filter_template == '' || $filter_template == $template->element)) {
                             if (!isset($positions[$value])) {
                                 $positions[$value] = array();
                             }
                             $positions[$value][$template->name] = $label;
                         }
                     }
                 }
             }
         }
         $this->total = count($positions);
         if ($limitstart >= $this->total) {
             $limitstart = $limitstart < $limit ? 0 : $limitstart - $limit;
             $this->setState('list.start', $limitstart);
         }
         if ($ordering == 'value') {
             if ($direction == 'asc') {
                 ksort($positions);
             } else {
                 krsort($positions);
             }
         } else {
             if ($direction == 'asc') {
                 asort($positions);
             } else {
                 arsort($positions);
             }
         }
         $this->items = array_slice($positions, $limitstart, $limit ? $limit : null);
     }
     return $this->items;
 }
コード例 #30
0
require_once JPATH_ADMINISTRATOR . '/components/com_templates/helpers/templates.php';
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
$clientId = $this->item->client_id;
$state = $this->state->get('filter.state');
$templates = array_keys(ModulesHelper::getTemplates($clientId, $state));
$templateGroups = array();
// Add an empty value to be able to deselect a module position
$option = ModulesHelper::createOption();
$templateGroups[''] = ModulesHelper::createOptionGroup('', array($option));
// Add positions from templates
$isTemplatePosition = false;
foreach ($templates as $template) {
    $options = array();
    $positions = TemplatesHelper::getPositions($clientId, $template);
    foreach ($positions as $position) {
        $text = ModulesHelper::getTranslatedModulePosition($clientId, $template, $position) . ' [' . $position . ']';
        $options[] = ModulesHelper::createOption($position, $text);
        if (!$isTemplatePosition && $this->item->position === $position) {
            $isTemplatePosition = true;
        }
    }
    $templateGroups[$template] = ModulesHelper::createOptionGroup(ucfirst($template), $options);
}
// Add custom position to options
$customGroupText = JText::_('COM_MODULES_CUSTOM_POSITION');
$editPositions = true;
$customPositions = ModulesHelper::getPositions($clientId, $editPositions);
$templateGroups[$customGroupText] = ModulesHelper::createOptionGroup($customGroupText, $customPositions);
// Build field
$attr = array('id' => 'jform_position', 'list.select' => $this->item->position, 'list.attr' => 'class="chzn-custom-value input-xlarge" ' . 'data-custom_group_text="' . $customGroupText . '" ' . 'data-no_results_text="' . JText::_('COM_MODULES_ADD_CUSTOM_POSITION') . '" ' . 'data-placeholder="' . JText::_('COM_MODULES_TYPE_OR_SELECT_POSITION') . '" ');
echo JHtml::_('select.groupedlist', $templateGroups, 'jform[position]', $attr);