function get_tad_gallery_cate_option($of_csn = 0, $level = 0, $v = "", $chk_view = 1, $chk_up = 0, $this_csn = "", $no_self = "0") { global $xoopsDB, $xoopsUser, $xoopsModule, $isAdmin; if ($xoopsUser) { $module_id = $xoopsModule->getVar('mid'); $isAdmin = $xoopsUser->isAdmin($module_id); } else { $isAdmin = false; } $tadgallery = new tadgallery(); $show_uid = isset($_SESSION['show_uid']) ? intval($_SESSION['show_uid']) : 0; if ($show_uid) { $tadgallery->set_show_uid($show_uid); } $cate_count = $tadgallery->get_tad_gallery_cate_count(); //$left=$level*10; $level += 1; $syb = str_repeat("-", $level) . " "; $option = $of_csn ? "" : "<option value='0'>" . _MD_TADGAL_CATE_SELECT . "</option>"; $sql = "select csn,title from " . $xoopsDB->prefix("tad_gallery_cate") . " where of_csn='{$of_csn}' order by sort"; $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error()); $ok_cat = $ok_up_cat = ""; if ($chk_view) { $ok_cat = $tadgallery->chk_cate_power(); } if ($chk_up) { $ok_up_cat = $tadgallery->chk_cate_power("upload"); } while (list($csn, $title) = $xoopsDB->fetchRow($result)) { if ($chk_view and is_array($ok_cat)) { if (!in_array($csn, $ok_cat)) { continue; } } if ($chk_up and is_array($ok_up_cat)) { if (!in_array($csn, $ok_up_cat)) { continue; } } if ($no_self == '1' and $this_csn == $csn) { continue; } $selected = $v == $csn ? "selected" : ""; $count = empty($cate_count[$csn]['file']) ? 0 : $cate_count[$csn]['file']; $option .= "<option value='{$csn}' {$selected}>{$syb}{$title}({$count})</option>"; $option .= get_tad_gallery_cate_option($csn, $level, $v, $chk_view, $chk_up, $this_csn, $no_self); } return $option; }
$page_bar['total'] = $this->pTotal; $page_bar['sql'] = $this->sqlQuery(); return $page_bar; } } /*-----------執行動作判斷區----------*/ $_REQUEST['op'] = empty($_REQUEST['op']) ? "" : $_REQUEST['op']; $sn = isset($_REQUEST['sn']) ? intval($_REQUEST['sn']) : 0; $csn = isset($_REQUEST['csn']) ? intval($_REQUEST['csn']) : 0; $passwd = isset($_POST['passwd']) ? $_POST['passwd'] : ""; $jquery = get_jquery(); switch ($_REQUEST['op']) { default: if (!empty($sn)) { $main = view_pic($sn); $pic = tadgallery::get_tad_gallery($sn); $csn = $pic['csn']; } else { $main = show_cate($csn, $passwd); } break; } //分類下拉選單 $cate_option = get_tad_gallery_cate_option(0, 0, $csn); $cate = tadgallery::get_tad_gallery_cate($csn); $cate_title = $cate['title']; //$jquery=get_jquery(); /*-----------秀出結果區--------------*/ $title = $xoopsModule->getVar('name'); $title_m = empty($cate['title']) ? "{$title}" : "{$title}-{$cate['title']}"; echo "\n<!DOCTYPE HTML>\n<html>\n<head>\n<title>{$title_m}</title>\n<meta charset='" . _CHARSET . "' />\n<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;' name='viewport' />\n<meta name='apple-mobile-web-app-capable' content='yes' />\n<link href='" . XOOPS_URL . "/modules/tadtools/jquery.mobile/jquery.mobile.css' rel='stylesheet' type='text/css'/>\n<link href='class/mobile/photoswipe.css' type='text/css' rel='stylesheet' />\n<script type='text/javascript' src='class/mobile/lib/klass.min.js'></script>\n<script type='text/javascript' src='" . XOOPS_URL . "/modules/tadtools/jquery/jquery.js'></script>\n<script type='text/javascript' src='" . XOOPS_URL . "/modules/tadtools/jquery.mobile/jquery.mobile.js'></script>\n<script type='text/javascript' src='class/mobile/code.photoswipe.jquery-3.0.5.min.js'></script>\n<script type='text/javascript'>\n\t(function(window, \$, PhotoSwipe){\n\t\t\$(document).ready(function(){\n\t\t\tvar options = {};\n\t\t\t\$('.nofolder a').photoSwipe(options);\n\t\t});\n\t}(window, window.jQuery, window.Code.PhotoSwipe));\n</script>\n<style>\n.ui-btn-right {\n top: -4px !important;\n}\n.ui-header .ui-title {\n margin: 0.6em 15% 0.8em !important;\n}\n.gallery { list-style: none; padding: 0; margin: 0; }\n.gallery:after { clear: both; content: " . "; display: block; height: 0; visibility: hidden; }\n.gallery li { float: left; width: 95px; height:95px; }\n.gallery li a { display: block; margin: 5px; border: 1px solid #3c3c3c; }\n.gallery li img { display: block; width: 100%; height: 70px; overflow:hidden; }\n</style>\n</head>\n<body>\n<div data-role='page' data-add-back-btn='true' id='page_{$csn}'>\n\t<div data-role='header' data-theme='a' data-position='fixed'>\n\t\t<a href='{$_SERVER['PHP_SELF']}' data-icon='home' data-iconpos='notext' class='ui-btn-left' rel='external'>Home</a>\n\t\t<h1>{$title_m}</h1>\n\t\t<div class='ui-btn-right'>\n\t\t<select onChange=\"window.location.href='{$_SERVER['PHP_SELF']}?csn=' + this.value\" data-icon='grid' data-iconpos='notext' data-native-menu='true' data-mini='true' style='padding-top:0px;margin-top:0px'>{$cate_option}</select>\n\t\t</div>\n\t</div>\n\t<div data-role='content' id='content_{$csn}'>\n\t{$main}\n\t</div>\n</div>\n</body>\n</html>\n";