NumCategories()==0) return "
No Categories

"; $o=""; $i=1; $list = $objSession->GetVariable($KeywordsVar); if(strlen($list)) $Keywords = explode(",",$list); $template = $pathtoroot.$admin."/templates/".$template; $topleft = 0; $topright = 0; $rightcount = 0; $totalcats = 0; $totalcats = $objCatList->NumItems(); $topleft = ceil($totalcats/2); $topright = $totalcats-$topleft; for ($x=0;$x<$topleft;$x++) { //printingleft $cat = $objCatList->Items[$x]; if($cat->Get("CategoryId")!=$ParentId) { if ($i > 2) { $o.="\n"; $i = 1; } //$cat->LoadPermissions($objSession->Get("GroupId")); if(strlen($list)) { $h = $cat->AdminParseTemplate($template); $h = HighlightKeywords($Keywords, $h); $o .= $h; $h = ""; } else $o.=$cat->AdminParseTemplate($template); $i++; } //printingright if ($rightcount < $topright && (($x+$topleft) <$totalcats)) { $cat = $objCatList->Items[$x+$topleft]; if($cat->Get("CategoryId")!=$ParentId) { if ($i > 2) { $o.="\n"; $i = 1; } //$cat->LoadPermissions($objSession->Get("GroupId")); if(strlen($list)) { $h = $cat->AdminParseTemplate($template); $h = HighlightKeywords($Keywords, $h); $o .= $h; $h = ""; } else $o.=$cat->AdminParseTemplate($template); $i++; } $rightcount++; } } $o .="\n
\n"; return $o; } function list_custom($c,$Type) { global $objSession, $objCustomFieldList, $objCustomDataList, $imagesURL; $field_list = $objCustomFieldList->Query_CustomField("Type=$Type"); if (count($field_list) == 0) return "No Custom Fields

"; $o=""; $i = 1; $objCustomDataList->SourceTable = $objSession->GetEditTable("CustomMetaData"); $objCustomDataList->LoadResource($c->Get("ResourceId")); foreach($field_list as $field) { $fieldname = $field->Get("FieldName"); $fieldlabel = $field->Get("FieldLabel"); $fieldid = $field->Get("CustomFieldId"); $f = $objCustomDataList->GetDataItem($fieldid); if(is_object($f)) { $fieldvalue = $f->Get("Value"); } else $fieldvalue=""; $o .=""; $o .=" $fieldname $fieldlabel \n"; $i++; } return $o; } function adListRelatedCategories($Item) { global $objCatList; if(is_object($Item)) { $catlist = $Item->GetRelatedCategories(0); $o = ""; foreach($catlist as $catrel) { $o .= "Get("RelationshipId")."\">"; $cat = $objCatList->GetByResource($catrel->Get("TargetId")); $o .= $cat->GetCachedNavBar(); $o .="
\n"; } } return $o; } function adListRelatedItems($Item) { global $objCatList; if(is_object($Item)) { $item_list=$Item->GetRelatedItems(0); $o = ""; foreach($item_list as $i) { $data = $i->GetTargetItemData(); $o .= ""; $o .= ""; $o .= "Get("RelationshipId")."\">"; $o .= $data[$data["TitleField"]]; $o .= ""; $o .= "".$data["SourceTable"].""; $cat =& $objCatList->GetCategory($data["CategoryId"]); $o .= ""; $o .= $cat->GetCachedNavBar(); $o .= ""; } } return $o; } function adListItemReviews($Item) { global $pathtoroot,$admin; $Reviews = $Item->GetItemReviews(); $o = ""; if($Reviews->ItemCount()>0) { foreach($Reviews->ItemList as $r) { $o .= ""; $o .= ""; if($r->Get("Pending")==0) { $o .= "Get("ReviewId")."\"> Delete"; } $o .= ""; if($r->Get("Pending")!=0) { $o .= "Get("ReviewId")."\"> Approve"; } $o .= ""; $o .= $r->parse_template(admintemplate($pathtoroot.$admin."/templates/review_element.tpl")); $o .= ""; } } return $o; } function adImageUploadFormTags($img) { static $file_count=0; $o = ""; if($file_count==0) { $o .= ""; } $o .= "Get("Name")."\">"; $o .= "Get("AltName")."\">"; $o .= ""; $o .= "Get("Url")."\">"; $o .= ""; $o .= "Get("Url")."\" NAME=\"$file_count\">"; $o .= "Get("ResourceId")."\">"; $o .= "Get("RelatedTo")."\">"; $o .= "Get("IsThumbnail")."\">"; $parts = pathinfo($img->Get("LocalPath")); $destdir = $parts["dirname"]; $o .= ""; if($img->Get("RelatedTo")>0) $o .= ""; $o .= ""; $file_count++; return $o; } function m_GetModuleInfo($info_type) { // get information for building sql in switch($info_type) { case 'rel_list': // Edit Category -> Relations List return Array( 'MainTable' => 'Category', 'ItemNameField' => 'CachedNavbar', // not used, because we have all relations new sections 'ItemNamePhrase' => 'la_Text_Category', 'TargetType' => 1); break; case 'summary_pending': global $imagesURL; $ret = Array(); $UserURL = $GLOBALS['adminURL'].'/users/user_list.php?env='.BuildEnv(); // pending users $ret[] = Array( 'link' => "config_val('User_View', '4' ,'$UserURL')", 'icon_image' => $imagesURL.'/itemicons/icon16_user_pending.gif', 'phrase' => 'la_Text_Users', 'list_var_name' => 'objUsers' ); // pending categories $ret[] = Array( 'link' => "PendingLink('category','Category_View',41)", 'icon_image' => $imagesURL.'/itemicons/icon16_cat_pending.gif', 'phrase' => 'la_tab_Categories', 'list_var_name' => 'objCatList'); return $ret; break; case 'all_bitmask': // return bitmask value equals to "all" for module filter return Array('VarName' => 'Category_View', 'Bits' => 127); break; case 'dupe_resourceids': $ret=Array(); $ret[]=Array('Table'=>'Category','IDField'=>'CategoryId'); $ret[]=Array('Table'=>'PortalGroup','IDField'=>'GroupId'); $ret[]=Array('Table'=>'PortalUser','IDField'=>'PortalUserId'); return $ret; break; case 'filenames': return Array('prefix' => 'm', 'table' => 'Category', 'id_field' => 'CategoryId', 'title_field' => 'Name'); break; } return false; } ?>