Exemplo n.º 1
0
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     $canDo = Jnt_HanhPhucHelper::getActions($this->state->get('filter.category_id'));
     JToolBarHelper::title(JText::_('Hanhphuc.vn: Orders Manager'), 'banners.png');
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_jnt_hanhphuc');
     }
 }
Exemplo n.º 2
0
 /**
  * Method to display a view.
  *
  * @param	boolean			If true, the view output will be cached
  * @param	array			An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  *
  * @return	JController		This object to support chaining.
  * @since	1.5
  */
 public function display($cachable = false, $urlparams = false)
 {
     require_once JPATH_COMPONENT . '/helpers/jnt_hanhphuc.php';
     //$this->setRedirect(JRoute::_('index.php?option=com_categories&extension=com_jnt_hanhphuc'));
     //return true;
     // Load the submenu.
     Jnt_HanhPhucHelper::addSubmenu(JRequest::getCmd('view', 'services'));
     parent::display();
     return $this;
 }
Exemplo n.º 3
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/jnt_hanhphuc.php';
     $canDo = Jnt_HanhPhucHelper::getActions($this->state->get('filter.category_id'));
     $user = JFactory::getUser();
     JToolBarHelper::title(JText::_('COM_BANNERS_MANAGER_BANNERS'), 'banners.png');
     if (count($user->getAuthorisedCategories('com_banners', 'core.create')) > 0) {
         JToolBarHelper::addNew('banner.add', 'JTOOLBAR_NEW');
     }
     if ($canDo->get('core.edit')) {
         JToolBarHelper::editList('banner.edit', 'JTOOLBAR_EDIT');
     }
     if ($canDo->get('core.edit.state')) {
         if ($this->state->get('filter.state') != 2) {
             JToolBarHelper::divider();
             JToolBarHelper::custom('banners.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
             JToolBarHelper::custom('banners.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true);
         }
         if ($this->state->get('filter.state') != -1) {
             JToolBarHelper::divider();
             if ($this->state->get('filter.state') != 2) {
                 JToolBarHelper::archiveList('banners.archive', 'JTOOLBAR_ARCHIVE');
             } else {
                 if ($this->state->get('filter.state') == 2) {
                     JToolBarHelper::unarchiveList('banners.publish', 'JTOOLBAR_UNARCHIVE');
                 }
             }
         }
     }
     if ($canDo->get('core.edit.state')) {
         JToolBarHelper::custom('banners.checkin', 'checkin.png', 'checkin_f2.png', 'JTOOLBAR_CHECKIN', true);
     }
     if ($canDo->get('core.edit.state')) {
         JToolBarHelper::trash('banners.trash', 'JTOOLBAR_TRASH');
     }
     if ($canDo->get('core.delete')) {
         JToolBarHelper::deleteList('', 'banners.delete', 'JTOOLBAR_EMPTY_TRASH');
         JToolBarHelper::divider();
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_banners');
         JToolBarHelper::divider();
     }
     JToolBarHelper::help('JHELP_COMPONENTS_BANNERS_BANNERS');
 }
Exemplo n.º 4
0
 /**
  * Display the view
  */
 public function display($tpl = null)
 {
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->state = $this->get('State');
     // Get filter form.
     $this->filterForm = $this->get('FilterForm');
     $this->activeFilters = $this->get('ActiveFilters');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     Jnt_HanhPhucHelper::addSubmenu('users');
     $this->addToolbar();
     $this->sidebar = JHtmlSidebar::render();
     parent::display($tpl);
 }
Exemplo n.º 5
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $isNew = $this->item->id == 0;
     $checkedOut = false;
     $canDo = Jnt_HanhPhucHelper::getActions($this->state->get('filter.category_id'));
     JToolBarHelper::title($isNew ? 'Hanhphuc.vn: New Service' : 'Hanhphuc.vn: Service detail', 'banners.png');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('service.edit') || $canDo->get('core.create'))) {
         JToolBarHelper::apply('service.apply', 'JTOOLBAR_APPLY');
         JToolBarHelper::save('service.save', 'JTOOLBAR_SAVE');
         JToolbarHelper::save2new('service.save2new');
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('service.cancel', 'JTOOLBAR_CANCEL');
     } else {
         JToolBarHelper::cancel('service.cancel', 'JTOOLBAR_CLOSE');
     }
 }
Exemplo n.º 6
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     JRequest::setVar('hidemainmenu', true);
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId);
     $canDo = Jnt_HanhPhucHelper::getActions($this->state->get('filter.category_id'));
     JToolBarHelper::title($isNew ? 'New Services' : 'Service detail', 'banners.png');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('service.edit') || $canDo->get('core.create'))) {
         JToolBarHelper::apply('service.apply', 'JTOOLBAR_APPLY');
         JToolBarHelper::save('service.save', 'JTOOLBAR_SAVE');
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('service.cancel', 'JTOOLBAR_CANCEL');
     } else {
         JToolBarHelper::cancel('service.cancel', 'JTOOLBAR_CLOSE');
     }
     JToolBarHelper::divider();
     JToolBarHelper::help('JHELP_COMPONENTS_BANNERS_BANNERS_EDIT');
 }
Exemplo n.º 7
0
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     $canDo = Jnt_HanhPhucHelper::getActions($this->state->get('filter.category_id'));
     $user = JFactory::getUser();
     JToolBarHelper::title(JText::_('Hanhphuc.vn: Manager Services'), 'banners.png');
     if (count($user->getAuthorisedCategories('com_jnt_hanhphuc', 'core.create')) > 0) {
         JToolBarHelper::addNew('service.add');
     }
     if ($canDo->get('core.edit')) {
         JToolBarHelper::editList('service.edit');
     }
     if ($canDo->get('core.edit.state')) {
         if ($this->state->get('filter.state') != 2) {
             JToolBarHelper::divider();
             JToolBarHelper::publish('services.publish', 'JTOOLBAR_PUBLISH', true);
             JToolBarHelper::unpublish('services.unpublish', 'JTOOLBAR_UNPUBLISH', true);
         }
         if ($this->state->get('filter.state') != -1) {
             JToolBarHelper::divider();
             if ($this->state->get('filter.state') == 2) {
                 JToolBarHelper::unarchiveList('banners.publish');
             }
         }
     }
     if ($canDo->get('core.edit.state')) {
         JToolBarHelper::checkin('services.checkin');
     }
     if ($this->state->get('filter.state') == -2 && $canDo->get('core.delete')) {
         JToolBarHelper::deleteList('', 'services.delete', 'JTOOLBAR_EMPTY_TRASH');
         JToolBarHelper::divider();
     } elseif ($canDo->get('core.edit.state')) {
         JToolBarHelper::trash('services.trash');
         JToolBarHelper::divider();
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_jnt_hanhphuc');
     }
 }
Exemplo n.º 8
0
 public function save($data)
 {
     // always set state is unpublish for each save
     $data['state'] = 0;
     $id = $data['id'];
     if (isset($id) && (int) $id > 0) {
         if (!FrontJntHanhphucHelper::checkUserPermissionOnItem($id, '#__hp_business_content')) {
             exit('Cannot edit this content!');
         }
     }
     if (parent::save($data)) {
         $id = (int) $this->getState($this->getName() . '.id');
         if ($id) {
             $data['id'] = $id;
         }
         $delImage = isset($data['del_image']) ? $data['del_image'] : null;
         // Upload thumb
         $item = $this->getItem();
         $data['images'] = Jnt_HanhPhucHelper::uploadImages('images', $item, $delImage, 'hp_content');
         // update content
         $content = $this->copyFilesOnSave($data['content'], $data['id']);
         if ($content) {
             $data['content'] = $content;
         }
         return parent::save($data);
     }
     return false;
 }
Exemplo n.º 9
0
 public function save($data)
 {
     // always set state is unpublish for each save
     $data['state'] = 0;
     $id = $data['id'];
     if (isset($id) && (int) $id > 0) {
         if (!FrontJntHanhphucHelper::checkUserPermissionOnItem($id, '#__hp_albums')) {
             exit('Cannot edit this album!');
         }
     }
     if (parent::save($data)) {
         $id = (int) $this->getState($this->getName() . '.id');
         // Update images
         $currentImages = isset($_POST['current_images']) ? $_POST['current_images'] : array();
         $currentDesc = isset($_POST['current_desc']) ? $_POST['current_desc'] : array();
         Jnt_HanhPhucHelper::updateImages($id, $currentImages, $currentDesc, 'albums');
         // Temp files
         if (isset($_POST['tmp_other_img'])) {
             // Copy file
             Jnt_HanhPhucHelper::copyTempFiles($id, $_POST['tmp_other_img'], 'albums');
             // Insert images
             Jnt_HanhPhucHelper::insertImages($id, $_POST['tmp_other_img'], $_POST['tmp_desc'], 'albums');
         }
         if ($id) {
             $data['id'] = $id;
         }
         $delImage = isset($data['del_image']) ? $data['del_image'] : null;
         // Upload thumb
         $item = $this->getItem();
         $data['images'] = Jnt_HanhPhucHelper::uploadImages('images', $item, $delImage, 'albums', 300);
         return parent::save($data);
     }
     return false;
 }