tutto cho che serve phoca
This commit is contained in:
@ -0,0 +1,327 @@
|
||||
<?php
|
||||
/*
|
||||
* @package Joomla.Framework
|
||||
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*
|
||||
* @component Phoca Component
|
||||
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
|
||||
*/
|
||||
defined('_JEXEC') or die();
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
use Joomla\CMS\Filesystem\Path;
|
||||
use Joomla\CMS\Filesystem\File;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Factory;
|
||||
class PhocaDownloadLayout
|
||||
{
|
||||
public $params;
|
||||
public $filePath;
|
||||
public $iconPath;
|
||||
public $cssImagePath;
|
||||
public $fileAbsPath;
|
||||
|
||||
public function __construct() {
|
||||
if (empty($params)) {
|
||||
$this->params = ComponentHelper::getParams('com_phocadownload') ;
|
||||
}
|
||||
|
||||
if ($this->filePath == '') {
|
||||
$this->filePath = PhocaDownloadPath::getPathSet('file');
|
||||
}
|
||||
|
||||
if ($this->iconPath == '') {
|
||||
$this->iconPath = PhocaDownloadPath::getPathSet('icon');
|
||||
}
|
||||
|
||||
if ($this->cssImagePath == '') {
|
||||
$this->cssImagePath = str_replace ( '../', Uri::base(true).'/', $this->iconPath['orig_rel_ds']);
|
||||
}
|
||||
|
||||
if ($this->fileAbsPath == '') {
|
||||
$this->fileAbsPath = $this->filePath['orig_abs_ds'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function getName($title, $filename, $preferTitle = 0) {
|
||||
|
||||
$name = $title;
|
||||
$fon = $this->params->get( 'filename_or_name', 'filename' );
|
||||
|
||||
if ($fon == 'title') {
|
||||
$name = $title;
|
||||
} else if ($fon == 'filename'){
|
||||
$name = PhocaDownloadFile::getTitleFromFilenameWithExt( $filename );
|
||||
} else if ($fon == 'filenametitle'){
|
||||
if ($preferTitle == 1) {
|
||||
$name = $title;
|
||||
} else {
|
||||
// Must be solved before
|
||||
$name = PhocaDownloadFile::getTitleFromFilenameWithExt( $filename );
|
||||
}
|
||||
}
|
||||
|
||||
return $name;
|
||||
}
|
||||
|
||||
public function getImageFileName($imageFilename, $fileName = '', $type = 1, $iconSize = 16) {
|
||||
|
||||
$name['filenamestyle'] = '';
|
||||
$name['filenamethumb'] = '';
|
||||
|
||||
if ($imageFilename !='') {
|
||||
$thumbnail = false;
|
||||
$thumbnail = preg_match("/phocathumbnail/i", $imageFilename);
|
||||
if ($thumbnail) {
|
||||
$name['filenamethumb'] = '<div class="pdfv-image-file-thumb" >'
|
||||
.'<img src="'.$this->cssImagePath.$imageFilename.'" alt="" /></div>';
|
||||
$name['filenamestyle'] = '';
|
||||
} else {
|
||||
$name['filenamethumb'] = '';
|
||||
$name['filenamestyle'] = 'style="background: url(\''.$this->cssImagePath.$imageFilename.'\') 0 center no-repeat;"';
|
||||
}
|
||||
} else {
|
||||
$file_icon_mime = $this->params->get( 'file_icon_mime', 1 );
|
||||
if ($fileName != '' && $file_icon_mime == 1) {
|
||||
if ($type == 3) { // Plugin
|
||||
$file_icon_size = $iconSize;
|
||||
} else if ($type == 2) {
|
||||
$file_icon_size = $this->params->get( 'file_icon_size_md', 16 );
|
||||
} else {
|
||||
$file_icon_size = $this->params->get( 'file_icon_size', 16 );
|
||||
}
|
||||
$icon = PhocaDownloadFile::getMimeTypeIcon($fileName, (int)$file_icon_size, 1);
|
||||
$name['filenamethumb'] = '';
|
||||
$name['filenamestyle'] = $icon;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $name;
|
||||
}
|
||||
|
||||
public function getFileSize($filename) {
|
||||
|
||||
$size = '';
|
||||
if ($filename != '') {
|
||||
$absFile = str_replace('\\', '/', Path::clean($this->fileAbsPath . $filename));
|
||||
if (File::exists($absFile)) {
|
||||
$size = PhocaDownloadFile::getFileSizeReadable(filesize($absFile));
|
||||
} else {
|
||||
$size = '';
|
||||
}
|
||||
}
|
||||
|
||||
return $size;
|
||||
}
|
||||
|
||||
public function getProtectEmail($email) {
|
||||
|
||||
$email = str_replace('@', '['.Text::_('COM_PHOCADOWNLOAD_AT').']', $email);
|
||||
$email = str_replace('.', '['.Text::_('COM_PHOCADOWNLOAD_DOT').']', $email);
|
||||
|
||||
return $email;
|
||||
}
|
||||
|
||||
public function getFileDate($filename, $date) {
|
||||
|
||||
$dateO = '';
|
||||
$ddt = $this->params->get( 'display_date_type', 0 );
|
||||
if ((int)$ddt > 0) {
|
||||
if ($filename !='') {
|
||||
$dateO = PhocaDownloadFile::getFileTime($filename, $ddt);
|
||||
}
|
||||
} else {
|
||||
$dateO = HTMLHelper::Date($date, Text::_('DATE_FORMAT_LC3'));
|
||||
}
|
||||
|
||||
return $dateO;
|
||||
}
|
||||
|
||||
public function isValueEditor($text) {
|
||||
|
||||
if ($text != '' && $text != '<p> </p>' && $text != '<p> </p>' && $text != '<p></p>' && $text != '<br />') {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getImageDownload($img) {
|
||||
|
||||
return '<img src="'.$this->cssImagePath . $img.'" alt="" />';
|
||||
}
|
||||
|
||||
public function displayTags($fileId, $type = 0) {
|
||||
|
||||
$o = '';
|
||||
$db = Factory::getDBO();
|
||||
|
||||
$query = 'SELECT a.id, a.title, a.link_ext, a.link_cat'
|
||||
.' FROM #__phocadownload_tags AS a'
|
||||
.' LEFT JOIN #__phocadownload_tags_ref AS r ON r.tagid = a.id'
|
||||
.' WHERE r.fileid = '.(int)$fileId
|
||||
.' ORDER BY a.id';
|
||||
|
||||
$db->setQuery($query);
|
||||
|
||||
try {
|
||||
$fileIdObject = $db->loadObjectList();
|
||||
} catch (\Exception $e) {
|
||||
throw new \Exception($e->getMessage(), 500);
|
||||
}
|
||||
|
||||
$tl = $this->params->get( 'tags_links', 0 );
|
||||
|
||||
$class = '';
|
||||
if ($type == 1) {
|
||||
$class = 'class="label label-default"';
|
||||
}
|
||||
|
||||
foreach ($fileIdObject as $k => $v) {
|
||||
$o .= '<span '.$class.'>';
|
||||
if ($tl == 0) {
|
||||
$o .= $v->title;
|
||||
} else if ($tl == 1) {
|
||||
if ($v->link_ext != '') {
|
||||
$o .= '<a href="'.$v->link_ext.'">'.$v->title.'</a>';
|
||||
} else {
|
||||
$o .= $v->title;
|
||||
}
|
||||
} else if ($tl == 2) {
|
||||
|
||||
if ($v->link_cat != '') {
|
||||
$query = 'SELECT a.id, a.alias'
|
||||
.' FROM #__phocadownload_categories AS a'
|
||||
.' WHERE a.id = '.(int)$v->link_cat
|
||||
.' ORDER BY a.id';
|
||||
|
||||
$db->setQuery($query, 0, 1);
|
||||
|
||||
|
||||
try {
|
||||
$category = $db->loadObject();
|
||||
} catch (\RuntimeException $e) {
|
||||
throw new \Exception($e->getMessage(), 500);
|
||||
}
|
||||
|
||||
if (isset($category->id) && isset($category->alias)) {
|
||||
$link = PhocaDownloadRoute::getCategoryRoute($category->id, $category->alias);
|
||||
$o .= '<a href="'.$link.'">'.$v->title.'</a>';
|
||||
} else {
|
||||
$o .= $v->title;
|
||||
}
|
||||
} else {
|
||||
$o .= $v->title;
|
||||
}
|
||||
} else if ($tl == 3) {
|
||||
$link = PhocaDownloadRoute::getCategoryRouteByTag($v->id);
|
||||
$o .= '<a href="'.$link.'">'.$v->title.'</a>';
|
||||
}
|
||||
|
||||
$o .= '</span> ';
|
||||
}
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
public function displayTagsString($string = '') {
|
||||
$o = array();
|
||||
if ($string != '') {
|
||||
$sA = explode(',', $string);
|
||||
if (!empty($sA)) {
|
||||
foreach ($sA as $k => $v) {
|
||||
// Specific cases for Joomla! CMS
|
||||
switch($v) {
|
||||
case '1.5': $c = 'pd-j-15'; break;
|
||||
case '1.7': $c = 'pd-j-17'; break;
|
||||
case '2.5': $c = 'pd-j-25'; break;
|
||||
case '3.x': $c = 'pd-j-3x'; break;
|
||||
case '3.5': $c = 'pd-j-35'; break;
|
||||
case '4.x': $c = 'pd-j-4x'; break;
|
||||
case '4.0': $c = 'pd-j-40'; break;
|
||||
default: $c = 'label-default bg-default label-'. PhocaDownloadUtils::getAliasName($v);break;
|
||||
}
|
||||
|
||||
$o[] = '<span class="label badge '.$c.'">'.trim($v).'</span>';
|
||||
}
|
||||
}
|
||||
}
|
||||
return implode(" ", $o);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function displayVideo($url, $view = 0, $ywidth = 0, $yheight = 0) {
|
||||
|
||||
$o = '';
|
||||
|
||||
$app = Factory::getApplication();
|
||||
|
||||
|
||||
if ($view == 0) {
|
||||
// Category View
|
||||
$height = $this->params->get( 'youtube_height_cv', 240 );
|
||||
$width = $this->params->get( 'youtube_width_cv', 320 );
|
||||
} else {
|
||||
// Detail View
|
||||
$height = $this->params->get( 'youtube_height_dv', 360 );
|
||||
$width = $this->params->get( 'youtube_width_dv', 480 );
|
||||
}
|
||||
|
||||
if ($url != '' && PhocaDownloadUtils::isURLAddress($url) ) {
|
||||
|
||||
|
||||
$ssl = strpos($url, 'https');
|
||||
$yLink = 'http://www.youtube.com/v/';
|
||||
if ($ssl != false) {
|
||||
$yLink = 'https://www.youtube.com/v/';
|
||||
}
|
||||
|
||||
$shortUrl = 'http://youtu.be/';
|
||||
$shortUrl2 = 'https://youtu.be/';
|
||||
$pos = strpos($url, $shortUrl);
|
||||
$pos2 = strpos($url, $shortUrl2);
|
||||
if ($pos !== false) {
|
||||
$code = str_replace($shortUrl, '', $url);
|
||||
} else if ($pos2 !== false) {
|
||||
$code = str_replace($shortUrl2, '', $url);
|
||||
} else {
|
||||
$codeArray = explode('=', $url);
|
||||
$code = str_replace($codeArray[0].'=', '', $url);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ((int)$ywidth > 0) {
|
||||
$width = (int)$ywidth;
|
||||
}
|
||||
if ((int)$yheight > 0) {
|
||||
$height = (int)$yheight;
|
||||
}
|
||||
|
||||
$attr = '';
|
||||
if ((int)$width > 0) {
|
||||
$attr .= ' width="'.(int)$width.'"';
|
||||
}
|
||||
if ((int)$height > 0) {
|
||||
$attr .= ' height="'.(int)$height.'"';
|
||||
}
|
||||
|
||||
$o .= '<div class="ph-video-container">';
|
||||
$o .= '<iframe '.$attr.' src="https://www.youtube.com/embed/'.$code.'"></iframe>';
|
||||
$o .= '</div>';
|
||||
/*$o .= '<object height="'.(int)$height.'" width="'.(int)$width.'" data="http://www.youtube.com/v/'.$code.'" type="application/x-shockwave-flash">'
|
||||
.'<param name="movie" value="http://www.youtube.com/v/'.$code.'" />'
|
||||
.'<param name="allowFullScreen" value="true" />'
|
||||
.'<param name="allowscriptaccess" value="always" />'
|
||||
.'<embed src="'.$yLink.$code.'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" height="'.(int)$height.'" width="'.(int)$width.'" /></object>';*/
|
||||
}
|
||||
return $o;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,108 @@
|
||||
<?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
|
||||
* @extension Phoca Extension
|
||||
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||
*/
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
class PhocaDownloadRenderAdmin
|
||||
{
|
||||
|
||||
public static function quickIconButton( $link, $image, $text, $imgUrl ) {
|
||||
return '<div class="thumbnails ph-icon">'
|
||||
.'<a class="thumbnail ph-icon-inside" href="'.$link.'">'
|
||||
.HTMLHelper::_('image', $imgUrl . $image, $text )
|
||||
.'<br /><span>'.$text.'</span></a></div>'. "\n";
|
||||
}
|
||||
|
||||
public static function getLinks() {
|
||||
$app = Factory::getApplication();
|
||||
$option = $app->input->get('option');
|
||||
$oT = strtoupper($option);
|
||||
|
||||
$links = array();
|
||||
switch ($option) {
|
||||
|
||||
case 'com_phocadownload':
|
||||
$links[] = array('Phoca Download site', 'https://www.phoca.cz/phocadownload');
|
||||
$links[] = array('Phoca Download documentation site', 'https://www.phoca.cz/documentation/category/17-phoca-download-component');
|
||||
$links[] = array('Phoca Download download site', 'https://www.phoca.cz/download/category/68-phoca-download');
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
$links[] = array('Phoca News', 'https://www.phoca.cz/news');
|
||||
$links[] = array('Phoca Forum', 'https://www.phoca.cz/forum');
|
||||
|
||||
$components = array();
|
||||
$components[] = array('Phoca Gallery','phocagallery', 'pg');
|
||||
$components[] = array('Phoca Guestbook','phocaguestbook', 'pgb');
|
||||
$components[] = array('Phoca Download','phocadownload', 'pd');
|
||||
$components[] = array('Phoca Documentation','phocadocumentation', 'pdc');
|
||||
$components[] = array('Phoca Favicon','phocafavicon', 'pfv');
|
||||
$components[] = array('Phoca SEF','phocasef', 'psef');
|
||||
$components[] = array('Phoca PDF','phocapdf', 'ppdf');
|
||||
$components[] = array('Phoca Restaurant Menu','phocamenu', 'prm');
|
||||
$components[] = array('Phoca Maps','phocamaps', 'pm');
|
||||
$components[] = array('Phoca Font','phocafont', 'pf');
|
||||
$components[] = array('Phoca Email','phocaemail', 'pe');
|
||||
$components[] = array('Phoca Install','phocainstall', 'pi');
|
||||
$components[] = array('Phoca Template','phocatemplate', 'pt');
|
||||
$components[] = array('Phoca Panorama','phocapanorama', 'pp');
|
||||
$components[] = array('Phoca Photo','phocaphoto', 'ph');
|
||||
$components[] = array('Phoca Commander','phocacommander', 'pcm');
|
||||
|
||||
$banners = array();
|
||||
$banners[] = array('Phoca Restaurant Menu','phocamenu', 'prm');
|
||||
$banners[] = array('Phoca Cart','phocacart', 'pc');
|
||||
|
||||
$o = '';
|
||||
$o .= '<p> </p>';
|
||||
$o .= '<h4 style="margin-bottom:5px;">'. Text::_($oT.'_USEFUL_LINKS'). '</h4>';
|
||||
$o .= '<ul>';
|
||||
foreach ($links as $k => $v) {
|
||||
$o .= '<li><a style="text-decoration:underline" href="'.$v[1].'" target="_blank">'.$v[0].'</a></li>';
|
||||
}
|
||||
$o .= '</ul>';
|
||||
|
||||
$o .= '<div>';
|
||||
$o .= '<p> </p>';
|
||||
$o .= '<h4 style="margin-bottom:5px;">'. Text::_($oT.'_USEFUL_TIPS'). '</h4>';
|
||||
|
||||
$m = mt_rand(0, 10);
|
||||
if ((int)$m > 0) {
|
||||
$o .= '<div>';
|
||||
$num = range(0,(count($components) - 1 ));
|
||||
shuffle($num);
|
||||
for ($i = 0; $i<3; $i++) {
|
||||
$numO = $num[$i];
|
||||
$o .= '<div style="float:left;width:33%;margin:0 auto;">';
|
||||
$o .= '<div><a style="text-decoration:underline;" href="https://www.phoca.cz/'.$components[$numO][1].'" target="_blank">'. HTMLHelper::_('image', 'media/'.$option.'/images/administrator/icon-box-'.$components[$numO][2].'.png', ''). '</a></div>';
|
||||
$o .= '<div style="margin-top:-10px;"><small><a style="text-decoration:underline;" href="https://www.phoca.cz/'.$components[$numO][1].'" target="_blank">'.$components[$numO][0].'</a></small></div>';
|
||||
$o .= '</div>';
|
||||
}
|
||||
$o .= '<div style="clear:both"></div>';
|
||||
$o .= '</div>';
|
||||
} else {
|
||||
$num = range(0,(count($banners) - 1 ));
|
||||
shuffle($num);
|
||||
$numO = $num[0];
|
||||
$o .= '<div><a href="https://www.phoca.cz/'.$banners[$numO][1].'" target="_blank">'. HTMLHelper::_('image', 'media/'.$option.'/images/administrator/b-'.$banners[$numO][2].'.png', ''). '</a></div>';
|
||||
|
||||
}
|
||||
|
||||
$o .= '<p> </p>';
|
||||
$o .= '<h4 style="margin-bottom:5px;">'. Text::_($oT.'_PLEASE_READ'). '</h4>';
|
||||
$o .= '<div><a style="text-decoration:underline" href="https://www.phoca.cz/phoca-needs-your-help/" target="_blank">'. Text::_($oT.'_PHOCA_NEEDS_YOUR_HELP'). '</a></div>';
|
||||
|
||||
$o .= '</div>';
|
||||
return $o;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Gallery
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Phoca\Render\Adminview;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Version;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
|
||||
class PhocaDownloadRenderAdminView extends AdminView
|
||||
{
|
||||
public $view = '';
|
||||
public $viewtype = 2;
|
||||
public $option = '';
|
||||
public $optionLang = '';
|
||||
public $compatible = false;
|
||||
public $sidebar = true;
|
||||
protected $document = false;
|
||||
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,635 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Download
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
use Joomla\CMS\Version;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\CMS\Filesystem\File;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
// Frontend editor - button plugin
|
||||
require_once JPATH_ADMINISTRATOR . '/components/com_phocadownload/libraries/autoloadPhoca.php';
|
||||
|
||||
use Phoca\Render\Adminviews;
|
||||
|
||||
|
||||
class PhocaDownloadRenderAdminViews extends AdminViews
|
||||
|
||||
|
||||
|
||||
{
|
||||
|
||||
public $view = '';
|
||||
public $viewtype = 1;
|
||||
public $option = '';
|
||||
public $optionLang = '';
|
||||
public $tmpl = '';
|
||||
public $compatible = false;
|
||||
public $sidebar = true;
|
||||
protected $document = false;
|
||||
|
||||
|
||||
|
||||
|
||||
public function __construct(){
|
||||
|
||||
$version = new Version();
|
||||
$is42 = $version->isCompatible('4.2.0-beta');
|
||||
|
||||
if ($is42) {
|
||||
$this->document = Factory::getDocument();
|
||||
$wa = $this->document->getWebAssetManager();
|
||||
$wa->useScript('table.columns')->useScript('multiselect');
|
||||
}
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/*
|
||||
public function startMainContainer() {
|
||||
|
||||
$o = array();
|
||||
|
||||
if ($this->compatible) {
|
||||
|
||||
// Joomla! 4
|
||||
|
||||
$o[] = '<div class="row">';
|
||||
if ($this->sidebar) {
|
||||
|
||||
$o[] = '<div id="j-main-container" class="col-md-12">';
|
||||
} else {
|
||||
|
||||
$o[] = '<div id="j-sidebar-container" class="col-md-2">'.JHtmlSidebar::render().'</div>';
|
||||
$o[] = '<div id="j-main-container" class="col-md-10">';
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
$o[] = '<div id="j-sidebar-container" class="span2">'.JHtmlSidebar::render().'</div>';
|
||||
$o[] = '<div id="j-main-container" class="span10">';
|
||||
}
|
||||
|
||||
return implode("\n", $o);
|
||||
}
|
||||
|
||||
public function endMainContainer() {
|
||||
$o = array();
|
||||
|
||||
$o[] = '</div>';
|
||||
if ($this->compatible) {
|
||||
$o[] = '</div>';
|
||||
}
|
||||
return implode("\n", $o);
|
||||
}
|
||||
|
||||
|
||||
public function jsJorderTable($listOrder) {
|
||||
|
||||
$js = 'Joomla.orderTable = function() {' . "\n"
|
||||
.' table = document.getElementById("sortTable");' . "\n"
|
||||
.' direction = document.getElementById("directionTable");' . "\n"
|
||||
.' order = table.options[table.selectedIndex].value;' . "\n"
|
||||
.' if (order != \''. $listOrder.'\') {' . "\n"
|
||||
.' dirn = \'asc\';' . "\n"
|
||||
.' } else {' . "\n"
|
||||
.' dirn = direction.options[direction.selectedIndex].value;' . "\n"
|
||||
.' }' . "\n"
|
||||
.' Joomla.tableOrdering(order, dirn, \'\');' . "\n"
|
||||
.'}' . "\n";
|
||||
Factory::getDocument()->addScriptDeclaration($js);
|
||||
}
|
||||
|
||||
public function startForm($option, $view, $id = 'adminForm', $name = 'adminForm') {
|
||||
return '<div id="'.$view.'"><form action="'.Route::_('index.php?option='.$option.'&view='.$view).'" method="post" name="'.$name.'" id="'.$id.'">'."\n";
|
||||
}
|
||||
|
||||
public function endForm() {
|
||||
return '</form>'."\n".'</div>'."\n";
|
||||
}
|
||||
|
||||
public function selectFilterPublished($txtSp, $state) {
|
||||
return '<div class="btn-group pull-right ph-select-status">'. "\n"
|
||||
.'<select name="filter_published" class="form-control" onchange="this.form.submit()">'."\n"
|
||||
. '<option value="">'.Text::_($txtSp).'</option>'
|
||||
. HTMLHelper::_('select.options', HTMLHelper::_('jgrid.publishedOptions', array('archived' => 0, 'trash' => 0)), 'value', 'text', $state, true)
|
||||
.'</select></div>'. "\n";
|
||||
}
|
||||
|
||||
public function selectFilterActived($txtSp, $state) {
|
||||
|
||||
|
||||
switch($state) {
|
||||
case '0':
|
||||
$aS = '';
|
||||
$nS = 'selected';
|
||||
$n = '';
|
||||
|
||||
break;
|
||||
case '1':
|
||||
$aS = 'selected';
|
||||
$nS = '';
|
||||
$n = '';
|
||||
break;
|
||||
default:
|
||||
$aS = '';
|
||||
$nS = '';
|
||||
$n = 'selected';
|
||||
break;
|
||||
}
|
||||
|
||||
return '<div class="btn-group pull-right ph-select-status">'. "\n"
|
||||
.'<select name="filter_actived" class="form-control" onchange="this.form.submit()">'."\n"
|
||||
. '<option value="" '.$n.'>- '.Text::_($txtSp).' -</option>'
|
||||
. '<option value="0" '.$nS.'>'.Text::_('COM_PHOCAEMAIL_NOT_ACTIVE').'</option>'
|
||||
. '<option value="1" '.$aS.'>'.Text::_('COM_PHOCAEMAIL_ACTIVE').'</option>'
|
||||
//. JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array()), 'value', 'text', $state, true)
|
||||
.'</select></div>'. "\n";
|
||||
}
|
||||
|
||||
public function selectFilterType($txtSp, $type, $typeList) {
|
||||
return '<div class="btn-group pull-right">'. "\n"
|
||||
.'<select name="filter_type" class="form-control" onchange="this.form.submit()">'."\n"
|
||||
. '<option value="">'.Text::_($txtSp).'</option>'
|
||||
. HTMLHelper::_('select.options', $typeList, 'value', 'text', $type, true)
|
||||
.'</select></div>'. "\n";
|
||||
}
|
||||
|
||||
public function selectFilterLanguage($txtLng, $state) {
|
||||
return '<div class="btn-group pull-right">'. "\n"
|
||||
.'<select name="filter_language" class="form-control" onchange="this.form.submit()">'."\n"
|
||||
. '<option value="">'.Text::_($txtLng).'</option>'
|
||||
. HTMLHelper::_('select.options', HTMLHelper::_('contentlanguage.existing', true, true), 'value', 'text', $state)
|
||||
.'</select></div>'. "\n";
|
||||
}
|
||||
|
||||
public function selectFilterCategory($categoryList, $txtLng, $state) {
|
||||
return '<div class="btn-group pull-right ">'. "\n"
|
||||
.'<select name="filter_category_id" class="form-control" onchange="this.form.submit()">'."\n"
|
||||
. '<option value="">'.Text::_($txtLng).'</option>'
|
||||
. HTMLHelper::_('select.options', $categoryList, 'value', 'text', $state)
|
||||
. '</select></div>'. "\n";
|
||||
}
|
||||
|
||||
public function selectFilterLevels($txtLng, $state) {
|
||||
$levelList = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5);
|
||||
return
|
||||
'<div class="btn-group pull-right">'. "\n"
|
||||
.'<select name="filter_level" class="form-control" onchange="this.form.submit()">'."\n"
|
||||
. '<option value="">'.Text::_($txtLng).'</option>'
|
||||
. HTMLHelper::_('select.options', $levelList, 'value', 'text', $state)
|
||||
. '</select></div>'. "\n";
|
||||
}
|
||||
|
||||
public function inputFilterSearch($txtSl, $txtSd, $state) {
|
||||
return '<div class="filter-search btn-group pull-left">'. "\n"
|
||||
.'<label for="filter_search" class="element-invisible">'.Text::_($txtSl).'</label>'. "\n"
|
||||
.'<input type="text" name="filter_search" placeholder="'.Text::_($txtSd).'" id="filter_search"'
|
||||
.' value="'.$state.'" title="'.Text::_($txtSd).'" />'. "\n"
|
||||
.'</div>'. "\n";
|
||||
}
|
||||
|
||||
/*public function inputFilterSearchClear($txtFs, $txtFc) {
|
||||
return '<div class="btn-group pull-left hidden-phone">'. "\n"
|
||||
.'<button class="btn tip hasTooltip" type="submit" title="'.Text::_($txtFs).'"><i class="icon-search"></i></button>'. "\n"
|
||||
.'<button class="btn tip hasTooltip" type="button" onclick="document.id(\'filter_search\').value=\'\';this.form.submit();"'
|
||||
.' title="'.Text::_($txtFc).'"><i class="icon-remove"></i></button>'. "\n"
|
||||
.'</div>'. "\n";
|
||||
}*//*
|
||||
|
||||
public function inputFilterSearchClear($txtFs, $txtFc) {
|
||||
return '<div class="btn-group pull-left hidden-phone">'. "\n"
|
||||
.'<button class="btn tip hasTooltip" type="submit" title="'.Text::_($txtFs).'"><i class="icon-search"></i></button>'. "\n"
|
||||
.'<button class="btn tip hasTooltip" type="button" onclick="document.getElementById(\'filter_search\').value=\'\';this.form.submit();"'
|
||||
.' title="'.Text::_($txtFc).'"><i class="icon-remove"></i></button>'. "\n"
|
||||
.'</div>'. "\n";
|
||||
}
|
||||
|
||||
public function inputFilterSearchLimit($txtSl, $paginationLimitBox) {
|
||||
return '<div class="btn-group pull-right hidden-phone">'. "\n"
|
||||
.'<label for="limit" class="element-invisible">'.Text::_($txtSl).'</label>'. "\n"
|
||||
.$paginationLimitBox ."\n" . '</div>'. "\n";
|
||||
}
|
||||
|
||||
public function selectFilterDirection($txtOd, $txtOasc, $txtOdesc, $listDirn) {
|
||||
$ascDir = $descDir = '';
|
||||
if ($listDirn == 'asc') {$ascDir = 'selected="selected"';}
|
||||
if ($listDirn == 'desc') {$descDir = 'selected="selected"';}
|
||||
return '<div class="btn-group pull-right hidden-phone">'. "\n"
|
||||
.'<label for="directionTable" class="element-invisible">' .Text::_('JFIELD_ORDERING_DESC').'</label>'. "\n"
|
||||
.'<select name="directionTable" id="directionTable" class="input-medium" onchange="Joomla.orderTable()">'. "\n"
|
||||
.'<option value="">' .Text::_('JFIELD_ORDERING_DESC').'</option>'. "\n"
|
||||
.'<option value="asc" '.$ascDir.'>' . Text::_('JGLOBAL_ORDER_ASCENDING').'</option>'. "\n"
|
||||
.'<option value="desc" '.$descDir.'>' . Text::_('JGLOBAL_ORDER_DESCENDING').'</option>'. "\n"
|
||||
.'</select>'. "\n"
|
||||
.'</div>'. "\n";
|
||||
}
|
||||
|
||||
public function selectFilterSortBy($txtSb, $sortFields, $listOrder) {
|
||||
return '<div class="btn-group pull-right">'. "\n"
|
||||
.'<label for="sortTable" class="element-invisible">'.Text::_($txtSb).'</label>'. "\n"
|
||||
.'<select name="sortTable" id="sortTable" class="input-medium" onchange="Joomla.orderTable()">'. "\n"
|
||||
.'<option value="">'.Text::_($txtSb).'</option>'. "\n"
|
||||
. HTMLHelper::_('select.options', $sortFields, 'value', 'text', $listOrder). "\n"
|
||||
.'</select>'. "\n"
|
||||
.'</div>'. "\n";
|
||||
}
|
||||
|
||||
public function startTable($id) {
|
||||
return '<table class="table table-striped" id="'.$id.'">'. "\n";
|
||||
}
|
||||
|
||||
public function endTable() {
|
||||
return '</table>'. "\n";
|
||||
}
|
||||
public function tblFoot($listFooter, $columns) {
|
||||
return '<tfoot>' . "\n" . '<tr><td colspan="'.(int)$columns.'">'.$listFooter.'</td></tr>'. "\n".'</tfoot>'. "\n";
|
||||
}
|
||||
|
||||
public function startTblHeader() {
|
||||
return '<thead>'."\n".'<tr>'."\n";
|
||||
}
|
||||
|
||||
public function endTblHeader() {
|
||||
return '</tr>'."\n".'</thead>'."\n";
|
||||
}
|
||||
|
||||
public function thOrdering($txtHo, $listDirn, $listOrder ) {
|
||||
return '<th class="nowrap center hidden-phone ph-ordering">'. "\n"
|
||||
. HTMLHelper::_('searchtools.sort', '<i class="icon-menu-2"></i>', 'a.ordering', $listDirn, $listOrder, null, 'asc', $txtHo). "\n"
|
||||
. '</th>';
|
||||
}
|
||||
|
||||
public function thOrderingXML($txtHo, $listDirn, $listOrder, $prefix = 'a', $empty = false ) {
|
||||
|
||||
if ($empty) {
|
||||
return '<th class="nowrap center text-center ph-ordering"></th>'. "\n";
|
||||
}
|
||||
|
||||
return '<th class="nowrap center text-center ph-ordering">'. "\n"
|
||||
. HTMLHelper::_('searchtools.sort', '', strip_tags($prefix).'.ordering', $listDirn, $listOrder, null, 'asc', $txtHo, 'icon-menu-2'). "\n"
|
||||
. '</th>';
|
||||
//JHtml::_('searchtools.sort', $this->t['l'].'_IN_STOCK', 'a.stock', $listDirn, $listOrder ).'</th>'."\n";
|
||||
|
||||
}
|
||||
|
||||
public function thCheck($txtCh) {
|
||||
return '<th class="hidden-phone ph-check">'. "\n"
|
||||
.'<input type="checkbox" name="checkall-toggle" value="" title="'.Text::_($txtCh).'" onclick="Joomla.checkAll(this)" />'. "\n"
|
||||
.'</th>'. "\n";
|
||||
}
|
||||
|
||||
public function tdOrder($canChange, $saveOrder, $orderkey, $ordering = 0){
|
||||
|
||||
$o = '<td class="order nowrap center hidden-phone">'. "\n";
|
||||
if ($canChange) {
|
||||
$disableClassName = '';
|
||||
$disabledLabel = '';
|
||||
if (!$saveOrder) {
|
||||
$disabledLabel = Text::_('JORDERINGDISABLED');
|
||||
$disableClassName = 'inactive tip-top';
|
||||
}
|
||||
$o .= '<span class="sortable-handler hasTooltip '.$disableClassName.'" title="'.$disabledLabel.'"><i class="icon-menu"></i></span>'."\n";
|
||||
} else {
|
||||
$o .= '<span class="sortable-handler inactive"><i class="icon-menu"></i></span>'."\n";
|
||||
}
|
||||
$orderkeyPlus = $ordering;//$orderkey + 1;
|
||||
$o .= '<input type="text" style="display:none" name="order[]" size="5" value="'.$orderkeyPlus.'" />'. "\n"
|
||||
.'</td>'. "\n";
|
||||
return $o;
|
||||
}
|
||||
/*
|
||||
public function tdRating($ratingAvg) {
|
||||
$o = '<td class="small hidden-phone">';
|
||||
$voteAvg = round(((float)$ratingAvg / 0.5)) * 0.5;
|
||||
$voteAvgWidth = 16 * $voteAvg;
|
||||
$o .= '<ul class="star-rating-small">'
|
||||
.'<li class="current-rating" style="width:'.$voteAvgWidth.'px"></li>'
|
||||
.'<li><span class="star1"></span></li>';
|
||||
|
||||
for ($ir = 2;$ir < 6;$ir++) {
|
||||
$o .= '<li><span class="stars'.$ir.'"></span></li>';
|
||||
}
|
||||
$o .= '</ul>';
|
||||
$o .='</td>'. "\n";
|
||||
return $o;
|
||||
}
|
||||
|
||||
public function tdLanguage($lang, $langTitle, $langTitleE ) {
|
||||
|
||||
$o = '<td class="small nowrap hidden-phone">';
|
||||
if ($lang == '*') {
|
||||
$o .= Text::_('JALL');
|
||||
} else {
|
||||
if ($langTitle) {
|
||||
$o .= $langTitleE;
|
||||
} else {
|
||||
$o .= Text::_('JUNDEFINED');;
|
||||
}
|
||||
}
|
||||
$o .= '</td>'. "\n";
|
||||
return $o;
|
||||
}
|
||||
|
||||
/*public function formInputs($listOrder, $originalOrders) {
|
||||
|
||||
return '<input type="hidden" name="task" value="" />'. "\n"
|
||||
.'<input type="hidden" name="boxchecked" value="0" />'. "\n"
|
||||
.'<input type="hidden" name="filter_order" value="'.$listOrder.'" />'. "\n"
|
||||
.'<input type="hidden" name="filter_order_Dir" value="" />'. "\n"
|
||||
. HTMLHelper::_('form.token'). "\n"
|
||||
.'<input type="hidden" name="original_order_values" value="'. implode(',', $originalOrders).'" />'. "\n";
|
||||
}*/
|
||||
/*
|
||||
public function formInputs($listOrder, $listDirn, $originalOrders) {
|
||||
|
||||
return '<input type="hidden" name="task" value="" />'. "\n"
|
||||
.'<input type="hidden" name="boxchecked" value="0" />'. "\n"
|
||||
.'<input type="hidden" name="filter_order" value="'.$listOrder.'" />'. "\n"
|
||||
.'<input type="hidden" name="filter_order_Dir" value="'.$listDirn.'" />'. "\n"
|
||||
. HTMLHelper::_('form.token'). "\n"
|
||||
.'<input type="hidden" name="original_order_values" value="'. implode(',', $originalOrders).'" />'. "\n";
|
||||
}
|
||||
|
||||
public function formInputsXml($listOrder, $listDirn, $originalOrders) {
|
||||
|
||||
return '<input type="hidden" name="task" value="" />'. "\n"
|
||||
.'<input type="hidden" name="boxchecked" value="0" />'. "\n"
|
||||
//.'<input type="hidden" name="filter_order" value="'.$listOrder.'" />'. "\n"
|
||||
//.'<input type="hidden" name="filter_order_Dir" value="'.$listDirn.'" />'. "\n"
|
||||
. HTMLHelper::_('form.token'). "\n"
|
||||
.'<input type="hidden" name="original_order_values" value="'. implode(',', $originalOrders).'" />'. "\n";
|
||||
}
|
||||
|
||||
public function td($value, $class = '') {
|
||||
if ($class != ''){
|
||||
return '<td class="'.$class.'">'. $value.'</td>'. "\n";
|
||||
} else {
|
||||
return '<td>'. $value.'</td>'. "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function tdPublishDownUp ($publishUp, $publishDown, $langPref) {
|
||||
|
||||
$o = '';
|
||||
$db = Factory::getDBO();
|
||||
//$app = JFactory::getApplication();
|
||||
$nullDate = $db->getNullDate();
|
||||
$now = Factory::getDate();
|
||||
$config = Factory::getConfig();
|
||||
$publish_up = Factory::getDate($publishUp);
|
||||
$publish_down = Factory::getDate($publishDown);
|
||||
$tz = new DateTimeZone($config->get('offset'));
|
||||
$publish_up->setTimezone($tz);
|
||||
$publish_down->setTimezone($tz);
|
||||
|
||||
|
||||
if ( $now->toUnix() <= $publish_up->toUnix() ) {
|
||||
$text = Text::_( $langPref . '_PENDING' );
|
||||
} else if ( ( $now->toUnix() <= $publish_down->toUnix() || $publishDown == $nullDate ) ) {
|
||||
$text = Text::_( $langPref . '_ACTIVE' );
|
||||
} else if ( $now->toUnix() > $publish_down->toUnix() ) {
|
||||
$text = Text::_( $langPref . '_EXPIRED' );
|
||||
}
|
||||
|
||||
$times = '';
|
||||
if (isset($publishUp)) {
|
||||
if ($publishUp == $nullDate) {
|
||||
$times .= "\n". Text::_( $langPref . '_START') . ': '.Text::_( $langPref . '_ALWAYS' );
|
||||
} else {
|
||||
$times .= "\n". Text::_( $langPref . '_START') .": ". $publish_up->format("D, d M Y H:i:s");
|
||||
}
|
||||
}
|
||||
if (isset($publishDown)) {
|
||||
if ($publishDown == $nullDate) {
|
||||
$times .= "\n". Text::_( $langPref . '_FINISH'). ': '. Text::_( $langPref . '_NO_EXPIRY' );
|
||||
} else {
|
||||
$times .= "\n". Text::_( $langPref . '_FINISH') .": ". $publish_down->format("D, d M Y H:i:s");
|
||||
}
|
||||
}
|
||||
|
||||
if ( $times ) {
|
||||
$o .= '<td align="center">'
|
||||
.'<span class="editlinktip hasTip" title="'. Text::_( $langPref . '_PUBLISH_INFORMATION' ).': '. $times.'">'
|
||||
.'<a href="javascript:void(0);" >'. $text.'</a></span>'
|
||||
.'</td>'. "\n";
|
||||
} else {
|
||||
$o .= '<td></td>'. "\n";
|
||||
}
|
||||
return $o;
|
||||
}
|
||||
|
||||
public function saveOrder($t, $listDirn) {
|
||||
|
||||
$saveOrderingUrl = 'index.php?option=' . $t['o'] . '&task=' . $t['tasks'] . '.saveOrderAjax&tmpl=component&' . Session::getFormToken() . '=1';
|
||||
if ($this->compatible) {
|
||||
HTMLHelper::_('draggablelist.draggable');
|
||||
} else {
|
||||
HTMLHelper::_('sortablelist.sortable', 'categoryList', 'adminForm', strtolower($listDirn), $saveOrderingUrl, false, true);
|
||||
}
|
||||
|
||||
return $saveOrderingUrl;
|
||||
}
|
||||
|
||||
public function firstColumnHeader($listDirn, $listOrder, $prefix = 'a', $empty = false) {
|
||||
if ($this->compatible) {
|
||||
// to do empty
|
||||
return '<th class="w-1 text-center ph-check">'. HTMLHelper::_('grid.checkall').'</td>';
|
||||
} else {
|
||||
return $this->thOrderingXML('JGRID_HEADING_ORDERING', $listDirn, $listOrder, $prefix, $empty);
|
||||
}
|
||||
}
|
||||
|
||||
public function secondColumnHeader($listDirn, $listOrder, $prefix = 'a', $empty = false) {
|
||||
if ($this->compatible) {
|
||||
return $this->thOrderingXML('JGRID_HEADING_ORDERING', $listDirn, $listOrder, $prefix, $empty);
|
||||
} else {
|
||||
// to do empty
|
||||
return $this->thCheck('JGLOBAL_CHECK_ALL');
|
||||
}
|
||||
}
|
||||
|
||||
public function startTblBody($saveOrder, $saveOrderingUrl, $listDirn) {
|
||||
|
||||
$o = array();
|
||||
|
||||
if ($this->compatible) {
|
||||
$o[] = '<tbody';
|
||||
if ($saveOrder){
|
||||
$o[] = ' class="js-draggable" data-url="'. $saveOrderingUrl.'" data-direction="'. strtolower($listDirn).'" data-nested="true"';
|
||||
}
|
||||
$o[] = '>';
|
||||
|
||||
} else {
|
||||
$o[] = '<tbody>'. "\n";
|
||||
}
|
||||
|
||||
return implode("", $o);
|
||||
}
|
||||
|
||||
public function endTblBody() {
|
||||
return '</tbody>'. "\n";
|
||||
}
|
||||
|
||||
public function startTr($i, $catid = 0){
|
||||
$iD = $i % 2;
|
||||
if ($this->compatible) {
|
||||
return '<tr class="row'.$iD.'" data-draggable-group="'. $catid.'">'. "\n";
|
||||
} else {
|
||||
|
||||
return '<tr class="row'.$iD.'" sortable-group-id="'.$catid.'" >'. "\n";
|
||||
}
|
||||
}
|
||||
|
||||
public function endTr() {
|
||||
return '</tr>'."\n";
|
||||
}
|
||||
|
||||
public function firstColumn($i, $itemId, $canChange, $saveOrder, $orderkey, $ordering) {
|
||||
if ($this->compatible) {
|
||||
return $this->td( HTMLHelper::_('grid.id', $i, $itemId), 'text-center');
|
||||
} else {
|
||||
return $this->tdOrder($canChange, $saveOrder, $orderkey, $ordering);
|
||||
}
|
||||
}
|
||||
|
||||
public function secondColumn($i, $itemId, $canChange, $saveOrder, $orderkey, $ordering) {
|
||||
|
||||
if ($this->compatible) {
|
||||
|
||||
$o = array();
|
||||
$o[] = '<td class="text-center d-none d-md-table-cell">';
|
||||
|
||||
$iconClass = '';
|
||||
if (!$canChange) {
|
||||
$iconClass = ' inactive';
|
||||
} else if (!$saveOrder) {
|
||||
$iconClass = ' inactive" title="' . Text::_('JORDERINGDISABLED');
|
||||
}
|
||||
|
||||
$o[] = '<span class="sortable-handler'. $iconClass.'"><span class="fas fa-ellipsis-v" aria-hidden="true"></span></span>';
|
||||
|
||||
if ($canChange && $saveOrder) {
|
||||
$o[] = '<input type="text" name="order[]" size="5" value="' . $ordering . '" class="width-20 text-area-order hidden">';
|
||||
}
|
||||
|
||||
$o[] = '</td>';
|
||||
|
||||
return implode("", $o);
|
||||
|
||||
} else {
|
||||
return $this->td(HTMLHelper::_('grid.id', $i, $itemId), "small ");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function startFilter($txtFilter = ''){
|
||||
$o = '<div id="j-sidebar-container" class="span2">'."\n". JHtmlSidebar::render()."\n";
|
||||
|
||||
if ($txtFilter != '') {
|
||||
|
||||
|
||||
|
||||
$o .= '<hr />'."\n" . '<div class="filter-select ">'."\n"
|
||||
. '<h4 class="page-header">'. Text::_($txtFilter).'</h4>'."\n";
|
||||
} else {
|
||||
$o .= '<div>';
|
||||
|
||||
}
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
public function endFilter() {
|
||||
return '</div>' . "\n" . '</div>' . "\n";
|
||||
}
|
||||
|
||||
public function startFilterBar($id = 0) {
|
||||
if ((int)$id > 0) {
|
||||
return '<div id="filter-bar'.$id.'" class="btn-toolbar ph-btn-toolbar-'.$id.'">'. "\n";
|
||||
} else {
|
||||
return '<div id="filter-bar'.$id.'" class="btn-toolbar">'. "\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function endFilterBar() {
|
||||
return '</div>' . "\n" . '<div class="clearfix"> </div>'. "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function tdImage($item, $button, $txtE, $class = '', $avatarAbs = '', $avatarRel = '') {
|
||||
$o = '<td class="'.$class.'">'. "\n";
|
||||
$o .= '<div class="pg-msnr-container"><div class="phocagallery-box-file">'. "\n"
|
||||
.' <center>'. "\n"
|
||||
.' <div class="phocagallery-box-file-first">'. "\n"
|
||||
.' <div class="phocagallery-box-file-second">'. "\n"
|
||||
.' <div class="phocagallery-box-file-third">'. "\n"
|
||||
.' <center>'. "\n";
|
||||
|
||||
if ($avatarAbs != '' && $avatarRel != '') {
|
||||
// AVATAR
|
||||
if (File::exists($avatarAbs.$item->avatar)){
|
||||
$o .= '<a class="'. $button->methodname.'"'
|
||||
//.' title="'. $button->text.'"'
|
||||
.' href="'.Uri::root().$avatarRel.$item->avatar.'" '
|
||||
//.' rel="'. $button->options.'"'
|
||||
. ' >'
|
||||
.'<img src="'.Uri::root().$avatarRel.$item->avatar.'?imagesid='.md5(uniqid(time())).'" alt="'.Text::_($txtE).'" />'
|
||||
.'</a>';
|
||||
} else {
|
||||
$o .= HTMLHelper::_( 'image', '/media/com_phocagallery/images/administrator/phoca_thumb_s_no_image.gif', '');
|
||||
}
|
||||
} else {
|
||||
// PICASA
|
||||
if (isset($item->extid) && $item->extid !='') {
|
||||
|
||||
$resW = explode(',', $item->extw);
|
||||
$resH = explode(',', $item->exth);
|
||||
$correctImageRes = PhocaGalleryImage::correctSizeWithRate($resW[2], $resH[2], 50, 50);
|
||||
$imgLink = $item->extl;
|
||||
|
||||
//$o .= '<a class="'. $button->modalname.'" title="'.$button->text.'" href="'. $imgLink .'" rel="'. $button->options.'" >'
|
||||
$o .= '<a class="'. $button->methodname.'" href="'. $imgLink .'" >'
|
||||
. '<img src="'.$item->exts.'?imagesid='.md5(uniqid(time())).'" width="'.$correctImageRes['width'].'" height="'.$correctImageRes['height'].'" alt="'.Text::_($txtE).'" />'
|
||||
.'</a>'. "\n";
|
||||
} else if (isset ($item->fileoriginalexist) && $item->fileoriginalexist == 1) {
|
||||
|
||||
$imageRes = PhocaGalleryImage::getRealImageSize($item->filename, 'small');
|
||||
$correctImageRes = PhocaGalleryImage::correctSizeWithRate($imageRes['w'], $imageRes['h'], 50, 50);
|
||||
$imgLink = PhocaGalleryFileThumbnail::getThumbnailName($item->filename, 'large');
|
||||
|
||||
//$o .= '<a class="'. $button->modalname.'" title="'. $button->text.'" href="'. JUri::root(). $imgLink->rel.'" rel="'. $button->options.'" >'
|
||||
$o .= '<a class="'. $button->methodname.'" href="'. Uri::root(). $imgLink->rel.'" >'
|
||||
. '<img src="'.Uri::root().$item->linkthumbnailpath.'?imagesid='.md5(uniqid(time())).'" width="'.$correctImageRes['width'].'" height="'.$correctImageRes['height'].'" alt="'.Text::_($txtE).'" itemprop="thumbnail" />'
|
||||
.'</a>'. "\n";
|
||||
} else {
|
||||
$o .= HTMLHelper::_( 'image', 'media/com_phocagallery/images/administrator/phoca_thumb_s_no_image.gif', '');
|
||||
}
|
||||
}
|
||||
$o .= ' </center>'. "\n"
|
||||
.' </div>'. "\n"
|
||||
.' </div>'. "\n"
|
||||
.' </div>'. "\n"
|
||||
.' </center>'. "\n"
|
||||
.'</div></div>'. "\n";
|
||||
$o .= '</td>'. "\n";
|
||||
return $o;
|
||||
}*/
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,610 @@
|
||||
<?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
|
||||
* @extension Phoca Extension
|
||||
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
||||
*/
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
class PhocaDownloadRenderFront
|
||||
{
|
||||
|
||||
public static function renderMainJs() {
|
||||
|
||||
$app = Factory::getApplication();
|
||||
$doc = $app->getDocument();
|
||||
|
||||
$oVars = array();
|
||||
$oLang = array();
|
||||
$oParams = array();
|
||||
/* $oLang = array(
|
||||
'COM_PHOCAGALLERY_MAX_LIMIT_CHARS_REACHED' => Text::_('COM_PHOCAGALLERY_MAX_LIMIT_CHARS_REACHED'),
|
||||
'COM_PHOCAGALLERY_ENTER_TITLE' => Text::_('COM_PHOCAGALLERY_ENTER_TITLE'),
|
||||
'COM_PHOCAGALLERY_ENTER_COMMENT' => Text::_('COM_PHOCAGALLERY_ENTER_COMMENT')
|
||||
|
||||
);*/
|
||||
|
||||
/// $doc->addScriptOptions('phLangPG', $oLang);
|
||||
//$doc->addScriptOptions('phVarsPG', $oVars);
|
||||
//$doc->addScriptOptions('phParamsPG', $oParams);
|
||||
|
||||
|
||||
HTMLHelper::_('script', 'media/com_phocadownload/js/main.js', array('version' => 'auto'));
|
||||
Factory::getApplication()
|
||||
->getDocument()
|
||||
->getWebAssetManager()
|
||||
->useScript('bootstrap.modal');
|
||||
}
|
||||
|
||||
public static function renderAllCSS($noBootStrap = 0) {
|
||||
$app = Factory::getApplication();
|
||||
$itemid = $app->input->get('Itemid', 0, 'int');
|
||||
$db = Factory::getDBO();
|
||||
$query = 'SELECT a.filename as filename, a.type as type, a.menulink as menulink'
|
||||
.' FROM #__phocadownload_styles AS a'
|
||||
.' WHERE a.published = 1'
|
||||
.' ORDER BY a.type, a.ordering ASC';
|
||||
$db->setQuery($query);
|
||||
$filenames = $db->loadObjectList();
|
||||
if (!empty($filenames)) {
|
||||
foreach ($filenames as $fk => $fv) {
|
||||
|
||||
$path = PhocaDownloadFile::getCSSPath($fv->type, 1);
|
||||
|
||||
if ($fv->menulink != '' && (int)$fv->menulink > 1) {
|
||||
|
||||
$menuLinks = explode(',', $fv->menulink);
|
||||
$isIncluded = in_array((int)$itemid, $menuLinks);
|
||||
if ($isIncluded) {
|
||||
HTMLHelper::stylesheet($path . $fv->filename );
|
||||
}
|
||||
} else {
|
||||
HTMLHelper::stylesheet($path . $fv->filename );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function displayMirrorLinks($view = 1, $link = '', $title = '', $target = '') {
|
||||
|
||||
$paramsC = ComponentHelper::getParams( 'com_phocadownload' );
|
||||
$param['display_mirror_links'] = $paramsC->get( 'display_mirror_links', 0 );
|
||||
$o = '';
|
||||
|
||||
$displayM = 0;
|
||||
if ($view == 1) {
|
||||
//Category View
|
||||
if ($param['display_mirror_links'] == 1 || $param['display_mirror_links'] == 3
|
||||
|| $param['display_mirror_links'] == 4 || $param['display_mirror_links'] == 6) {
|
||||
$displayM = 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
//File View
|
||||
if ($param['display_mirror_links'] == 2 || $param['display_mirror_links'] == 3
|
||||
|| $param['display_mirror_links'] == 5 || $param['display_mirror_links'] == 6) {
|
||||
$displayM = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($displayM == 1 && $link != '' && PhocaDownloadUtils::isURLAddress($link) && $title != '') {
|
||||
|
||||
$targetO = '';
|
||||
if ($target != '') {
|
||||
$targetO = 'target="'.$target.'"';
|
||||
}
|
||||
$o .= '<a class="" href="'.$link.'" '.$targetO.'>'.strip_tags($title).'</a>';
|
||||
|
||||
}
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
public static function displayReportLink($view = 1, $title = '') {
|
||||
|
||||
$paramsC = ComponentHelper::getParams( 'com_phocadownload' );
|
||||
$param['display_report_link'] = $paramsC->get( 'display_report_link', 0 );
|
||||
$param['report_link_guestbook_id'] = $paramsC->get( 'report_link_guestbook_id', 0 );
|
||||
$o = '';
|
||||
|
||||
$displayL = 0;
|
||||
if ($view == 1) {
|
||||
//Category View
|
||||
if ($param['display_report_link'] == 1 || $param['display_report_link'] == 3) {
|
||||
$displayL = 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
//File View
|
||||
if ($param['display_report_link'] == 2 || $param['display_report_link'] == 3) {
|
||||
$displayL = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($displayL == 1 && (int)$param['report_link_guestbook_id'] > 0) {
|
||||
|
||||
$onclick = "window.open(this.href,'win2','width=600,height=500,scrollbars=yes,menubar=no,resizable=yes'); return false;";
|
||||
//$href = JRoute::_('index.php?option=com_phocaguestbook&view=guestbook&id='.(int)$param['report_link_guestbook_id'].'&reporttitle='.strip_tags($title).'&tmpl=component&Itemid='. JFactory::getApplication()->input->get('Itemid', 0, '', 'int') );
|
||||
|
||||
$href = PhocaDownloadRoute::getGuestbookRoute((int)$param['report_link_guestbook_id'],urlencode(strip_tags($title) ));
|
||||
//$href = JRoute::_('index.php?option=com_phocaguestbook&view=guestbook&id='.(int)$param['report_link_guestbook_id'].'&reporttitle='.strip_tags($title).'&tmpl=component');
|
||||
|
||||
|
||||
$o .= '<a href="'.$href.'#pgbTabForm" onclick="'.$onclick.'">'.Text::_('COM_PHOCADOWNLOAD_REPORT').'</a>';
|
||||
|
||||
}
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
public static function displayNewIcon ($date, $time = 0) {
|
||||
|
||||
if ($time == 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$dateAdded = strtotime($date, time());
|
||||
$dateToday = time();
|
||||
$dateExists = $dateToday - $dateAdded;
|
||||
$dateNew = $time * 24 * 60 * 60;
|
||||
|
||||
|
||||
if ($dateExists < $dateNew) {
|
||||
//return ' '. JHtml::_('image', 'media/com_phocadownload/images/icon-new.png', JText::_('COM_PHOCADOWNLOAD_NEW'));
|
||||
return ' <span class="label label-warning badge bg-warning">'.Text::_('COM_PHOCADOWNLOAD_LABEL_TXT_NEW').'</span>';
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static function displayHotIcon ($hits, $requiredHits = 0) {
|
||||
|
||||
if ($requiredHits == 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($requiredHits <= $hits) {
|
||||
//return ' '. JHtml::_('image', 'media/com_phocadownload/images/icon-hot.png', JText::_('COM_PHOCADOWNLOAD_HOT'));
|
||||
return ' <span class="label label-important label-danger badge bg-danger">'.Text::_('COM_PHOCADOWNLOAD_LABEL_TXT_HOT').'</span>';
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
public static function renderOnUploadJS() {
|
||||
|
||||
$tag = "<script type=\"text/javascript\"> \n"
|
||||
. "function OnUploadSubmitFile() { \n"
|
||||
. "if ( document.getElementById('catid').value < 1 ) { \n"
|
||||
. "alert('".Text::_('COM_PHOCADOWNLOAD_PLEASE_SELECT_CATEGORY')."'); \n"
|
||||
. "return false; \n"
|
||||
. "} \n"
|
||||
. "document.getElementById('loading-label-file').style.display='block'; \n"
|
||||
. "return true; \n"
|
||||
. "} \n"
|
||||
. "</script>";
|
||||
|
||||
return $tag;
|
||||
}
|
||||
|
||||
public static function renderDescriptionUploadJS($chars) {
|
||||
|
||||
$tag = "<script type=\"text/javascript\"> \n"
|
||||
."function countCharsUpload() {" . "\n"
|
||||
."var maxCount = ".$chars.";" . "\n"
|
||||
."var pdu = document.getElementById('phocadownload-upload-form');" . "\n"
|
||||
."var charIn = pdu.phocadownloaduploaddescription.value.length;" . "\n"
|
||||
."var charLeft = maxCount - charIn;" . "\n"
|
||||
."" . "\n"
|
||||
."if (charLeft < 0) {" . "\n"
|
||||
." alert('".Text::_('COM_PHOCADOWNLOAD_MAX_LIMIT_CHARS_REACHED')."');" . "\n"
|
||||
." pdu.phocadownloaduploaddescription.value = pdu.phocadownloaduploaddescription.value.substring(0, maxCount);" . "\n"
|
||||
." charIn = maxCount;" . "\n"
|
||||
." charLeft = 0;" . "\n"
|
||||
."}" . "\n"
|
||||
."pdu.phocadownloaduploadcountin.value = charIn;" . "\n"
|
||||
."pdu.phocadownloaduploadcountleft.value = charLeft;" . "\n"
|
||||
."}" . "\n"
|
||||
. "</script>";
|
||||
|
||||
return $tag;
|
||||
}
|
||||
|
||||
public static function userTabOrdering() {
|
||||
$js = "\t". '<script language="javascript" type="text/javascript">'."\n"
|
||||
. 'function tableOrdering( order, dir, task )' . "\n"
|
||||
. '{ ' . "\n"
|
||||
. "\t".'var form = document.phocadownloadfilesform;' . "\n"
|
||||
. "\t".'form.filter_order.value = order;' . "\n"
|
||||
. "\t".'form.filter_order_Dir.value = dir;' . "\n"
|
||||
. "\t".'document.phocadownloadfilesform.submit();' . "\n"
|
||||
. '}'. "\n"
|
||||
. '</script>' . "\n";
|
||||
|
||||
return $js;
|
||||
}
|
||||
|
||||
public static function renderOverlibCSS($ol_fg_color, $ol_bg_color, $ol_tf_color, $ol_cf_color, $opacity = 0.8) {
|
||||
|
||||
$opacityPer = (float)$opacity * 100;
|
||||
|
||||
$css = "<style type=\"text/css\">\n"
|
||||
|
||||
. ".bgPhocaClass{
|
||||
background:".$ol_bg_color.";
|
||||
filter:alpha(opacity=".$opacityPer.");
|
||||
opacity: ".$opacity.";
|
||||
-moz-opacity:".$opacity.";
|
||||
z-index:1000;
|
||||
}
|
||||
.fgPhocaClass{
|
||||
background:".$ol_fg_color.";
|
||||
filter:alpha(opacity=100);
|
||||
opacity: 1;
|
||||
-moz-opacity:1;
|
||||
z-index:1000;
|
||||
}
|
||||
.fontPhocaClass{
|
||||
color:".$ol_tf_color.";
|
||||
z-index:1001;
|
||||
}
|
||||
.capfontPhocaClass, .capfontclosePhocaClass{
|
||||
color:".$ol_cf_color.";
|
||||
font-weight:bold;
|
||||
z-index:1001;
|
||||
}"
|
||||
." </style>\n";
|
||||
|
||||
return $css;
|
||||
}
|
||||
|
||||
public static function renderBootstrapModalJs($item = '.btn') {
|
||||
|
||||
$document = Factory::getDocument();
|
||||
HTMLHelper::_('jquery.framework', false);
|
||||
$s = '
|
||||
jQuery(document).ready(function(){
|
||||
|
||||
jQuery("#phModalPlay").on("hidden.bs.modal", function (e) {
|
||||
jQuery("#phModalPlay iframe").attr("src", jQuery("#phModalPlay iframe").attr("src"));
|
||||
jQuery("audio").each(function(){this.pause();this.currentTime = 0;});
|
||||
jQuery("video").each(function(){this.pause();this.currentTime = 0;});
|
||||
});
|
||||
|
||||
|
||||
jQuery("'.$item.'").on("click", function () {
|
||||
var $target = jQuery(this).data("target");
|
||||
var $href = jQuery(this).data("href");
|
||||
var $body = $target + "Body";
|
||||
var $dialog = $target + "Dialog";
|
||||
var $height = jQuery(this).data("height");
|
||||
var $width = jQuery(this).data("width");
|
||||
var $heightD= jQuery(this).data("height-dialog");
|
||||
var $widthD = jQuery(this).data("width-dialog");
|
||||
var $type = jQuery(this).data("type");
|
||||
jQuery($body).css("height", $height);
|
||||
jQuery($target).css("width", $width);
|
||||
jQuery($body).css("overflow-y", "auto");
|
||||
jQuery($dialog).css("height", $heightD);
|
||||
jQuery($dialog).css("width", $widthD);
|
||||
|
||||
|
||||
if ($type == "image") {
|
||||
jQuery($body).html(\'<img class="img-responsive" src="\' + $href + \'" />\');
|
||||
} else if ($type == "document") {
|
||||
$widthD = $widthD -50;
|
||||
$heightD = $heightD -40;
|
||||
jQuery($body).html(\'<object type="application/pdf" data="\' + $href + \'" width="\' + $widthD + \'" height="\' + $heightD + \'" ></object>\');
|
||||
} else {
|
||||
|
||||
/*jQuery($body).load($href, function (response, status, xhr) {
|
||||
if (status == "success") {
|
||||
|
||||
|
||||
//jQuery($target).modal({ show: true });
|
||||
}
|
||||
});*/
|
||||
}
|
||||
|
||||
});
|
||||
});';
|
||||
$document->addScriptDeclaration($s);
|
||||
}
|
||||
|
||||
/* Launch
|
||||
<a type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#phModalDetail" data-href="..." data-height="500px">..</a>
|
||||
*/
|
||||
|
||||
public static function bootstrapModalHtml($item = 'phModal', $title = '') {
|
||||
|
||||
$close = Text::_('COM_PHOCADOWNLAD_CLOSE');
|
||||
$o = '<div id="'.$item.'" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="'.$item.'Label">
|
||||
<div class="modal-dialog" role="document" id="'.$item.'Dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-title" id="'.$item.'Label">'.$title.'</h3>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="'.$close.'"></button>
|
||||
</div>
|
||||
<div class="modal-body" id="'.$item.'Body" ></div>
|
||||
<div class="modal-footer"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
public static function renderPhocaDownload() {
|
||||
return '<div sty'.'le="t'.'ext-al'.'ign:ri'.'ght;">Po'
|
||||
.'wered by <a href="ht'.'tp://www.pho'
|
||||
.'ca.cz/phocad'.'ownload" targe'
|
||||
.'t="_bla'.'nk" title="Pho'.'ca Dow'
|
||||
.'nload">Phoca Down'.'load</a></div>';
|
||||
}
|
||||
|
||||
public static function renderIcon($type, $img, $alt, $class = '', $attributes = '') {
|
||||
|
||||
//return JHtml::_('image', $img, $alt);
|
||||
|
||||
$paramsC = ComponentHelper::getParams('com_phocadownload');
|
||||
|
||||
// possible FR
|
||||
$icons = 0;//$paramsC->get('icons', 0);
|
||||
|
||||
if ($icons == 0) {
|
||||
return HTMLHelper::_('image', $img, $alt, $attributes);
|
||||
}
|
||||
|
||||
$i = '';
|
||||
|
||||
if ($icons == 1) {
|
||||
|
||||
$icon = array();
|
||||
$icon['view'] = 'zoom-in';
|
||||
$icon['download'] = 'download-alt';
|
||||
$icon['geo'] = 'globe';
|
||||
$icon['bold'] = 'bold';
|
||||
$icon['italic'] = 'italic';
|
||||
$icon['underline'] = 'text-color';
|
||||
$icon['camera'] = 'camera';
|
||||
$icon['comment'] = 'comment';
|
||||
$icon['comment-a'] = 'comment'; //ph-icon-animated
|
||||
$icon['comment-fb'] = 'comment'; //ph-icon-fb
|
||||
$icon['cart'] = 'shopping-cart';
|
||||
$icon['extlink1'] = 'share';
|
||||
$icon['extlink2'] = 'share';
|
||||
$icon['trash'] = 'trash';
|
||||
$icon['publish'] = 'ok';
|
||||
$icon['unpublish'] = 'remove';
|
||||
$icon['viewed'] = 'modal-window';
|
||||
$icon['calendar'] = 'calendar';
|
||||
$icon['vote'] = 'star';
|
||||
$icon['statistics'] = 'stats';
|
||||
$icon['category'] = 'folder-close';
|
||||
$icon['subcategory'] = 'folder-open';
|
||||
$icon['upload'] = 'upload';
|
||||
$icon['upload-ytb'] = 'upload';
|
||||
$icon['upload-multiple'] = 'upload';
|
||||
$icon['upload-java'] = 'upload';
|
||||
$icon['user'] = 'user';
|
||||
$icon['icon-up-images'] = 'arrow-left';
|
||||
$icon['icon-up'] = 'arrow-up';
|
||||
$icon['minus-sign'] = 'minus-sign';
|
||||
$icon['next'] = 'forward';
|
||||
$icon['prev'] = 'backward';
|
||||
$icon['reload'] = 'repeat';
|
||||
$icon['play'] = 'play';
|
||||
$icon['stop'] = 'stop';
|
||||
$icon['pause'] = 'pause';
|
||||
$icon['off'] = 'off';
|
||||
$icon['image'] = 'picture';
|
||||
$icon['save'] = 'floppy-disk';
|
||||
$icon['feed'] = 'bullhorn';
|
||||
$icon['remove'] = 'remove';
|
||||
$icon['search'] = 'zoom-in';
|
||||
$icon['lock'] = 'lock';
|
||||
|
||||
if (isset($icon[$type])) {
|
||||
return '<span class="ph-icon-' . $type . ' glyphicon glyphicon-' . $icon[$type] . ' ' . $class . '"></span>';
|
||||
|
||||
} else {
|
||||
if ($img != '') {
|
||||
return HTMLHelper::_('image', $img, $alt, $attributes);
|
||||
}
|
||||
}
|
||||
|
||||
// NOT glyphicon
|
||||
// smile, sad, lol, confused, wink, cooliris
|
||||
|
||||
// Classes
|
||||
// ph-icon-animated, ph-icon-fb, icon-up-images, ph-icon-disabled
|
||||
|
||||
} else if ($icons == 2) {
|
||||
|
||||
$icon = array();
|
||||
$icon['view'] = 'search';
|
||||
$icon['download'] = 'download';
|
||||
$icon['geo'] = 'globe';
|
||||
$icon['bold'] = 'bold';
|
||||
$icon['italic'] = 'italic';
|
||||
$icon['underline'] = 'underline';
|
||||
$icon['camera'] = 'camera';
|
||||
$icon['comment'] = 'comment';
|
||||
$icon['comment-a'] = 'comment'; //ph-icon-animated
|
||||
$icon['comment-fb'] = 'comment'; //ph-icon-fb
|
||||
$icon['cart'] = 'shopping-cart';
|
||||
$icon['extlink1'] = 'share';
|
||||
$icon['extlink2'] = 'share';
|
||||
$icon['trash'] = 'trash';
|
||||
$icon['publish'] = 'check-circle';
|
||||
$icon['unpublish'] = 'times-circle';
|
||||
$icon['viewed'] = 'window-maximize';
|
||||
$icon['calendar'] = 'calendar';
|
||||
$icon['vote'] = 'star';
|
||||
$icon['statistics'] = 'chart-bar';
|
||||
$icon['category'] = 'folder';
|
||||
$icon['subcategory'] = 'folder-open';
|
||||
$icon['upload'] = 'upload';
|
||||
$icon['upload-ytb'] = 'upload';
|
||||
$icon['upload-multiple'] = 'upload';
|
||||
$icon['upload-java'] = 'upload';
|
||||
$icon['user'] = 'user';
|
||||
$icon['icon-up-images'] = 'arrow-left';
|
||||
$icon['icon-up'] = 'arrow-up';
|
||||
$icon['minus-sign'] = 'minus-circle';
|
||||
$icon['next'] = 'forward';
|
||||
$icon['prev'] = 'backward';
|
||||
$icon['reload'] = 'sync';
|
||||
$icon['play'] = 'play';
|
||||
$icon['stop'] = 'stop';
|
||||
$icon['pause'] = 'pause';
|
||||
$icon['off'] = 'power-off';
|
||||
$icon['image'] = 'image';
|
||||
$icon['save'] = 'save';
|
||||
$icon['feed'] = 'rss';
|
||||
$icon['remove'] = 'times-circle';
|
||||
$icon['search'] = 'search';
|
||||
$icon['lock'] = 'lock';
|
||||
|
||||
|
||||
if (isset($icon[$type])) {
|
||||
return '<span class="ph-icon-' . $type . ' fa fa5 fa-' . $icon[$type] . ' ' . $class . '"></span>';
|
||||
|
||||
} else {
|
||||
if ($img != '') {
|
||||
return HTMLHelper::_('image', $img, $alt, $attributes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function renderHeader($headers = array(), $tag = '', $imageMeta = '')
|
||||
{
|
||||
|
||||
$app = Factory::getApplication();
|
||||
//$menus = $app->getMenu();
|
||||
//$menu = $menus->getActive();
|
||||
$p = $app->getParams();
|
||||
$showPageHeading = $p->get('show_page_heading');
|
||||
$pageHeading = $p->get('page_heading');
|
||||
$displayHeader = $p->get('display_header_type', 'h1');
|
||||
//$hideHeader = $p->get('hide_header_view', array());
|
||||
|
||||
|
||||
|
||||
if ($displayHeader == '-1') {
|
||||
return '';
|
||||
}
|
||||
|
||||
//$view = $app->input->get('view', '', 'string');
|
||||
|
||||
/*if (!empty($hideHeader) && $view != '') {
|
||||
if (in_array($view, $hideHeader)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
if ($tag == '') {
|
||||
$tag = $displayHeader;
|
||||
}
|
||||
|
||||
$h = array();
|
||||
if ($showPageHeading && $pageHeading != '') {
|
||||
$h[] = htmlspecialchars($pageHeading);
|
||||
}
|
||||
|
||||
if (!empty($headers)) {
|
||||
foreach ($headers as $k => $v) {
|
||||
if ($v != '') {
|
||||
$h[] = htmlspecialchars($v);
|
||||
break; // in array there are stored OR items (if empty try next, if not empty use this and do not try next)
|
||||
// PAGE HEADING AND NEXT ITEM OR NEXT NEXT ITEM
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$imgMetaAttr = '';
|
||||
if ($imageMeta != '') {
|
||||
$imgMetaAttr = 'data-image-meta="'.$imageMeta.'"';
|
||||
}
|
||||
|
||||
if (!empty($h)) {
|
||||
return '<' . strip_tags($tag) . ' class="ph-header" '.$imgMetaAttr.'>' . implode(" - ", $h) . '</' . strip_tags($tag) . '>';
|
||||
} else if ($imgMetaAttr != '') {
|
||||
return '<div style="display:none;" '.$imgMetaAttr.'></div>';// use hidden tag for open graph info
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function renderSubHeader($headers = array(), $tag = '', $class = '', $imageMeta = '')
|
||||
{
|
||||
|
||||
$app = Factory::getApplication();
|
||||
//$menus = $app->getMenu();
|
||||
//$menu = $menus->getActive();
|
||||
$p = $app->getParams();
|
||||
//$showPageHeading = $p->get('show_page_heading');
|
||||
//$pageHeading = $p->get('page_heading');
|
||||
$displayHeader = $p->get('display_subheader_type', 'h3');
|
||||
//$hideHeader = $p->get('hide_header_view', array());
|
||||
|
||||
|
||||
|
||||
if ($displayHeader == '-1') {
|
||||
return '';
|
||||
}
|
||||
|
||||
//$view = $app->input->get('view', '', 'string');
|
||||
|
||||
/*if (!empty($hideHeader) && $view != '') {
|
||||
if (in_array($view, $hideHeader)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
if ($tag == '') {
|
||||
$tag = $displayHeader;
|
||||
}
|
||||
|
||||
$h = array();
|
||||
// if ($showPageHeading && $pageHeading != '') {
|
||||
// $h[] = htmlspecialchars($pageHeading);
|
||||
// }
|
||||
|
||||
if (!empty($headers)) {
|
||||
foreach ($headers as $k => $v) {
|
||||
if ($v != '') {
|
||||
$h[] = htmlspecialchars($v);
|
||||
break; // in array there are stored OR items (if empty try next, if not empty use this and do not try next)
|
||||
// PAGE HEADING AND NEXT ITEM OR NEXT NEXT ITEM
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$imgMetaAttr = '';
|
||||
if ($imageMeta != '') {
|
||||
$imgMetaAttr = 'data-image-meta="'.$imageMeta.'"';
|
||||
}
|
||||
|
||||
if (!empty($h)) {
|
||||
return '<' . strip_tags($tag) . ' class="ph-subheader '.htmlspecialchars(strip_tags($class)).'" '.$imgMetaAttr.'>' . implode(" - ", $h) . '</' . strip_tags($tag) . '>';
|
||||
} else if ($imgMetaAttr != '') {
|
||||
return '<div style="display:none;" '.$imgMetaAttr.'></div>';// use hidden tag for open graph info
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,85 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Gallery
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
|
||||
class PhocaDownloadRenderTabs
|
||||
{
|
||||
|
||||
protected $id = '';
|
||||
protected $activeTab = '';
|
||||
protected $countTab = 0;
|
||||
|
||||
public function __construct() {
|
||||
|
||||
$this->id = uniqid();
|
||||
HTMLHelper::_('jquery.framework', false);
|
||||
HTMLHelper::_('script', 'media/com_phocadownload/js/tabs/tabs.js', array('version' => 'auto'));
|
||||
HTMLHelper::_('stylesheet', 'media/com_phocadownload/js/tabs/tabs.css', array('version' => 'auto'));
|
||||
}
|
||||
|
||||
public function setActiveTab($item) {
|
||||
if ($item != '') {
|
||||
$this->activeTab = $item;
|
||||
}
|
||||
}
|
||||
|
||||
public function startTabs() {
|
||||
return '<div class="phTabs" id="phTabsId' . $this->id . '">';
|
||||
}
|
||||
|
||||
|
||||
public function endTabs() {
|
||||
return '</div>';
|
||||
}
|
||||
|
||||
public function renderTabsHeader($items) {
|
||||
|
||||
$o = array();
|
||||
$o[] = '<ul class="phTabsUl">';
|
||||
if (!empty($items)) {
|
||||
$i = 0;
|
||||
foreach ($items as $k => $v) {
|
||||
|
||||
$activeO = '';
|
||||
if ($this->activeTab == '' && $i == 0) {
|
||||
$activeO = ' active';
|
||||
} else if ($this->activeTab == $v['id']) {
|
||||
$activeO = ' active';
|
||||
|
||||
}
|
||||
$o[] = '<li class="phTabsLi"><a class="phTabsA phTabsHeader' . $activeO . '" id="phTabId' . $this->id . 'Item' . $v['id'] . '">' . PhocaDownloadRenderFront::renderIcon($v['icon'], 'media/com_phocadownload/images/icon-' . $v['image'] . '.png', '') . ' ' . $v['title'] . '</a></li>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$o[] = '</ul>';
|
||||
return implode("\n", $o);
|
||||
|
||||
}
|
||||
|
||||
public function startTab($name) {
|
||||
|
||||
$activeO = '';
|
||||
if ($this->activeTab == '' && $this->countTab == 0) {
|
||||
$activeO = ' active';
|
||||
} else if ($this->activeTab == $name) {
|
||||
$activeO = ' active';
|
||||
}
|
||||
$this->countTab++;
|
||||
return '<div class="phTabsContainer' . $activeO . '" id="phTabId' . $this->id . 'Item' . $name . 'Container">';
|
||||
}
|
||||
|
||||
public function endTab() {
|
||||
return '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user