first commit

This commit is contained in:
alazhar
2020-01-02 22:20:31 +07:00
commit 10eb3340ad
5753 changed files with 631345 additions and 0 deletions

View File

@ -0,0 +1,204 @@
<?php
/**
* @version $Id: default.php 1971 2013-05-01 16:04:17Z lefteris.kavadas $
* @package K2
* @author JoomlaWorks http://www.joomlaworks.net
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
*/
// no direct access
defined('_JEXEC') or die;
$document = JFactory::getDocument();
$document->addScriptDeclaration("
\$K2(document).ready(function(){
\$K2('#K2ImportContentButton').click(function(event){
var answer = confirm('".JText::_('K2_WARNING_YOU_ARE_ABOUT_TO_IMPORT_ALL_SECTIONS_CATEGORIES_AND_ARTICLES_FROM_JOOMLAS_CORE_CONTENT_COMPONENT_COM_CONTENT_INTO_K2_IF_THIS_IS_THE_FIRST_TIME_YOU_IMPORT_CONTENT_TO_K2_AND_YOUR_SITE_HAS_MORE_THAN_A_FEW_THOUSAND_ARTICLES_THE_PROCESS_MAY_TAKE_A_FEW_MINUTES_IF_YOU_HAVE_EXECUTED_THIS_OPERATION_BEFORE_DUPLICATE_CONTENT_MAY_BE_PRODUCED', true)."');
if(!answer){
event.preventDefault();
}
});
});
");
?>
<form action="index.php" method="post" name="adminForm" id="adminForm">
<table class="k2AdminTableFilters table">
<tr>
<td class="k2AdminTableFiltersSearch"><?php echo JText::_('K2_FILTER'); ?>
<input type="text" name="search" value="<?php echo $this->lists['search'] ?>" class="text_area" title="<?php echo JText::_('K2_FILTER_BY_TITLE'); ?>" />
<button id="k2SubmitButton"><?php echo JText::_('K2_GO'); ?></button>
<button id="k2ResetButton"><?php echo JText::_('K2_RESET'); ?></button>
</td>
<td class="k2AdminTableFiltersSelects hidden-phone">
<?php echo $this->lists['trash']; ?>
<?php echo $this->lists['featured']; ?>
<?php echo $this->lists['categories']; ?>
<?php if(isset($this->lists['tag'])): ?>
<?php echo $this->lists['tag']; ?>
<?php endif; ?>
<?php echo $this->lists['authors']; ?> <?php echo $this->lists['state']; ?>
<?php if(isset($this->lists['language'])): ?>
<?php echo $this->lists['language']; ?>
<?php endif; ?>
<?php foreach($this->filters as $filter):?>
<?php echo $filter; ?>
<?php endforeach; ?>
</td>
</tr>
</table>
<table class="adminlist table table-striped" id="k2ItemsList">
<thead>
<tr>
<?php if(K2_JVERSION == '30'): ?>
<th width="1%" class="center hidden-phone">
<?php if($this->filter_featured=='1'): ?>
<?php echo JHtml::_('grid.sort', '<i class="icon-menu-2"></i>', 'i.featured_ordering', @$this->lists['order_Dir'], @$this->lists['order'], null, 'asc', 'K2_FEATURED_ORDER'); ?>
<?php else: ?>
<?php echo JHtml::_('grid.sort', '<i class="icon-menu-2"></i>', 'i.ordering', @$this->lists['order_Dir'], @$this->lists['order'], null, 'asc', 'K2_ORDER'); ?>
<?php endif; ?>
</th>
<?php else: ?>
<th>#</th>
<?php endif; ?>
<th class="center">
<input id="jToggler" type="checkbox" name="toggle" value="" />
</th>
<th class="title"> <?php echo JHTML::_('grid.sort', 'K2_TITLE', 'i.title', @$this->lists['order_Dir'], @$this->lists['order']); ?> </th>
<th class="center"> <?php echo JHTML::_('grid.sort', 'K2_FEATURED', 'i.featured', @$this->lists['order_Dir'], @$this->lists['order']); ?> </th>
<th class="center"> <?php echo JHTML::_('grid.sort', 'K2_PUBLISHED', 'i.published', @$this->lists['order_Dir'], @$this->lists['order']); ?> </th>
<?php if(K2_JVERSION != '30'): ?>
<th>
<?php if($this->filter_featured=='1'): ?>
<?php echo JHTML::_('grid.sort', 'K2_FEATURED_ORDER', 'i.featured_ordering', @$this->lists['order_Dir'], @$this->lists['order']); ?>
<?php if($this->ordering) {echo JHTML::_('grid.order', $this->rows, 'filesave.png','savefeaturedorder');} ?>
<?php else: ?>
<?php echo JHTML::_('grid.sort', 'K2_ORDER', 'i.ordering', @$this->lists['order_Dir'], @$this->lists['order']); ?>
<?php if($this->ordering) {echo JHTML::_('grid.order', $this->rows);} ?>
<?php endif; ?>
</th>
<?php endif; ?>
<th class="hidden-phone"> <?php echo JHTML::_('grid.sort', 'K2_CATEGORY', 'category', @$this->lists['order_Dir'], @$this->lists['order']); ?> </th>
<th class="hidden-phone"> <?php echo JHTML::_('grid.sort', 'K2_AUTHOR', 'author', @$this->lists['order_Dir'], @$this->lists['order']); ?> </th>
<th class="hidden-phone"> <?php echo JHTML::_('grid.sort', 'K2_LAST_MODIFIED_BY', 'moderator', @$this->lists['order_Dir'], @$this->lists['order']); ?> </th>
<th class="hidden-phone center"> <?php echo JHTML::_('grid.sort', 'K2_ACCESS_LEVEL', 'i.access', @$this->lists['order_Dir'], @$this->lists['order']); ?> </th>
<th class="hidden-phone"> <?php echo JHTML::_('grid.sort', 'K2_CREATED', 'i.created', @$this->lists['order_Dir'], @$this->lists['order']); ?> </th>
<th class="hidden-phone"> <?php echo JHTML::_('grid.sort', 'K2_MODIFIED', 'i.modified', @$this->lists['order_Dir'], @$this->lists['order']); ?> </th>
<th class="center hidden-phone"> <?php echo JHTML::_('grid.sort', 'K2_HITS', 'i.hits', @$this->lists['order_Dir'], @$this->lists['order']); ?> </th>
<th class="hidden-phone center"> <?php echo JText::_('K2_IMAGE'); ?> </th>
<?php if(isset($this->lists['language'])): ?>
<th class="hidden-phone"> <?php echo JHTML::_('grid.sort', 'K2_LANGUAGE', 'i.language', @$this->lists['order_Dir'], @$this->lists['order']); ?> </th>
<?php endif; ?>
<th class="hidden-phone"> <?php echo JHTML::_('grid.sort', 'K2_ID', 'i.id', @$this->lists['order_Dir'], @$this->lists['order']); ?> </th>
<?php foreach($this->columns as $column):?>
<th> <?php echo JHTML::_('grid.sort', $column->label, $column->property, @$this->lists['order_Dir'], @$this->lists['order']); ?> </th>
<?php endforeach; ?>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="<?php echo 16+sizeof($this->columns); ?>">
<?php if(K2_JVERSION == '30'): ?>
<div class="k2LimitBox">
<?php echo $this->page->getLimitBox(); ?>
</div>
<?php endif; ?>
<?php echo $this->page->getListFooter(); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php foreach ($this->rows as $key => $row): ?>
<tr class="row<?php echo ($key%2); ?>"<?php if($this->filter_featured!='1') echo ' sortable-group-id="'.$row->catid.'"'; ?>>
<?php if(K2_JVERSION == '30'): ?>
<td class="order center hidden-phone">
<?php if($row->canChange): ?>
<span class="sortable-handler<?php echo ($this->ordering) ? '' : ' inactive tip-top' ; ?>" title="<?php echo ($this->ordering) ? '' : JText::_('JORDERINGDISABLED'); ?>" rel="tooltip"><i class="icon-menu"></i></span>
<input type="text" style="display:none" name="order[]" size="5" value="<?php echo $row->ordering; ?>" class="width-20 text-area-order " />
<?php else: ?>
<span class="sortable-handler inactive" ><i class="icon-menu"></i></span>
<?php endif; ?>
</td>
<?php else: ?>
<td><?php echo $key+1; ?></td>
<?php endif; ?>
<td class="center"><?php echo @JHTML::_('grid.checkedout', $row, $key); ?></td>
<td>
<?php if($this->table->isCheckedOut($this->user->get('id'), $row->checked_out)): ?>
<?php echo $row->title; ?>
<?php else: ?>
<?php if(!$this->filter_trash): ?>
<a href="<?php echo JRoute::_('index.php?option=com_k2&view=item&cid='.$row->id); ?>"><?php echo $row->title; ?></a>
<?php else: ?>
<?php echo $row->title; ?>
<?php endif; ?>
<?php endif; ?>
</td>
<td class="k2Center center"><?php echo $row->featuredStatus; ?></td>
<td class="k2Center center"><?php echo $row->status; ?></td>
<?php if(K2_JVERSION != '30'): ?>
<td class="order k2Order">
<?php if($this->filter_featured=='1'): ?>
<span><?php echo $this->page->orderUpIcon($key, true, 'featuredorderup', 'K2_MOVE_UP', $this->ordering); ?></span> <span><?php echo $this->page->orderDownIcon($key, count($this->rows), true, 'featuredorderdown', 'K2_MOVE_DOWN', $this->ordering); ?></span>
<input type="text" name="order[]" size="5" value="<?php echo $row->featured_ordering; ?>" <?php echo ($this->ordering) ? '' : 'disabled="disabled"' ?> class="text_area k2OrderBox" />
<?php else: ?>
<span><?php echo $this->page->orderUpIcon($key, ($row->catid == @$this->rows[$key-1]->catid), 'orderup', 'K2_MOVE_UP', $this->ordering); ?></span> <span><?php echo $this->page->orderDownIcon($key, count($this->rows), ($row->catid == @$this->rows[$key+1]->catid), 'orderdown', 'K2_MOVE_DOWN', $this->ordering); ?></span>
<input type="text" name="order[]" size="5" value="<?php echo $row->ordering; ?>" <?php echo ($this->ordering)? '' : 'disabled="disabled"' ?> class="text_area k2OrderBox" />
<?php endif; ?>
</td>
<?php endif; ?>
<td class="hidden-phone"><a href="<?php echo JRoute::_('index.php?option=com_k2&view=category&cid='.$row->catid); ?>"><?php echo $row->category; ?></a></td>
<td class="hidden-phone">
<?php if($this->user->gid>23): ?>
<a href="<?php echo JRoute::_('index.php?option=com_k2&view=user&cid='.$row->created_by); ?>"><?php echo $row->author; ?></a>
<?php else: ?>
<?php echo $row->author; ?>
<?php endif; ?>
</td>
<td class="hidden-phone">
<?php if($this->user->gid>23): ?>
<a href="<?php echo JRoute::_('index.php?option=com_k2&view=user&cid='.$row->modified_by); ?>"><?php echo $row->moderator; ?></a>
<?php else: ?>
<?php echo $row->moderator; ?>
<?php endif; ?>
</td>
<td class="k2Center hidden-phone center"><?php echo ($this->filter_trash || K2_JVERSION != '15')? $row->groupname:JHTML::_('grid.access', $row, $key); ?></td>
<td class="k2Date hidden-phone"><?php echo JHTML::_('date', $row->created , $this->dateFormat); ?></td>
<td class="k2Date hidden-phone"><?php echo ($row->modified == $this->nullDate) ? JText::_('K2_NEVER') : JHTML::_('date', $row->modified , $this->dateFormat); ?></td>
<td class="center hidden-phone"><?php echo $row->hits ?></td>
<td class="k2Center center hidden-phone">
<?php if(JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$row->id).'_XL.jpg')): ?>
<a href="<?php echo JURI::root(true).'/media/k2/items/cache/'.md5("Image".$row->id).'_XL.jpg'; ?>" title="<?php echo JText::_('K2_PREVIEW_IMAGE'); ?>" class="modal">
<?php if(K2_JVERSION == '30'): ?>
<i class="icon-picture" title="<?php echo JText::_('K2_PREVIEW_IMAGE'); ?>"></i>
<?php else: ?>
<img src="templates/<?php echo $this->template; ?>/images/menu/icon-16-media.png" alt="<?php echo JText::_('K2_PREVIEW_IMAGE'); ?>" />
<?php endif; ?>
</a>
<?php endif; ?>
</td>
<?php if(isset($this->lists['language'])): ?>
<td class="center hidden-phone"><?php echo $row->language; ?></td>
<?php endif; ?>
<td class="center hidden-phone"><?php echo $row->id; ?></td>
<?php foreach($this->columns as $column):?>
<td <?php if($column->class){ echo 'class="'.$column->class.'"';}?>>
<?php $property = $column->property; echo $row->$property; ?>
</td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<input type="hidden" name="option" value="com_k2" />
<input type="hidden" name="view" value="<?php echo JRequest::getVar('view'); ?>" />
<input type="hidden" name="task" value="<?php echo JRequest::getVar('task'); ?>" />
<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
<input type="hidden" name="boxchecked" value="0" />
<?php echo JHTML::_('form.token'); ?>
</form>

View File

@ -0,0 +1,82 @@
<?php
/**
* @version $Id: element.php 1971 2013-05-01 16:04:17Z lefteris.kavadas $
* @package K2
* @author JoomlaWorks http://www.joomlaworks.net
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
*/
// no direct access
defined('_JEXEC') or die;
?>
<form action="index.php" method="post" name="adminForm" id="adminForm">
<h1><?php echo JText::_('K2_SELECT_ITEMS'); ?></h1>
<table class="k2AdminTableFilters table">
<tr>
<td class="k2AdminTableFiltersSearch">
<?php echo JText::_('K2_FILTER'); ?>
<input type="text" name="search" value="<?php echo $this->lists['search'] ?>" class="text_area" title="<?php echo JText::_('K2_FILTER_BY_TITLE'); ?>"/>
<button id="k2SubmitButton"><?php echo JText::_('K2_GO'); ?></button>
<button id="k2ResetButton"><?php echo JText::_('K2_RESET'); ?></button>
</td>
<td class="k2AdminTableFiltersSelects hidden-phone">
<?php echo $this->lists['trash']; ?>
<?php echo $this->lists['featured']; ?>&nbsp;|
<?php echo $this->lists['categories']; ?>
<?php if(isset($this->lists['tag'])): ?>
<?php echo $this->lists['tag']; ?>
<?php endif; ?>
<?php echo $this->lists['authors']; ?>
<?php echo $this->lists['state']; ?>
<?php if(isset($this->lists['language'])): ?>
<?php echo $this->lists['language']; ?>
<?php endif; ?>
</td>
</tr>
</table>
<table class="adminlist table table-striped">
<thead>
<tr>
<th><?php echo JText::_('K2_NUM'); ?></th>
<th><?php echo JHTML::_('grid.sort', 'K2_TITLE', 'i.title', @$this->lists['order_Dir'], @$this->lists['order']); ?></th>
<th><?php echo JHTML::_('grid.sort', 'K2_CATEGORY', 'category', @$this->lists['order_Dir'], @$this->lists['order']); ?></th>
<th><?php echo JHTML::_('grid.sort', 'K2_AUTHOR', 'author', @$this->lists['order_Dir'], @$this->lists['order']); ?></th>
<th><?php echo JHTML::_('grid.sort', 'K2_ACCESS_LEVEL', 'i.access', @$this->lists['order_Dir'], @$this->lists['order']); ?></th>
<th><?php echo JHTML::_('grid.sort', 'K2_CREATED', 'i.created', @$this->lists['order_Dir'], @$this->lists['order']); ?></th>
<th><?php echo JHTML::_('grid.sort', 'K2_ID', 'i.id', @$this->lists['order_Dir'], @$this->lists['order']); ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($this->rows as $key => $row): ?>
<tr class="row<?php echo ($key%2); ?>">
<td><?php echo $key+1; ?></td>
<td><a class="k2ListItemDisabled" title="<?php echo JText::_('K2_CLICK_TO_ADD_THIS_ITEM'); ?>" onclick="window.parent.jSelectItem('<?php echo $row->id; ?>', '<?php echo str_replace(array("'", "\""), array("\\'", ""),$row->title); ?>', '<?php echo JRequest::getCmd('object', 'id'); ?>');"><?php echo $row->title; ?></a></td>
<td><?php echo $row->category; ?></td>
<td><?php echo $row->author; ?></td>
<td class="k2Center"><?php echo $row->groupname; ?></td>
<td class="k2Date"><?php echo $row->created; ?></td>
<td><?php echo $row->id; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
<tfoot>
<tr>
<td colspan="7">
<?php if(K2_JVERSION == '30'): ?>
<div class="k2LimitBox">
<?php echo $this->page->getLimitBox(); ?>
</div>
<?php endif; ?>
<?php echo $this->page->getListFooter(); ?>
</td>
</tr>
</tfoot>
</table>
<input type="hidden" name="option" value="com_k2" />
<input type="hidden" name="view" value="items" />
<input type="hidden" name="task" value="element" />
<input type="hidden" name="tmpl" value="component" />
<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
</form>

View File

@ -0,0 +1,46 @@
<?php
/**
* @version $Id: move.php 1877 2013-02-07 14:37:58Z joomlaworks $
* @package K2
* @author JoomlaWorks http://www.joomlaworks.net
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
*/
// no direct access
defined('_JEXEC') or die;
$document = & JFactory::getDocument();
$document->addScriptDeclaration("
Joomla.submitbutton = function(pressbutton) {
if (pressbutton == 'cancel') {
submitform( pressbutton );
return;
}
if (\$K2.trim(\$K2('#category').val()) == '') {
alert( '".JText::_('K2_YOU_MUST_SELECT_A_TARGET_CATEGORY', true)."' );
} else {
submitform( pressbutton );
}
}
");
?>
<form action="index.php" method="post" id="adminForm" name="adminForm">
<fieldset>
<legend><?php echo JText::_('K2_TARGET_CATEGORY'); ?></legend>
<?php echo $this->lists['categories']; ?>
</fieldset>
<fieldset>
<legend>(<?php echo count($this->rows); ?>) <?php echo JText::_('K2_ITEMS_BEING_MOVED'); ?></legend>
<ol>
<?php foreach ($this->rows as $row): ?>
<li><?php echo $row->title; ?><input type="hidden" name="cid[]" value="<?php echo $row->id; ?>" /></li>
<?php endforeach; ?>
</ol>
</fieldset>
<input type="hidden" name="option" value="com_k2" />
<input type="hidden" name="view" value="<?php echo JRequest::getVar('view'); ?>" />
<input type="hidden" name="task" value="<?php echo JRequest::getVar('task'); ?>" />
</form>

View File

@ -0,0 +1,352 @@
<?php
/**
* @version $Id: view.html.php 1953 2013-04-02 16:34:59Z lefteris.kavadas $
* @package K2
* @author JoomlaWorks http://www.joomlaworks.net
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
*/
// no direct access
defined('_JEXEC') or die ;
jimport('joomla.application.component.view');
class K2ViewItems extends K2View
{
function display($tpl = null)
{
JHTML::_('behavior.modal');
jimport('joomla.filesystem.file');
$mainframe = JFactory::getApplication();
$user = JFactory::getUser();
$option = JRequest::getCmd('option');
$view = JRequest::getCmd('view');
$limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
$limitstart = $mainframe->getUserStateFromRequest($option.$view.'.limitstart', 'limitstart', 0, 'int');
$filter_order = $mainframe->getUserStateFromRequest($option.$view.'filter_order', 'filter_order', 'i.id', 'cmd');
$filter_order_Dir = $mainframe->getUserStateFromRequest($option.$view.'filter_order_Dir', 'filter_order_Dir', 'DESC', 'word');
$filter_trash = $mainframe->getUserStateFromRequest($option.$view.'filter_trash', 'filter_trash', 0, 'int');
$filter_featured = $mainframe->getUserStateFromRequest($option.$view.'filter_featured', 'filter_featured', -1, 'int');
$filter_category = $mainframe->getUserStateFromRequest($option.$view.'filter_category', 'filter_category', 0, 'int');
$filter_author = $mainframe->getUserStateFromRequest($option.$view.'filter_author', 'filter_author', 0, 'int');
$filter_state = $mainframe->getUserStateFromRequest($option.$view.'filter_state', 'filter_state', -1, 'int');
$search = $mainframe->getUserStateFromRequest($option.$view.'search', 'search', '', 'string');
$search = JString::strtolower($search);
$tag = $mainframe->getUserStateFromRequest($option.$view.'tag', 'tag', 0, 'int');
$language = $mainframe->getUserStateFromRequest($option.$view.'language', 'language', '', 'string');
$params = JComponentHelper::getParams('com_k2');
$db = JFactory::getDBO();
$nullDate = $db->getNullDate();
$this->assignRef('nullDate', $nullDate);
$model = $this->getModel();
$total = $model->getTotal();
if ($limitstart > $total - $limit)
{
$limitstart = max(0, (int)(ceil($total / $limit) - 1) * $limit);
JRequest::setVar('limitstart', $limitstart);
}
$items = $model->getData();
if (K2_JVERSION != '15')
{
$langs = JLanguageHelper::getLanguages();
$langsMapping = array();
$langsMapping['*'] = JText::_('K2_ALL');
foreach ($langs as $lang)
{
$langsMapping[$lang->lang_code] = $lang->title;
}
}
foreach ($items as $key => $item)
{
if (K2_JVERSION != '15')
{
$item->status = JHtml::_('jgrid.published', $item->published, $key, '', ($filter_trash == 0), 'cb', $item->publish_up, $item->publish_down);
$states = array(
1 => array(
'featured',
'K2_FEATURED',
'K2_REMOVE_FEATURED_FLAG',
'K2_FEATURED',
false,
'publish',
'publish'
),
0 => array(
'featured',
'K2_NOT_FEATURED',
'K2_FLAG_AS_FEATURED',
'K2_NOT_FEATURED',
false,
'unpublish',
'unpublish'
),
);
$item->featuredStatus = JHtml::_('jgrid.state', $states, $item->featured, $key, '', $filter_trash == 0);
$item->canChange = $user->authorise('core.edit.state', 'com_k2.item.'.$item->id);
$item->language = $item->language ? $item->language : '*';
if (isset($langsMapping))
{
$item->language = $langsMapping[$item->language];
}
}
else
{
$now = JFactory::getDate();
$config = JFactory::getConfig();
$publish_up = JFactory::getDate($item->publish_up);
$publish_down = JFactory::getDate($item->publish_down);
$publish_up->setOffset($config->getValue('config.offset'));
$publish_down->setOffset($config->getValue('config.offset'));
$img = 'tick.png';
if ($now->toUnix() <= $publish_up->toUnix() && $item->published == 1)
{
$img = 'publish_y.png';
}
else if (($now->toUnix() <= $publish_down->toUnix() || $item->publish_down == $nullDate) && $item->published == 1)
{
$img = 'tick.png';
}
else if ($now->toUnix() > $publish_down->toUnix() && $item->published == 1)
{
$img = 'publish_r.png';
}
$item->status = JHTML::_('grid.published', $item, $key, $img);
if ($filter_trash)
{
$item->status = strip_tags($item->status, '<img>');
}
$item->featuredStatus = '';
if (!$filter_trash)
{
$tmpTitle = $item->featured ? JText::_('K2_REMOVE_FEATURED_FLAG') : JText::_('K2_FLAG_AS_FEATURED');
$item->featuredStatus .= '<a href="javascript:void(0);" onclick="return listItemTask(\'cb'.$key.'\',\'featured\')" title="'.$tmpTitle.'">';
}
$item->state = $item->published;
$item->published = $item->featured;
$item->featuredStatus .= strip_tags(JHTML::_('grid.published', $item, $key), '<img>');
$item->published = $item->state;
if (!$filter_trash)
{
$item->featuredStatus .= '</a>';
}
}
}
$this->assignRef('rows', $items);
$lists = array();
$lists['search'] = $search;
if (!$filter_order)
{
$filter_order = 'category';
}
$lists['order_Dir'] = $filter_order_Dir;
$lists['order'] = $filter_order;
$filter_trash_options[] = JHTML::_('select.option', 0, JText::_('K2_CURRENT'));
$filter_trash_options[] = JHTML::_('select.option', 1, JText::_('K2_TRASHED'));
$lists['trash'] = JHTML::_('select.genericlist', $filter_trash_options, 'filter_trash', '', 'value', 'text', $filter_trash);
require_once JPATH_ADMINISTRATOR.'/components/com_k2/models/categories.php';
$categoriesModel = K2Model::getInstance('Categories', 'K2Model');
$categories_option[] = JHTML::_('select.option', 0, JText::_('K2_SELECT_CATEGORY'));
$categories = $categoriesModel->categoriesTree(NULL, true, false);
$categories_options = @array_merge($categories_option, $categories);
$lists['categories'] = JHTML::_('select.genericlist', $categories_options, 'filter_category', '', 'value', 'text', $filter_category);
$authors = $model->getItemsAuthors();
$options = array();
$options[] = JHTML::_('select.option', 0, '- '.JText::_('K2_NO_USER').' -');
foreach ($authors as $author)
{
$name = $author->name;
if ($author->block)
{
$name .= ' ['.JText::_('K2_USER_DISABLED').']';
}
$options[] = JHTML::_('select.option', $author->id, $name);
}
$lists['authors'] = JHTML::_('select.genericlist', $options, 'filter_author', '', 'value', 'text', $filter_author);
$filter_state_options[] = JHTML::_('select.option', -1, JText::_('K2_SELECT_PUBLISHING_STATE'));
$filter_state_options[] = JHTML::_('select.option', 1, JText::_('K2_PUBLISHED'));
$filter_state_options[] = JHTML::_('select.option', 0, JText::_('K2_UNPUBLISHED'));
$lists['state'] = JHTML::_('select.genericlist', $filter_state_options, 'filter_state', '', 'value', 'text', $filter_state);
$filter_featured_options[] = JHTML::_('select.option', -1, JText::_('K2_SELECT_FEATURED_STATE'));
$filter_featured_options[] = JHTML::_('select.option', 1, JText::_('K2_FEATURED'));
$filter_featured_options[] = JHTML::_('select.option', 0, JText::_('K2_NOT_FEATURED'));
$lists['featured'] = JHTML::_('select.genericlist', $filter_featured_options, 'filter_featured', '', 'value', 'text', $filter_featured);
if ($params->get('showTagFilter'))
{
$tagsModel = K2Model::getInstance('Tags', 'K2Model');
$options = $tagsModel->getFilter();
$option = new JObject();
$option->id = 0;
$option->name = JText::_('K2_SELECT_TAG');
array_unshift($options, $option);
$lists['tag'] = JHTML::_('select.genericlist', $options, 'tag', '', 'id', 'name', $tag);
}
if (version_compare(JVERSION, '1.6.0', 'ge'))
{
$languages = JHTML::_('contentlanguage.existing', true, true);
array_unshift($languages, JHTML::_('select.option', '', JText::_('K2_SELECT_LANGUAGE')));
$lists['language'] = JHTML::_('select.genericlist', $languages, 'language', '', 'value', 'text', $language);
}
$this->assignRef('lists', $lists);
jimport('joomla.html.pagination');
$pageNav = new JPagination($total, $limitstart, $limit);
$this->assignRef('page', $pageNav);
$filters = array();
$columns = array();
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('k2');
$dispatcher->trigger('onK2BeforeAssignFilters', array(&$filters));
$this->assignRef('filters', $filters);
$dispatcher->trigger('onK2BeforeAssignColumns', array(&$columns));
$this->assignRef('columns', $columns);
JToolBarHelper::title(JText::_('K2_ITEMS'), 'k2.png');
if ($filter_trash == 1)
{
JToolBarHelper::custom('restore', 'publish.png', 'publish_f2.png', 'K2_RESTORE', true);
JToolBarHelper::deleteList('K2_ARE_YOU_SURE_YOU_WANT_TO_DELETE_SELECTED_ITEMS', 'remove', 'K2_DELETE');
}
else
{
$params = JComponentHelper::getParams('com_k2');
$toolbar = JToolBar::getInstance('toolbar');
K2_JVERSION == '30' ? JToolBarHelper::custom('featured', 'featured.png', 'featured_f2.png', 'K2_TOGGLE_FEATURED_STATE', true) : JToolBarHelper::custom('featured', 'default.png', 'default_f2.png', 'K2_TOGGLE_FEATURED_STATE', true);
JToolBarHelper::publishList();
JToolBarHelper::unpublishList();
JToolBarHelper::custom('move', 'move.png', 'move_f2.png', 'K2_MOVE', true);
JToolBarHelper::custom('copy', 'copy.png', 'copy_f2.png', 'K2_COPY', true);
JToolBarHelper::editList();
JToolBarHelper::addNew();
JToolBarHelper::trash('trash');
}
$toolbar = JToolBar::getInstance('toolbar');
if (K2_JVERSION != '15')
{
JToolBarHelper::preferences('com_k2', 550, 875, 'K2_PARAMETERS');
}
else
{
$toolbar->appendButton('Popup', 'config', 'K2_PARAMETERS', 'index.php?option=com_k2&view=settings');
}
// Import Joomla! content button
if ($user->gid > 23 && !$params->get('hideImportButton'))
{
$buttonUrl = JURI::base().'index.php?option=com_k2&amp;view=items&amp;task=import';
$buttonText = JText::_('K2_IMPORT_JOOMLA_CONTENT');
if (K2_JVERSION == '30')
{
$button = '<a id="K2ImportContentButton" class="btn btn-small" href="'.$buttonUrl.'"><i class="icon-archive "></i>'.$buttonText.'</a>';
}
else
{
$button = '<a id="K2ImportContentButton" href="'.$buttonUrl.'"><span class="icon-32-archive" title="'.$buttonText.'"></span>'.$buttonText.'</a>';
}
$toolbar->appendButton('Custom', $button);
}
$this->loadHelper('html');
K2HelperHTML::subMenu();
$template = $mainframe->getTemplate();
$this->assignRef('template', $template);
$this->assignRef('filter_featured', $filter_featured);
$this->assignRef('filter_trash', $filter_trash);
$this->assignRef('user', $user);
if (K2_JVERSION != '15')
{
$dateFormat = JText::_('K2_J16_DATE_FORMAT');
}
else
{
$dateFormat = JText::_('K2_DATE_FORMAT');
}
$this->assignRef('dateFormat', $dateFormat);
$ordering = (($this->lists['order'] == 'i.ordering' || $this->lists['order'] == 'category' || ($this->filter_featured > 0 && $this->lists['order'] == 'i.featured_ordering')) && (!$this->filter_trash));
$this->assignRef('ordering', $ordering);
JTable::addIncludePath(JPATH_COMPONENT.DS.'tables');
$table = JTable::getInstance('K2Item', 'Table');
$this->assignRef('table', $table);
// Joomla! 3.0 drag-n-drop sorting variables
if (K2_JVERSION == '30')
{
if ($ordering)
{
$action = $this->filter_featured == 1 ? 'savefeaturedorder' : 'saveorder';
JHtml::_('sortablelist.sortable', 'k2ItemsList', 'adminForm', strtolower($this->lists['order_Dir']), 'index.php?option=com_k2&view=items&task='.$action.'&format=raw');
}
$document = JFactory::getDocument();
$document->addScriptDeclaration('
Joomla.orderTable = function() {
table = document.getElementById("sortTable");
direction = document.getElementById("directionTable");
order = table.options[table.selectedIndex].value;
if (order != \''.$this->lists['order'].'\') {
dirn = \'asc\';
} else {
dirn = direction.options[direction.selectedIndex].value;
}
Joomla.tableOrdering(order, dirn, "");
}');
}
parent::display($tpl);
}
function move()
{
$mainframe = JFactory::getApplication();
JTable::addIncludePath(JPATH_COMPONENT.DS.'tables');
$cid = JRequest::getVar('cid');
foreach ($cid as $id)
{
$row = JTable::getInstance('K2Item', 'Table');
$row->load($id);
$rows[] = $row;
}
$categoriesModel = K2Model::getInstance('Categories', 'K2Model');
$categories = $categoriesModel->categoriesTree(null, true, false);
$lists['categories'] = JHTML::_('select.genericlist', $categories, 'category', 'class="inputbox" size="8"', 'value', 'text');
$this->assignRef('rows', $rows);
$this->assignRef('lists', $lists);
JToolBarHelper::title(JText::_('K2_MOVE_ITEMS'), 'k2.png');
JToolBarHelper::custom('saveMove', 'save.png', 'save_f2.png', 'K2_SAVE', false);
JToolBarHelper::cancel();
parent::display();
}
}