function list_tad_gallery($csn = "", $show_function = 1) { global $xoopsDB, $xoopsModule, $xoopsModuleConfig, $xoopsTpl; $tadgallery = new tadgallery(); $xoopsTpl->assign("jquery", get_jquery(true)); $xoopsTpl->assign("csn", $csn); if (isset($_SESSION['gallery_list_mode']) and $_SESSION['gallery_list_mode'] == "good") { $mode_select = "<a href='main.php?op=chg_mode&mode=normal#gallery_top' class='btn btn-warning'>" . _MA_TADGAL_LIST_NORMAL . "</a>"; $tadgallery->set_view_good(true); $cate_options = $cate_option = $link_to_cate = ""; } else { $mode_select = "<a href='main.php?op=chg_mode&mode=good#gallery_top' class='btn btn-warning'>" . _MA_TADGAL_LIST_GOOD . "</a>"; $tadgallery->set_view_good(false); $tadgallery->set_view_csn($csn); list_tad_gallery_cate_tree($csn); $cate = tadgallery::get_tad_gallery_cate($csn); $link_to_cate = !empty($csn) ? "<a href='../index.php?csn={$csn}' class='btn btn-info'>" . sprintf(_MA_TADGAL_LINK_TO_CATE, $cate['title']) . "</a>" : ""; } $tag_select = tag_select("", "add_tag"); $xoopsTpl->assign("cate_option", $cate_option); $xoopsTpl->assign("mode_select", $mode_select); $xoopsTpl->assign("link_to_cate", $link_to_cate); $xoopsTpl->assign("option", $cate_options); $xoopsTpl->assign("tag_select", $tag_select); $tadgallery->set_admin_mode(true); $tadgallery->get_photos(); }
<?php /*-----------引入檔案區--------------*/ include_once "header.php"; $xoopsOption['template_main'] = set_bootstrap("tadgallery_cooliris.html"); include_once XOOPS_ROOT_PATH . "/header.php"; /*-----------function區--------------*/ include_once $GLOBALS['xoops']->path('/modules/system/include/functions.php'); $csn = system_CleanVars($_REQUEST, 'csn', 0, 'int'); $xoopsTpl->assign("csn", $csn); $xoopsTpl->assign("up_file_url", _TADGAL_UP_FILE_URL); list_tad_gallery_cate_tree($csn); //列出所有tad_gallery_cate資料 function list_tad_gallery_cate_tree($def_csn = "") { global $xoopsDB, $xoopsTpl; $tadgallery = new tadgallery(); $cate_count = $tadgallery->get_tad_gallery_cate_count(); $path = get_tadgallery_cate_path($def_csn); $path_arr = array_keys($path); $sql = "select csn,of_csn,title from " . $xoopsDB->prefix("tad_gallery_cate") . " order by sort"; $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error()); while (list($csn, $of_csn, $title) = $xoopsDB->fetchRow($result)) { $font_style = $def_csn == $csn ? ", font:{'background-color':'yellow', 'color':'black'}" : ''; $open = in_array($csn, $path_arr) ? 'true' : 'false'; $display_counter = empty($cate_count[$csn]['file']) ? "" : " ({$cate_count[$csn]['file']})"; $data[] = "{ id:{$csn}, pId:{$of_csn}, name:'{$title}{$display_counter}', url:'cooliris.php?csn={$csn}', open: {$open} ,target:'_self' {$font_style}}"; } $json = implode(",\n", $data); if (!file_exists(XOOPS_ROOT_PATH . "/modules/tadtools/ztree.php")) { redirect_header("index.php", 3, _MA_NEED_TADTOOLS);