/** * Add the page title and toolbar. */ protected function addToolbar() { JFactory::getApplication()->input->set('hidemainmenu', true); $user = JFactory::getUser(); $isNew = $this->item->id == 0; if (isset($this->item->checked_out)) { $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id')); } else { $checkedOut = false; } $canDo = SomosmaestrosHelper::getActions(); JToolBarHelper::title(JText::_('COM_SOMOSMAESTROS_TITLE_FORMACION'), 'formacion.png'); // If not checked out, can save the item. if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) { JToolBarHelper::apply('formacion.apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('formacion.save', 'JTOOLBAR_SAVE'); } if (!$checkedOut && $canDo->get('core.create')) { JToolBarHelper::custom('formacion.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('formacion.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); } if (empty($this->item->id)) { JToolBarHelper::cancel('formacion.cancel', 'JTOOLBAR_CANCEL'); } else { JToolBarHelper::cancel('formacion.cancel', 'JTOOLBAR_CLOSE'); } }
/** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { require_once JPATH_COMPONENT . '/helpers/somosmaestros.php'; $state = $this->get('State'); $canDo = SomosmaestrosHelper::getActions($state->get('filter.category_id')); JToolBarHelper::title(JText::_('COM_SOMOSMAESTROS_TITLE_LISTARBLOGS'), 'listarblogs.png'); //Check if the form exists before showing the add/edit buttons $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/listar_blog'; if (file_exists($formPath)) { if ($canDo->get('core.create')) { JToolBarHelper::addNew('listar_blog.add', 'JTOOLBAR_NEW'); } if ($canDo->get('core.edit') && isset($this->items[0])) { JToolBarHelper::editList('listar_blog.edit', 'JTOOLBAR_EDIT'); } } if ($canDo->get('core.edit.state')) { if (isset($this->items[0]->state)) { JToolBarHelper::divider(); JToolBarHelper::custom('listarblogs.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true); JToolBarHelper::custom('listarblogs.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true); } else { if (isset($this->items[0])) { //If this component does not use state then show a direct delete button as we can not trash JToolBarHelper::deleteList('', 'listarblogs.delete', 'JTOOLBAR_DELETE'); } } if (isset($this->items[0]->state)) { JToolBarHelper::divider(); JToolBarHelper::archiveList('listarblogs.archive', 'JTOOLBAR_ARCHIVE'); } if (isset($this->items[0]->checked_out)) { JToolBarHelper::custom('listarblogs.checkin', 'checkin.png', 'checkin_f2.png', 'JTOOLBAR_CHECKIN', true); } } //Show trash and delete for components that uses the state field if (isset($this->items[0]->state)) { if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) { JToolBarHelper::deleteList('', 'listarblogs.delete', 'JTOOLBAR_EMPTY_TRASH'); JToolBarHelper::divider(); } else { if ($canDo->get('core.edit.state')) { JToolBarHelper::trash('listarblogs.trash', 'JTOOLBAR_TRASH'); JToolBarHelper::divider(); } } } if ($canDo->get('core.admin')) { JToolBarHelper::preferences('com_somosmaestros'); } //Set sidebar action - New in 3.0 JHtmlSidebar::setAction('index.php?option=com_somosmaestros&view=listarblogs'); $this->extra_sidebar = ''; // }
/** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { require_once JPATH_COMPONENT . '/helpers/somosmaestros.php'; $state = $this->get('State'); $canDo = SomosmaestrosHelper::getActions($state->get('filter.category_id')); JToolBarHelper::title(JText::_('COM_SOMOSMAESTROS_TITLE_CAPAAS'), 'capaas.png'); //Check if the form exists before showing the add/edit buttons $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/capaa'; if (file_exists($formPath)) { if ($canDo->get('core.create')) { JToolBarHelper::addNew('capaa.add', 'JTOOLBAR_NEW'); } if ($canDo->get('core.edit') && isset($this->items[0])) { JToolBarHelper::editList('capaa.edit', 'JTOOLBAR_EDIT'); } } if ($canDo->get('core.edit.state')) { if (isset($this->items[0]->state)) { JToolBarHelper::divider(); JToolBarHelper::custom('capaas.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true); JToolBarHelper::custom('capaas.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true); } else { if (isset($this->items[0])) { //If this component does not use state then show a direct delete button as we can not trash JToolBarHelper::deleteList('', 'capaas.delete', 'JTOOLBAR_DELETE'); } } if (isset($this->items[0]->state)) { JToolBarHelper::divider(); JToolBarHelper::archiveList('capaas.archive', 'JTOOLBAR_ARCHIVE'); } if (isset($this->items[0]->checked_out)) { JToolBarHelper::custom('capaas.checkin', 'checkin.png', 'checkin_f2.png', 'JTOOLBAR_CHECKIN', true); } } //Show trash and delete for components that uses the state field if (isset($this->items[0]->state)) { if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) { JToolBarHelper::deleteList('', 'capaas.delete', 'JTOOLBAR_EMPTY_TRASH'); JToolBarHelper::divider(); } else { if ($canDo->get('core.edit.state')) { JToolBarHelper::trash('capaas.trash', 'JTOOLBAR_TRASH'); JToolBarHelper::divider(); } } } if ($canDo->get('core.admin')) { JToolBarHelper::preferences('com_somosmaestros'); } //Set sidebar action - New in 3.0 JHtmlSidebar::setAction('index.php?option=com_somosmaestros&view=capaas'); $this->extra_sidebar = ''; JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), "value", "text", $this->state->get('filter.state'), true)); //Filter for the field tipo $select_label = JText::sprintf('COM_SOMOSMAESTROS_FILTER_SELECT_LABEL', 'Tipo'); $options = array(); $options[0] = new stdClass(); $options[0]->value = "1"; $options[0]->text = "Formación"; $options[1] = new stdClass(); $options[1]->value = "2"; $options[1]->text = "Blog"; $options[2] = new stdClass(); $options[2]->value = "3"; $options[2]->text = "Perfil"; JHtmlSidebar::addFilter($select_label, 'filter_tipo', JHtml::_('select.options', $options, "value", "text", $this->state->get('filter.tipo'), true)); //Filter for the field fecha_inicio $this->extra_sidebar .= '<div class="other-filters">'; $this->extra_sidebar .= '<small><label for="filter_from_fecha_inicio">' . JText::sprintf('COM_SOMOSMAESTROS_FROM_FILTER', 'Fecha Inicio') . '</label></small>'; $this->extra_sidebar .= JHtml::_('calendar', $this->state->get('filter.fecha_inicio.from'), 'filter_from_fecha_inicio', 'filter_from_fecha_inicio', '%Y-%m-%d', array('style' => 'width:142px;', 'onchange' => 'this.form.submit();')); $this->extra_sidebar .= '<small><label for="filter_to_fecha_inicio">' . JText::sprintf('COM_SOMOSMAESTROS_TO_FILTER', 'Fecha Inicio') . '</label></small>'; $this->extra_sidebar .= JHtml::_('calendar', $this->state->get('filter.fecha_inicio.to'), 'filter_to_fecha_inicio', 'filter_to_fecha_inicio', '%Y-%m-%d', array('style' => 'width:142px;', 'onchange' => 'this.form.submit();')); $this->extra_sidebar .= '</div>'; $this->extra_sidebar .= '<hr class="hr-condensed">'; //Filter for the field fecha_fin $this->extra_sidebar .= '<div class="other-filters">'; $this->extra_sidebar .= '<small><label for="filter_from_fecha_fin">' . JText::sprintf('COM_SOMOSMAESTROS_FROM_FILTER', 'Fecha Fin') . '</label></small>'; $this->extra_sidebar .= JHtml::_('calendar', $this->state->get('filter.fecha_fin.from'), 'filter_from_fecha_fin', 'filter_from_fecha_fin', '%Y-%m-%d', array('style' => 'width:142px;', 'onchange' => 'this.form.submit();')); $this->extra_sidebar .= '<small><label for="filter_to_fecha_fin">' . JText::sprintf('COM_SOMOSMAESTROS_TO_FILTER', 'Fecha Fin') . '</label></small>'; $this->extra_sidebar .= JHtml::_('calendar', $this->state->get('filter.fecha_fin.to'), 'filter_to_fecha_fin', 'filter_to_fecha_fin', '%Y-%m-%d', array('style' => 'width:142px;', 'onchange' => 'this.form.submit();')); $this->extra_sidebar .= '</div>'; $this->extra_sidebar .= '<hr class="hr-condensed">'; }
/** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { require_once JPATH_COMPONENT . '/helpers/somosmaestros.php'; $state = $this->get('State'); $canDo = SomosmaestrosHelper::getActions($state->get('filter.category_id')); JToolBarHelper::title(JText::_('COM_SOMOSMAESTROS_TITLE_CAMPANABLOGS'), 'campanablogs.png'); //Check if the form exists before showing the add/edit buttons $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/campanablog'; if (file_exists($formPath)) { if ($canDo->get('core.create')) { JToolBarHelper::addNew('campanablog.add', 'JTOOLBAR_NEW'); } if ($canDo->get('core.edit') && isset($this->items[0])) { JToolBarHelper::editList('campanablog.edit', 'JTOOLBAR_EDIT'); } } if ($canDo->get('core.edit.state')) { if (isset($this->items[0]->state)) { JToolBarHelper::divider(); JToolBarHelper::custom('campanablogs.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true); JToolBarHelper::custom('campanablogs.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true); } else { if (isset($this->items[0])) { //If this component does not use state then show a direct delete button as we can not trash JToolBarHelper::deleteList('', 'campanablogs.delete', 'JTOOLBAR_DELETE'); } } if (isset($this->items[0]->state)) { JToolBarHelper::divider(); JToolBarHelper::archiveList('campanablogs.archive', 'JTOOLBAR_ARCHIVE'); } if (isset($this->items[0]->checked_out)) { JToolBarHelper::custom('campanablogs.checkin', 'checkin.png', 'checkin_f2.png', 'JTOOLBAR_CHECKIN', true); } } //Show trash and delete for components that uses the state field if (isset($this->items[0]->state)) { if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) { JToolBarHelper::deleteList('', 'campanablogs.delete', 'JTOOLBAR_EMPTY_TRASH'); JToolBarHelper::divider(); } else { if ($canDo->get('core.edit.state')) { JToolBarHelper::trash('campanablogs.trash', 'JTOOLBAR_TRASH'); JToolBarHelper::divider(); } } } if ($canDo->get('core.admin')) { JToolBarHelper::preferences('com_somosmaestros'); } //Set sidebar action - New in 3.0 JHtmlSidebar::setAction('index.php?option=com_somosmaestros&view=campanablogs'); $this->extra_sidebar = ''; JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), "value", "text", $this->state->get('filter.state'), true)); //Filter for the field blog; jimport('joomla.form.form'); $options = array(); JForm::addFormPath(JPATH_COMPONENT . '/models/forms'); $form = JForm::getInstance('com_somosmaestros.campanablog', 'campanablog'); $field = $form->getField('blog'); $query = $form->getFieldAttribute('filter_blog', 'query'); $translate = $form->getFieldAttribute('filter_blog', 'translate'); $key = $form->getFieldAttribute('filter_blog', 'key_field'); $value = $form->getFieldAttribute('filter_blog', 'value_field'); // Get the database object. $db = JFactory::getDBO(); // Set the query and get the result list. $db->setQuery($query); $items = $db->loadObjectlist(); // Build the field options. if (!empty($items)) { foreach ($items as $item) { if ($translate == true) { $options[] = JHtml::_('select.option', $item->{$key}, JText::_($item->{$value})); } else { $options[] = JHtml::_('select.option', $item->{$key}, $item->{$value}); } } } JHtmlSidebar::addFilter('$Blog', 'filter_blog', JHtml::_('select.options', $options, "value", "text", $this->state->get('filter.blog')), true); }