+ $sql = 'SELECT CategoryId FROM '.$this->tablename.' WHERE (Filename = %s) AND (CategoryId != '.$this->UniqueId().') AND (ParentId = '.$m_var_list['cat'].')';
+ while ( $db->GetOne( sprintf($sql, $db->qstr($filename.$append)) ) > 0 )
+ function GetParentField($fieldname,$skipvalue,$default)
+ {
+ /* this function moves up the category tree until a value for $field other than
+ $skipvalue is returned. if no matches are made, then $default is returned */
+
+ $path = $this->Get("ParentPath");
+ $path = substr($path,1,-1); //strip off the first & last tokens
+ $aPath = explode("|",$path);
+ $aPath = array_slice($aPath,0,-1);
+ $ParentPath = implode("|",$aPath);
+ $sql = "SELECT $fieldname FROM ".GetTablePrefix()."Category WHERE $fieldname != '$skipvalue' AND ParentPath LIKE '$ParentPath' ORDER BY ParentPath DESC";
+ $rs = $this->adodbConnection->execute($sql);
+ if($rs && !$rs->EOF)
+ {
+ $ret = $rs->fields[$fieldname];
+ }
+ else
+ {
+ $ret = $default;
+ }
+ $update = "UPDATE ".$this->tablename." SET $fieldname='$ret' WHERE CategoryId=".$this->Get("CategoryId");
+ $this->adodbConnection->execute($update);
+ return $ret;
+ }
+
+
+
+ function GetCustomField($fieldName)
+ {
+ global $objSession, $Errors;
+
+ if(!isset($this->m_CategoryId))
+ {
+ $Errors->AddError("error.appError","Get field is required in order to set custom field values","","",get_class($this),"GetCustomField");
+ $sql = "SELECT COUNT(*) as SubCount FROM ".$this->tablename." WHERE ParentPath LIKE '".$this->Get("ParentPath")."%' AND CategoryId !=".$this->Get("CategoryId");
+ $sql = "SELECT CategoryId FROM ".$this->tablename." WHERE ParentPath LIKE '".$this->Get("ParentPath")."%' AND CategoryId !=".$this->Get("CategoryId");
+ $rs = $this->adodbConnection->Execute($sql);
+ $ret = array();
+ while($rs && !$rs->EOF)
+ {
+ $ret[] = $rs->fields["CategoryId"];
+ $rs->MoveNext();
+ }
+ return $ret;
+ }
+
+ function GetParentIds()
+ {
+ $Parents = array();
+ $ParentPath = $this->Get("ParentPath");
+ if(strlen($ParentPath))
+ {
+ $ParentPath = substr($ParentPath,1,-1);
+ $Parents = explode("|",$ParentPath);
+ }
+ return $Parents;
+ }
+
+ function ItemCount($ItemType="")
+ {
+ global $objItemTypes,$objCatList,$objCountCache;
+ @description: Loads category's subcategories into a list and renders using the m_list_cats global tag
+ @attrib:_subcattemplate:tpl:Template used to render subcategory list elements
+ @attrib: _columns:int: Numver of columns to display the categories in (defaults to 1)
+ @attrib: _maxlistcount:int: Maximum number of categories to list
+ @attrib: _FirstItemTemplate:tpl: Template used for the first category listed
+ @attrib: _LastItemTemplate:tpl: Template used for the last category listed
+ @attrib: _NoTable:bool: If set to 1, the categories will not be listed in a table. If a table is used, all HTML attributes are passed to the TABLE tag
+ @description:Displays the category relevance in search results
+ @attrib:_displaymode:: How the relevance should be displayed<br>
+ <UL>
+ <LI>"Numerical": Show the decimal value
+ <LI>"Bar": Show the HTML representing the relevance. Returns two HTML cells ≶td< with specified background colors
+ <LI>"Graphical":Show image representing the relevance
+ </UL>
+ @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