本文整理汇总了PHP中K2HelperRoute::getDateRoute方法的典型用法代码示例。如果您正苦于以下问题:PHP K2HelperRoute::getDateRoute方法的具体用法?PHP K2HelperRoute::getDateRoute怎么用?PHP K2HelperRoute::getDateRoute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类K2HelperRoute
的用法示例。
在下文中一共展示了K2HelperRoute::getDateRoute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getArchive
public static function getArchive($params)
{
$model = K2Model::getInstance('Items');
$model->setState('site', true);
$filter = $params->get('archiveCategory');
$model->setState('category.filter', $filter);
$model->setState('sorting', 'created.reverse');
$rows = $model->getArchive();
$months = array(JText::_('K2_JANUARY'), JText::_('K2_FEBRUARY'), JText::_('K2_MARCH'), JText::_('K2_APRIL'), JText::_('K2_MAY'), JText::_('K2_JUNE'), JText::_('K2_JULY'), JText::_('K2_AUGUST'), JText::_('K2_SEPTEMBER'), JText::_('K2_OCTOBER'), JText::_('K2_NOVEMBER'), JText::_('K2_DECEMBER'));
$archives = array();
$root = isset($filter->categories[0]) ? $filter->categories[0] : 0;
foreach ($rows as $row) {
$row->numOfItems = '';
if ($params->get('archiveItemsCounter')) {
$row->numOfItems = self::countArchiveItems($row->month, $row->year, $root);
}
$row->name = $months[$row->month - 1];
$row->link = JRoute::_(K2HelperRoute::getDateRoute($row->year, $row->month, null, $root));
// Legacy
$row->y = $row->year;
$archives[] = $row;
}
return $archives;
}
示例2: getDateLink
function getDateLink($day, $month, $year)
{
$mainframe = JFactory::getApplication();
$user = JFactory::getUser();
$aid = $user->get('aid');
$db = JFactory::getDBO();
$jnow = JFactory::getDate();
$now = K2_JVERSION == '15' ? $jnow->toMySQL() : $jnow->toSql();
$nullDate = $db->getNullDate();
$languageCheck = '';
if (K2_JVERSION != '15') {
$accessCheck = " access IN(" . implode(',', $user->getAuthorisedViewLevels()) . ") ";
if ($mainframe->getLanguageFilter()) {
$languageTag = JFactory::getLanguage()->getTag();
$languageCheck = " AND language IN (" . $db->Quote($languageTag) . ", " . $db->Quote('*') . ") ";
}
} else {
$accessCheck = " access <= {$aid}";
}
$query = "SELECT COUNT(*) FROM #__k2_items WHERE YEAR(created)={$year} AND MONTH(created)={$month} AND DAY(created)={$day} AND published=1 AND ( publish_up = " . $db->Quote($nullDate) . " OR publish_up <= " . $db->Quote($now) . " ) AND ( publish_down = " . $db->Quote($nullDate) . " OR publish_down >= " . $db->Quote($now) . " ) AND trash=0 AND {$accessCheck} {$languageCheck} AND EXISTS(SELECT * FROM #__k2_categories WHERE id= #__k2_items.catid AND published=1 AND trash=0 AND {$accessCheck} {$languageCheck})";
$catid = $this->category;
if ($catid > 0) {
$query .= " AND catid={$catid}";
}
$db->setQuery($query);
$result = $db->loadResult();
if ($db->getErrorNum()) {
echo $db->stderr();
return false;
}
if ($result > 0) {
if ($catid > 0) {
return JRoute::_(K2HelperRoute::getDateRoute($year, $month, $day, $catid));
} else {
return JRoute::_(K2HelperRoute::getDateRoute($year, $month, $day));
}
} else {
return false;
}
}