You've already forked joomla_test
first commit
This commit is contained in:
19
administrator/components/com_checkin/checkin.php
Normal file
19
administrator/components/com_checkin/checkin.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_checkin
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
if (!JFactory::getUser()->authorise('core.manage', 'com_checkin'))
|
||||
{
|
||||
return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
|
||||
}
|
||||
|
||||
$controller = JControllerLegacy::getInstance('Checkin');
|
||||
$controller->execute(JFactory::getApplication()->input->get('task'));
|
||||
$controller->redirect();
|
26
administrator/components/com_checkin/checkin.xml
Normal file
26
administrator/components/com_checkin/checkin.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="component" version="3.1" method="upgrade">
|
||||
<name>com_checkin</name>
|
||||
<author>Joomla! Project</author>
|
||||
<copyright>(C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
</copyright>
|
||||
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
|
||||
<authorEmail>admin@joomla.org</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>3.0.0</version>
|
||||
<description>COM_CHECKIN_XML_DESCRIPTION</description>
|
||||
<administration>
|
||||
<files folder="admin">
|
||||
<filename>checkin.php</filename>
|
||||
<filename>config.xml</filename>
|
||||
<filename>controller.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<folder>models</folder>
|
||||
<folder>views</folder>
|
||||
</files>
|
||||
<languages folder="admin">
|
||||
<language tag="en-GB">language/en-GB.com_checkin.ini</language>
|
||||
<language tag="en-GB">language/en-GB.com_checkin.sys.ini</language>
|
||||
</languages>
|
||||
</administration>
|
||||
</extension>
|
27
administrator/components/com_checkin/config.xml
Normal file
27
administrator/components/com_checkin/config.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<config>
|
||||
<fieldset
|
||||
name="permissions"
|
||||
label="JCONFIG_PERMISSIONS_LABEL"
|
||||
description="JCONFIG_PERMISSIONS_DESC"
|
||||
>
|
||||
|
||||
<field
|
||||
name="rules"
|
||||
type="rules"
|
||||
label="JCONFIG_PERMISSIONS_LABEL"
|
||||
filter="rules"
|
||||
validate="rules"
|
||||
component="com_checkin"
|
||||
section="component">
|
||||
<action
|
||||
name="core.admin"
|
||||
title="JACTION_ADMIN"
|
||||
description="JACTION_ADMIN_COMPONENT_DESC" />
|
||||
<action
|
||||
name="core.manage"
|
||||
title="JACTION_MANAGE"
|
||||
description="JACTION_MANAGE_COMPONENT_DESC" />
|
||||
</field>
|
||||
</fieldset>
|
||||
</config>
|
82
administrator/components/com_checkin/controller.php
Normal file
82
administrator/components/com_checkin/controller.php
Normal file
@ -0,0 +1,82 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_checkin
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Checkin Controller
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_checkin
|
||||
* @since 1.6
|
||||
*/
|
||||
class CheckinController extends JControllerLegacy
|
||||
{
|
||||
public function display($cachable = false, $urlparams = false)
|
||||
{
|
||||
// Load the submenu.
|
||||
$this->addSubmenu($this->input->getWord('option', 'com_checkin'));
|
||||
|
||||
parent::display();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function checkin()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or jexit(JText::_('JInvalid_Token'));
|
||||
|
||||
$ids = $this->input->get('cid', array(), 'array');
|
||||
|
||||
if (empty($ids))
|
||||
{
|
||||
JError::raiseWarning(500, JText::_('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST'));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get the model.
|
||||
$model = $this->getModel();
|
||||
|
||||
// Checked in the items.
|
||||
$this->setMessage(JText::plural('COM_CHECKIN_N_ITEMS_CHECKED_IN', $model->checkin($ids)));
|
||||
}
|
||||
|
||||
$this->setRedirect('index.php?option=com_checkin');
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the Linkbar.
|
||||
*
|
||||
* @param string $vName The name of the active view.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function addSubmenu($vName)
|
||||
{
|
||||
JHtmlSidebar::addEntry(
|
||||
JText::_('JGLOBAL_SUBMENU_CHECKIN'),
|
||||
'index.php?option=com_checkin',
|
||||
$vName == 'com_checkin'
|
||||
);
|
||||
|
||||
JHtmlSidebar::addEntry(
|
||||
JText::_('JGLOBAL_SUBMENU_CLEAR_CACHE'),
|
||||
'index.php?option=com_cache',
|
||||
$vName == 'cache'
|
||||
);
|
||||
JHtmlSidebar::addEntry(
|
||||
JText::_('JGLOBAL_SUBMENU_PURGE_EXPIRED_CACHE'),
|
||||
'index.php?option=com_cache&view=purge',
|
||||
$vName == 'purge'
|
||||
);
|
||||
}
|
||||
}
|
1
administrator/components/com_checkin/index.html
Normal file
1
administrator/components/com_checkin/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
200
administrator/components/com_checkin/models/checkin.php
Normal file
200
administrator/components/com_checkin/models/checkin.php
Normal file
@ -0,0 +1,200 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_checkin
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Checkin Model
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_checkin
|
||||
* @since 1.6
|
||||
*/
|
||||
class CheckinModelCheckin extends JModelList
|
||||
{
|
||||
protected $total;
|
||||
|
||||
protected $tables;
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* @Note. Calling getState in this method will result in recursion.
|
||||
* @param string $ordering An optional ordering field.
|
||||
* @param string $direction An optional direction (asc|desc).
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
{
|
||||
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
|
||||
$this->setState('filter.search', $search);
|
||||
|
||||
// List state information.
|
||||
parent::populateState('table', 'asc');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks in requested tables
|
||||
*
|
||||
* @param array $ids An array of table names. Optional.
|
||||
*
|
||||
* @return integer Checked in item count
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function checkin($ids = array())
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$db = $this->_db;
|
||||
$nullDate = $db->getNullDate();
|
||||
|
||||
if (!is_array($ids))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// this int will hold the checked item count
|
||||
$results = 0;
|
||||
|
||||
foreach ($ids as $tn)
|
||||
{
|
||||
// make sure we get the right tables based on prefix
|
||||
if (stripos($tn, $app->getCfg('dbprefix')) !== 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$fields = $db->getTableColumns($tn);
|
||||
|
||||
if (!(isset($fields['checked_out']) && isset($fields['checked_out_time'])))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$query = $db->getQuery(true)
|
||||
->update($db->quoteName($tn))
|
||||
->set('checked_out = 0')
|
||||
->set('checked_out_time = ' . $db->quote($nullDate))
|
||||
->where('checked_out > 0');
|
||||
|
||||
$db->setQuery($query);
|
||||
if ($db->execute())
|
||||
{
|
||||
$results = $results + $db->getAffectedRows();
|
||||
}
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get total of tables
|
||||
*
|
||||
* @return int Total to check-in tables
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getTotal()
|
||||
{
|
||||
if (!isset($this->total))
|
||||
{
|
||||
$this->getItems();
|
||||
}
|
||||
return $this->total;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tables
|
||||
*
|
||||
* @return array Checked in table names as keys and checked in item count as values
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
if (!isset($this->items))
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$db = $this->_db;
|
||||
$tables = $db->getTableList();
|
||||
|
||||
// this array will hold table name as key and checked in item count as value
|
||||
$results = array();
|
||||
|
||||
foreach ($tables as $i => $tn)
|
||||
{
|
||||
// make sure we get the right tables based on prefix
|
||||
if (stripos($tn, $app->getCfg('dbprefix')) !== 0)
|
||||
{
|
||||
unset($tables[$i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($this->getState('filter.search') && stripos($tn, $this->getState('filter.search')) === false)
|
||||
{
|
||||
unset($tables[$i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
$fields = $db->getTableColumns($tn);
|
||||
|
||||
if (!(isset($fields['checked_out']) && isset($fields['checked_out_time'])))
|
||||
{
|
||||
unset($tables[$i]);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
foreach ($tables as $tn)
|
||||
{
|
||||
$query = $db->getQuery(true)
|
||||
->select('COUNT(*)')
|
||||
->from($db->quoteName($tn))
|
||||
->where('checked_out > 0');
|
||||
|
||||
$db->setQuery($query);
|
||||
if ($db->execute())
|
||||
{
|
||||
$results[$tn] = $db->loadResult();
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
$this->total = count($results);
|
||||
if ($this->getState('list.ordering') == 'table')
|
||||
{
|
||||
if ($this->getState('list.direction') == 'asc')
|
||||
{
|
||||
ksort($results);
|
||||
}
|
||||
else
|
||||
{
|
||||
krsort($results);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->getState('list.direction') == 'asc')
|
||||
{
|
||||
asort($results);
|
||||
}
|
||||
else
|
||||
{
|
||||
arsort($results);
|
||||
}
|
||||
}
|
||||
$results = array_slice($results, $this->getState('list.start'), $this->getState('list.limit') ? $this->getState('list.limit') : null);
|
||||
$this->items = $results;
|
||||
}
|
||||
return $this->items;
|
||||
}
|
||||
}
|
1
administrator/components/com_checkin/models/index.html
Normal file
1
administrator/components/com_checkin/models/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_checkin
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
JHtml::_('bootstrap.tooltip');
|
||||
|
||||
$listOrder = $this->escape($this->state->get('list.ordering'));
|
||||
$listDirn = $this->escape($this->state->get('list.direction'));
|
||||
?>
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_checkin'); ?>" method="post" name="adminForm" id="adminForm">
|
||||
<?php if (!empty($this->sidebar)) : ?>
|
||||
<div id="j-sidebar-container" class="span2">
|
||||
<?php echo $this->sidebar; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div id="j-main-container"<?php echo !empty($this->sidebar) ? ' class="span10"' : ''; ?>>
|
||||
<div id="filter-bar" class="btn-toolbar">
|
||||
<div class="filter-search btn-group pull-left">
|
||||
<input type="text" name="filter_search" id="filter_search" placeholder="<?php echo JText::_('JSEARCH_FILTER'); ?>" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="hasTooltip" title="<?php echo JHtml::tooltipText('COM_CHECKIN_FILTER_SEARCH_DESC'); ?>" />
|
||||
</div>
|
||||
<div class="btn-group pull-left">
|
||||
<button type="submit" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_SUBMIT'); ?>">
|
||||
<i class="icon-search"></i></button>
|
||||
<button type="button" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.id('filter_search').value='';this.form.submit();">
|
||||
<i class="icon-remove"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
<table id="global-checkin" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="1%">
|
||||
<?php echo JHtml::_('grid.checkall'); ?>
|
||||
</th>
|
||||
<th class="left"><?php echo JHtml::_('grid.sort', 'COM_CHECKIN_DATABASE_TABLE', 'table', $listDirn, $listOrder); ?></th>
|
||||
<th><?php echo JHtml::_('grid.sort', 'COM_CHECKIN_ITEMS_TO_CHECK_IN', 'count', $listDirn, $listOrder); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($this->items as $table => $count): $i = 0; ?>
|
||||
<tr class="row<?php echo $i % 2; ?>">
|
||||
<td class="center"><?php echo JHtml::_('grid.id', $i, $table); ?></td>
|
||||
<td><?php echo JText::sprintf('COM_CHECKIN_TABLE', $table); ?></td>
|
||||
<td width="200" class="center"><span class="label label-info"><?php echo $count; ?></span></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="15">
|
||||
<?php echo $this->pagination->getListFooter(); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
<input type="hidden" name="task" value="" />
|
||||
<input type="hidden" name="boxchecked" value="0" />
|
||||
<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
|
||||
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_checkin
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* HTML View class for the Checkin component
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_checkin
|
||||
* @since 1.0
|
||||
*/
|
||||
class CheckinViewCheckin extends JViewLegacy
|
||||
{
|
||||
protected $tables;
|
||||
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$this->items = $this->get('Items');
|
||||
$this->pagination = $this->get('Pagination');
|
||||
$this->state = $this->get('State');
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
JError::raiseError(500, implode("\n", $errors));
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->addToolbar();
|
||||
$this->sidebar = JHtmlSidebar::render();
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function addToolbar()
|
||||
{
|
||||
JToolbarHelper::title(JText::_('COM_CHECKIN_GLOBAL_CHECK_IN'), 'checkin.png');
|
||||
if (JFactory::getUser()->authorise('core.admin', 'com_checkin'))
|
||||
{
|
||||
JToolbarHelper::custom('checkin', 'checkin.png', 'checkin_f2.png', 'JTOOLBAR_CHECKIN', true);
|
||||
JToolbarHelper::divider();
|
||||
JToolbarHelper::preferences('com_checkin');
|
||||
JToolbarHelper::divider();
|
||||
}
|
||||
JToolbarHelper::help('JHELP_SITE_MAINTENANCE_GLOBAL_CHECK-IN');
|
||||
}
|
||||
}
|
1
administrator/components/com_checkin/views/index.html
Normal file
1
administrator/components/com_checkin/views/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
Reference in New Issue
Block a user