Ejemplo n.º 1
0
 /**
  * Setup ACL based tjtoolbar
  *
  * @return  void
  *
  * @since   2.2
  */
 protected function addTJtoolbar()
 {
     require_once JPATH_ADMINISTRATOR . '/components/com_quick2cart/helpers/quick2cart.php';
     $canDo = Quick2cartHelper::getActions();
     // Add toolbar buttons
     jimport('techjoomla.tjtoolbar.toolbar');
     $tjbar = TJToolbar::getInstance('tjtoolbar', 'pull-right');
     if ($canDo->get('core.create')) {
         if (!empty($this->allowToCreateStore)) {
             $tjbar->appendButton('vendor.addNew', 'TJTOOLBAR_NEW', '', 'btn btn-small btn-success');
         }
     }
     if ($canDo->get('core.edit') && isset($this->items[0])) {
         $tjbar->appendButton('vendor.edit', 'TJTOOLBAR_EDIT', '', 'btn btn-small btn-success');
     }
     if ($canDo->get('core.edit.state')) {
         if (isset($this->items[0]->published)) {
             $tjbar->appendButton('stores.publish', 'TJTOOLBAR_PUBLISH', '', 'btn btn-small btn-success');
             $tjbar->appendButton('stores.unpublish', 'TJTOOLBAR_UNPUBLISH', '', 'btn btn-small btn-warning');
         }
     }
     if ($canDo->get('core.edit.state')) {
         if (isset($this->items[0])) {
             $tjbar->appendButton('stores.delete', 'TJTOOLBAR_DELETE', '', 'btn btn-small btn-danger');
         }
     }
     $this->toolbarHTML = $tjbar->render();
 }
Ejemplo n.º 2
0
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/quick2cart.php';
     $state = $this->get('State');
     $canDo = Quick2cartHelper::getActions($state->get('filter.category_id'));
     if (JVERSION >= '3.0') {
         JToolbarHelper::title(JText::_('COM_QUICK2CART_REPORTS'), 'list');
     } else {
         JToolbarHelper::title(JText::_('COM_QUICK2CART_REPORTS'), 'payouts.png');
     }
     // Check if the form exists before showing the add/edit buttons
     $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/payout';
     if (file_exists($formPath)) {
         if ($canDo->get('core.create')) {
             JToolBarHelper::addNew('payout.add', 'JTOOLBAR_NEW');
         }
         if ($canDo->get('core.edit') && isset($this->items[0])) {
             JToolBarHelper::editList('payout.edit', 'JTOOLBAR_EDIT');
         }
     }
     if ($canDo->get('core.edit.state')) {
         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('', 'payouts.delete', 'JTOOLBAR_DELETE');
         }
     }
     // CSV EXPORT
     if (!empty($this->items)) {
         if (JVERSION >= '3.0') {
             JToolBarHelper::custom('payouts.csvexport', 'download', 'download', 'COM_QUICK2CART_SALES_CSV_EXPORT', false);
         } else {
             $button = "<a href='#' onclick=\"javascript:document.getElementById('task').value = 'payouts.csvexport';document.adminForm.submit();\" ><span class='icon-32-save' title='Export'></span>" . JText::_('COM_QUICK2CART_SALES_CSV_EXPORT') . "</a>";
             $bar = JToolBar::getInstance();
             $bar->appendButton('Custom', $button);
         }
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_quick2cart');
     }
     if (JVERSION >= '3.0') {
         // Set sidebar action - New in 3.0
         JHtmlSidebar::setAction('index.php?option=com_quick2cart&view=payouts');
     }
     $this->extra_sidebar = '';
 }
Ejemplo n.º 3
0
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $user = JFactory::getUser();
     $isNew = $this->item->id == 0;
     if ($isNew) {
         $viewTitle = JText::_('COM_QUICK2CART_ADD_COUPON');
     } else {
         $viewTitle = JText::_('COM_QUICK2CART_EDIT_COUPON');
     }
     if (isset($this->item->checked_out)) {
         $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
     } else {
         $checkedOut = false;
     }
     $canDo = Quick2cartHelper::getActions();
     if (JVERSION >= '3.0') {
         JToolbarHelper::title($viewTitle, 'pencil-2');
     } else {
         JToolbarHelper::title($viewTitle, 'coupon.png');
     }
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
         JToolbarHelper::apply('coupon.apply', 'JTOOLBAR_APPLY');
         JToolbarHelper::save('coupon.save', 'JTOOLBAR_SAVE');
     }
     /*
      * if (!$checkedOut && ($canDo->get('core.create'))){
      * JToolbarHelper::custom('coupon.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('coupon.save2copy', 'save-copy.png',
      * 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); }
      */
     if (empty($this->item->id)) {
         JToolbarHelper::cancel('coupon.cancel', 'JTOOLBAR_CANCEL');
     } else {
         JToolbarHelper::cancel('coupon.cancel', 'JTOOLBAR_CLOSE');
     }
 }
Ejemplo n.º 4
0
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/quick2cart.php';
     $state = $this->get('State');
     $canDo = Quick2cartHelper::getActions();
     if (JVERSION >= '3.0') {
         JToolbarHelper::title(JText::_('QTC_COUPON'), 'list');
     } else {
         JToolbarHelper::title(JText::_('QTC_COUPON'), 'coupons.png');
     }
     // Check if the form exists before showing the add/edit buttons
     $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/coupon';
     if (file_exists($formPath)) {
         if ($canDo->get('core.create')) {
             JToolbarHelper::addNew('coupon.add', 'JTOOLBAR_NEW');
         }
         if ($canDo->get('core.edit') && isset($this->items[0])) {
             JToolbarHelper::editList('coupon.edit', 'JTOOLBAR_EDIT');
         }
     }
     if ($canDo->get('core.edit.state')) {
         if (isset($this->items[0]->published)) {
             JToolbarHelper::divider();
             JToolbarHelper::custom('coupons.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
             JToolbarHelper::custom('coupons.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true);
         }
     }
     if ($canDo->get('core.edit.state')) {
         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('', 'coupons.delete', 'JTOOLBAR_DELETE');
         }
     }
     if ($canDo->get('core.admin')) {
         JToolbarHelper::preferences('com_quick2cart');
     }
     if (JVERSION >= '3.0') {
         // Set sidebar action - New in 3.0
         JHtmlSidebar::setAction('index.php?option=com_quick2cart&view=coupons');
     }
     $this->extra_sidebar = '';
 }
Ejemplo n.º 5
0
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @since   1.6
  */
 public function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/quick2cart.php';
     $canDo = Quick2cartHelper::getActions();
     $input = JFactory::getApplication()->input;
     $layout = $input->get('layout', '');
     if ($layout != 'order' && $layout != 'invoice') {
         if (isset($this->orders[0])) {
             if ($canDo->get('core.delete')) {
                 JToolBarHelper::deleteList('', 'orders.deleteorders');
             }
             // CSV EXPORT
             if (JVERSION >= '3.0') {
                 JToolBarHelper::custom('orders.payment_csvexport', 'download', 'download', 'COM_QUICK2CART_SALES_CSV_EXPORT', false);
             } else {
                 // Get the toolbar object instance
                 $bar = JToolBar::getInstance('toolbar');
                 $button = "<a href='#' onclick=\"javascript:document.getElementById('task').value = 'orders.payment_csvexport';";
                 $button .= " document.adminForm.submit();\" > <span class='icon-32-save' title='" . JText::_('COM_QUICK2CART_SALES_CSV_EXPORT');
                 $button .= "'></span>" . JText::_('COM_QUICK2CART_SALES_CSV_EXPORT') . "</a>";
                 $bar->appendButton('Custom', $button);
             }
         }
         JToolBarHelper::back('QTC_HOME', 'index.php?option=com_quick2cart');
         if (JVERSION >= '3.0') {
             JToolBarHelper::title(JText::_('QTC_ORDERS'), 'list');
         } else {
             JToolBarHelper::title(JText::_('QTC_ORDERS'), 'orders.png');
         }
     } elseif ($layout != 'invoice') {
         JToolBarHelper::back('COM_QUICK2CART_BACK', 'index.php?option=com_quick2cart&view=orders');
         // Invoice Resend button
         JToolBarHelper::custom('orders.resendInvoice', 'repeat', 'repeat', JText::_('COM_QUICK2CART_RESEND_INVOICE'), false);
         // Invoice Preview button
         JToolBarHelper::preview('index.php?option=com_quick2cart&view=orders&layout=invoice&orderid=' . $this->orderid . '&tmpl=component', false);
         JToolBarHelper::custom('printOrder', 'print', 'print', JText::_('COM_QUICK2CART_PRINT'), false);
         // Amol code end
         if (JVERSION >= '3.0') {
             JToolBarHelper::title(JText::_('COM_QUICK2CART_ORDER_TITLE'), 'list');
         } else {
             JToolBarHelper::title(JText::_('COM_QUICK2CART_ORDER_TITLE'), 'order.png');
         }
     }
     if (JVERSION >= '3.0') {
         // JHtmlSidebar class to render a list view sidebar
         // setAction::Set value for the action attribute of the filter form
         JHtmlSidebar::setAction('index.php?option=com_quick2cart');
     }
 }
Ejemplo n.º 6
0
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/quick2cart.php';
     $state = $this->get('State');
     $canDo = Quick2cartHelper::getActions();
     if (JVERSION >= '3.0') {
         JToolBarHelper::title(JText::_('COM_QUICK2CART_TITLE_STORES'), 'cart');
     } else {
         JToolBarHelper::title(JText::_('COM_QUICK2CART_TITLE_STORES'), 'stores.png');
     }
     // Check if the form exists before showing the add/edit buttons
     $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/store';
     //@TODO use JForm for store creation
     if (file_exists($formPath)) {
         if ($canDo->get('core.create')) {
             JToolBarHelper::addNew('store.add', 'JTOOLBAR_NEW');
         }
         if ($canDo->get('core.edit') && isset($this->items[0])) {
             JToolBarHelper::editList('store.edit', 'JTOOLBAR_EDIT');
         }
     } else {
         if ($canDo->get('core.create')) {
             JToolBarHelper::addNew('vendor.addNew', 'JTOOLBAR_NEW');
         }
         if ($canDo->get('core.edit') && isset($this->items[0])) {
             JToolBarHelper::editList('vendor.edit', 'JTOOLBAR_EDIT');
         }
     }
     if ($canDo->get('core.edit.state')) {
         if (isset($this->items[0]->published)) {
             JToolBarHelper::divider();
             JToolBarHelper::custom('stores.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
             JToolBarHelper::custom('stores.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true);
         }
         /*elseif (isset($this->items[0]))
         		{
         			//If this component does not use state then show a direct delete button as we can not trash
         			JToolBarHelper::deleteList('', 'stores.delete', 'JTOOLBAR_DELETE');
         		}*/
         /*if (isset($this->items[0]->published))
         		{
         			JToolBarHelper::divider();
         			JToolBarHelper::archiveList('stores.archive', 'JTOOLBAR_ARCHIVE');
         		}*/
         if (isset($this->items[0]->checked_out)) {
             JToolBarHelper::custom('stores.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]->published))
     		{
     			if ($state->get('filter.state') == -2 && $canDo->get('core.delete'))
     			{
     				JToolBarHelper::deleteList('', 'stores.delete','JTOOLBAR_EMPTY_TRASH');
     				JToolBarHelper::divider();
     			}
     			elseif ($canDo->get('core.edit.state'))
     			{
     				JToolBarHelper::trash('stores.trash','JTOOLBAR_TRASH');
     				JToolBarHelper::divider();
     			}
     		}*/
     if (isset($this->items[0])) {
         if ($canDo->get('core.delete')) {
             JToolBarHelper::deleteList('', 'stores.delete', 'JTOOLBAR_DELETE');
         }
     }
     JToolBarHelper::back('QTC_HOME', 'index.php?option=com_quick2cart');
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_quick2cart');
     }
     if (JVERSION >= '3.0') {
         // Set sidebar action
         JHtmlSidebar::setAction('index.php?option=com_quick2cart&view=stores');
     }
     $this->extra_sidebar = '';
 }
Ejemplo n.º 7
0
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/quick2cart.php';
     $state = $this->get('State');
     $canDo = Quick2cartHelper::getActions();
     if (JVERSION >= '3.0') {
         JToolBarHelper::title(JText::_('COM_QUICK2CART_SHIPPING'), 'list');
     } else {
         JToolBarHelper::title(JText::_('COM_QUICK2CART_SHIPPING'), 'shipping_48.png');
     }
     $this->extra_sidebar = '';
 }
Ejemplo n.º 8
0
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/quick2cart.php';
     $state = $this->get('State');
     $canDo = Quick2cartHelper::getActions();
     if (JVERSION >= '3.0') {
         JToolBarHelper::title(JText::_('COM_QUICK2CART_SHIPPROFILE'), 'list');
     } else {
         JToolBarHelper::title(JText::_('COM_QUICK2CART_SHIPPROFILE'), 'shipping_48.png');
     }
     // Check if the form exists before showing the add/edit buttons
     $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/shipprofile';
     //@TODO use JForm for shipprofile creation
     if (file_exists($formPath)) {
         if ($canDo->get('core.create')) {
             JToolBarHelper::addNew('shipprofile.add', 'JTOOLBAR_NEW');
         }
         if ($canDo->get('core.edit') && isset($this->items[0])) {
             JToolBarHelper::editList('shipprofile.edit', 'JTOOLBAR_EDIT');
         }
     }
     if ($canDo->get('core.edit.state')) {
         JToolBarHelper::divider();
         JToolBarHelper::custom('shipprofile.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
         JToolBarHelper::custom('shipprofile.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true);
     }
     if (isset($this->items[0])) {
         if ($canDo->get('core.delete')) {
             JToolBarHelper::deleteList('', 'shipprofile.delete', 'JTOOLBAR_DELETE');
         }
     }
     $this->extra_sidebar = '';
 }