Index: trunk/kernel/include/category.php =================================================================== diff -u -r470 -r495 --- trunk/kernel/include/category.php (.../category.php) (revision 470) +++ trunk/kernel/include/category.php (.../category.php) (revision 495) @@ -1022,6 +1022,26 @@ */ $ret = $this->ItemCount(); break; + + case 'modified': + $ret = ''; + $date = $this->Get('Modified'); + if( $element->GetAttributeByName('_tz') ) + { + $date = GetLocalTime($date,$objSession->Get("tz")); + } + + $part = strtolower($element->GetAttributeByName('_part') ); + if(strlen($part)) + { + $ret = ExtractDatePart($part,$date); + } + else + { + $ret = ($date <= 0) ? '' : LangDate($date); + } + break; + case "itemdate": /* @field:cat.itemdate @@ -1300,18 +1320,35 @@ return $res; } - function UpdateCacheCounts() + function UpdateCacheCounts() { - global $objItemTypes; - - $CatId = $this->Get("CategoryId"); - - if($CatId>0) - { - //echo "Updating count for ".$this->Get("CachedNavbar")."
\n"; - UpdateCategoryCount(0,$CatId); - } - } + global $objItemTypes; + + $CatId = $this->Get("CategoryId"); + + if($CatId>0) + { + //echo "Updating count for ".$this->Get("CachedNavbar")."
\n"; + UpdateCategoryCount(0,$CatId); + } + } + + /** + * @return void + * @param int $date + * @desc Set Modified field for category & all it's parent categories + */ + function SetLastUpdate($date) + { + $parents = $this->Get('ParentPath'); + $parents = substr($parents, 1, strlen($parents) - 2 ); + $parents = explode('|', $parents); + + $db =& GetADODBConnection(); + $sql = 'UPDATE '.$this->tablename.' SET Modified = '.$date.' WHERE CategoryId IN ('.implode(',', $parents).')'; + $db->Execute($sql); + } + }