Exemplo n.º 1
0
function jbi_approval_form($jbi_sn = "")
{
    global $xoopsDB, $xoopsTpl;
    if (empty($jbi_sn)) {
        redirect_header("main.php", 3, "無此場地。");
    }
    $DBV = get_jill_booking_item($jbi_sn);
    if (empty($DBV)) {
        redirect_header("main.php", 3, "無此場地。");
    }
    //設定 jbi_approval 欄位的預設值
    $xoopsTpl->assign('approval', (int) $DBV['jbi_approval']);
    $op = "save_jbi_approval";
    $sql = "select `uid`,`name`,`uname` from `" . $xoopsDB->prefix("users") . "` order by `uname` ";
    $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error());
    $all_content = "";
    $all_content2 = "";
    $i = 0;
    while (list($uid, $name, $uname) = $xoopsDB->fetchRow($result)) {
        $jbi_approvalArr = explode(";", $DBV['jbi_approval']);
        if (in_array($uid, $jbi_approvalArr)) {
            $all_content2[$i]['uid'] = $uid;
            $all_content2[$i]['name'] = $name;
            $all_content2[$i]['uname'] = $uname;
        } else {
            $all_content[$i]['uid'] = $uid;
            $all_content[$i]['name'] = $name;
            $all_content[$i]['uname'] = $uname;
        }
        $i++;
    }
    //加入Token安全機制
    include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
    $token = new XoopsFormHiddenToken();
    $token_form = $token->render();
    $xoopsTpl->assign("token_form", $token_form);
    $xoopsTpl->assign('action', $_SERVER["PHP_SELF"]);
    $xoopsTpl->assign('all_content', $all_content);
    $xoopsTpl->assign('all_content2', $all_content2);
    $xoopsTpl->assign('jbi_title', sprintf(_MA_JILLBOOKIN_APPROVAL, $DBV['jbi_title']));
    $xoopsTpl->assign('jbi_sn', $jbi_sn);
    $xoopsTpl->assign('now_op', 'jbi_approval_form');
    $xoopsTpl->assign('jbi_approval', $DBV['jbi_approval']);
    $xoopsTpl->assign('next_op', $op);
}
Exemplo n.º 2
0
 /**
  * Get the HTML code for a XoopsFormHiddenToken object - used in forms that do not use XoopsForm elements
  *
  * @return string
  **/
 function getTokenHTML()
 {
     require_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
     $token = new XoopsFormHiddenToken();
     return $token->render();
 }
Exemplo n.º 3
0
                               </button>
                               ' . $restore . '
                               <button class="ui-corner-all tooltip" type="button" onclick="$(\'#display_contenu\').hide();$(\'#display_form\').fadeIn(\'fast\');" title="' . _AM_SYSTEM_TEMPLATES_CANCEL . '">
                                   <img src="' . system_AdminIcons('cancel.png') . '" alt="' . _AM_SYSTEM_TEMPLATES_CANCEL . '" />
                               </button>
                               <div class="clear"></div>
                          </div>
                      </div>
                 </td>
             </tr>
             <tr>
                 <td><textarea id="code_mirror" name="templates" rows=24 cols=110>' . $content . '</textarea></td>
             </tr>
           </table>';
     XoopsLoad::load('XoopsFormHiddenToken');
     $xoopsToken = new XoopsFormHiddenToken();
     echo $xoopsToken->render();
     echo '<input type="hidden" name="path_file" value="' . $clean_path_file . '"><input type="hidden" name="file" value="' . trim($clean_file) . '"><input type="hidden" name="ext" value="' . $ext . '"></form>';
     break;
     // Restore backup file
 // Restore backup file
 case 'tpls_restore':
     $extensions = array('.html', '.htm', '.css', '.tpl');
     //check if the file is inside themes directory
     $valid_dir = stristr(realpath($_REQUEST['path_file']), realpath(XOOPS_ROOT_PATH . '/themes'));
     $old_file = $_REQUEST['path_file'] . '.back';
     $new_file = $_REQUEST['path_file'];
     $extension_verif = strrchr($new_file, '.');
     if ($valid_dir && in_array($extension_verif, $extensions) && file_exists($old_file) && file_exists($new_file)) {
         if (unlink($new_file)) {
             if (rename($old_file, $new_file)) {
Exemplo n.º 4
0
function jill_booking_item_form($jbi_sn = "")
{
    global $xoopsDB, $xoopsTpl;
    //抓取預設值
    if (!empty($jbi_sn)) {
        $DBV = get_jill_booking_item($jbi_sn);
    } else {
        $DBV = array();
    }
    //預設值設定
    $myts =& MyTextSanitizer::getInstance();
    //設定 jbi_sn 欄位的預設值
    $jbi_sn = !isset($DBV['jbi_sn']) ? $jbi_sn : $DBV['jbi_sn'];
    $xoopsTpl->assign('jbi_sn', $jbi_sn);
    //設定 jbi_start 欄位的預設值
    $jbi_start = !isset($DBV['jbi_start']) ? date("Y-m-d") : $DBV['jbi_start'];
    $yesterday = date("Y-m-d", strtotime('-1 day'));
    $xoopsTpl->assign('jbi_start', $jbi_start);
    $xoopsTpl->assign('yesterday', $yesterday);
    //設定 jbi_end 欄位的預設值
    $jbi_end = !isset($DBV['jbi_end']) ? "" : $DBV['jbi_end'];
    $xoopsTpl->assign('jbi_end', $jbi_end);
    //設定 jbi_title 欄位的預設值
    $jbi_title = !isset($DBV['jbi_title']) ? "" : $DBV['jbi_title'];
    $xoopsTpl->assign('jbi_title', $jbi_title);
    //設定 jbi_desc 欄位的預設值
    $jbi_desc = !isset($DBV['jbi_desc']) ? "" : $myts->displayTarea($DBV['jbi_desc'], $html = 1, $smiley = 1, $xcode = 1, $image = 1, $br = 0);
    if (!file_exists(TADTOOLS_PATH . "/ck.php")) {
        redirect_header("index.php", 3, _MD_NEED_TADTOOLS);
    }
    include_once TADTOOLS_PATH . "/ck.php";
    $Editor = new CKEditor("jill_booking", "jbi_desc", $jbi_desc);
    $Editor->setToolbarSet('myBasic');
    $Editor_code = $Editor->render();
    $xoopsTpl->assign('Editor_code', $Editor_code);
    //設定 jbi_approval 欄位的預設值
    $jbi_approval = !isset($DBV['jbi_approval']) ? "0" : $DBV['jbi_approval'];
    $xoopsTpl->assign('jbi_approval', $jbi_approval);
    //設定 jbi_sort 欄位的預設值
    $jbi_sort = !isset($DBV['jbi_sort']) ? jill_booking_item_max_sort() : $DBV['jbi_sort'];
    $xoopsTpl->assign('jbi_sort', $jbi_sort);
    //設定 jbi_enable 欄位的預設值
    $jbi_enable = !isset($DBV['jbi_enable']) ? "1" : $DBV['jbi_enable'];
    $xoopsTpl->assign('jbi_enable', $jbi_enable);
    $op = empty($jbi_sn) ? "insert_jill_booking_item" : "update_jill_booking_item";
    //$op="replace_jill_booking_item";
    //套用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();
    //加入Token安全機制
    include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
    $token = new XoopsFormHiddenToken();
    $token_form = $token->render();
    $xoopsTpl->assign("token_form", $token_form);
    $xoopsTpl->assign('action', $_SERVER["PHP_SELF"]);
    $xoopsTpl->assign('formValidator_code', $formValidator_code);
    $xoopsTpl->assign('now_op', 'jill_booking_item_form');
    $xoopsTpl->assign('next_op', $op);
}
Exemplo n.º 5
0
function jill_booking_form($jbi_sn = "")
{
    global $xoopsDB, $xoopsTpl, $xoopsModuleConfig;
    //場地設定
    $item_opt = get_jill_booking_time_options($jbi_sn);
    if (!empty($jbi_sn)) {
        //場地資訊
        $itemArr = get_jill_booking_item($jbi_sn, 1);
        $xoopsTpl->assign('itemArr', $itemArr);
        // array ('jbi_sn' => '2','jbi_title' =>'多功能教室','jbi_desc' => '<p>多功能教室多功能教室</p>','jbi_sort' => '1','jbi_start' => '2015-01-28','jbi_end' => '0000-00-00','jbi_enable' => '1','jbi_approval' => '0',)
        //die(var_export($itemArr));
        //預設值設定
        //設定 jb_booking_content 欄位的預設值
        $xoopsTpl->assign('jb_booking_content', "");
        //設定 jb_start_date 欄位的預設值
        $jb_start_date = strtotime($itemArr['jbi_start']) <= strtotime(date("Y-m-d")) ? date("Y-m-d") : $itemArr['jbi_start'];
        $xoopsTpl->assign('jb_start_date', $jb_start_date);
        //設定 jb_end_date 欄位的預設值
        $xoopsTpl->assign('jb_end_date', $jb_start_date);
        //設定可預約之週數及日期
        $max_bookingweek = $xoopsModuleConfig['max_bookingweek'];
        //$show_range      = date("Y-m-d", strtotime("+$max_bookingweek week"));
        if (empty($max_bookingweek)) {
            //場地預約結束日期
            $end = $itemArr['jbi_end'] == '0000-00-00' ? 0 : strtotime($itemArr['jbi_end']);
            $max_date = $end == 0 ? '' : $itemArr['jbi_end'];
        } else {
            $endtime = strtotime("+{$max_bookingweek} week");
            if ($itemArr['jbi_end'] == '0000-00-00') {
                $end = $endtime;
            } else {
                $end = strtotime($itemArr['jbi_end']) >= $endtime ? $endtime : strtotime($itemArr['jbi_end']);
            }
            $max_date = date("Y-m-d", $end);
        }
        //die($max_date);
        $xoopsTpl->assign('max_date', $max_date);
        //時段資訊
        $timeArr = get_bookingtime_jbisn($jbi_sn);
        $xoopsTpl->assign('timeArr', $timeArr);
        //die(var_export($timeArr));
        $weektime = "";
        foreach ($timeArr as $t => $time) {
            for ($w = 0; $w < 7; $w++) {
                $jbt_sn = $time['jbt_sn'];
                $jbt_week = strval($time['jbt_week']);
                $weektime[$t][$w]['jbt_week'] = strpos($jbt_week, strval($w)) !== false ? "<input type='checkbox' name='jb_week[{$jbt_sn}][]'  value='{$w}' >" : "<span style='color:#D44950'><i class='fa fa-times'></i></span>";
            }
        }
        //die(var_export($weektime));
        //套用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();
        //加入Token安全機制
        include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
        $token = new XoopsFormHiddenToken();
        $token_form = $token->render();
        $xoopsTpl->assign("token_form", $token_form);
        $xoopsTpl->assign('formValidator_code', $formValidator_code);
        $xoopsTpl->assign('weektime', $weektime);
        $xoopsTpl->assign('next_op', "insert_jill_booking");
    }
    $xoopsTpl->assign('item_opt', $item_opt);
    $xoopsTpl->assign('now_op', 'jill_booking_form');
    $xoopsTpl->assign('action', $_SERVER["PHP_SELF"]);
}
Exemplo n.º 6
0
 /**
  * Get the HTML code for a XoopsFormHiddenToken object - used in forms that do not use XoopsForm elements
  *
  * @param string $name session token name
  *
  * @return string
  */
 public function getTokenHTML($name = 'XOOPS_TOKEN')
 {
     require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
     $token = new XoopsFormHiddenToken($name);
     return $token->render();
 }
Exemplo n.º 7
0
     ';
 //select groupe
 $form_select_groups = '<select  name="selgroups" id="selgroups"   style="display:none;"><option value="">---------</option>';
 //$module_array[0] = _AM_SYSTEM_USERS_COMMENTS_FORM_ALL_MODS;
 $group_handler = xoops_getHandler('group');
 $group_arr = $group_handler->getObjects();
 foreach (array_keys($group_arr) as $i) {
     if ($group_arr[$i]->getVar('groupid') != 3) {
         $form_select_groups .= '<option value="' . $group_arr[$i]->getVar('groupid') . '"  ' . ($selgroups == $group_arr[$i]->getVar('groupid') ? ' selected' : '') . '>' . $group_arr[$i]->getVar('name') . '</option>';
     }
 }
 $form_select_groups .= '</select><input type="hidden" name="op" value="users_add_delete_group">';
 $xoopsTpl->assign('form_sort', $form);
 $xoopsTpl->assign('form_select_groups', $form_select_groups);
 // add token to render in template
 $tokenElement = new XoopsFormHiddenToken();
 $token = $tokenElement->render();
 $xoopsTpl->assign('form_token', $token);
 //echo $requete_search;
 if ($users_count > 0) {
     //echo $requete_search;
     foreach (array_keys($users_arr) as $i) {
         $users['uid'] = $users_arr[$i]->getVar('uid');
         //Display group
         $user_group = $member_handler->getGroupsByUser($users_arr[$i]->getVar('uid'));
         if (in_array('1', $user_group)) {
             $users['group'] = system_AdminIcons('xoops/group_1.png');
             //$users['icon'] = '<img src="'.XOOPS_URL.'/modules/system/images/icons/admin.png" alt="'._AM_SYSTEM_USERS_ADMIN.'" title="'._AM_SYSTEM_USERS_ADMIN.'" />';
             $users['checkbox_user'] = false;
         } else {
             $users['group'] = system_AdminIcons('xoops/group_2.png');