示例#1
0
 static function getLastArticleModifiedDate($category, $children = false)
 {
     $category_ids = array($category->id);
     if ($children !== false) {
         $category_ids = array_merge($category_ids, TemplateContentCategoryHelper::getChildIds($children, $category));
     }
     $db = JFactory::getDBO();
     $query = $db->getQuery(true);
     $query->select('MAX(modified) AS max_modified, MAX(created) AS max_created');
     $query->from('#__content');
     $query->where('catid IN (' . implode(',', $category_ids) . ') AND state = 1');
     // echo $query->dump();
     $db->setQuery($query);
     $options = $db->loadObject();
     if (strtotime($options->max_modified) > strtotime($options->max_created)) {
         return JHtml::_('date', $options->max_modified, JText::_('DATE_FORMAT_LC2'));
     } else {
         return JHtml::_('date', $options->max_created, JText::_('DATE_FORMAT_LC2'));
     }
 }