primo commit

This commit is contained in:
2024-12-17 17:34:10 +01:00
commit e650f8df99
16435 changed files with 2451012 additions and 0 deletions

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,98 @@
<?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('JPATH_BASE') or die;
use Joomla\CMS\Form\Field\ListField;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Form\Form;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;
jimport('joomla.html.html');
jimport('joomla.form.formfield');
jimport('joomla.form.helper');
FormHelper::loadFieldClass('list');
class JFormFieldPhocaAccessLevel extends ListField
{
public $type = 'PhocaAccessLevel';
protected function getInput()
{
// Initialize variables.
$attr = '';
// Initialize some field attributes.
$attr .= $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : 'class="form-control"';
$attr .= ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
$attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
$attr .= $this->multiple ? ' multiple="multiple"' : '';
// Initialize JavaScript field attributes.
$attr .= $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';
// Get the field options.
$options = $this->getOptions();
//return JHtml::_('access.level', $this->name, $this->value, $attr, $options, $this->id);
return JFormFieldPhocaAccessLevel::accessLevel( $this->name, $this->value, $attr, $options, $this->id);
}
/*
* Copy of JHtml::_('access.level', $this->name, $this->value, $attr, $options, $this->id);
* because of prevent from loading the "Public"
*/
public static function accessLevel($name, $selected, $attribs = '', $params = true, $id = false)
{
$db = Factory::getDbo();
$query = $db->getQuery(true);
$query->select('a.id AS value, a.title AS text');
$query->from('#__viewlevels AS a');
$query->group('a.id, a.title');
$query->order('a.ordering ASC');
$query->where('a.id <> 1');//PHOCAEDIT
$query->order('`title` ASC');
// Get the options.
$db->setQuery($query);
$options = $db->loadObjectList();
// Check for a database error.
/*if ($db->getErrorNum()) {
throw new Exception($db->getErrorMsg(), 500);
return null;
}*/
// If params is an array, push these options to the array
if (is_array($params)) {
$options = array_merge($params,$options);
}
// If all levels is allowed, push it into the array.
elseif ($params) {
array_unshift($options, HTMLHelper::_('select.option', '', Text::_('JOPTION_ACCESS_SHOW_ALL_LEVELS')));
}
return HTMLHelper::_('select.genericlist', $options, $name,
array(
'list.attr' => $attribs,
'list.select' => $selected,
'id' => $id
)
);
}
}

View File

@ -0,0 +1,93 @@
<?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('JPATH_BASE') or die;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Component\ComponentHelper;
jimport('joomla.form.formfield');
class JFormFieldPhocaColorText extends FormField
{
protected $type = 'PhocaColorText';
protected $phocaParams = null;
protected function getInput() {
$document = Factory::getDocument();
$option = Factory::getApplication()->input->getCmd('option');
$globalValue = $this->_getPhocaParams( $this->element['name'] );
HTMLHelper::stylesheet( 'media/com_phocagallery/js/jcp/picker.css' );
$document->addScript(Uri::base(true).'/media/com_phocagallery/js/jcp/picker.js');
// Initialize some field attributes.
$size = $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
$class = $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
$maxLength = $this->element['maxlength'] ? ' maxlength="'.(int) $this->element['maxlength'].'"' : '';
$readonly = ((string) $this->element['readonly'] == 'true') ? ' readonly="readonly"' : '';
$disabled = ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
// Initialize JavaScript field attributes.
$onchange = $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';
$value = htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8');
// TO DO 1.6
// MENU - Set Default value to "" because of saving "" value into the menu link ( use global = "")
if ($option == "com_menus") {
$DefaultValue = (string)$this->element['default'];
if ($value == $DefaultValue) {
$value = '';
}
}
$html ='<input type="text" name="'.$this->name.'" id="'.$this->id.'" value="'.$value.'"'
.$class.$size.$disabled.$readonly.$onchange.$maxLength.'/>';
// Color Picker
$nameCP = str_replace('[', '_', $this->name);
$nameCP = str_replace(']', '', $nameCP);
$html .= '<span style="margin-left:10px" class="btn" onclick="openPicker(\''.$nameCP.'\')" >' . Text::_('COM_PHOCAGALLERY_PICK_COLOR') . '</span>';
// MENU - Display the global value
if ($option == "com_menus") {
$html .= '<span style="margin-left:10px;">[</span><span style="background:#fff"> ' . $globalValue . ' </span><span>]</span>';
}
return $html;
}
protected function getLabel() {
echo '<div class="clearfix"></div>';
return parent::getLabel();
echo '<div class="clearfix"></div>';
}
protected function _setPhocaParams(){
$component = 'com_phocagallery';
$paramsC = ComponentHelper::getParams($component) ;
$this->phocaParams = $paramsC;
}
protected function _getPhocaParams( $name ){
// Don't call sql query by every param item (it will be loaded only one time)
if (!$this->phocaParams) {
$params = $this->_setPhocaParams();
}
$globalValue = $this->phocaParams->get( $name, '' );
return $globalValue;
}
}
?>

View File

@ -0,0 +1,156 @@
<?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\Form\FormField;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\Component\Fields\Administrator\Helper\FieldsHelper;
if (! class_exists('PhocaGalleryLoader')) {
require_once( JPATH_ADMINISTRATOR.'/components/com_phocagallery/libraries/loader.php');
}
phocagalleryimport('phocagallery.render.renderadmin');
phocagalleryimport('phocagallery.html.categoryhtml');
Factory::getApplication()->getLanguage()->load('com_phocagallery');
class JFormFieldPhocaGalleryCategory extends FormField
{
protected $type = 'PhocaGalleryCategory';
protected $layout = 'phocagallery.form.field.category';
protected function getRenderer($layoutId = 'default')
{
// Make field usable outside of Phoca Cart component
$renderer = parent::getRenderer($layoutId);
$renderer->addIncludePath(JPATH_ADMINISTRATOR . '/components/com_phocagallery/layouts');
return $renderer;
}
private function buildCategoryTree(array &$options, array $categories, string $treeTitle, array $typeFilter, array $langFilter, array $omitIds): void {
foreach ($categories as $category) {
if ($typeFilter && !in_array($category->type, $typeFilter)) continue;
if ($langFilter && !in_array($category->language, $langFilter)) continue;
if ($omitIds && in_array($category->id, $omitIds)) continue;
$title = ($treeTitle ? $treeTitle . ' - ' : '') . $category->title;
$options[] = (object)[
'text' => $title . ($category->language === '*' ? '' : ' (' . $category->language . ')'),
'value' => $category->id,
];
if ($category->children)
$this->buildCategoryTree($options, $category->children, $title, $typeFilter, $langFilter, $omitIds);
}
}
protected function getInput() {
$db = Factory::getDBO();
$multiple = (string)$this->element['multiple'] == 'true';
$typeMethod = $this->element['typemethod'];
switch($this->element['categorytype']) {
case 1:
$typeFilter = [0, 1];
break;
case 2:
$typeFilter = [0, 2];
break;
case 0:
default:
$typeFilter = [];
break;
}
if ($this->element['language']) {
$langFilter = explode(',', $this->element['language']);
} elseif ($this->form->getValue('language', 'filter')) {
$langFilter = [$this->form->getValue('language', 'filter')];
} else {
$langFilter = [];
}
// TO DO - check for other views than category edit
$omitIds = [];
switch (Factory::getApplication()->input->get('view')) {
case 'phocagallerycategory':
if ($this->form->getValue('id') > 0)
$omitIds[] = $this->form->getValue('id');
break;
}
$db->setQuery('SELECT a.*, null AS children FROM #__phocagallery_categories AS a ORDER BY a.ordering, a.id');
$categories = $db->loadObjectList('id') ?? [];
array_walk($categories, function ($category) use ($categories) {
if ($category->parent_id) {
if ($categories[$category->parent_id]->children === null) {
$categories[$category->parent_id]->children = [];
}
$categories[$category->parent_id]->children[] = $category;
}
});
$rootCategories = array_filter($categories, function($category) {
return !$category->parent_id;
});
$options = [];
if ($multiple) {
if ($typeMethod == 'allnone') {
$options[] = HTMLHelper::_('select.option', '0', Text::_('COM_PHOCAGALLERY_NONE'), 'value', 'text');
$options[] = HTMLHelper::_('select.option', '-1', Text::_('COM_PHOCAGALLERY_ALL'), 'value', 'text');
}
} else {
// in filter we need zero value for canceling the filter
if ($typeMethod == 'filter') {
$options[] = HTMLHelper::_('select.option', '', '- ' . Text::_('COM_PHOCAGALLERY_SELECT_CATEGORY') . ' -', 'value', 'text');
} else {
$options[] = HTMLHelper::_('select.option', '0', '- '.Text::_('COM_PHOCAGALLERY_SELECT_CATEGORY').' -', 'value', 'text');
}
}
$this->buildCategoryTree($options, $rootCategories, '', $typeFilter, $langFilter, $omitIds);
$data = $this->getLayoutData();
$data['options'] = $options;
//if (!empty($activeCats)) {
// $data['value'] = $activeCats;
//} else {
$data['value'] = $this->value;
//}
$data['refreshPage'] = (bool)$this->element['refresh-enabled'];
$data['refreshCatId'] = (string)$this->element['refresh-cat-id'];
$data['refreshSection'] = (string)$this->element['refresh-section'];
$data['hasCustomFields']= !empty(FieldsHelper::getFields('com_phocagallery.phocagalleryitem'));
$document = Factory::getDocument();
$document->addCustomTag('<script type="text/javascript">
function changeCatid() {
var catid = document.getElementById(\'jform_catid\').value;
var href = document.getElementById(\'pgselectytb\').getAttribute(\'data-url\');
href = href ? href.substring(0, href.lastIndexOf("&")) : \'\';
href += \'&catid=\' + catid;
document.getElementById(\'pgselectytb\').setAttribute(\'data-url\', href);
}
</script>');
return $this->getRenderer($this->layout)->render($data);
}
}
?>

View File

@ -0,0 +1,116 @@
<?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('JPATH_BASE') or die;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\HTML\HTMLHelper;
jimport('joomla.html.html');
jimport('joomla.form.formfield');
class JFormFieldPhocaGalleryOrdering extends FormField
{
protected $type = 'PhocaGalleryOrdering';
protected function getInput() {
// Initialize variables.
$html = array();
$attr = '';
// Get some field values from the form.
$id = (int) $this->form->getValue('id');
$title = 'title';
if ($this->element['table']) {
switch (strtolower($this->element['table'])) {
case "category":
$whereLabel = 'parent_id';
$whereValue = (int) $this->form->getValue('parent_id');
$table = '#__phocagallery_categories';
break;
case "commentimage":
$whereLabel = 'imgid';
$whereValue = (int) $this->form->getValue('imgid');
$table = '#__phocagallery_img_comments';
break;
case "comment":
$whereLabel = 'catid';
$whereValue = (int) $this->form->getValue('catid');
$table = '#__phocagallery_comments';
break;
case "fbuser":
$whereLabel = '';
$whereValue = '';
$table = '#__phocagallery_fb_users';
$title = 'name';
break;
case "tag":
$whereLabel = '';
$whereValue = '';
$table = '#__phocagallery_tags';
break;
case "styles":
$whereLabel = 'type';
$whereValue = (int) $this->form->getValue('type');
$table = '#__phocagallery_styles';
break;
case "image":
default:
$whereLabel = 'catid';
$whereValue = (int) $this->form->getValue('catid');
$table = '#__phocagallery';
break;
}
} else {
$whereLabel = 'catid';
$whereValue = (int) $this->form->getValue('catid');
$table = '#__phocagallery';
}
// Initialize some field attributes.
$attr .= $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
$attr .= ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
$attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
// Initialize JavaScript field attributes.
$attr .= $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';
// Build the query for the ordering list.
$query = 'SELECT ordering AS value, '.$title.' AS text' .
' FROM ' . $table ;
if ($whereLabel != '') {
$query .= ' WHERE '.$whereLabel.' = ' . (int) $whereValue ;
}
$query .=' ORDER BY ordering';
// Create a read-only list (no name) with a hidden input to store the value.
if ((string) $this->element['readonly'] == 'true') {
$html[] = HTMLHelper::_('list.ordering', '', $query, trim($attr), $this->value, $id ? 0 : 1);
$html[] = '<input type="hidden" name="'.$this->name.'" value="'.$this->value.'"/>';
}
// Create a regular list.
else {
$html[] = HTMLHelper::_('list.ordering', $this->name, $query, trim($attr), $this->value, $id ? 0 : 1);
}
return implode($html);
}
}

View File

@ -0,0 +1,57 @@
<?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('JPATH_BASE') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
jimport('joomla.html.html');
jimport('joomla.form.formfield');
class JFormFieldPhocaHead extends FormField
{
protected $type = 'PhocaHead';
protected function getLabel() { return '';}
protected function getInput() {
$app = Factory::getApplication();
$wa = $app->getDocument()->getWebAssetManager();
$option = 'com_phocagallery';
$wa->registerAndUseStyle($option . '.options', 'media/' .$option . '/css/administrator/phocagalleryoptions.css', array('version' => 'auto'));
$wa->registerAndUseStyle($option . '.theme', 'media/' .$option . '/css/administrator/theme-dark.css', array('version' => 'auto'), [], ['template.active']);
//echo '<div style="clear:both;"></div>';
$phocaImage = ( (string)$this->element['phocaimage'] ? $this->element['phocaimage'] : '' );
$image = '';
if ($phocaImage != ''){
$image = HTMLHelper::_('image', 'media/com_phocagallery/images/administrator/'. $phocaImage, '' );
}
if ($this->element['default']) {
if ($image != '') {
return '<div class="ph-options-head">'
.'<div>'. $image.' <strong>'. Text::_($this->element['default']) . '</strong></div>'
.'</div>';
} else {
return '<div class="ph-options-head">'
.'<strong>'. Text::_($this->element['default']) . '</strong>'
.'</div>';
}
} else {
return parent::getLabel();
}
//echo '<div style="clear:both;"></div>';
}
}
?>

View File

@ -0,0 +1,43 @@
<?php
/*
* @package Joomla
* @copyright Copyright (C) 2005 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('JPATH_BASE') or die;
use Joomla\CMS\Form\FormField;
jimport('joomla.form.formfield');
class JFormFieldPhocaInfoText extends FormField
{
protected $type = 'PhocaInfoText';
protected function getInput()
{
$class = 'inputbox';
if ((string) $this->element['class'] != '') {
$class = $this->element['class'];
}
return '<div class="'.$class.'" style="padding-top:5px">'.$this->value.'</div>';
}
protected function getLabel()
{
echo '<div class="clearfix"></div>';
return parent::getLabel();
echo '<div class="clearfix"></div>';
}
}

View File

@ -0,0 +1,83 @@
<?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('JPATH_BASE') or die;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Factory;
use Joomla\CMS\Component\ComponentHelper;
jimport('joomla.form.formfield');
class JFormFieldPhocaLongText extends FormField
{
protected $type = 'PhocaLongText';
protected $phocaParams = null;
protected function getInput() {
$document = Factory::getDocument();
$option = Factory::getApplication()->input->getCmd('option');
$globalValue = $this->_getPhocaParams( $this->element['name'] );
// Initialize some field attributes.
$size = $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
$class = $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
$maxLength = $this->element['maxlength'] ? ' maxlength="'.(int) $this->element['maxlength'].'"' : '';
$readonly = ((string) $this->element['readonly'] == 'true') ? ' readonly="readonly"' : '';
$disabled = ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
// Initialize JavaScript field attributes.
$onchange = $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';
$value = htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8');
// TO DO 1.6
// MENU - Set Default value to "" because of saving "" value into the menu link ( use global = "")
if ($option == "com_menus") {
$DefaultValue = (string)$this->element['default'];
if ($value == $DefaultValue) {
$value = '';
}
}
// MENU - Display the global value
if ($option == "com_menus") {
$html ='<table><tr><td colspan="3"><input type="text" name="'.$this->name.'" id="'.$this->id.'" value="'.$value.'"'
.$class.$size.$disabled.$readonly.$onchange.$maxLength.'/></td></tr>';
$html .='<tr><td>[</td><td><input type="text" value="'. $globalValue .'" style="width:15em;border:1px solid #fff;background:#fff;" /></td><td>]</td></tr></table>';
} else {
$html ='<input type="text" name="'.$this->name.'" id="'.$this->id.'" value="'.$value.'"'
.$class.$size.$disabled.$readonly.$onchange.$maxLength.'/>';
}
return $html;
}
protected function getLabel() {
echo '<div class="clearfix"></div>';
return parent::getLabel();
echo '<div class="clearfix"></div>';
}
protected function _setPhocaParams(){
$component = 'com_phocagallery';
$paramsC = ComponentHelper::getParams($component) ;
$this->phocaParams = $paramsC;
}
protected function _getPhocaParams( $name ){
// Don't call sql query by every param item (it will be loaded only one time)
if (!$this->phocaParams) {
$params = $this->_setPhocaParams();
}
$globalValue = $this->phocaParams->get( $name, '' );
return $globalValue;
}
}
?>

View File

@ -0,0 +1,117 @@
<?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('JPATH_BASE') or die;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
jimport('joomla.form.formfield');
class JFormFieldPhocaSelectFbAlbum extends FormField
{
public $type = 'phocaSelectFbAlbum';
protected function getInput()
{
// Initialize variables.
$html = array();
// Initialize some field attributes.
$attr = $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
$attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
$uid = $this->form->getValue('extfbuid');
$suffix = '';
if ($uid != '') { $suffix .= '&amp;uid='.$uid;}
$link = 'index.php?option=com_phocagallery&amp;view=phocagalleryfba&amp;tmpl=component&amp;field='.$this->id. $suffix;
// Initialize JavaScript field attributes.
$onchange = (string) $this->element['onchange'];
// Build the script.
/* $script = array();
$script[] = ' function phocaSelectFbAlbum_'.$this->id.'(title) {';
$script[] = ' document.getElementById("'.$this->id.'_id").value = title;';
$script[] = ' '.$onchange;
$script[] = ' SqueezeBox.close();';
$script[] = ' }';*/
HTMLHelper::_('jquery.framework');
$idA = 'pgselectfbalbum';
// Build the script.
$script = array();
$script[] = ' function phocaSelectFBAlbum_'.$this->id.'(title) {';
$script[] = ' document.getElementById("'.$this->id.'").value = title;';
$script[] = ' '.$onchange;
//$script[] = ' SqueezeBox.close();';
$script[] = ' jQuery(\'#'.$idA.'\').modal(\'toggle\');';
$script[] = ' }';
$script[] = 'window.closeModal = function(){';
$script[] = ' jQuery(\'#'.$idA.'\').modal(\'hide\');';
$script[] = '}';
// Add the script to the document head.
Factory::getDocument()->addScriptDeclaration(implode("\n", $script));
/* $html[] = '<div class="input-append">';
$html[] = '<input type="text" id="'.$this->id.'_id" name="'.$this->name.'" value="'. $this->value.'"' .' '.$attr.' />';
$html[] = '<a id="pglinktoalbum" class="modal_'.$this->id.' btn" title="'.Text::_('COM_PHOCAGALLERY_FB_SELECT_ALBUM').'"'
.' href="'.($this->element['readonly'] ? '' : $link).'"'
.' rel="{handler: \'iframe\', size: {x: 650, y: 400}}">'
. Text::_('COM_PHOCAGALLERY_FB_SELECT_ALBUM').'</a>';
$html[] = '</div>'. "\n";*/
$html[] = '<div class="input-append">';
$html[] = '<span class="input-append"><input type="text" id="' . $this->id . '" name="' . $this->name . '"'
. ' value="' . $this->value . '"' . $attr . ' />';
$html[] = '<a href="#'.$idA.'" role="button" class="btn " data-toggle="modal" title="' . Text::_('COM_PHOCAGALLERY_FB_SELECT_ALBUM') . '">'
. '<span class="icon-list icon-white"></span> '
. Text::_('COM_PHOCAGALLERY_FB_SELECT_ALBUM') . '</a></span>';
$html[] = '</div>'. "\n";
$html[] = HTMLHelper::_(
'bootstrap.renderModal',
$idA,
array(
'url' => $link,
'title' => Text::_('COM_PHOCAGALLERY_FB_SELECT_ALBUM'),
'width' => '700px',
'height' => '400px',
'modalWidth' => '80',
'bodyHeight' => '70',
'footer' => '<button type="button" class="btn" data-dismiss="modal" aria-hidden="true">'
. Text::_('COM_PHOCAGALLERY_CLOSE') . '</button>'
)
);
return implode("\n", $html);
}
}
?>

View File

@ -0,0 +1,61 @@
<?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\Form\FormField;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;
if (! class_exists('PhocaGalleryLoader')) {
require_once( JPATH_ADMINISTRATOR.'/components/com_phocagallery/libraries/loader.php');
}
phocagalleryimport('phocagallery.render.renderadmin');
class JFormFieldPhocaSelectFbUser extends FormField
{
protected $type = 'PhocaSelectFbUser';
protected function getInput() {
$db = Factory::getDBO();
//build the list of categories
$query = 'SELECT a.id AS value, '
. ' CASE WHEN CHAR_LENGTH(a.name) THEN a.name ELSE a.appid END as text'
. ' FROM #__phocagallery_fb_users AS a'
. ' WHERE a.published = 1'
. ' ORDER BY a.ordering';
$db->setQuery( $query );
$items = $db->loadObjectList();
// TO DO - check for other views than category edit
/*$view = JFactory::getApplication()->input->get( 'view' );
$catId = -1;
if ($view == 'phocagalleryc') {
$id = $this->form->getValue('id'); // id of current category
if ((int)$id > 0) {
$catId = $id;
}
}*/
$fieldId = $this->element['fieldid'] ? $this->element['fieldid'] : '';
$link = 'index.php?option=com_phocagallery&amp;view=phocagalleryfba&amp;tmpl=component&amp;field=jform_'.$fieldId.'&amp;uid=';
$js = 'document.getElementById(\'pglinktoalbum\').href = \''.$link.'\' + this.value';
array_unshift($items, HTMLHelper::_('select.option', '', '- '.Text::_('COM_PHOCAGALLERY_SELECT_FB_USER').' -', 'value', 'text'));
return HTMLHelper::_('select.genericlist', $items, $this->name, 'class="form-control" onchange="'.$js.'"', 'value', 'text', $this->value, $this->id );
}
}
?>

View File

@ -0,0 +1,136 @@
<?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('JPATH_BASE') or die;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
jimport('joomla.form.formfield');
class JFormFieldPhocaSelectFilename extends FormField
{
public $type = 'PhocaSelectFilename';
protected function getInput()
{
// Initialize variables.
$html = array();
$link = 'index.php?option=com_phocagallery&amp;view=phocagalleryi&amp;tmpl=component&amp;field='.$this->id;
$onchange = (string) $this->element['onchange'];
$size = ($v = $this->element['size']) ? ' size="' . $v . '"' : '';
$class = ($v = $this->element['class']) ? ' class="' . $v . '"' : 'class="text_area"';
$required = ($v = $this->element['required']) ? ' required="required"' : '';
// Initialize some field attributes.
$attr = $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
$attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
$idA = 'phFileNameModal';
// If external image, we don't need the filename will be required
$extId = (int) $this->form->getValue('extid');
if ($extId > 0) {
$readonly = ' readonly="readonly"';
$attr = '';
return '<input type="text" name="'.$this->name.'" id="'.$this->id.'" value="-" '.$attr.$readonly.' class="form-control" />';
}
/*$script = array();
$script[] = ' function phocaSelectFileName_'.$this->id.'(title) {';
$script[] = ' document.getElementById("'.$this->id.'").value = title;';
$script[] = ' '.$onchange;
$script[] = ' jQuery(\'#'.$idA.'\').modal(\'toggle\');';
$script[] = ' }';
JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));*/
HTMLHelper::_('jquery.framework');
/* JFactory::getDocument()->addScriptDeclaration('
function phocaSelectFileName_' . $this->id . '(name) {
document.getElementById("' . $this->id . '").value = name;
jQuery(\'#'.$idA.'\').modal(\'toggle\');
}
');*/
$script = array();
$script[] = ' function phocaSelectFileName_'.$this->id.'(title) {';
$script[] = ' document.getElementById("'.$this->id.'").value = title;';
$script[] = ' '.$onchange;
//$script[] = ' jModalClose();';
$script[] = ' jQuery(\'#'.$idA.'\').modal(\'toggle\');';
//$script[] = ' SqueezeBox.close();';
//$script[] = ' jQuery(\'#'.$idA.'\').modal(\'toggle\');';
$script[] = ' }';
// Add the script to the document head.
Factory::getDocument()->addScriptDeclaration(implode("\n", $script));
$html[] = '<div class="input-group input-append">';
$html[] = '<span class="input-group input-append"><input type="text" id="' . $this->id . '" name="' . $this->name . '"'
. ' value="' . $this->value . '"' . $attr . ' />';
$html[] = '<a href="'.$link.'" role="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#'.$idA.'" title="' . Text::_('COM_PHOCAGALLERY_FORM_SELECT_FILENAME') . '">'
. '<span class="icon-list icon-white"></span> '
. Text::_('COM_PHOCAGALLERY_FORM_SELECT_FILENAME') . '</a></span>';
$html[] = '</div>'. "\n";
$html[] = HTMLHelper::_(
'bootstrap.renderModal',
$idA,
array(
'url' => $link,
'title' => Text::_('COM_PHOCAGALLERY_FORM_SELECT_FILENAME'),
'width' => '',
'height' => '',
'modalWidth' => '80',
'bodyHeight' => '80',
'footer' => '<div class="ph-info-modal"></div><button type="button" class="btn" data-bs-dismiss="modal" aria-hidden="true">'
. Text::_('COM_PHOCAGALLERY_CLOSE') . '</button>'
)
);
/*
//readonly="readonly"
$html[] = '<span class="input-append"><input type="text" ' . $required . ' id="' . $this->id . '" name="' . $this->name . '"'
. ' value="' . $this->value . '"' . $size . $class . ' />';
$html[] = '<a href="#'.$idA.'" role="button" class="btn btn-primary" data-toggle="modal" title="' . Text::_('COM_PHOCAGALLERY_FORM_SELECT_FILENAME') . '">'
. '<span class="icon-list icon-white"></span> '
. Text::_('COM_PHOCAGALLERY_FORM_SELECT_FILENAME') . '</a></span>';
$html[] = HTMLHelper::_(
'bootstrap.renderModal',
$idA,
array(
'url' => $link,
'title' => Text::_('COM_PHOCAGALLERY_FORM_SELECT_FILENAME'),
'width' => '700px',
'height' => '400px',
'modalWidth' => '80',
'bodyHeight' => '70',
'footer' => '<button type="button" class="btn" data-dismiss="modal" aria-hidden="true">'
. Text::_('COM_PHOCAGALLERY_CLOSE') . '</button>'
)
);*/
// We don't use hidden field name, we can edit it the filename form field, there are three ways of adding filename:
// - manually typed
// - selected by image select box
// - added per YouTube import
//
// The name="' . $this->name . '" is used above in standard input form
//
//$html[] = '<input class="input-small" type="hidden" name="' . $this->name . '" value="'
// . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '" />';
return implode("\n", $html);
}
}

View File

@ -0,0 +1,110 @@
<?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('JPATH_BASE') or die;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
jimport('joomla.form.formfield');
class JFormFieldPhocaSelectFolder extends FormField
{
public $type = 'PhocaSelectFolder';
protected function getInput()
{
// Initialize variables.
$html = array();
$link = 'index.php?option=com_phocagallery&amp;view=phocagalleryf&amp;tmpl=component&amp;field='.$this->id;
$attr = $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
$attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
$onchange = (string) $this->element['onchange'];
$required = ($v = $this->element['required']) ? ' required="required"' : '';
// Build the script.
/* $script = array();
$script[] = ' function phocaSelectFolder_'.$this->id.'(title) {';
$script[] = ' document.getElementById("'.$this->id.'_id").value = title;';
$script[] = ' '.$onchange;
$script[] = ' SqueezeBox.close();';
$script[] = ' }';*/
HTMLHelper::_('jquery.framework');
$idA = 'pgselectfolder';
// Build the script.
$script = array();
$script[] = ' function phocaSelectFolder_'.$this->id.'(title) {';
$script[] = ' document.getElementById("'.$this->id.'").value = title;';
$script[] = ' '.$onchange;
$script[] = ' jQuery(\'#'.$idA.'\').modal(\'hide\');';
$script[] = ' }';
// Add the script to the document head.
Factory::getDocument()->addScriptDeclaration(implode("\n", $script));
/*
$html[] = '<div class="fltlft">';
$html[] = '<input type="text" id="'.$this->id.'_id" name="'.$this->name.'" value="'. $this->value.'"' .' '.$attr.' />';
$html[] = '</div>';
// Create the user select button.
$html[] = '<div class="button2-left">';
$html[] = ' <div class="blank">';
$html[] = ' <a class="modal_'.$this->id.'" title="'.Text::_('COM_PHOCAGALLERY_FORM_SELECT_FOLDER').'"' .
' href="'.($this->element['readonly'] ? '' : $link).'"' .
' rel="{handler: \'iframe\', size: {x: 650, y: 375}}">';
$html[] = ' '.Text::_('COM_PHOCAGALLERY_FORM_SELECT_FOLDER').'</a>';
$html[] = ' </div>';
$html[] = '</div>';*/
/* $html[] = '<div class="input-append">';
$html[] = '<input type="text" id="'.$this->id.'_id" name="'.$this->name.'" value="'. $this->value.'"' .' '.$attr.' />';
$html[] = '<a class="modal_'.$this->id.' btn" title="'.Text::_('COM_PHOCAGALLERY_FORM_SELECT_FOLDER').'"'
.' href="'.($this->element['readonly'] ? '' : $link).'"'
.' rel="{handler: \'iframe\', size: {x: 650, y: 400}}">'
. Text::_('COM_PHOCAGALLERY_FORM_SELECT_FOLDER').'</a>';
$html[] = '</div>'. "\n";*/
$html[] = '<div class="input-group input-append">';
$html[] = '<span class="input-group input-append"><input type="text" ' . $required . ' id="' . $this->id . '" name="' . $this->name . '"'
. ' value="' . $this->value . '"' . $attr . ' />';
$html[] = '<a href="'.$link.'" role="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#'.$idA.'" title="' . Text::_('COM_PHOCAGALLERY_FORM_SELECT_FOLDER') . '">'
. '<span class="icon-list icon-white"></span> '
. Text::_('COM_PHOCAGALLERY_FORM_SELECT_FOLDER') . '</a></span>';
$html[] = '</div>'. "\n";
$html[] = HTMLHelper::_(
'bootstrap.renderModal',
$idA,
array(
'url' => $link,
'title' => Text::_('COM_PHOCAGALLERY_FORM_SELECT_FOLDER'),
'width' => '700px',
'height' => '400px',
'modalWidth' => '80',
'bodyHeight' => '70',
'footer' => '<button type="button" class="btn" data-dismiss="modal" aria-hidden="true">'
. Text::_('COM_PHOCAGALLERY_CLOSE') . '</button>'
)
);
return implode("\n", $html);
}
}

View File

@ -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('JPATH_BASE') or die();
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Language\Text;
jimport('joomla.form.formfield');
class JFormFieldPhocaSelectItem extends FormField
{
public $type = 'PhocaSelectItem';
protected function getInput() {
$html = array();
$url = 'index.php?option=com_phocagallery&view=phocagalleryitema&format=json&tmpl=component&'. Session::getFormToken().'=1';
// Possible problem with modal
//$attr = $this->element['class'] ? ' class="'.(string) $this->element['class'].' typeahead"' : ' class="typeahead"';
$attr = $this->element['class'] ? ' class="'.(string) $this->element['class'].' "' : ' class=""';
$attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
$attr .= $this->element['required'] ? ' required aria-required="true"' : '';
$clearId = 'phClearId'.$this->id;
if ($this->multiple) {
$multiple = 'true';
} else {
$multiple = 'false';
}
$onchange = (string) $this->element['onchange'];
$value = '';
$image = PhocaGalleryImage::getImageByImageId((int)$this->value);// We don't need catid, we get all categories title
if(isset($image->id)) {
$value .= (int)$image->id . ':'. $image->title .' ('.$image->category_title.')';
}
$id = (int)$this->value;
$document = Factory::getDocument();
$app = Factory::getApplication();
$wa = $app->getDocument()->getWebAssetManager();
HTMLHelper::_('jquery.framework', false);
//HTMLHelper::_('script', 'media/com_phocagallery/js/administrator/select2/select2.js', array('version' => 'auto'));
//HTMLHelper::_('script', 'media/com_phocagallery/js/administrator/select2/jquery.phocaselect2.js', array('version' => 'auto'));
//HTMLHelper::_('stylesheet', 'media/com_phocagallery/js/administrator/select2/select2.css', array('version' => 'auto'));
$wa->registerAndUseScript('com_phocagallery.select2', 'media/com_phocagallery/js/administrator/select2/select2.js', array('version' => 'auto'));
$wa->registerAndUseScript('com_phocagallery.phocaselect2', 'media/com_phocagallery/js/administrator/select2/jquery.phocaselect2.js', array('version' => 'auto'));
$wa->registerAndUseStyle('com_phocagallery.select2', 'media/com_phocagallery/js/administrator/select2/select2.css', array('version' => 'auto'));
$document->addScriptOptions('phLang', array(
'COM_PHOCAGALLERY_NO_MATCHES_FOUND' => Text::_('COM_PHOCAGALLERY_NO_MATCHES_FOUND'),
'COM_PHOCAGALLERY_PLEASE_ENTER' => Text::_('COM_PHOCAGALLERY_PLEASE_ENTER'),
'COM_PHOCAGALLERY_S_MORE_CHARACTER' => Text::_('COM_PHOCAGALLERY_S_MORE_CHARACTER'),
'COM_PHOCAGALLERY_PLEASE_DELETE' => Text::_('COM_PHOCAGALLERY_PLEASE_DELETE'),
'COM_PHOCAGALLERY_S_CHARACTER' => Text::_('COM_PHOCAGALLERY_S_CHARACTER'),
'COM_PHOCAGALLERY_YOU_CAN_ONLY_SELECT' => Text::_('COM_PHOCAGALLERY_YOU_CAN_ONLY_SELECT'),
'COM_PHOCAGALLERY_S_ITEM' => Text::_('COM_PHOCAGALLERY_S_ITEM'),
'COM_PHOCAGALLERY_LOADING_MORE_RESULTS' => Text::_('COM_PHOCAGALLERY_LOADING_MORE_RESULTS'),
'COM_PHOCAGALLERY_SEARCHING' => Text::_('COM_PHOCAGALLERY_SEARCHING')
));
$document->addScriptOptions('phVars', array('uriRoot' => Uri::root()));
$s = array();
$s[] = 'jQuery(document).ready(function() {';
$s[] = ' phSearchItemsMultiple("#'.$this->id.'", "'.$url.'", '.(int)$id.', '.$multiple.', "[|]");';
if (!$this->multiple) {
$s[] = ' jQuery("#' . $clearId . '").on("click", function() {jQuery("#' . $this->id . '").select2("val", ""); });';
}
$s[] = '});';
$document->addScriptDeclaration(implode("\n", $s));
$class = '';
if (!$this->multiple) {
$class = 'ph-select2-clear-btn-box';
}
$html[] = '<div class="input-append input-group">';
$html[] = '<input type="text" placeholder="&nbsp;" class="'.$class.'" id="'.$this->id.'" name="'.$this->name.'" value="'. $value.'"' .' '.$attr.' />';
if (!$this->multiple) {
$html[] = '<input type="button" class="btn btn-primary" id="' . $clearId . '" name="' . $clearId . '" value="' . Text::_('COM_PHOCAGALLERY_CLEAR') . '"' . ' />';
}
$html[] = '</div>'. "\n";
return implode("\n", $html);
}
}
?>

View File

@ -0,0 +1,127 @@
<?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('JPATH_BASE') or die;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
jimport('joomla.form.formfield');
class JFormFieldPhocaSelectMap extends FormField
{
public $type = 'PhocaSelectMap';
protected function getInput()
{
// Initialize variables.
$html = array();
// Initialize some field attributes.
$attr = $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
$attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
if ($this->id == 'jform_latitude') {
// One link for latitude, longitude, zoom
$lat = $this->form->getValue('latitude');
$lng = $this->form->getValue('longitude');
$zoom = $this->form->getValue('zoom');
$suffix = '';
if ($lat != '') { $suffix .= '&amp;lat='.$lat;}
if ($lng != '') { $suffix .= '&amp;lng='.$lng;}
if ($zoom != '') { $suffix .= '&amp;zoom='.$zoom;}
$link = 'index.php?option=com_phocagallery&amp;view=phocagalleryg&amp;tmpl=component&amp;field='.$this->id. $suffix;
HTMLHelper::_('jquery.framework');
}
$idA = 'pgselectmap';
// Initialize JavaScript field attributes.
$onchange = (string) $this->element['onchange'];
/* // Build the script.
$script = array();
$script[] = ' function phocaSelectMap_'.$this->id.'(title) {';
$script[] = ' document.getElementById("'.$this->id.'_id").value = title;';
$script[] = ' '.$onchange;
//$script[] = ' SqueezeBox.close();';
$script[] = ' }';*/
// Build the script.
$script = array();
$script[] = ' function phocaSelectMap_'.$this->id.'(title) {';
$script[] = ' document.getElementById("'.$this->id.'").value = title;';
$script[] = ' '.$onchange;
$script[] = ' jModalClose();';
//$script[] = ' SqueezeBox.close();';
//$script[] = ' jQuery(\'#'.$idA.'\').modal(\'toggle\');';
$script[] = ' }';
// Hide Info box on start
if ($this->id == 'jform_latitude') {
$script[] = ' jQuery(document).ready(function() {';
$script[] = ' jQuery(\'#'.$idA.'\').on(\'shown.bs.modal\', function () {';
$script[] = ' jQuery(\'#phmPopupInfo\').html(\'\');';
$script[] = ' })';
$script[] = ' })';
}
// Add the script to the document head.
Factory::getDocument()->addScriptDeclaration(implode("\n", $script));
if ($this->id == 'jform_latitude') {
/*$html[] = '<div class="input-append">';
$html[] = '<input type="text" id="'.$this->id.'_id" name="'.$this->name.'" value="'. $this->value.'"' . ' '.$attr.' />';
$html[] = '<a class="modal_'.$this->id.' btn" title="'.Text::_('COM_PHOCAGALLERY_FORM_SELECT_COORDINATES').'"'
.' href="'.($this->element['readonly'] ? '' : $link).'"'
.' rel="{handler: \'iframe\', size: {x: 560, y: 470}}">'
. Text::_('COM_PHOCAGALLERY_FORM_SELECT_COORDINATES').'</a>';
$html[] = '</div>'. "\n";*/
$html[] = '<div class="input-group input-append">';
$html[] = '<span class="input-group input-append"><input type="text" id="' . $this->id . '" name="' . $this->name . '"'
. ' value="' . $this->value . '"' . $attr . ' />';
$html[] = '<a href="'.$link.'" role="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#'.$idA.'" title="' . Text::_('COM_PHOCAGALLERY_FORM_SELECT_COORDINATES') . '">'
. '<span class="icon-list icon-white"></span> '
. Text::_('COM_PHOCAGALLERY_FORM_SELECT_COORDINATES') . '</a></span>';
$html[] = '</div>'. "\n";
$html[] = HTMLHelper::_(
'bootstrap.renderModal',
$idA,
array(
'url' => $link,
'title' => Text::_('COM_PHOCAGALLERY_FORM_SELECT_COORDINATES'),
'width' => '560px',
'height' => '470px',
'modalWidth' => '50',
'bodyHeight' => '70',
'footer' => '<div id="phmPopupInfo" class="ph-info-modal"></div><button type="button" class="btn" data-bs-dismiss="modal" aria-hidden="true">'
. Text::_('COM_PHOCAGALLERY_CLOSE') . '</button>'
)
);
} else {
$html[] = '<input type="text" id="'.$this->id.'" name="'.$this->name.'" value="'. $this->value.'"' . ' '.$attr.' />';
}
return implode("\n", $html);
}
}

View File

@ -0,0 +1,144 @@
<?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('JPATH_BASE') or die;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
jimport('joomla.form.formfield');
class JFormFieldPhocaSelectYtb extends FormField
{
public $type = 'PhocaSelectYtb';
protected function getInput()
{
// Initialize variables.
$html = array();
$suffix = '';
$catid = $this->form->getValue('catid');
if ((int)$catid > 0) {
$suffix .= '&amp;catid='.$catid;
} else {
$suffix .= '&amp;catid=0';
}
$link = 'index.php?option=com_phocagallery&amp;view=phocagalleryytb&amp;tmpl=component&amp;field='.$this->id.$suffix;
// Initialize some field attributes.
$class = $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
$disabled = ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
$columns = $this->element['cols'] ? ' cols="'.(int) $this->element['cols'].'"' : '';
$rows = $this->element['rows'] ? ' rows="'.(int) $this->element['rows'].'"' : '';
//$required = ($v = $this->element['required']) ? ' required="required"' : '';
// Initialize JavaScript field attributes.
$onchange = (string) $this->element['onchange'];
HTMLHelper::_('jquery.framework');
$idA = 'pgselectytb';
// Build the script.
$script = array();
$script[] = ' function phocaSelectYtb_'.$this->id.'(link, title, desc, filename) {';
$script[] = ' document.getElementById("'.$this->id.'").value = link;';
$script[] = ' document.getElementById("jform_title").value = title;';
$script[] = ' document.getElementById("jform_description").value = desc;';
$script[] = ' document.getElementById("jform_filename").value = filename;';
$script[] = ' '.$onchange;
//$script[] = ' SqueezeBox.close();';
//$script[] = ' jQuery(\'#'.$idA.'\').modal(\'toggle\');';
$script[] = ' jQuery(\'#'.$idA.'\').modal(\'hide\');';
$script[] = ' }';
// Add the script to the document head.
Factory::getDocument()->addScriptDeclaration(implode("\n", $script));
/*
$html[] = '<div class="fltlft">';
$html[] = '<textarea name="'.$this->name.'" id="'.$this->id.'"' .
$columns.$rows.$class.$disabled.$onchange.'>' .
htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') .
'</textarea>';
$html[] = '</div>';
// Create the user select button.
$html[] = '<div class="button2-left">';
$html[] = ' <div class="blank">';
$html[] = ' <a id="pgselectytb" class="modal_'.$this->id.'" title="'.Text::_('COM_PHOCAGALLERY_FORM_SELECT_YTB').'"' .
' href="'.($this->element['readonly'] ? '' : $link).'"' .
' rel="{handler: \'iframe\', size: {x: 650, y: 375}}">';
$html[] = ' '.Text::_('COM_PHOCAGALLERY_FORM_SELECT_YTB').'</a>';
$html[] = ' </div>';
$html[] = '</div>';*/
$html[] = '<div class="input-group input-append">';
$html[] = '<input type="text" name="'.$this->name.'" id="'.$this->id.'"' .
$columns.$rows.$class.$disabled.$onchange.' value="' .
htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') .
'" />';
//$html[] = '<a id="pgselectytb" class="modal_'.$this->id.' btn" title="'.JText::_('COM_PHOCAGALLERY_FORM_SELECT_YTB').'"'
// .' href="'.($this->element['readonly'] ? '' : $link).'"'
// .' rel="{handler: \'iframe\', size: {x: 650, y: 400}}">'
// . JText::_('COM_PHOCAGALLERY_FORM_SELECT_YTB').'</a>';
//$html[] = '<span class="input-append"><input type="text" ' . $required . ' id="' . $this->id . '" name="' . $this->name . '"'
// . ' value="' . $this->value . '"' . $size . $class . ' />';
/*$html[] = '<a href="#'.$idA.'" role="button" class="btn " data-toggle="modal" title="' . JText::_('COM_PHOCAGALLERY_FORM_SELECT_YTB') . '">'
. '<span class="icon-list icon-white"></span> '
. Text::_('COM_PHOCAGALLERY_FORM_SELECT_YTB') . '</a></span>';
$html[] = '</div>'. "\n";
$html[] = HTMLHelper::_(
'bootstrap.renderModal',
$idA,
array(
'url' => $link,
'title' => Text::_('COM_PHOCAGALLERY_FORM_SELECT_YTB'),
'width' => '700px',
'height' => '400px',
'modalWidth' => '80',
'bodyHeight' => '70',
'footer' => '<button type="button" class="btn" data-dismiss="modal" aria-hidden="true">'
. Text::_('COM_PHOCAGALLERY_CLOSE') . '</button>'
)
); */
$html[] = '<a href="'.$link.'" role="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#'.$idA.'" title="' . Text::_('COM_PHOCAGALLERY_FORM_SELECT_YTB') . '">'
. '<span class="icon-list icon-white"></span> '
. Text::_('COM_PHOCAGALLERY_FORM_SELECT_YTB') . '</a></span>';
$html[] = '</div>'. "\n";
$html[] = HTMLHelper::_(
'bootstrap.renderModal',
$idA,
array(
'url' => $link,
'title' => Text::_('COM_PHOCAGALLERY_FORM_SELECT_YTB'),
'width' => '560px',
'height' => '470px',
'modalWidth' => '50',
'bodyHeight' => '70',
'footer' => '<div class="ph-info-modal"></div><button type="button" class="btn" data-bs-dismiss="modal" aria-hidden="true">'
. Text::_('COM_PHOCAGALLERY_CLOSE') . '</button>'
)
);
return implode("\n", $html);
}
}

View File

@ -0,0 +1,38 @@
<?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\Form\FormField;
phocagalleryimport('phocagallery.tag.tag');
class JFormFieldPhocaTags extends FormField
{
protected $type = 'PhocaTags';
protected function getInput() {
$id = (int) $this->form->getValue('id');
$activeTags = array();
if ((int)$id > 0) {
$activeTags = PhocaGalleryTag::getTags($id, 1);
}
//return PhocaGalleryTag::getAllTagsSelectBox($this->name, $this->id, $activeTags, NULL,'id' );
$tags = PhocaGalleryTag::getAllTags();
$data = $this->getLayoutData();
$data['options'] = (array)$tags;
$data['value'] = $activeTags;
return $this->getRenderer($this->layout)->render($data);
}
}
?>

View File

@ -0,0 +1,83 @@
<?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('JPATH_BASE') or die;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Factory;
use Joomla\CMS\Component\ComponentHelper;
jimport('joomla.form.formfield');
class JFormFieldPhocaText extends FormField
{
protected $type = 'PhocaText';
protected $phocaParams = null;
protected function getInput() {
$document = Factory::getDocument();
$option = Factory::getApplication()->input->getCmd('option');
$globalValue = $this->_getPhocaParams( $this->element['name'] );
// Initialize some field attributes.
$size = $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
$class = $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
$maxLength = $this->element['maxlength'] ? ' maxlength="'.(int) $this->element['maxlength'].'"' : '';
$readonly = ((string) $this->element['readonly'] == 'true') ? ' readonly="readonly"' : '';
$disabled = ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
// Initialize JavaScript field attributes.
$onchange = $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';
$value = htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8');
// TO DO 1.6
// MENU - Set Default value to "" because of saving "" value into the menu link ( use global = "")
if ($option == "com_menus") {
$DefaultValue = (string)$this->element['default'];
if ($value == $DefaultValue) {
$value = '';
}
}
$html ='<input type="text" name="'.$this->name.'" id="'.$this->id.'" value="'.$value.'"'
.$class.$size.$disabled.$readonly.$onchange.$maxLength.'/>';
// MENU - Display the global value
if ($option == "com_menus") {
$html .= '<span style="margin-left:10px;">[</span><span style="background:#fff;"> ' . $globalValue . ' </span><span>]</span>';
}
return $html;
}
protected function getLabel() {
echo '<div class="clearfix"></div>';
return parent::getLabel();
echo '<div class="clearfix"></div>';
}
protected function _setPhocaParams(){
$component = 'com_phocagallery';
$paramsC = ComponentHelper::getParams($component) ;
$this->phocaParams = $paramsC;
}
protected function _getPhocaParams( $name ){
// Don't call sql query by every param item (it will be loaded only one time)
if (!$this->phocaParams) {
$params = $this->_setPhocaParams();
}
$globalValue = $this->phocaParams->get( $name, '' );
return $globalValue;
}
}
?>

View File

@ -0,0 +1,87 @@
<?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('JPATH_BASE') or die;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Factory;
use Joomla\CMS\Component\ComponentHelper;
jimport('joomla.form.formfield');
class JFormFieldPhocaTextArea extends FormField
{
protected $type = 'PhocaTextArea';
protected $phocaParams = null;
protected function getInput() {
$document = Factory::getDocument();
$option = Factory::getApplication()->input->getCmd('option');
$globalValue = $this->_getPhocaParams( $this->element['name'] );
// Initialize some field attributes.
$class = $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
$disabled = ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
$columns = $this->element['cols'] ? ' cols="'.(int) $this->element['cols'].'"' : '';
$rows = $this->element['rows'] ? ' rows="'.(int) $this->element['rows'].'"' : '';
// Initialize JavaScript field attributes.
$onchange = $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';
$value = htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8');
// TO DO 1.6
// MENU - Set Default value to "" because of saving "" value into the menu link ( use global = "")
if ($option == "com_menus") {
$DefaultValue = (string)$this->element['default'];
if ($value == $DefaultValue) {
$value = '';
}
}
// MENU - Display the global value
if ($option == "com_menus") {
$html ='<table><tr><td colspan="3"><textarea name="'.$this->name.'" id="'.$this->id.'"' .
$columns.$rows.$class.$disabled.$onchange.'>' .
$value .
'</textarea></td></tr>';
$html .='<tr><td>[</td><td><input type="text" value="'. $globalValue .'" style="width:15em;border:1px solid #fff;background:#fff;" /></td><td>]</td></tr></table>';
} else {
$html = '<textarea name="'.$this->name.'" id="'.$this->id.'"' .
$columns.$rows.$class.$disabled.$onchange.'>' .
$value .
'</textarea>';
}
return $html;
}
protected function getLabel() {
echo '<div class="clearfix"></div>';
return parent::getLabel();
echo '<div class="clearfix"></div>';
}
protected function _setPhocaParams(){
$component = 'com_phocagallery';
$paramsC = ComponentHelper::getParams($component) ;
$this->phocaParams = $paramsC;
}
protected function _getPhocaParams( $name ){
// Don't call sql query by every param item (it will be loaded only one time)
if (!$this->phocaParams) {
$params = $this->_setPhocaParams();
}
$globalValue = $this->phocaParams->get( $name, '' );
return $globalValue;
}
}
?>

View File

@ -0,0 +1,82 @@
<?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\Form\Field\ListField;
use Joomla\CMS\Form\FormField;
if (! class_exists('PhocaGalleryLoader')) {
require_once( JPATH_ADMINISTRATOR.'/components/com_phocagallery/libraries/loader.php');
}
phocagalleryimport('phocagallery.access.access');
class JFormFieldPhocaUsers extends ListField
{
protected $type = 'PhocaUsers';
protected function getInput() {
$data = $this->getLayoutData();
$userId = $this->form->getValue($this->element['name']);
$owner = ( (string)$this->element['typeowner'] ? $this->element['typeowner'] : 0 );
if ($owner == 1) {
//return PhocaGalleryAccess::usersListOwner($this->name, $this->id, $userId, 1, NULL, 'name', 0, 1 );
$data['options'] = (array) PhocaGalleryAccess::usersListOwner($this->name, $this->id, $userId, 1, NULL, 'name', 0, 1 );
$activeArray = $userId;
if ($userId != '') {
$activeArray = explode(',',$userId);
}
if (!empty($activeArray)) {
$data['value'] = $activeArray;
} else {
$data['value'] = $this->value;
}
return $this->getRenderer($this->layout)->render($data);
} else {
// Joomla! 3.1.5: $this->name.'[]'
// Joomla! 3.2.0: $this->name
$userIdString = $userId;
if (is_array($userId)) {
$userIdString = implode(',', $userId);
}
//return PhocaGalleryAccess::usersList($this->name, $this->id, $userIdString, 1, NULL,'name', 0 );
$data['options'] = (array) PhocaGalleryAccess::usersList($this->name, $this->id, $userIdString, 1, NULL,'name', 0, 1 );
$activeArray = $userId;
if ($userId != '' && !is_array($userId)) {
$activeArray = explode(',',$userId);
}
if (!empty($activeArray)) {
$data['value'] = $activeArray;
} else {
$data['value'] = $this->value;
}
return $this->getRenderer($this->layout)->render($data);
}
}
}
?>

View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_phocagallery/models/fields">
<fields name="filter">
<field name="search" type="text" inputmode="search" label="COM_PHOCAGALLERY_SEARCH" description="COM_PHOCAGALLERY_SEARCH" hint="JSEARCH_FILTER" />
<field name="published" type="list" label="JOPTION_FILTER_PUBLISHED" description="JOPTION_FILTER_PUBLISHED_DESC" onchange="this.form.submit();" >
<option value="">JOPTION_SELECT_PUBLISHED</option>
<option value="1">COM_PHOCAGALLERY_PUBLISHED</option>
<option value="0">COM_PHOCAGALLERY_UNPUBLISHED</option>
</field>
<field name="category_id" type="PhocaGalleryCategory" label="JOPTION_FILTER_CATEGORY" description="JOPTION_FILTER_CATEGORY_DESC" onchange="this.form.submit();" />
<!--
<field name="language" type="contentlanguage" label="JOPTION_FILTER_LANGUAGE" description="JOPTION_FILTER_LANGUAGE_DESC" onchange="this.form.submit();">
<option value="">JOPTION_SELECT_LANGUAGE</option>
<option value="*">JALL</option>
</field> -->
<input type="hidden" name="form_submited" value="1"/>
</fields>
<fields name="list">
<field name="fullordering" type="list" label="COM_PHOCAGALLERY_LIST_FULL_ORDERING" description="COM_PHOCAGALLERY_LIST_FULL_ORDERING_DESC" onchange="this.form.submit();" default="a.title ASC" validate="options" >
<option value="">JGLOBAL_SORT_BY</option>
<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
<option value="ua.username ASC">COM_PHOCAGALLERY_USER_ASC</option>
<option value="ua.username DESC">COM_PHOCAGALLERY_USER_DESC</option>
<option value="a.title ASC">JGLOBAL_TITLE_ASC</option>
<option value="a.title DESC">JGLOBAL_TITLE_DESC</option>
<option value="a.date ASC">JDATE_ASC</option>
<option value="a.date DESC">JDATE_DESC</option>
<option value="a.published ASC" >COM_PHOCAGALLERY_PUBLISHED_ASC</option>
<option value="a.published DESC" >COM_PHOCAGALLERY_PUBLISHED_DESC</option>
<option value="image_title ASC">COM_PHOCAGALLERY_IMAGE_ASC</option>
<option value="image_title DESC">COM_PHOCAGALLERY_IMAGE_DESC</option>
<option value="category_title ASC">COM_PHOCAGALLERY_CATEGORY_ASC</option>
<option value="category_title DESC">COM_PHOCAGALLERY_CATEGORY_DESC</option>
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field name="limit" type="limitbox" label="COM_PHOCAGALLERY_LIST_LIMIT" description="COM_PHOCAGALLERY_LIST_LIMIT_DESC" class="input-mini" default="25" onchange="this.form.submit();" />
</fields>
</fieldset>
</form>

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_phocagallery/models/fields">
<fields name="filter">
<field name="search" type="text" inputmode="search" label="COM_PHOCAGALLERY_SEARCH" description="COM_PHOCAGALLERY_SEARCH" hint="JSEARCH_FILTER" />
<field name="published" type="list" label="JOPTION_FILTER_PUBLISHED" description="JOPTION_FILTER_PUBLISHED_DESC" onchange="this.form.submit();" >
<option value="">JOPTION_SELECT_PUBLISHED</option>
<option value="1">COM_PHOCAGALLERY_PUBLISHED</option>
<option value="0">COM_PHOCAGALLERY_UNPUBLISHED</option>
</field>
<field name="category_id" type="PhocaGalleryCategory" label="JOPTION_FILTER_CATEGORY" description="JOPTION_FILTER_CATEGORY_DESC" onchange="this.form.submit();" />
<!--
<field name="language" type="contentlanguage" label="JOPTION_FILTER_LANGUAGE" description="JOPTION_FILTER_LANGUAGE_DESC" onchange="this.form.submit();">
<option value="">JOPTION_SELECT_LANGUAGE</option>
<option value="*">JALL</option>
</field>-->
<input type="hidden" name="form_submited" value="1"/>
</fields>
<fields name="list">
<field name="fullordering" type="list" label="COM_PHOCAGALLERY_LIST_FULL_ORDERING" description="COM_PHOCAGALLERY_LIST_FULL_ORDERING_DESC" onchange="this.form.submit();" default="a.title ASC" validate="options" >
<option value="">JGLOBAL_SORT_BY</option>
<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
<option value="ua.username ASC">COM_PHOCAGALLERY_USER_ASC</option>
<option value="ua.username DESC">COM_PHOCAGALLERY_USER_DESC</option>
<option value="a.title ASC">JGLOBAL_TITLE_ASC</option>
<option value="a.title DESC">JGLOBAL_TITLE_DESC</option>
<option value="a.date ASC">JDATE_ASC</option>
<option value="a.date DESC">JDATE_DESC</option>
<option value="a.published ASC" >COM_PHOCAGALLERY_PUBLISHED_ASC</option>
<option value="a.published DESC" >COM_PHOCAGALLERY_PUBLISHED_DESC</option>
<option value="category_title ASC">COM_PHOCAGALLERY_CATEGORY_ASC</option>
<option value="category_title DESC">COM_PHOCAGALLERY_CATEGORY_DESC</option>
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field name="limit" type="limitbox" label="COM_PHOCAGALLERY_LIST_LIMIT" description="COM_PHOCAGALLERY_LIST_LIMIT_DESC" class="input-mini" default="25" onchange="this.form.submit();" />
</fields>
</fieldset>
</form>

View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_phocagallery/models/fields">
<fields name="filter">
<field name="search" type="text" inputmode="search" label="COM_PHOCAGALLERY_SEARCH" description="COM_PHOCAGALLERY_SEARCH" hint="JSEARCH_FILTER" />
<field name="published" type="list" label="JOPTION_FILTER_PUBLISHED" description="JOPTION_FILTER_PUBLISHED_DESC" onchange="this.form.submit();" >
<option value="">JOPTION_SELECT_PUBLISHED</option>
<option value="1">COM_PHOCAGALLERY_PUBLISHED</option>
<option value="0">COM_PHOCAGALLERY_UNPUBLISHED</option>
</field>
<field name="level" type="list" label="JOPTION_FILTER_PUBLISHED" description="JOPTION_FILTER_PUBLISHED_DESC" onchange="this.form.submit();" >
<option value="">COM_PHOCAGALLERY_SELECT_MAX_LEVELS_HEAD</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</field>
<field name="language" type="contentlanguage" label="JOPTION_FILTER_LANGUAGE" description="JOPTION_FILTER_LANGUAGE_DESC" onchange="this.form.submit();">
<option value="">JOPTION_SELECT_LANGUAGE</option>
<option value="*">JALL</option>
</field>
<input type="hidden" name="form_submited" value="1"/>
</fields>
<fields name="list">
<field name="fullordering" type="list" label="COM_PHOCAGALLERY_LIST_FULL_ORDERING" description="COM_PHOCAGALLERY_LIST_FULL_ORDERING_DESC" onchange="this.form.submit();" default="a.title ASC" validate="options" >
<option value="">JGLOBAL_SORT_BY</option>
<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
<option value="a.title ASC">JGLOBAL_TITLE_ASC</option>
<option value="a.title DESC">JGLOBAL_TITLE_DESC</option>
<option value="a.published ASC" >COM_PHOCAGALLERY_PUBLISHED_ASC</option>
<option value="a.published DESC" >COM_PHOCAGALLERY_PUBLISHED_DESC</option>
<option value="a.approved ASC" >COM_PHOCAGALLERY_APPROVED_ASC</option>
<option value="a.approved DESC" >COM_PHOCAGALLERY_APPROVED_DESC</option>
<option value="parent_title ASC">COM_PHOCAGALLERY_PARENT_CATEGORY_ASC</option>
<option value="parent_title DESC">COM_PHOCAGALLERY_PARENT_CATEGORY_DESC</option>
<option value="a.owner ASC">COM_PHOCAGALLERY_OWNER_ASC</option>
<option value="a.owner DESC">COM_PHOCAGALLERY_OWNER_DESC</option>
<option value="ratingavg ASC">COM_PHOCAGALLERY_RATING_ASC</option>
<option value="ratingavg DESC">COM_PHOCAGALLERY_RATING_DESC</option>
<option value="a.hits ASC">JGLOBAL_HITS_ASC</option>
<option value="a.hits DESC">JGLOBAL_HITS_DESC</option>
<option value="a.language ASC">JGRID_HEADING_LANGUAGE_ASC</option>
<option value="a.language DESC">JGRID_HEADING_LANGUAGE_DESC</option>
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field name="limit" type="limitbox" label="COM_PHOCAGALLERY_LIST_LIMIT" description="COM_PHOCAGALLERY_LIST_LIMIT_DESC" class="input-mini" default="25" onchange="this.form.submit();" />
</fields>
</fieldset>
</form>

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_phocagallery/models/fields">
<fields name="filter">
<field name="search" type="text" inputmode="search" label="COM_PHOCAGALLERY_SEARCH" description="COM_PHOCAGALLERY_SEARCH" hint="JSEARCH_FILTER" />
<field name="published" type="list" label="JOPTION_FILTER_PUBLISHED" description="JOPTION_FILTER_PUBLISHED_DESC" onchange="this.form.submit();" >
<option value="">JOPTION_SELECT_PUBLISHED</option>
<option value="1">COM_PHOCAGALLERY_PUBLISHED</option>
<option value="0">COM_PHOCAGALLERY_UNPUBLISHED</option>
</field>
<field name="category_id" type="list" label="JOPTION_FILTER_PUBLISHED" description="JOPTION_FILTER_PUBLISHED_DESC" onchange="this.form.submit();" >
<option value="">COM_PHOCAGALLERY_FILTER_SELECT_TYPE_HEAD</option>
<option value="1">COM_PHOCAGALLERY_MAIN_CSS</option>
<option value="2">COM_PHOCAGALLERY_CUSTOM_CSS</option>
</field>
<field name="language" type="contentlanguage" label="JOPTION_FILTER_LANGUAGE" description="JOPTION_FILTER_LANGUAGE_DESC" onchange="this.form.submit();">
<option value="">JOPTION_SELECT_LANGUAGE</option>
<option value="*">JALL</option>
</field>
<input type="hidden" name="form_submited" value="1"/>
</fields>
<fields name="list">
<field name="fullordering" type="list" label="COM_PHOCAGALLERY_LIST_FULL_ORDERING" description="COM_PHOCAGALLERY_LIST_FULL_ORDERING_DESC" onchange="this.form.submit();" default="a.title ASC" validate="options" >
<option value="">JGLOBAL_SORT_BY</option>
<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
<option value="a.title ASC">JGLOBAL_TITLE_ASC</option>
<option value="a.title DESC">JGLOBAL_TITLE_DESC</option>
<option value="a.published ASC" >COM_PHOCAGALLERY_PUBLISHED_ASC</option>
<option value="a.published DESC" >COM_PHOCAGALLERY_PUBLISHED_DESC</option>
<option value="a.filename ASC">COM_PHOCAGALLERY_FILENAME_ASC</option>
<option value="a.filename DESC">COM_PHOCAGALLERY_FILENAME_DESC</option>
<option value="a.type ASC" >COM_PHOCAGALLERY_TYPE_ASC</option>
<option value="a.type DESC" >COM_PHOCAGALLERY_TYPE_DESC</option>
<option value="a.language ASC">JGRID_HEADING_LANGUAGE_ASC</option>
<option value="a.language DESC">JGRID_HEADING_LANGUAGE_DESC</option>
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field name="limit" type="limitbox" label="COM_PHOCAGALLERY_LIST_LIMIT" description="COM_PHOCAGALLERY_LIST_LIMIT_DESC" class="input-mini" default="25" onchange="this.form.submit();" />
</fields>
</fieldset>
</form>

View File

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_phocagallery/models/fields">
<fields name="filter">
<field name="search" type="text" inputmode="search" label="COM_PHOCAGALLERY_SEARCH" description="COM_PHOCAGALLERY_SEARCH" hint="JSEARCH_FILTER" />
<field name="published" type="list" label="JOPTION_FILTER_PUBLISHED" description="JOPTION_FILTER_PUBLISHED_DESC" onchange="this.form.submit();" >
<option value="">JOPTION_SELECT_PUBLISHED</option>
<option value="1">COM_PHOCAGALLERY_PUBLISHED</option>
<option value="0">COM_PHOCAGALLERY_UNPUBLISHED</option>
</field>
<field name="category_id" type="PhocaGalleryCategory" typemethod="filter" layout="joomla.form.field.list-fancy-select" label="JOPTION_FILTER_CATEGORY" description="JOPTION_FILTER_CATEGORY_DESC" onchange="this.form.submit();" />
<field name="language" type="contentlanguage" label="JOPTION_FILTER_LANGUAGE" description="JOPTION_FILTER_LANGUAGE_DESC" onchange="this.form.submit();">
<option value="">JOPTION_SELECT_LANGUAGE</option>
<option value="*">JALL</option>
</field>
<input type="hidden" name="form_submited" value="1"/>
</fields>
<fields name="list">
<field name="fullordering" type="list" label="COM_PHOCAGALLERY_LIST_FULL_ORDERING" description="COM_PHOCAGALLERY_LIST_FULL_ORDERING_DESC" onchange="this.form.submit();" default="a.title ASC" validate="options" >
<option value="">JGLOBAL_SORT_BY</option>
<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
<option value="a.title ASC">JGLOBAL_TITLE_ASC</option>
<option value="a.title DESC">JGLOBAL_TITLE_DESC</option>
<option value="a.published ASC" >COM_PHOCAGALLERY_PUBLISHED_ASC</option>
<option value="a.published DESC" >COM_PHOCAGALLERY_PUBLISHED_DESC</option>
<option value="a.filename ASC">COM_PHOCAGALLERY_FILENAME_ASC</option>
<option value="a.filename DESC">COM_PHOCAGALLERY_FILENAME_DESC</option>
<option value="a.approved ASC" >COM_PHOCAGALLERY_APPROVED_ASC</option>
<option value="a.approved DESC" >COM_PHOCAGALLERY_APPROVED_DESC</option>
<option value="category_id ASC">JCATEGORY_ASC</option>
<option value="category_id DESC">JCATEGORY_DESC</option>
<option value="category_owner_id ASC">COM_PHOCAGALLERY_OWNER_ASC</option>
<option value="category_owner_id DESC">COM_PHOCAGALLERY_OWNER_DESC</option>
<option value="uploadusername ASC">COM_PHOCAGALLERY_UPLOADED_BY_ASC</option>
<option value="uploadusername DESC">COM_PHOCAGALLERY_UPLOADED_BY_DESC</option>
<option value="ratingavg ASC">COM_PHOCAGALLERY_RATING_ASC</option>
<option value="ratingavg DESC">COM_PHOCAGALLERY_RATING_DESC</option>
<option value="a.hits ASC">JGLOBAL_HITS_ASC</option>
<option value="a.hits DESC">JGLOBAL_HITS_DESC</option>
<option value="a.language ASC">JGRID_HEADING_LANGUAGE_ASC</option>
<option value="a.language DESC">JGRID_HEADING_LANGUAGE_DESC</option>
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field name="limit" type="limitbox" label="COM_PHOCAGALLERY_LIST_LIMIT" description="COM_PHOCAGALLERY_LIST_LIMIT_DESC" class="input-mini" default="25" onchange="this.form.submit();" />
</fields>
</fieldset>
</form>

View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_phocagallery/models/fields">
<fields name="filter">
<field name="search" type="text" inputmode="search" label="COM_PHOCAGALLERY_SEARCH" description="COM_PHOCAGALLERY_SEARCH" hint="JSEARCH_FILTER" />
<!--<field name="published" type="list" label="JOPTION_FILTER_PUBLISHED" description="JOPTION_FILTER_PUBLISHED_DESC" onchange="this.form.submit();" >
<option value="">JOPTION_SELECT_PUBLISHED</option>
<option value="1">COM_PHOCAGALLERY_PUBLISHED</option>
<option value="0">COM_PHOCAGALLERY_UNPUBLISHED</option>
</field> -->
<field name="category_id" type="PhocaGalleryCategory" label="JOPTION_FILTER_CATEGORY" description="JOPTION_FILTER_CATEGORY_DESC" onchange="this.form.submit();" />
<!--
<field name="language" type="contentlanguage" label="JOPTION_FILTER_LANGUAGE" description="JOPTION_FILTER_LANGUAGE_DESC" onchange="this.form.submit();">
<option value="">JOPTION_SELECT_LANGUAGE</option>
<option value="*">JALL</option>
</field> -->
<input type="hidden" name="form_submited" value="1"/>
</fields>
<fields name="list">
<field name="fullordering" type="list" label="COM_PHOCAGALLERY_LIST_FULL_ORDERING" description="COM_PHOCAGALLERY_LIST_FULL_ORDERING_DESC" onchange="this.form.submit();" default="ua.username ASC" validate="options" >
<option value="">JGLOBAL_SORT_BY</option>
<option value="category_title ASC">COM_PHOCAGALLERY_CATEGORY_ASC</option>
<option value="category_title DESC">COM_PHOCAGALLERY_CATEGORY_DESC</option>
<option value="image_title ASC">COM_PHOCAGALLERY_IMAGE_ASC</option>
<option value="image_title DESC">COM_PHOCAGALLERY_IMAGE_DESC</option>
<option value="ua.username ASC">COM_PHOCAGALLERY_USER_ASC</option>
<option value="ua.username DESC">COM_PHOCAGALLERY_USER_DESC</option>
<option value="a.rating ASC">COM_PHOCAGALLERY_RATING_ASC</option>
<option value="a.rating DESC">COM_PHOCAGALLERY_RATING_DESC</option>
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field name="limit" type="limitbox" label="COM_PHOCAGALLERY_LIST_LIMIT" description="COM_PHOCAGALLERY_LIST_LIMIT_DESC" class="input-mini" default="25" onchange="this.form.submit();" />
</fields>
</fieldset>
</form>

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_phocagallery/models/fields">
<fields name="filter">
<field name="search" type="text" inputmode="search" label="COM_PHOCAGALLERY_SEARCH" description="COM_PHOCAGALLERY_SEARCH" hint="JSEARCH_FILTER" />
<!--
<field name="published" type="list" label="JOPTION_FILTER_PUBLISHED" description="JOPTION_FILTER_PUBLISHED_DESC" onchange="this.form.submit();" >
<option value="">JOPTION_SELECT_PUBLISHED</option>
<option value="1">COM_PHOCAGALLERY_PUBLISHED</option>
<option value="0">COM_PHOCAGALLERY_UNPUBLISHED</option>
</field>-->
<field name="category_id" type="PhocaGalleryCategory" label="JOPTION_FILTER_CATEGORY" description="JOPTION_FILTER_CATEGORY_DESC" onchange="this.form.submit();" />
<!--
<field name="language" type="contentlanguage" label="JOPTION_FILTER_LANGUAGE" description="JOPTION_FILTER_LANGUAGE_DESC" onchange="this.form.submit();">
<option value="">JOPTION_SELECT_LANGUAGE</option>
<option value="*">JALL</option>
</field> -->
<input type="hidden" name="form_submited" value="1"/>
</fields>
<fields name="list">
<field name="fullordering" type="list" label="COM_PHOCAGALLERY_LIST_FULL_ORDERING" description="COM_PHOCAGALLERY_LIST_FULL_ORDERING_DESC" onchange="this.form.submit();" default="ua.username ASC" validate="options" >
<option value="">JGLOBAL_SORT_BY</option>
<option value="category_title ASC">COM_PHOCAGALLERY_CATEGORY_ASC</option>
<option value="category_title DESC">COM_PHOCAGALLERY_CATEGORY_DESC</option>
<option value="image_title ASC">COM_PHOCAGALLERY_IMAGE_ASC</option>
<option value="image_title DESC">COM_PHOCAGALLERY_IMAGE_DESC</option>
<option value="ua.username ASC">COM_PHOCAGALLERY_USER_ASC</option>
<option value="ua.username DESC">COM_PHOCAGALLERY_USER_DESC</option>
<option value="a.rating ASC">COM_PHOCAGALLERY_RATING_ASC</option>
<option value="a.rating DESC">COM_PHOCAGALLERY_RATING_DESC</option>
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field name="limit" type="limitbox" label="COM_PHOCAGALLERY_LIST_LIMIT" description="COM_PHOCAGALLERY_LIST_LIMIT_DESC" class="input-mini" default="25" onchange="this.form.submit();" />
</fields>
</fieldset>
</form>

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_phocagallery/models/fields">
<fields name="filter">
<field name="search" type="text" inputmode="search" label="COM_PHOCAGALLERY_SEARCH" description="COM_PHOCAGALLERY_SEARCH" hint="JSEARCH_FILTER" />
<field name="published" type="list" label="JOPTION_FILTER_PUBLISHED" description="JOPTION_FILTER_PUBLISHED_DESC" onchange="this.form.submit();" >
<option value="">JOPTION_SELECT_PUBLISHED</option>
<option value="1">COM_PHOCAGALLERY_PUBLISHED</option>
<option value="0">COM_PHOCAGALLERY_UNPUBLISHED</option>
</field>
<!--
<field name="language" type="contentlanguage" label="JOPTION_FILTER_LANGUAGE" description="JOPTION_FILTER_LANGUAGE_DESC" onchange="this.form.submit();">
<option value="">JOPTION_SELECT_LANGUAGE</option>
<option value="*">JALL</option>
</field> -->
<input type="hidden" name="form_submited" value="1"/>
</fields>
<fields name="list">
<field name="fullordering" type="list" label="COM_PHOCAGALLERY_LIST_FULL_ORDERING" description="COM_PHOCAGALLERY_LIST_FULL_ORDERING_DESC" onchange="this.form.submit();" default="a.title ASC" validate="options" >
<option value="">JGLOBAL_SORT_BY</option>
<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
<option value="a.title ASC">JGLOBAL_TITLE_ASC</option>
<option value="a.title DESC">JGLOBAL_TITLE_DESC</option>
<option value="a.published ASC" >COM_PHOCAGALLERY_PUBLISHED_ASC</option>
<option value="a.published DESC" >COM_PHOCAGALLERY_PUBLISHED_DESC</option>
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field name="limit" type="limitbox" label="COM_PHOCAGALLERY_LIST_LIMIT" description="COM_PHOCAGALLERY_LIST_LIMIT_DESC" class="input-mini" default="25" onchange="this.form.submit();" />
</fields>
</fieldset>
</form>

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_phocagallery/models/fields">
<fields name="filter">
<field name="search" type="text" inputmode="search" label="COM_PHOCAGALLERY_SEARCH" description="COM_PHOCAGALLERY_SEARCH" hint="JSEARCH_FILTER" />
<field name="published" type="list" label="JOPTION_FILTER_PUBLISHED" description="JOPTION_FILTER_PUBLISHED_DESC" onchange="this.form.submit();" >
<option value="">JOPTION_SELECT_PUBLISHED</option>
<option value="1">COM_PHOCAGALLERY_PUBLISHED</option>
<option value="0">COM_PHOCAGALLERY_UNPUBLISHED</option>
</field>
<!--
<field name="language" type="contentlanguage" label="JOPTION_FILTER_LANGUAGE" description="JOPTION_FILTER_LANGUAGE_DESC" onchange="this.form.submit();">
<option value="">JOPTION_SELECT_LANGUAGE</option>
<option value="*">JALL</option>
</field> -->
<input type="hidden" name="form_submited" value="1"/>
</fields>
<fields name="list">
<field name="fullordering" type="list" label="COM_PHOCAGALLERY_LIST_FULL_ORDERING" description="COM_PHOCAGALLERY_LIST_FULL_ORDERING_DESC" onchange="this.form.submit();" default="ua.username ASC" validate="options" >
<option value="">JGLOBAL_SORT_BY</option>
<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
<option value="ua.username ASC">COM_PHOCAGALLERY_USER_ASC</option>
<option value="ua.username DESC">COM_PHOCAGALLERY_USER_DESC</option>
<option value="a.published ASC" >COM_PHOCAGALLERY_PUBLISHED_ASC</option>
<option value="a.published DESC" >COM_PHOCAGALLERY_PUBLISHED_DESC</option>
<option value="a.approved ASC" >COM_PHOCAGALLERY_APPROVED_ASC</option>
<option value="a.approved DESC" >COM_PHOCAGALLERY_APPROVED_DESC</option>
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field name="limit" type="limitbox" label="COM_PHOCAGALLERY_LIST_LIMIT" description="COM_PHOCAGALLERY_LIST_LIMIT_DESC" class="input-mini" default="25" onchange="this.form.submit();" />
</fields>
</fieldset>
</form>

View File

@ -0,0 +1 @@
<html><body></body></html>

View File

@ -0,0 +1,109 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_phocagallery/models/fields">
<field name="id" type="text" default="0" label="JGLOBAL_FIELD_ID_LABEL" required="true" readonly="true" class="readonly" />
<field name="title" type="text" class="form-control" size="40" label="COM_PHOCAGALLERY_FIELD_TITLE_LABEL" description="COM_PHOCAGALLERY_FIELD_TITLE_DESC" required="true" />
<field name="alias" type="text" class="form-control" size="40" label="COM_PHOCAGALLERY_FIELD_ALIAS_LABEL" description="COM_PHOCAGALLERY_FIELD_ALIAS_DESC" />
<field name="parent_id" type="phocagallerycategory" label="COM_PHOCAGALLERY_FIELD_PARENT_CATEGORY_LABEL" description="COM_PHOCAGALLERY_FIELD_CATEGORY_CATEGORY_DESC" />
<field name="image_id" type="phocaselectitem" label="COM_PHOCAGALLERY_FIELD_IMAGE_ID_LABEL" description="COM_PHOCAGALLERY_FIELD_IMAGE_ID_DESC" />
<field name="ordering" type="PhocaGalleryOrdering" table="category" class="form-select" label="COM_PHOCAGALLERY_FIELD_ORDERING_LABEL" description="COM_PHOCAGALLERY_FIELD_ORDERING_DESC" />
<field name="access" type="accesslevel" label="JFIELD_ACCESS_LABEL" description="JFIELD_ACCESS_DESC" class="form-select" size="1" />
<field name="accessuserid" type="phocausers" multiple="1" layout="joomla.form.field.list-fancy-select" label="COM_PHOCAGALLERY_FIELD_ACCESS_RIGHTS_LABEL" description="COM_PHOCAGALLERY_FIELD_ACCESS_RIGHTS_DESC" size="1" />
<field name="uploaduserid" type="phocausers" multiple="1" layout="joomla.form.field.list-fancy-select" label="COM_PHOCAGALLERY_FIELD_UPLOAD_RIGHTS_LABEL" description="COM_PHOCAGALLERY_FIELD_UPLOAD_RIGHTS_DESC" size="1" />
<field name="deleteuserid" type="phocausers" multiple="1" layout="joomla.form.field.list-fancy-select" label="COM_PHOCAGALLERY_FIELD_DELETE_RIGHTS_LABEL" description="COM_PHOCAGALLERY_FIELD_DELETE_RIGHTS_DESC" size="1" />
<field name="owner_id" type="phocausers" typeowner="1" layout="joomla.form.field.list-fancy-select" label="COM_PHOCAGALLERY_FIELD_OWNER_LABEL" description="COM_PHOCAGALLERY_FIELD_OWNER_DESC" size="1" />
<field name="userfolder" type="phocaselectfolder" label="COM_PHOCAGALLERY_FIELD_OWNER_FOLDER_LABEL" description="COM_PHOCAGALLERY_FIELD_OWNER_FOLDER_DESC" class="form-select" size="40" />
<field name="latitude" type="phocaselectmap" label="COM_PHOCAGALLERY_FIELD_LATITUDE_LABEL" description="COM_PHOCAGALLERY_FIELD_LATITUDE_DESC" class="form-select" size="40" />
<field name="longitude" type="phocaselectmap" label="COM_PHOCAGALLERY_FIELD_LONGITUDE_LABEL" description="COM_PHOCAGALLERY_FIELD_LONGITUDE_DESC" class="form-select" size="40" />
<field name="zoom" type="phocaselectmap" label="COM_PHOCAGALLERY_FIELD_ZOOM_LABEL" description="COM_PHOCAGALLERY_FIELD_ZOOM_DESC" class="form-select" size="40" />
<field name="geotitle" type="Text" class="form-select" size="40" label="COM_PHOCAGALLERY_FIELD_GEOTITLE_LABEL" description="COM_PHOCAGALLERY_FIELD_GEOTITLE_DESC" />
<field name="description" type="editor" buttons="true" hide="pagebreak,readmore" class="form-select" label="COM_PHOCAGALLERY_FIELD_DESCRIPTION_LABEL" filter="\Joomla\CMS\Component\ComponentHelper::filterText" description="COM_PHOCAGALLERY_FIELD_DESCRIPTION_DESC" />
<field name="extu" type="Text" class="form-select" size="40" label="COM_PHOCAGALLERY_FIELD_PICASA_USER_LABEL" description="COM_PHOCAGALLERY_FIELD_PICASA_USER_DESC" />
<field name="exta" type="Text" class="form-select" size="40" label="COM_PHOCAGALLERY_FIELD_PICASA_ALBUM_LABEL" description="COM_PHOCAGALLERY_FIELD_PICASA_ALBUM_DESC" />
<field name="extauth" type="Text" class="form-select" size="40" label="COM_PHOCAGALLERY_FIELD_PICASA_AUTHKEY_LABEL" description="COM_PHOCAGALLERY_FIELD_PICASA_AUTHKEY_DESC" />
<field name="extfbuid" type="phocaselectfbuser" class="form-select" label="COM_PHOCAGALLERY_FIELD_FB_USER_LABEL" description="COM_PHOCAGALLERY_FIELD_FB_USER_DESC" fieldid="extfbcatid" />
<field name="extfbcatid" type="PhocaSelectFbAlbum" class="form-select" size="40" label="COM_PHOCAGALLERY_FIELD_FB_ALBUM_LABEL" description="COM_PHOCAGALLERY_FIELD_FB_ALBUM_DESC" />
<field name="imgurclient" type="Text" class="form-select" size="40" label="COM_PHOCAGALLERY_FIELD_IMGUR_CLIENT_ID_LABEL" description="COM_PHOCAGALLERY_FIELD_IMGUR_CLIENT_ID_DESC" />
<field name="imguralbum" type="Text" class="form-select" size="40" label="COM_PHOCAGALLERY_FIELD_IMGUR_ALBUM_ID_LABEL" description="COM_PHOCAGALLERY_FIELD_IMGUR_ALBUM_ID_DESC" />
<field name="metakey" type="textarea"
label="JField_Meta_Keywords_Label" description="JField_Meta_Keywords_Desc"
class="form-select" rows="3" cols="30" />
<field name="metadesc" type="textarea"
label="JField_Meta_Description_Label" description="JField_Meta_Description_Desc"
class="form-select" rows="3" cols="30" />
</fieldset>
<fieldset name="publish" label="COM_PHOCAGALLERY_GROUP_LABEL_PUBLISHING_DETAILS" >
<field name="published" type="list" label="COM_PHOCAGALLERY_FIELD_PUBLISHED_LABEL" description="COM_PHOCAGALLERY_FIELD_PUBLISHED_DESC" class="form-select" size="1" default="1">
<option value="1">JPUBLISHED</option>
<option value="0">JUNPUBLISHED</option>
</field>
<field name="approved" type="list" label="COM_PHOCAGALLERY_FIELD_APPROVED_LABEL" description="COM_PHOCAGALLERY_FIELD_APPROVED_DESC" class="form-select" size="1" default="1">
<option value="1">COM_PHOCAGALLERY_APPROVED</option>
<option value="0">COM_PHOCAGALLERY_NOT_APPROVED</option>
</field>
<field name="date" type="Calendar" class="form-control" label="COM_PHOCAGALLERY_FIELD_DATE_LABEL" description="COM_PHOCAGALLERY_FIELD_DATE_DESC" filter="user_utc" translateformat="true" />
<field name="hits" type="Text" class="form-control" size="6" label="COM_PHOCAGALLERY_FIELD_HITS" description="COM_PHOCAGALLERY_FIELD_HITS_DESC" />
<field name="language" type="contentlanguage" label="JFIELD_LANGUAGE_LABEL" description="COM_PHOCAGALLERY_FIELD_LANGUAGE_CATEGORY_DESC" class="form-select">
<option value="*">JALL</option>
</field>
</fieldset>
<fields name="metadata">
<fieldset name="metadata" label="JGLOBAL_FIELDSET_METADATA_OPTIONS">
<!--
<field name="robots" type="list"
label="JField_Metadata_Robots_Label" description="JField_Metadata_Robots_Desc"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JGLOBAL_INDEX_FOLLOW</option>
<option value="1">JGLOBAL_NOINDEX_FOLLOW</option>
<option value="2">JGLOBAL_INDEX_NOFOLLOW</option>
<option value="3">JGLOBAL_NOINDEX_NOFOLLOW</option>
<option value="4">JGLOBAL_NO_ROBOTS_TAG</option>
</field>
<field name="author" type="text" label="JAUTHOR"
description="JField_Metadata_Author_Desc" size="20" />
<field name="rights" type="text"
label="JFIELD_META_RIGHTS_LABEL" description="JFIELD_META_RIGHTS_DESC"
required="" filter="string" cols="30" rows="2" -->
</fieldset>
</fields>
</form>

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_phocagallery/models/fields">
<field name="id" type="text" default="0" label="JGLOBAL_FIELD_ID_LABEL" required="true" readonly="true" class="readonly" />
<field name="title" type="text" class="form-control" size="40" label="COM_PHOCAGALLERY_FIELD_TITLE_LABEL" description="COM_PHOCAGALLERY_FIELD_TITLE_DESC" required="true" />
<field name="usertitle" type="phocainfotext" class="form-control" size="40" label="COM_PHOCAGALLERY_FIELD_USER_LABEL" description="COM_PHOCAGALLERY_FIELD_USER_DESC" />
<field name="alias" type="text" class="form-control" size="40" label="COM_PHOCAGALLERY_FIELD_ALIAS_LABEL" description="COM_PHOCAGALLERY_FIELD_ALIAS_DESC" />
<field name="cattitle" type="phocainfotext" label="COM_PHOCAGALLERY_FIELD_CATEGORY_LABEL" description="COM_PHOCAGALLERY_FIELD_CATEGORY_DESC" class="form-control" />
<field name="ordering" type="PhocaGalleryOrdering" table="comment" class="form-select" label="COM_PHOCAGALLERY_FIELD_ORDERING_LABEL" description="COM_PHOCAGALLERY_FIELD_ORDERING_DESC" />
<field name="catid" type="hidden" filter="unset" />
<field name="comment" type="editor" buttons="true" hide="pagebreak,readmore" class="form-control" label="COM_PHOCAGALLERY_FIELD_COMMENT_LABEL" description="COM_PHOCAGALLERY_FIELD_COMMENT_DESC" filter="\Joomla\CMS\Component\ComponentHelper::filterText" />
</fieldset>
<fieldset name="publish" label="COM_PHOCAGALLERY_GROUP_LABEL_PUBLISHING_DETAILS" >
<field name="published" type="list" label="COM_PHOCAGALLERY_FIELD_PUBLISHED_LABEL" description="COM_PHOCAGALLERY_FIELD_PUBLISHED_DESC" class="form-select" size="1" default="1">
<option value="1">JPUBLISHED</option>
<option value="0">JUNPUBLISHED</option>
</field>
<field name="date" type="Calendar" class="form-control" label="COM_PHOCAGALLERY_FIELD_DATE_LABEL" description="COM_PHOCAGALLERY_FIELD_DATE_DESC" filter="user_utc" translateformat="true" />
</fieldset>
</form>

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_phocagallery/models/fields">
<field name="id" type="text" default="0" label="JGLOBAL_FIELD_ID_LABEL" required="true" readonly="true" class="readonly" />
<field name="title" type="text" class="form-control" size="40" label="COM_PHOCAGALLERY_FIELD_TITLE_LABEL" description="COM_PHOCAGALLERY_FIELD_TITLE_DESC" required="true" />
<field name="usertitle" type="phocainfotext" class="form-control" size="40" label="COM_PHOCAGALLERY_FIELD_USER_LABEL" description="COM_PHOCAGALLERY_FIELD_USER_DESC" />
<field name="alias" type="text" class="form-control" size="40" label="COM_PHOCAGALLERY_FIELD_ALIAS_LABEL" description="COM_PHOCAGALLERY_FIELD_ALIAS_DESC" />
<field name="cattitle" type="phocainfotext" label="COM_PHOCAGALLERY_FIELD_CATEGORY_LABEL" description="COM_PHOCAGALLERY_FIELD_CATEGORY_DESC" class="form-control" />
<field name="imagetitle" type="phocainfotext" label="COM_PHOCAGALLERY_FIELD_IMAGE_LABEL" description="COM_PHOCAGALLERY_FIELD_IMAGE_DESC" class="form-control" readonly="1" />
<field name="ordering" type="PhocaGalleryOrdering" table="commentimage" class="form-select" label="COM_PHOCAGALLERY_FIELD_ORDERING_LABEL" description="COM_PHOCAGALLERY_FIELD_ORDERING_DESC" />
<field name="imgid" type="hidden" filter="unset" />
<field name="comment" type="editor" buttons="true" hide="pagebreak,readmore" class="form-control" label="COM_PHOCAGALLERY_FIELD_COMMENT_LABEL" description="COM_PHOCAGALLERY_FIELD_COMMENT_DESC" filter="\Joomla\CMS\Component\ComponentHelper::filterText" />
</fieldset>
<fieldset name="publish" label="COM_PHOCAGALLERY_GROUP_LABEL_PUBLISHING_DETAILS" >
<field name="published" type="list" label="COM_PHOCAGALLERY_FIELD_PUBLISHED_LABEL" description="COM_PHOCAGALLERY_FIELD_PUBLISHED_DESC" class="form-select" size="1" default="1">
<option value="1">JPUBLISHED</option>
<option value="0">JUNPUBLISHED</option>
</field>
<field name="date" type="Calendar" class="form-control" label="COM_PHOCAGALLERY_FIELD_DATE_LABEL" description="COM_PHOCAGALLERY_FIELD_DATE_DESC" filter="user_utc" translateformat="true" />
</fieldset>
</form>

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_phocagallery/models/fields">
<field name="id" type="text" default="0" label="JGLOBAL_FIELD_ID_LABEL" required="true" readonly="true" class="readonly" />
<field name="title" type="text" class="form-control" size="40" label="COM_PHOCAGALLERY_FIELD_TITLE_LABEL" description="COM_PHOCAGALLERY_FIELD_TITLE_DESC" required="true" />
<field name="alias" type="text" class="form-control" size="40" label="COM_PHOCAGALLERY_FIELD_ALIAS_LABEL" description="COM_PHOCAGALLERY_FIELD_ALIAS_DESC" />
<field name="type" type="hidden" default="0" label="COM_PHOCAGALLERY_FIELD_TYPE_LABEL" required="true" readonly="true" class="readonly" />
<field name="typeoutput" type="text" default="COM_PHOCAGALLERY_CUSTOM_CSS" label="COM_PHOCAGALLERY_FIELD_TYPE_LABEL" required="true" readonly="true" class="readonly" />
<field name="filename" type="text" default="" label="COM_PHOCAGALLERY_FIELD_FILENAME_LABEL" readonly="true" class="readonly" />
<field name="ordering" type="phocagalleryOrdering" table="styles" class="form-select" label="COM_PHOCAGALLERY_FIELD_ORDERING_LABEL" description="COM_PHOCAGALLERY_FIELD_ORDERING_DESC" />
<field name="source" type="editor" editor="codemirror|none" buttons="no" label="COM_PHOCAGALLERY_FIELD_CSS_LABEL" description="COM_PHOCAGALLERY_FIELD_CSS_DESC" syntax="css" filter="raw" height="400" />
</fieldset>
<fieldset name="publish" label="COM_PHOCAGALLERY_GROUP_LABEL_PUBLISHING_DETAILS" >
<field name="published" type="list" label="COM_PHOCAGALLERY_FIELD_PUBLISHED_LABEL" description="COM_PHOCAGALLERY_FIELD_PUBLISHED_DESC" class="form-select" size="1" default="1">
<option value="1">JPUBLISHED</option>
<option value="0">JUNPUBLISHED</option>
</field>
<field name="menulink" type="text" default="" label="COM_PHOCAGALLERY_FIELD_CSS_MENULINK_ID_LABEL" description="COM_PHOCAGALLERY_FIELD_CSS_MENULINK_ID_DESC" />
</fieldset>
</form>

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_phocagallery/models/fields">
<field name="id" type="text" default="0" label="JGLOBAL_FIELD_ID_LABEL" required="true" readonly="true" class="readonly" />
<field name="name" type="text" class="form-control" size="60" label="COM_PHOCAGALLERY_FIELD_FB_NAME_LABEL" description="COM_PHOCAGALLERY_FIELD_FB_NAME_DESC" />
<field name="appid" type="text" class="form-control" size="60" label="COM_PHOCAGALLERY_FIELD_FB_APPID_LABEL" description="COM_PHOCAGALLERY_FIELD_FB_APPID_DESC" required="true" />
<field name="appsid" type="text" class="form-control" size="60" label="COM_PHOCAGALLERY_FIELD_FB_APPSID_LABEL" description="COM_PHOCAGALLERY_FIELD_FB_APPSID_DESC" required="true" />
<field name="ordering" type="PhocaGalleryOrdering" table="fbuser" class="form-select" label="COM_PHOCAGALLERY_FIELD_ORDERING_LABEL" description="COM_PHOCAGALLERY_FIELD_ORDERING_DESC" />
<field name="uid" type="text" class="form-control" size="60" label="COM_PHOCAGALLERY_FIELD_FB_UID_LABEL" description="COM_PHOCAGALLERY_FIELD_FB_UID_DESC" />
<field name="base_domain" type="text" class="form-control" size="60" label="COM_PHOCAGALLERY_FIELD_FB_BASE_DOMAIN_LABEL" description="COM_PHOCAGALLERY_FIELD_FB_BASE_DOMAIN_DESC" />
<field name="secret" type="text" class="form-control" size="60" label="COM_PHOCAGALLERY_FIELD_FB_SECRET_LABEL" description="COM_PHOCAGALLERY_FIELD_FB_SECRET_DESC" />
<field name="session_key" type="text" class="form-control" size="60" label="COM_PHOCAGALLERY_FIELD_FB_SESSION_KEY_LABEL" description="COM_PHOCAGALLERY_FIELD_FB_SESSION_KEY_DESC" />
<field name="access_token" type="text" class="form-control" size="60" label="COM_PHOCAGALLERY_FIELD_FB_ACCESS_TOKEN_LABEL" description="COM_PHOCAGALLERY_FIELD_FB_ACCESS_TOKEN_DESC" />
<field name="sig" type="text" class="form-control" size="60" label="COM_PHOCAGALLERY_FIELD_FB_SIG_LABEL" description="COM_PHOCAGALLERY_FIELD_FB_SIG_DESC" />
<field name="expires" type="hidden" class="form-control" size="60" label="COM_PHOCAGALLERY_FIELD_FB_EXPIRES_LABEL" description="COM_PHOCAGALLERY_FIELD_FB_EXPIRES_DESC" />
<field name="fanpageid" type="text" class="form-control" size="60" label="COM_PHOCAGALLERY_FIELD_FB_FANPAGEID_LABEL" description="COM_PHOCAGALLERY_FIELD_FB_FANPAGEID_DESC" />
</fieldset>
<fieldset name="publish" label="COM_PHOCAGALLERY_GROUP_LABEL_PUBLISHING_DETAILS" >
<field name="published" type="list" label="COM_PHOCAGALLERY_FIELD_PUBLISHED_LABEL" description="COM_PHOCAGALLERY_FIELD_PUBLISHED_DESC" class="form-control" size="1" default="1">
<option value="1">JPUBLISHED</option>
<option value="0">JUNPUBLISHED</option>
</field>
</fieldset>
<fields name="comments">
<fieldset name="comments" label="COM_PHOCAGALLERY_FACEBOOK_COMMENTS">
<field name="fb_comment_width" default="550" size="6" type="phocatext" label="COM_PHOCAGALLERY_FACEBOOK_COMMENTS_WIDTH_LABEL" description="COM_PHOCAGALLERY_FACEBOOK_COMMENTS_WIDTH_DESC" />
<field name="fb_comment_lang" type="text" size="30" default="en_US" label="COM_PHOCAGALLERY_FACEBOOK_FIELD_COMMENT_LANG_LABEL" description="COM_PHOCAGALLERY_FACEBOOK_FIELD_COMMENT_LANG_DESC" />
<field name="fb_comment_count" type="text" size="30" default="" label="COM_PHOCAGALLERY_FACEBOOK_FIELD_COMMENT_COUNT_LABEL" description="COM_PHOCAGALLERY_FACEBOOK_FIELD_COMMENT_COUNT_DESC" />
</fieldset>
</fields>
</form>

View File

@ -0,0 +1,137 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_phocagallery/models/fields">
<field name="id" type="text" default="0" label="JGLOBAL_FIELD_ID_LABEL" required="true" readonly="true" class="readonly" />
<field name="title" type="text" class="form-control" size="40" label="COM_PHOCAGALLERY_FIELD_TITLE_LABEL" description="COM_PHOCAGALLERY_FIELD_TITLE_DESC" />
<field name="alias" type="text" class="form-control" size="40" label="COM_PHOCAGALLERY_FIELD_ALIAS_LABEL" description="COM_PHOCAGALLERY_FIELD_ALIAS_DESC" />
<field name="catid" type="phocagallerycategory" onchange="changeCatid()" label="COM_PHOCAGALLERY_FIELD_CATEGORY_LABEL" description="COM_PHOCAGALLERY_FIELD_CATEGORY_DESC" required="true" />
<field name="ordering" type="PhocaGalleryOrdering" table="image" class="form-select" label="COM_PHOCAGALLERY_FIELD_ORDERING_LABEL" description="COM_PHOCAGALLERY_FIELD_ORDERING_DESC" />
<field name="filename" type="phocaselectfilename" label="COM_PHOCAGALLERY_FIELD_FILENAME_LABEL" required="true" description="COM_PHOCAGALLERY_FIELD_FILENAME_DESC" class="form-control" size="40" />
<field name="extid" type="hidden" />
<field name="latitude" type="phocaselectmap" label="COM_PHOCAGALLERY_FIELD_LATITUDE_LABEL" description="COM_PHOCAGALLERY_FIELD_LATITUDE_DESC" class="form-control" size="40" />
<field name="longitude" type="phocaselectmap" label="COM_PHOCAGALLERY_FIELD_LONGITUDE_LABEL" description="COM_PHOCAGALLERY_FIELD_LONGITUDE_DESC" class="form-control" size="40" />
<field name="zoom" type="phocaselectmap" label="COM_PHOCAGALLERY_FIELD_ZOOM_LABEL" description="COM_PHOCAGALLERY_FIELD_ZOOM_DESC" class="form-control" size="40" />
<field name="geotitle" type="text" class="form-control" size="40" label="COM_PHOCAGALLERY_FIELD_GEOTITLE_LABEL" description="COM_PHOCAGALLERY_FIELD_GEOTITLE_DESC" />
<field name="videocode" type="phocaselectytb" rows="3" cols="5" label="COM_PHOCAGALLERY_FIELD_VIDEOCODE_LABEL" class="form-control" description="COM_PHOCAGALLERY_FIELD_VIDEOCODE_DESC" filter="raw" />
<field name="pcproductid" type="text" class="form-control" size="40" label="COM_PHOCAGALLERY_FIELD_PCPRODUCT_ID_LABEL" description="COM_PHOCAGALLERY_FIELD_PCPRODUCT_ID_DESC" />
<field name="vmproductid" type="text" class="form-control" size="40" label="COM_PHOCAGALLERY_FIELD_VMPRODUCT_ID_LABEL" description="COM_PHOCAGALLERY_FIELD_VMPRODUCT_ID_DESC" />
<field name="description" type="editor" buttons="true" hide="pagebreak,readmore" class="form-control" label="COM_PHOCAGALLERY_FIELD_DESCRIPTION_LABEL" filter="\Joomla\CMS\Component\ComponentHelper::filterText" description="COM_PHOCAGALLERY_FIELD_DESCRIPTION_DESC" />
<field name="extu" type="Text" class="form-control" size="40" label="COM_PHOCAGALLERY_FIELD_PICASA_USER_LABEL" description="COM_PHOCAGALLERY_FIELD_PICASA_USER_DESC" />
<field name="exta" type="Text" class="form-control" size="40" label="COM_PHOCAGALLERY_FIELD_PICASA_ALBUM_LABEL" description="COM_PHOCAGALLERY_FIELD_PICASA_ALBUM_DESC" />
<field name="extauth" type="Text" class="form-control" size="40" label="COM_PHOCAGALLERY_FIELD_PICASA_AUTHKEY_LABEL" description="COM_PHOCAGALLERY_FIELD_PICASA_AUTHKEY_DESC" />
<field name="extlink1link" type="Text" class="form-control" size="40" label="COM_PHOCAGALLERY_EXTERNAL_LINK_LINK_LABEL" description="COM_PHOCAGALLERY_FIELD_EXTERNAL_LINK_LINK_DESC" />
<field name="extlink1title" type="Text" class="form-control" size="40" label="COM_PHOCAGALLERY_EXTERNAL_LINK_TITLE_LABEL" description="COM_PHOCAGALLERY_FIELD_EXTERNAL_LINK_TITLE_DESC" />
<field name="extlink1target" type="list" class="form-select" label="COM_PHOCAGALLERY_EXTERNAL_LINK_TARGET_LABEL" description="COM_PHOCAGALLERY_FIELD_EXTERNAL_LINK_TARGET_DESC" default="_self" >
<option value="_self">COM_PHOCAGALLERY_OPEN_WINDOW_SELF</option>
<option value="_blank">COM_PHOCAGALLERY_OPEN_WINDOW_BLANK</option>
<option value="_parent">COM_PHOCAGALLERY_OPEN_WINDOW_PARENT</option>
<option value="_top">COM_PHOCAGALLERY_OPEN_WINDOW_TOP</option>
</field>
<field name="extlink1icon" type="list" class="form-select" label="COM_PHOCAGALLERY_EXTERNAL_LINK_ICON_LABEL" description="COM_PHOCAGALLERY_FIELD_EXTERNAL_LINK_ICON_DESC" default="1" >
<option value="0">COM_PHOCAGALLERY_NO</option>
<option value="1">COM_PHOCAGALLERY_YES</option>
</field>
<field name="extlink2link" type="Text" class="form-control" size="40" label="COM_PHOCAGALLERY_EXTERNAL_LINK_LINK2_LABEL" description="COM_PHOCAGALLERY_FIELD_EXTERNAL_LINK_LINK2_DESC" />
<field name="extlink2title" type="Text" class="form-control" size="40" label="COM_PHOCAGALLERY_EXTERNAL_LINK_TITLE2_LABEL" description="COM_PHOCAGALLERY_FIELD_EXTERNAL_LINK_TITLE2_DESC" />
<field name="extlink2target" type="list" class="form-select" label="COM_PHOCAGALLERY_EXTERNAL_LINK_TARGET2_LABEL" description="COM_PHOCAGALLERY_FIELD_EXTERNAL_LINK_TARGET2_DESC" default="_self" >
<option value="_self">COM_PHOCAGALLERY_OPEN_WINDOW_SELF</option>
<option value="_blank">COM_PHOCAGALLERY_OPEN_WINDOW_BLANK</option>
<option value="_parent">COM_PHOCAGALLERY_OPEN_WINDOW_PARENT</option>
<option value="_top">COM_PHOCAGALLERY_OPEN_WINDOW_TOP</option>
</field>
<field name="extlink2icon" type="list" class="form-select" label="COM_PHOCAGALLERY_EXTERNAL_LINK_ICON2_LABEL" description="COM_PHOCAGALLERY_FIELD_EXTERNAL_LINK_ICON2_DESC" default="1" >
<option value="0">COM_PHOCAGALLERY_NO</option>
<option value="1">COM_PHOCAGALLERY_YES</option>
</field>
<field name="metakey" type="textarea"
label="JField_Meta_Keywords_Label" description="JField_Meta_Keywords_Desc"
class="form-control" rows="3" cols="30" />
<field name="metadesc" type="textarea"
label="JField_Meta_Description_Label" description="JField_Meta_Description_Desc"
class="form-control" rows="3" cols="30" />
</fieldset>
<fieldset name="publish" label="COM_PHOCAGALLERY_GROUP_LABEL_PUBLISHING_DETAILS" >
<field name="published" type="list" label="COM_PHOCAGALLERY_FIELD_PUBLISHED_LABEL" description="COM_PHOCAGALLERY_FIELD_PUBLISHED_DESC" class="form-select" size="1" default="1">
<option value="1">JPUBLISHED</option>
<option value="0">JUNPUBLISHED</option>
</field>
<field name="approved" type="list" label="COM_PHOCAGALLERY_FIELD_APPROVED_LABEL" description="COM_PHOCAGALLERY_FIELD_APPROVED_DESC" class="form-select" size="1" default="1">
<option value="1">COM_PHOCAGALLERY_APPROVED</option>
<option value="0">COM_PHOCAGALLERY_NOT_APPROVED</option>
</field>
<field name="date" type="Calendar" class="form-control" label="COM_PHOCAGALLERY_FIELD_DATE_LABEL" description="COM_PHOCAGALLERY_FIELD_DATE_DESC" filter="user_utc" translateformat="true" />
<field name="hits" type="Text" class="form-control" size="6" label="COM_PHOCAGALLERY_FIELD_HITS" description="COM_PHOCAGALLERY_FIELD_HITS_DESC" />
<field name="language" type="contentlanguage" label="JFIELD_LANGUAGE_LABEL" description="COM_PHOCAGALLERY_FIELD_LANGUAGE_IMAGE_DESC" class="form-select">
<option value="*">JALL</option>
</field>
<field name="tags" type="phocatags" multiple="1" label="COM_PHOCAGALLERY_FIELD_TAGS_LABEL" description="COM_PHOCAGALLERY_FIELD_TAGS_DESC" layout="joomla.form.field.list-fancy-select" size="1" />
</fieldset>
<fields name="metadata">
<fieldset name="metadata" label="JGLOBAL_FIELDSET_METADATA_OPTIONS">
<!--
<field name="robots" type="list"
label="JField_Metadata_Robots_Label" description="JField_Metadata_Robots_Desc"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JGLOBAL_INDEX_FOLLOW</option>
<option value="1">JGLOBAL_NOINDEX_FOLLOW</option>
<option value="2">JGLOBAL_INDEX_NOFOLLOW</option>
<option value="3">JGLOBAL_NOINDEX_NOFOLLOW</option>
<option value="4">JGLOBAL_NO_ROBOTS_TAG</option>
</field>
<field name="author" type="text" label="JAUTHOR"
description="JField_Metadata_Author_Desc" size="20" />
<field name="rights" type="text"
label="JFIELD_META_RIGHTS_LABEL" description="JFIELD_META_RIGHTS_DESC"
required="" filter="string" cols="30" rows="2" /> -->
</fieldset>
</fields>
</form>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_phocagallery/models/fields">
<field name="title" type="text" class="form-control" size="40" label="COM_PHOCAGALLERY_FIELD_TITLE_LABEL" description="COM_PHOCAGALLERY_FIELD_TITLE_M_DESC" />
<field name="alias" type="text" class="form-control" size="40" label="COM_PHOCAGALLERY_FIELD_ALIAS_LABEL" description="COM_PHOCAGALLERY_FIELD_ALIAS_M_DESC" />
<field name="catid" type="phocagallerycategory" label="COM_PHOCAGALLERY_FIELD_CATEGORY_LABEL" description="COM_PHOCAGALLERY_FIELD_CATEGORY_DESC" />
<field name="published" type="list" label="COM_PHOCAGALLERY_FIELD_PUBLISHED_LABEL" description="COM_PHOCAGALLERY_FIELD_PUBLISHED_DESC" class="form-select" size="1" default="1">
<option value="1">JPUBLISHED</option>
<option value="0">JUNPUBLISHED</option>
</field>
<field name="approved" type="list" label="COM_PHOCAGALLERY_FIELD_APPROVED_LABEL" description="COM_PHOCAGALLERY_FIELD_APPROVED_DESC" class="form-select" size="1" default="1">
<option value="1">COM_PHOCAGALLERY_APPROVED</option>
<option value="0">COM_PHOCAGALLERY_NOT_APPROVED</option>
</field>
<field name="language" type="contentlanguage" label="JFIELD_LANGUAGE_LABEL" description="COM_PHOCAGALLERY_FIELD_LANGUAGE_IMAGE_DESC" class="form-select">
<option value="*">JALL</option>
</field>
</fieldset>
</form>

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset>
<field
name="source"
type="editor"
editor="codemirror|none"
buttons="no"
label="COM_TEMPLATES_FIELD_SOURCE_LABEL"
description="COM_TEMPLATES_FIELD_SOURCE_DESC"
rows="20"
cols="80"
filter="raw" />
</fieldset>
</form>

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_phocagallery/models/fields">
<field name="id" type="text" default="0" label="JGLOBAL_FIELD_ID_LABEL" required="true" readonly="true" class="readonly" />
<field name="title" type="text" class="form-control" size="40" label="COM_PHOCAGALLERY_FIELD_TITLE_LABEL" description="COM_PHOCAGALLERY_FIELD_TITLE_DESC" required="true" />
<field name="alias" type="text" class="form-control" size="40" label="COM_PHOCAGALLERY_FIELD_ALIAS_LABEL" description="COM_PHOCAGALLERY_FIELD_ALIAS_DESC" />
<field name="link_cat" type="phocagallerycategory" label="COM_PHOCAGALLERY_FIELD_CATEGORY_LINK_LABEL" description="COM_PHOCAGALLERY_FIELD_CATEGORY_LINK_DESC" />
<field name="link_ext" type="text" label="COM_PHOCAGALLERY_FIELD_EXT_LINK_TAG_LABEL" description="COM_PHOCAGALLERY_FIELD_EXT_LINK_TAG_DESC" class="form-control" size="40" />
<field name="ordering" type="phocagalleryOrdering" table="tag" class="form-select" label="COM_PHOCAGALLERY_FIELD_ORDERING_LABEL" description="COM_PHOCAGALLERY_FIELD_ORDERING_DESC" />
<field name="description" type="editor" buttons="true" hide="pagebreak,readmore" class="form-control" label="COM_PHOCAGALLERY_FIELD_DESCRIPTION_LABEL" filter="\Joomla\CMS\Component\ComponentHelper::filterText" description="COM_PHOCAGALLERY_FIELD_DESCRIPTION_DESC" />
</fieldset>
<fieldset name="publish" label="COM_PHOCAGALLERY_GROUP_LABEL_PUBLISHING_DETAILS" >
<field name="published" type="list" label="COM_PHOCAGALLERY_FIELD_PUBLISHED_LABEL" description="COM_PHOCAGALLERY_FIELD_PUBLISHED_DESC" class="form-select" size="1" default="1">
<option value="1">JPUBLISHED</option>
<option value="0">JUNPUBLISHED</option>
</field>
</fieldset>
</form>

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,127 @@
<?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\MVC\Model\AdminModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Table\Table;
use Joomla\CMS\Application\ApplicationHelper;
jimport('joomla.application.component.modeladmin');
class PhocaGalleryCpModelPhocaGalleryCo extends AdminModel
{
protected $option = 'com_phocagallery';
protected $text_prefix = 'com_phocagallery';
public $typeAlias = 'com_phocagallery.phocagalleryco';
protected function canDelete($record)
{
$user = Factory::getUser();
if (!empty($record->catid)) {
return $user->authorise('core.delete', 'com_phocagallery.phocagalleryco.'.(int) $record->catid);
} else {
return parent::canDelete($record);
}
}
protected function canEditState($record)
{
$user = Factory::getUser();
if (!empty($record->catid)) {
return $user->authorise('core.edit.state', 'com_phocagallery.phocagalleryco.'.(int) $record->catid);
} else {
return parent::canEditState($record);
}
}
public function getTable($type = 'PhocaGalleryComments', $prefix = 'Table', $config = array())
{
return Table::getInstance($type, $prefix, $config);
}
public function getForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_phocagallery.phocagalleryco', 'phocagalleryco', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form)) {
return false;
}
// Determine correct permissions to check.
if ($this->getState('phocagalleryco.id')) {
// Existing record. Can only edit in selected categories.
$form->setFieldAttribute('catid', 'action', 'core.edit');
} else {
// New record. Can only create in selected categories.
$form->setFieldAttribute('catid', 'action', 'core.create');
}
return $form;
}
protected function loadFormData()
{
// Check the session for previously entered form data.
$data = Factory::getApplication()->getUserState('com_phocagallery.edit.phocagalleryco.data', array());
if (empty($data)) {
$data = $this->getItem();
}
return $data;
}
protected function getReorderConditions($table = null)
{
$condition = array();
$condition[] = 'catid = '.(int) $table->catid;
return $condition;
}
protected function prepareTable($table)
{
jimport('joomla.filter.output');
$date = Factory::getDate();
$user = Factory::getUser();
$table->title = htmlspecialchars_decode($table->title, ENT_QUOTES);
$table->alias =ApplicationHelper::stringURLSafe($table->alias);
if (empty($table->alias)) {
$table->alias =ApplicationHelper::stringURLSafe($table->title);
}
if(intval($table->date) == 0) {
$table->date = Factory::getDate()->toSql();
}
if (empty($table->id)) {
// Set the values
//$table->created = $date->toSql();
// Set ordering to the last item if not set
if (empty($table->ordering)) {
$db = Factory::getDbo();
$db->setQuery('SELECT MAX(ordering) FROM #__phocagallery_comments WHERE catid = '.(int) $table->catid);
$max = $db->loadResult();
$table->ordering = $max+1;
}
}
else {
// Set the values
//$table->modified = $date->toSql();
//$table->modified_by = $user->get('id');
}
}
}
?>

View File

@ -0,0 +1,128 @@
<?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\MVC\Model\AdminModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Table\Table;
use Joomla\CMS\Application\ApplicationHelper;
jimport('joomla.application.component.modeladmin');
class PhocaGalleryCpModelPhocaGalleryCoImg extends AdminModel
{
protected $option = 'com_phocagallery';
protected $text_prefix = 'com_phocagallery';
public $typeAlias = 'com_phocagallery.phocagallerycoimg';
protected function canDelete($record)
{
$user = Factory::getUser();
if ($record->imgid) {
return $user->authorise('core.delete', 'com_phocagallery.phocagallerycoimg.'.(int) $record->imgid);
} else {
return parent::canDelete($record);
}
}
protected function canEditState($record)
{
$user = Factory::getUser();
if ($record->imgid) {
return $user->authorise('core.edit.state', 'com_phocagallery.phocagallerycoimg.'.(int) $record->imgid);
} else {
return parent::canEditState($record);
}
}
public function getTable($type = 'PhocaGallerycommentImgs', $prefix = 'Table', $config = array())
{
return Table::getInstance($type, $prefix, $config);
}
public function getForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_phocagallery.phocagallerycoimg', 'phocagallerycoimg', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form)) {
return false;
}
// Determine correct permissions to check.
if ($this->getState('phocagallerycoimg.id')) {
// Existing record. Can only edit in selected categories.
$form->setFieldAttribute('catid', 'action', 'core.edit');
} else {
// New record. Can only create in selected categories.
$form->setFieldAttribute('catid', 'action', 'core.create');
}
return $form;
}
protected function loadFormData()
{
// Check the session for previously entered form data.
$data = Factory::getApplication()->getUserState('com_phocagallery.edit.phocagallerycoimg.data', array());
if (empty($data)) {
$data = $this->getItem();
}
return $data;
}
protected function getReorderConditions($table = null)
{
$condition = array();
$condition[] = 'image_id = '.(int) $table->image_id;
return $condition;
}
protected function prepareTable($table)
{
jimport('joomla.filter.output');
$date = Factory::getDate();
$user = Factory::getUser();
$table->title = htmlspecialchars_decode($table->title, ENT_QUOTES);
$table->alias =ApplicationHelper::stringURLSafe($table->alias);
if (empty($table->alias)) {
$table->alias =ApplicationHelper::stringURLSafe($table->title);
}
if(intval($table->date) == 0) {
$table->date = Factory::getDate()->toSql();
}
if (empty($table->id)) {
// Set the values
//$table->created = $date->toSql();
// Set ordering to the last item if not set
if (empty($table->ordering)) {
$db = Factory::getDbo();
$db->setQuery('SELECT MAX(ordering) FROM #__phocagallery_img_comments WHERE imgid = '.(int) $table->imgid);
$max = $db->loadResult();
$table->ordering = $max+1;
}
}
else {
// Set the values
//$table->modified = $date->toSql();
//$table->modified_by = $user->get('id');
}
}
}
?>

View File

@ -0,0 +1,192 @@
<?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\MVC\Model\ListModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Component\ComponentHelper;
jimport('joomla.application.component.modellist');
class PhocaGalleryCpModelPhocaGalleryCoImgs extends ListModel
{
protected $option = 'com_phocagallery';
//public $context = 'com_phocagallery.phocagallerycoimgs';
public function __construct($config = array())
{
if (empty($config['filter_fields'])) {
$config['filter_fields'] = array(
'id', 'a.id',
'title', 'a.title',
'username','ua.username',
'date', 'a.date',
'alias', 'a.alias',
'checked_out', 'a.checked_out',
'checked_out_time', 'a.checked_out_time',
'category_id', 'category_id',
'state', 'a.state',
'access', 'a.access', 'access_level',
'ordering', 'a.ordering',
'language', 'a.language',
'hits', 'a.hits',
'published','a.published',
'image_title', 'image_title',
'category_title', 'category_title'
);
}
parent::__construct($config);
}
protected function populateState($ordering = 'a.title', $direction = 'ASC')
{
// Initialise variables.
$app = Factory::getApplication('administrator');
// Load the filter state.
$search = $app->getUserStateFromRequest($this->context.'.filter.search', 'filter_search');
$this->setState('filter.search', $search);
/*
$accessId = $app->getUserStateFromRequest($this->context.'.filter.access', 'filter_access', null, 'int');
$this->setState('filter.access', $accessId);
*/
$state = $app->getUserStateFromRequest($this->context.'.filter.published', 'filter_published', '', 'string');
$this->setState('filter.published', $state);
$categoryId = $app->getUserStateFromRequest($this->context.'.filter.category_id', 'filter_category_id', null);
$this->setState('filter.category_id', $categoryId);
$language = $app->getUserStateFromRequest($this->context.'.filter.language', 'filter_language', '');
$this->setState('filter.language', $language);
// Load the parameters.
$params = ComponentHelper::getParams('com_phocagallery');
$this->setState('params', $params);
// List state information.
parent::populateState($ordering, $direction);
}
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':'.$this->getState('filter.search');
//$id .= ':'.$this->getState('filter.access');
$id .= ':'.$this->getState('filter.published');
$id .= ':'.$this->getState('filter.category_id');
$id .= ':'.$this->getState('filter.image_id');
return parent::getStoreId($id);
}
protected function getListQuery()
{
/*
$query = ' SELECT a.*, i.title AS imgtitle, i.id AS imageid, c.id AS catid, c.title AS cattitle, ua.name AS editor, u.id AS commentuserid, u.username AS commentusername '
. ' FROM #__phocagallery_img_comments AS a '
. ' LEFT JOIN #__phocagallery AS i ON i.id = a.imgid '
. ' LEFT JOIN #__phocagallery_categories AS c ON c.id = i.catid '
. ' LEFT JOIN #__users AS ua ON ua.id = a.checked_out '
. ' LEFT JOIN #__users AS u ON u.id = a.userid'
. $where
. ' GROUP by a.id'
. $orderby
*/
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
// Select the required fields from the table.
$query->select(
$this->getState(
'list.select',
'a.*'
)
);
$query->from('`#__phocagallery_img_comments` AS a');
// Join over the language
$query->select('l.title AS language_title');
$query->join('LEFT', '`#__languages` AS l ON l.lang_code = a.language');
// Join over the users for the checked out user.
$query->select('ua.id AS commentuserid, ua.username AS commentusername, ua.name AS commentname');
$query->join('LEFT', '#__users AS ua ON ua.id=a.userid');
$query->select('uc.name AS editor');
$query->join('LEFT', '#__users AS uc ON uc.id=a.checked_out');
$query->select('i.title AS image_title, i.id AS image_id');
$query->join('LEFT', '#__phocagallery AS i ON i.id = a.imgid');
/* // Join over the asset groups.
$query->select('ag.title AS access_level');
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
*/
// Join over the categories.
$query->select('c.title AS category_title, c.id AS category_id');
$query->join('LEFT', '#__phocagallery_categories AS c ON c.id = i.catid');
// Filter by access level.
/* if ($access = $this->getState('filter.access')) {
$query->where('a.access = '.(int) $access);
}*/
// Filter by published state.
$published = $this->getState('filter.published');
if (is_numeric($published)) {
$query->where('a.published = '.(int) $published);
}
else if ($published === '') {
$query->where('(a.published IN (0, 1))');
}
// Filter by category.
$categoryId = $this->getState('filter.category_id');
if (is_numeric($categoryId)) {
$query->where('i.catid = ' . (int) $categoryId);
}
// Filter by search in title
$search = $this->getState('filter.search');
if (!empty($search))
{
if (stripos($search, 'id:') === 0) {
$query->where('a.id = '.(int) substr($search, 3));
}
else
{
$search = $db->Quote('%'.$db->escape($search, true).'%');
$query->where('( a.title LIKE '.$search.' OR a.comment LIKE '.$search.')');
}
}
// $query->group('a.id');
// Add the list ordering clause.
$orderCol = $this->state->get('list.ordering');
$orderDirn = $this->state->get('list.direction');
/*if ($orderCol == 'a.ordering' || $orderCol == 'image_title') {
$orderCol = 'image_title '.$orderDirn.', a.ordering';
}*/
$query->order($db->escape($orderCol.' '.$orderDirn));
return $query;
}
}
?>

View File

@ -0,0 +1,182 @@
<?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\MVC\Model\ListModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Component\ComponentHelper;
jimport('joomla.application.component.modellist');
class PhocaGalleryCpModelPhocaGalleryCos extends ListModel
{
protected $option = 'com_phocagallery';
//public $context = 'com_phocagallery.phocagallerycos';
public function __construct($config = array())
{
if (empty($config['filter_fields'])) {
$config['filter_fields'] = array(
'id', 'a.id',
'title', 'a.title',
'username','ua.username',
'date', 'a.date',
'alias', 'a.alias',
'checked_out', 'a.checked_out',
'checked_out_time', 'a.checked_out_time',
'category_id', 'category_id',
'state', 'a.state',
'access', 'a.access', 'access_level',
'ordering', 'a.ordering',
'language', 'a.language',
'hits', 'a.hits',
'published','a.published',
'category_title', 'category_title'
);
}
parent::__construct($config);
}
protected function populateState($ordering = 'a.title', $direction = 'ASC')
{
// Initialise variables.
$app = Factory::getApplication('administrator');
// Load the filter state.
$search = $app->getUserStateFromRequest($this->context.'.filter.search', 'filter_search');
$this->setState('filter.search', $search);
/*
$accessId = $app->getUserStateFromRequest($this->context.'.filter.access', 'filter_access', null, 'int');
$this->setState('filter.access', $accessId);
*/
$state = $app->getUserStateFromRequest($this->context.'.filter.published', 'filter_published', '', 'string');
$this->setState('filter.published', $state);
$categoryId = $app->getUserStateFromRequest($this->context.'.filter.category_id', 'filter_category_id', null);
$this->setState('filter.category_id', $categoryId);
$language = $app->getUserStateFromRequest($this->context.'.filter.language', 'filter_language', '');
$this->setState('filter.language', $language);
// Load the parameters.
$params = ComponentHelper::getParams('com_phocagallery');
$this->setState('params', $params);
// List state information.
parent::populateState($ordering, $direction);
}
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':'.$this->getState('filter.search');
//$id .= ':'.$this->getState('filter.access');
$id .= ':'.$this->getState('filter.published');
$id .= ':'.$this->getState('filter.category_id');
$id .= ':'.$this->getState('filter.image_id');
return parent::getStoreId($id);
}
protected function getListQuery()
{
/*
$query = ' SELECT a.*, cc.title AS category, ua.name AS editor, u.id AS commentuserid, u.username AS commentusername '
. ' FROM #__phocagallery_comments AS a '
. ' LEFT JOIN #__phocagallery_categories AS cc ON cc.id = a.catid '
. ' LEFT JOIN #__users AS ua ON ua.id = a.checked_out '
. ' LEFT JOIN #__users AS u ON u.id = a.userid'
. $where
. ' GROUP by a.id'
. $orderby
;
*/
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
// Select the required fields from the table.
$query->select(
$this->getState(
'list.select',
'a.*'
)
);
$query->from('`#__phocagallery_comments` AS a');
// Join over the language
$query->select('l.title AS language_title');
$query->join('LEFT', '`#__languages` AS l ON l.lang_code = a.language');
// Join over the users for the checked out user.
$query->select('ua.id AS commentuserid, ua.username AS commentusername, ua.name AS commentname');
$query->join('LEFT', '#__users AS ua ON ua.id=a.userid');
$query->select('uc.name AS editor');
$query->join('LEFT', '#__users AS uc ON uc.id=a.checked_out');
/* // Join over the asset groups.
$query->select('ag.title AS access_level');
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
*/
// Join over the categories.
$query->select('c.title AS category_title, c.id AS category_id');
$query->join('LEFT', '#__phocagallery_categories AS c ON c.id = a.catid');
// Filter by access level.
/* if ($access = $this->getState('filter.access')) {
$query->where('a.access = '.(int) $access);
}*/
// Filter by published state.
$published = $this->getState('filter.published');
if (is_numeric($published)) {
$query->where('a.published = '.(int) $published);
}
else if ($published === '') {
$query->where('(a.published IN (0, 1))');
}
// Filter by category.
$categoryId = $this->getState('filter.category_id');
if (is_numeric($categoryId)) {
$query->where('a.catid = ' . (int) $categoryId);
}
// Filter by search in title
$search = $this->getState('filter.search');
if (!empty($search))
{
if (stripos($search, 'id:') === 0) {
$query->where('a.id = '.(int) substr($search, 3));
}
else
{
$search = $db->Quote('%'.$db->escape($search, true).'%');
$query->where('( a.title LIKE '.$search.' OR a.comment LIKE '.$search.')');
}
}
// $query->group('a.id');
// Add the list ordering clause.
$orderCol = $this->state->get('list.ordering');
$orderDirn = $this->state->get('list.direction');
/*if ($orderCol == 'a.ordering' || $orderCol == 'category_title') {
$orderCol = 'category_title '.$orderDirn.', a.ordering';
}*/
$query->order($db->escape($orderCol.' '.$orderDirn));
return $query;
}
}
?>

View File

@ -0,0 +1,363 @@
<?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\MVC\Model\ListModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Component\ComponentHelper;
jimport('joomla.application.component.modellist');
class PhocaGalleryCpModelPhocaGalleryCs extends ListModel
{
protected $option = 'com_phocagallery';
protected $total = 0;
//public $context = 'com_phocagallery.phocagallerycoimgs';
public function __construct($config = array())
{
if (empty($config['filter_fields'])) {
$config['filter_fields'] = array(
'id', 'a.id',
'title', 'a.title',
'alias', 'a.alias',
'checked_out', 'a.checked_out',
'checked_out_time', 'a.checked_out_time',
'category_id', 'category_id',
'state', 'a.state',
'access', 'a.access', 'access_level',
'ordering', 'a.ordering',
'language', 'a.language',
'hits', 'a.hits',
'ratingavg', 'ratingavg',
'published','a.published',
'autorized', 'a.approved',
'owner_id','a.owner_id',
'parentcat_title', 'parentcat_title',
'level', 'level'
);
}
parent::__construct($config);
}
protected function populateState($ordering = 'a.title', $direction = 'ASC')
{
// Initialise variables.
$app = Factory::getApplication('administrator');
// Load the filter state.
$search = $app->getUserStateFromRequest($this->context.'.filter.search', 'filter_search');
$this->setState('filter.search', $search);
$accessId = $app->getUserStateFromRequest($this->context.'.filter.access', 'filter_access', null, 'int');
$this->setState('filter.access', $accessId);
$state = $app->getUserStateFromRequest($this->context.'.filter.published', 'filter_published', '', 'string');
$this->setState('filter.published', $state);
$categoryId = $app->getUserStateFromRequest($this->context.'.filter.parent_id', 'filter_parent_id', null);
$this->setState('filter.parent_id', $categoryId);
$language = $app->getUserStateFromRequest($this->context.'.filter.language', 'filter_language', '');
$this->setState('filter.language', $language);
// Not used in SQL - used in view in recursive category tree function
$levels = $app->getUserStateFromRequest($this->context.'.filter.level', 'filter_level', '', 'string');
$this->setState('filter.level', $levels);
// Load the parameters.
$params = ComponentHelper::getParams('com_phocagallery');
$this->setState('params', $params);
// List state information.
parent::populateState($ordering, $direction);
}
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':'.$this->getState('filter.search');
$id .= ':'.$this->getState('filter.access');
$id .= ':'.$this->getState('filter.published');
$id .= ':'.$this->getState('filter.category_id');
$id .= ':'.$this->getState('filter.image_id');
$id .= ':'.$this->getState('filter.level');
return parent::getStoreId($id);
}
/*
* Because of tree we need to load all the items
*
* We need to load all items because of creating tree
* After creating tree we get info from pagination
* and will set displaying of categories for current pagination
* E.g. pagination is limitstart 5, limit 5 - so only categories from 5 to 10 will be displayed (in Default.php)
*/
public function getItems()
{
// Get a storage key.
$store = $this->getStoreId();
// Try to load the data from internal storage.
if (!empty($this->cache[$store])) {
return $this->cache[$store];
}
// Load the list items.
$query = $this->getListQuery();
//$items = $this->_getList($query, $this->getState('list.start'), $this->getState('list.limit'));
$items = $this->_getList($query);
// Check for a database error.
/*if ($this->_db->getErrorNum()) {
$this->setError($this->_db->getErrorMsg());
return false;
}*/
// Add the items to the internal cache.
$this->cache[$store] = $items;
return $this->cache[$store];
}
protected function getListQuery()
{
/*
$query = ' SELECT a.*, cc.title AS parentname, u.name AS editor, v.average AS ratingavg, ua.username AS usercatname, c.countid AS countid, ag.title AS access_level'
. ' FROM #__phocagallery_categories AS a '
. ' LEFT JOIN #__users AS u ON u.id = a.checked_out '
. ' LEFT JOIN #__viewlevels AS ag ON ag.id = a.access '
. ' LEFT JOIN #__phocagallery_categories AS cc ON cc.id = a.parent_id'
. ' LEFT JOIN #__phocagallery_votes_statistics AS v ON v.catid = a.id'
. ' LEFT JOIN #__users AS ua ON ua.id = a.owner_id'
. ' JOIN (SELECT c.parent_id, count(*) AS countid'
. ' FROM #__phocagallery_categories AS c'
.' GROUP BY c.parent_id ) AS c'
.' ON a.parent_id = c.parent_id'
. $where
. $orderby;
*/
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
// Select the required fields from the table.
$query->select(
$this->getState(
'list.select',
'a.id, a.title, a.name, a.parent_id, a.owner_id, a.alias, a.access, a.ordering, a.count, a.params, a.accessuserid, a.uploaduserid, a.deleteuserid, a.userfolder, a.latitude, a.longitude, a.image, a.section, a.image_position, a.checked_out_time, a.checked_out, a.hits, a.approved, a.zoom, a.geotitle, a.description, a.published, a.language'
)
);
$query->from('`#__phocagallery_categories` AS a');
// Join over the language
$query->select('l.title AS language_title');
$query->join('LEFT', '`#__languages` AS l ON l.lang_code = a.language');
// Join over the users for the checked out user.
$query->select('uc.name AS editor');
$query->join('LEFT', '#__users AS uc ON uc.id=a.checked_out');
// Join over the asset groups.
$query->select('ag.title AS access_level');
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
// Join over the categories.
$query->select('c.title AS parentcat_title, c.id AS parentcat_id');
$query->join('LEFT', '#__phocagallery_categories AS c ON c.id = a.parent_id');
$query->select('ua.id AS userid, ua.username AS username, ua.name AS usernameno');
$query->join('LEFT', '#__users AS ua ON ua.id = a.owner_id');
$query->select('v.average AS ratingavg');
$query->join('LEFT', '#__phocagallery_votes_statistics AS v ON v.catid = a.id');
$query->select('cc.countid AS countid');
$query->join('LEFT', '(SELECT cc.parent_id, count(cc.id) AS countid'
. ' FROM #__phocagallery_categories AS cc'
.' GROUP BY cc.parent_id, cc.id ) AS cc'
.' ON a.parent_id = cc.parent_id');
// Filter by access level.
if ($access = $this->getState('filter.access')) {
$query->where('a.access = '.(int) $access);
}
// Filter by published state.
$published = $this->getState('filter.published');
if (is_numeric($published)) {
$query->where('a.published = '.(int) $published);
}
else if ($published === '') {
$query->where('(a.published IN (0, 1))');
}
// Filter by category.
$categoryId = $this->getState('filter.parent_id');
if (is_numeric($categoryId)) {
$query->where('a.parent_id = ' . (int) $categoryId);
}
// Filter by search in title
/*$search = $this->getState('filter.search');
if (!empty($search))
{
if (stripos($search, 'id:') === 0) {
$query->where('a.id = '.(int) substr($search, 3));
}
else
{
$search = $db->Quote('%'.$db->escape($search, true).'%');
// PHOCAEDIT - search parent categories of searched categories - so we can build whole tree
// Find all parent categories of searched category:
$searchParentCatString = $this->getParentCategoriesOfSearch($search);
$query->where('( a.title LIKE '.$search.' OR a.alias LIKE '.$search.' OR c.alias LIKE '.$search.' OR c.alias LIKE '.$search. $searchParentCatString.')');
// 3 places changed:
// 1) here
// 2) the function below getParentCategoriesOfSearch
// 3) view cca line 48 - filter the categories and remove parents and remake the pagination
// END PHOCAEDIT
//$query->where('( a.title LIKE '.$search.' OR a.alias LIKE '.$search.' OR c.alias LIKE '.$search.' OR c.alias LIKE '.$search.')');
}
}*/
// Filter by search in title
$search = $this->getState('filter.search');
if (!empty($search))
{
if (stripos($search, 'id:') === 0) {
$query->where('a.id = '.(int) substr($search, 3));
}
else
{
$search = $db->Quote('%'.$db->escape($search, true).'%');
$query->where('( a.title LIKE '.$search.' OR a.alias LIKE '.$search.')');
}
}
// Filter on the language.
if ($language = $this->getState('filter.language')) {
$query->where('a.language = ' . $db->quote($language));
}
$query->group('a.id, a.parent_id, a.owner_id, a.image_id, a.title, a.name, l.title, uc.name, ag.title, c.id, c.title, ua.id, ua.username, ua.name, v.average, cc.countid, a.alias, a.access, a.ordering, a.count, a.params, a.accessuserid, a.uploaduserid, a.deleteuserid, a.userfolder, a.latitude, a.longitude, a.image, a.section, a.image_position, a.checked_out, a.checked_out_time, a.hits, a.approved, a.zoom, a.geotitle, a.description, a.published, a.language');
// Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'title');
$orderDirn = $this->state->get('list.direction', 'asc');
/* if ($orderCol == 'a.ordering' || $orderCol == 'parentcat_title') {
$orderCol = 'parentcat_title '.$orderDirn.', a.ordering';
}
*/
$query->order($db->escape($orderCol.' '.$orderDirn));
//echo nl2br(str_replace('#__', 'jos_', $query->__toString()));
return $query;
}
protected function getParentCategoriesOfSearch($search = '', $string = '', $parentId = 0) {
$db = $this->getDbo();
// Search the parent category by string
// But we must continue to whole tree to parent_id = 0, means to the root of category tree
// So if we stop with searched string, we need to go further with parentid until we reach 0
$s = false;
if ($parentId > 0) {
$q = 'SELECT a.id, a.parent_id FROM #__phocagallery_categories AS a WHERE a.id = '.(int)$parentId;
$db->setQuery($q);
$s = $db->loadObjectList();
} else if ($search != '') {
$q = 'SELECT a.id, a.parent_id FROM #__phocagallery_categories AS a WHERE ( a.title LIKE '.$search.' OR a.alias LIKE '.$search.')';
$db->setQuery($q);
$s = $db->loadObjectList();
}
// Try to add parent categories to search outcomes
if (!empty($s)) {
foreach ($s as $k => $v) {
if ($v->parent_id > 0) {
$string .= ' OR a.id = '.(int)$v->parent_id;
$string = $this->getParentCategoriesOfSearch($search, $string, $v->parent_id);
}
}
}
return $string;
}
function getNotApprovedCategory() {
$query = 'SELECT COUNT(a.id) AS count'
.' FROM #__phocagallery_categories AS a'
.' WHERE approved = 0';
$this->_db->setQuery($query, 0, 1);
$countNotApproved = $this->_db->loadObject();
return $countNotApproved;
}
public function getTotal() {
$store = $this->getStoreId('getTotal');
if (isset($this->cache[$store])) {
return $this->cache[$store];
}
// PHOCAEDIT
if (isset($this->total) && (int)$this->total > 0) {
$total = (int)$this->total;
} else {
$query = $this->_getListQuery();
try {
$total = (int) $this->_getListCount($query);
}
catch (RuntimeException $e) {
$this->setError($e->getMessage());
return false;
}
}
$this->cache[$store] = $total;
return $this->cache[$store];
}
public function setTotal($total) {
// When we use new total and new pagination, we need to clean their cache
$store1 = $this->getStoreId('getTotal');
$store2 = $this->getStoreId('getStart');
$store3 = $this->getStoreId('getPagination');
unset($this->cache[$store1]);
unset($this->cache[$store2]);
unset($this->cache[$store3]);
$this->total = (int)$total;
}
}
?>

View File

@ -0,0 +1,82 @@
<?php
/*
* @package Joomla
* @copyright Copyright (C) 2005 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\MVC\Model\BaseDatabaseModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Object\CMSObject;
jimport('joomla.application.component.model');
class PhocaGalleryCpModelPhocaGalleryD extends BaseDatabaseModel
{
protected $id;
protected $data;
public function __construct() {
parent::__construct();
$id = Factory::getApplication()->input->get('id', 0, '', 'int');
$this->setId((int)$id);
}
protected function setId($id) {
$this->id = $id;
$this->data = null;
}
public function getData() {
if (!$this->loadData()) {
$this->initData();
}
return $this->data;
}
function loadData() {
if (empty($this->data)) {
$query = 'SELECT a.*' .
' FROM #__phocagallery AS a' .
' WHERE a.id = '.(int) $this->id;
$this->_db->setQuery($query);
$fileObject = $this->_db->loadObject();
$file = new CMSObject();
$refresh_url = 'index.php?option=com_phocagallery&view=phocagalleryd&tmpl=component&id='.(int)$this->id;
//Creata thumbnails if not exist
PhocaGalleryFileThumbnail::getOrCreateThumbnail($fileObject->filename, $refresh_url, 1, 1, 1);
jimport( 'joomla.filesystem.file' );
if (!isset($fileObject->filename)) {
$file->set('linkthumbnailpath', '');
} else {
$thumbFile = PhocaGalleryFileThumbnail::getThumbnailName ($fileObject->filename, 'large');
$file->set('linkthumbnailpath', $thumbFile->rel);
$file->set('extid', $fileObject->extid);
$file->set('extl', $fileObject->extl);
$file->set('extw', $fileObject->extw);
$file->set('exth', $fileObject->exth);
}
$this->data = $file;
return (boolean) $this->data;
}
return true;
}
protected function initData() {
if (empty($this->data)) {
$this->data = '';
return (boolean) $this->data;
}
return true;
}
}
?>

View File

@ -0,0 +1,288 @@
<?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\MVC\Model\AdminModel;
use Joomla\CMS\Table\Table;
use Joomla\CMS\Factory;
use Joomla\CMS\Application\ApplicationHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Client\ClientHelper;
use Joomla\CMS\Filesystem\Path;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Log\Log;
jimport('joomla.application.component.modeladmin');
class PhocaGalleryCpModelPhocaGalleryEf extends AdminModel
{
protected $option = 'com_phocagallery';
protected $text_prefix = 'com_phocagallery';
public $typeAlias = 'com_phocagallery.phocagalleryef';
protected function canDelete($record)
{
//$user = JFactory::getUser();
return parent::canDelete($record);
}
protected function canEditState($record)
{
//$user = JFactory::getUser();
return parent::canEditState($record);
}
public function getTable($type = 'PhocaGalleryEf', $prefix = 'Table', $config = array())
{
return Table::getInstance($type, $prefix, $config);
}
public function getForm($data = array(), $loadData = true) {
$app = Factory::getApplication();
$form = $this->loadForm('com_phocagallery.phocagallerystyles', 'phocagalleryef', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form)) {
return false;
}
return $form;
}
protected function loadFormData()
{
// Check the session for previously entered form data.
$data = Factory::getApplication()->getUserState('com_phocagallery.edit.phocagallerystyles.data', array());
if (empty($data)) {
$data = $this->getItem();
}
return $data;
}
protected function prepareTable($table)
{
jimport('joomla.filter.output');
$date = Factory::getDate();
$user = Factory::getUser();
$table->title = htmlspecialchars_decode($table->title, ENT_QUOTES);
$table->alias =ApplicationHelper::stringURLSafe($table->alias);
if (empty($table->alias)) {
$table->alias =ApplicationHelper::stringURLSafe($table->title);
}
if (empty($table->id)) {
// Set the values
//$table->created = $date->toSql();
// Set ordering to the last item if not set
if (empty($table->ordering)) {
$db = Factory::getDbo();
$db->setQuery('SELECT MAX(ordering) FROM #__phocagallery_styles WHERE type = '.(int)$table->type);
$max = $db->loadResult();
$table->ordering = $max+1;
}
}
else {
// Set the values
//$table->modified = $date->toSql();
//$table->modified_by = $user->get('id');
}
}
protected function getReorderConditions($table = null)
{
$condition = array();
$condition[] = 'type = '. (int) $table->type;
//$condition[] = 'state >= 0';
return $condition;
}
public function increaseOrdering($categoryId) {
$ordering = 1;
$this->_db->setQuery('SELECT MAX(ordering) FROM #__phocagallery_styles WHERE type='.(int)$categoryId);
$max = $this->_db->loadResult();
$ordering = $max + 1;
return $ordering;
}
public function &getSource($id, $filename, $type) {
$item = new stdClass;
$filePath = PhocaGalleryFile::existsCSS($filename, $type);
if ($filePath) {
//$item->id = $id;
//$item->type = $type;
//$item->filname = $filename;
$item->source = file_get_contents($filePath);
} else {
$this->setError(Text::_('COM_PHOCAGALLERY_FILE_DOES_NOT_EXIST'));
}
return $item;
}
public function save($data) {
jimport('joomla.filesystem.file');
// New
if ($data['id'] < 1) {
$data['type'] = 2;// Custom in every case
if ($data['title'] != '') {
$filename =ApplicationHelper::stringURLSafe($data['title']);
if (trim(str_replace('-','',$filename)) == '') {
$filename = Factory::getDate()->format("Y-m-d-H-i-s");
}
} else {
$filename = Factory::getDate()->format("Y-m-d-H-i-s");
}
$filename = $filename . '.css';
$data['filename'] = $filename;
$filePath = PhocaGalleryFile::existsCSS($filename, $data['type']);
if ($filePath) {
$this->setError(Text::sprintf('COM_PHOCAGALLERY_FILE_ALREADY_EXISTS', $fileName));
return false;
} else {
$filePath = PhocaGalleryFile::getCSSPath($data['type']) . $filename;
}
} else {
$filename = PhocaGalleryFile::getCSSFile($data['id']);
$filePath = PhocaGalleryFile::existsCSS($filename, $data['type']);
}
//$dispatcher = J EventDispatcher::getInstance();
$fileName = $filename;
// Include the extension plugins for the save events.
//JPluginHelper::importPlugin('extension');
// Set FTP credentials, if given.
ClientHelper::setCredentialsFromRequest('ftp');
$ftp = ClientHelper::getCredentials('ftp');
// Try to make the template file writeable.
if (!$ftp['enabled'] && Path::isOwner($filePath) && !Path::setPermissions($filePath, '0644')) {
$this->setError(Text::_('COM_PHOCAGALLERY_ERROR_SOURCE_FILE_NOT_WRITABLE'));
return false;
}
// Trigger the onExtensionBeforeSave event.
/*$result = $dispatcher->trigger('onExtensionBeforeSave', array('com_phocagallery.source', &$data, false));
if (in_array(false, $result, true)) {
$this->setError($table->getError());
return false;
}*/
$return = File::write($filePath, $data['source']);
// Try to make the template file unwriteable.
/*if (!$ftp['enabled'] && JPath::isOwner($filePath) && !JPath::setPermissions($filePath, '0444')) {
$this->setError(Text::_('COM_PHOCAGALLERY_ERROR_SOURCE_FILE_NOT_UNWRITABLE'));
return false;
} else*/
if (!$return) {
$this->setError(Text::sprintf('COM_PHOCAGALLERY_ERROR_FAILED_TO_SAVE_FILENAME', $fileName));
return false;
}
// Trigger the onExtensionAfterSave event.
//$dispatcher->trigger('onExtensionAfterSave', array('com_templates.source', &$table, false));
//return true;
return parent::save($data);
}
public function delete(&$pks)
{
//$dispatcher = J EventDispatcher::getInstance();
$pks = (array) $pks;
$table = $this->getTable();
// Include the content plugins for the on delete events.
PluginHelper::importPlugin('content');
// Iterate the items to delete each one.
foreach ($pks as $i => $pk)
{
if ($table->load($pk))
{
if ($this->canDelete($table))
{
$context = $this->option . '.' . $this->name;
// Trigger the onContentBeforeDelete event.
$result = Factory::getApplication()->triggerEvent($this->event_before_delete, array($context, $table));
if (in_array(false, $result, true))
{
$this->setError($table->getError());
return false;
}
//PHOCAEDIT
$filePath = PhocaGalleryFile::getCSSFile($pk, true);
//END PHOCAEDIT
if (!$table->delete($pk))
{
$this->setError($table->getError());
return false;
}
//PHOCAEDIT
if (file_exists($filePath)) {
File::delete($filePath);
}
//END PHOCAEDIT
// Trigger the onContentAfterDelete event.
Factory::getApplication()->triggerEvent($this->event_after_delete, array($context, $table));
}
else
{
// Prune items that you can't change.
unset($pks[$i]);
$error = $this->getError();
if ($error)
{
Log::add($error, Log::WARNING, ' ');
return false;
}
else
{
Log::add(Text::_('JLIB_APPLICATION_ERROR_DELETE_NOT_PERMITTED'), Log::WARNING, ' ');
return false;
}
}
}
else
{
$this->setError($table->getError());
return false;
}
}
// Clear the component's cache
$this->cleanCache();
return true;
}
}
?>

View File

@ -0,0 +1,259 @@
<?php
/*
* @package Joomla.Framework
* @copyright Copyright (C) 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\MVC\Model\ListModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Filesystem\Path;
use Joomla\CMS\Filesystem\Folder;
use Joomla\CMS\Language\Text;
jimport( 'joomla.application.component.modellist' );
jimport( 'joomla.filesystem.folder' );
jimport( 'joomla.filesystem.file' );
phocagalleryimport( 'phocagallery.file.filefolder' );
class PhocaGalleryCpModelPhocaGalleryEfs extends ListModel
{
protected $option = 'com_phocagallery';
public function __construct($config = array())
{
if (empty($config['filter_fields'])) {
$config['filter_fields'] = array(
'id', 'a.id',
'title', 'a.title',
'alias', 'a.alias',
'checked_out', 'a.checked_out',
'checked_out_time', 'a.checked_out_time',
'type', 'a.type',
'published', 'a.published',
'ordering', 'a.ordering',
'language', 'a.language',
'category_id', 'category_id'
);
}
parent::__construct($config);
}
protected function populateState($ordering = 'a.ordering', $direction = 'ASC')
{
// Initialise variables.
$app = Factory::getApplication('administrator');
// Load the filter state.
$search = $app->getUserStateFromRequest($this->context.'.filter.search', 'filter_search');
$this->setState('filter.search', $search);
/*
$accessId = $app->getUserStateFromRequest($this->context.'.filter.access', 'filter_access', null, 'int');
$this->setState('filter.access', $accessId);
*/
$state = $app->getUserStateFromRequest($this->context.'.filter.published', 'filter_published', '', 'string');
$this->setState('filter.published', $state);
$categoryId = $app->getUserStateFromRequest($this->context.'.filter.category_id', 'filter_category_id', null);
$this->setState('filter.category_id', $categoryId);
$language = $app->getUserStateFromRequest($this->context.'.filter.language', 'filter_language', '');
$this->setState('filter.language', $language);
// Load the parameters.
$params = ComponentHelper::getParams('com_phocagallery');
$this->setState('params', $params);
// List state information.
parent::populateState($ordering, $direction);
}
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':'.$this->getState('filter.search');
$id .= ':'.$this->getState('filter.published');
$id .= ':'.$this->getState('filter.category_id');
return parent::getStoreId($id);
}
protected function getListQuery()
{
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
// Select the required fields from the table.
$query->select(
$this->getState(
'list.select',
'a.*'
)
);
$query->from('`#__phocagallery_styles` AS a');
// Join over the language
$query->select('l.title AS language_title');
$query->join('LEFT', '`#__languages` AS l ON l.lang_code = a.language');
// Join over the users for the checked out user.
$query->select('uc.name AS editor');
$query->join('LEFT', '#__users AS uc ON uc.id=a.checked_out');
// Filter by published state.
$published = $this->getState('filter.published');
if (is_numeric($published)) {
$query->where('a.published = '.(int) $published);
}
else if ($published === '') {
$query->where('(a.published IN (0, 1))');
}
// Filter by category.
$categoryId = $this->getState('filter.category_id');
if (is_numeric($categoryId)) {
$query->where('a.type = ' . (int) $categoryId);
}
// Filter by search in title
$search = $this->getState('filter.search');
if (!empty($search))
{
if (stripos($search, 'id:') === 0) {
$query->where('a.id = '.(int) substr($search, 3));
}
else
{
$search = $db->Quote('%'.$db->escape($search, true).'%');
$query->where('( a.title LIKE '.$search.' OR a.filename LIKE '.$search.')');
}
}
// $query->group('a.id');
// Add the list ordering clause.
$orderCol = $this->state->get('list.ordering');
$orderDirn = $this->state->get('list.direction');
if ($orderCol == 'a.ordering' || $orderCol == 'category_title') {
$orderCol = 'a.type '.$orderDirn.', a.ordering';
}
$query->order($db->escape($orderCol.' '.$orderDirn));
return $query;
}
protected function getItemsCheck() {
$db = Factory::getDBO();
$query = 'SELECT a.id, a.filename, a.type'
.' FROM #__phocagallery_styles AS a';
$db->setQuery($query);
$items = $db->loadObjectList();
return $items;
}
public function checkItems() {
$db = Factory::getDBO();
$files = $this->getFiles();
$items = $this->getItemsCheck();
if (!empty($files)) {
foreach ($files as $fk => $fv) {
if ($fv->exists) {
$exists = 0;
foreach ($items as $ik => $iv) {
if ($fv->filename == $iv->filename && $fv->type == $iv->type){
// we cannot break because there are two types
$exists = 1;
}
}
if ($exists == 0) {
$query = 'SELECT a.ordering'
.' FROM #__phocagallery_styles AS a'
.' WHERE a.type = '.(int) $fv->type;
$db->setQuery($query, 0, 1);
$ordO = $db->loadObject();
if (!isset($ordO->ordering)) {
$ordering = 1;
} else {
$ordering = (int)$ordO->ordering + 1;
}
$title = ucfirst(str_replace('.css', '', htmlspecialchars($fv->filename)));
$published = 1;
$query = 'INSERT into #__phocagallery_styles'
.' (id, title, filename, type, published, ordering, language)'
.' VALUES (null, '. $db->quote($title)
.' , '.$db->quote(htmlspecialchars($fv->filename))
.' , '.(int)$fv->type
.' , '.(int)$published
.' , '.(int)$ordering
.' , '.$db->quote('*')
.')';
$db->setQuery($query);
if (!$db->execute()) {
$this->setError('Database Error - Inserting CSS Style');
return false;
}
}
}
}
}
return true;
}
public function getFiles()
{
$result = array();
jimport('joomla.filesystem.folder');
$paths = PhocaGalleryPath::getPath();
$path = Path::clean($paths->media_css_abs . '/main/');
if (is_dir($path)) {
$files = Folder::files($path, '\.css$', false, false);
foreach ($files as $file) {
$fileO = new stdClass;
$fileO->filename = $file;
$fileO->exists = file_exists($path.$file);
$fileO->type = 1;
$result[] = $fileO;
}
} else {
$this->setError(Text::_('COM_PHOCAGALLERY_ERROR_CSS_FOLDER_NOT_FOUND') . ' (1)');
return false;
}
$path = Path::clean($paths->media_css_abs . '/custom/');
if (is_dir($path)) {
$files = Folder::files($path, '\.css$', false, false);
foreach ($files as $file) {
$fileO = new stdClass;
$fileO->filename = $file;
$fileO->exists = file_exists($path.$file);
$fileO->type = 2;
$result[] = $fileO;
}
} else {
$this->setError(Text::_('COM_PHOCAGALLERY_ERROR_CSS_FOLDER_NOT_FOUND') . ' (2)');
return false;
}
return $result;
}
}
?>

View File

@ -0,0 +1,94 @@
<?php
/*
* @package Joomla
* @copyright Copyright (C) 2005 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\MVC\Model\BaseDatabaseModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Filesystem\Path;
use Joomla\CMS\Filesystem\Folder;
use Joomla\CMS\Object\CMSObject;
jimport('joomla.application.component.model');
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
setlocale(LC_ALL, 'C.UTF-8', 'C');
class PhocaGalleryCpModelPhocaGalleryF extends BaseDatabaseModel
{
function getState($property = NULL, $default = NULL) {
static $set;
if (!$set) {
$folder = Factory::getApplication()->input->get( 'folder', '', '', 'path' );
$upload = Factory::getApplication()->input->get( 'upload', '', '', 'int' );
$this->setState('folder', $folder);
$parent = str_replace("\\", "/", dirname($folder));
$parent = ($parent == '.') ? null : $parent;
$this->setState('parent', $parent);
$set = true;
}
return parent::getState($property);
}
function getFolders() {
$list = $this->getList();
return $list['folders'];
}
function getList() {
static $list;
// Only process the list once per request
if (is_array($list)) {
return $list;
}
// Get current path from request
$current = $this->getState('folder');
// If undefined, set to empty
if ($current == 'undefined') {
$current = '';
}
//Get folder variables from Helper
$path = PhocaGalleryPath::getPath();
// Initialize variables
if (strlen($current) > 0) {
$orig_path = Path::clean($path->image_abs.$current);
} else {
$orig_path = $path->image_abs;
}
$orig_path_server = str_replace('\\', '/', $path->image_abs);
$folders = array ();
// Get the list of files and folders from the given folder
$folder_list = Folder::folders($orig_path, '', false, false, array(0 => 'thumbs'));
// Iterate over the folders if they exist
if ($folder_list !== false) {
foreach ($folder_list as $folder) {
$tmp = new CMSObject();
$tmp->name = basename($folder);
$tmp->path_with_name = str_replace('\\', '/', Path::clean($orig_path . '/'. $folder));
$tmp->path_without_name_relative= $path->image_rel . str_replace($orig_path_server, '', $tmp->path_with_name);
$tmp->path_with_name_relative_no= str_replace($orig_path_server, '', $tmp->path_with_name);
$folders[] = $tmp;
}
}
$list = array('folders' => $folders);
return $list;
}
}
?>

View File

@ -0,0 +1,139 @@
<?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\MVC\Model\AdminModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Table\Table;
use Joomla\CMS\Application\ApplicationHelper;
use Joomla\Registry\Registry;
jimport('joomla.application.component.modeladmin');
class PhocaGalleryCpModelPhocaGalleryFb extends AdminModel
{
protected $option = 'com_phocagallery';
protected $text_prefix = 'com_phocagallery';
public $typeAlias = 'com_phocagallery.phocagalleryfb';
protected function canDelete($record)
{
$user = Factory::getUser();
if ($record->id) {
return $user->authorise('core.delete', 'com_phocagallery.phocagalleryfb.'.(int) $record->id);
} else {
return parent::canDelete($record);
}
}
protected function canEditState($record)
{
$user = Factory::getUser();
if ($record->id) {
return $user->authorise('core.edit.state', 'com_phocagallery.phocagalleryfb.'.(int) $record->id);
} else {
return parent::canEditState($record);
}
}
public function getTable($type = 'PhocaGalleryFbUsers', $prefix = 'Table', $config = array())
{
return Table::getInstance($type, $prefix, $config);
}
public function getForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_phocagallery.phocagalleryfb', 'phocagalleryfb', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form)) {
return false;
}
// Determine correct permissions to check.
if ($this->getState('phocagalleryfb.id')) {
// Existing record. Can only edit in selected categories.
$form->setFieldAttribute( 'id', 'action', 'core.edit');
} else {
// New record. Can only create in selected categories.
$form->setFieldAttribute( 'id', 'action', 'core.create');
}
return $form;
}
protected function loadFormData()
{
// Check the session for previously entered form data.
$data = Factory::getApplication()->getUserState('com_phocagallery.edit.phocagalleryfb.data', array());
if (empty($data)) {
$data = $this->getItem();
}
return $data;
}
/*
protected function getReorderConditions($table = null){
$condition = array();
//$condition[] = 'catid = '.(int) $table->catid;
return $condition;
}*/
protected function prepareTable($table)
{
jimport('joomla.filter.output');
$date = Factory::getDate();
$user = Factory::getUser();
/*$table->title = htmlspecialchars_decode($table->title, ENT_QUOTES);
$table->alias =ApplicationHelper::stringURLSafe($table->alias);
if (empty($table->alias)) {
$table->alias =ApplicationHelper::stringURLSafe($table->title);
}*/
if (empty($table->id)) {
// Set the values
//$table->created = $date->toSql();
// Set ordering to the last item if not set
if (empty($table->ordering)) {
$db = Factory::getDbo();
$db->setQuery('SELECT MAX(ordering) FROM #__phocagallery_fb_users');
$max = $db->loadResult();
$table->ordering = $max+1;
}
}
else {
// Set the values
//$table->modified = $date->toSql();
//$table->modified_by = $user->get('id');
}
}
public function getItem($pk = null)
{
if ($item = parent::getItem($pk)) {
// Convert the params field to an array.
$registry = new Registry;
$registry->loadString($item->comments);
$item->comments = $registry->toArray();
}
return $item;
}
}
?>

View File

@ -0,0 +1,155 @@
<?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\MVC\Model\ListModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Component\ComponentHelper;
jimport('joomla.application.component.modellist');
class PhocaGalleryCpModelPhocaGalleryFbs extends ListModel
{
protected $option = 'com_phocagallery';
//public $context = 'com_phocagallery.phocagallerycos';
public function __construct($config = array())
{
if (empty($config['filter_fields'])) {
$config['filter_fields'] = array(
'id', 'a.id',
'name', 'a.name',
'uid', 'a.uid',
'appid', 'a.appid',
'checked_out', 'a.checked_out',
'checked_out_time', 'a.checked_out_time',
'category_id', 'category_id',
'state', 'a.state',
'access', 'a.access', 'access_level',
'ordering', 'a.ordering',
'language', 'a.language',
'hits', 'a.hits',
'average', 'v.average',
'published','a.published'
);
}
parent::__construct($config);
}
protected function populateState($ordering = 'a.name', $direction = 'ASC')
{
// Initialise variables.
$app = Factory::getApplication('administrator');
// Load the filter state.
$search = $app->getUserStateFromRequest($this->context.'.filter.search', 'filter_search');
$this->setState('filter.search', $search);
/*
$accessId = $app->getUserStateFromRequest($this->context.'.filter.access', 'filter_access', null, 'int');
$this->setState('filter.access', $accessId);
*/
$state = $app->getUserStateFromRequest($this->context.'.filter.published', 'filter_published', '', 'string');
$this->setState('filter.published', $state);
$language = $app->getUserStateFromRequest($this->context.'.filter.language', 'filter_language', '');
$this->setState('filter.language', $language);
// Load the parameters.
$params = ComponentHelper::getParams('com_phocagallery');
$this->setState('params', $params);
// List state information.
parent::populateState($ordering, $direction);
}
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':'.$this->getState('filter.search');
//$id .= ':'.$this->getState('filter.access');
$id .= ':'.$this->getState('filter.published');
$id .= ':'.$this->getState('filter.fb_id');
return parent::getStoreId($id);
}
protected function getListQuery()
{
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
// Select the required fields from the table.
$query->select(
$this->getState(
'list.select',
'a.*'
)
);
$query->from('`#__phocagallery_fb_users` AS a');
// Join over the language
$query->select('l.title AS language_title');
$query->join('LEFT', '`#__languages` AS l ON l.lang_code = a.language');
$query->select('uc.name AS editor');
$query->join('LEFT', '#__users AS uc ON uc.id=a.checked_out');
/* // Join over the asset groups.
$query->select('ag.title AS access_level');
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
*/
// Filter by access level.
/* if ($access = $this->getState('filter.access')) {
$query->where('a.access = '.(int) $access);
}*/
// Filter by published state.
$published = $this->getState('filter.published');
if (is_numeric($published)) {
$query->where('a.published = '.(int) $published);
}
else if ($published === '') {
$query->where('(a.published IN (0, 1))');
}
// Filter by search in title
$search = $this->getState('filter.search');
if (!empty($search))
{
if (stripos($search, 'id:') === 0) {
$query->where('a.id = '.(int) substr($search, 3));
}
else
{
$search = $db->Quote('%'.$db->escape($search, true).'%');
$query->where('( a.name LIKE '.$search.' )');
}
}
// $query->group('a.id');
// Add the list ordering clause.
$orderCol = $this->state->get('list.ordering');
$orderDirn = $this->state->get('list.direction');
$query->order($db->escape($orderCol.' '.$orderDirn));
return $query;
}
}
?>

View File

@ -0,0 +1,58 @@
<?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\MVC\Model\BaseDatabaseModel;
use Joomla\CMS\Factory;
jimport('joomla.application.component.model');
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
phocagalleryimport('phocagallery.file.filefolderlist');
class PhocaGalleryCpModelPhocaGalleryI extends BaseDatabaseModel
{
protected $option = 'com_phocagallery';
protected $text_prefix = 'com_phocagallery';
//public $typeAlias = 'com_phocagallery.phocagalleryi';
function getFolderState($property = null) {
static $set;
if (!$set) {
$folder = Factory::getApplication()->input->get( 'folder', '', '', 'path' );
$this->setState('folder', $folder);
$parent = str_replace("\\", "/", dirname($folder));
$parent = ($parent == '.') ? null : $parent;
$this->setState('parent', $parent);
$set = true;
}
return parent::getState($property);
}
function getImages() {
$tab = Factory::getApplication()->input->get( 'tab', '', '', 'string' );
$muFailed = Factory::getApplication()->input->get( 'mufailed', '0', '', 'int' );
$muUploaded = Factory::getApplication()->input->get( 'muuploaded', '0', '', 'int' );
$refreshUrl = 'index.php?option=com_phocagallery&view=phocagalleryi&tab='.$tab.'&mufailed='.$muFailed.'&muuploaded='.$muUploaded.'&tmpl=component';
$list = PhocaGalleryFileFolderList::getList(0,1,0,$refreshUrl);
return $list['Images'];
}
function getFolders() {
$tab = Factory::getApplication()->input->get( 'tab', 0, '', 'int' );
$refreshUrl = 'index.php?option=com_phocagallery&view=phocagalleryi&tab='.$tab.'&tmpl=component';
$list = PhocaGalleryFileFolderList::getList(0,0,0,$refreshUrl);
return $list['folders'];
}
}
?>

View File

@ -0,0 +1,912 @@
<?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\MVC\Model\AdminModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Table\Table;
use Joomla\Registry\Registry;
use Joomla\CMS\Application\ApplicationHelper;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Log\Log;
jimport('joomla.application.component.modeladmin');
phocagalleryimport('phocagallery.tag.tag');
class PhocaGalleryCpModelPhocaGalleryImg extends AdminModel
{
protected $option = 'com_phocagallery';
protected $text_prefix = 'com_phocagallery';
public $typeAlias = 'com_phocagallery.phocagalleryimg';
protected function canDelete($record)
{
$user = Factory::getUser();
if (!empty($record->catid)) {
return $user->authorise('core.delete', 'com_phocagallery.phocagalleryimg.'.(int) $record->catid);
} else {
return parent::canDelete($record);
}
}
protected function canEditState($record)
{
$user = Factory::getUser();
if (!empty($record->catid)) {
return $user->authorise('core.edit.state', 'com_phocagallery.phocagalleryimg.'.(int) $record->catid);
} else {
return parent::canEditState($record);
}
}
public function getTable($type = 'PhocaGallery', $prefix = 'Table', $config = array())
{
return Table::getInstance($type, $prefix, $config);
}
public function getForm($data = array(), $loadData = true) {
$app = Factory::getApplication();
$form = $this->loadForm('com_phocagallery.phocagalleryimg', 'phocagalleryimg', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form)) {
return false;
}
return $form;
}
protected function loadFormData()
{
// Check the session for previously entered form data.
$app = Factory::getApplication('administrator');
$data = $app->getUserState('com_phocagallery.edit.phocagallery.data', array());
if (empty($data)) {
$data = $this->getItem();
}
// Try to preselect category when we add new image
// Take the value from filter select box in image list
// Or take it from GET - if someone wants to add new file and wants to have preselected category
if (empty($data) || (!empty($data) && (int)$data->id < 1)) {
$filter = (array) $app->getUserState('com_phocagallery.phocagalleryimgs.filter.category_id');
if (isset($filter[0]) && (int)$filter[0] > 0) {
$data->set('catid', (int)$filter[0]);
} else {
// UNDER TEST
$catid = $app->input->get('catid');
if ((int)$catid > 0) {
$data->set('catid', (int)$catid);
}
}
}
return $data;
}
public function getItem($pk = null)
{
if ($item = parent::getItem($pk)) {
// Convert the params field to an array.
if (isset($item->metadata)) {
$registry = new Registry;
$registry->loadString($item->metadata);
$item->metadata = $registry->toArray();
}
}
return $item;
}
protected function prepareTable($table)
{
jimport('joomla.filter.output');
$date = Factory::getDate();
$user = Factory::getUser();
$table->title = htmlspecialchars_decode($table->title, ENT_QUOTES);
$table->alias =ApplicationHelper::stringURLSafe($table->alias);
$table->hits = PhocaGalleryUtils::getIntFromString($table->hits);
$table->zoom = PhocaGalleryUtils::getIntFromString($table->zoom);
$table->pcproductid = PhocaGalleryUtils::getIntFromString($table->pcproductid);
$table->vmproductid = PhocaGalleryUtils::getIntFromString($table->vmproductid);
if (empty($table->alias)) {
$table->alias =ApplicationHelper::stringURLSafe($table->title);
}
if (empty($table->id)) {
// Set the values
//$table->created = $date->toSql();
// Set ordering to the last item if not set
if (empty($table->ordering)) {
$db = Factory::getDbo();
$db->setQuery('SELECT MAX(ordering) FROM #__phocagallery WHERE catid = '.(int)$table->catid);
$max = $db->loadResult();
$table->ordering = $max+1;
}
}
else {
// Set the values
//$table->modified = $date->toSql();
//$table->modified_by = $user->get('id');
}
}
protected function getReorderConditions($table = null)
{
$condition = array();
$condition[] = 'catid = '. (int) $table->catid;
//$condition[] = 'state >= 0';
return $condition;
}
function approve(&$pks, $value = 1)
{
// Initialise variables.
//$dispatcher = JDispatcher::getInstance();
$app = Factory::getApplication();
$user = Factory::getUser();
$table = $this->getTable('phocagallery');
$pks = (array) $pks;
// Include the content plugins for the change of state event.
PluginHelper::importPlugin('content');
// Access checks.
foreach ($pks as $i => $pk) {
if ($table->load($pk)) {
if (!$this->canEditState($table)) {
// Prune items that you can't change.
unset($pks[$i]);
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_EDIT_STATE_NOT_PERMITTED'), 403);
}
}
}
// Attempt to change the state of the records.
if (!$table->approve($pks, $value, $user->get('id'))) {
$this->setError($table->getError());
return false;
}
$context = $this->option.'.'.$this->name;
// Trigger the onContentChangeState event.
//$result = $dispatcher->trigger($this->event_change_state, array($context, $pks, $value));
$result = $app->triggerEvent($this->event_change_state, array($context, $pks, $value));
if (in_array(false, $result, true)) {
$this->setError($table->getError());
return false;
}
PluginHelper::importPlugin($this->events_map['change_state']);
$result = $app->triggerEvent($this->event_change_state, array($context, $pks, $value));
if (\in_array(false, $result, true)) {
$this->setError($table->getError());
return false;
}
return true;
}
function save($data) {
$app = Factory::getApplication();
$params = ComponentHelper::getParams( 'com_phocagallery' );
$clean_thumbnails = $params->get( 'clean_thumbnails', 0 );
$fileOriginalNotExist = 0;
if ((int)$data['extid'] > 0) {
$data['imgorigsize'] = 0;
if ($data['title'] == '') {
$data['title'] = 'External Image';
}
} else {
//If this file doesn't exists don't save it
if (!PhocaGalleryFile::existsFileOriginal($data['filename'])) {
//$this->setError('Original File does not exist');
//return false;
$fileOriginalNotExist = 1;
$errorMsg = Text::_('COM_PHOCAGALLERY_ORIGINAL_IMAGE_NOT_EXIST');
}
$data['imgorigsize'] = PhocaGalleryFile::getFileSize($data['filename'], 0);
$data['format'] = PhocaGalleryFile::getFileFormat($data['filename']);
//If there is no title and no alias, use filename as title and alias
if ($data['title'] == '') {
$data['title'] = PhocaGalleryFile::getTitleFromFile($data['filename']);
}
}
if ($data['extlink1link'] != '') {
$extlink1 = str_replace('http://','', $data['extlink1link']);
$data['extlink1'] = $extlink1 . '|'.$data['extlink1title'].'|'.$data['extlink1target'].'|'.$data['extlink1icon'];
} else {
$data['extlink1'] = $data['extlink1link'] . '|'.$data['extlink1title'].'|'.$data['extlink1target'].'|'.$data['extlink1icon'];
}
if ($data['extlink2link'] != '') {
$extlink2 = str_replace('http://','', $data['extlink2link']);
$data['extlink2'] = $extlink2 . '|'.$data['extlink2title'].'|'.$data['extlink2target'].'|'.$data['extlink2icon'];
} else {
$data['extlink2'] = $data['extlink2link'] . '|'.$data['extlink2title'].'|'.$data['extlink2target'].'|'.$data['extlink2icon'];
}
// Geo
if($data['longitude'] == '' || $data['latitude'] == '') {
phocagalleryimport('phocagallery.geo.geo');
$coords = PhocaGalleryGeo::getGeoCoords($data['filename']);
if ($data['longitude'] == '' ){
$data['longitude'] = $coords['longitude'];
}
if ($data['latitude'] == '' ){
$data['latitude'] = $coords['latitude'];
}
if ($data['latitude'] != '' && $data['longitude'] != '' && $data['zoom'] == ''){
$data['zoom'] = PhocaGallerySettings::getAdvancedSettings('geozoom');
}
}
if ($data['alias'] == '') {
$data['alias'] = $data['title'];
}
//clean alias name (no bad characters)
//$data['alias'] = PhocaGalleryText::getAliasName($data['alias']);
// if new item, order last in appropriate group
//if (!$row->id) {
// $where = 'catid = ' . (int) $row->catid ;
// $row->ordering = $row->getNextOrder( $where );
//}
// = = = = = = = = = =
// Initialise variables;
//$dispatcher = JDispatcher::getInstance();
$table = $this->getTable();
$pk = (!empty($data['id'])) ? $data['id'] : (int)$this->getState($this->getName().'.id');
$isNew = true;
// Include the content plugins for the on save events.
PluginHelper::importPlugin('content');
// Load the row if saving an existing record.
if ($pk > 0) {
$table->load($pk);
$isNew = false;
}
// Bind the data.
if (!$table->bind($data)) {
$this->setError($table->getError());
return false;
}
if(intval($table->date) == 0) {
$table->date = Factory::getDate()->toSql();
}
// Prepare the row for saving
$this->prepareTable($table);
// Check the data.
if (!$table->check()) {
$this->setError($table->getError());
return false;
}
// Trigger the onContentBeforeSave event.
/*$result = $dispatcher->trigger($this->event_before_save, array($this->option.'.'.$this->name, $table, $isNew));
$result = $app->triggerEvent($this->event_before_save, array($this->option.'.'.$this->name, $table, $isNew));
if (in_array(false, $result, true)) {
$this->setError($table->getError());
return false;
}*/
PluginHelper::importPlugin($this->events_map['save']);
$result = $app->triggerEvent($this->event_before_save, array($this->option.'.'.$this->name, $table, $isNew, $data));
if (\in_array(false, $result, true)) {
$this->setError($table->getError());
return false;
}
// Store the data.
if (!$table->store()) {
$this->setError($table->getError());
return false;
}
// Store to ref table
if (!isset($data['tags'])) {
$data['tags'] = array();
}
if ((int)$table->id > 0) {
PhocaGalleryTag::storeTags($data['tags'], (int)$table->id);
}
// Clean the cache.
$cache = Factory::getCache($this->option);
$cache->clean();
// Trigger the onContentAfterSave event.
//$dispatcher->trigger($this->event_after_save, array($this->option.'.'.$this->name, $table, $isNew));
PluginHelper::importPlugin($this->events_map['save']);
$result = $app->triggerEvent($this->event_after_save, array($this->option.'.'.$this->name, $table, $isNew, $data));
if (\in_array(false, $result, true)) {
$this->setError($table->getError());
return false;
}
$pkName = $table->getKeyName();
if (isset($table->$pkName)) {
$this->setState($this->getName().'.id', $table->$pkName);
}
$this->setState($this->getName().'.new', $isNew);
// = = = = = =
$task = Factory::getApplication()->input->get('task');
if (isset($table->$pkName)) {
$id = $table->$pkName;
}
if ((int)$data['extid'] > 0 || $fileOriginalNotExist == 1) {
} else {
// - - - - - - - - - - - - - - - - - -
//Create thumbnail small, medium, large
//file - abc.img, file_no - folder/abc.img
//Get folder variables from Helper
//Create thumbnails small, medium, large
$refresh_url = 'index.php?option=com_phocagallery&task=phocagalleryimg.thumbs';
$task = Factory::getApplication()->input->get('task');
if (isset($table->$pkName) && $task == 'apply') {
$id = $table->$pkName;
$refresh_url = 'index.php?option=com_phocagallery&task=phocagalleryimg.edit&id='.(int)$id;
}
if ($task == 'save2new') {
// Don't create automatically thumbnails in case, we are going to add new image
} else {
$file_thumb = PhocaGalleryFileThumbnail::getOrCreateThumbnail($data['filename'], $refresh_url, 1, 1, 1);
}
//Clean Thumbs Folder if there are thumbnail files but not original file
if ($clean_thumbnails == 1) {
phocagalleryimport('phocagallery.file.filefolder');
PhocaGalleryFileFolder::cleanThumbsFolder();
}
// - - - - - - - - - - - - - - - - - - - - -
}
return true;
}
function delete(&$cid = array()) {
$params = ComponentHelper::getParams( 'com_phocagallery' );
$clean_thumbnails = $params->get( 'clean_thumbnails', 0 );
$result = false;
$table = $this->getTable();
if (count( $cid )) {
\Joomla\Utilities\ArrayHelper::toInteger($cid);
$cids = implode( ',', $cid );
// - - - - - - - - - - - - -
// Get all filenames we want to delete from database, we delete all thumbnails from server of this file
$queryd = 'SELECT filename as filename FROM #__phocagallery WHERE id IN ( '.$cids.' )';
$this->_db->setQuery($queryd);
$fileObject = $this->_db->loadObjectList();
// - - - - - - - - - - - - -
//Delete it from DB
/*$query = 'DELETE FROM #__phocagallery'
. ' WHERE id IN ( '.$cids.' )';
$this->_db->setQuery( $query );
$this->_db->execute();
/*if(!$this->_db->query()) {
$this->setError($this->_db->getErrorMsg());
return false;
}*/
$app = Factory::getApplication();
PluginHelper::importPlugin($this->events_map['delete']);
foreach ($cid as $i => $pk) {
if ($table->load($pk)) {
if ($this->canDelete($table)) {
if (!$table->delete($pk)) {
throw new Exception($table->getError(), 500);
return false;
}
$app->triggerEvent($this->event_after_delete, array($this->option.'.'.$this->name, $table));
}
}
}
// - - - - - - - - - - - - - -
// Delete thumbnails - medium and large, small from server
// All id we want to delete - gel all filenames
foreach ($fileObject as $key => $value) {
//The file can be stored in other category - don't delete it from server because other category use it
$querys = "SELECT id as id FROM #__phocagallery WHERE filename='".$value->filename."' ";
$this->_db->setQuery($queryd);
$sameFileObject = $this->_db->loadObject();
// same file in other category doesn't exist - we can delete it
if (!$sameFileObject) {
PhocaGalleryFileThumbnail::deleteFileThumbnail($value->filename, 1, 1, 1);
}
}
// Clean Thumbs Folder if there are thumbnail files but not original file
if ($clean_thumbnails == 1) {
phocagalleryimport('phocagallery.file.filefolder');
PhocaGalleryFileFolder::cleanThumbsFolder();
}
// - - - - - - - - - - - - - -
}
return true;
}
function recreate($cid = array(), &$message = '') {
if (count( $cid )) {
\Joomla\Utilities\ArrayHelper::toInteger($cid);
$cids = implode( ',', $cid );
$query = 'SELECT a.filename, a.extid'.
' FROM #__phocagallery AS a' .
' WHERE a.id IN ( '.$cids.' )';
$this->_db->setQuery($query);
$files = $this->_db->loadObjectList();
if (isset($files) && count($files)) {
foreach($files as $key => $value) {
if (isset($value->extid) && ((int)$value->extid > 0)) {
// Picasa cannot be recreated
$message = Text::_('COM_PHOCAGALLERY_ERROR_EXT_IMG_NOT_RECREATE');
return false;
} else if (isset($value->filename) && $value->filename != '') {
$original = PhocaGalleryFile::existsFileOriginal($value->filename);
if (!$original) {
// Original does not exist - cannot generate new thumbnail
$message = Text::_('COM_PHOCAGALLERY_FILEORIGINAL_NOT_EXISTS');
return false;
}
// Delete old thumbnails
$deleteThubms = PhocaGalleryFileThumbnail::deleteFileThumbnail($value->filename, 1, 1, 1);
} else {
$message = Text::_('COM_PHOCAGALLERY_FILENAME_NOT_EXISTS');
return false;
}
if (!$deleteThubms) {
$message = Text::_('COM_PHOCAGALLERY_ERROR_DELETE_THUMBNAIL');
return false;
}
}
} else {
$message = Text::_('COM_PHOCAGALLERY_ERROR_LOADING_DATA_DB');
return false;
}
} else {
$message = Text::_('COM_PHOCAGALLERY_ERROR_ITEM_NOT_SELECTED');
return false;
}
return true;
}
/*
function deletethumbs($id) {
if ($id > 0) {
$query = 'SELECT a.filename as filename'.
' FROM #__phocagallery AS a' .
' WHERE a.id = '.(int) $id;
$this->_db->setQuery($query);
$file = $this->_db->loadObject();
if (isset($file->filename) && $file->filename != '') {
$deleteThubms = PhocaGalleryFileThumbnail::deleteFileThumbnail($file->filename, 1, 1, 1);
if ($deleteThubms) {
return true;
} else {
return false;
}
} return false;
} return false;
}*/
public function disableThumbs() {
$component = 'com_phocagallery';
$paramsC = ComponentHelper::getParams($component) ;
$paramsC->set('enable_thumb_creation', 0);
$data['params'] = $paramsC->toArray();
$table = Table::getInstance('extension');
$idCom = $table->find( array('element' => $component ));
$table->load($idCom);
if (!$table->bind($data)) {
throw new Exception($db->getErrorMsg());
return false;
}
// pre-save checks
if (!$table->check()) {
throw new Exception($table->getError());
return false;
}
// save the changes
if (!$table->store()) {
throw new Exception($table->getError());
return false;
}
return true;
}
function rotate($id, $angle, &$errorMsg) {
phocagalleryimport('phocagallery.image.imagerotate');
if ($id > 0 && $angle !='') {
$query = 'SELECT a.filename as filename'.
' FROM #__phocagallery AS a' .
' WHERE a.id = '.(int) $id;
$this->_db->setQuery($query);
$file = $this->_db->loadObject();
if (isset($file->filename) && $file->filename != '') {
$thumbNameL = PhocaGalleryFileThumbnail::getThumbnailName ($file->filename, 'large');
$thumbNameM = PhocaGalleryFileThumbnail::getThumbnailName ($file->filename, 'medium');
$thumbNameS = PhocaGalleryFileThumbnail::getThumbnailName ($file->filename, 'small');
$errorMsg = $errorMsgS = $errorMsgM = $errorMsgL ='';
PhocaGalleryImageRotate::rotateImage($thumbNameL, 'large', $angle, $errorMsgL);
if ($errorMsgL != '') {
$errorMsg = $errorMsgL;
return false;
}
PhocaGalleryImageRotate::rotateImage($thumbNameM, 'medium', $angle, $errorMsgM);
if ($errorMsgM != '') {
$errorMsg = $errorMsgM;
return false;
}
PhocaGalleryImageRotate::rotateImage($thumbNameS, 'small', $angle, $errorMsgS);
if ($errorMsgS != '') {
$errorMsg = $errorMsgS;
return false;
}
if ($errorMsgL == '' && $errorMsgM == '' && $errorMsgS == '' ) {
return true;
} else {
$errorMsg = ' ('.$errorMsg.')';
return false;
}
}
$errorMsg = Text::_('COM_PHOCAGALLERY_FILENAME_NOT_EXISTS');
return false;
}
$errorMsg = Text::_('COM_PHOCAGALLERY_ERROR_ITEM_NOT_SELECTED');
return false;
}
function deletethumbs($id) {
if ($id > 0) {
$query = 'SELECT a.filename as filename'.
' FROM #__phocagallery AS a' .
' WHERE a.id = '.(int) $id;
$this->_db->setQuery($query);
$file = $this->_db->loadObject();
if (isset($file->filename) && $file->filename != '') {
$deleteThubms = PhocaGalleryFileThumbnail::deleteFileThumbnail($file->filename, 1, 1, 1);
if ($deleteThubms) {
return true;
} else {
return false;
}
} return false;
} return false;
}
protected function batchCopy($value, $pks, $contexts)
{
$categoryId = (int) $value;
$table = $this->getTable();
$db = $this->getDbo();
// Check that the category exists
if ($categoryId) {
$categoryTable = Table::getInstance('PhocaGalleryC', 'Table');
if (!$categoryTable->load($categoryId)) {
if ($error = $categoryTable->getError()) {
// Fatal error
$this->setError($error);
return false;
}
else {
$this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_MOVE_CATEGORY_NOT_FOUND'));
return false;
}
}
}
if (empty($categoryId)) {
$this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_MOVE_CATEGORY_NOT_FOUND'));
return false;
}
// Check that the user has create permission for the component
$extension = Factory::getApplication()->input->getCmd('option');
$user = Factory::getUser();
if (!$user->authorise('core.create', $extension)) {
$this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_CREATE'));
return false;
}
//NEW
//$i = 0;
//ENDNEW
// Parent exists so we let's proceed
while (!empty($pks))
{
// Pop the first ID off the stack
$pk = array_shift($pks);
$table->reset();
// Check that the row actually exists
if (!$table->load($pk)) {
if ($error = $table->getError()) {
// Fatal error
$this->setError($error);
return false;
}
else {
// Not fatal error
$this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
}
// Alter the title & alias
$data = $this->generateNewTitle($categoryId, $table->alias, $table->title);
$table->title = $data['0'];
$table->alias = $data['1'];
// Reset the ID because we are making a copy
$table->id = 0;
// New category ID
$table->catid = $categoryId;
// Ordering
$table->ordering = $this->increaseOrdering($categoryId);
$table->hits = 0;
// Check the row.
if (!$table->check()) {
$this->setError($table->getError());
return false;
}
// Store the row.
if (!$table->store()) {
$this->setError($table->getError());
return false;
}
//NEW
// Get the new item ID
$newId = $table->get('id');
// Add the new ID to the array
$newIds[$pk] = $newId;
if ($newId > 0) {
$tags = PhocaGalleryTag::getTags($pk, 1);
PhocaGalleryTag::storeTags($tags, $newId);
}
//$i++;
//ENDNEW
}
// Clean the cache
$this->cleanCache();
//NEW
return $newIds;
//END NEW
}
/**
* Batch move articles to a new category
*
* @param integer $value The new category ID.
* @param array $pks An array of row IDs.
*
* @return booelan True if successful, false otherwise and internal error is set.
*
* @since 11.1
*/
protected function batchMove($value, $pks, $contexts)
{
$categoryId = (int) $value;
$table = $this->getTable();
//$db = $this->getDbo();
// Check that the category exists
if ($categoryId) {
$categoryTable = Table::getInstance('PhocaGalleryC', 'Table');
if (!$categoryTable->load($categoryId)) {
if ($error = $categoryTable->getError()) {
// Fatal error
$this->setError($error);
return false;
}
else {
$this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_MOVE_CATEGORY_NOT_FOUND'));
return false;
}
}
}
if (empty($categoryId)) {
$this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_MOVE_CATEGORY_NOT_FOUND'));
return false;
}
// Check that user has create and edit permission for the component
$extension = Factory::getApplication()->input->getCmd('option');
$user = Factory::getUser();
if (!$user->authorise('core.create', $extension)) {
$this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_CREATE'));
return false;
}
if (!$user->authorise('core.edit', $extension)) {
$this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
return false;
}
// Parent exists so we let's proceed
foreach ($pks as $pk)
{
// Check that the row actually exists
if (!$table->load($pk)) {
if ($error = $table->getError()) {
// Fatal error
$this->setError($error);
return false;
}
else {
// Not fatal error
$this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
}
// Set the new category ID
$table->catid = $categoryId;
// Check the row.
if (!$table->check()) {
$this->setError($table->getError());
return false;
}
// Store the row.
if (!$table->store()) {
$this->setError($table->getError());
return false;
}
}
// Clean the cache
$this->cleanCache();
return true;
}
public function increaseOrdering($categoryId) {
$ordering = 1;
$this->_db->setQuery('SELECT MAX(ordering) FROM #__phocagallery WHERE catid='.(int)$categoryId);
$max = $this->_db->loadResult();
$ordering = $max + 1;
return $ordering;
}
/*
public function publish(&$pks, $value = 1)
{
$dispatcher = J EventDispatcher::getInstance();
$user = Factory::getUser();
$table = $this->getTable();
$pks = (array) $pks;
//PHOCAEDIT
// Include the plugins for the change of state event.
//JPluginHelper::importPlugin($this->events_map['change_state']);
// Access checks.
foreach ($pks as $i => $pk)
{
$table->reset();
if ($table->load($pk))
{
if (!$this->canEditState($table))
{
// Prune items that you can't change.
unset($pks[$i]);
Log::add(Text::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'), Log::WARNING, ' ');
return false;
}
}
}
// Attempt to change the state of the records.
if (!$table->publish($pks, $value, $user->get('id')))
{
$this->setError($table->getError());
return false;
}
$context = $this->option . '.' . $this->name;
// Trigger the change state event.
$result = $dispatcher->trigger($this->event_change_state, array($context, $pks, $value));
if (in_array(false, $result, true))
{
$this->setError($table->getError());
return false;
}
// Clear the component's cache
$this->cleanCache();
return true;
}*/
}
?>

View File

@ -0,0 +1,223 @@
<?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\MVC\Model\ListModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Component\ComponentHelper;
jimport( 'joomla.application.component.modellist' );
jimport( 'joomla.filesystem.folder' );
jimport( 'joomla.filesystem.file' );
phocagalleryimport( 'phocagallery.file.filefolder' );
class PhocaGalleryCpModelPhocaGalleryImgs extends ListModel
{
protected $option = 'com_phocagallery';
//public $context = 'com_phocagallery.phocagallerycoimgs';
public function __construct($config = array())
{
if (empty($config['filter_fields'])) {
$config['filter_fields'] = array(
'id', 'a.id',
'title', 'a.title',
'alias', 'a.alias',
'checked_out', 'a.checked_out',
'checked_out_time', 'a.checked_out_time',
'category_id', 'category_id',
'state', 'a.state',
'access', 'a.access', 'access_level',
'ordering', 'a.ordering',
'language', 'a.language',
'hits', 'a.hits',
'ratingavg', 'ratingavg',
'published','a.published',
'filename', 'a.filename',
'autorized', 'a.approved',
'uploadusername', 'uploadusername',
'category_owner_id', 'category_owner_id',
);
}
parent::__construct($config);
}
protected function populateState($ordering = 'a.title', $direction = 'ASC')
{
// Initialise variables.
$app = Factory::getApplication('administrator');
// Load the filter state.
$search = $app->getUserStateFromRequest($this->context.'.filter.search', 'filter_search');
$this->setState('filter.search', $search);
/*
$accessId = $app->getUserStateFromRequest($this->context.'.filter.access', 'filter_access', null, 'int');
$this->setState('filter.access', $accessId);
*/
$state = $app->getUserStateFromRequest($this->context.'.filter.published', 'filter_published', '', 'string');
$this->setState('filter.published', $state);
$categoryId = $app->getUserStateFromRequest($this->context.'.filter.category_id', 'filter_category_id', null);
$this->setState('filter.category_id', $categoryId);
$language = $app->getUserStateFromRequest($this->context.'.filter.language', 'filter_language', '');
$this->setState('filter.language', $language);
// Load the parameters.
$params = ComponentHelper::getParams('com_phocagallery');
$this->setState('params', $params);
// List state information.
parent::populateState($ordering, $direction);
}
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':'.$this->getState('filter.search');
//$id .= ':'.$this->getState('filter.access');
$id .= ':'.$this->getState('filter.published');
$id .= ':'.$this->getState('filter.category_id');
$id .= ':'.$this->getState('filter.image_id');
return parent::getStoreId($id);
}
protected function getListQuery()
{
/*
$query = ' SELECT a.*, cc.title AS category, cc.owner_id AS ownerid, u.name AS editor, v.average AS ratingavg, ua.username AS usercatname'
. ' FROM #__phocagallery AS a '
. ' LEFT JOIN #__phocagallery_categories AS cc ON cc.id = a.catid '
. ' LEFT JOIN #__phocagallery_img_votes_statistics AS v ON v.imgid = a.id'
. ' LEFT JOIN #__users AS u ON u.id = a.checked_out '
. ' LEFT JOIN #__users AS ua ON ua.id = cc.owner_id'
. $where
. $orderby;
. $orderby
*/
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
// Select the required fields from the table.
$query->select(
$this->getState(
'list.select',
'a.*'
)
);
$query->from('`#__phocagallery` AS a');
// Join over the language
$query->select('l.title AS language_title');
$query->join('LEFT', '`#__languages` AS l ON l.lang_code = a.language');
// Join over the users for the checked out user.
$query->select('uc.name AS editor');
$query->join('LEFT', '#__users AS uc ON uc.id=a.checked_out');
$query->select('uua.id AS uploaduserid, uua.username AS uploadusername, uua.name AS uploadname');
$query->join('LEFT', '#__users AS uua ON uua.id=a.userid');
// Join over the asset groups.
/* $query->select('ag.title AS access_level');
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
*/
// Join over the categories.
$query->select('c.title AS category_title, c.id AS category_id, c.owner_id AS category_owner_id');
$query->join('LEFT', '#__phocagallery_categories AS c ON c.id = a.catid');
$query->select('ua.id AS userid, ua.username AS username, ua.name AS usernameno');
$query->join('LEFT', '#__users AS ua ON ua.id = c.owner_id');
$query->select('v.average AS ratingavg');
$query->join('LEFT', '#__phocagallery_img_votes_statistics AS v ON v.imgid = a.id');
// Filter by access level.
if ($access = $this->getState('filter.access')) {
$query->where('a.access = '.(int) $access);
}
// Filter by published state.
$published = $this->getState('filter.published');
if (is_numeric($published)) {
$query->where('a.published = '.(int) $published);
}
else if ($published === '') {
$query->where('(a.published IN (0, 1))');
}
// Filter by category.
$categoryId = $this->getState('filter.category_id');
if (is_numeric($categoryId)) {
$query->where('a.catid = ' . (int) $categoryId);
}
// Filter on the language.
if ($language = $this->getState('filter.language')) {
$query->where('a.language = ' . $db->quote($language));
}
// Filter by search in title
$search = $this->getState('filter.search');
if (!empty($search))
{
if (stripos($search, 'id:') === 0) {
$query->where('a.id = '.(int) substr($search, 3));
}
else
{
$search = $db->Quote('%'.$db->escape($search, true).'%');
$query->where('( a.title LIKE '.$search.' OR a.filename LIKE '.$search.')');
}
}
// $query->group('a.id');
// Add the list ordering clause.
$orderCol = $this->state->get('list.ordering');
$orderDirn = $this->state->get('list.direction');
/*if ($orderCol == 'a.ordering' || $orderCol == 'category_title') {
$orderCol = 'category_title '.$orderDirn.', a.ordering';
}*/
$query->order($db->escape($orderCol.' '.$orderDirn));
return $query;
}
public function getItemsThumbnail() {
$query = ' SELECT a.filename FROM #__phocagallery AS a ';
$this->_db->setQuery($query);
$itemsThumbnail = $this->_db->loadObjectList();
return $itemsThumbnail;
}
public function getNotApprovedImage() {
$query = 'SELECT COUNT(a.id) AS count'
.' FROM #__phocagallery AS a'
.' WHERE approved = 0';
$this->_db->setQuery($query, 0, 1);
$countNotApproved = $this->_db->loadObject();
return $countNotApproved;
}
}
?>

View File

@ -0,0 +1,151 @@
<?php
/*
* @package Joomla
* @copyright Copyright (C) 2005 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\MVC\Model\BaseDatabaseModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Pagination\Pagination;
jimport('joomla.application.component.model');
use Joomla\String\StringHelper;
class PhocaGalleryCpModelPhocaGalleryLinkImg extends BaseDatabaseModel
{
var $_data = null;
var $_total = null;
var $_pagination = null;
var $_context = 'com_phocagallery.phocagallerylinkimg';
function __construct() {
parent::__construct();
$app = Factory::getApplication();
// Get the pagination request variables
$limit = $app->getUserStateFromRequest( $this->_context.'.list.limit', 'limit', $app->get('list_limit'), 'int' );
$limitstart = $app->getUserStateFromRequest( $this->_context.'.limitstart', 'limitstart', 0, 'int' );
// In case limit has been changed, adjust limitstart accordingly
$limitstart = ($limit != 0 ? (floor($limitstart / $limit) * $limit) : 0);
$this->setState('limit', $limit);
$this->setState('limitstart', $limitstart);
}
function getData() {
if (empty($this->_data)) {
$query = $this->_buildQuery();
$this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit'));
}
if (!empty($this->_data)) {
foreach ($this->_data as $key => $value) {
$fileOriginal = PhocaGalleryFile::getFileOriginal($value->filename);
//Let the user know that the file doesn't exists
if (!File::exists($fileOriginal)) {
$this->_data[$key]->filename = Text::_( 'COM_PHOCAGALLERY_IMG_FILE_NOT_EXISTS' );
$this->_data[$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->_data[$key]->linkthumbnailpath = $fileThumb['thumb_name_s_no_rel'];
$this->_data[$key]->fileoriginalexist = 1;
}
}
}
return $this->_data;
}
function getTotal() {
if (empty($this->_total)) {
$query = $this->_buildQuery();
$this->_total = $this->_getListCount($query);
}
return $this->_total;
}
function getPagination() {
if (empty($this->_pagination)) {
jimport('joomla.html.pagination');
$this->_pagination = new Pagination( $this->getTotal(), $this->getState('limitstart'), $this->getState('limit') );
}
return $this->_pagination;
}
function _buildQuery() {
$where = $this->_buildContentWhere();
$orderby = $this->_buildContentOrderBy();
$query = ' SELECT a.*, cc.title AS category, u.name AS editor, v.average AS ratingavg'
. ' FROM #__phocagallery AS a '
. ' LEFT JOIN #__phocagallery_categories AS cc ON cc.id = a.catid '
. ' LEFT JOIN #__phocagallery_img_votes_statistics AS v ON v.imgid = a.id'
. ' LEFT JOIN #__users AS u ON u.id = a.checked_out '
. $where
. $orderby;
return $query;
}
function _buildContentOrderBy() {
$app = Factory::getApplication();
$filter_order = $app->getUserStateFromRequest( $this->_context.'.filter_order', 'filter_order', 'a.ordering', 'cmd' );
$filter_order_Dir = $app->getUserStateFromRequest( $this->_context.'.filter_order_Dir', 'filter_order_Dir', '', 'word' );
if ($filter_order == 'a.ordering'){
$orderby = ' ORDER BY category, a.ordering '.$filter_order_Dir;
} else {
$orderby = ' ORDER BY '.$filter_order.' '.$filter_order_Dir.' , category, a.ordering ';
}
return $orderby;
}
function _buildContentWhere() {
$app = Factory::getApplication();
$filter_published = $app->getUserStateFromRequest( $this->_context.'.filter_published', 'filter_published', '', 'word' );
$filter_catid = $app->getUserStateFromRequest( $this->_context.'.filter_catid', 'filter_catid', 0, 'int' );
$filter_order = $app->getUserStateFromRequest( $this->_context.'.filter_order', 'filter_order', 'a.ordering', 'cmd' );
$filter_order_Dir = $app->getUserStateFromRequest( $this->_context.'.filter_order_Dir', 'filter_order_Dir', '', 'word' );
$search = $app->getUserStateFromRequest( $this->_context.'.search', 'search', '', 'string' );
$search = StringHelper::strtolower( $search );
$where = array();
$where[] = 'a.published = 1';
$where[] = 'a.approved = 1';
$where[] = 'cc.published = 1';
$where[] = 'cc.approved = 1';
if ($filter_catid > 0) {
$where[] = 'a.catid = '.(int) $filter_catid;
}
if ($search) {
$where[] = 'LOWER(a.title) LIKE '.$this->_db->Quote('%'.$search.'%');
}
if ( $filter_published ) {
if ( $filter_published == 'P' ) {
$where[] = 'a.published = 1';
} else if ($filter_published == 'U' ) {
$where[] = 'a.published = 0';
}
}
$where = ( count( $where ) ? ' WHERE '. implode( ' AND ', $where ) : '' );
return $where;
}
}
?>

View File

@ -0,0 +1,552 @@
<?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\MVC\Model\AdminModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Table\Table;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Filesystem\Folder;
use Joomla\CMS\Filesystem\Path;
use Joomla\CMS\Object\CMSObject;
jimport('joomla.application.component.modeladmin');
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
phocagalleryimport('phocagallery.file.filefolderlist');
setlocale(LC_ALL, 'C.UTF-8', 'C');
class PhocaGalleryCpModelPhocaGalleryM extends AdminModel
{
protected $option = 'com_phocagallery';
protected $text_prefix = 'com_phocagallery';
public $typeAlias = 'com_phocagallery.phocagallerym';
protected $imageCount = 0;
protected $categoryCount = 0;
protected $firstImageFolder = '';
function __construct() {
$this->imageCount = 0;
$this->categoryCount = 0;
$this->firstImageFolder = '';
parent::__construct();
}
public function getForm($data = array(), $loadData = true) {
$form = $this->loadForm('com_phocagallery.phocagallerym', 'phocagallerym', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form)) {
return false;
}
return $form;
}
protected function canDelete($record)
{
$user = Factory::getUser();
if (!empty($record->catid)) {
return $user->authorise('core.delete', 'com_phocagallery.phocagalleryimg.'.(int) $record->catid);
} else {
return parent::canDelete($record);
}
}
protected function canEditState($record)
{
$user = Factory::getUser();
if (!empty($record->catid)) {
return $user->authorise('core.edit.state', 'com_phocagallery.phocagalleryimg.'.(int) $record->catid);
} else {
return parent::canEditState($record);
}
}
public function getTable($type = 'PhocaGallery', $prefix = 'Table', $config = array())
{
return Table::getInstance($type, $prefix, $config);
}
protected function loadFormData()
{
// Check the session for previously entered form data.
$data = Factory::getApplication()->getUserState('com_phocagallerym.edit.phocagallerym.data', array());
if (empty($data)) {
$data = $this->getItem();
}
return $data;
}
/*function &getData() {
$this->_initData();
return $this->_data;
}*/
/*
* - If we add only image, then the thumbnail creation will be run
* - If we add folder with image, we need to know the first image in the folder
* to run thumbnail creating (PhocaGalleryFileThumbnail::getOrCreateThumbnail())
*/
function setFirstImageFolder($filename) {
$this->firstImageFolder = $filename;
}
function setImageCount($count) {
$this->imageCount = $this->imageCount + $count;
}
function setCategoryCount($count) {
$this->categoryCount = $this->categoryCount + $count;
}
function save($data) {
$app = Factory::getApplication();
$foldercid = Factory::getApplication()->input->get('foldercid', array(), 'raw');
$cid = Factory::getApplication()->input->get('cid', 0, 'raw');
$data = Factory::getApplication()->input->get('jform', array(0), 'post', 'array');
if(isset($foldercid)) {
$data['foldercid'] = $foldercid;
} else {
$data['foldercid'] = array();
}
if(isset($cid)) {
$data['cid'] = $cid;
} else {
$data['cid'] = array();
}
if (isset($data['catid']) && (int)$data['catid'] > 0) {
$data['catid'] = (int)$data['catid'];
} else {
$data['catid'] = 0;
}
//Params
$params = ComponentHelper::getParams( 'com_phocagallery' );
$clean_thumbnails = $params->get( 'clean_thumbnails', 0 );
//Get folder variables from Helper
$path = PhocaGalleryPath::getPath();
$origPath = $path->image_abs;
$origPathServer = str_replace('\\', '/', $path->image_abs);
// Cache all existing categories
$query = 'SELECT id, title, parent_id'
. ' FROM #__phocagallery_categories' ;
$this->_db->setQuery( $query );
$existingCategories = $this->_db->loadObjectList() ;
// Cache all existing images
$query = 'SELECT catid, filename'
. ' FROM #__phocagallery';
$this->_db->setQuery( $query );
$existingImages = $this->_db->loadObjectList() ;
$result = new stdClass();
$result->category_count = 0;
$result->image_count = 0;
$i = 1;
// Category will be saved - Images will be saved in recursive function
if (isset($data['foldercid'])) {
foreach ($data['foldercid'] as $foldername) {
if (strlen($foldername) > 0) {
$fullPath = $path->image_abs.$foldername;
$result = $this->_createCategoriesRecursive( $origPathServer, $fullPath, $existingCategories, $existingImages, $data['catid'], $data );
}
}
}
// Only Imagees will be saved
if (isset($data['cid']) && !empty($data['cid'])) {
foreach ($data['cid'] as $filename) {
if ($filename) {
$ext = strtolower(File::getExt($filename));
// Don't create thumbnails from defined files (don't save them into a database)...
$dontCreateThumb = PhocaGalleryFileThumbnail::dontCreateThumb ($filename);
if ($dontCreateThumb == 1) {
$ext = '';// WE USE $ext FOR NOT CREATE A THUMBNAIL CLAUSE
}
if ($ext == 'jpg' || $ext == 'png' || $ext == 'gif' || $ext == 'jpeg' || $ext == 'webp' || $ext == 'avif') {
$row = $this->getTable('phocagallery');
$datam = array();
$datam['published'] = $data['published'];
$datam['catid'] = $data['catid'];
$datam['approved'] = $data['approved'];
$datam['language'] = $data['language'];
$datam['filename'] = $filename;
if ($data['title'] != '') {
$datam['title'] = $data['title'];
$datam['title'] = str_replace('{###}', str_pad((string)$i, 3, '0', STR_PAD_LEFT), $datam['title']);
$datam['title'] = str_replace('{##}', str_pad((string)$i, 2, '0', STR_PAD_LEFT), $datam['title']);
$datam['title'] = str_replace('{#}', $i, $datam['title']);
} else {
$datam['title'] = PhocaGalleryFile::getTitleFromFile($filename);
}
if ($data['alias'] != '') {
$datam['alias'] = $data['alias'];
} else {
$datam['alias'] = $datam['title'];//PhocaGalleryText::getAliasName($datam['title']);
}
$datam['imgorigsize'] = PhocaGalleryFile::getFileSize($datam['filename'], 0);
$datam['format'] = PhocaGalleryFile::getFileFormat($datam['filename']);
// Geo
phocagalleryimport('phocagallery.geo.geo');
$coords = PhocaGalleryGeo::getGeoCoords($datam['filename']);
$datam['longitude'] = $coords['longitude'];
$datam['latitude'] = $coords['latitude'];
if ($datam['latitude'] != '' && $datam['longitude'] != ''){
$datam['zoom'] = PhocaGallerySettings::getAdvancedSettings('geozoom');
}
// Save
// Bind the form fields to the Phoca gallery table
if (!$row->bind($datam)) {
$this->setError($row->getError());
return false;
}
// Create the timestamp for the date
$row->date = gmdate('Y-m-d H:i:s');
// if new item, order last in appropriate group
if (!$row->id) {
$where = 'catid = ' . (int) $row->catid ;
$row->ordering = $row->getNextOrder( $where );
}
// Make sure the Phoca gallery table is valid
if (!$row->check()) {
$this->setError($row->getError());
return false;
}
// Store the Phoca gallery table to the database
if (!$row->store()) {
$this->setError($row->getError());
return false;
}
$result->image_count++;
$i++;
}
}
}
$this->setImageCount($result->image_count);
}
// - - - - - - - - - - - - - - - - -
//Create thumbnail small, medium, large
//file - abc.img, file_no - folder/abc.img
//Get folder variables from Helper
// $refresh_url = 'index.php?option=com_phocagallery&task=phocagalleryimg.thumbs';
$msg = $this->categoryCount. ' ' .Text::_('COM_PHOCAGALLERY_CATEGORIES_ADDED') .', '.$this->imageCount. ' ' . Text::_('COM_PHOCAGALLERY_IMAGES_ADDED');
$app->enqueueMessage($msg);
$app->redirect(Route::_('index.php?option=com_phocagallery&view=phocagalleryimgs&countimg='.$this->imageCount.'&imagesid='.md5(time()), false));
// Only image without folder was added to the system
if (isset($row->filename) && $row->filename != '') {
$fileNameThumb = $row->filename;
} else if ($this->firstImageFolder != '') {
$fileNameThumb = $this->firstImageFolder;
} else {
$fileNameThumb = '';
}
if ($fileNameThumb != '') {
$refresh_url = 'index.php?option=com_phocagallery&view=phocagalleryimgs&countimg='.$this->imageCount;
$fileThumb = PhocaGalleryFileThumbnail::getOrCreateThumbnail($fileNameThumb, $refresh_url, 1, 1, 1);
}
//Clean Thumbs Folder if there are thumbnail files but not original file
if ($clean_thumbnails == 1) {
PhocaGalleryFileFolder::cleanThumbsFolder();
}
// - - - - - - - - - - - - - - - - -
return true;
}
protected function _getCategoryId( &$existingCategories, &$title, $parentId ) {
$id = -1 ;
$i = 0;
$count = count($existingCategories);
while ( $id == -1 && $i < $count ) {
if ( $existingCategories[$i]->title == $title &&
$existingCategories[$i]->parent_id == $parentId ) {
$id = $existingCategories[$i]->id ;
}
$i++;
}
return $id ;
}
protected function _ImageExist( &$existing_image, &$filename, $catid ) {
$result = false ;
$i = 0;
$count = count($existing_image);
while ( $result == false && $i < $count ) {
if ( $existing_image[$i]->filename == $filename &&
$existing_image[$i]->catid == $catid ) {
$result = true;
}
$i++;
}
return $result;
}
protected function _addAllImagesFromFolder(&$existingImages, $category_id, $fullPath, $rel_path, $data = array()) {
$count = 0;
$i = 1;
$fileList = Folder::files( $fullPath );
natcasesort($fileList);
// Iterate over the files if they exist
//file - abc.img, file_no - folder/abc.img
if ($fileList !== false) {
foreach ($fileList as $filename) {
$storedfilename = ltrim(str_replace('\\', '/', Path::clean($rel_path . '/'. $filename )), '/');
$ext = strtolower(File::getExt($filename));
// Don't create thumbnails from defined files (don't save them into a database)...
$dontCreateThumb = PhocaGalleryFileThumbnail::dontCreateThumb ($filename);
if ($dontCreateThumb == 1) {
$ext = '';// WE USE $ext FOR NOT CREATE A THUMBNAIL CLAUSE
}
if ($ext == 'jpg' || $ext == 'png' || $ext == 'gif' || $ext == 'jpeg' || $ext == 'webp' || $ext == 'avif') {
if (File::exists($fullPath. '/'. $filename) &&
substr($filename, 0, 1) != '.' &&
strtolower($filename) !== 'index.html' &&
!$this->_ImageExist($existingImages, $storedfilename, $category_id) ) {
$row = $this->getTable('phocagallery');
$datam = array();
$datam['published'] = $data['published'];
$datam['catid'] = $category_id;
$datam['filename'] = $storedfilename;
$datam['approved'] = $data['approved'];
$datam['language'] = $data['language'];
if ($data['title'] != '') {
$datam['title'] = $data['title'];
$datam['title'] = str_replace('{###}', str_pad((string)$i, 3, '0', STR_PAD_LEFT), $datam['title']);
$datam['title'] = str_replace('{##}', str_pad((string)$i, 2, '0', STR_PAD_LEFT), $datam['title']);
$datam['title'] = str_replace('{#}', $i, $datam['title']);
} else {
$datam['title'] = PhocaGalleryFile::getTitleFromFile($filename);
}
if ($data['alias'] != '') {
$datam['alias'] = $data['alias'];
} else {
$datam['alias'] = $datam['title'];//PhocaGalleryText::getAliasName($datam['title']);
}
$datam['imgorigsize'] = PhocaGalleryFile::getFileSize($datam['filename'], 0);
$datam['format'] = PhocaGalleryFile::getFileFormat($datam['filename']);
// Geo
phocagalleryimport('phocagallery.geo.geo');
$coords = PhocaGalleryGeo::getGeoCoords($datam['filename']);
$datam['longitude'] = $coords['longitude'];
$datam['latitude'] = $coords['latitude'];
if ($datam['latitude'] != '' && $datam['longitude'] != ''){
$datam['zoom'] = PhocaGallerySettings::getAdvancedSettings('geozoom');
}
// Save
// Bind the form fields to the Phoca gallery table
if (!$row->bind($datam)) {
$this->setError($row->getError());
return false;
}
// Create the timestamp for the date
$row->date = gmdate('Y-m-d H:i:s');
// if new item, order last in appropriate group
if (!$row->id) {
$where = 'catid = ' . (int) $row->catid ;
$row->ordering = $row->getNextOrder( $where );
}
// Make sure the Phoca gallery table is valid
if (!$row->check()) {
$this->setError($row->getError());
return false;
}
// Store the Phoca gallery table to the database
if (!$row->store()) {
$this->setError($row->getError());
return false;
}
if ($this->firstImageFolder == '') {
$this->setFirstImageFolder($row->filename);
}
$image = new CMSObject();
$image->filename = $storedfilename ;
$image->catid = $category_id;
$existingImages[] = &$image ;
$count++ ;
$i++;
}
}
}
}
// $this->setImageCount($count);
return $count;
}
protected function _createCategoriesRecursive(&$origPathServer, $path, &$existingCategories, &$existingImages, $parentId = 0, $data = array() ) {
$totalresult = new stdClass();
$totalresult->image_count = 0 ;
$totalresult->category_count = 0 ;
$categoryName = basename($path);
$id = $this->_getCategoryId( $existingCategories, $categoryName, $parentId ) ;
$category = null;
// Full path: eg. "/home/www/joomla/images/categ/subcat/"
$fullPath = str_replace('\\', '/', Path::clean('/' . $path));
// Relative path eg "categ/subcat"
$relativePath = str_replace($origPathServer, '', $fullPath);
// Category doesn't exist
if ( $id == -1 ) {
$row = $this->getTable('phocagalleryc');
$row->published = $data['published'];
$row->approved = $data['approved'];
$row->language = $data['language'];
$row->parent_id = $parentId;
$row->title = $categoryName;
// Create the timestamp for the date
$row->date = gmdate('Y-m-d H:i:s');
// $row->alias = PhocaGalleryText::getAliasName($categoryName);
$row->userfolder = ltrim(str_replace('\\', '/', Path::clean($relativePath )), '/');
$row->ordering = $row->getNextOrder( "parent_id = " . $this->_db->Quote($row->parent_id) );
if (!$row->check()) {
throw new Exception('Check Problem', 500);
}
if (!$row->store()) {
throw new Exception('Store Problem', 500);
}
$category = new CMSObject();
$category->title = $categoryName ;
$category->parent_id = $parentId;
$category->id = $row->id;
$totalresult->category_count++;
$id = $category->id;
$existingCategories[] = &$category ;
$this->setCategoryCount(1);//This subcategory was added
}
// Add all images from this folder
$totalresult->image_count += $this->_addAllImagesFromFolder( $existingImages, $id, $path, $relativePath, $data );
$this->setImageCount($totalresult->image_count);
// Do sub folders
$parentId = $id;
$folderList = Folder::folders( $path, $filter = '.', $recurse = false, $fullpath = true, $exclude = array('thumbs') );
// Iterate over the folders if they exist
if ($folderList !== false) {
foreach ($folderList as $folder) {
//$this->setCategoryCount(1);//This subcategory was added
$folderName = $relativePath .'/' . str_replace($origPathServer, '', $folder);
$result = $this->_createCategoriesRecursive( $origPathServer, $folder, $existingCategories, $existingImages, $id , $data);
$totalresult->image_count += $result->image_count ;
$totalresult->category_count += $result->category_count ;
}
}
return $totalresult ;
}
/*
* Images
*/
function getFolderState($property = null) {
static $set;
if (!$set) {
$folder = Factory::getApplication()->input->get( 'folder', '', '', 'path' );
$this->setState('folder', $folder);
$parent = str_replace("\\", "/", dirname($folder));
$parent = ($parent == '.') ? null : $parent;
$this->setState('parent', $parent);
$set = true;
}
return parent::getState($property);
}
function getImages() {
$refreshUrl = 'index.php?option=com_phocagallery&view=phocagalleryi&tmpl=component';
$list = PhocaGalleryFileFolderList::getList(0,0,0,$refreshUrl);
return $list['Images'];
}
function getFolders() {
$refreshUrl = 'index.php?option=com_phocagallery&view=phocagalleryi&tmpl=component';
$list = PhocaGalleryFileFolderList::getList(0,0,0,$refreshUrl);
return $list['folders'];
}
}
?>

View File

@ -0,0 +1,250 @@
<?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\MVC\Model\ListModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Application\ApplicationHelper;
jimport('joomla.application.component.modellist');
class PhocaGalleryCpModelPhocaGalleryRa extends ListModel
{
protected $option = 'com_phocagallery';
public function __construct($config = array())
{
if (empty($config['filter_fields'])) {
$config['filter_fields'] = array(
'id', 'a.id',
'title', 'a.title',
'username','ua.username',
'date', 'a.date',
'alias', 'a.alias',
'checked_out', 'a.checked_out',
'checked_out_time', 'a.checked_out_time',
'category_id', 'category_id',
'state', 'a.state',
'ordering', 'a.ordering',
'language', 'a.language',
'hits', 'a.hits',
'published','a.published',
'rating', 'a.rating',
'category_title', 'category_title'
);
}
parent::__construct($config);
}
protected function populateState($ordering = 'ua.username', $direction = 'ASC')
{
// Initialise variables.
$app = Factory::getApplication('administrator');
// Load the filter state.
$search = $app->getUserStateFromRequest($this->context.'.filter.search', 'filter_search');
$this->setState('filter.search', $search);
/*
$accessId = $app->getUserStateFromRequest($this->context.'.filter.access', 'filter_access', null, 'int');
$this->setState('filter.access', $accessId);
$state = $app->getUserStateFromRequest($this->context.'.filter.published', 'filter_published', '', 'string');
$this->setState('filter.published', $state);
*/
$categoryId = $app->getUserStateFromRequest($this->context.'.filter.category_id', 'filter_category_id', null);
$this->setState('filter.category_id', $categoryId);
/*
$language = $app->getUserStateFromRequest($this->context.'.filter.language', 'filter_language', '');
$this->setState('filter.language', $language);
*/
// Load the parameters.
$params = ComponentHelper::getParams('com_phocagallery');
$this->setState('params', $params);
// List state information.
parent::populateState($ordering, $direction);
}
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':'.$this->getState('filter.search');
//$id .= ':'.$this->getState('filter.access');
//$id .= ':'.$this->getState('filter.published');
$id .= ':'.$this->getState('filter.category_id');
return parent::getStoreId($id);
}
protected function getListQuery()
{
/*
$query = ' SELECT a.*, cc.title AS category, ua.name AS editor, u.id AS ratinguserid, u.username AS ratingusername '
. ' FROM #__phocagallery_votes AS a '
. ' LEFT JOIN #__phocagallery_categories AS cc ON cc.id = a.catid '
. ' LEFT JOIN #__users AS ua ON ua.id = a.checked_out '
. ' LEFT JOIN #__users AS u ON u.id = a.userid'
. $where
. ' GROUP by a.id'
. $orderby
;
*/
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
// Select the required fields from the table.
$query->select(
$this->getState(
'list.select',
'a.*'
)
);
$query->from('`#__phocagallery_votes` AS a');
// Join over the language
$query->select('l.title AS language_title');
$query->join('LEFT', '`#__languages` AS l ON l.lang_code = a.language');
// Join over the users for the checked out user.
$query->select('ua.id AS ratinguserid, ua.username AS ratingusername, ua.name AS ratingname');
$query->join('LEFT', '#__users AS ua ON ua.id=a.userid');
$query->select('uc.name AS editor');
$query->join('LEFT', '#__users AS uc ON uc.id=a.checked_out');
/* // Join over the asset groups.
$query->select('ag.title AS access_level');
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
*/
// Join over the categories.
$query->select('c.title AS category_title, c.id AS category_id');
$query->join('LEFT', '#__phocagallery_categories AS c ON c.id = a.catid');
// Filter by access level.
/* if ($access = $this->getState('filter.access')) {
$query->where('a.access = '.(int) $access);
}*/
// Filter by published state.
$published = $this->getState('filter.published');
if (is_numeric($published)) {
$query->where('a.published = '.(int) $published);
}
else if ($published === '') {
$query->where('(a.published IN (0, 1))');
}
// Filter by category.
$categoryId = $this->getState('filter.category_id');
if (is_numeric($categoryId)) {
$query->where('a.catid = ' . (int) $categoryId);
}
// Filter by search in title
$search = $this->getState('filter.search');
if (!empty($search))
{
if (stripos($search, 'id:') === 0) {
$query->where('a.id = '.(int) substr($search, 3));
}
else
{
$search = $db->Quote('%'.$db->escape($search, true).'%');
$query->where('( ua.name LIKE '.$search.' OR ua.username LIKE '.$search.')');
}
}
//$query->group('a.id');
// Add the list ordering clause.
$orderCol = $this->state->get('list.ordering');
$orderDirn = $this->state->get('list.direction');
if ($orderCol == 'a.ordering' || $orderCol == 'category_title') {
$orderCol = 'category_title '.$orderDirn.', a.ordering';
}
$query->order($db->escape($orderCol.' '.$orderDirn));
//echo nl2br(str_replace('#__','jos_',$query));
return $query;
}
function delete($cid = array()) {
if (count( $cid )) {
\Joomla\Utilities\ArrayHelper::toInteger($cid);
$cids = implode( ',', $cid );
//Select affected catids
$query = 'SELECT v.catid AS catid'
. ' FROM #__phocagallery_votes AS v'
. ' WHERE v.id IN ( '.$cids.' )';
$catids = $this->_getList($query);
//Delete it from DB
$query = 'DELETE FROM #__phocagallery_votes'
. ' WHERE id IN ( '.$cids.' )';
$this->_db->setQuery( $query );
$this->_db->execute();
/*
if(!$this->_db->query()) {
$this->setError($this->_db->getErrorMsg());
return false;
}*/
phocagalleryimport('phocagallery.rate.ratecategory');
foreach ($catids as $valueCatid) {
$updated = PhocaGalleryRateCategory::updateVoteStatistics( $valueCatid->catid );
if(!$updated) {
return false;
}
}
}
return true;
}
protected function prepareTable($table)
{
jimport('joomla.filter.output');
$date = Factory::getDate();
$user = Factory::getUser();
$table->title = htmlspecialchars_decode($table->title, ENT_QUOTES);
$table->alias =ApplicationHelper::stringURLSafe($table->alias);
if (empty($table->alias)) {
$table->alias =ApplicationHelper::stringURLSafe($table->title);
}
if (empty($table->id)) {
// Set the values
//$table->created = $date->toSql();
// Set ordering to the last item if not set
if (empty($table->ordering)) {
$db = Factory::getDbo();
$db->setQuery('SELECT MAX(ordering) FROM #__phocagallery_votes WHERE catid = '.(int) $table->catid);
$max = $db->loadResult();
$table->ordering = $max+1;
}
}
else {
// Set the values
//$table->modified = $date->toSql();
//$table->modified_by = $user->get('id');
}
}
}
?>

View File

@ -0,0 +1,254 @@
<?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\MVC\Model\ListModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Application\ApplicationHelper;
jimport('joomla.application.component.modellist');
class PhocaGalleryCpModelPhocaGalleryRaImg extends ListModel
{
protected $option = 'com_phocagallery';
public function __construct($config = array())
{
if (empty($config['filter_fields'])) {
$config['filter_fields'] = array(
'id', 'a.id',
'title', 'a.title',
'username','ua.username',
'date', 'a.date',
'alias', 'a.alias',
'checked_out', 'a.checked_out',
'checked_out_time', 'a.checked_out_time',
'category_id', 'category_id',
'state', 'a.state',
'ordering', 'a.ordering',
'language', 'a.language',
'hits', 'a.hits',
'published','a.published',
'rating', 'a.rating',
'image_title', 'image_title',
'category_title', 'category_title'
);
}
parent::__construct($config);
}
protected function populateState($ordering = 'ua.username', $direction = 'ASC')
{
// Initialise variables.
$app = Factory::getApplication('administrator');
// Load the filter state.
$search = $app->getUserStateFromRequest($this->context.'.filter.search', 'filter_search');
$this->setState('filter.search', $search);
/*
$accessId = $app->getUserStateFromRequest($this->context.'.filter.access', 'filter_access', null, 'int');
$this->setState('filter.access', $accessId);
$state = $app->getUserStateFromRequest($this->context.'.filter.published', 'filter_published', '', 'string');
$this->setState('filter.published', $state);
*/
$categoryId = $app->getUserStateFromRequest($this->context.'.filter.category_id', 'filter_category_id', null);
$this->setState('filter.category_id', $categoryId);
/*
$language = $app->getUserStateFromRequest($this->context.'.filter.language', 'filter_language', '');
$this->setState('filter.language', $language);
*/
// Load the parameters.
$params = ComponentHelper::getParams('com_phocagallery');
$this->setState('params', $params);
// List state information.
parent::populateState($ordering, $direction);
}
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':'.$this->getState('filter.search');
//$id .= ':'.$this->getState('filter.access');
//$id .= ':'.$this->getState('filter.published');
$id .= ':'.$this->getState('filter.category_id');
return parent::getStoreId($id);
}
protected function getListQuery()
{
/*
$query = ' SELECT a.*, cc.title AS categorytitle, cc.id AS categoryid, i.title AS imagetitle, i.id AS imageid, ua.name AS editor, u.id AS ratinguserid, u.username AS ratingusername '
. ' FROM #__phocagallery_img_votes AS a '
. ' LEFT JOIN #__phocagallery AS i ON i.id = a.imgid '
. ' LEFT JOIN #__phocagallery_categories AS cc ON cc.id = i.catid '
. ' LEFT JOIN #__users AS ua ON ua.id = a.checked_out '
. ' LEFT JOIN #__users AS u ON u.id = a.userid'
. $where
. ' GROUP by a.id'
. $orderby;
*/
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
// Select the required fields from the table.
$query->select(
$this->getState(
'list.select',
'a.*'
)
);
$query->from('`#__phocagallery_img_votes` AS a');
// Join over the language
$query->select('l.title AS language_title');
$query->join('LEFT', '`#__languages` AS l ON l.lang_code = a.language');
// Join over the users for the checked out user.
$query->select('ua.id AS ratinguserid, ua.username AS ratingusername, ua.name AS ratingname');
$query->join('LEFT', '#__users AS ua ON ua.id=a.userid');
$query->select('uc.name AS editor');
$query->join('LEFT', '#__users AS uc ON uc.id=a.checked_out');
$query->select('i.title AS image_title, i.id AS image_id');
$query->join('LEFT', '#__phocagallery AS i ON i.id = a.imgid');
/* // Join over the asset groups.
$query->select('ag.title AS access_level');
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
*/
// Join over the categories.
$query->select('c.title AS category_title, c.id AS category_id');
$query->join('LEFT', '#__phocagallery_categories AS c ON c.id = i.catid');
// Filter by access level.
/* if ($access = $this->getState('filter.access')) {
$query->where('a.access = '.(int) $access);
}*/
// Filter by published state.
$published = $this->getState('filter.published');
if (is_numeric($published)) {
$query->where('a.published = '.(int) $published);
}
else if ($published === '') {
$query->where('(a.published IN (0, 1))');
}
// Filter by category.
$categoryId = $this->getState('filter.category_id');
if (is_numeric($categoryId)) {
$query->where('i.catid = ' . (int) $categoryId);
}
// Filter by search in title
$search = $this->getState('filter.search');
if (!empty($search))
{
if (stripos($search, 'id:') === 0) {
$query->where('a.id = '.(int) substr($search, 3));
}
else
{
$search = $db->Quote('%'.$db->escape($search, true).'%');
$query->where('( ua.name LIKE '.$search.' OR ua.username LIKE '.$search.')');
}
}
// $query->group('a.id');
// Add the list ordering clause.
$orderCol = $this->state->get('list.ordering');
$orderDirn = $this->state->get('list.direction');
if ($orderCol == 'a.ordering' || $orderCol == 'category_title') {
$orderCol = 'category_title '.$orderDirn.', a.ordering';
}
$query->order($db->escape($orderCol.' '.$orderDirn));
//echo nl2br(str_replace('#__','jos_',$query));
return $query;
}
function delete($cid = array()) {
if (count( $cid )) {
\Joomla\Utilities\ArrayHelper::toInteger($cid);
$cids = implode( ',', $cid );
//Select affected catids
$query = 'SELECT v.imgid AS imgid'
. ' FROM #__phocagallery_img_votes AS v'
. ' WHERE v.id IN ( '.$cids.' )';
$images = $this->_getList($query);
//Delete it from DB
$query = 'DELETE FROM #__phocagallery_img_votes'
. ' WHERE id IN ( '.$cids.' )';
$this->_db->setQuery( $query );
$this->_db->execute();
/*
if(!$this->_db->query()) {
$this->setError($this->_db->getErrorMsg());
return false;
}*/
phocagalleryimport('phocagallery.rate.rateimage');
foreach ($images as $valueImgId) {
$updated = PhocaGalleryRateImage::updateVoteStatistics( $valueImgId->imgid );
if(!$updated) {
return false;
}
}
}
return true;
}
protected function prepareTable($table)
{
jimport('joomla.filter.output');
$date = Factory::getDate();
$user = Factory::getUser();
$table->title = htmlspecialchars_decode($table->title, ENT_QUOTES);
$table->alias =ApplicationHelper::stringURLSafe($table->alias);
if (empty($table->alias)) {
$table->alias =ApplicationHelper::stringURLSafe($table->title);
}
if (empty($table->id)) {
// Set the values
//$table->created = $date->toSql();
// Set ordering to the last item if not set
if (empty($table->ordering)) {
$db = Factory::getDbo();
$db->setQuery('SELECT MAX(ordering) FROM #__phocagallery_img_votes WHERE imgid = '.(int) $table->imgid);
$max = $db->loadResult();
$table->ordering = $max+1;
}
}
else {
// Set the values
//$table->modified = $date->toSql();
//$table->modified_by = $user->get('id');
}
}
}
?>

View File

@ -0,0 +1,696 @@
<?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();
use Joomla\CMS\MVC\Model\AdminModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Filesystem\Folder;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Table\Table;
use Joomla\Registry\Registry;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Filesystem\Path;
use Joomla\CMS\Log\Log;
jimport( 'joomla.application.component.modeladmin' );
jimport( 'joomla.installer.installer' );
jimport( 'joomla.installer.helper' );
jimport( 'joomla.filesystem.folder' );
setlocale(LC_ALL, 'C.UTF-8', 'C');
class PhocaGalleryCpModelPhocaGalleryT extends AdminModel
{
protected $_paths = array();
protected $_manifest = null;
protected $option = 'com_phocagallery';
protected $text_prefix = 'com_phocagallery';
public $typeAlias = 'com_phocagallery.phocagalleryt';
function __construct(){
parent::__construct();
}
public function getForm($data = array(), $loadData = true) {
$app = Factory::getApplication();
$form = $this->loadForm('com_phocagallery.phocagalleryt', 'phocagalleryt', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form)) {
return false;
}
return $form;
}
function install($theme) {
$app = Factory::getApplication();
$db = Factory::getDBO();
$package = $this->_getPackageFromUpload();
if (!$package) {
$this->deleteTempFiles();
throw new Exception(Text::_('COM_PHOCAGALLERY_ERROR_FIND_INSTALL_PACKAGE'), 500);
return false;
}
if ($package['dir'] && Folder::exists($package['dir'])) {
$this->setPath('source', $package['dir']);
} else {
$this->deleteTempFiles();
throw new Exception(Text::_('COM_PHOCAGALLERY_ERROR_INSTALL_PATH_NOT_EXISTS'), 500);
return false;
}
// We need to find the installation manifest file
if (!$this->_findManifest()) {
$this->deleteTempFiles();
throw new Exception(Text::_('COM_PHOCAGALLERY_ERROR_FIND_INFO_INSTALL_PACKAGE'), 500);
return false;
}
// Files - copy files in manifest
foreach ($this->_manifest->children() as $child)
{
if (is_a($child, 'SimpleXMLElement') && $child->getName() == 'files') {
if ($this->parseFiles($child) === false) {
$this->deleteTempFiles();
throw new Exception(Text::_('COM_PHOCAGALLERY_ERROR_FIND_INFO_INSTALL_PACKAGE'), 500);
return false;
}
}
}
// File - copy the xml file
$copyFile = array();
$path['src'] = $this->getPath( 'manifest' ); // XML file will be copied too
$path['dest'] = JPATH_SITE.'/media/com_phocagallery/images/'. basename($this->getPath('manifest'));
$copyFile[] = $path;
$this->copyFiles($copyFile, array());
$this->deleteTempFiles();
// -------------------
// Themes
// -------------------
// Params - Get new themes params
$paramsThemes = $this->getParamsThemes();
// -------------------
// Component
// -------------------
if (isset($theme['component']) && $theme['component'] == 1 ) {
$component = 'com_phocagallery';
$paramsC = ComponentHelper::getParams($component) ;
if (!empty($paramsThemes)) {
foreach ($paramsThemes as $keyT => $valueT) {
$paramsC->set($valueT['name'], $valueT['value']);
}
}
$data['params'] = $paramsC->toArray();
$table = Table::getInstance('extension');
$idCom = $table->find( array('element' => $component ));
$table->load($idCom);
if (!$table->bind($data)) {
throw new Exception('Not a valid component', 500);
return false;
}
// pre-save checks
if (!$table->check()) {
throw new Exception($table->getError('Check Problem'), 500);
return false;
}
// save the changes
if (!$table->store()) {
throw new Exception($table->getError('Store Problem'), 500);
return false;
}
}
// -------------------
// Menu Categories
// -------------------
/* if (isset($theme['categories']) && $theme['categories'] == 1 ){
$link = 'index.php?option=com_phocagallery&view=categories';
$where = Array();
$where[] = 'link = '. $db->Quote($link);
$query = 'SELECT id, params FROM #__menu WHERE '. implode(' AND ', $where);
$db->setQuery($query);
$itemsCat = $db->loadObjectList();
if (!empty($itemsCat)) {
foreach($itemsCat as $keyIT => $valueIT) {
$query = 'SELECT m.params FROM #__menu AS m WHERE m.id = '.(int) $valueIT->id;
$db->setQuery( $query );
$paramsCJSON = $db->loadResult();
//$paramsCJSON = $valueIT->params;
//$paramsMc = new J Parameter;
//$paramsMc->loadJSON($paramsCJSON);
$paramsMc = new Registry;
$paramsMc->loadString($paramsCJSON, 'JSON');
foreach($paramsThemes as $keyT => $valueT) {
$paramsMc->set($valueT['name'], $valueT['value']);
}
$dataMc['params'] = $paramsMc->toArray();
$table = Table::getInstance( 'menu' );
if (!$table->load((int) $valueIT->id)) {
throw new Exception('Not a valid table', 500);
return false;
}
if (!$table->bind($dataMc)) {
throw new Exception('Not a valid table', 500);
return false;
}
// pre-save checks
if (!$table->check()) {
throw new Exception($table->getError('Check Problem'), 500);
return false;
}
// save the changes
if (!$table->store()) {
throw new Exception($table->getError('Store Problem'), 500);
return false;
}
}
}
}*/
// -------------------
// Menu Category
// -------------------
/* if (isset($theme['category']) && $theme['category'] == 1 ) {
// Select all categories to get possible menu links
$query = 'SELECT c.id FROM #__phocagallery_categories AS c';
$db->setQuery( $query );
$categoriesId = $db->loadObjectList();
// We get id from Phoca Gallery categories and try to find menu links from these categories
if (!empty ($categoriesId)) {
foreach($categoriesId as $keyI => $valueI) {
$link = 'index.php?option=com_phocagallery&view=category&id='.(int)$valueI->id;
//$link = 'index.php?option=com_phocagallery&view=category';
$where = Array();
$where[] = 'link = '. $db->Quote($link);
$query = 'SELECT id, params FROM #__menu WHERE '. implode(' AND ', $where);
$db->setQuery($query);
$itemsCat = $db->loadObjectList();
if (!empty ($itemsCat)) {
foreach($itemsCat as $keyIT2 => $valueIT2) {
$query = 'SELECT m.params FROM #__menu AS m WHERE m.id = '.(int) $valueIT2->id;
$db->setQuery( $query );
$paramsCtJSON = $db->loadResult();
//$paramsCtJSON = $valueIT2->params;
//$paramsMct = new J Parameter;
//$paramsMct->loadJSON($paramsCtJSON);
$paramsMc = new Registry;
$paramsMc->loadString($paramsCJSON, 'JSON');
/*foreach($paramsThemes as $keyT => $valueT) {
$paramsMct->set($valueT['name'], $valueT['value']);
}
$dataMct['params'] = $paramsMct->toArray();
*//*
$table = Table::getInstance( 'menu' );
if (!$table->load((int) $valueIT2->id)) {
throw new Exception('Not a valid table', 500);
return false;
}
if (!$table->bind($dataMct)) {
throw new Exception('Not a valid table', 500);
return false;
}
// pre-save checks
if (!$table->check()) {
throw new Exception($table->getError('Check Problem'), 500);
return false;
}
// save the changes
if (!$table->store()) {
throw new Exception($table->getError('Store Problem'), 500);
return false;
}
}
}
}
}
}*/
return true;
}
function _getPackageFromUpload()
{
// Get the uploaded file information
$userfile = Factory::getApplication()->input->files->get( 'Filedata', null, 'raw' );
// Make sure that file uploads are enabled in php
if (!(bool) ini_get('file_uploads')) {
throw new Exception(Text::_('COM_PHOCAGALLERY_ERROR_INSTALL_FILE_UPLOAD'), 500);
return false;
}
// Make sure that zlib is loaded so that the package can be unpacked
if (!extension_loaded('zlib')) {
throw new Exception(Text::_('COM_PHOCAGALLERY_ERROR_INSTALL_ZLIB'), 500);
return false;
}
// If there is no uploaded file, we have a problem...
if (!is_array($userfile) ) {
throw new Exception(Text::_('COM_PHOCAGALLERY_ERROR_NO_FILE_SELECTED'), 500);
return false;
}
// Check if there was a problem uploading the file.
if ( $userfile['error'] || $userfile['size'] < 1 ) {
throw new Exception(Text::_('COM_PHOCAGALLERY_ERROR_UPLOAD_FILE'), 500);
return false;
}
// Build the appropriate paths
$config = Factory::getConfig();
$tmp_dest = $config->get('tmp_path'). '/'. $userfile['name'];
$tmp_src = $userfile['tmp_name'];
// Move uploaded file
jimport('joomla.filesystem.file');
$uploaded = File::upload($tmp_src, $tmp_dest, false, true);
// Unpack the downloaded package file
$package = self::unpack($tmp_dest);
///$this->_manifest =& $manifest;
$this->setPath('packagefile', $package['packagefile']);
$this->setPath('extractdir', $package['extractdir']);
return $package;
}
function getPath($name, $default=null) {
return (!empty($this->_paths[$name])) ? $this->_paths[$name] : $default;
}
function setPath($name, $value) {
$this->_paths[$name] = $value;
}
function _findManifest() {
// Get an array of all the xml files from teh installation directory
$xmlfiles = Folder::files($this->getPath('source'), '.xml$', 1, true);
// If at least one xml file exists
if (count($xmlfiles) > 0) {
foreach ($xmlfiles as $file)
{
// Is it a valid joomla installation manifest file?
$manifest = $this->_isManifest($file);
if (!is_null($manifest)) {
$attr = $manifest->attributes();
if ((string)$attr['method'] != 'phocagallerytheme') {
throw new Exception(Text::_('COM_PHOCAGALLERY_ERROR_NO_THEME_FILE'), 500);
return false;
}
// Set the manifest object and path
$this->_manifest = $manifest;
$this->setPath('manifest', $file);
// Set the installation source path to that of the manifest file
$this->setPath('source', dirname($file));
return true;
}
}
// None of the xml files found were valid install files
throw new Exception(Text::_('COM_PHOCAGALLERY_ERROR_XML_INSTALL_PHOCA'), 500);
return false;
} else {
// No xml files were found in the install folder
throw new Exception(Text::_('COM_PHOCAGALLERY_ERROR_XML_INSTALL'), 500);
return false;
}
}
function _isManifest($file) {
$xml = simplexml_load_file($file);
if (!$xml) {
unset ($xml);
return null;
}
if (!is_object($xml) || ($xml->getName() != 'install' )) {
unset ($xml);
return null;
}
return $xml;
}
function parseFiles($element, $cid=0) {
$copyfiles = array();
$copyfolders = array();
if (!is_a($element, 'SimpleXMLElement') || !count($element->children())) {
return 0;// Either the tag does not exist or has no children therefore we return zero files processed.
}
$files = $element->children();// Get the array of file nodes to process
if (count($files) == 0) {
return 0;// No files to process
}
$source = $this->getPath('source');
$destination = JPATH_SITE.'/media/com_phocagallery';
//$destination2 = JPATH_SITE.'/media/com_phocagallery';
//foreach ($files as $file) {
//if ($file->na me() == 'folder') {
if(!empty($files->folder)){
foreach ($files->folder as $fk => $fv) {
$path['src'] = $source.'/'.$fv;
$path['dest'] = $destination.'/'.$fv;
$copyfolders[] = $path;
}
}
//}
//}
if (!empty($files->filename)) {
foreach($files->filename as $fik => $fiv) {
$path['src'] = $source.'/'.$fiv;
$path['dest'] = $destination.'/'.$fiv;
$copyfiles[] = $path;
}
}
return $this->copyFiles($copyfiles, $copyfolders);
}
function copyFiles($files, $folders) {
$i = 0;
$fileIncluded = $folderIncluded = 0;
if (is_array($folders) && count($folders) > 0)
{
foreach ($folders as $folder)
{
// Get the source and destination paths
$foldersource = Path::clean($folder['src']);
$folderdest = Path::clean($folder['dest']);
// Get info about custom css and disable all other custom css in database
$foldersource2 = str_replace('\\', '/', $foldersource);
$folder_array = explode('/', $foldersource2);
$count_array = count($folder_array);//Count this array
$last_array_value = $count_array - 1;
$folder_name = $folder_array[$last_array_value];
if ($folder_name == 'css') {
$filesF = scandir($foldersource . '/' . 'custom');
if (!empty($filesF)) {
foreach($filesF as $kF => $vF) {
//$s = strtolower($vF);
//$f = 'custom_';
//$pos = strpos($s, $f);
//if ($pos === false) {
//} else {
$db =Factory::getDBO();
// disable all other custom files
$query = ' UPDATE #__phocagallery_styles SET published = 0 WHERE type = 2';
$db->setQuery($query);
$db->execute();
// disable the default style - simple
$query = ' UPDATE #__phocagallery_styles SET published = 0 WHERE type = 1 AND filename = "theme_simple.css"';
$db->setQuery($query);
$db->execute();
// enable the uploaded custom file
$query = ' UPDATE #__phocagallery_styles SET published = 1 WHERE type = 2 AND filename = '.$db->quote($vF);
$db->setQuery($query);
$db->execute();
//}
}
}
}
if (!Folder::exists($foldersource)) {
throw new Exception(Text::sprintf('COM_PHOCAGALLERY_FOLDER_NOT_EXISTS', $foldersource), 500);
return false;
} else {
if (!(Folder::copy($foldersource, $folderdest, '', true))) {
throw new Exception(Text::sprintf('COM_PHOCAGALLERY_ERROR_COPY_FOLDER_TO', $foldersource, $folderdest), 500);
return false;
} else {
$i++;
}
}
}
$folderIncluded = 1;
}
if (is_array($files) && count($files) > 0)
{
foreach ($files as $file)
{
// Get the source and destination paths
$filesource = Path::clean($file['src']);
$filedest = Path::clean($file['dest']);
if (!file_exists($filesource)) {
throw new Exception(Text::sprintf('COM_PHOCAGALLERY_FILE_NOT_EXISTS', $filesource), 500);
return false;
} else {
if (!(File::copy($filesource, $filedest))) {
throw new Exception(Text::sprintf('COM_PHOCAGALLERY_ERROR_COPY_FILE_TO', $filesource, $filedest), 500);
return false;
} else {
$i++;
}
}
}
$fileIncluded = 1;
}
if ($fileIncluded == 0 && $folderIncluded ==0) {
throw new Exception(Text::sprintf('COM_PHOCAGALLERY_ERROR_INSTALL_FILE'), 500);
return false;
}
return $i;// Possible TO DO, now it returns count folders and files togeter, //return count($files);
}
protected function getParamsThemes() {
$element = $this->_manifest->children()->params;
if (!is_a($element, 'SimpleXMLElement') || !count($element->children())) {
return null;// Either the tag does not exist or has no children therefore we return zero files processed.
}
$params = $element->children();
if (count($params) == 0) {
return null;// No params to process
}
// Process each parameter in the $params array.
$paramsArray = array();
$i=0;
foreach ($params as $param) {
if (!$name = $param['name']) {
continue;
}
if (!$value = $param['default']) {
continue;
}
$paramsArray[$i]['name'] = (string)$name;
$paramsArray[$i]['value'] = (string)$value;
$i++;
}
return $paramsArray;
}
function deleteTempFiles() {
$path = $this->getPath('source');
if (is_dir($path)) {
$val = Folder::delete($path);
} else if (is_file($path)) {
$val = File::delete($path);
}
$packageFile = $this->getPath('packagefile');
if (is_file($packageFile)) {
$val = File::delete($packageFile);
}
$extractDir = $this->getPath('extractdir');
if (is_dir($extractDir)) {
$val = Folder::delete($extractDir);
}
}
public static function unpack($p_filename)
{
// Path to the archive
$archivename = $p_filename;
// Temporary folder to extract the archive into
$tmpdir = uniqid('install_');
// Clean the paths to use for archive extraction
$extractdir = Path::clean(dirname($p_filename) . '/' . $tmpdir);
$archivename = Path::clean($archivename);
// Do the unpacking of the archive
try
{
$archive = new \Joomla\Archive\Archive;
$archive->extract($archivename, $extractdir);
}
catch (Exception $e)
{
return false;
}
/*
* Let's set the extraction directory and package file in the result array so we can
* cleanup everything properly later on.
*/
$retval['extractdir'] = $extractdir;
$retval['packagefile'] = $archivename;
/*
* Try to find the correct install directory. In case the package is inside a
* subdirectory detect this and set the install directory to the correct path.
*
* List all the items in the installation directory. If there is only one, and
* it is a folder, then we will set that folder to be the installation folder.
*/
$dirList = array_merge(Folder::files($extractdir, ''), Folder::folders($extractdir, ''));
if (count($dirList) == 1)
{
if (Folder::exists($extractdir . '/' . $dirList[0]))
{
$extractdir = Path::clean($extractdir . '/' . $dirList[0]);
}
}
/*
* We have found the install directory so lets set it and then move on
* to detecting the extension type.
*/
$retval['dir'] = $extractdir;
/*
* Get the extension type and return the directory/type array on success or
* false on fail.
*/
$retval['type'] = self::detectType($extractdir);
if ($retval['type'])
{
return $retval;
}
else
{
return false;
}
}
public static function detectType($p_dir)
{
// Search the install dir for an XML file
$files = Folder::files($p_dir, '\.xml$', 1, true);
if (!count($files))
{
Log::add(Text::_('JLIB_INSTALLER_ERROR_NOTFINDXMLSETUPFILE'), Log::WARNING, ' ');
return false;
}
foreach ($files as $file)
{
$xml = simplexml_load_file($file);
if (!$xml)
{
continue;
}
if ($xml->getName() != 'install')
{
unset($xml);
continue;
}
$type = (string) $xml->attributes()->type;
// Free up memory
unset($xml);
return $type;
}
Log::add(Text::_('JLIB_INSTALLER_ERROR_NOTFINDJOOMLAXMLSETUPFILE'), Log::WARNING, ' ');
// Free up memory.
unset($xml);
return false;
}
}
?>

View File

@ -0,0 +1,97 @@
<?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\MVC\Model\AdminModel;
use Joomla\CMS\Table\Table;
use Joomla\CMS\Factory;
use Joomla\CMS\Application\ApplicationHelper;
jimport('joomla.application.component.modeladmin');
class PhocaGalleryCpModelPhocaGalleryTag extends AdminModel
{
protected $option = 'com_phocagallery';
protected $text_prefix = 'com_phocagallery';
public $typeAlias = 'com_phocagallery.phocagallerytag';
protected function canDelete($record)
{
//$user = JFactory::getUser();
return parent::canDelete($record);
}
protected function canEditState($record)
{
//$user = JFactory::getUser();
return parent::canEditState($record);
}
public function getTable($type = 'PhocaGalleryTag', $prefix = 'Table', $config = array())
{
return Table::getInstance($type, $prefix, $config);
}
public function getForm($data = array(), $loadData = true) {
$app = Factory::getApplication();
$form = $this->loadForm('com_phocagallery.phocagallerytag', 'phocagallerytag', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form)) {
return false;
}
return $form;
}
protected function loadFormData()
{
// Check the session for previously entered form data.
$data = Factory::getApplication()->getUserState('com_phocagallery.edit.phocagallerytag.data', array());
if (empty($data)) {
$data = $this->getItem();
}
return $data;
}
protected function prepareTable($table)
{
jimport('joomla.filter.output');
$date = Factory::getDate();
$user = Factory::getUser();
$table->title = htmlspecialchars_decode($table->title, ENT_QUOTES);
$table->alias =ApplicationHelper::stringURLSafe($table->alias);
if (empty($table->alias)) {
$table->alias =ApplicationHelper::stringURLSafe($table->title);
}
if (empty($table->id)) {
// Set the values
//$table->created = $date->toSql();
// Set ordering to the last item if not set
if (empty($table->ordering)) {
$db = Factory::getDbo();
$db->setQuery('SELECT MAX(ordering) FROM #__phocagallery_tags');
$max = $db->loadResult();
$table->ordering = $max+1;
}
}
else {
// Set the values
//$table->modified = $date->toSql();
//$table->modified_by = $user->get('id');
}
}
}
?>

View File

@ -0,0 +1,154 @@
<?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\MVC\Model\ListModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Component\ComponentHelper;
jimport('joomla.application.component.modellist');
class PhocaGalleryCpModelPhocaGalleryTags extends ListModel
{
protected $option = 'com_phocagallery';
public function __construct($config = array())
{
if (empty($config['filter_fields'])) {
$config['filter_fields'] = array(
'id', 'a.id',
'title', 'a.title',
'alias', 'a.alias',
'checked_out', 'a.checked_out',
'checked_out_time', 'a.checked_out_time',
'ordering', 'a.ordering',
'published','a.published',
);
}
parent::__construct($config);
}
protected function populateState($ordering = 'a.title', $direction = 'ASC')
{
// Initialise variables.
$app = Factory::getApplication('administrator');
// Load the filter state.
$search = $app->getUserStateFromRequest($this->context.'.filter.search', 'filter_search');
$this->setState('filter.search', $search);
/* $accessId = $app->getUserStateFromRequest($this->context.'.filter.access', 'filter_access', null, 'int');
$this->setState('filter.access', $accessId);*/
$state = $app->getUserStateFromRequest($this->context.'.filter.published', 'filter_published', '', 'string');
$this->setState('filter.published', $state);
//$language = $app->getUserStateFromRequest($this->context.'.filter.language', 'filter_language', '');
//$this->setState('filter.language', $language);
// Load the parameters.
$params = ComponentHelper::getParams('com_phocagallery');
$this->setState('params', $params);
// List state information.
parent::populateState($ordering, $direction);
}
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':'.$this->getState('filter.search');
//$id .= ':'.$this->getState('filter.access');
$id .= ':'.$this->getState('filter.published');
$id .= ':'.$this->getState('filter.tag_id');
return parent::getStoreId($id);
}
protected function getListQuery()
{
/*
$query = ' SELECT a.*, u.name AS editor '
. ' FROM #__PhocaGallery_licenses AS a '
. ' LEFT JOIN #__users AS u ON u.id = a.checked_out '
*/
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
// Select the required fields from the table.
$query->select(
$this->getState(
'list.select',
'a.*'
)
);
$query->from('`#__phocagallery_tags` AS a');
// Join over the language
//$query->select('l.title AS language_title');
//$query->join('LEFT', '`#__languages` AS l ON l.lang_code = a.language');
// Join over the users for the checked out user.
$query->select('uc.name AS editor');
$query->join('LEFT', '#__users AS uc ON uc.id=a.checked_out');
// Filter by access level.
/* if ($access = $this->getState('filter.access')) {
$query->where('a.access = '.(int) $access);
}*/
// Filter by published state.
$published = $this->getState('filter.published');
if (is_numeric($published)) {
$query->where('a.published = '.(int) $published);
}
else if ($published === '') {
$query->where('(a.published IN (0, 1))');
}
// Filter by search in title
$search = $this->getState('filter.search');
if (!empty($search))
{
if (stripos($search, 'id:') === 0) {
$query->where('a.id = '.(int) substr($search, 3));
}
else
{
$search = $db->Quote('%'.$db->escape($search, true).'%');
$query->where('( a.title LIKE '.$search.' OR a.alias LIKE '.$search.')');
}
}
$orderCol = $this->state->get('list.ordering');
$orderDirn = $this->state->get('list.direction');
$query->order($db->escape($orderCol.' '.$orderDirn));
//echo nl2br(str_replace('#__', 'jos_', $query->__toString()));
return $query;
}
}
?>

View File

@ -0,0 +1,227 @@
<?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\MVC\Model\AdminModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Table\Table;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Application\ApplicationHelper;
jimport('joomla.application.component.modeladmin');
class PhocaGalleryCpModelPhocaGalleryUser extends AdminModel
{
protected $option = 'com_phocagallery';
protected $text_prefix = 'com_phocagallery';
public $typeAlias = 'com_phocagallery.phocagalleryuser';
protected function canDelete($record)
{
$user = Factory::getUser();
/*if (!empty($record->catid)) {
return $user->authorise('core.delete', 'com_phocagallery.phocagalleryuser');
} else {*/
return parent::canDelete($record);
//}
}
protected function canEditState($record)
{
$user = Factory::getUser();
/*if (!empty($record->catid)) {
return $user->authorise('core.edit.state', 'com_phocagallery.phocagalleryuser');
} else {*/
return parent::canEditState($record);
//}
}
public function getTable($type = 'PhocaGalleryUser', $prefix = 'Table', $config = array())
{
return Table::getInstance($type, $prefix, $config);
}
public function getForm($data = array(), $loadData = true) {
$app = Factory::getApplication();
$form = $this->loadForm('com_phocagallery.phocagalleryuser', 'phocagalleryuser', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form)) {
return false;
}
return $form;
}
protected function loadFormData()
{
// Check the session for previously entered form data.
$data = Factory::getApplication()->getUserState('com_phocagallery.edit.phocagalleryuser.data', array());
if (empty($data)) {
$data = $this->getItem();
}
return $data;
}
/*protected function getReorderConditions($table = null)
{
$condition = array();
//$condition[] = 'catid = '. (int) $table->catid;
//$condition[] = 'state >= 0';
return $condition;
}*/
function approve(&$pks, $value = 1)
{
// Initialise variables.
//$dispatcher = JDispatcher::getInstance();
$user = Factory::getUser();
$table = $this->getTable('phocagalleryuser');
$pks = (array) $pks;
// Include the content plugins for the change of state event.
PluginHelper::importPlugin('content');
// Access checks.
foreach ($pks as $i => $pk) {
if ($table->load($pk)) {
if (!$this->canEditState($table)) {
// Prune items that you can't change.
unset($pks[$i]);
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_EDIT_STATE_NOT_PERMITTED'), 403);
}
}
}
// Attempt to change the state of the records.
if (!$table->approve($pks, $value, $user->get('id'))) {
$this->setError($table->getError());
return false;
}
$context = $this->option.'.'.$this->name;
// Trigger the onContentChangeState event.
/*$result = $dispatcher->trigger($this->event_change_state, array($context, $pks, $value));
if (in_array(false, $result, true)) {
$this->setError($table->getError());
return false;
}*/
return true;
}
/*
var $_id = null;
function __construct() {
parent::__construct();
$array = Factory::getApplication()->input->get('cid', 0, '', 'array');
$this->setId((int)$array[0]);
}
function setId($id) {
$this->_id = $id;
}
*/
/*TO DO - add rules like in approve */
function delete(&$cid = array()) {
if (count( $cid )) {
\Joomla\Utilities\ArrayHelper::toInteger($cid);
$cids = implode( ',', $cid );
//Delete it from DB
$query = 'UPDATE #__phocagallery_user'
. ' SET avatar = ""'
. ' WHERE id IN ( '.$cids.' )';
$this->_db->setQuery( $query );
$this->_db->execute();
/*if(!$this->_db->query()) {
$this->setError($this->_db->getErrorMsg());
return false;
}*/
}
return true;
}
/*TO DO - add rules like in approve */
function approveall() {
//$user =& JFactory::getUser();
$query = 'UPDATE #__phocagallery'
. ' SET approved = 1';
//. ' AND ( checked_out = 0 OR ( checked_out = '.(int) $user->get('id').' ) )';
$this->_db->setQuery( $query );
$this->_db->execute();
/*if (!$this->_db->query()) {
$this->setError($this->_db->getErrorMsg());
return false;
}*/
$query = 'UPDATE #__phocagallery_categories'
. ' SET approved = 1';
$this->_db->setQuery( $query );
$this->_db->execute();
/*
if (!$this->_db->query()) {
$this->setError($this->_db->getErrorMsg());
return false;
}*/
return true;
}
protected function prepareTable($table)
{
jimport('joomla.filter.output');
$date = Factory::getDate();
$user = Factory::getUser();
$table->title = htmlspecialchars_decode($table->title, ENT_QUOTES);
$table->alias =ApplicationHelper::stringURLSafe($table->alias);
if (empty($table->alias)) {
$table->alias = ApplicationHelper::stringURLSafe($table->title);
}
if (empty($table->id)) {
// Set the values
//$table->created = $date->toSql();
// Set ordering to the last item if not set
if (empty($table->ordering)) {
$db = Factory::getDbo();
$db->setQuery('SELECT MAX(ordering) FROM #__phocagallery_user');
$max = $db->loadResult();
$table->ordering = $max+1;
}
}
else {
// Set the values
//$table->modified = $date->toSql();
//$table->modified_by = $user->get('id');
}
}
}
?>

View File

@ -0,0 +1,269 @@
<?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\MVC\Model\ListModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Component\ComponentHelper;
jimport('joomla.application.component.modellist');
jimport( 'joomla.filesystem.folder' );
jimport( 'joomla.filesystem.file' );
phocagalleryimport( 'phocagallery.file.filefolder' );
class PhocaGalleryCpModelPhocaGalleryUsers extends ListModel
{
protected $option = 'com_phocagallery';
public $context = 'com_phocagallery.phocagalleryusers';
public function __construct($config = array())
{
if (empty($config['filter_fields'])) {
$config['filter_fields'] = array(
'id', 'a.id',
'username', 'ua.username',
'checked_out', 'a.checked_out',
'checked_out_time', 'a.checked_out_time',
'category_id', 'category_id',
'state', 'a.state',
'access', 'a.access', 'access_level',
'ordering', 'a.ordering',
'language', 'a.language',
'hits', 'a.hits',
'published','a.published',
'authorized','a.approved'
);
}
parent::__construct($config);
}
protected function populateState($ordering = 'ua.username', $direction = 'ASC')
{
// Initialise variables.
$app = Factory::getApplication('administrator');
// Load the filter state.
$search = $app->getUserStateFromRequest($this->context.'.filter.search', 'filter_search');
$this->setState('filter.search', $search);
/*
$accessId = $app->getUserStateFromRequest($this->context.'.filter.access', 'filter_access', null, 'int');
$this->setState('filter.access', $accessId);
*/
$state = $app->getUserStateFromRequest($this->context.'.filter.published', 'filter_published', '', 'string');
$this->setState('filter.published', $state);
/*
$categoryId = $app->getUserStateFromRequest($this->context.'.filter.category_id', 'filter_category_id', null);
$this->setState('filter.category_id', $categoryId);
$language = $app->getUserStateFromRequest($this->context.'.filter.language', 'filter_language', '');
$this->setState('filter.language', $language);
*/
// Load the parameters.
$params = ComponentHelper::getParams('com_phocagallery');
$this->setState('params', $params);
// List state information.
parent::populateState($ordering, $direction);
}
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':'.$this->getState('filter.search');
//$id .= ':'.$this->getState('filter.access');
$id .= ':'.$this->getState('filter.published');
return parent::getStoreId($id);
}
protected function getListQuery()
{
/*
$query = ' SELECT a.*, us.name AS username, u.name AS editor, c.countcid, i.countiid'
. ' FROM #__phocagallery_user AS a '
. ' LEFT JOIN #__users AS us ON us.id = a.userid '
. ' LEFT JOIN #__users AS u ON u.id = a.checked_out '
. ' LEFT JOIN (SELECT c.owner_id, c.id, count(*) AS countcid'
. ' FROM #__phocagallery_categories AS c'
. ' GROUP BY c.owner_id) AS c '
. ' ON a.userid = c.owner_id'
. ' LEFT JOIN (SELECT i.catid, uc.userid AS uid, count(i.id) AS countiid'
. ' FROM #__phocagallery AS i'
. ' LEFT JOIN #__phocagallery_categories AS cc ON cc.id = i.catid'
. ' LEFT JOIN #__phocagallery_user AS uc ON uc.userid = cc.owner_id'
//. ' WHERE cc.owner_id = uc.userid'
//. ' AND cc.id = i.catid'
. ' GROUP BY uc.userid'
. ' ) AS i '
. ' ON i.uid = c.owner_id'
. $where
. $orderby;
*/
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
// Select the required fields from the table.
$query->select(
$this->getState(
'list.select',
'a.id, a.ordering, a.avatar, a.published, a.approved'
)
);
$query->from('#__phocagallery_user AS a');
// Join over the language
$query->select('l.title AS language_title');
$query->join('LEFT', '#__languages AS l ON l.lang_code = a.language');
// Join over the users for the checked out user.
$query->select('ua.id AS userid, ua.username AS username, ua.name AS usernameno');
$query->join('LEFT', '#__users AS ua ON ua.id=a.userid');
$query->select('uc.name AS editor');
$query->join('LEFT', '#__users AS uc ON uc.id=a.checked_out');
$query->select('c.countcid');
/*$query->join('LEFT', '(SELECT c.owner_id, c.id, count(*) AS countcid'
. ' FROM #__phocagallery_categories AS c'
. ' GROUP BY c.owner_id, c.id) AS c '
. ' ON a.userid = c.owner_id ');*/
$query->join('LEFT', '(SELECT c.owner_id,count(c.id) AS countcid'
. ' FROM #__phocagallery_categories AS c'
. ' GROUP BY c.owner_id) AS c '
. ' ON a.userid = c.owner_id ');
$query->select('i.countiid');
/*$query->join('LEFT', '(SELECT i.catid, uc.userid AS uid, count(i.id) AS countiid'
. ' FROM #__phocagallery AS i'
. ' LEFT JOIN #__phocagallery_categories AS cc ON cc.id = i.catid'
. ' LEFT JOIN #__phocagallery_user AS uc ON uc.userid = cc.owner_id'
. ' GROUP BY uc.userid, i.catid'
. ' ) AS i '
. ' ON i.uid = c.owner_id');*/
$query->join('LEFT', '(SELECT uc.userid AS uid, count(i.id) AS countiid'
. ' FROM #__phocagallery AS i'
. ' LEFT JOIN #__phocagallery_categories AS cc ON cc.id = i.catid'
. ' LEFT JOIN #__phocagallery_user AS uc ON uc.userid = cc.owner_id'
. ' GROUP BY uc.userid'
. ' ) AS i '
. ' ON i.uid = c.owner_id');
/* // Join over the asset groups.
$query->select('ag.title AS access_level');
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
*/
// Filter by access level.
/* if ($access = $this->getState('filter.access')) {
$query->where('a.access = '.(int) $access);
}*/
// Filter by published state.
$published = $this->getState('filter.published');
if (is_numeric($published)) {
$query->where('a.published = '.(int) $published);
}
else if ($published === '') {
$query->where('(a.published IN (0, 1))');
}
// Filter by category.
/*$categoryId = $this->getState('filter.category_id');
if (is_numeric($categoryId)) {
$query->where('a.catid = ' . (int) $categoryId);
}*/
// Filter by search in title
$search = $this->getState('filter.search');
if (!empty($search))
{
if (stripos($search, 'id:') === 0) {
$query->where('a.id = '.(int) substr($search, 3));
}
else
{
$search = $db->Quote('%'.$db->escape($search, true).'%');
$query->where('( ua.name LIKE '.$search.' OR ua.username LIKE '.$search.')');
}
}
$query->group('ua.id, a.id, l.title, ua.username, ua.name, uc.name, c.countcid, i.countiid, a.ordering, a.avatar, a.published, a.approved');
// Add the list ordering clause.
$orderCol = $this->state->get('list.ordering');
$orderDirn = $this->state->get('list.direction');
/*if ($orderCol == 'a.ordering' || $orderCol == 'username') {
$orderCol = 'username '.$orderDirn.', a.ordering';
}*/
$query->order($db->escape($orderCol.' '.$orderDirn));
//echo nl2br(str_replace('#__', 'jos_', $query->__toString()));
return $query;
}
function getOwnerMainCategory($userId) {
$query = 'SELECT cc.*'
. ' FROM #__phocagallery_categories AS cc'
. ' WHERE cc.owner_id = '.(int)$userId
//. ' AND cc.id <> '.(int)$categoryId // Check other categories
. ' AND cc.owner_id > 0' // Ignore -1
. ' AND cc.parent_id = 0';
$this->_db->setQuery( $query );
$ownerMainCategoryId = $this->_db->loadObject();
if (isset($ownerMainCategoryId->id)) {
return $ownerMainCategoryId;
}
return false;
}
function getCountUserSubCat($userId) {
$query = 'SELECT count(cc.id) AS countid'
. ' FROM #__phocagallery_categories AS cc'
. ' WHERE cc.owner_id = '.(int)$userId
. ' AND cc.parent_id <> 0';
$this->_db->setQuery( $query );
$categoryCount = $this->_db->loadObject();
if (isset($categoryCount->countid)) {
return $categoryCount->countid;
}
return 0;
}
function getCountUserImage($userId) {
$query = 'SELECT count(a.id) AS count'
. ' FROM #__phocagallery AS a'
. ' LEFT JOIN #__phocagallery_categories AS cc ON cc.id = a.catid '
. ' WHERE cc.owner_id = '.(int)$userId;
$this->_db->setQuery( $query );
$imageCount = $this->_db->loadObject();
if (isset($imageCount->count)) {
return $imageCount->count;
}
return 0;
}
}
?>