本文整理汇总了PHP中Classes::get_collection方法的典型用法代码示例。如果您正苦于以下问题:PHP Classes::get_collection方法的具体用法?PHP Classes::get_collection怎么用?PHP Classes::get_collection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Classes
的用法示例。
在下文中一共展示了Classes::get_collection方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: draw
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: draw
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();
}
示例3: search_more
function search_more()
{
header('Content-Type: text/html; charset=utf-8');
global $display;
$keyword = Url::get('keyword');
$anchor_index = intval(Url::get('anchor_index', 0));
$type = Url::get('type');
$order_str = '';
$per_page = 21;
if ($type == 'class') {
$where_class = ' WHERE c.`name` LIKE "%' . addslashes($keyword) . '%" AND c.is_active = 1 ';
$list_class = Classes::get_collection(' LIMIT ' . $anchor_index * ($per_page - 1) . ', ' . $per_page, $where_class, $order_str);
if (count($list_class) == $per_page) {
$is_next_class = 1;
array_pop($list_class);
} else {
$is_next_class = 0;
}
if (empty($list_class)) {
exit;
}
}
if ($type == 'subject') {
$where_subject = ' WHERE `name` LIKE "%' . addslashes($keyword) . '%" ';
$list_subject = Subjects::get_collection(' LIMIT ' . $anchor_index * ($per_page - 1) . ', ' . $per_page, $where_subject, $order_str);
if (count($list_subject) == $per_page) {
$is_next_subject = 1;
array_pop($list_subject);
} else {
$is_next_subject = 0;
}
if (empty($list_subject)) {
exit;
}
}
if ($type == 'lesson') {
$where_lesson = ' WHERE `name` LIKE "%' . addslashes($keyword) . '%" ';
$list_lesson = Subjects::get_collection(' LIMIT ' . $anchor_index * ($per_page - 1) . ', ' . $per_page, $where_lesson, $order_str);
if (count($list_lesson) == $per_page) {
$is_next_lesson = 1;
array_pop($list_lesson);
} else {
$is_next_lesson = 0;
}
if (empty($list_lesson)) {
exit;
}
}
if ($type == 'class') {
$display->add('list_class', $list_class);
$display->add('anchor_index_class', $anchor_index);
$display->add('is_next_class', $is_next_class);
}
if ($type == 'subject') {
$display->add('list_subject', $list_subject);
$display->add('anchor_index_subject', $anchor_index);
$display->add('is_next_subject', $is_next_subject);
}
if ($type == 'lesson') {
$display->add('list_lesson', $list_lesson);
$display->add('anchor_index_lesson', $anchor_index);
$display->add('is_next_lesson', $is_next_lesson);
}
$display->output('Searchinfo/ajax/ShowMore');
exit;
}
示例4: preview_teacher_log
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;
}