Current File : /home/pacjaorg/public_html/km/administrator/components/com_djclassifieds/views/fields/view.html.php |
<?php
/**
* @package DJ-Classifieds
* @copyright Copyright (C) DJ-Extensions.com, All rights reserved.
* @license http://www.gnu.org/licenses GNU/GPL
* @author url: http://dj-extensions.com
* @author email: contact@dj-extensions.com
*/
defined('_JEXEC') or die('Restricted access');
class DJClassifiedsViewFields extends JViewLegacy
{
protected $items;
protected $pagination;
protected $state;
public function display($tpl = null)
{
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
$this->batchForm = $this->get('BatchForm');
$this->bs_cl = DJClassifiedsTheme::getBSClasses();
$this->addToolbar();
if (class_exists('JHtmlSidebar')){
$this->sidebar = JHtmlSidebar::render();
}
if($this->state->get('filter.source') == '' && $this->state->get('list.ordering') == 'f.ordering'){
JFactory::getApplication()->enqueueMessage(JText::_('COM_DJCLASSIFIEDS_FIELDS_ORDERING_INFO'), 'notice');
}
parent::display($tpl);
}
protected function addToolbar()
{
$user = JFactory::getUser();
$par = JComponentHelper::getParams('com_djclassifieds');
JToolBarHelper::title(JText::_('COM_DJCLASSIFIEDS_FIELDS'), 'generic.png');
if ($user->authorise('core.create', 'com_djclassifieds')) {
JToolBarHelper::addNew('field.add','JTOOLBAR_NEW');
}
if ($user->authorise('core.edit', 'com_djclassifieds')) {
JToolBarHelper::editList('field.edit','JTOOLBAR_EDIT');
}
if ($user->authorise('core.edit.state', 'com_djclassifieds')) {
JToolBarHelper::custom('fields.publish', 'publish.png', 'publish_f2.png','JTOOLBAR_PUBLISH', true);
JToolBarHelper::custom('fields.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true);
}
if ($user->authorise('core.delete', 'com_djclassifieds')) {
JToolBarHelper::deleteList('', 'fields.delete','JTOOLBAR_DELETE');
}
if ($user->authorise('core.admin', 'com_djclassifieds')) {
if($par->get('store_org_img', '1') == '1'){
JToolBarHelper::custom('fields.recreateThumbnails', 'move', 'move', JText::_('COM_DJCLASSIFIEDS_RECREATE_THUMBNAILS'), false);
}
}
if ($user->authorise('core.edit', 'com_djclassifieds')) {
JToolBarHelper::custom('fields.copyDefaultOrdering', 'out.png', 'copy.png', 'COM_DJCLASSIFIEDS_FIELDS_APPLY_ORDERING_TO_CATEGORIES', false);
}
JFactory::getDocument()->addScriptDeclaration("
Joomla.submitbutton = function(task)
{
if (task == 'fields.recreateThumbnails' && document.adminForm.boxchecked.value == 0)
{
if (confirm('".DJClassifiedsTheme::sanitizeText(JText::_('COM_DJCLASSIFIEDS_FIELDS_RECREATE_ALL_THUMBNAILS_CONFIRM'))."')) {
Joomla.submitform(task);
} else {
return false;
}
}else if (task == 'fields.copyDefaultOrdering' && document.adminForm.boxchecked.value == 0){
if (confirm('".DJClassifiedsTheme::sanitizeText(JText::_('COM_DJCLASSIFIEDS_FIELDS_COPY_ORDERING_ALL_CONFIRM'))."')) {
Joomla.submitform(task);
} else {
return false;
}
}else{
Joomla.submitform(task);
}
};
");
if ($user->authorise('core.admin', 'com_djclassifieds')) {
$bar = JToolBar::getInstance('toolbar');
$layout = new JLayoutFile('joomla.toolbar.batch');
$dhtml = $layout->render(array('title' => JText::_('COM_DJCLASSIFIEDS_BATCH')));
$bar->appendButton('Custom', $dhtml, 'batch');
if($this->state->get('filter.source') == ''){
JFactory::getDocument()->addScriptDeclaration("
jQuery(function($){
$('#toolbar-batch button').prop('onclick', false).click(function(e){
alert('".DJClassifiedsTheme::sanitizeText(JText::_('COM_DJCLASSIFIEDS_BATCH_FIELDS_SELECT_SOURCE'))."');
});
});
");
}
}
if ($user->authorise('core.admin', 'com_djclassifieds')) {
JToolBarHelper::divider();
if ($user->authorise('core.admin', 'com_djclassifieds')) {
JToolBarHelper::preferences('com_djclassifieds', 450, 800);
JToolBarHelper::divider();
}
}
}
}