示例#1
0
文件: list.php 项目: hqd276/bigs
 function draw()
 {
     global $display;
     $keyword = Url::get('keyword');
     if (!$keyword) {
         $keyword = Url::get('keyword_mobile');
     }
     $order_str = '';
     $where_class = ' WHERE `name` LIKE "%' . addslashes($keyword) . '%"  AND is_active = 1 ';
     $where_subject = ' WHERE `name` LIKE "%' . addslashes($keyword) . '%"   ';
     $where_lesson = ' WHERE `name` LIKE "%' . addslashes($keyword) . '%"   ';
     $per_page = 21;
     $list_class = Classes::get_collection(' LIMIT 0, ' . $per_page, $where_class, $order_str);
     $list_subject = Subjects::get_collection(' LIMIT 0, ' . $per_page, $where_subject, $order_str);
     $list_lesson = Lessons::get_collection(' LIMIT 0, ' . $per_page, $where_lesson, $order_str);
     $current_url = strtok($_SERVER['REQUEST_URI'], '&');
     if (count($list_class) == $per_page) {
         $is_next_class = 1;
         array_pop($list_class);
     } else {
         $is_next_class = 0;
     }
     if (count($list_subject) == $per_page) {
         $is_next_subject = 1;
         array_pop($list_subject);
     } else {
         $is_next_subject = 0;
     }
     if (count($list_lesson) == $per_page) {
         $is_next_lesson = 1;
         array_pop($list_lesson);
     } else {
         $is_next_lesson = 0;
     }
     $display->add('current_url', $current_url);
     $display->add('is_next_class', $is_next_class);
     $display->add('is_next_subject', $is_next_subject);
     $display->add('is_next_lesson', $is_next_lesson);
     $display->add('list_class', $list_class);
     $display->add('list_subject', $list_subject);
     $display->add('list_lesson', $list_lesson);
     $display->add('keyword_view', htmlspecialchars($keyword));
     $display->add('keyword', $keyword);
     $display->add('keyword_mobile', $keyword);
     // Output
     $display->output("list");
 }
示例#2
0
文件: History.php 项目: hqd276/bigs
 function draw()
 {
     $user_ids = Url::get('id');
     global $display;
     //        $this->beginForm(false, 'post', false, Url::build_current(array('cmd' => 'history_lesson')));
     $filter_id = intval(trim(Url::get('filter_id')));
     $sid = intval(trim(Url::get('subject')));
     $display->add('from_time', Url::get('from_time'));
     $display->add('to_time', Url::get('to_time'));
     $display->add('subject', $sid);
     $list_subject = Subjects::get_collection(null);
     if (!empty($sid)) {
         $list_lesson = Lessons::get_collection(null, ' subject = ' . $sid);
     } else {
         $list_lesson = Lessons::get_collection(null);
     }
     $display->add('list_subject', $list_subject);
     $display->add('list_lesson', $list_lesson);
     $cond = array();
     if (!empty($filter_id)) {
         $cond[] = 'id LIKE "%' . $filter_id . '%"';
         $display->add('filter_id', $filter_id);
     }
     $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;
     }
     $cond[] = 'uid = ' . $user_ids;
     $cond[] = 'type_id = 1';
     $str_lesson = '';
     foreach ($list_lesson as $lesson) {
         $str_lesson .= $str_lesson == '' ? $lesson['id'] : ', ' . $lesson['id'];
     }
     $cond[] = ' object_id IN (' . $str_lesson . ') ';
     $item_per_page = 50;
     $cond = EClassApi::analyze_conditions($cond);
     $list_user_log = array();
     $paging = '';
     $total_row = Logs::count_all($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_user_log = Logs::get_collection($limit, $cond, 'ORDER BY id DESC');
     }
     $error_message = $this->getErrorMessage('admin/category/error');
     $display->add('error_message', $error_message);
     $display->add('paging', $paging);
     $display->add('user_ids', $user_ids);
     $display->add('list_user_log', $list_user_log);
     $display->add('is_admin', User::is_admin());
     $display->output('history');
     //        $this->endForm();
 }
示例#3
0
 function preview_teacher_log()
 {
     header('Content-Type: text/html; charset=utf-8');
     global $display;
     $anchor_index = intval(Url::get('anchor_index', 0));
     $tid = intval(Url::get('tid', 0));
     $cid = intval(Url::get('cid', 0));
     $lid = intval(Url::get('lid', 0));
     $from_time = 0;
     $to_time = 0;
     $cond = array();
     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 ($cid) {
         $cond[] = ' cid= ' . $cid;
     }
     if ($lid) {
         $cond[] = ' lid= ' . $lid;
     }
     $cond[] = ' tid=' . $tid;
     $cond = EClassApi::analyze_conditions($cond);
     if ($anchor_index == 0) {
         $list_logs = Classes::get_list_teacher_log(' LIMIT ' . $anchor_index * 9 . ', 9', $cond, 'ORDER BY id DESC');
         $is_preview = 0;
     } else {
         $list_logs = Classes::get_list_teacher_log(' LIMIT ' . $anchor_index * 9 . ', 10', $cond, 'ORDER BY id DESC');
         if (count($list_logs) == 10) {
             $is_preview = 1;
             array_pop($list_logs);
         } else {
             $is_preview = 0;
         }
         if (empty($list_logs)) {
             exit;
         }
     }
     $list_class = Classes::get_collection(null);
     $list_lesson = Lessons::get_collection(null);
     $list_user = User::get_collection(null);
     $is_next = 1;
     $display->add('list_class', $list_class);
     $display->add('list_lesson', $list_lesson);
     $display->add('list_user', $list_user);
     $display->add('list_logs', $list_logs);
     $display->add('anchor_index', $anchor_index);
     $display->add('is_next', $is_next);
     $display->add('is_preview', $is_preview);
     $display->output('Personal/ajax/Next');
     exit;
 }