function draw() { global $display; $this->beginForm(true, "post", false, "?" . htmlentities($_SERVER['QUERY_STRING'])); $user = PersonalDB::get_account_information(); $display->add('user', $user); if (intval(date('d')) >= 5) { $month = date('n', strtotime('+1 month')); } else { $month = date('n'); } $list_paid = PersonalDB::get_student_paid('', ' uid = ' . $user['id'] . ' AND month = ' . $month, ''); $display->add('month', $month); $str_class = ''; foreach ($list_paid as $paid) { $str_class .= $str_class == '' ? $paid['cid'] : ', ' . $paid['cid']; } $list_class_paid = array(); $list_paid_all = array(); $list_class = array(); if ($user['class_id'] != '') { if ($str_class != '') { $list_class_paid = Classes::get_collection(null, ' id IN (' . $user['class_id'] . ') AND id NOT IN (' . $str_class . ') AND price > 0'); } else { $list_class_paid = Classes::get_collection(null, ' id IN (' . $user['class_id'] . ') AND price > 0'); } $list_paid_all = PersonalDB::get_student_paid('', ' uid = ' . $user['id'] . ' AND cid IN (' . $user['class_id'] . ')', ''); $list_class = Classes::get_collection(null, ' id IN (' . $user['class_id'] . ') AND price > 0'); } $display->add('list_paid_all', $list_paid_all); $display->add('list_class', $list_class); $display->add('error_message', $this->getErrorMessage('personal/extra_time')); $display->add('success_message', $this->getSuccessMessage('personal/extra_time')); $display->add('form_data', $this->getSuccessMessage('personal/form_data')); $display->add('list_class_paid', $list_class_paid); $display->output('ExtraTime', false, 'Personal'); $this->endForm(); }
function draw() { global $display; // $this->beginForm(false, 'post', false, Url::build_current(array('cmd' => 'list_log'))); $filter_id = intval(trim(Url::get('filter_id'))); $cid = intval(trim(Url::get('cid'))); $display->add('cid', $cid); $display->add('from_time', Url::get('from_time')); $display->add('to_time', Url::get('to_time')); $cond = array(); if (!empty($filter_id)) { $cond[] = 'a.id LIKE "' . $filter_id . '%"'; $display->add('filter_id', $filter_id); } if (!empty($cid)) { $cond[] = 'cid = ' . $cid; } $from_time = 0; $to_time = 0; if (Url::get('from_time')) { $date_arr = explode('/', Url::get('from_time')); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $from_time = EClassApi::render_time($date_arr[1] . '/' . $date_arr[0] . '/' . (int) $date_arr[2], 0); } } if (Url::get('to_time')) { $date_arr = explode('/', Url::get('to_time')); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $to_time = EClassApi::render_time($date_arr[1] . '/' . $date_arr[0] . '/' . (int) $date_arr[2], 1); } } if ($from_time) { $cond[] = ' `time` >= ' . $from_time; } if ($to_time) { $cond[] = ' `time` <= ' . $to_time; } // if (intval(date('d')) < 5) // $month = date('n'); // else // $month= date('n', strtotime('+1 month')); $month = date('n'); $cond[] = 'month = ' . $month; $item_per_page = 50; $cond = EClassApi::analyze_conditions($cond); $list_extend = array(); $paging = ''; $total_row = PersonalDB::count_all_paid($cond); if ($total_row) { require_once ROOT_PATH . 'core/ECPagging.php'; $limit = ''; $paging = ECPagging::pagingSE($limit, $total_row, $item_per_page, 10, 'page_no', true); $list_extend = PersonalDB::get_student_paid($limit, $cond, ' ORDER BY uid DESC'); } foreach ($list_extend as $extend) { $time = date('H:i:s d/m/Y', $extend['time']); $list_extend[$extend['id']]['time'] = $time; } $list_class = Classes::get_collection_with_join(null); $error_message = $this->getErrorMessage('admin/log/error'); $display->add('error_message', $error_message); $display->add('paging', $paging); $display->add('list_extend', $list_extend); $display->add('list_class', $list_class); $display->add('is_admin', User::is_admin()); $display->output('Extend'); // $this->endForm(); }