Esempio n. 1
0
 /**
  * Method to get the field input markup.
  *
  * @return  string  The field input markup.
  *
  * @since   11.1
  */
 protected function getInput()
 {
     $html = parent::getInput();
     $default = SibdietHelper::getDefault((int) $this->value);
     $class = $this->element['class'] ? ' class="control-label ' . (string) $this->element['class'] . '"' : 'control-label';
     $html .= '<div' . $class . '>' . $default . '</div>';
     return $html;
 }
Esempio n. 2
0
 /**
  * Add the page title and toolbar.
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/sibdiet.php';
     $state = $this->get('State');
     $canDo = SibdietHelper::getActions();
     $filterDays = $state->get('filter.days', '');
     // Get the toolbar object instance
     $bar = JToolBar::getInstance('toolbar');
     JToolBarHelper::title(JText::_('COM_SIBDIET_MANAGER_DEFAULTS_DAILYS') . ' - ' . SibdietHelper::getDefault((int) $this->state->get('filter.defaults_id')), 'database defaults_dailys');
     if ($canDo->get('core.create') && !empty($filterDays)) {
         JToolBarHelper::addNew('defaults_daily.add');
     }
     if ($canDo->get('core.edit') && isset($this->items[0])) {
         JToolBarHelper::editList('defaults_daily.edit');
     }
     if ($canDo->get('core.edit.state')) {
         JToolbarHelper::checkin('defaults_dailys.checkin');
     }
     if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
         JToolbarHelper::publish('defaults_dailys.publish', 'JTOOLBAR_PUBLISH', true);
         JToolbarHelper::deleteList('', 'defaults_dailys.delete', 'JTOOLBAR_EMPTY_TRASH');
     } elseif ($canDo->get('core.edit.state')) {
         JToolbarHelper::trash('defaults_dailys.trash');
     }
     // Add a batch button
     if ($canDo->get('core.create') && $canDo->get('core.edit') && $canDo->get('core.edit.state')) {
         JHtml::_('bootstrap.modal', 'collapseModal');
         // Copy Foods to other default
         $title = JText::_('COM_SIBDIET_COPY_DEFAULTS');
         $dhtml = "<button data-toggle=\"modal\" data-target=\"#copyDefaultsCollapseModal\" class=\"btn btn-small\">\r\n\t\t\t\t\t\t<i class=\"icon-checkbox-partial\" title=\"{$title}\"></i>\r\n\t\t\t\t\t\t{$title}</button>";
         $bar->appendButton('Custom', $dhtml, 'batch');
     }
     JToolBarHelper::divider();
     JToolBarHelper::back('COM_SIBDIET_DEFAULTS', 'index.php?option=com_sibdiet&view=defaults');
     JToolBarHelper::back('COM_SIBDIET_DEFAULTS_WEEKLY', 'index.php?option=com_sibdiet&view=defaults_weeklys&filter_defaults_id=' . $this->state->get('filter.defaults_id'));
     JToolBarHelper::back('COM_SIBDIET_DEFAULTS_MEALLY', 'index.php?option=com_sibdiet&view=defaults_meallys&filter_defaults_id=' . $this->state->get('filter.defaults_id'));
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_sibdiet');
     }
     JHtmlSidebar::setAction('index.php?option=com_sibdiet&view=defaults_dailys');
 }