예제 #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 = BookingHelper::getActions();
     JToolBarHelper::title(JText::_('COM_BOOKING_TITLE_BOOKING'), 'booking.png');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
         JToolBarHelper::apply('booking.apply', 'JTOOLBAR_APPLY');
         JToolBarHelper::save('booking.save', 'JTOOLBAR_SAVE');
     }
     if (!$checkedOut && $canDo->get('core.create')) {
         JToolBarHelper::custom('booking.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('booking.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('booking.cancel', 'JTOOLBAR_CANCEL');
     } else {
         JToolBarHelper::cancel('booking.cancel', 'JTOOLBAR_CLOSE');
     }
 }
예제 #2
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/booking.php';
     $state = $this->get('State');
     $canDo = BookingHelper::getActions($state->get('filter.category_id'));
     JToolBarHelper::title(JText::_('COM_BOOKING_TITLE_BOOKINGS'), 'bookings.png');
     //Check if the form exists before showing the add/edit buttons
     $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/booking';
     if (file_exists($formPath)) {
         if ($canDo->get('core.create')) {
             JToolBarHelper::addNew('booking.add', 'JTOOLBAR_NEW');
         }
         if ($canDo->get('core.edit') && isset($this->items[0])) {
             JToolBarHelper::editList('booking.edit', 'JTOOLBAR_EDIT');
         }
     }
     if ($canDo->get('core.edit.state')) {
         if (isset($this->items[0]->state)) {
             JToolBarHelper::divider();
             JToolBarHelper::custom('bookings.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
             JToolBarHelper::custom('bookings.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('', 'bookings.delete', 'JTOOLBAR_DELETE');
             }
         }
         if (isset($this->items[0]->state)) {
             JToolBarHelper::divider();
             JToolBarHelper::archiveList('bookings.archive', 'JTOOLBAR_ARCHIVE');
         }
         if (isset($this->items[0]->checked_out)) {
             JToolBarHelper::custom('bookings.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('', 'bookings.delete', 'JTOOLBAR_EMPTY_TRASH');
             JToolBarHelper::divider();
         } else {
             if ($canDo->get('core.edit.state')) {
                 JToolBarHelper::trash('bookings.trash', 'JTOOLBAR_TRASH');
                 JToolBarHelper::divider();
             }
         }
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_booking');
     }
     //Set sidebar action - New in 3.0
     JHtmlSidebar::setAction('index.php?option=com_booking&view=bookings');
     $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));
 }
예제 #3
0
 /**
  * Display button to open popup window. 
  * 
  * @param int $value
  */
 function fetchElement($value)
 {
     $customerModel = new BookingModelCustomer();
     $customerModel->setId($value);
     $customer = $customerModel->getObject();
     $html = '<div style="float: left; height: 19px; padding-top: 3px;">';
     $html .= '<input style="color: #000000;" size="60" type="text" id="customer_name" value="' . BookingHelper::formatName($customer, true) . '" disabled="disabled" />';
     $html .= '</div>';
     $html .= '<div class="button2-left">';
     $html .= '<div class="blank">';
     $html .= '<a class="modal" title="' . JText::_('Select a Customer') . '"  href="' . ARoute::browse(CONTROLLER_CUSTOMER, true) . '" rel="{handler: \'iframe\', size: {x: 800, y: 600}}">' . JText::_('Select') . '</a>';
     $html .= '</div>';
     $html .= '</div>';
     $html .= '<input type="hidden" id="customer_id" name="customer" value="' . $value . '" />';
     return $html;
 }