} $xoopsTpl->assign( 'category_desc' , $myts->displayTarea( $description , $arrow_html , 1 , 1 , 1 , $arrow_br , 1 ) ) ; $imgurl= preg_match('/^(https?|ftp)(:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)$/', $imgurl) ? $imgurl :""; $kmlurl= preg_match('/^(https?|ftp)(:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)$/', $kmlurl) ? $kmlurl :""; $xoopsTpl->assign( 'category_imgurl' , $imgurl ) ; $xoopsTpl->assign( 'parent_id' , $pid ) ; $xoopsTpl->assign( 'category_id' , $cid ) ; $xoopsTpl->assign( 'subcategories' , gnavi_get_sub_categories( $cid , $cattree,"AND (lat<>0 OR lng<>0)" ) ) ; $xoopsTpl->assign( 'category_options' , gnavi_get_cat_options() ) ; $cids = $cattree->getAllChildId( $cid ) ; array_push( $cids , $cid ) ; //counts $photo_num_total = gnavi_get_photo_total_sum_from_cats( $cids , "status>0 AND (lat<>0 OR lng<>0)" ) ; $xoopsTpl->assign( 'photo_num_total' , $photo_num_total.' '._MD_GNAV_C_DATA ) ; //breadcrumbs $xoops_breadcrumbs[] = array( 'url' => XOOPS_URL.'/modules/'.$mydirname.'/index.php' , 'name' => $xoopsModule->getVar( 'name' ) ) ; if($gnavi_indexpage!='map'){ $xoops_breadcrumbs[] = array( 'url' => XOOPS_URL.'/modules/'.$mydirname.'/index.php?page=map' , 'name' => _MD_GNAV_MAP_SHOW ) ; } $xoops_breadcrumbs = gnavi_add_breadcrumbs( $pid , "index.php".( $page_map ? '?'.$page_map:''),$xoops_breadcrumbs); $xoops_breadcrumbs[] = array( 'name' => $myts->makeTboxData4show( $cat_title )) ; $xoopsTpl->assign( 'imgurl' , $imgurl ) ; $xoopsTpl->assign( 'description' , $description ) ; $where = "";
$arrow_br = 0; } else { $arrow_html = 0; $arrow_br = 1; } $xoopsTpl->assign('category_desc', $myts->displayTarea($description, $arrow_html, 1, 1, 1, $arrow_br, 1)); $imgurl = preg_match('/^(https?|ftp)(:\\/\\/[-_.!~*\'()a-zA-Z0-9;\\/?:\\@&=+\\$,%#]+)$/', $imgurl) ? $imgurl : ""; $xoopsTpl->assign('category_imgurl', $imgurl); $xoopsTpl->assign('parent_id', $pid); $xoopsTpl->assign('category_id', $cid); $xoopsTpl->assign('subcategories', gnavi_get_sub_categories($cid, $cattree)); $xoopsTpl->assign('category_options', gnavi_get_cat_options()); $cids = $cattree->getAllChildId($cid); array_push($cids, $cid); //counts $photo_num_total = gnavi_get_photo_total_sum_from_cats($cids, "status>0"); $xoopsTpl->assign('photo_num_total', $photo_num_total . ' ' . _MD_GNAV_C_DATA); if ($gnavi_showparent) { $where = ""; foreach ($cids as $cidw) { $where .= "{$cidw},"; } $where = substr($where, 0, -1); $where = "(cid IN({$where}) or cid1 IN({$where}) or cid2 IN({$where}) or cid3 IN({$where}) or cid4 IN({$where}) )"; } else { $where = "( cid={$cid} or cid1={$cid} or cid2={$cid} or cid3={$cid} or cid4={$cid} )"; } $prs = $xoopsDB->query("SELECT COUNT(lid) FROM {$table_photos} WHERE {$where} AND status>0"); list($photo_small_sum) = $xoopsDB->fetchRow($prs); $xoopsTpl->assign('photo_small_sum', $photo_small_sum); //breadcrumbs
function gnavi_get_sub_categories($parent_id, $cattree, $where = "") { global $xoopsDB, $table_cat; $myts =& MyTextSanitizer::getInstance(); $ret = array(); $crs = $xoopsDB->query("SELECT cid, title, imgurl,description FROM {$table_cat} WHERE pid={$parent_id} ORDER BY weight,title") or die("Error: Get Category."); while (list($cid, $title, $imgurl, $description) = $xoopsDB->fetchRow($crs)) { // Show first child of this category $subcat = array(); $arr = $cattree->getFirstChild($cid, "weight"); foreach ($arr as $child) { $subcat[] = array('cid' => $child['cid'], 'description' => $child['description'], 'title' => $myts->makeTboxData4Show($child['title']), 'photo_small_sum' => gnavi_get_photo_small_sum_from_cat($child['cid'], "status>0 " . $where), 'number_of_subcat' => sizeof($cattree->getFirstChildId($child['cid']))); } // Category's banner default if ($imgurl == "http://") { $imgurl = ''; } // Total sum of photos $cids = $cattree->getAllChildId($cid); array_push($cids, $cid); $photo_total_sum = gnavi_get_photo_total_sum_from_cats($cids, "status>0 " . $where); $ret[] = array('cid' => $cid, 'description' => $description, 'imgurl' => $myts->makeTboxData4Edit($imgurl), 'photo_small_sum' => gnavi_get_photo_small_sum_from_cat($cid, "status>0 " . $where), 'photo_total_sum' => $photo_total_sum, 'title' => $myts->makeTboxData4Show($title), 'subcategories' => $subcat); } return $ret; }