Get("CategoryId")."\" _SubCats=\"1\" ";
$txt .=" _ListType=\"category\" _CountCurrent=\"1\" _ForceUpdate=\"$ForceUpdate\" _ItemType=\"$TypeId\" _GroupOnly=\"$GroupOnly\" />";
$tag = new clsHtmlTag($txt);
- $ret = $tag->Execute();
+ $ret = $tag->Execute();
//echo "Category parseobject: $ret
";
}
else
@@ -1190,11 +1191,11 @@
case "totalitems":
/*
@field:cat.totalitems
- @description:returns the number of items in the category and all subcategories
- */
- $ret = $this->ItemCount();
+ @description:returns the number of items in the category and all subcategories
+ */
+ $ret = $this->ItemCount();
break;
-
+
case 'modified':
$ret = '';
$date = $this->Get('Modified');
@@ -1214,14 +1215,14 @@
$ret = ($date <= 0) ? '' : LangDate($date);
}
break;
-
+
case "itemdate":
/*
@field:cat.itemdate
@description:Returns the date the cache count was last updated
@attrib:_itemtype:Item name to check
@attrib:_tz:bool:Convert the date to the user's local time
- @attrib:_part::Returns part of the date. The following options are available: month,day,year,time_24hr,time_12hr
+ @attrib:_part::Returns part of the date. The following options are available: month,day,year,time_24hr,time_12hr
*/
$typestr = $element->GetAttributeByName('_itemtype');
$type = $objItemTypes->GetTypeByName($typestr);
@@ -1233,9 +1234,9 @@
{
$date = $cc->Get("LastUpdate");
}
- else
+ else
$date = "";
-
+
//$date = $this->GetCacheCountDate($TypeId);
if( $element->GetAttributeByName('_tz') )
{
@@ -1264,8 +1265,8 @@
/*
@field:cat.new
@description:returns text if category's status is "new"
- @attrib:_label:lang: Text to return if status is new
- */
+ @attrib:_label:lang: Text to return if status is new
+ */
if($this->IsNewItem())
{
$ret = $element->GetAttributeByName('_label');
@@ -1280,8 +1281,8 @@
/*
@field:cat.pick
@description:returns text if article's status is "hot"
- @attrib:_label:lang: Text to return if status is "hot"
- */
+ @attrib:_label:lang: Text to return if status is "hot"
+ */
if($this->Get("EditorsPick")==1)
{
$ret = $element->GetAttributeByName('_label');
@@ -1292,49 +1293,49 @@
else
$ret = "";
break;
-
+
case "parsetag":
/*
@field:cat.parsetag
@description:returns a tag output with this categoriy set as a current category
- @attrib:_tag:: tag name
- */
-
+ @attrib:_tag:: tag name
+ */
+
$tag = new clsHtmlTag();
$tag->name = $element->GetAttributeByName('_tag');
- $tag->attributes = $element->attributes;
- $tag->attributes["_catid"] = $this->Get("CategoryId");
- $ret = $tag->Execute();
+ $tag->attributes = $element->attributes;
+ $tag->attributes["_catid"] = $this->Get("CategoryId");
+ $ret = $tag->Execute();
break;
-
-
+
+
/*
@field:cat.relevance
@description:Displays the category relevance in search results
@attrib:_displaymode:: How the relevance should be displayed
- - "Numerical": Show the decimal value
+
- "Numerical": Show the decimal value
- "Bar": Show the HTML representing the relevance. Returns two HTML cells ≶td< with specified background colors
- "Graphical":Show image representing the relevance
-
+
@attrib:_onimage::Zero relevance image shown in graphical display mode. Also used as prefix to build other images (i.e. prefix+"_"+percentage+".file_extension"
@attrib:_OffBackGroundColor::Off background color of HTML cell in bar display mode
- @attrib:_OnBackGroundColor::On background color of HTML cell in bar display mode
- */
-
+ @attrib:_OnBackGroundColor::On background color of HTML cell in bar display mode
+ */
+
}
if( !isset($ret) ) $ret = parent::ParseObject($element);
-
+
}
return $ret;
}
function parsetag($tag)
- {
+ {
global $objConfig,$objUsers, $m_var_list, $m_var_list_update;
if(is_object($tag))
- {
+ {
$tagname = $tag->name;
}
else
@@ -1344,10 +1345,10 @@
{
case "cat_id":
return $this->Get("CategoryId");
- break;
+ break;
case "cat_parent":
return $this->Get("ParentId");
- break;
+ break;
case "cat_fullpath":
return $this->Get("CachedNavbar");
break;
@@ -1359,7 +1360,7 @@
break;
case "cat_priority":
if($this->Get("Priority")!=0)
- {
+ {
return (int)$this->Get("Priority");
}
else
@@ -1436,9 +1437,9 @@
$ret = "addcategory.php?env=" . BuildEnv();
unset($m_var_list_update["id"]);
return $ret;
- break;
+ break;
- case "cat_date":
+ case "cat_date":
return LangDate($this->Get("CreatedOn"), 0, true);
break;
case "cat_num_cats":
@@ -1470,21 +1471,21 @@
$nav = "";
//echo "Rebuilding Navbar..
\n";
if(strlen($this->Get("ParentPath"))==0)
- {
+ {
$this->UpdateCachedPath();
}
$cats = explode("|",substr($this->Get("ParentPath"),1,-1));
-
+
foreach($cats as $catid)
- {
+ {
$cat =& $objCatList->GetCategory($catid);
if(is_object($cat))
- {
+ {
if(strlen($cat->Get("Name")))
- $names[] = $cat->Get("Name");
-
+ $names[] = $cat->Get("Name");
+
}
- }
+ }
$nav = implode(">", $names);
$this->Set("CachedNavbar",$nav);
$this->Update();
@@ -1506,7 +1507,7 @@
UpdateCategoryCount(0,$CatId);
}
}*/
-
+
/**
* @return void
* @param int $date
@@ -1516,16 +1517,16 @@
{
$parents = $this->Get('ParentPath');
if (!$parents) return false;
-
+
$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);
}
-
-
+
+
}
class clsCatList extends clsItemList //clsItemCollection
@@ -1556,14 +1557,14 @@
function GetCountSQL($PermName,$CatId=NULL, $GroupId=NULL, $AdditonalWhere="")
{
global $objSession, $objPermissions, $objCatList;
-
+
$ltable = $this->SourceTable;
$acl = $objSession->GetACLClause();
$cattable = GetTablePrefix()."CategoryItems";
$CategoryTable = GetTablePrefix()."Category";
- $ptable = GetTablePrefix()."PermCache";
+ $ptable = GetTablePrefix()."PermCache";
$VIEW = $objPermissions->GetPermId($PermName);
-
+
$sql = "SELECT count(*) as CacheVal FROM $ltable ";
$sql .="INNER JOIN $ptable ON ($ltable.CategoryId=$ptable.CategoryId) ";
$sql .="WHERE ($acl AND PermId=$VIEW AND $ltable.Status=1) ";
@@ -1573,7 +1574,7 @@
$sql .= "AND (".$AdditonalWhere.")";
}
return $sql;
- }
+ }
function CountCategories($attribs)
{
@@ -1586,56 +1587,56 @@
}
if((int)$cat>0)
$c = $this->GetCategory($cat);
-
+
if( getArrayValue($attribs,'_subcats') && $cat>0)
{
$ParentWhere = "(ParentPath LIKE '".$c->Get("ParentPath")."%' AND ".$this->SourceTable.".CategoryId != $cat)";
}
if( getArrayValue($attribs,'_today') )
{
- $today = adodb_mktime(0,0,0,adodb_date("m"),adodb_date("d"),adodb_date("Y"));
- $TodayWhere = "(CreatedOn>=$today)";
+ $today = adodb_mktime(0,0,0,adodb_date("m"),adodb_date("d"),adodb_date("Y"));
+ $TodayWhere = "(CreatedOn>=$today)";
}
else
{
$TodayWhere = '';
}
if( getArrayValue($attribs,'_grouponly') )
{
- $GroupList = $objSession->Get("GroupList");
+ $GroupList = $objSession->Get("GroupList");
}
- else
+ else
$GroupList = NULL;
-
+
$where = "";
if(strlen($ParentWhere))
{
- $where = $ParentWhere;
+ $where = $ParentWhere;
}
if(strlen($TodayWhere))
{
- if(strlen($where))
+ if(strlen($where))
$where .=" AND ";
$where .= $TodayWhere;
}
$sql = $this->GetCountSQL("CATEGORY.VIEW",$cat,$GroupList,$where);
-
+
// echo "SQL: ".$sql."
";
-
- $rs = $this->adodbConnection->Execute($sql);
+
+ $rs = $this->adodbConnection->Execute($sql);
if($rs && !$rs->EOF)
{
- $ret = $rs->fields["CacheVal"];
+ $ret = $rs->fields["CacheVal"];
}
else
$ret = 0;
-
- return $ret;
- }
-
+
+ return $ret;
+ }
+
function CurrentCategoryID()
{
- global $m_var_list;
+ global $m_var_list;
return (int)$m_var_list["cat"];
}
@@ -1660,63 +1661,63 @@
return $this->GetItemByField("ResourceId",$ResId);
}
- function QueryOrderByClause($EditorsPick=FALSE,$Priority=FALSE,$UseTableName=FALSE)
+ function QueryOrderByClause($EditorsPick=FALSE,$Priority=FALSE,$UseTableName=FALSE)
{
global $objSession;
-
+
if($UseTableName)
{
$TableName = $this->SourceTable.".";
}
else
- $TableName = "";
+ $TableName = "";
$Orders = array();
- if($EditorsPick)
+ if($EditorsPick)
{
$Orders[] = $TableName."EditorsPick DESC";
}
if($Priority)
{
- $Orders[] = $TableName."Priority DESC";
+ $Orders[] = $TableName."Priority DESC";
}
-
+
$FieldVar = "Category_Sortfield";
$OrderVar = "Category_Sortorder";
-
+
if(is_object($objSession))
{
- if(strlen($objSession->GetPersistantVariable($FieldVar))>0)
- {
- $Orders[] = trim($TableName.$objSession->GetPersistantVariable($FieldVar) . " ".
- $objSession->GetPersistantVariable($OrderVar));
+ if(strlen($objSession->GetPersistantVariable($FieldVar))>0)
+ {
+ $Orders[] = trim($TableName.$objSession->GetPersistantVariable($FieldVar) . " ".
+ $objSession->GetPersistantVariable($OrderVar));
}
}
$FieldVar = "Category_Sortfield2";
$OrderVar = "Category_Sortorder2";
-
+
if(is_object($objSession))
{
- if(strlen($objSession->GetPersistantVariable($FieldVar))>0)
- {
- $Orders[] = trim($TableName.$objSession->GetPersistantVariable($FieldVar) . " ".
- $objSession->GetPersistantVariable($OrderVar));
+ if(strlen($objSession->GetPersistantVariable($FieldVar))>0)
+ {
+ $Orders[] = trim($TableName.$objSession->GetPersistantVariable($FieldVar) . " ".
+ $objSession->GetPersistantVariable($OrderVar));
}
}
-
-
+
+
if(count($Orders)>0)
{
$OrderBy = "ORDER BY ".implode(", ",$Orders);
}
- else
+ else
$OrderBy="";
- return $OrderBy;
+ return $OrderBy;
}
-
+
function LoadCategories($where="", $orderBy = "", $no_limit = true, $fix_method = 'set_first')
{
// load category list using $where clause
@@ -1725,7 +1726,7 @@
// in case if stored page is greather then page count issue page_fixing with
// method specified (see "FixInvalidPage" method for details)
$PerPage = $this->GetPerPage();
-
+
$this->QueryItemCount = TableCount($this->SourceTable,$where,0);
if($no_limit == false)
{
@@ -1734,13 +1735,13 @@
$limit = "LIMIT ".$Start.",".$PerPage;
}
else
- $limit = NULL;
-
+ $limit = NULL;
+
return $this->Query_Category($where, $orderBy, $limit);
}
function Query_Category($whereClause="",$orderByClause="",$limit=NULL)
- {
+ {
global $m_var_list, $objSession, $Errors, $objPermissions;
$GroupID = $objSession->Get("GroupID");
$resultset = array();
@@ -1749,11 +1750,11 @@
$ptable = GetTablePrefix()."PermCache";
$CAT_VIEW = $objPermissions->GetPermId("CATEGORY.VIEW");
if(!$objSession->HasSystemPermission("ADMIN"))
- {
+ {
$sql = "SELECT * FROM $table INNER JOIN $ptable ON ($ptable.CategoryId=$table.CategoryId)";
- $acl_where = $objSession->GetACLClause();
+ $acl_where = $objSession->GetACLClause();
if(strlen($whereClause))
- {
+ {
$sql .= " WHERE ($acl_where) AND PermId=$CAT_VIEW AND ".$whereClause;
}
else
@@ -1772,7 +1773,7 @@
//echo "SQL: $sql
";
return $this->Query_item($sql);
}
-
+
function CountPending()
{
return TableCount($this->SourceTable,"Status=".STATUS_PENDING,0);
@@ -1786,7 +1787,7 @@
$PerPage = $this->GetPerPage();
$NumPages = ceil( $this->GetNumPages($PerPage) );
-
+
if($NumPages == 1 && $HideEmpty) return '';
if(strlen($dest_template))
@@ -1844,11 +1845,11 @@
unset($m_var_list_update,$var_list_update["t"] );
return $o;
}
-
+
function GetAdminPageLinkList($url)
{
global $objConfig, $m_var_list_update, $var_list_update, $var_list;
-
+
$PerPage = $this->GetPerPage();
$NumPages = ceil($this->GetNumPages($PerPage));
$o = "";
@@ -1880,29 +1881,29 @@
else
$o .= "$p";
}
-
+
if($this->Page < $NumPages)
$o .= ">>";
- return $o;
+ return $o;
}
function Search_Category($orderByClause)
{
- global $objSession, $objConfig, $Errors;
+ global $objSession, $objConfig, $Errors;
$PerPage = $this->GetPerPage();
$Start = ($this->Page-1) * $PerPage;
$objResults = new clsSearchResults("Category","clsCategory");
$this->Clear();
$this->Categories = $objResults->LoadSearchResults($Start,$PerPage);
-
+
return $this->Categories;
}
function GetSubCats($ParentCat)
- {
+ {
return $this->Query_Category("ParentId=".$ParentCat,"");
}
@@ -1931,7 +1932,7 @@
}
function cat_navbar($admin=0, $cat, $target_template, $separator = " > ", $LinkLeaf = FALSE,
- $root = 0,$RootTemplate="",$modcat=0, $ModTemplate="", $LinkRoot = FALSE)
+ $root = 0,$RootTemplate="",$modcat=0, $ModTemplate="", $LinkRoot = FALSE)
{
// draw category navigation bar (at top)
global $Errors, $var_list_update, $var_list, $m_var_list_update, $m_var_list, $objConfig;
@@ -1941,13 +1942,13 @@
if( GetVar('new') ) $url_params['new'] = GetVar('new');
if( GetVar('destform') ) $url_params['destform'] = GetVar('destform');
if( GetVar('destfield') ) $url_params['destfield'] = GetVar('destfield');
-
+
$nav = "";
- $m_var_list_update["p"]=1;
+ $m_var_list_update["p"]=1;
if(strlen($target_template)==0)
$target_template = $var_list["t"];
-
-
+
+
if($cat == 0)
{
$cat_name = language($objConfig->Get("Root_Name"));
@@ -1962,15 +1963,15 @@
{
$nav = array();
$c =& $this->GetCategory($cat);
- $nav_unparsed = $c->Get("ParentPath");
+ $nav_unparsed = $c->Get("ParentPath");
if(strlen($nav_unparsed)==0)
- {
+ {
$c->UpdateCachedPath();
$nav_unparsed = $c->Get("ParentPath");
}
//echo " Before $nav_unparsed ";
if($root)
- {
+ {
$r =& $this->GetCategory($root);
$rpath = $r->Get("ParentPath");
$nav_unparsed = substr($nav_unparsed,strlen($rpath),-1);
@@ -1981,8 +1982,8 @@
$nav[] = "".$cat_name.""; //href=\"browse.php?env=". BuildEnv() ."\"
}
else
- {
- if ($admin == 1)
+ {
+ if ($admin == 1)
{
$nav[] = "".$cat_name."";
}
@@ -2001,7 +2002,7 @@
}
}
else
- {
+ {
$nav_unparsed = substr($nav_unparsed,1,-1);
$cat_name = language($objConfig->Get("Root_Name"));
$m_var_list_update["cat"] = 0;
@@ -2010,8 +2011,8 @@
$nav[] = "".$cat_name.""; //href=\"browse.php?env=". BuildEnv() ."\"
}
else
- {
- if ($admin == 1)
+ {
+ if ($admin == 1)
{
$nav[] = "".$cat_name."";
}
@@ -2026,36 +2027,36 @@
$nav[] = "".$cat_name."";
}
}
-
+
}
//echo " After $nav_unparsed
\n";
if(strlen($target_template)==0)
- $target_template = $var_list["t"];
-
+ $target_template = $var_list["t"];
+
$cats = explode("|", $nav_unparsed);
foreach($cats as $catid)
{
if($catid)
- {
+ {
$c =& $this->GetCategory($catid);
if(is_object($c))
- {
+ {
$cat_name = $c->Get("Name");
-
+
$m_var_list_update["cat"] = $catid;
if($catid==$modcat && strlen($ModTemplate)>0)
{
$t = $ModTemplate;
}
- else
+ else
$t = $target_template;
if($cat == $catid && !$LinkLeaf)
{
$nav[] = "".$cat_name."";
}
else
- {
- if ($admin == 1)
+ {
+ if ($admin == 1)
{
$nav[] = "".$cat_name."";
}
@@ -2066,17 +2067,17 @@
unset($var_list_update["t"]);
}
}
- unset($m_var_list_update["cat"]);
+ unset($m_var_list_update["cat"]);
}
- }
+ }
}
$nav = implode($separator, $nav);
}
return $nav;
}
- function &Add_NEW($fields_hash)
+ function &Add_NEW($fields_hash, $from_import = false)
{
global $objSession;
@@ -2096,21 +2097,24 @@
}
$d->Create();
- if ($d->Get('Status') == STATUS_ACTIVE) {
- $d->SendUserEventMail("CATEGORY.ADD", $objSession->Get("PortalUserId"));
- $d->SendAdminEventMail("CATEGORY.ADD");
+
+ if (!$from_import) {
+ if ($d->Get('Status') == STATUS_ACTIVE) {
+ $d->SendUserEventMail("CATEGORY.ADD", $objSession->Get("PortalUserId"));
+ $d->SendAdminEventMail("CATEGORY.ADD");
+ }
+ else
+ {
+ $d->SendUserEventMail("CATEGORY.ADD.PENDING", $objSession->Get("PortalUserId"));
+ $d->SendAdminEventMail("CATEGORY.ADD.PENDING");
+ }
+ $d->UpdateCachedPath();
}
- else
- {
- $d->SendUserEventMail("CATEGORY.ADD.PENDING", $objSession->Get("PortalUserId"));
- $d->SendAdminEventMail("CATEGORY.ADD.PENDING");
- }
- $d->UpdateCachedPath();
return $d;
}
function &Add( $ParentId, $Name, $Description, $CreatedOn, $EditorsPick, $Status, $Hot, $New, $Pop,
- $Priority, $MetaKeywords,$MetaDesc, $auto_filename = 1, $filename = '')
+ $Priority, $MetaKeywords,$MetaDesc, $auto_filename = 1, $filename = '')
{
global $objSession;
@@ -2119,13 +2123,13 @@
$d = new clsCategory(NULL);
$filename = $d->StripDisallowed($filename);
$d->tablename = $this->SourceTable;
-
+
if( $d->UsingTempTable() ) $d->Set('CategoryId', -1);
$d->idfield = 'CategoryId';
-
- $d->Set(Array( 'ParentId', 'Name', 'Description', 'CreatedOn', 'EditorsPick', 'Status', 'HotItem',
+
+ $d->Set(Array( 'ParentId', 'Name', 'Description', 'CreatedOn', 'EditorsPick', 'Status', 'HotItem',
'NewItem','PopItem', 'Priority', 'MetaKeywords', 'MetaDescription', 'CreatedById',
- 'AutomaticFilename', 'Filename'),
+ 'AutomaticFilename', 'Filename'),
Array( $ParentId, $Name, $Description, $CreatedOn, $EditorsPick, $Status, $Hot, $New,
$Pop, $Priority, $MetaKeywords,$MetaDesc, $UserId, $auto_filename, $filename) );
@@ -2163,19 +2167,19 @@
function Move_Category($Id, $ParentTo)
{
global $objCatList;
-
+
$d =& $this->GetCategory($Id);
- $oldparent = $d->Get("ParentId");
+ $oldparent = $d->Get("ParentId");
$ChildList = $d->GetSubCatIds();
-
+
/*
echo "Target Parent Id: $ParentTo
\n";
echo "";print_r($ChildList); echo "
";
echo "Old Parent: $oldparent
\n";
echo "ID: $Id
\n";
*/
/* sanity checks */
-
+
if(!in_array($ParentTo,$ChildList) && $oldparent != $ParentTo && $oldparent != $Id &&
$Id != $ParentTo)
{
@@ -2186,15 +2190,15 @@
RunUp($oldparent, "Decrement_Count");
RunUp($ParentTo, "Increment_Count");
RunDown($ParentTo, "UpdateCachedPath");
- return TRUE;
+ return TRUE;
}
- else
+ else
{
global $Errors;
$Errors->AddAdminUserError("la_error_move_subcategory");
return FALSE;
- }
- die();
+ }
+ die();
}
function Copy_CategoryTree($Id, $ParentTo)
@@ -2210,7 +2214,7 @@
if ($result && !$result->EOF)
{
while(!$result->EOF)
- {
+ {
$this->Copy_CategoryTree($result->fields["CategoryId"], $new);
$result->MoveNext();
}
@@ -2220,19 +2224,19 @@
}
function Copy_Category($Id, $ParentTo)
- {
+ {
global $objGroups;
-
+
$src = $this->GetCategory($Id);
$Children = $src->GetSubCatIds();
if($Id==$ParentTo || in_array($ParentTo,$Children))
{
/* sanity error here */
global $Errors;
- $Errors->AddAdminUserError("la_error_copy_subcategory");
+ $Errors->AddAdminUserError("la_error_copy_subcategory");
return 0;
- }
+ }
$dest = $src;
$dest->Set("ParentId", $ParentTo);
if ($src->get("ParentId") == $ParentTo)
@@ -2251,20 +2255,20 @@
$Name = $parts[2]." ".$parts[3];
}
else
- $Name = $OldName;
+ $Name = $OldName;
}
else
- $Name = $OldName;
+ $Name = $OldName;
//echo "New Name: $Name
";
- $dest->Set("Name", $Name);
- $Names = CategoryNameCount($ParentTo,$Name);
+ $dest->Set("Name", $Name);
+ $Names = CategoryNameCount($ParentTo,$Name);
//echo "Names Count: ".count($Names)."
";
if(count($Names)>0)
- {
+ {
$NameCount = count($Names);
$found = FALSE;
$NewName = "Copy of $Name";
-
+
if(!in_array($NewName,$Names))
{
//echo "Matched on $NewName in:
\n";
@@ -2281,55 +2285,55 @@
$found = TRUE;
break;
}
-
+
}
- }
+ }
if(!$found)
{
$NameCount++;
$NewName = "Copy $NameCount of $Name";
- }
+ }
//echo "New Name: $NewName
";
- $dest->Set("Name",$NewName);
+ $dest->Set("Name",$NewName);
}
-
+
}
$dest->UnsetIdField();
$dest->Set("CachedDescendantCatsQty",0);
$dest->Set("ResourceId",NULL);
$dest->Set('Filename', '');
- $dest->Create();
- $dest->UpdateCachedPath();
+ $dest->Create();
+ $dest->UpdateCachedPath();
$p = new clsPermList();
- $p->Copy_Permissions($src->Get("CategoryId"),$dest->Get("CategoryId"));
+ $p->Copy_Permissions($src->Get("CategoryId"),$dest->Get("CategoryId"));
$glist = $objGroups->GetAllGroupList();
$view = $p->GetGroupPermList($dest, "CATEGORY.VIEW", $glist);
$dest->SetViewPerms("CATEGORY.VIEW",$view,$glist);
RunUp($ParentTo, "Increment_Count");
- return $dest->Get("CategoryId");
+ return $dest->Get("CategoryId");
}
function Delete_Category($Id)
{
global $objSession;
$d =& $this->GetCategory($Id);
-
+
if(is_object($d))
- {
+ {
if($d->Get("CategoryId")==$Id)
- {
+ {
$d->SendUserEventMail("CATEGORY.DELETE",$objSession->Get("PortalUserId"));
$d->SendAdminEventMail("CATEGORY.DELETE");
- $p =& $this->GetCategory($d->Get("ParentId"));
+ $p =& $this->GetCategory($d->Get("ParentId"));
RunDown($d->Get("CategoryId"), "Delete");
- RunUp($p->Get("CategoryId"), "Decrement_Count");
+ RunUp($p->Get("CategoryId"), "Decrement_Count");
RunUp($d->Get("CategoryId"),"ClearCacheData");
}
}
}
-
+
function PasteFromClipboard($TargetCat)
{
global $objSession;
@@ -2342,17 +2346,17 @@
$item_ids = explode(",",$ClipBoard["ids"]);
for($i=0;$iGetItem($item_ids[$i]);
if(!$IsCopy)
- {
- $this->Move_Category($ItemId, $TargetCat);
+ {
+ $this->Move_Category($ItemId, $TargetCat);
$clip = str_replace("CUT","COPY",$clip);
$objSession->SetVariable("ClipBoard",$clip);
}
else
- {
+ {
$this->Copy_CategoryTree($ItemId,$TargetCat);
}
}
@@ -2361,7 +2365,7 @@
function NumChildren($ParentID)
- {
+ {
$cat_filter = "m_cat_filter";
global $$cat_filter;
@@ -2393,9 +2397,9 @@
$c->SetFromArray($data);
$c->UpdateCachedPath();
$rs->MoveNext();
- }
+ }
}
-
+
function CopyFromEditTable($idfield)
{
global $objGroups, $objSession, $objPermList;
@@ -2410,11 +2414,11 @@
{
$data = $rs->fields;
$c = new $this->classname;
- $c->SetFromArray($data);
- $c->Dirty();
-
+ $c->SetFromArray($data);
+ $c->Dirty();
+
if($c->Get("CategoryId")>0)
- {
+ {
$c->Update();
}
else
@@ -2424,13 +2428,13 @@
$sql = "UPDATE ".GetTablePrefix()."Permissions SET CatId=".$c->Get("CategoryId")." WHERE CatId=-1";
$this->adodbConnection->Execute($sql);
}
- $c->UpdateCachedPath();
+ $c->UpdateCachedPath();
$c->UpdateACL();
$c->SendUserEventMail("CATEGORY.MODIFY",$objSession->Get("PortalUserId"));
$c->SendAdminEventMail("CATEGORY.MODIFY");
$c->Related = new clsRelationshipList();
if(is_object($c->Related))
- {
+ {
$r = $c->Related;
$r->CopyFromEditTable($c->Get("ResourceId"));
}
@@ -2445,8 +2449,8 @@
unset($GLOBALS['_CopyFromEditTable']);
return $item_ids;
//$this->UpdateMissingCacheData();
- }
-
+ }
+
function PurgeEditTable($idfield)
{
parent::PurgeEditTable($idfield);
@@ -2472,65 +2476,65 @@
$p = substr($path,0,strlen($rpath));
//echo $rpath." vs. .$p [$path]
\n";
if($rpath==$p)
- {
+ {
$itemtype = $Type;
break;
}
- }
+ }
}
return $itemtype;
}
}
function RunUp($Id, $function, $Param=NULL)
-{
+{
global $objCatList;
$d = $objCatList->GetCategory($Id);
$ParentId = $d->Get("ParentId");
if ($ParentId == 0)
{
if($Param == NULL)
- {
+ {
$d->$function();
}
else
- {
+ {
$d->$function($Param);
}
}
else
{
RunUp($ParentId, $function, $Param);
if($Param == NULL)
- {
+ {
$d->$function();
}
else
- {
+ {
$d->$function($Param);
}
}
-
+
}
function RunDown($Id, $function, $Param=NULL)
{
global $objCatList;
- $adodbConnection = &GetADODBConnection();
+ $adodbConnection = &GetADODBConnection();
$sql = "select CategoryId from ".GetTablePrefix()."Category where ParentId='$Id'";
$rs = $adodbConnection->Execute($sql);
-
- while($rs && !$rs->EOF)
- {
- RunDown($rs->fields["CategoryId"], $function, $Param);
+
+ while($rs && !$rs->EOF)
+ {
+ RunDown($rs->fields["CategoryId"], $function, $Param);
$rs->MoveNext();
}
$d = $objCatList->GetCategory($Id);
if($Param == NULL)
- {
+ {
$d->$function();
}
else