Files
@ 7ec91347b83f
Branch filter:
Location: hot67beta/administrator/components/com_content/views/element/view.php
7ec91347b83f
6.9 KiB
text/x-php
there we go
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | <?php
/**
* @version $Id: view.php 11213 2008-10-25 12:43:11Z pasamio $
* @package Joomla
* @subpackage Content
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant to the
* GNU General Public License, and as distributed it includes or is derivative
* of works licensed under the GNU General Public License or other free or open
* source software licenses. See COPYRIGHT.php for copyright notices and
* details.
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.component.view');
/**
* HTML Article Element View class for the Content component
*
* @package Joomla
* @subpackage Content
* @since 1.5
*/
class ContentViewElement extends JView
{
function display()
{
global $mainframe;
// Initialize variables
$db = &JFactory::getDBO();
$nullDate = $db->getNullDate();
$document = & JFactory::getDocument();
$document->setTitle('Article Selection');
JHTML::_('behavior.modal');
$template = $mainframe->getTemplate();
$document->addStyleSheet("templates/$template/css/general.css");
$limitstart = JRequest::getVar('limitstart', '0', '', 'int');
$lists = $this->_getLists();
//Ordering allowed ?
$ordering = ($lists['order'] == 'section_name' && $lists['order_Dir'] == 'ASC');
$rows = &$this->get('List');
$page = &$this->get('Pagination');
JHTML::_('behavior.tooltip');
?>
<form action="index.php?option=com_content&task=element&tmpl=component&object=id" method="post" name="adminForm">
<table>
<tr>
<td width="100%">
<?php echo JText::_( 'Filter' ); ?>:
<input type="text" name="search" id="search" value="<?php echo $lists['search'];?>" class="text_area" onchange="document.adminForm.submit();" />
<button onclick="this.form.submit();"><?php echo JText::_( 'Go' ); ?></button>
<button onclick="document.getElementById('search').value='';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
</td>
<td nowrap="nowrap">
<?php
echo $lists['sectionid'];
echo $lists['catid'];
?>
</td>
</tr>
</table>
<table class="adminlist" cellspacing="1">
<thead>
<tr>
<th width="5">
<?php echo JText::_( 'Num' ); ?>
</th>
<th class="title">
<?php echo JHTML::_('grid.sort', 'Title', 'c.title', @$lists['order_Dir'], @$lists['order'] ); ?>
</th>
<th width="7%">
<?php echo JHTML::_('grid.sort', 'Access', 'groupname', @$lists['order_Dir'], @$lists['order'] ); ?>
</th>
<th width="2%" class="title">
<?php echo JHTML::_('grid.sort', 'ID', 'c.id', @$lists['order_Dir'], @$lists['order'] ); ?>
</th>
<th class="title" width="15%" nowrap="nowrap">
<?php echo JHTML::_('grid.sort', 'Section', 'section_name', @$lists['order_Dir'], @$lists['order'] ); ?>
</th>
<th class="title" width="15%" nowrap="nowrap">
<?php echo JHTML::_('grid.sort', 'Category', 'cc.title', @$lists['order_Dir'], @$lists['order'] ); ?>
</th>
<th align="center" width="10">
<?php echo JHTML::_('grid.sort', 'Date', 'c.created', @$lists['order_Dir'], @$lists['order'] ); ?>
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="15">
<?php echo $page->getListFooter(); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php
$k = 0;
for ($i=0, $n=count( $rows ); $i < $n; $i++)
{
$row = &$rows[$i];
$link = '';
$date = JHTML::_('date', $row->created, JText::_('DATE_FORMAT_LC4') );
$access = JHTML::_('grid.access', $row, $i, $row->state );
?>
<tr class="<?php echo "row$k"; ?>">
<td>
<?php echo $page->getRowOffset( $i ); ?>
</td>
<td>
<a style="cursor: pointer;" onclick="window.parent.jSelectArticle('<?php echo $row->id; ?>', '<?php echo str_replace(array("'", "\""), array("\\'", ""),$row->title); ?>', '<?php echo JRequest::getVar('object'); ?>');">
<?php echo htmlspecialchars($row->title, ENT_QUOTES, 'UTF-8'); ?></a>
</td>
<td align="center">
<?php echo $row->groupname;?>
</td>
<td>
<?php echo $row->id; ?>
</td>
<td>
<?php echo $row->section_name; ?>
</td>
<td>
<?php echo $row->cctitle; ?>
</td>
<td nowrap="nowrap">
<?php echo $date; ?>
</td>
</tr>
<?php
$k = 1 - $k;
}
?>
</tbody>
</table>
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $lists['order']; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $lists['order_Dir']; ?>" />
</form>
<?php
}
function _getLists()
{
global $mainframe;
// Initialize variables
$db = &JFactory::getDBO();
// Get some variables from the request
$sectionid = JRequest::getVar( 'sectionid', -1, '', 'int' );
$redirect = $sectionid;
$option = JRequest::getCmd( 'option' );
$filter_order = $mainframe->getUserStateFromRequest('articleelement.filter_order', 'filter_order', '', 'cmd');
$filter_order_Dir = $mainframe->getUserStateFromRequest('articleelement.filter_order_Dir', 'filter_order_Dir', '', 'word');
$filter_state = $mainframe->getUserStateFromRequest('articleelement.filter_state', 'filter_state', '', 'word');
$catid = $mainframe->getUserStateFromRequest('articleelement.catid', 'catid', 0, 'int');
$filter_authorid = $mainframe->getUserStateFromRequest('articleelement.filter_authorid', 'filter_authorid', 0, 'int');
$filter_sectionid = $mainframe->getUserStateFromRequest('articleelement.filter_sectionid', 'filter_sectionid', -1, 'int');
$limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
$limitstart = $mainframe->getUserStateFromRequest('articleelement.limitstart', 'limitstart', 0, 'int');
$search = $mainframe->getUserStateFromRequest('articleelement.search', 'search', '', 'string');
$search = JString::strtolower($search);
// get list of categories for dropdown filter
$filter = ($filter_sectionid >= 0) ? ' WHERE cc.section = '.$db->Quote($filter_sectionid) : '';
// get list of categories for dropdown filter
$query = 'SELECT cc.id AS value, cc.title AS text, section' .
' FROM #__categories AS cc' .
' INNER JOIN #__sections AS s ON s.id = cc.section' .
$filter .
' ORDER BY s.ordering, cc.ordering';
$lists['catid'] = ContentHelper::filterCategory($query, $catid);
// get list of sections for dropdown filter
$javascript = 'onchange="document.adminForm.submit();"';
$lists['sectionid'] = JHTML::_('list.section', 'filter_sectionid', $filter_sectionid, $javascript);
// table ordering
$lists['order_Dir'] = $filter_order_Dir;
$lists['order'] = $filter_order;
// search filter
$lists['search'] = $search;
return $lists;
}
}
|