Exemple #1
0
 function on_submit()
 {
     $id = intval(Url::get('id'));
     $data['title'] = Url::get('title');
     $data['title_en'] = Url::get('title_en');
     $data['category_id'] = intval(trim(Url::get('category_id', 0)));
     $data['description'] = Url::get('description');
     $data['description_en'] = Url::get('description_en');
     $data['content'] = Url::get('content');
     $data['content_en'] = Url::get('content_en');
     $data['image'] = '';
     $data['keywords'] = Url::get('keywords');
     $data['post_day'] = trim(Url::get('post_day'));
     if (!empty($data['post_day'])) {
         $data['post_day'] = EClassApi::render_time($data['post_day']);
     } else {
         $data['post_day'] = time();
     }
     $data['is_active'] = Url::get('is_active', 0);
     $data['hot_article'] = Url::get('hot_article', 0);
     $data['top_home'] = Url::get('top_home', 0);
     if (empty($data['shortcut'])) {
         $data['shortcut'] = strtolower(EClassApi::safe_title($data['title']));
     } else {
         $data['shortcut'] = strtolower(EClassApi::safe_title(Url::get('shorcut')));
     }
     if (isset($_FILES["file"]) && $_FILES["file"]["size"] > 0) {
         $store_in = 'files/news/' . date('Y/m/d') . '/';
         if (!file_exists($store_in)) {
             mkdir($store_in, 0775, true);
         }
         move_uploaded_file($_FILES["file"]["tmp_name"], $store_in . $_FILES["file"]["name"]);
         $data['image'] = $store_in . $_FILES["file"]["name"];
     } else {
         unset($data['image']);
     }
     if (intval($id) == 0) {
         $data['uid'] = User::id();
         $id = DB::insert('news_item', $data);
         $this->setSuccessMessage('news/item/form', serialize($data));
         $this->setSuccessMessage('news/item/success', 'Lưu thông tin bài viết [' . $data['title'] . '] thành công');
     } else {
         DB::update('news_item', $data, 'id=' . $id);
         $this->setSuccessMessage('news/item/success', 'Cập nhật thông tin bài viết [' . $data['title'] . '] thành công');
     }
     Url::redirect_url('admin_news_item.html?cmd=edit&id=' . $id);
     eb_memcache::do_remove('news_item:' . $id);
 }
Exemple #2
0
 function draw()
 {
     global $display;
     //        $this->beginForm(false, 'post', false, Url::build_current(array('cmd' => 'list_log')));
     $filter_id = intval(trim(Url::get('filter_id')));
     $filter_type = intval(trim(Url::get('filter_type')));
     $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);
     }
     $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[] = ' type_id = -1 ';
     $item_per_page = 50;
     $cond = EClassApi::analyze_conditions($cond);
     $list_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_log = Logs::get_collection($limit, $cond, ' ORDER BY id DESC');
         foreach ($list_log as $k => $l) {
             $l['data'] = unserialize($l['data']);
             if ($l['data']['type'] != 'VIP') {
                 if (isset($l['data']['status'])) {
                     if ($l['data']['status'] == '00') {
                         $list_log[$k]['status'] = 1;
                     } else {
                         $list_log[$k]['status'] = 0;
                     }
                 } else {
                     $list_log[$k]['status'] = 0;
                 }
                 if (!empty($l['data']['status'])) {
                     $list_log[$k]['fail'] = 0;
                 } else {
                     $list_log[$k]['fail'] = 1;
                 }
             } else {
                 $list_log[$k]['status'] = 1;
                 $list_log[$k]['fail'] = 0;
             }
             $list_log[$k]['data'] = $l['data'];
         }
     }
     $display->add('paging', $paging);
     $display->add('list_log', $list_log);
     $display->add('is_admin', User::is_admin());
     $display->add('is_root', User::is_root());
     $display->output('ListCoin');
     //        $this->endForm();
 }
Exemple #3
0
 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();
 }
Exemple #4
0
 function draw()
 {
     global $display;
     $this->beginForm(false, "POST", false, Url::build_current());
     //search theo ngay thang nam
     $display->add('created_time_from', Url::get('created_time_from'));
     $display->add('created_time_to', Url::get('created_time_to'));
     $created_time_from = 0;
     $created_time_to = 0;
     if (Url::get('created_time_from')) {
         $date_arr = explode('/', Url::get('created_time_from'));
         if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) {
             $created_time_from = EClassApi::render_time($date_arr[1] . '/' . $date_arr[0] . '/' . (int) $date_arr[2], 0);
         }
     }
     if (Url::get('created_time_to')) {
         $date_arr = explode('/', Url::get('created_time_to'));
         if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) {
             $created_time_to = EClassApi::render_time($date_arr[1] . '/' . $date_arr[0] . '/' . (int) $date_arr[2], 1);
         }
     }
     $search_value = 1;
     $last_log = (int) Url::get('last_log');
     if ($last_log) {
         if ($created_time_from) {
             $search_value .= ' AND last_login >= ' . $created_time_from;
         }
         if ($created_time_to) {
             $search_value .= ' AND last_login <= ' . $created_time_to;
         }
     } else {
         if ($created_time_from) {
             $search_value .= ' AND create_time >= ' . $created_time_from;
         }
         if ($created_time_to) {
             $search_value .= ' AND create_time <= ' . $created_time_to;
         }
     }
     $display->add('last_log', $last_log);
     if (Url::get('active') == 1) {
         $search_value .= ' AND (is_active=1)';
         $display->add('active_checked', 'checked');
     } else {
         $display->add('active_checked', '');
     }
     if (Url::get('tracking') == 1) {
         $search_value .= ' AND (tracking=1)';
         $display->add('tracking_checked', 'checked');
     } else {
         $display->add('tracking_checked', '');
     }
     if (Url::get('invalid') == 1) {
         $search_value .= ' AND (invalid_time > 0 OR invalid_time = -1)';
         $order_by = ' ORDER BY invalid_time DESC ';
         $display->add('invalid_checked', 'checked');
     } else {
         //$search_value .= ' AND invalid_time = 0';
         $order_by = ' ORDER BY id DESC ';
         $display->add('invalid_checked', '');
     }
     if (Url::get('block') == 1) {
         $search_value .= ' AND (block_time >= ' . TIME_NOW . ' OR block_time = -1)';
         $order_by = ' ORDER BY block_time DESC ';
         $display->add('block_checked', 'checked');
     } else {
         //$search_value .= ' AND block_time!=-1 AND block_time <= '.TIME_NOW;
         $display->add('block_checked', '');
     }
     $od_by = Url::get('order_by');
     $od_dir = Url::get('order_dir', 'DESC');
     if ($od_by == 'name') {
         $order_by = ' ORDER BY user_name ' . $od_dir;
     } elseif ($od_by == 'id') {
         $order_by = ' ORDER BY id ' . $od_dir;
     } elseif ($od_by == 'time') {
         $order_by = ' ORDER BY create_time ' . $od_dir;
     } elseif ($last_log) {
         $order_by = ' ORDER BY last_login ' . $od_dir;
     }
     if (Url::get('ava')) {
         $search_value .= ' AND avatar_url != ""';
         $display->add('ava_checked', 'checked');
     } else {
         $display->add('ava_checked', '');
     }
     // search ô textbox	 ID
     $id_search = (int) Url::get('id_search', 0);
     if ($id_search) {
         $search_value .= ' AND id=' . $id_search;
     }
     if ($id_search == 0) {
         $id_search = '';
     }
     $display->add('id_search', $id_search);
     // search ô textbox	tài khoản
     if (Url::get('text_value') != '') {
         $text_value = trim(Url::get('text_value'));
         $display->add('text_value', $text_value);
         $str_search = str_replace("'", '"', $text_value);
         $str_search = str_replace("&#39;", '"', $str_search);
         $str_search = str_replace("&quot;", '"', $str_search);
         $s_user = User::getByUserName($str_search, true);
         if ($s_user) {
             $search_value .= " AND id='{$s_user['id']}' ";
         } else {
             $search_value .= " AND  0 ";
         }
     }
     $cid = 0;
     if (Url::get('cid') != 0) {
         $cid = trim(Url::get('cid'));
         $search_value .= ' AND (CONCAT(",", class_id, ",") LIKE "%,' . $cid . ',%") ';
     }
     $display->add('id_phone', Url::get('id_phone'));
     $item_per_page = Url::get('item_per_page', 50);
     $sql_count = 'SELECT COUNT(id) AS total_item FROM account WHERE ' . $search_value;
     $total = DB::fetch($sql_count, 'total_item', 0);
     $items = array();
     $str_id = '';
     $uids = '';
     if ($total) {
         $limit = '';
         require_once ROOT_PATH . 'core/ECPagging.php';
         $paging = ECPagging::pagingSE($limit, $total, $item_per_page, 10, 'page_no', true, 'Thành viên', 'Trang');
         $sql = 'SELECT * FROM account WHERE ' . $search_value . ' ' . $order_by . $limit;
         $result = DB::query($sql);
         if ($result) {
             while ($row = mysql_fetch_assoc($result)) {
                 $row['create_time'] = date('d/m/y H:i', $row['create_time']);
                 if ($row['last_login']) {
                     $row['last_login'] = date('d/m/y H:i', $row['last_login']);
                 } else {
                     $row['last_login'] = false;
                 }
                 if ($row['block_time'] > TIME_NOW || $row['block_time'] == -1) {
                     if ($row['block_time'] != -1) {
                         $row['status'] = "<font color=red><b>" . date('H:i d/m/y', $row['block_time']) . '</b></font>';
                     } else {
                         $row['status'] = '<font color=red><b>Khóa vĩnh viễn</b></font>';
                     }
                     $row['bgcolor'] = 'bgcolor="#CCCCCC"';
                     $row['is_block'] = true;
                     $display->add('type_reason', 'Khóa');
                 } else {
                     $row['status'] = "";
                     $row['bgcolor'] = '';
                     $row['is_block'] = false;
                 }
                 $row['gender'] = '';
                 $row['unban_nick'] = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac'), 'cmd=unban_nick&id=' . $row['id']);
                 if (User::is_root()) {
                     $row['del_link'] = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac'), 'cmd=del_user&id=' . $row['id']);
                 }
                 $row['detail'] = Url::build_current(array('cmd' => 'edit', 'id' => $row['id']));
                 $row['openids'] = array();
                 $row['del_cache'] = Url::build_all(array('cmd', 'id'), 'cmd=del_cache&id=' . $row['id']);
                 $uids .= ($uids ? ',' : '') . $row['id'];
                 $items[$row['id']] = $row;
             }
         }
     } else {
         $paging = '';
     }
     //
     //		if($uids){
     //			$re = DB::query("SELECT openid_url,user_id FROM openid WHERE user_id IN($uids)");
     //
     //			if($re){
     //				while ($oid = mysql_fetch_assoc($re)) {
     //					$items[$oid['user_id']]['openids'][] = $oid['openid_url'];
     //				}
     //			}
     //		}
     //lay ly do khoa nicks hoac kiem duyet nick
     $arr_reason = array();
     if ($str_id) {
         $where = '';
         if (Url::get('block') == 1) {
             $where = ' AND type IN (0,1) ';
         } else {
             if (Url::get('invalid') == 1) {
                 $where = ' AND type = 2 ';
             }
         }
         $sql = 'SELECT user_id, time, note, type,admin_id, admin_name FROM acc_lock WHERE user_id IN(' . $str_id . ') ' . $where . ' ORDER BY id ASC';
         $result = DB::query($sql);
         while ($row = mysql_fetch_assoc($result)) {
             $arr_reason[$row['user_id']] = $row;
         }
     }
     foreach ($items as $value) {
         if (isset($arr_reason[$value['id']]['user_id']) && $value['id'] == $arr_reason[$value['id']]['user_id']) {
             $items[$value['id']]['lock_reason'] = EClassApi::filter_title($arr_reason[$value['id']]['note']);
             $items[$value['id']]['lock_type'] = $arr_reason[$value['id']]['type'];
             $items[$value['id']]['time_lock'] = date("d/m/y H:i", $arr_reason[$value['id']]['time']);
             $items[$value['id']]['create_time_lock'] = $arr_reason[$value['id']]['time'];
             $items[$value['id']]['admin_name'] = $arr_reason[$value['id']]['admin_name'];
         } else {
             $items[$value['id']]['lock_reason'] = '';
             $items[$value['id']]['lock_type'] = '';
             $items[$value['id']]['time_lock'] = '';
             $items[$value['id']]['create_time_lock'] = 0;
             $items[$value['id']]['admin_name'] = '';
         }
     }
     //end lay ly do khoa nick
     if ($od_dir == 'ASC') {
         $od_dir = 'DESC';
     } else {
         $od_dir = 'ASC';
     }
     $href_id = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac'), 'order_by=id&order_dir=' . $od_dir);
     $href_name = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac'), 'order_by=name&order_dir=' . $od_dir);
     $href_up = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac'), 'order_by=up&order_dir=' . $od_dir);
     $href_time = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac'), 'order_by=time&order_dir=' . $od_dir);
     $img_id = '<img src="style/images/admin/downarrow.png" alt="">';
     //default
     $img_name = '';
     $img_up = '';
     $img_time = '';
     if ($od_by == 'id') {
         $img_id = '<img src="style/images/admin/' . ($od_dir != 'DESC' ? 'down' : 'up') . 'arrow.png" alt="">';
     }
     if ($od_by == 'name') {
         $img_name = '<img src="style/images/admin/' . ($od_dir != 'DESC' ? 'down' : 'up') . 'arrow.png" alt="">';
         $img_id = '';
     }
     if ($od_by == 'up') {
         $img_up = '<img src="style/images/admin/' . ($od_dir != 'DESC' ? 'down' : 'up') . 'arrow.png" alt="">';
         $img_id = '';
     }
     if ($od_by == 'time') {
         $img_time = '<img src="style/images/admin/' . ($od_dir != 'DESC' ? 'down' : 'up') . 'arrow.png" alt="">';
         $img_id = '';
     }
     // neu show cac thanh vien bi khoa, se sap xep theo thoi diem khoa hien tai giam dan
     if (Url::get('block') == 1) {
         usort($items, array("ListUserAdminForm", "cmp"));
     }
     $display->add('img_id', $img_id);
     $display->add('img_name', $img_name);
     $display->add('img_up', $img_up);
     $display->add('img_time', $img_time);
     $display->add('href_id', $href_id);
     $display->add('href_name', $href_name);
     $display->add('href_up', $href_up);
     $display->add('href_time', $href_time);
     $display->add('total_account', $total);
     $display->add('limit_date', BAN_NICK_DATE);
     $display->add('items', $items);
     $display->add('cid', $cid);
     //System::debug($items);
     $display->add('paging', $paging);
     $display->add('is_root', User::is_root());
     $display->output('list');
     $this->endForm();
 }
Exemple #5
0
 function draw()
 {
     global $display;
     //        $this->beginForm(false, 'post', false, Url::build_current(array('cmd' => 'list_log')));
     $filter_id = intval(trim(Url::get('filter_id')));
     $filter_type = intval(trim(Url::get('filter_type')));
     $type_id = intval(trim(Url::get('type_id')));
     $cid = intval(trim(Url::get('cid')));
     $display->add('cid', $cid);
     $display->add('type_id', $type_id);
     $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($filter_type)) {
         switch ($filter_type) {
             case 1:
                 $cond[] = ' type_id = ' . $filter_type;
                 break;
             case 2:
                 $cond[] = ' type_id = ' . $filter_type;
                 break;
             case 0:
                 $cond[] = ' type_id = ' . $filter_type;
                 break;
             default:
                 //                    $cond[] = ' type_id = 0';
                 break;
         }
         $display->add('filter_type', $filter_type);
     } else {
         $cond[] = ' type_id = 0';
         $display->add('filter_type', 0);
     }
     if (!empty($type_id) && $type_id != 0) {
         $cond[] = 'object_id = ' . $type_id;
         if (!empty($cid)) {
             $cond[] = ' (CONCAT(",", class_id, ",") LIKE "%,' . $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;
     }
     $item_per_page = 50;
     $cond = EClassApi::analyze_conditions($cond);
     $list_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_log = Logs::get_collection($limit, $cond, ' ORDER BY id DESC');
     }
     $list_class = Classes::get_collection_with_join(null);
     $list_lesson = Lessons::get_collection_with_join(null);
     $list_exam = Exam::get_collection(null);
     $error_message = $this->getErrorMessage('admin/log/error');
     $display->add('error_message', $error_message);
     $display->add('paging', $paging);
     $display->add('list_log', $list_log);
     $display->add('list_class', $list_class);
     $display->add('list_lesson', $list_lesson);
     $display->add('list_exam', $list_exam);
     $display->add('is_admin', User::is_admin());
     $display->output('ListLog');
     //        $this->endForm();
 }
Exemple #6
0
 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();
 }
Exemple #7
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;
 }