本文整理汇总了PHP中Subjects::get_collection方法的典型用法代码示例。如果您正苦于以下问题:PHP Subjects::get_collection方法的具体用法?PHP Subjects::get_collection怎么用?PHP Subjects::get_collection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subjects
的用法示例。
在下文中一共展示了Subjects::get_collection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例3: draw
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();
}