Beispiel #1
0
function list_photos($csn = "", $uid = "")
{
    global $xoopsModuleConfig, $xoopsTpl, $tadgallery;
    if (!file_exists(XOOPS_ROOT_PATH . "/modules/tadtools/fancybox.php")) {
        redirect_header("index.php", 3, _MA_NEED_TADTOOLS);
    }
    include_once XOOPS_ROOT_PATH . "/modules/tadtools/fancybox.php";
    if ($csn) {
        $tadgallery->set_orderby("photo_sort");
        $tadgallery->set_view_csn($csn);
        $tadgallery->set_only_thumb($xoopsModuleConfig['only_thumb']);
        $cate = $tadgallery->get_tad_gallery_cate($csn);
        $xoopsTpl->assign("cate", $cate);
        $upload_powers = $tadgallery->chk_cate_power("upload");
        if ($upload_powers) {
            include_once XOOPS_ROOT_PATH . "/modules/tadtools/jeditable.php";
            $file = "save.php";
            $jeditable = new jeditable();
            $jeditable->setTextAreaCol("#content", $file, '90%', '100px', "{'csn':{$csn},'op' : 'save'}", _MD_TADGAL_EDIT_CATE_CONTENT);
            $jeditable_set = $jeditable->render();
            $xoopsTpl->assign("jeditable_set", $jeditable_set);
        }
    } else {
        $tadgallery->set_orderby("rand");
        $tadgallery->set_limit($xoopsModuleConfig['thumbnail_number']);
    }
    $tadgallery->get_photos();
    $tadgallery->get_albums();
    $cate_fancybox = new fancybox('.editbtn');
    $cate_fancybox_code = $cate_fancybox->render(false);
    $xoopsTpl->assign('cate_fancybox_code', $cate_fancybox_code);
    if (!file_exists(XOOPS_ROOT_PATH . "/modules/tadtools/colorbox.php")) {
        redirect_header("index.php", 3, _MA_NEED_TADTOOLS);
    }
    include_once XOOPS_ROOT_PATH . "/modules/tadtools/colorbox.php";
    $colorbox = new colorbox('.Photo');
    $colorbox_code = $colorbox->render(false);
    $xoopsTpl->assign('colorbox_code', $colorbox_code);
    $xoopsTpl->assign('only_thumb', $xoopsModuleConfig['only_thumb']);
}
Beispiel #2
0
function list_jill_booking_time($jbi_sn = "")
{
    global $xoopsDB, $xoopsTpl, $isAdmin;
    if (empty($jbi_sn)) {
        return;
    }
    $item = get_jill_booking_item($jbi_sn);
    include_once XOOPS_ROOT_PATH . "/modules/tadtools/jeditable.php";
    $jeditable = new jeditable();
    $myts =& MyTextSanitizer::getInstance();
    $sql = "select * from `" . $xoopsDB->prefix("jill_booking_time") . "`\n          where `jbi_sn`='{$jbi_sn}' order by `jbt_sort`";
    $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error());
    $total = $xoopsDB->getRowsNum($result);
    $all_content = "";
    $i = 0;
    while ($all = $xoopsDB->fetchArray($result)) {
        //以下會產生這些變數: $jbt_sn , $jbi_sn , $jbt_title , $jbt_sort
        foreach ($all as $k => $v) {
            ${$k} = $v;
        }
        //過濾讀出的變數值
        $jbt_title = $myts->htmlSpecialChars($jbt_title);
        $jeditable->setTextCol("#jbt_title_{$jbt_sn}", 'time.php', '100%', '11pt', "{'jbt_sn':{$jbt_sn},'op' : 'save_jbt_title'}", _TAD_EDIT . _MA_JILLBOOKIN_JBT_TITLE);
        $all_content[$i]['jbi_sn'] = $jbi_sn;
        $all_content[$i]['jbt_sn'] = $jbt_sn;
        $all_content[$i]['jbt_title_link'] = "<a href='{$_SERVER['PHP_SELF']}?jbt_sn={$jbt_sn}'>{$jbt_title}</a>";
        $all_content[$i]['jbt_title'] = $jbt_title;
        $all_content[$i]['jbt_sort'] = $jbt_sort;
        $all_content[$i]['jbt_week'] = strval($jbt_week);
        $booking_times = get_booking_times($jbt_sn);
        $all_content[$i]['booking_times'] = empty($booking_times) ? "" : sprintf(_MA_JILLBOOKIN_BOOKING_TIME, $booking_times);
        $w_arr = explode(',', $jbt_week);
        for ($j = 0; $j <= 7; $j++) {
            $name = "w{$j}";
            $pic = in_array($j, $w_arr) ? "yes.gif" : "no.gif";
            $all_content[$i][$name] = "<img src='../images/{$pic}' id='{$jbt_sn}_{$j}' onClick=\"change_enable({$jbt_sn},{$j});\" style='cursor: pointer;'>";
        }
        ++$i;
    }
    //die(var_export($all_content));
    //刪除確認的JS
    $xoopsTpl->assign('item', $item);
    $xoopsTpl->assign('bar', $bar);
    $xoopsTpl->assign('action', $_SERVER['PHP_SELF']);
    $xoopsTpl->assign('isAdmin', $isAdmin);
    $xoopsTpl->assign('all_content', $all_content);
    $xoopsTpl->assign('now_op', 'list_jill_booking_time');
    $xoopsTpl->assign('jbi_sn', $jbi_sn);
    if (!file_exists(XOOPS_ROOT_PATH . "/modules/tadtools/sweet_alert.php")) {
        redirect_header("index.php", 3, _MA_NEED_TADTOOLS);
    }
    include_once XOOPS_ROOT_PATH . "/modules/tadtools/sweet_alert.php";
    $sweet_alert = new sweet_alert();
    $delete_jill_booking_time_func = $sweet_alert->render('delete_jill_booking_time_func', "{$_SERVER['PHP_SELF']}?op=delete_jill_booking_time&jbi_sn={$jbi_sn}&jbt_sn=", "jbt_sn");
    $xoopsTpl->assign('delete_jill_booking_time_func', $delete_jill_booking_time_func);
    //套用formValidator驗證機制
    if (!file_exists(TADTOOLS_PATH . "/formValidator.php")) {
        redirect_header("index.php", 3, _TAD_NEED_TADTOOLS);
    }
    include_once TADTOOLS_PATH . "/formValidator.php";
    $formValidator = new formValidator("#myForm", true);
    $formValidator_code = $formValidator->render();
    $xoopsTpl->assign('formValidator_code', $formValidator_code);
    $jeditable_set = $jeditable->render();
    $xoopsTpl->assign('jeditable_set', $jeditable_set);
    //找出現有場地
    $i = 0;
    $place_time = "";
    $sql = "select a.* , count(b.jbt_sn) as counter from `" . $xoopsDB->prefix("jill_booking_item") . "` as a join `" . $xoopsDB->prefix("jill_booking_time") . "` as b on a.jbi_sn=b.jbi_sn where a.jbi_enable='1' group by b.jbi_sn";
    $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error());
    while ($data = $xoopsDB->fetchArray($result)) {
        $data['jbi_link'] = sprintf(_MA_JILLBOOKIN_IMPORT_PLACE, $data['jbi_title'], $data['counter']);
        $place_time[$i] = $data;
        $i++;
    }
    $xoopsTpl->assign('place_time', $place_time);
    $xoopsTpl->assign('jquery', get_jquery(true));
}