primo commit
This commit is contained in:
		| @ -0,0 +1 @@ | ||||
| <html><body bgcolor="#FFFFFF"></body></html> | ||||
| @ -0,0 +1,220 @@ | ||||
| <?php | ||||
| /* | ||||
|  * @package Joomla | ||||
|  * @copyright Copyright (C) Open Source Matters. All rights reserved. | ||||
|  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php | ||||
|  * @component Phoca Gallery | ||||
|  * @copyright Copyright (C) Jan Pavelka www.phoca.cz | ||||
|  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL | ||||
|  */ | ||||
|  | ||||
| use Joomla\CMS\Factory; | ||||
|  | ||||
| defined('_JEXEC') or die; | ||||
| use Joomla\CMS\Uri\Uri; | ||||
| use Joomla\CMS\Language\Text; | ||||
| use Joomla\CMS\Layout\LayoutHelper; | ||||
| use Joomla\CMS\HTML\HTMLHelper; | ||||
| use Joomla\CMS\Router\Route; | ||||
|  | ||||
| $document = Factory::getDocument(); | ||||
| $document->addStyleSheet(Uri::root(true).'/media/com_phocagallery/js/photoswipe/css/photoswipe.css'); | ||||
| $document->addStyleSheet(Uri::root(true).'/media/com_phocagallery/js/photoswipe/css/default-skin/default-skin.css'); | ||||
| $document->addStyleSheet(Uri::root(true).'/media/com_phocagallery/js/photoswipe/css/photoswipe-style.css'); | ||||
|  | ||||
| $task		= 'phocagalleryimg'; | ||||
|  | ||||
| $r 			= $this->r; | ||||
| $app		= Factory::getApplication(); | ||||
| $option 	= $app->input->get('option'); | ||||
| $tasks		= $task . 's'; | ||||
| $OPT		= strtoupper($option); | ||||
| $user		= Factory::getUser(); | ||||
| $userId		= $user->get('id'); | ||||
| $listOrder	= $this->escape($this->state->get('list.ordering')); | ||||
| $listDirn	= $this->escape($this->state->get('list.direction')); | ||||
| $canOrder	= $user->authorise('core.edit.state', $option); | ||||
| $saveOrder	= $listOrder == 'a.ordering'; | ||||
| $saveOrderingUrl = ''; | ||||
| if ($saveOrder && !empty($this->items)) { | ||||
| 	$saveOrderingUrl = $r->saveOrder($this->t, $listDirn); | ||||
| } | ||||
| $sortFields = $this->getSortFields(); | ||||
|  | ||||
| echo $r->startHeader(); | ||||
| echo $r->jsJorderTable($listOrder); | ||||
|  | ||||
| echo '<div class="phoca-thumb-status">' . $this->t['enablethumbcreationstatus'] .'</div>'; | ||||
| //echo '<div class="clearfix"></div>'; | ||||
|  | ||||
| echo $r->startForm($option, $tasks, 'adminForm'); | ||||
| //echo $r->startFilter(); | ||||
| //echo $r->endFilter(); | ||||
|  | ||||
| echo $r->startMainContainer(); | ||||
| if (isset($this->t['notapproved']->count) && (int)$this->t['notapproved']->count > 0 ) { | ||||
|  | ||||
| 	echo '<div class="alert alert-error alert-dismissible fade show" role="alert">'. Text::_('COM_PHOCAGALLERY_NOT_APPROVED_IMAGE_IN_GALLERY').': ' | ||||
| 	.(int)$this->t['notapproved']->count.'<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="'.Text::_('COM_PHOCAGALLERY_CLOSE').'"></button></div>'; | ||||
| } | ||||
| /* | ||||
| echo $r->startFilterBar(); | ||||
| echo $r->inputFilterSearch($OPT.'_FILTER_SEARCH_LABEL', $OPT.'_FILTER_SEARCH_DESC', | ||||
| 							$this->escape($this->state->get('filter.search'))); | ||||
| echo $r->inputFilterSearchClear('JSEARCH_FILTER_SUBMIT', 'JSEARCH_FILTER_CLEAR'); | ||||
| echo $r->inputFilterSearchLimit('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC', $this->pagination->getLimitBox()); | ||||
| echo $r->selectFilterDirection('JFIELD_ORDERING_DESC', 'JGLOBAL_ORDER_ASCENDING', 'JGLOBAL_ORDER_DESCENDING', $listDirn); | ||||
| echo $r->selectFilterSortBy('JGLOBAL_SORT_BY', $sortFields, $listOrder); | ||||
|  | ||||
| echo $r->startFilterBar(2); | ||||
| echo $r->selectFilterPublished('JOPTION_SELECT_PUBLISHED', $this->state->get('filter.published')); | ||||
| echo $r->selectFilterLanguage('JOPTION_SELECT_LANGUAGE', $this->state->get('filter.language')); | ||||
| echo $r->selectFilterCategory(PhocaGalleryCategory::options($option, 1), 'JOPTION_SELECT_CATEGORY', $this->state->get('filter.category_id')); | ||||
| //echo $r->endFilterBar(); | ||||
|  | ||||
| echo $r->endFilterBar();*/ | ||||
|  | ||||
| echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this)); | ||||
|  | ||||
| echo '<div  id="pg-msnr-container" class="pg-photoswipe pg-msnr-container pg-category-items-box" itemscope itemtype="http://schema.org/ImageGallery">'; | ||||
|  | ||||
| echo $r->startTable('categoryList'); | ||||
|  | ||||
| echo $r->startTblHeader(); | ||||
|  | ||||
| echo $r->firstColumnHeader($listDirn, $listOrder); | ||||
| echo $r->secondColumnHeader($listDirn, $listOrder); | ||||
|  | ||||
| echo '<th class="ph-image">'.Text::_( $OPT. '_IMAGE' ).'</th>'."\n"; | ||||
| echo '<th class="ph-title">'.HTMLHelper::_('searchtools.sort',  	$OPT.'_TITLE', 'a.title', $listDirn, $listOrder ).'</th>'."\n"; | ||||
| echo '<th class="ph-filename">'.HTMLHelper::_('searchtools.sort',  	$OPT.'_FILENAME', 'a.filename', $listDirn, $listOrder ).'</th>'."\n"; | ||||
| echo '<th class="ph-functions">'.Text::_( $OPT. '_FUNCTIONS' ).'</th>'."\n"; | ||||
| echo '<th class="ph-published">'.HTMLHelper::_('searchtools.sort',  $OPT.'_PUBLISHED', 'a.published', $listDirn, $listOrder ).'</th>'."\n"; | ||||
| echo '<th class="ph-approved">'.HTMLHelper::_('searchtools.sort',  	$OPT.'_APPROVED', 'a.approved', $listDirn, $listOrder ).'</th>'."\n"; | ||||
| echo '<th class="ph-parentcattitle">'.HTMLHelper::_('searchtools.sort', $OPT.'_CATEGORY', 'category_id', $listDirn, $listOrder ).'</th>'."\n"; | ||||
| //echo '<th class="ph-access">'.JText::_($OPT.'_ACCESS').'</th>'."\n"; | ||||
| //echo '<th class="ph-owner">'.HTMLHelper::_('searchtools.sort',  	$OPT.'_OWNER', 'category_owner_id', $listDirn, $listOrder ).'</th>'."\n"; | ||||
| //echo '<th class="ph-uploaduser">'.HTMLHelper::_('searchtools.sort', $OPT.'_UPLOADED_BY', 'uploadusername', $listDirn, $listOrder ).'</th>'."\n"; | ||||
| echo '<th class="ph-rating">'.HTMLHelper::_('searchtools.sort',  	$OPT.'_RATING', 'ratingavg', $listDirn, $listOrder ).'</th>'."\n"; | ||||
| echo '<th class="ph-hits">'.HTMLHelper::_('searchtools.sort',  		$OPT.'_HITS', 'a.hits', $listDirn, $listOrder ).'</th>'."\n"; | ||||
| echo '<th class="ph-language">'.HTMLHelper::_('searchtools.sort',  	'JGRID_HEADING_LANGUAGE', 'a.language', $listDirn, $listOrder ).'</th>'."\n"; | ||||
| echo '<th class="ph-id">'.HTMLHelper::_('searchtools.sort',  		$OPT.'_ID', 'a.id', $listDirn, $listOrder ).'</th>'."\n"; | ||||
|  | ||||
| echo $r->endTblHeader(); | ||||
| echo $r->startTblBody($saveOrder, $saveOrderingUrl, $listDirn); | ||||
|  | ||||
| $originalOrders = array(); | ||||
| $parentsStr 	= ""; | ||||
| $j 				= 0; | ||||
|  | ||||
| if (is_array($this->items)) { | ||||
| 	foreach ($this->items as $i => $item) { | ||||
|  | ||||
| 		//if ($i >= (int)$this->pagination->limitstart && $j < (int)$this->pagination->limit) { | ||||
| 			$j++; | ||||
|  | ||||
| $urlEdit		= 'index.php?option='.$option.'&task='.$task.'.edit&id='; | ||||
| $urlTask		= 'index.php?option='.$option.'&task='.$task; | ||||
| $orderkey   	= array_search($item->id, $this->ordering[$item->catid]); | ||||
| $ordering		= ($listOrder == 'a.ordering'); | ||||
| $canCreate		= $user->authorise('core.create', $option); | ||||
| $canEdit		= $user->authorise('core.edit', $option); | ||||
| $canCheckin		= $user->authorise('core.manage', 'com_checkin') || $item->checked_out==$user->get('id') || $item->checked_out==0; | ||||
| $canChange		= $user->authorise('core.edit.state', $option) && $canCheckin; | ||||
| $linkEdit 		= Route::_( $urlEdit. $item->id ); | ||||
| $linkRotate90 	= Route::_( $urlTask.'.rotate&angle=90&id='. $item->id ); | ||||
| $linkRotate270 	= Route::_( $urlTask.'.rotate&angle=270&id='. $item->id ); | ||||
| $linkDeleteThumbs= Route::_( $urlTask.'.recreate&cid[]='. (int)$item->id ); | ||||
|  | ||||
| $linkCat	= Route::_( 'index.php?option=com_phocagallery&task=phocagalleryc.edit&id='.(int) $item->category_id ); | ||||
| $canEditCat	= $user->authorise('core.edit', $option); | ||||
|  | ||||
|  | ||||
| echo $r->startTr($i, isset($item->catid) ? (int)$item->catid : 0); | ||||
| echo $r->firstColumn($i, $item->id, $canChange, $saveOrder, $orderkey, $item->ordering); | ||||
| echo $r->secondColumn($i, $item->id, $canChange, $saveOrder, $orderkey, $item->ordering); | ||||
| echo $r->tdImage($item, 'pg-photoswipe-button', 'COM_PHOCAGALLERY_ENLARGE_IMAGE'); | ||||
| $checkO = ''; | ||||
| if ($item->checked_out) { | ||||
| 	$checkO .= HTMLHelper::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, $tasks.'.', $canCheckin); | ||||
| } | ||||
| if ($canCreate || $canEdit) { | ||||
| 	$checkO .= '<a href="'. Route::_($linkEdit).'">'. $this->escape($item->title).'</a>'; | ||||
| } else { | ||||
| 	$checkO .= $this->escape($item->title); | ||||
| } | ||||
| $checkO .= ' <span class="smallsub">(<span>'.Text::_($OPT.'_FIELD_ALIAS_LABEL').':</span>'. $this->escape($item->alias).')</span>'; | ||||
| echo $r->td($checkO, "small"); | ||||
|  | ||||
| if (isset($item->extid) && $item->extid !='') { | ||||
|     if (isset($item->exttype) && $item->exttype == 2) { | ||||
|         echo $r->td(Text::_('COM_PHOCAGALLERY_IMGUR_STORED_FILE')); | ||||
|         echo $r->td(''); | ||||
|     } else if (isset($item->exttype) && $item->exttype == 1) { | ||||
| 		echo $r->td(Text::_('COM_PHOCAGALLERY_FACEBOOK_STORED_FILE')); | ||||
| 		echo $r->td(''); | ||||
| 	} else { | ||||
| 		echo $r->td(Text::_('COM_PHOCAGALLERY_PICASA_STORED_FILE')); | ||||
| 		echo $r->td(''); | ||||
| 	} | ||||
| } else { | ||||
| 	echo $r->td(str_replace('/', ' / ', $item->filename), "small ph-list-filename"); | ||||
| 	echo '<td align="center">'; | ||||
|  | ||||
| 	echo '<div class="pha-toolbox">'; | ||||
| 	echo '<a class="pha-no-underline" href="'. $linkRotate90 .'" title="'. Text::_( 'COM_PHOCAGALLERY_ROTATE_LEFT' ).'">' | ||||
| 		. '<span class="ph-cp-item"><i class="phi phi-mirror duotone icon-unblock phi-fs-m phi-fc-od" title="'. Text::_( 'COM_PHOCAGALLERY_ROTATE_LEFT' ).'"></i></span>'.'</a> ' | ||||
| 		.'<a class="pha-no-underline" href="'. $linkRotate270 .'" title="'. Text::_( 'COM_PHOCAGALLERY_ROTATE_RIGHT' ).'">' | ||||
| 		. '<span class="ph-cp-item"><i class="phi duotone icon-unblock phi-fs-m phi-fc-od" title="'. Text::_( 'COM_PHOCAGALLERY_ROTATE_RIGHT' ).'"></i></span>'.'</a> ' | ||||
| 		.'<a class="pha-no-underline" href="'. $linkDeleteThumbs.'" title="'. Text::_( 'COM_PHOCAGALLERY_RECREATE_THUMBS' ).'">'. '<span class="ph-cp-item"><i class="phi duotone icon-plus-circle phi-fs-m phi-fc-gd" title="'. Text::_( 'COM_PHOCAGALLERY_RECREATE_THUMBS' ).'"></i></span>'.'</a> ' | ||||
| 		.'<a class="pha-no-underline" href="#" onclick="window.location.reload(true);" title="'. Text::_( 'COM_PHOCAGALLERY_RELOAD_SITE' ).'">'. '<span class="ph-cp-item"><i class="phi duotone icon-loop phi-fs-m phi-fc-bl " title="'. Text::_( 'COM_PHOCAGALLERY_RELOAD_SITE' ).'"></i></span>'.'</a>'; | ||||
|  | ||||
| 	echo '</div>'; | ||||
| 	echo '</td>'; | ||||
| } | ||||
|  | ||||
| echo $r->td(HTMLHelper::_('jgrid.published', $item->published, $i, $tasks.'.', $canChange), "small"); | ||||
| echo $r->td(PhocaGalleryJGrid::approved( $item->approved, $i, $tasks.'.', $canChange), "small"); | ||||
|  | ||||
| if ($canEditCat) { | ||||
| 	$catO = '<a href="'. Route::_($linkCat).'">'. $this->escape($item->category_title).'</a>'; | ||||
| } else { | ||||
| 	$catO = $this->escape($item->category_title); | ||||
| } | ||||
| echo $r->td($catO, "small"); | ||||
| //echo $r->td($this->escape($item->access_level), "small"); | ||||
| /* | ||||
| $usrO = $item->usernameno; | ||||
| if ($item->username) {$usrO = $usrO . ' ('.$item->username.')';} | ||||
| echo $r->td($usrO, "small"); | ||||
|  | ||||
| $usrU = $item->uploadname; | ||||
| if ($item->uploadusername) {$usrU = $usrU . ' ('.$item->uploadusername.')';} | ||||
| echo $r->td($usrU, "small"); | ||||
| */ | ||||
| echo $r->tdRating($item->ratingavg); | ||||
| echo $r->td($item->hits, "small"); | ||||
| echo $r->tdLanguage($item->language, $item->language_title, $this->escape($item->language_title)); | ||||
| echo $r->td($item->id, "small"); | ||||
|  | ||||
| echo $r->endTr(); | ||||
|  | ||||
| 		//} | ||||
| 	} | ||||
|  | ||||
| } | ||||
| echo $r->endTblBody(); | ||||
|  | ||||
| echo $r->tblFoot($this->pagination->getListFooter(), 15); | ||||
| echo $r->endTable(); | ||||
| echo "</div>"; | ||||
|  | ||||
| echo $this->loadTemplate('batch'); | ||||
|  | ||||
| echo $r->formInputsXML($listOrder, $listDirn, $originalOrders); | ||||
| echo $r->endMainContainer(); | ||||
| echo $r->endForm(); | ||||
|  | ||||
| // Modal window for images | ||||
| echo PhocaGalleryRenderDetailWindow::loadPhotoswipeBottom(); | ||||
| ?> | ||||
| @ -0,0 +1,60 @@ | ||||
| <?php | ||||
| /* | ||||
|  * @package Joomla | ||||
|  * @copyright Copyright (C) Open Source Matters. All rights reserved. | ||||
|  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php | ||||
|  * @component Phoca Gallery | ||||
|  * @copyright Copyright (C) Jan Pavelka www.phoca.cz | ||||
|  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL | ||||
|  */ | ||||
| defined('_JEXEC') or die; | ||||
| use Joomla\CMS\Language\Text; | ||||
| use Joomla\CMS\Layout\LayoutHelper; | ||||
|  | ||||
| //$published = $this->state->get('filter.published'); | ||||
| ?> | ||||
|  | ||||
| <div id="collapseModal" role="dialog" tabindex="-1" class="joomla-modal modal fade"> | ||||
| 	<div class="modal-dialog modal-lg"> | ||||
| 		<div class="modal-content"> | ||||
| 			<div class="modal-header"> | ||||
| 			<h3 class="modal-title"><?php echo Text::_('COM_PHOCAGALLERY_BATCH_OPTIONS_IMAGES');?></h3> | ||||
| 				<button type="button" class="btn-close novalidate" data-bs-dismiss="modal" aria-label="<?php Text::_('COM_PHOCAGALLERY_CLOSE'); ?>"> | ||||
| 		</button> | ||||
| 	</div> | ||||
| <div class="modal-body"> | ||||
|  | ||||
| <div class="p-3"> | ||||
| 	<div class="row"> | ||||
|         <div class="form-group col-md-6"> | ||||
| 			<div class="controls"><?php echo LayoutHelper::render('joomla.html.batch.access', []);?></div> | ||||
| 		</div> | ||||
| 	</div> | ||||
|  | ||||
|     <div class="row"> | ||||
|         <div class="form-group col-md-6"> | ||||
| 			<div class="controls"><?php echo LayoutHelper::render('joomla.html.batch.language', []); ?></div> | ||||
| 		</div> | ||||
| 	</div> | ||||
|     <div class="row"> | ||||
|         <div class="form-group col-md-6"> | ||||
| 			<div class="controls"><?php echo PhocaGalleryBatch::item(''); ?></div> | ||||
| 		</div> | ||||
| 	</div> | ||||
| </div> | ||||
| </div> | ||||
|  | ||||
| <div class="modal-footer"> | ||||
| 		<button class="btn" type="button" onclick="document.getElementById('batch-category-id').value='';document.getElementById('batch-access').value='';document.getElementById('batch-language-id').value=''" data-bs-dismiss="modal"> | ||||
| 			<?php echo Text::_('JCANCEL'); ?> | ||||
| 		</button> | ||||
| 		<button class="btn btn-primary" type="submit" onclick="Joomla.submitbutton('phocagalleryimg.batch');" id="batch-submit-button-id" data-submit-task="phocagalleryimg.batch"> | ||||
| 			<?php echo Text::_('JGLOBAL_BATCH_PROCESS'); ?> | ||||
| 		</button> | ||||
| 	</div> | ||||
|  | ||||
|  | ||||
| 		</div> | ||||
| 	</div> | ||||
| </div> | ||||
|  | ||||
| @ -0,0 +1 @@ | ||||
| <html><body bgcolor="#FFFFFF"></body></html> | ||||
| @ -0,0 +1,288 @@ | ||||
| <?php | ||||
| /* | ||||
|  * @package Joomla | ||||
|  * @copyright Copyright (C) Open Source Matters. All rights reserved. | ||||
|  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php | ||||
|  * @component Phoca Gallery | ||||
|  * @copyright Copyright (C) Jan Pavelka www.phoca.cz | ||||
|  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL | ||||
|  */ | ||||
| defined( '_JEXEC' ) or die(); | ||||
|  | ||||
| use Joomla\CMS\Layout\FileLayout; | ||||
| use Joomla\CMS\MVC\View\HtmlView; | ||||
| use Joomla\CMS\Factory; | ||||
| use Joomla\CMS\Component\ComponentHelper; | ||||
| use Joomla\CMS\Object\CMSObject; | ||||
| use Joomla\CMS\Language\Text; | ||||
| use Joomla\CMS\Toolbar\Toolbar; | ||||
| use Joomla\CMS\Toolbar\ToolbarHelper; | ||||
| use Joomla\CMS\HTML\HTMLHelper; | ||||
| use Joomla\CMS\Filesystem\File; | ||||
| jimport( 'joomla.application.component.view' ); | ||||
| phocagalleryimport('phocagallery.library.library'); | ||||
| phocagalleryimport('phocagallery.render.renderdetailwindow'); | ||||
|  | ||||
|  | ||||
| class PhocaGalleryCpViewPhocaGalleryImgs extends HtmlView | ||||
| { | ||||
|  | ||||
| 	protected $items; | ||||
| 	protected $items_thumbnail; | ||||
| 	protected $pagination; | ||||
| 	protected $state; | ||||
| 	protected $button; | ||||
| 	protected $t; | ||||
| 	protected $r; | ||||
| 	public $filterForm; | ||||
| 	public $activeFilters; | ||||
| 	//public $_context 	= 'com_phocagallery.phocagalleryimg'; | ||||
|  | ||||
| 	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->r = new PhocaGalleryRenderAdminViews(); | ||||
| 		$this->t			= PhocaGalleryUtils::setVars('img'); | ||||
|  | ||||
| 		// Preprocess the list of items to find ordering divisions. | ||||
| 		foreach ($this->items as &$item) { | ||||
| 			$this->ordering[$item->catid][] = $item->id; | ||||
| 		} | ||||
|  | ||||
|  | ||||
| 		$this->processImages(); | ||||
|  | ||||
|  | ||||
|  | ||||
| 		$document	= Factory::getDocument(); | ||||
|  | ||||
|  | ||||
|  | ||||
| 		$params 	= ComponentHelper::getParams('com_phocagallery'); | ||||
|  | ||||
|  | ||||
| 		$this->t['enablethumbcreation']			= $params->get('enable_thumb_creation', 1 ); | ||||
| 		$this->t['enablethumbcreationstatus'] 	= PhocaGalleryRenderAdmin::renderThumbnailCreationStatus((int)$this->t['enablethumbcreation']); | ||||
|  | ||||
|  | ||||
|  | ||||
| 		/*$app	= JFactory::getApplication(); | ||||
| 		$uri		= \Joomla\CMS\Uri\Uri::getInstance(); | ||||
|  | ||||
| 		$db		    = JFactory::getDBO();*/ | ||||
|  | ||||
| 		$this->t['notapproved'] 	=  $this->get( 'NotApprovedImage' ); | ||||
|  | ||||
| 		// Button | ||||
| 		/* | ||||
| 		$this->button = new CMSObject(); | ||||
| 		$this->button->set('modal', true); | ||||
| 		$this->button->set('methodname', 'modal-button'); | ||||
| 		//$this->button->set('link', $link); | ||||
| 		$this->button->set('text', Text::_('COM_PHOCAGALLERY_DISPLAY_IMAGE_DETAIL')); | ||||
| 		//$this->button->set('name', 'image'); | ||||
| 		$this->button->set('modalname', 'modal_phocagalleryimgs'); | ||||
| 		$this->button->set('options', "{handler: 'image', size: {x: 200, y: 150}}");*/ | ||||
|  | ||||
|  | ||||
| 		$library 			= PhocaGalleryLibrary::getLibrary(); | ||||
| 		$libraries			= array(); | ||||
| 		$btn 				= new PhocaGalleryRenderDetailWindow(); | ||||
| 		$btn->popupWidth 	= '640'; | ||||
| 		$btn->popupHeight 	= '480'; | ||||
| 		$btn->backend		= 1; | ||||
|  | ||||
| 		$btn->setButtons(14, $libraries, $library); | ||||
| 		$this->button = $btn->getB1(); | ||||
|  | ||||
|  | ||||
| 		$this->addToolbar(); | ||||
| 		parent::display($tpl); | ||||
| 	} | ||||
|  | ||||
|  | ||||
|  | ||||
| 	protected function addToolbar() { | ||||
|  | ||||
| 		require_once JPATH_COMPONENT.'/helpers/phocagalleryimgs.php'; | ||||
|  | ||||
|  | ||||
|  | ||||
| 		$state	= $this->get('State'); | ||||
| 		$canDo	= PhocaGalleryImgsHelper::getActions($state->get('filter.image_id')); | ||||
| 		$user  = Factory::getUser(); | ||||
| 		$bar = Toolbar::getInstance('toolbar'); | ||||
| 		ToolbarHelper::title( Text::_('COM_PHOCAGALLERY_IMAGES'), 'image.png' ); | ||||
| 		if ($canDo->get('core.create')) { | ||||
| 			ToolbarHelper::addNew( 'phocagalleryimg.add','JToolbar_NEW'); | ||||
| 			ToolbarHelper::custom( 'phocagallerym.edit', 'multiple.png', '', 'COM_PHOCAGALLERY_MULTIPLE_ADD' , false); | ||||
| 		} | ||||
| 		if ($canDo->get('core.edit')) { | ||||
| 			ToolbarHelper::editList('phocagalleryimg.edit','JToolbar_EDIT'); | ||||
| 		} | ||||
|  | ||||
| 		$dropdown = $bar->dropdownButton('status-group')->text('JTOOLBAR_CHANGE_STATUS')->toggleSplit(false)->icon('icon-ellipsis-h')->buttonClass('btn btn-action')->listCheck(true); | ||||
| 		$childBar = $dropdown->getChildToolbar(); | ||||
|  | ||||
| 		if ($canDo->get('core.create')) { | ||||
|  | ||||
| 			/* | ||||
| 			$bar->appendButton( 'Custom', '<a href="#" onclick="javascript:if(document.adminForm.boxchecked.value==0){alert(\''.JText::_('COM_PHOCAGALLERY_WARNING_RECREATE_MAKE_SELECTION').'\');}else{if(confirm(\''.JText::_('COM_PHOCAGALLERY_WARNING_RECREATE_THUMBNAILS').'\')){Joomla.submitbutton(\'phocagalleryimg.recreate\');}}" class="toolbar"><span class="icon-32-recreate" title="'.JText::_('COM_PHOCAGALLERY_RECREATE_THUMBS').'" type="Custom"></span>'.JText::_('COM_PHOCAGALLERY_RECREATE').'</a>');*/ | ||||
|  | ||||
| 		/*	$dhtml = '<joomla-toolbar-button id="toolbar-recreate-thumbnails" list-selection>'; | ||||
| 			$dhtml .= '<button class="btn btn-small" onclick="javascript:if(document.adminForm.boxchecked.value==0){alert(\''.Text::_('COM_PHOCAGALLERY_WARNING_RECREATE_MAKE_SELECTION').'\');}else{if(confirm(\''.Text::_('COM_PHOCAGALLERY_WARNING_RECREATE_THUMBNAILS').'\')){Joomla.submitbutton(\'phocagalleryimg.recreate\');}}" ><i class="icon-recreate" title="'.Text::_('COM_PHOCAGALLERY_RECREATE_THUMBS').'"></i> '.Text::_('COM_PHOCAGALLERY_RECREATE_THUMBS').'</button>'; | ||||
| 			$dhtml .= '</joomla-toolbar-button>'; | ||||
| 			$bar->appendButton('Custom', $dhtml);*/ | ||||
|  | ||||
| 			$onClick = 'javascript:if(document.adminForm.boxchecked.value==0){alert(\''.Text::_('COM_PHOCAGALLERY_WARNING_RECREATE_MAKE_SELECTION').'\');}else{if(confirm(\''.Text::_('COM_PHOCAGALLERY_WARNING_RECREATE_THUMBNAILS').'\')){Joomla.submitbutton(\'phocagalleryimg.recreate\');}}'; | ||||
|  | ||||
| 			$childBar->standardButton('recreate')->text('COM_PHOCAGALLERY_RECREATE_THUMBS')->onclick($onClick)->icon('icon-image'); | ||||
|  | ||||
|  | ||||
| 		} | ||||
|  | ||||
|  | ||||
|  | ||||
| 		if ($canDo->get('core.edit.state')) { | ||||
|  | ||||
| 			//ToolbarHelper::divider(); | ||||
| 			/*ToolbarHelper::custom('phocagalleryimgs.publish', 'publish.png', 'publish_f2.png','JToolbar_PUBLISH', true); | ||||
| 			ToolbarHelper::custom('phocagalleryimgs.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JToolbar_UNPUBLISH', true); | ||||
| 			ToolbarHelper::custom( 'phocagalleryimgs.approve', 'approve.png', '',  'COM_PHOCAGALLERY_APPROVE' , true); | ||||
| 			ToolbarHelper::custom( 'phocagalleryimgs.disapprove', 'disapprove.png', '',  'COM_PHOCAGALLERY_NOT_APPROVE' , true); | ||||
| 		*/ | ||||
| 			$childBar->publish('phocagalleryimgs.publish')->listCheck(true); | ||||
| 			$childBar->unpublish('phocagalleryimgs.unpublish')->listCheck(true); | ||||
| 			$childBar->standardButton('approve')->text('COM_PHOCAGALLERY_APPROVE')->task('phocagalleryimgs.approve')->listCheck(true); | ||||
| 			$childBar->standardButton('disapprove')->text('COM_PHOCAGALLERY_NOT_APPROVE')->task('phocagalleryimgs.disapprove')->listCheck(true); | ||||
|  | ||||
| 		} | ||||
|  | ||||
| 		if ($canDo->get('core.delete')) { | ||||
| 			$childBar->delete($this->t['tasks'].'.delete')->text('COM_PHOCAGALLERY_DELETE')->message('COM_PHOCAGALLERY_WARNING_DELETE_ITEMS')->icon('icon-trash')->listCheck(true); | ||||
| 			//ToolbarHelper::deleteList( Text::_( 'COM_PHOCAGALLERY_WARNING_DELETE_ITEMS' ), 'phocagalleryimgs.delete', 'COM_PHOCAGALLERY_DELETE'); | ||||
| 		} | ||||
|  | ||||
| 		// Add a batch button | ||||
| 		if ($user->authorise('core.edit')) | ||||
| 		{ | ||||
|  | ||||
| 			//HTMLHelper::_('bootstrap.renderModal', 'collapseModal'); | ||||
| 			/*$title = Text::_('JToolbar_BATCH'); | ||||
| 			$dhtml = '<joomla-toolbar-button id="toolbar-batch" list-selection>'; | ||||
| 			$dhtml .= "<button data-bs-toggle=\"modal\" data-bs-target=\"#collapseModal\" class=\"btn btn-small\"> | ||||
| 						<i class=\"icon-checkbox-partial\" title=\"$title\"></i> | ||||
| 						$title</button>"; | ||||
| 			$dhtml .= '</joomla-toolbar-button>'; | ||||
|  | ||||
| 			$bar->appendButton('Custom', $dhtml, 'batch');*/ | ||||
|  | ||||
| 			HTMLHelper::_('bootstrap.renderModal', 'collapseModal'); | ||||
| 			$childBar->popupButton('batch')->text('JTOOLBAR_BATCH')->selector('collapseModal')->listCheck(true); | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| 		} | ||||
|  | ||||
| 		ToolbarHelper::divider(); | ||||
| 		ToolbarHelper::help( 'screen.phocagallery', true ); | ||||
| 	} | ||||
|  | ||||
|  | ||||
| 	protected function processImages() { | ||||
|  | ||||
| 		if (!empty($this->items)) { | ||||
|  | ||||
| 			$params							= ComponentHelper::getParams( 'com_phocagallery' ); | ||||
| 			$pagination_thumbnail_creation 	= $params->get( 'pagination_thumbnail_creation', 0 ); | ||||
| 			$clean_thumbnails 				= $params->get( 'clean_thumbnails', 0 ); | ||||
|  | ||||
|  | ||||
| 			//Server doesn't have CPU power | ||||
| 			//we do thumbnail for all images - there is no pagination... | ||||
| 			//or we do thumbanil for only listed images | ||||
| 			if (empty($this->items_thumbnail)) { | ||||
| 				if ($pagination_thumbnail_creation == 1) { | ||||
| 					$this->items_thumbnail 	= $this->items; | ||||
| 				} else { | ||||
| 					$this->items_thumbnail	= $this->get('ItemsThumbnail'); | ||||
|  | ||||
| 				} | ||||
| 			} | ||||
|  | ||||
| 			// - - - - - - - - - - - - - - - - - - - - | ||||
| 			// Check if the file stored in database is on the server. If not please refer to user | ||||
| 			// Get filename from every object there is stored in database | ||||
| 			// file - abc.img, file_no - folder/abc.img | ||||
| 			// Get folder variables from Helper | ||||
| 			$path 				= PhocaGalleryPath::getPath(); | ||||
| 			$origPath 			= $path->image_abs; | ||||
| 			$origPathServer 	= str_replace('\\', '/', $path->image_abs); | ||||
|  | ||||
| 			//----------------------------------------- | ||||
| 			//Do all thumbnails no limit no pagination | ||||
| 			if (!empty($this->items_thumbnail)) { | ||||
| 				foreach ($this->items_thumbnail as $key => $value) { | ||||
| 					$fileOriginalThumb = PhocaGalleryFile::getFileOriginal($value->filename); | ||||
| 					//Let the user know that the file doesn't exists and delete all thumbnails | ||||
| 					if (File::exists($fileOriginalThumb)) { | ||||
| 						$refreshUrlThumb = 'index.php?option=com_phocagallery&view=phocagalleryimgs'; | ||||
| 						$fileThumb = PhocaGalleryFileThumbnail::getOrCreateThumbnail( $value->filename, $refreshUrlThumb, 1, 1, 1); | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
|  | ||||
| 			$this->items_thumbnail = null; // delete data to reduce memory | ||||
|  | ||||
| 			//Only the the site with limitation or pagination... | ||||
| 			if (!empty($this->items)) { | ||||
| 				foreach ($this->items as $key => $value) { | ||||
| 					$fileOriginal = PhocaGalleryFile::getFileOriginal($value->filename); | ||||
| 					//Let the user know that the file doesn't exists and delete all thumbnails | ||||
|  | ||||
| 					if (!File::exists($fileOriginal)) { | ||||
| 						$this->items[$key]->filename = Text::_( 'COM_PHOCAGALLERY_IMG_FILE_NOT_EXISTS' ); | ||||
| 						$this->items[$key]->fileoriginalexist = 0; | ||||
| 					} else { | ||||
| 						//Create thumbnails small, medium, large | ||||
| 						$refresh_url 	= 'index.php?option=com_phocagallery&view=phocagalleryimgs'; | ||||
| 						$fileThumb 		= PhocaGalleryFileThumbnail::getOrCreateThumbnail($value->filename, $refresh_url, 1, 1, 1); | ||||
|  | ||||
| 						$this->items[$key]->linkthumbnailpath 	= $fileThumb['thumb_name_s_no_rel']; | ||||
| 						$this->items[$key]->fileoriginalexist = 1; | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
|  | ||||
| 			//Clean Thumbs Folder if there are thumbnail files but not original file | ||||
| 			if ($clean_thumbnails == 1) { | ||||
| 				PhocaGalleryFileFolder::cleanThumbsFolder(); | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	protected function getSortFields() { | ||||
| 		return array( | ||||
| 			'a.ordering'	=> Text::_('JGRID_HEADING_ORDERING'), | ||||
| 			'a.title' 		=> Text::_('COM_PHOCAGALLERY_TITLE'), | ||||
| 			'a.filename'	=> Text::_('COM_PHOCAGALLERY_FILENAME'), | ||||
| 			'a.published' 	=> Text::_('COM_PHOCAGALLERY_PUBLISHED'), | ||||
| 			'a.approved' 	=> Text::_('COM_PHOCAGALLERY_APPROVED'), | ||||
| 			'category_id' 	=> Text::_('COM_PHOCAGALLERY_CATEGORY'), | ||||
| 			'category_owner_id'=> Text::_('COM_PHOCAGALLERY_OWNER'), | ||||
| 			'uploadusername'=> Text::_('COM_PHOCAGALLERY_UPLOADED_BY'), | ||||
| 			'ratingavg' 		=> Text::_('COM_PHOCAGALLERY_RATING'), | ||||
| 			'a.hits' 		=> Text::_('COM_PHOCAGALLERY_HITS'), | ||||
| 			'language' 		=> Text::_('JGRID_HEADING_LANGUAGE'), | ||||
| 			'a.id' 			=> Text::_('JGRID_HEADING_ID') | ||||
| 		); | ||||
| 	} | ||||
| } | ||||
| ?> | ||||
		Reference in New Issue
	
	Block a user