Exemplo n.º 1
0
 /**
  * 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 = FloorplanHelper::getActions();
     JToolBarHelper::title(JText::_('COM_FLOORPLAN_TITLE_BOOTH'), 'booth.png');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
         JToolBarHelper::apply('booth.apply', 'JTOOLBAR_APPLY');
         JToolBarHelper::save('booth.save', 'JTOOLBAR_SAVE');
     }
     if (!$checkedOut && $canDo->get('core.create')) {
         JToolBarHelper::custom('booth.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('booth.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('booth.cancel', 'JTOOLBAR_CANCEL');
     } else {
         JToolBarHelper::cancel('booth.cancel', 'JTOOLBAR_CLOSE');
     }
 }
Exemplo n.º 2
0
 /**
  * Display the view
  */
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $this->state = $this->get('State');
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->params = $app->getParams('com_floorplan');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         throw new Exception(implode("\n", $errors));
     }
     $floorplan = array();
     $this->floorplan = FloorplanHelper::BuildFloorplan($this->params, $this->items);
     //	for ($i = 1; $i <= count($booths); $i++) echo  "&nbsp;". $booths[$i]. "&nbsp;";
     $this->_prepareDocument();
     parent::display($tpl);
 }
Exemplo n.º 3
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/floorplan.php';
     $state = $this->get('State');
     $canDo = FloorplanHelper::getActions($state->get('filter.category_id'));
     JToolBarHelper::title(JText::_('COM_FLOORPLAN_TITLE_BOOTHS'), 'booths.png');
     //Check if the form exists before showing the add/edit buttons
     $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/booth';
     if (file_exists($formPath)) {
         if ($canDo->get('core.create')) {
             JToolBarHelper::addNew('booth.add', 'JTOOLBAR_NEW');
         }
         if ($canDo->get('core.edit') && isset($this->items[0])) {
             JToolBarHelper::editList('booth.edit', 'JTOOLBAR_EDIT');
         }
     }
     if ($canDo->get('core.edit.state')) {
         if (isset($this->items[0]->state)) {
             JToolBarHelper::divider();
             JToolBarHelper::custom('booths.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
             JToolBarHelper::custom('booths.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('', 'booths.delete', 'JTOOLBAR_DELETE');
             }
         }
         if (isset($this->items[0]->state)) {
             JToolBarHelper::divider();
             JToolBarHelper::archiveList('booths.archive', 'JTOOLBAR_ARCHIVE');
         }
         if (isset($this->items[0]->checked_out)) {
             JToolBarHelper::custom('booths.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('', 'booths.delete', 'JTOOLBAR_EMPTY_TRASH');
             JToolBarHelper::divider();
         } else {
             if ($canDo->get('core.edit.state')) {
                 JToolBarHelper::trash('booths.trash', 'JTOOLBAR_TRASH');
                 JToolBarHelper::divider();
             }
         }
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_floorplan');
     }
     //Set sidebar action - New in 3.0
     JHtmlSidebar::setAction('index.php?option=com_floorplan&view=booths');
     $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 type
     $select_label = JText::sprintf('COM_FLOORPLAN_FILTER_SELECT_LABEL', 'This booth is:');
     $options = array();
     $options[0] = new stdClass();
     $options[0]->value = "Available";
     $options[0]->text = "Available";
     $options[1] = new stdClass();
     $options[1]->value = "Reserved";
     $options[1]->text = "Reserved";
     $options[2] = new stdClass();
     $options[2]->value = "Refreshment";
     $options[2]->text = "Refreshment";
     $options[3] = new stdClass();
     $options[3]->value = "Special";
     $options[3]->text = "Special";
     JHtmlSidebar::addFilter($select_label, 'filter_type', JHtml::_('select.options', $options, "value", "text", $this->state->get('filter.type'), true));
 }
Exemplo n.º 4
0
 public static function BuildFloorplan($params, $items)
 {
     $Booths = FloorplanHelper::BuildBooths($params->get('TotalBooths', '0'), $params->get('ReservedColour', '0'), $params->get('EmptyColour', '0'), $params->get('RefreshmentColour', '0'), $params->get('SpecialColour', '0'), $params->get('Mailto', '*****@*****.**'), $items);
     $Shape = $params->get('Shape', 'Square');
     switch ($Shape) {
         case "Square":
             $result = FloorplanHelper::BuildShapeSquare($params->get('TotalBooths', '0'), $Booths);
             break;
         case "Rectangle":
             $result = FloorplanHelper::BuildShapeRectangle($params->get('TotalBooths', '0'), $Booths);
             break;
         case "LShape":
             $result = FloorplanHelper::BuildShapeL($params->get('TotalBooths', '0'), $Booths);
             break;
         case "leadership":
             $result = FloorplanHelper::BuildShapeLeadership($params->get('TotalBooths', '0'), $Booths);
             break;
         case "rac":
             $result = FloorplanHelper::Race2015Shape($params->get('TotalBooths', '0'), $Booths);
             break;
     }
     return $result;
 }