Index: branches/RC/core/units/categories/categories_tag_processor.php
===================================================================
diff -u -r8929 -r8991
--- branches/RC/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 8929)
+++ branches/RC/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 8991)
@@ -513,6 +513,58 @@
{
return 'events['.$this->Prefix.']['.$params['event'].']';
}
+
+ /**
+ * Returns last modification date of items in category / system
+ *
+ * @param Array $params
+ * @return string
+ */
+ function LastUpdated($params)
+ {
+ $category_id = $this->Application->GetVar('m_cat_id');
+ $table_name = $this->Application->getUnitOption($this->Prefix, 'TableName');
+
+ if (isset($params['local']) && $params['local'] && $category_id > 0) {
+ // scan only current category & it's children
+ $sql = 'SELECT TreeLeft, TreeRight
+ FROM '.TABLE_PREFIX.'Category
+ WHERE CategoryId = '.$category_id;
+ $tree_info = $this->Conn->GetRow($sql);
+
+ $sql = 'SELECT MAX(c.Modified) AS ModDate, MAX(c.CreatedOn) AS NewDate
+ FROM '.TABLE_PREFIX.'Category c
+ WHERE c.TreeLeft BETWEEN '.$tree_info['TreeLeft'].' AND '.$tree_info['TreeRight'];
+ }
+ else {
+ // scan all categories in system
+ $sql = 'SELECT MAX(Modified) AS ModDate, MAX(CreatedOn) AS NewDate
+ FROM '.$table_name;
+ }
+
+ $row_data = $this->Conn->GetRow($sql);
+ if (!$row_data) {
+ return '';
+ }
+
+ $date = $row_data[ $row_data['NewDate'] > $row_data['ModDate'] ? 'NewDate' : 'ModDate' ];
+
+ // format date
+ $format = isset($params['format']) ? $params['format'] : '_regional_DateTimeFormat';
+ if (preg_match("/_regional_(.*)/", $format, $regs)) {
+ $lang =& $this->Application->recallObject('lang.current');
+ if ($regs[1] == 'DateTimeFormat') {
+ // combined format
+ $format = $lang->GetDBField('DateFormat').' '.$lang->GetDBField('TimeFormat');
+ }
+ else {
+ // simple format
+ $format = $lang->GetDBField($regs[1]);
+ }
+ }
+
+ return adodb_date($format, $date);
+ }
}
Index: branches/RC/core/units/general/cat_tag_processor.php
===================================================================
diff -u -r8929 -r8991
--- branches/RC/core/units/general/cat_tag_processor.php (.../cat_tag_processor.php) (revision 8929)
+++ branches/RC/core/units/general/cat_tag_processor.php (.../cat_tag_processor.php) (revision 8991)
@@ -458,6 +458,60 @@
return preg_replace('/('.implode('|', $keywords).')/i', $opening.'\\1'.$closing, $ret);
}
+
+ /**
+ * Returns last modification date of items in category / system
+ *
+ * @param Array $params
+ * @return string
+ */
+ function LastUpdated($params)
+ {
+ $category_id = $this->Application->GetVar('m_cat_id');
+ $table_name = $this->Application->getUnitOption($this->Prefix, 'TableName');
+
+ if (isset($params['local']) && $params['local'] && $category_id > 0) {
+ // scan only current category & it's children
+ $sql = 'SELECT TreeLeft, TreeRight
+ FROM '.TABLE_PREFIX.'Category
+ WHERE CategoryId = '.$category_id;
+ $tree_info = $this->Conn->GetRow($sql);
+
+ $sql = 'SELECT MAX(item_table.Modified) AS ModDate, MAX(item_table.CreatedOn) AS NewDate
+ FROM '.$table_name.' item_table
+ LEFT JOIN '.TABLE_PREFIX.'CategoryItems ci ON (item_table.ResourceId = ci.ItemResourceId)
+ LEFT JOIN '.TABLE_PREFIX.'Category c ON c.CategoryId = ci.CategoryId
+ WHERE c.TreeLeft BETWEEN '.$tree_info['TreeLeft'].' AND '.$tree_info['TreeRight'];
+ }
+ else {
+ // scan all categories in system
+ $sql = 'SELECT MAX(Modified) AS ModDate, MAX(CreatedOn) AS NewDate
+ FROM '.$table_name;
+ }
+
+ $row_data = $this->Conn->GetRow($sql);
+ if (!$row_data) {
+ return '';
+ }
+
+ $date = $row_data[ $row_data['NewDate'] > $row_data['ModDate'] ? 'NewDate' : 'ModDate' ];
+
+ // format date
+ $format = isset($params['format']) ? $params['format'] : '_regional_DateTimeFormat';
+ if (preg_match("/_regional_(.*)/", $format, $regs)) {
+ $lang =& $this->Application->recallObject('lang.current');
+ if ($regs[1] == 'DateTimeFormat') {
+ // combined format
+ $format = $lang->GetDBField('DateFormat').' '.$lang->GetDBField('TimeFormat');
+ }
+ else {
+ // simple format
+ $format = $lang->GetDBField($regs[1]);
+ }
+ }
+
+ return adodb_date($format, $date);
+ }
}
?>
\ No newline at end of file
Index: branches/RC/themes/default2007/platform/elements/content_boxes/sub_categories.tpl
===================================================================
diff -u -r8929 -r8991
--- branches/RC/themes/default2007/platform/elements/content_boxes/sub_categories.tpl (.../sub_categories.tpl) (revision 8929)
+++ branches/RC/themes/default2007/platform/elements/content_boxes/sub_categories.tpl (.../sub_categories.tpl) (revision 8991)
@@ -6,20 +6,24 @@
- |
+
+ |