Exemple #1
0
 /**
  * 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 = WeblinksHelper::getActions($this->state->get('filter.category_id'), $this->item->id);
     JToolBarHelper::title(JText::_('Weblinks_Manager_Weblink'));
     // If not checked out, can save the item.
     if (!$checkedOut && $canDo->get('core.edit')) {
         JToolBarHelper::apply('weblink.apply', 'JToolbar_Apply');
         JToolBarHelper::save('weblink.save', 'JToolbar_Save');
         JToolBarHelper::addNew('weblink.save2new', 'JToolbar_Save_and_new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolBarHelper::custom('weblink.save2copy', 'copy.png', 'copy_f2.png', 'JToolbar_Save_as_Copy', false);
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('weblink.cancel', 'JToolbar_Cancel');
     } else {
         JToolBarHelper::cancel('weblink.cancel', 'JToolbar_Close');
     }
     JToolBarHelper::divider();
     JToolBarHelper::help('screen.weblink.edit');
 }
Exemple #2
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     JRequest::setVar('hidemainmenu', true);
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
     // Since we don't track these assets at the item level, use the category id.
     $canDo = WeblinksHelper::getActions($this->item->catid, 0);
     JToolBarHelper::title(JText::_('COM_WEBLINKS_MANAGER_WEBLINK'), 'weblinks.png');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_weblinks', 'core.create')))) {
         JToolBarHelper::apply('weblink.apply');
         JToolBarHelper::save('weblink.save');
     }
     if (!$checkedOut && count($user->getAuthorisedCategories('com_weblinks', 'core.create'))) {
         JToolBarHelper::save2new('weblink.save2new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && count($user->getAuthorisedCategories('com_weblinks', 'core.create')) > 0) {
         JToolBarHelper::save2copy('weblink.save2copy');
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('weblink.cancel');
     } else {
         JToolBarHelper::cancel('weblink.cancel', 'JTOOLBAR_CLOSE');
     }
     JToolBarHelper::divider();
     JToolBarHelper::help('JHELP_COMPONENTS_WEBLINKS_LINKS_EDIT');
 }
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/weblinks.php';
     $state = $this->get('State');
     $canDo = WeblinksHelper::getActions($state->get('filter.category_id'));
     $user = JFactory::getUser();
     JToolBarHelper::title(JText::_('COM_WEBLINKS_MANAGER_WEBLINKS'), 'weblinks.png');
     if (count($user->getAuthorisedCategories('com_weblinks', 'core.create')) > 0) {
         JToolBarHelper::addNew('weblink.add');
     }
     if ($canDo->get('core.edit')) {
         JToolBarHelper::editList('weblink.edit');
     }
     if ($canDo->get('core.edit.state')) {
         JToolBarHelper::divider();
         JToolBarHelper::publish('weblinks.publish', 'JTOOLBAR_PUBLISH', true);
         JToolBarHelper::unpublish('weblinks.unpublish', 'JTOOLBAR_UNPUBLISH', true);
         JToolBarHelper::divider();
         JToolBarHelper::archiveList('weblinks.archive');
         JToolBarHelper::checkin('weblinks.checkin');
     }
     if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
         JToolBarHelper::deleteList('', 'weblinks.delete', 'JTOOLBAR_EMPTY_TRASH');
         JToolBarHelper::divider();
     } elseif ($canDo->get('core.edit.state')) {
         JToolBarHelper::trash('weblinks.trash');
         JToolBarHelper::divider();
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_weblinks');
         JToolBarHelper::divider();
     }
     JToolBarHelper::help('JHELP_COMPONENTS_WEBLINKS_LINKS');
 }
Exemple #4
0
 /**
  * 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 = WeblinksHelper::getActions($this->state->get('filter.category_id'), $this->item->id);
     JToolBarHelper::title(JText::_('COM_WEBLINKS_MANAGER_WEBLINK'), 'weblinks.png');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
         JToolBarHelper::apply('weblink.apply', 'JTOOLBAR_APPLY');
         JToolBarHelper::save('weblink.save', 'JTOOLBAR_SAVE');
     }
     if (!$checkedOut && $canDo->get('core.create')) {
         JToolBarHelper::custom('weblink.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolBarHelper::custom('weblink.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('weblink.cancel', 'JTOOLBAR_CANCEL');
     } else {
         JToolBarHelper::cancel('weblink.cancel', 'JTOOLBAR_CLOSE');
     }
     JToolBarHelper::divider();
     JToolBarHelper::help('JHELP_COMPONENTS_WEBLINKS_LINKS_EDIT');
 }
Exemple #5
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/weblinks.php';
     $state = $this->get('State');
     $canDo = WeblinksHelper::getActions($state->get('filter.category_id'));
     JToolBarHelper::title(JText::_('COM_WEBLINKS_MANAGER_WEBLINKS'), 'weblinks.png');
     if ($canDo->get('core.create')) {
         JToolBarHelper::addNew('weblink.add', 'JTOOLBAR_NEW');
     }
     if ($canDo->get('core.edit')) {
         JToolBarHelper::editList('weblink.edit', 'JTOOLBAR_EDIT');
     }
     if ($canDo->get('core.edit.state')) {
         JToolBarHelper::divider();
         JToolBarHelper::custom('weblinks.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
         JToolBarHelper::custom('weblinks.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true);
         JToolBarHelper::divider();
         JToolBarHelper::archiveList('weblinks.archive', 'JTOOLBAR_ARCHIVE');
         JToolBarHelper::custom('weblinks.checkin', 'checkin.png', 'checkin_f2.png', 'JTOOLBAR_CHECKIN', true);
     }
     if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
         JToolBarHelper::deleteList('', 'weblinks.delete', 'JTOOLBAR_EMPTY_TRASH');
         JToolBarHelper::divider();
     } else {
         if ($canDo->get('core.edit.state')) {
             JToolBarHelper::trash('weblinks.trash', 'JTOOLBAR_TRASH');
             JToolBarHelper::divider();
         }
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_weblinks');
         JToolBarHelper::divider();
     }
     JToolBarHelper::help('JHELP_COMPONENTS_WEBLINKS_LINKS');
 }
Exemple #6
0
 /**
  * Setup the Toolbar
  */
 protected function _setToolbar()
 {
     require_once JPATH_COMPONENT . DS . 'helpers' . DS . 'weblinks.php';
     $state = $this->get('State');
     $canDo = WeblinksHelper::getActions($state->get('filter.category_id'));
     JToolBarHelper::title(JText::_('Weblinks_Manager_Weblinks'), 'generic.png');
     if ($canDo->get('core.create')) {
         JToolBarHelper::addNew('weblink.add');
     }
     if ($canDo->get('core.edit')) {
         JToolBarHelper::editList('weblink.edit');
     }
     JToolBarHelper::divider();
     if ($canDo->get('core.edit.state')) {
         JToolBarHelper::custom('weblinks.publish', 'publish.png', 'publish_f2.png', 'Publish', true);
         JToolBarHelper::custom('weblinks.unpublish', 'unpublish.png', 'unpublish_f2.png', 'Unpublish', true);
         JToolBarHelper::divider();
         if ($state->get('filter.published') != -1) {
             JToolBarHelper::archiveList('weblinks.archive');
         }
     }
     if ($state->get('filter.published') == -2 && $canDo->get('core.delete')) {
         JToolBarHelper::deleteList('', 'weblinks.delete');
     } else {
         if ($canDo->get('core.edit.state')) {
             JToolBarHelper::trash('weblinks.trash');
         }
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::divider();
         JToolBarHelper::preferences('com_weblinks');
     }
     JToolBarHelper::divider();
     JToolBarHelper::help('screen.weblink');
 }
Exemple #7
0
 /**
  * Display the view
  *
  * @return  void
  */
 public function display($tpl = null)
 {
     $this->state = $this->get('State');
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     WeblinksHelper::addSubmenu('weblinks');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     $this->addToolbar();
     $this->sidebar = JHtmlSidebar::render();
     parent::display($tpl);
 }
Exemple #8
0
 /**
  * Add the page title and toolbar.
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/weblinks.php';
     $state = $this->get('State');
     $canDo = WeblinksHelper::getActions($state->get('filter.category_id'));
     $user = JFactory::getUser();
     // Get the toolbar object instance
     $bar = JToolBar::getInstance('toolbar');
     JToolbarHelper::title(JText::_('COM_WEBLINKS_MANAGER_WEBLINKS'), 'weblinks.png');
     if (count($user->getAuthorisedCategories('com_weblinks', 'core.create')) > 0) {
         JToolbarHelper::addNew('weblink.add');
     }
     if ($canDo->get('core.edit')) {
         JToolbarHelper::editList('weblink.edit');
     }
     if ($canDo->get('core.edit.state')) {
         JToolbarHelper::publish('weblinks.publish', 'JTOOLBAR_PUBLISH', true);
         JToolbarHelper::unpublish('weblinks.unpublish', 'JTOOLBAR_UNPUBLISH', true);
         JToolbarHelper::archiveList('weblinks.archive');
         JToolbarHelper::checkin('weblinks.checkin');
     }
     if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
         JToolbarHelper::deleteList('', 'weblinks.delete', 'JTOOLBAR_EMPTY_TRASH');
     } elseif ($canDo->get('core.edit.state')) {
         JToolbarHelper::trash('weblinks.trash');
     }
     // Add a batch button
     if ($user->authorise('core.create', 'com_weblinks') && $user->authorise('core.edit', 'com_weblinks') && $user->authorise('core.edit.state', 'com_weblinks')) {
         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_weblinks');
     }
     JToolbarHelper::help('JHELP_COMPONENTS_WEBLINKS_LINKS');
     JHtmlSidebar::setAction('index.php?option=com_weblinks&view=weblinks');
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_state', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.state'), true));
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_CATEGORY'), 'filter_category_id', JHtml::_('select.options', JHtml::_('category.options', 'com_weblinks'), 'value', 'text', $this->state->get('filter.category_id')));
     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')));
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_TAG'), 'filter_tag', JHtml::_('select.options', JHtml::_('tag.options', true, true), 'value', 'text', $this->state->get('filter.tag')));
 }
 /**
  * Method to display a view.
  *
  * @param	boolean			$cachable	If true, the view output will be cached
  * @param	array			$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/weblinks.php';
     // Load the submenu.
     WeblinksHelper::addSubmenu(JRequest::getCmd('view', 'weblinks'));
     $view = JRequest::getCmd('view', 'weblinks');
     $layout = JRequest::getCmd('layout', 'default');
     $id = JRequest::getInt('id');
     // Check for edit form.
     if ($view == 'weblink' && $layout == 'edit' && !$this->checkEditId('com_weblinks.edit.weblink', $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_weblinks&view=weblinks', false));
         return false;
     }
     parent::display();
     return $this;
 }
Exemple #10
0
 /**
  * Method to display a view.
  */
 function display()
 {
     require_once JPATH_COMPONENT . DS . 'helpers' . DS . 'weblinks.php';
     // Get the document object.
     $document = JFactory::getDocument();
     // Set the default view name and format from the Request.
     $vName = JRequest::getWord('view', 'weblinks');
     $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.
         WeblinksHelper::addSubmenu($vName);
     }
 }