Example #1
1
 /**
  * Add the page title and toolbar.
  */
 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 = SibdietHelper::getActions();
     JToolBarHelper::title(JText::_('COM_SIBDIET_MANAGER_ERRAND'), 'database errands');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
         JToolBarHelper::apply('errand.apply');
         JToolBarHelper::save('errand.save');
     }
     if (!$checkedOut && $canDo->get('core.create')) {
         JToolbarHelper::save2new('errand.save2new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolbarHelper::save2copy('errand.save2copy');
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('errand.cancel');
     } else {
         JToolBarHelper::cancel('errand.cancel', 'JTOOLBAR_CLOSE');
     }
 }
Example #2
0
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     $canDo = SibdietHelper::getActions('com_sibdiet');
     // Get the toolbar object instance
     $bar = JToolBar::getInstance('toolbar');
     JToolBarHelper::title(JText::_('COM_SIBDIET_MANAGER_CONTAGS'), 'tags contags');
     if (in_array('contags', $this->permissions)) {
         if ($canDo->get('core.create')) {
             JToolBarHelper::addNew('contag.add');
         }
         if (isset($this->items[0])) {
             if ($canDo->get('core.edit')) {
                 JToolBarHelper::editList('contag.edit');
             }
             if ($canDo->get('core.edit.state')) {
                 JToolbarHelper::checkin('contags.checkin');
             }
             if ($this->state->get('filter.state') == -2 && $canDo->get('core.delete')) {
                 JToolbarHelper::publish('contags.publish', 'JTOOLBAR_PUBLISH', true);
                 JToolbarHelper::deleteList('', 'contags.delete', 'JTOOLBAR_EMPTY_TRASH');
             } elseif ($canDo->get('core.edit.state')) {
                 JToolbarHelper::trash('contags.trash');
             }
         }
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_sibdiet');
     }
 }
Example #3
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/sibdiet.php';
     $state = $this->get('State');
     $canDo = SibdietHelper::getActions();
     // Get the toolbar object instance
     $bar = JToolBar::getInstance('toolbar');
     JToolBarHelper::title(JText::_('COM_SIBDIET_MANAGER_ACTIVITIES'), 'database activities');
     if ($canDo->get('core.create')) {
         JToolBarHelper::addNew('activity.add');
     }
     if ($canDo->get('core.edit') && isset($this->items[0])) {
         JToolBarHelper::editList('activity.edit');
     }
     if ($canDo->get('core.edit.state')) {
         JToolbarHelper::checkin('activities.checkin');
     }
     if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
         JToolbarHelper::publish('activities.publish', 'JTOOLBAR_PUBLISH', true);
         JToolbarHelper::deleteList('', 'activities.delete', 'JTOOLBAR_EMPTY_TRASH');
     } elseif ($canDo->get('core.edit.state')) {
         JToolbarHelper::trash('activities.trash');
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_sibdiet');
     }
     JHtmlSidebar::setAction('index.php?option=com_sibdiet&view=activities');
 }
Example #4
0
 /**
  * Add the page title and toolbar.
  */
 protected function addToolbar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $user = JFactory::getUser();
     $isNew = $this->item->id == 0;
     $canDo = SibdietHelper::getActions();
     JToolBarHelper::title(JText::_('COM_SIBDIET_MANAGER_SETTING'), 'database settings');
     // If not checked out, can save the item.
     if ($canDo->get('core.manage')) {
         JToolBarHelper::apply('setting.apply');
     }
     JToolBarHelper::back('JTOOLBAR_BACK', 'index.php?option=com_sibdiet');
 }
Example #5
0
 /**
  * Execute and display a template script.
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  mixed  A string if successful, otherwise a Error object.
  *
  * @since   1.6
  */
 public function display($tpl = null)
 {
     $this->form = $this->get('Form');
     $this->item = $this->get('Item');
     $this->state = $this->get('State');
     $this->canDo = SibdietHelper::getActions('com_sibdiet');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     $this->permissions = SibdietHelper::getUserPermissions();
     $this->addToolbar();
     if (in_array('units', $this->permissions)) {
         parent::display($tpl);
     }
 }
Example #6
0
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     $canDo = SibdietHelper::getActions('com_sibdiet');
     // Get the toolbar object instance
     $bar = JToolBar::getInstance('toolbar');
     $bar->addButtonPath(JPATH_COMPONENT . '/toolbar/button/');
     JToolBarHelper::title(JText::_('COM_SIBDIET_MANAGER_FOODS'), 'database foods');
     if (in_array('foods', $this->permissions)) {
         if ($canDo->get('core.create')) {
             JToolBarHelper::addNew('food.add');
         }
         if (isset($this->items[0])) {
             if ($canDo->get('core.edit')) {
                 JToolBarHelper::editList('food.edit');
             }
             if ($canDo->get('core.edit.state')) {
                 JToolbarHelper::checkin('foods.checkin');
             }
             if ($this->state->get('filter.state') == -2 && $canDo->get('core.delete')) {
                 JToolbarHelper::publish('foods.publish', 'JTOOLBAR_PUBLISH', true);
                 JToolbarHelper::deleteList('', 'foods.delete', 'JTOOLBAR_EMPTY_TRASH');
             } elseif ($canDo->get('core.edit.state')) {
                 JToolbarHelper::trash('foods.trash');
             }
             // Copy foods to diet batch button
             if ($canDo->get('core.create')) {
                 JToolbarHelper::modal('copyFoodsCollapseModal', 'icon-checkbox-partial', JText::_('COM_SIBDIET_COPY_FOODS'));
             }
             // Edit foods batch buttons
             if ($canDo->get('core.edit') && $canDo->get('core.edit.state')) {
                 JToolbarHelper::modal('editCompositionsCollapseModal', 'icon-checkbox-partial', JText::_('COM_SIBDIET_EDIT_COMPOSITIONS'));
                 JToolbarHelper::modal('editPreparationsCollapseModal', 'icon-checkbox-partial', JText::_('COM_SIBDIET_EDIT_PRPARATIONS'));
             }
             // Print foods compositions
             $bar->appendButton('Print', 'index.php?option=com_sibdiet&view=printfoods&tmpl=component', 'COM_SIBDIET_PRINT_FOODS');
             // Print foods preparations
             $bar->appendButton('Print', 'index.php?option=com_sibdiet&view=printfoods&tmpl=component&layout=preparations', 'COM_SIBDIET_PRINT_FOODS_PREPARATIONS', false);
         }
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_sibdiet');
     }
 }
Example #7
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');
 }
Example #8
0
          <span class="age hasTooltip" title="<?php 
echo JText::_('COM_SIBDIET_AGE');
?>
">
          <?php 
if (!empty($this->item->profile->birthday)) {
    $age = SibdietHelper::age($this->item->profile->birthday, $this->item->created);
    echo $age->y . '.' . $age->m;
}
?>
          </span>
          <?php 
echo $this->form->getInput('email', 'profile');
?>
          <?php 
$canDo = SibdietHelper::getActions();
?>
          <?php 
if ($canDo->get('room.1')) {
    echo $this->form->getInput('room1');
}
?>
          <?php 
if ($canDo->get('room.2')) {
    echo $this->form->getInput('room2');
}
?>
          <?php 
if ($canDo->get('room.3')) {
    echo $this->form->getInput('room3');
}