Exemple #1
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 ? JText::_('User Content: Edit') : JText::_('User Content: New'), 'article.png');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_je_content', 'core.create')) > 0)) {
         JToolBarHelper::apply('article.apply');
         JToolBarHelper::save('article.save');
         if ($canDo->get('core.create')) {
             JToolBarHelper::save2new('article.save2new');
         }
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolBarHelper::save2copy('article.save2copy');
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('article.cancel');
     } else {
         JToolBarHelper::cancel('article.cancel', 'JTOOLBAR_CLOSE');
     }
 }
Exemple #2
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     $canDo = Jnt_HanhphucHelper::getActions($this->state->get('filter.category_id'));
     $user = JFactory::getUser();
     JToolBarHelper::title(JText::_('User content manager'), 'article.png');
     if ($canDo->get('core.create') || count($user->getAuthorisedCategories('com_je_content', 'core.create')) > 0) {
         JToolBarHelper::addNew('article.add');
     }
     if ($canDo->get('core.edit') || $canDo->get('core.edit.own')) {
         JToolBarHelper::editList('article.edit');
     }
     if ($canDo->get('core.edit.state')) {
         JToolBarHelper::divider();
         JToolBarHelper::publish('articles.publish', 'JTOOLBAR_PUBLISH', true);
         JToolBarHelper::unpublish('articles.unpublish', 'JTOOLBAR_UNPUBLISH', true);
         JToolBarHelper::custom('articles.featured', 'featured.png', 'featured_f2.png', 'JFEATURED', true);
         JToolBarHelper::divider();
         JToolBarHelper::archiveList('articles.archive');
         JToolBarHelper::checkin('articles.checkin');
     }
     if ($this->state->get('filter.state') == -2 && $canDo->get('core.delete')) {
         JToolBarHelper::deleteList('', 'articles.delete', 'JTOOLBAR_EMPTY_TRASH');
     } else {
         if ($canDo->get('core.edit.state')) {
             JToolBarHelper::trash('articles.trash');
         }
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::divider();
         JToolBarHelper::preferences('com_je_content');
     }
 }
Exemple #3
0
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @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::_('Albums Manager'), 'article.png');
     //		if (count($user->getAuthorisedCategories('com_jnt_hanhphuc', 'core.create')) > 0)
     if ($canDo->get('core.create')) {
         JToolBarHelper::addNew('album.add');
     }
     if ($canDo->get('core.edit')) {
         JToolBarHelper::editList('album.edit');
     }
     if ($canDo->get('core.edit.state')) {
         if ($this->state->get('filter.state') != 2) {
             JToolBarHelper::divider();
             JToolBarHelper::publish('albums.publish', 'JTOOLBAR_PUBLISH', true);
             JToolBarHelper::unpublish('albums.unpublish', 'JTOOLBAR_UNPUBLISH', true);
         }
         if ($this->state->get('filter.state') != -1) {
             JToolBarHelper::divider();
             if ($this->state->get('filter.state') != 2) {
                 JToolBarHelper::archiveList('albums.archive');
             } elseif ($this->state->get('filter.state') == 2) {
                 JToolBarHelper::unarchiveList('albums.publish');
             }
         }
     }
     if ($canDo->get('core.edit.state')) {
         JToolBarHelper::checkin('albums.checkin');
     }
     if ($this->state->get('filter.state') == -2 && $canDo->get('core.delete')) {
         JToolBarHelper::deleteList('', 'albums.delete', 'JTOOLBAR_EMPTY_TRASH');
         JToolBarHelper::divider();
     } elseif ($canDo->get('core.edit.state')) {
         JToolBarHelper::trash('albums.trash');
         JToolBarHelper::divider();
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_jnt_hanhphuc');
     }
 }
Exemple #4
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);
     // Since we don't track these assets at the item level, use the category id.
     $canDo = Jnt_HanhphucHelper::getActions($this->item->catid, 0);
     JToolBarHelper::title($isNew ? JText::_('Albums Manager: New Album') : JText::_('Albums Manager: Edit Album'), 'banners.png');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_jnt_hanhphuc', 'core.create')) > 0)) {
         JToolBarHelper::apply('album.apply');
         JToolBarHelper::save('album.save');
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('album.cancel');
     } else {
         JToolBarHelper::cancel('album.cancel', 'JTOOLBAR_CLOSE');
     }
 }
Exemple #5
0
 public function save($data)
 {
     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');
         // update content
         $content = Jnt_HanhphucHelper::copyFilesOnSave($data['description'], 'albums', $id);
         if ($content) {
             $data['description'] = $content;
         }
         //TODO: Update count location
         //			Jnt_HanhphucHelper::updateCountLocations('albums');
         //TODO: Update count custom field for each location
         //			Jnt_HanhphucHelper::updateCountCustomFieldLocations('albums');
         return parent::save($data);
     }
     return false;
 }
 static function updateImages($itemId, $curentImages = array(), $currentDesc = array(), $itemType = 'albums')
 {
     $db = JFactory::getDbo();
     // get old images
     $images = Jnt_HanhphucHelper::getImages($itemId, $itemType);
     // 		var_dump($images, $curentImages, $currentDesc);
     // 		die;
     foreach ($images as $img) {
         $image = $img->images;
         $query = $db->getQuery(true);
         if (!in_array($img->id, array_keys($curentImages))) {
             // delete image
             $destFolder = JPATH_ROOT . DS . 'images' . DS . $itemType . DS . $itemId . DS;
             $destThumbFolder = $destFolder . 'thumbnail' . DS;
             @unlink($destThumbFolder . $image);
             @unlink($destFolder . $image);
             // delete rec in db
             $query->delete('#__hp_images')->where('id = ' . $img->id);
         } else {
             $query->update('#__hp_images')->set('description = "' . $currentDesc[$img->id] . '"')->where('id = ' . $img->id);
         }
         $db->setQuery($query);
         $db->query();
     }
 }
Exemple #7
0
<?php

/**
 * @package		Joomla.Administrator
 * @subpackage	com_users
 * @copyright	Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */
// No direct access.
defined('_JEXEC') or die;
// Load the tooltip behavior.
JHtml::_('behavior.tooltip');
JHtml::_('behavior.multiselect');
JHtml::_('behavior.modal');
$canDo = Jnt_HanhphucHelper::getActions();
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$loggeduser = JFactory::getUser();
?>

<form action="<?php 
echo JRoute::_('index.php?option=com_jnt_hanhphuc&view=users');
?>
" method="post" name="adminForm" id="adminForm">
	<fieldset id="filter-bar">
		<div class="filter-search fltlft">
			<label class="filter-search-lbl" for="filter_search"><?php 
echo JText::_('Search: ');
?>
</label>
			<input type="text" name="filter_search" id="filter_search" value="<?php 
Exemple #8
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     $canDo = Jnt_HanhphucHelper::getActions();
     JToolBarHelper::title(JText::_('COM_USERS_VIEW_USERS_TITLE'), 'user');
 }
Exemple #9
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     $canDo = Jnt_HanhphucHelper::getActions();
     JToolBarHelper::title(JText::_('Users Manager'), 'user');
 }