/** * Setting the toolbar */ protected function addToolBar() { JToolBarHelper::title(JText::_('COM_DEMO_IMPORT_TITLE'), 'upload'); JHtmlSidebar::setAction('index.php?option=com_demo&view=import'); if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_demo'); } // set help url for this view if found $help_url = DemoHelper::getHelpUrl('import'); if (DemoHelper::checkString($help_url)) { JToolbarHelper::help('COM_DEMO_HELP_MANAGER', false, $help_url); } }
/** * Setting the toolbar */ protected function addToolBar() { $canDo = DemoHelper::getActions('demo'); JToolBarHelper::title(JText::_('COM_DEMO_DASHBOARD'), 'grid-2'); // set help url for this view if found $help_url = DemoHelper::getHelpUrl('demo'); if (DemoHelper::checkString($help_url)) { JToolbarHelper::help('COM_DEMO_HELP_MANAGER', false, $help_url); } if ($canDo->get('core.admin') || $canDo->get('core.options')) { JToolBarHelper::preferences('com_demo'); } }
/** * Setting the toolbar */ protected function addToolBar() { JFactory::getApplication()->input->set('hidemainmenu', true); $user = JFactory::getUser(); $userId = $user->id; $isNew = $this->item->id == 0; JToolbarHelper::title(JText::_($isNew ? 'COM_DEMO_HELP_DOCUMENT_NEW' : 'COM_DEMO_HELP_DOCUMENT_EDIT'), 'pencil-2 article-add'); // Built the actions for new and existing records. if ($this->refid || $this->ref) { if ($this->canDo->get('help_document.create') && $isNew) { // We can create the record. JToolBarHelper::save('help_document.save', 'JTOOLBAR_SAVE'); } elseif ($this->canDo->get('help_document.edit')) { // We can save the record. JToolBarHelper::save('help_document.save', 'JTOOLBAR_SAVE'); } if ($isNew) { // Do not creat but cancel. JToolBarHelper::cancel('help_document.cancel', 'JTOOLBAR_CANCEL'); } else { // We can close it. JToolBarHelper::cancel('help_document.cancel', 'JTOOLBAR_CLOSE'); } } else { if ($isNew) { // For new records, check the create permission. if ($this->canDo->get('help_document.create')) { JToolBarHelper::apply('help_document.apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('help_document.save', 'JTOOLBAR_SAVE'); JToolBarHelper::custom('help_document.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); } JToolBarHelper::cancel('help_document.cancel', 'JTOOLBAR_CANCEL'); } else { if ($this->canDo->get('help_document.edit')) { // We can save the new record JToolBarHelper::apply('help_document.apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('help_document.save', 'JTOOLBAR_SAVE'); // We can save this record, but check the create permission to see // if we can return to make a new one. if ($this->canDo->get('help_document.create')) { JToolBarHelper::custom('help_document.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); } } $canVersion = $this->canDo->get('core.version') && $this->canDo->get('help_document.version'); if ($this->state->params->get('save_history', 1) && $this->canDo->get('help_document.edit') && $canVersion) { JToolbarHelper::versions('com_demo.help_document', $this->item->id); } if ($this->canDo->get('help_document.create')) { JToolBarHelper::custom('help_document.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); } JToolBarHelper::cancel('help_document.cancel', 'JTOOLBAR_CLOSE'); } } JToolbarHelper::divider(); // set help url for this view if found $help_url = DemoHelper::getHelpUrl('help_document'); if (DemoHelper::checkString($help_url)) { JToolbarHelper::help('COM_DEMO_HELP_MANAGER', false, $help_url); } }
/** * Setting the toolbar */ protected function addToolBar() { JToolBarHelper::title(JText::_('COM_DEMO_HELP_DOCUMENTS'), 'support'); JHtmlSidebar::setAction('index.php?option=com_demo&view=help_documents'); JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); if ($this->canCreate) { JToolBarHelper::addNew('help_document.add'); } // Only load if there are items if (DemoHelper::checkArray($this->items)) { if ($this->canEdit) { JToolBarHelper::editList('help_document.edit'); } if ($this->canState) { JToolBarHelper::publishList('help_documents.publish'); JToolBarHelper::unpublishList('help_documents.unpublish'); JToolBarHelper::archiveList('help_documents.archive'); if ($this->canDo->get('core.admin')) { JToolBarHelper::checkin('help_documents.checkin'); } } // Add a batch button if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) { // Get the toolbar object instance $bar = JToolBar::getInstance('toolbar'); // set the batch button name $title = JText::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button $layout = new JLayoutFile('joomla.toolbar.batch'); // add the button to the page $dhtml = $layout->render(array('title' => $title)); $bar->appendButton('Custom', $dhtml, 'batch'); } if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) { JToolbarHelper::deleteList('', 'help_documents.delete', 'JTOOLBAR_EMPTY_TRASH'); } elseif ($this->canState && $this->canDelete) { JToolbarHelper::trash('help_documents.trash'); } if ($this->canDo->get('core.export') && $this->canDo->get('help_document.export')) { JToolBarHelper::custom('help_documents.exportData', 'download', '', 'COM_DEMO_EXPORT_DATA', true); } } if ($this->canDo->get('core.import') && $this->canDo->get('help_document.import')) { JToolBarHelper::custom('help_documents.importData', 'upload', '', 'COM_DEMO_IMPORT_DATA', false); } // set help url for this view if found $help_url = DemoHelper::getHelpUrl('help_documents'); if (DemoHelper::checkString($help_url)) { JToolbarHelper::help('COM_DEMO_HELP_MANAGER', false, $help_url); } // add the options comp button if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_demo'); } if ($this->canState) { JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true)); // only load if batch allowed if ($this->canBatch) { JHtmlBatch_::addListSelection(JText::_('COM_DEMO_KEEP_ORIGINAL_STATE'), 'batch[published]', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)); } } JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_ACCESS'), 'filter_access', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))); if ($this->canBatch && $this->canCreate && $this->canEdit) { JHtmlBatch_::addListSelection(JText::_('COM_DEMO_KEEP_ORIGINAL_ACCESS'), 'batch[access]', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text')); } // Set Type Selection $this->typeOptions = $this->getTheTypeSelections(); if ($this->typeOptions) { // Type Filter JHtmlSidebar::addFilter('- Select ' . JText::_('COM_DEMO_HELP_DOCUMENT_TYPE_LABEL') . ' -', 'filter_type', JHtml::_('select.options', $this->typeOptions, 'value', 'text', $this->state->get('filter.type'))); if ($this->canBatch && $this->canCreate && $this->canEdit) { // Type Batch Selection JHtmlBatch_::addListSelection('- Keep Original ' . JText::_('COM_DEMO_HELP_DOCUMENT_TYPE_LABEL') . ' -', 'batch[type]', JHtml::_('select.options', $this->typeOptions, 'value', 'text')); } } // Set Location Selection $this->locationOptions = $this->getTheLocationSelections(); if ($this->locationOptions) { // Location Filter JHtmlSidebar::addFilter('- Select ' . JText::_('COM_DEMO_HELP_DOCUMENT_LOCATION_LABEL') . ' -', 'filter_location', JHtml::_('select.options', $this->locationOptions, 'value', 'text', $this->state->get('filter.location'))); if ($this->canBatch && $this->canCreate && $this->canEdit) { // Location Batch Selection JHtmlBatch_::addListSelection('- Keep Original ' . JText::_('COM_DEMO_HELP_DOCUMENT_LOCATION_LABEL') . ' -', 'batch[location]', JHtml::_('select.options', $this->locationOptions, 'value', 'text')); } } // Set Admin View Selection $this->admin_viewOptions = $this->getTheAdmin_viewSelections(); if ($this->admin_viewOptions) { // Admin View Filter JHtmlSidebar::addFilter('- Select ' . JText::_('COM_DEMO_HELP_DOCUMENT_ADMIN_VIEW_LABEL') . ' -', 'filter_admin_view', JHtml::_('select.options', $this->admin_viewOptions, 'value', 'text', $this->state->get('filter.admin_view'))); if ($this->canBatch && $this->canCreate && $this->canEdit) { // Admin View Batch Selection JHtmlBatch_::addListSelection('- Keep Original ' . JText::_('COM_DEMO_HELP_DOCUMENT_ADMIN_VIEW_LABEL') . ' -', 'batch[admin_view]', JHtml::_('select.options', $this->admin_viewOptions, 'value', 'text')); } } // Set Site View Selection $this->site_viewOptions = $this->getTheSite_viewSelections(); if ($this->site_viewOptions) { // Site View Filter JHtmlSidebar::addFilter('- Select ' . JText::_('COM_DEMO_HELP_DOCUMENT_SITE_VIEW_LABEL') . ' -', 'filter_site_view', JHtml::_('select.options', $this->site_viewOptions, 'value', 'text', $this->state->get('filter.site_view'))); if ($this->canBatch && $this->canCreate && $this->canEdit) { // Site View Batch Selection JHtmlBatch_::addListSelection('- Keep Original ' . JText::_('COM_DEMO_HELP_DOCUMENT_SITE_VIEW_LABEL') . ' -', 'batch[site_view]', JHtml::_('select.options', $this->site_viewOptions, 'value', 'text')); } } }