本文整理汇总了PHP中K2HelperHTML::stateToggler方法的典型用法代码示例。如果您正苦于以下问题:PHP K2HelperHTML::stateToggler方法的具体用法?PHP K2HelperHTML::stateToggler怎么用?PHP K2HelperHTML::stateToggler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类K2HelperHTML
的用法示例。
在下文中一共展示了K2HelperHTML::stateToggler方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
echo $row->id;
?>
" class="closeComment"><?php
echo JText::_('K2_CANCEL');
?>
</a>
<div class="clr"></div>
</div>
<input type="hidden" name="currentValue[]" value="<?php
echo $row->commentText;
?>
" />
</td>
<td class="k2Center">
<?php
echo $this->mainframe->isSite() ? K2HelperHTML::stateToggler($row, $key) : JHTML::_('grid.published', $row, $key);
?>
</td>
<td>
<?php
if ($this->mainframe->isAdmin() && $row->userID) {
?>
<a href="<?php
echo $this->userEditLink . $row->userID;
?>
"><?php
echo $row->userName;
?>
</a>
<?php
} else {
示例2: display
function display($tpl = null)
{
$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', 'c.id', 'cmd');
$filter_order_Dir = $mainframe->getUserStateFromRequest($option . $view . 'filter_order_Dir', 'filter_order_Dir', 'DESC', 'word');
$filter_state = $mainframe->getUserStateFromRequest($option . $view . 'filter_state', 'filter_state', -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');
$search = $mainframe->getUserStateFromRequest($option . $view . 'search', 'search', '', 'string');
$search = JString::strtolower($search);
if ($mainframe->isSite()) {
$filter_author = $user->id;
JRequest::setVar('filter_author', $user->id);
}
$this->loadHelper('html');
K2Model::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'models');
$model = K2Model::getInstance('Comments', 'K2Model');
$params = JComponentHelper::getParams('com_k2');
$total = $model->getTotal();
if ($limitstart > $total - $limit) {
$limitstart = max(0, (int) (ceil($total / $limit) - 1) * $limit);
JRequest::setVar('limitstart', $limitstart);
}
$comments = $model->getData();
$reportLink = $mainframe->isAdmin() ? 'index.php?option=com_k2&view=user&task=report&id=' : 'index.php?option=com_k2&view=comments&task=reportSpammer&id=';
foreach ($comments as $key => $comment) {
$comment->reportUserLink = false;
$comment->commenterLastVisitIP = NULL;
if ($comment->userID) {
$db = JFactory::getDBO();
$db->setQuery("SELECT ip FROM #__k2_users WHERE userID = " . $comment->userID);
$comment->commenterLastVisitIP = $db->loadResult();
$commenter = JFactory::getUser($comment->userID);
if ($commenter->name) {
$comment->userName = $commenter->name;
}
if ($mainframe->isSite()) {
if (K2_JVERSION != '15') {
if ($user->authorise('core.admin', 'com_k2')) {
$comment->reportUserLink = JRoute::_($reportLink . $comment->userID);
}
} else {
if ($user->gid > 24) {
$comment->reportUserLink = JRoute::_($reportLink . $comment->userID);
}
}
} else {
$comment->reportUserLink = JRoute::_($reportLink . $comment->userID);
}
}
if ($mainframe->isSite()) {
$comment->status = K2HelperHTML::stateToggler($comment, $key);
} else {
$comment->status = K2_JVERSION == '15' ? JHTML::_('grid.published', $comment, $key) : JHtml::_('jgrid.published', $comment->published, $key);
}
}
$this->assignRef('rows', $comments);
jimport('joomla.html.pagination');
$pageNav = new JPagination($total, $limitstart, $limit);
$this->assignRef('page', $pageNav);
$lists = array();
$lists['search'] = $search;
$lists['order_Dir'] = $filter_order_Dir;
$lists['order'] = $filter_order;
$filter_state_options[] = JHTML::_('select.option', -1, JText::_('K2_SELECT_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);
$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);
$lists['authors'] = JHTML::_('list.users', 'filter_author', $filter_author, true, '');
$this->assignRef('lists', $lists);
$this->assignRef('mainframe', $mainframe);
if (K2_JVERSION != '15') {
$dateFormat = JText::_('K2_J16_DATE_FORMAT');
} else {
$dateFormat = JText::_('K2_DATE_FORMAT');
}
$this->assignRef('dateFormat', $dateFormat);
if ($mainframe->isAdmin()) {
JToolBarHelper::title(JText::_('K2_COMMENTS'), 'k2.png');
JToolBarHelper::publishList();
JToolBarHelper::unpublishList();
JToolBarHelper::deleteList('', 'remove', 'K2_DELETE');
JToolBarHelper::custom('deleteUnpublished', 'delete', 'delete', 'K2_DELETE_ALL_UNPUBLISHED', false);
$toolbar = JToolBar::getInstance('toolbar');
if (K2_JVERSION != '15') {
JToolBarHelper::preferences('com_k2', 550, 875, 'K2_PARAMETERS');
} else {
$toolbar->appendButton('Popup', 'config', 'Parameters', 'index.php?option=com_k2&view=settings');
}
K2HelperHTML::subMenu();
//.........这里部分代码省略.........