Image Image
 
\n"; $rezstr.= $topopts; $rezstr.=list_tree($id,$cid,0,0,$shwarry,$only_published); $rezstr.="\n"; return $rezstr; } function list_tree($id=0,$cid=0,$catid=0, $level=0, $shwarry='',$only_published=false) { global $database; $level++; $q = "SELECT * FROM #__classifieds_categories "; $q .= "WHERE parent=".$catid ; if ($only_published) $q.=" AND published=1 "; if ($shwarry) $q.=" AND id IN (".$shwarry.")"; $q .= " ORDER BY ordering" ; $database->setQuery($q); $rows = $database->loadObjectList(); $rez=""; foreach ($rows as $row) if (!($row->id==$id)) { if ($row->id==$cid) $rez.= ""; $rez.=list_tree($id, $cid, $row->id, $level,$shwarry,$only_published); } return $rez; } function get_f_cats() { global $database; $database->setQuery( "SELECT cc.id FROM #__classifieds_categories AS cc" . "\nLEFT JOIN #__classifieds AS a ON a.catid = cc.id " . "\nWHERE a.published='1' AND a.approved='1' AND a.confirmed='1' AND cc.published=1" . "\n AND a.expiredate>NOW() ORDER BY cc.ordering" ); $cats = $database->loadObjectList(); echo $database->getErrorMsg(); $database->setQuery( "SELECT parent as id FROM #__classifieds_categories WHERE parent<>0 AND published='1' ORDER BY ordering"); $cats = array_merge( $cats, $database->loadObjectList() ); $carr=array(); foreach ($cats as $cat) if (!in_array($cat->id,$carr)) array_push($carr,$cat->id); $ret=implode(",",$carr); return $ret; } function get_cat_path($catid,$top=0) { global $database; $database->setQuery( "SELECT id,parent,name FROM #__classifieds_categories " . "\nWHERE id=".$catid." ORDER BY ordering"); $cats = $database->loadObjectList(); $cat=$cats[0]; if (!($cat->parent==$top)) $cats=array_merge(get_cat_path($cat->parent,$top),$cats); return $cats; } function get_cat_tree($catid=0,$only_published=false) { global $database; if ($only_published) $publ=" AND published=1 "; else $publ=""; $database->setQuery( "SELECT id,parent,name FROM #__classifieds_categories " . "\nWHERE parent=".$catid.$publ." ORDER BY ordering"); $cats = $database->loadObjectList(); $tmp=array(); if (count($cats)>0) { foreach ($cats as $cat) $tmp=array_merge($tmp,get_cat_tree($cat->id,$only_published)); } $cats=array_merge($cats,$tmp); return $cats; } function get_cat_ad_count($catid, $type=0) { global $database; $subarr=extract_id(get_cat_tree($catid)); array_push($subarr,$catid); $where = "catid IN (".implode(",",$subarr).")"; if ($type>0) $typewhere="AND type=".$type; else $typewhere=""; $database->setQuery( "SELECT count(*) FROM #__classifieds " . "\nWHERE ".$where." ".$typewhere); $res = $database->loadResult(); return $res; } function get_cat_ad_count_special(&$rows,$catid, $type=0) { global $database; $subarr=extract_id(get_cat_tree($catid)); array_push($subarr,$catid); $res=0; foreach ($rows as $row) { $typ=true; if ($type && !($row->type==$type)) $typ=false; if (in_array($row->catid,$subarr) && $typ) $res++; } /* $where = "catid IN (".implode(",",$subarr).")"; if ($type>0) $typewhere="AND type=".$type; else $typewhere=""; $database->setQuery( "SELECT count(*) FROM #__classifieds " . "\nWHERE ".$where." ".$typewhere); $res = $database->loadResult(); */ return $res; } function extract_id($catarr) { $tmpcarr=array(); foreach ($catarr as $catpth) array_push($tmpcarr,$catpth->id); return $tmpcarr; } function get_cat_path_titles($catid, $delim=" > ", $top=0) { $ret=""; if ($catid) { $catarr=get_cat_path($catid,$top); $tmparr=array(); foreach ($catarr as $catpth) array_push($tmparr, $catpth->name); $ret=implode($delim,$tmparr); } return $ret; } function get_cat_path_links($catid, $lnk, $delim=" > ") { $ret=""; if ($catid) { $catarr=get_cat_path($catid); $tmparr=array(); foreach ($catarr as $catpth) { $p=''.$catpth->name.""; array_push($tmparr, $p); } $ret=implode($delim,$tmparr); } return $ret; } function get_cat_path_links_full($catid, $lnk, $delim=" > ") { $ret=""; if ($catid) { $catarr=get_cat_path($catid); $tmparr=array(); for ($i=0; $i<(count($catarr)-1); $i++) { $pom=$catarr[$i]; $p=''.$pom->name.""; array_push($tmparr, $p); } $last=$catarr[count($catarr)-1]; if (count($catarr)>1) $dl=$delim; else $dl=""; $ret=implode($delim,$tmparr).$dl.$last->name; } return $ret; } function get_cat_path_links_full_wrap($catid, $lnk, $delim=" > ", $delim2="-") { $ret=""; if ($catid) { $catarr=get_cat_path($catid); $tmparr=array(); for ($i=0; $i<(count($catarr)-1); $i++) { $pp=""; for ($j=0; $j<$i; $j++) $pp.=$delim2; $pom=$catarr[$i]; $p=$pp.$delim.''.$pom->name.""; array_push($tmparr, $p); } $last=$catarr[count($catarr)-1]; if (count($catarr)>1) $dl="
".$pp.$delim2.$delim; else $dl=$delim; $ret=implode("
",$tmparr).$dl.$last->name; } return $ret; } ?>
לוח מודעות - יצירת קשר
catid); $tn=$row->typename; $catnm=$tn." : ".$cn; ?>
email=""; HTML_oglasi::show($row,$catnm); ?>
הודעה