primo commit
This commit is contained in:
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Gallery
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
defined('_JEXEC') or die;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Factory;
|
||||
|
||||
abstract class PhocaGalleryBatch
|
||||
{
|
||||
|
||||
public static function item($published, $category = 0)
|
||||
{
|
||||
// Create the copy/move options.
|
||||
$options = array(
|
||||
HTMLHelper::_('select.option', 'c', Text::_('JLIB_HTML_BATCH_COPY')),
|
||||
HTMLHelper::_('select.option', 'm', Text::_('JLIB_HTML_BATCH_MOVE'))
|
||||
);
|
||||
|
||||
$db = Factory::getDbo();
|
||||
|
||||
//build the list of categories
|
||||
$query = 'SELECT a.title AS text, a.id AS value, a.parent_id as parentid'
|
||||
. ' FROM #__phocagallery_categories AS a'
|
||||
// TO DO. ' WHERE a.published = '.(int)$published
|
||||
. ' ORDER BY a.ordering';
|
||||
$db->setQuery( $query );
|
||||
$data = $db->loadObjectList();
|
||||
$tree = array();
|
||||
$text = '';
|
||||
$catId= -1;
|
||||
$tree = PhocaGalleryCategoryhtml::CategoryTreeOption($data, $tree, 0, $text, $catId);
|
||||
|
||||
if ($category == 1) {
|
||||
array_unshift($tree, HTMLHelper::_('select.option', 0, Text::_('JLIB_HTML_ADD_TO_ROOT'), 'value', 'text'));
|
||||
}
|
||||
|
||||
|
||||
// Create the batch selector to change select the category by which to move or copy.
|
||||
$lines = array(
|
||||
'<label id="batch-choose-action-lbl" for="batch-choose-action">',
|
||||
Text::_('JLIB_HTML_BATCH_MENU_LABEL'),
|
||||
'</label>',
|
||||
'<fieldset id="batch-choose-action" class="combo">',
|
||||
'<select name="batch[category_id]" class="form-select" id="batch-category-id">',
|
||||
'<option value=""> - '.Text::_('JSELECT').' - </option>',
|
||||
/*JHtml::_('select.options', JHtml::_('category.options', $extension, array('published' => (int) $published))),*/
|
||||
HTMLHelper::_('select.options', $tree ),
|
||||
'</select>',
|
||||
HTMLHelper::_( 'select.radiolist', $options, 'batch[move_copy]', '', 'value', 'text', 'm'),
|
||||
'</fieldset>'
|
||||
);
|
||||
|
||||
return implode("\n", $lines);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Gallery
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
defined('_JEXEC') or die;
|
||||
class PhocaGalleryCategory
|
||||
{
|
||||
public static function options($type = 0, $ignorePublished = 0)
|
||||
{
|
||||
if ($type == 1) {
|
||||
$tree[0] = new JObject();
|
||||
$tree[0]->text = JText::_('COM_PHOCAGALLERY_MAIN_CSS');
|
||||
$tree[0]->value = 1;
|
||||
$tree[1] = new JObject();
|
||||
$tree[1]->text = JText::_('COM_PHOCAGALLERY_CUSTOM_CSS');
|
||||
$tree[1]->value = 2;
|
||||
return $tree;
|
||||
}
|
||||
|
||||
$db = JFactory::getDBO();
|
||||
|
||||
//build the list of categories
|
||||
$query = 'SELECT a.title AS text, a.id AS value, a.parent_id as parentid'
|
||||
. ' FROM #__phocagallery_categories AS a';
|
||||
if ($ignorePublished == 0) {
|
||||
$query .= ' WHERE a.published = 1';
|
||||
}
|
||||
$query .= ' ORDER BY a.ordering';
|
||||
$db->setQuery( $query );
|
||||
$phocagallerys = $db->loadObjectList();
|
||||
|
||||
$catId = -1;
|
||||
|
||||
$javascript = 'class="inputbox" size="1" onchange="Joomla.submitform( );"';
|
||||
|
||||
$tree = array();
|
||||
$text = '';
|
||||
$tree = self::CategoryTreeOption($phocagallerys, $tree, 0, $text, $catId);
|
||||
|
||||
return $tree;
|
||||
|
||||
}
|
||||
|
||||
public static function CategoryTreeOption($data, $tree, $id=0, $text='', $currentId = 0) {
|
||||
|
||||
foreach ($data as $key) {
|
||||
$show_text = $text . $key->text;
|
||||
|
||||
if ($key->parentid == $id && $currentId != $id && $currentId != $key->value) {
|
||||
$tree[$key->value] = new JObject();
|
||||
$tree[$key->value]->text = $show_text;
|
||||
$tree[$key->value]->value = $key->value;
|
||||
$tree = self::CategoryTreeOption($data, $tree, $key->value, $show_text . " - ", $currentId );
|
||||
}
|
||||
}
|
||||
return($tree);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Gallery
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
defined('_JEXEC') or die;
|
||||
use Joomla\CMS\Object\CMSObject;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Factory;
|
||||
class PhocaGalleryCategoryhtml
|
||||
{
|
||||
public static function options($type = 0, $ignorePublished = 0)
|
||||
{
|
||||
if ($type == 1) {
|
||||
$tree[0] = new CMSObject();
|
||||
$tree[0]->text = Text::_('COM_PHOCAGALLERY_MAIN_CSS');
|
||||
$tree[0]->value = 1;
|
||||
$tree[1] = new CMSObject();
|
||||
$tree[1]->text = Text::_('COM_PHOCAGALLERY_CUSTOM_CSS');
|
||||
$tree[1]->value = 2;
|
||||
return $tree;
|
||||
}
|
||||
|
||||
$db = Factory::getDBO();
|
||||
|
||||
//build the list of categories
|
||||
$query = 'SELECT a.title AS text, a.id AS value, a.parent_id as parentid'
|
||||
. ' FROM #__phocagallery_categories AS a';
|
||||
if ($ignorePublished == 0) {
|
||||
$query .= ' WHERE a.published = 1';
|
||||
}
|
||||
$query .= ' ORDER BY a.ordering';
|
||||
$db->setQuery( $query );
|
||||
$phocagallerys = $db->loadObjectList();
|
||||
|
||||
$catId = -1;
|
||||
|
||||
$javascript = 'class="form-control" size="1" onchange="Joomla.submitform( );"';
|
||||
|
||||
$tree = array();
|
||||
$text = '';
|
||||
$tree = self::CategoryTreeOption($phocagallerys, $tree, 0, $text, $catId);
|
||||
|
||||
return $tree;
|
||||
|
||||
}
|
||||
|
||||
public static function CategoryTreeOption($data, $tree, $id=0, $text='', $currentId = 0) {
|
||||
|
||||
foreach ($data as $key) {
|
||||
$show_text = $text . $key->text;
|
||||
|
||||
if ($key->parentid == $id && $currentId != $id && $currentId != $key->value) {
|
||||
$tree[$key->value] = new CMSObject();
|
||||
$tree[$key->value]->text = $show_text;
|
||||
$tree[$key->value]->value = $key->value;
|
||||
$tree = self::CategoryTreeOption($data, $tree, $key->value, $show_text . " - ", $currentId );
|
||||
}
|
||||
}
|
||||
return($tree);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,141 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Gallery
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
|
||||
/*
|
||||
jimport('joomla.html.grid');
|
||||
jimport('joomla.html.html.grid');
|
||||
jimport('joomla.html.html.jgrid');
|
||||
*/
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\HTML\Helpers\Grid;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Factory;
|
||||
if (! class_exists('HTMLHelperGrid')) {
|
||||
require_once( JPATH_SITE.'/libraries/src/HTML/Helpers/Grid.php' );
|
||||
}
|
||||
|
||||
|
||||
|
||||
class PhocaGalleryGrid extends Grid
|
||||
{
|
||||
|
||||
public static function id($rowNum, $recId, $checkedOut = false, $name = 'cid', $stub = 'cb', $title = '', $formId = null)
|
||||
{
|
||||
if ($checkedOut)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
else
|
||||
{
|
||||
return '<input type="checkbox" id="cb' . $rowNum . '" name="' . $name . '[]" value="' . $recId
|
||||
. '" onclick="Joomla.isChecked(this.checked, \'undefined\');" title="' . Text::sprintf('JGRID_CHECKBOX_ROW_N', ($rowNum + 1)) . '" />';
|
||||
//return '<input type="checkbox" id="cb' . $rowNum . '" name="' . $name . '[]" value="' . $recId
|
||||
// . '" title="' . JText::sprintf('JGRID_CHECKBOX_ROW_N', ($rowNum + 1)) . '" />';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to sort a column in a grid
|
||||
*
|
||||
* @param string $title The link title
|
||||
* @param string $order The order field for the column
|
||||
* @param string $direction The current direction
|
||||
* @param string $selected The selected ordering
|
||||
* @param string $task An optional task override
|
||||
* @param string $new_direction An optional direction for the new column
|
||||
* @param string $tip An optional text shown as tooltip title instead of $title
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* GRID in frontend must be customized
|
||||
* because Joomla! takes "adminForm" as the only one name of form ??????????????????????????????????????????
|
||||
*
|
||||
*/
|
||||
|
||||
public static function sort($title, $order, $direction = 'asc', $selected = 0, $task = null, $new_direction = 'asc', $tip = '', $form = '', $suffix = '')
|
||||
{
|
||||
|
||||
$direction = strtolower($direction);
|
||||
$icon = array('arrow-up-3', 'arrow-down-3');
|
||||
$index = (int) ($direction == 'desc');
|
||||
|
||||
if ($order != $selected)
|
||||
{
|
||||
$direction = $new_direction;
|
||||
}
|
||||
else
|
||||
{
|
||||
$direction = ($direction == 'desc') ? 'asc' : 'desc';
|
||||
}
|
||||
|
||||
$html = '<a href="#" onclick="Joomla.tableOrderingPhoca(\'' . $order . '\',\'' . $direction . '\',\'' . $task . '\',\'' . $form . '\',\'' . $suffix . '\');return false;"'
|
||||
. ' class="hasTooltip" title="' . HTMLHelper::tooltipText(($tip ? $tip : $title), 'JGLOBAL_CLICK_TO_SORT_THIS_COLUMN') . '">';
|
||||
|
||||
if (isset($title['0']) && $title['0'] == '<')
|
||||
{
|
||||
$html .= $title;
|
||||
}
|
||||
else
|
||||
{
|
||||
$html .= Text::_($title);
|
||||
}
|
||||
|
||||
if ($order == $selected)
|
||||
{
|
||||
|
||||
$html .= ' <i class="icon-' . $icon[$index] . ' glyphicon glyphicon-' . $icon[$index] . '"></i>';
|
||||
}
|
||||
|
||||
$html .= '</a>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public static function renderSortJs() {
|
||||
|
||||
|
||||
$o = '';
|
||||
$o .= '<script type="text/javascript">'."\n";
|
||||
$o .= ''."\n";
|
||||
$o .= 'Joomla.tableOrderingPhoca = function(order, dir, task, form, suffix) {'."\n";
|
||||
$o .= ''."\n";
|
||||
$o .= ' if (typeof(form) === "undefined") {'."\n";
|
||||
$o .= ' form = document.getElementById("adminForm");'."\n";
|
||||
$o .= ' }'."\n";
|
||||
$o .= ''."\n";
|
||||
$o .= ''."\n";
|
||||
$o .= ' if (typeof form == "string" || form instanceof String) {'."\n";
|
||||
$o .= ' form = document.getElementById(form);'."\n";
|
||||
$o .= ' }'."\n";
|
||||
$o .= ''."\n";
|
||||
$o .= ' var orderS = "filter_order" + suffix;'."\n";
|
||||
$o .= ' var orderSDir = "filter_order_Dir" + suffix;'."\n";
|
||||
$o .= ''."\n";
|
||||
$o .= ' form[orderS].value = order;'."\n";
|
||||
$o .= ' form[orderSDir].value = dir;'."\n";
|
||||
$o .= ' Joomla.submitform(task, form);'."\n";
|
||||
$o .= ''."\n";
|
||||
$o .= '}'."\n";
|
||||
$o .= '</script>'."\n";
|
||||
|
||||
|
||||
|
||||
$document = Factory::getDocument();
|
||||
$document->addCustomTag($o);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
<html><body></body></html>
|
||||
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Phoca Gallery
|
||||
* @author Jan Pavelka - https://www.phoca.cz
|
||||
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
|
||||
* @cms Joomla
|
||||
* @copyright Copyright (C) Open Source Matters. All rights reserved.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
|
||||
*/
|
||||
|
||||
/*
|
||||
jimport('joomla.html.grid');
|
||||
jimport('joomla.html.html.grid');
|
||||
jimport('joomla.html.html.jgrid');
|
||||
*/
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\HTML\Helpers\JGrid;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
if (! class_exists('HTMLHelperJGrid')) {
|
||||
require_once( JPATH_SITE.'/libraries/src/HTML/Helpers/JGrid.php' );
|
||||
}
|
||||
|
||||
class PhocaGalleryJGrid extends JGrid
|
||||
{
|
||||
|
||||
public static function approved($value, $i, $prefix = '', $enabled = true, $checkbox='cb')
|
||||
{
|
||||
if (is_array($prefix)) {
|
||||
$options = $prefix;
|
||||
$enabled = array_key_exists('enabled', $options) ? $options['enabled'] : $enabled;
|
||||
$checkbox = array_key_exists('checkbox', $options) ? $options['checkbox'] : $checkbox;
|
||||
$prefix = array_key_exists('prefix', $options) ? $options['prefix'] : '';
|
||||
}
|
||||
$states = array(
|
||||
1 => array('disapprove', 'COM_PHOCAGALLERY_APPROVED', 'COM_PHOCAGALLERY_NOT_APPROVE_ITEM', 'COM_PHOCAGALLERY_APPROVED', false, 'publish', 'publish'),
|
||||
0 => array('approve', 'COM_PHOCAGALLERY_NOT_APPROVED', 'COM_PHOCAGALLERY_APPROVE_ITEM', 'COM_PHOCAGALLERY_NOT_APPROVED', false, 'unpublish', 'unpublish')
|
||||
);
|
||||
return self::state($states, $value, $i, $prefix, $enabled, true, $checkbox);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user