// MyTextSanitizer object include_once XOOPS_ROOT_PATH . "/class/xoopstree.php"; $mytree = new XoopsTree($xoopsDB->prefix("mylinks_cat"), "cid", "pid"); $xoopsOption['template_main'] = 'mylinks_index.html'; include XOOPS_ROOT_PATH . "/header.php"; $result = $xoopsDB->query("SELECT cid, title, imgurl FROM " . $xoopsDB->prefix("mylinks_cat") . " WHERE pid = 0 ORDER BY title") or exit("Error"); $count = 1; while ($myrow = $xoopsDB->fetchArray($result)) { $imgurl = ''; if ($myrow['imgurl'] && $myrow['imgurl'] != "http://") { $imgurl = $myts->makeTboxData4Edit($myrow['imgurl']); } $totallink = getTotalItems($myrow['cid'], 1); // get child category objects $arr = array(); $arr = $mytree->getFirstChild($myrow['cid'], "title"); $space = 0; $chcount = 0; $subcategories = ''; foreach ($arr as $ele) { $chtitle = $myts->makeTboxData4Show($ele['title']); if ($chcount > 5) { $subcategories .= "..."; break; } if ($space > 0) { $subcategories .= ", "; } $subcategories .= "<a href=\"" . XOOPS_URL . "/modules/mylinks/viewcat.php?cid=" . $ele['cid'] . "\">" . $chtitle . "</a>"; $space++; $chcount++;
$category_image_link = '<a href="' . $_CONF[site_url] . '/filemgmt/viewcat.php?cid=' . $myrow['cid'] . '">' . '<img src="' . $filemgmt_SnapCatURL . $imgurl . '" width="' . $mydownloads_shotwidth . '" style="border:none;" alt=""' . XHTML . '></a>'; $p->set_var('category_link', $category_image_link); } else { $p->set_var('category_link', ''); } $downloadsWaitingSubmission = getTotalItems($myrow['cid'], 0); $p->set_var('num_files', getTotalItems($myrow['cid'], 1)); if ($downloadsWaitingSubmission > 0) { $p->set_var('files_waiting_submission', '(' . getTotalItems($myrow['cid'], 0) . ')'); } else { $p->set_var('files_waiting_submission', ''); } // get child category objects $subcategories = ''; $arr = array(); $arr = $mytree->getFirstChild($myrow['cid'], 'title'); $space = 0; $chcount = 0; foreach ($arr as $ele) { $chtitle = $myts->makeTboxData4Show($ele['title']); if ($chcount >= $numSubCategories2Show) { $subcategories .= "..."; break; } if ($space > 0) { $subcategories .= ", "; } $subcategories .= "<a href=\"{$_CONF[site_url]}/filemgmt/viewcat.php?cid={$ele['cid']}\">{$chtitle}</a>"; $space++; $chcount++; }
function getFirstChildTopics() { $ret = array(); $xt = new XoopsTree($this->table, "topic_id", "topic_pid"); $topic_arr = $xt->getFirstChild($this->topic_id, "topic_title"); if (is_array($topic_arr) && count($topic_arr)) { foreach ($topic_arr as $topic) { $ret[] = new XoopsTopic($this->table, $topic); } } return $ret; }
function getFirstChild(){ $ret = array(); $xt = new XoopsTree($this->table, "id", "pid"); $category_arr = $xt->getFirstChild($this->id, 'orders'); if ( is_array($category_arr) && count($category_arr) ) { foreach($category_arr as $category){ $ret[] = new WfsCategory($category); } } return $ret; }
$show = $mydownloads_perpage; $offset = ($page - 1) * $show; $orderby = ''; if (isset($_GET['orderby'])) { $orderby = COM_applyFilter($_GET['orderby']); } $orderby = convertorderbyin($orderby); $pathstring = '<a href="index.php">' . _MD_MAIN . '</a> : '; $nicepath = $mytree->getNicePathFromId($cid, "title", "{$_CONF['site_url']}/filemgmt/viewcat.php"); $pathstring .= $nicepath; $p->set_var('category_path_link', $pathstring); $p->set_var('cid', $cid); // get child category objects $subcategories = ''; $arr = array(); $arr = $mytree->getFirstChild($cid, 'title'); if (count($arr) > 0) { $count = 1; foreach ($arr as $ele) { $totalfiles = 0; $chtitle = $myts->makeTboxData4Show($ele['title']); $totalfiles = $totalfiles + getTotalItems($ele['cid'], 1); $subcategories = '<a href="' . $_CONF[site_url] . '/filemgmt/viewcat.php?cid=' . $ele['cid'] . '">' . $chtitle . '</a> (' . $totalfiles . ') '; $p->set_var('subcategories', $subcategories); $p->set_var('new_table_row', $count == 1 ? '<tr>' : ''); $p->set_var('end_of_row', $count == $numCategoriesPerRow ? '</tr>' : ''); $count = $count == $numCategoriesPerRow ? 1 : $count + 1; $p->parse('category_records', 'category', true); } } else { $p->set_var('subcategories', '');
echo $heading; } echo "<br /><br />"; echo "<table width=80% cellspacing=4 cellpadding=0 border=0 valign=top><tr>"; while ($myrow = $xoopsDB->fetchArray($result)) { $cname = $myts->makeTboxData4Show($myrow['cname']); $cdesc = $myts->makeTboxData4Show($myrow['cdesc']); $cimg = $myts->makeTboxData4Show($myrow['cimg']); $number = getTotalItems($myrow['cid'], 1, 3); if ($category_visdefault == 1) { $show = $category_visualize; } else { $show = $category_default; } $arr = array(); $arr = $mytree->getFirstChild($myrow['cid'], "cname"); $space = 0; $chcount = 0; $subcats = ""; foreach ($arr as $ele) { $chtitle = $myts->makeTboxData4Show($ele['cname']); if ($chcount > $maxsubcatshow) { $subcats .= "..."; break; } if ($space > 0) { $subcats .= ", "; } $subcats .= "<a href=\"" . XOOPS_URL . "/modules/tutorials/listtutorials.php?cid=" . $ele['cid'] . "\">" . $chtitle . "</a>"; $space++; $chcount++;
$min = isset($HTTP_GET_VARS['min']) ? intval($HTTP_GET_VARS['min']) : 0; if (!isset($max)) { $max = $min + $show; } if (isset($HTTP_GET_VARS['orderby'])) { $orderby = convertorderbyin($HTTP_GET_VARS['orderby']); } else { $orderby = "title ASC"; } $pathstring = "<a href='index.php'>" . _MD_MAIN . "</a> : "; $pathstring .= $mytree->getNicePathFromId($cid, "title", "viewcat.php?op="); $xoopsTpl->assign('category_path', $pathstring); $xoopsTpl->assign('category_id', $cid); // get child category objects $arr = array(); $arr = $mytree->getFirstChild($cid, "title"); if (count($arr) > 0) { $scount = 1; foreach ($arr as $ele) { $sub_arr = array(); $sub_arr = $mytree->getFirstChild($ele['cid'], "title"); $space = 0; $chcount = 0; $infercategories = ""; foreach ($sub_arr as $sub_ele) { $chtitle = $myts->makeTboxData4Show($sub_ele['title']); if ($chcount > 5) { $infercategories .= "..."; break; } if ($space > 0) {
echo "<table width=100% cellspacing=4 cellpadding=0 border=0 valign=top><tr>"; } $subcats = $db->num_rows($result); while (list($cid, $cname, $cdesc, $cimg) = $db->fetch_row($result)) { $cname = $myts->makeTboxData4Show($cname); $cdesc = $myts->makeTboxData4Show($cdesc); $cimg = $myts->makeTboxData4Show($cimg); $result2 = $db->query("select tid from " . $db->prefix(tutorials) . " where cid={$cid} and status=1 or status=3"); $number = $db->num_rows($result2); if ($category_visdefault == 1) { $show = $category_visualize; } else { $show = $category_default; } $arr = array(); $arr = $mytree->getFirstChild($cid, "cname"); $space = 0; $chcount = 0; $subcat = ""; foreach ($arr as $ele) { $chtitle = $myts->makeTboxData4Show($ele['cname']); if ($chcount > $maxsubcatshow) { $subcat .= "..."; break; } if ($space > 0) { $subcat .= ", "; } $subcat .= "<a href=\"" . XOOPS_URL . "/modules/tutorials/listtutorials.php?cid=" . $ele['cid'] . "\">" . $chtitle . "</a>"; $space++; $chcount++;