本文整理汇总了PHP中SessionManager::get_sessions_list方法的典型用法代码示例。如果您正苦于以下问题:PHP SessionManager::get_sessions_list方法的具体用法?PHP SessionManager::get_sessions_list怎么用?PHP SessionManager::get_sessions_list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SessionManager
的用法示例。
在下文中一共展示了SessionManager::get_sessions_list方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: intval
document.search_simple.submit();
}
</script> ';
$session_id = intval($_REQUEST['session_id']);
if (empty($session_id)) {
$temp_course_list = CourseManager::get_courses_list();
} else {
$temp_course_list = SessionManager::get_course_list_by_session_id($session_id);
}
foreach ($temp_course_list as $temp_course_item) {
$course_item = CourseManager::get_course_information($temp_course_item['code']);
$course_list[] = array('db_name' => $course_item['db_name'], 'code' => $course_item['code'], 'title' => $course_item['title'], 'visual_code' => $course_item['visual_code']);
$course_select_list[$temp_course_item['code']] = $course_item['title'];
}
//Get session list
$session_list = SessionManager::get_sessions_list(array(), array('name'));
$my_session_list = array();
$my_session_list[0] = get_lang('None');
foreach ($session_list as $sesion_item) {
$my_session_list[$sesion_item['id']] = $sesion_item['name'];
}
$form = new FormValidator('search_simple', 'POST', '', '', null, false);
$form->addElement('select', 'session_id', get_lang('Sessions'), $my_session_list, array('id' => 'session_id', 'onchange' => 'load_courses();'));
$form->addElement('select', 'course_code', get_lang('Courses'), $course_select_list);
$form->addElement('style_submit_button', 'submit_form', get_lang('Filter'));
if (!empty($_REQUEST['course_code'])) {
$course_code = $_REQUEST['course_code'];
} else {
$course_code = '';
}
if (empty($course_code)) {
示例2: WSListSessions
/**
* Get a list of sessions (id, title, url, date_start, date_end) and
* return to caller. Date start can be set to ask only for the sessions
* starting at or after this date. Date end can be set to ask only for the
* sessions ending before or at this date.
* Function registered as service. Returns strings in UTF-8.
* @param array List of parameters (security key, date_start and date_end)
* @return array Sessions list (id=>[title=>'title',url='http://...',date_start=>'...',date_end=>''])
*/
function WSListSessions($params)
{
if (!WSHelperVerifyKey($params)) {
return return_error(WS_ERROR_SECRET_KEY);
}
$sql_params = array();
// Dates should be provided in YYYY-MM-DD format, UTC
if (!empty($params['date_start'])) {
$sql_params['s.access_start_date'] = array('operator' => '>=', 'value' => $params['date_start']);
}
if (!empty($params['date_end'])) {
$sql_params['s.access_end_date'] = array('operator' => '<=', 'value' => $params['date_end']);
}
$sessions_list = SessionManager::get_sessions_list($sql_params);
$return_list = array();
foreach ($sessions_list as $session) {
$return_list[] = array('id' => $session['id'], 'title' => $session['name'], 'url' => api_get_path(WEB_CODE_PATH) . 'session/index.php?session_id=' . $session['id'], 'date_start' => $session['access_start_date'], 'date_end' => $session['access_end_date']);
}
return $return_list;
}
示例3: search_sessions
function search_sessions($needle, $type)
{
global $session_in_promotion;
$xajax_response = new xajaxResponse();
$return = '';
if (!empty($needle) && !empty($type)) {
$session_list = SessionManager::get_sessions_list(array('s.name' => array('operator' => 'LIKE', 'value' => "{$needle}%")));
$return .= '<select id="session_not_in_promotion" name="session_not_in_promotion_name[]" multiple="multiple" size="15" style="width:360px;">';
foreach ($session_list as $row) {
if (!in_array($row['id'], array_keys($session_in_promotion))) {
$return .= '<option value="' . $row['id'] . '">' . $row['name'] . '</option>';
}
}
$return .= '</select>';
$xajax_response->addAssign('ajax_list_multiple', 'innerHTML', api_utf8_encode($return));
}
return $xajax_response;
}
示例4: array_keys
}
$courseList = CourseManager::get_courses_followed_by_drh(api_get_user_id());
if (!empty($courseList)) {
$courseCodeList = array_keys($courseList);
}
}
if (empty($userIdList) || empty($courseCodeList)) {
exit;
}
} elseif (api_is_student_boss()) {
$searchByGroups = true;
} elseif (api_is_platform_admin()) {
if ($sessionId == -1) {
$userIdList = SessionManager::getAllUsersFromCoursesFromAllSessionFromStatus('admin', null);
$userIdList = array_column($userIdList, 'user_id');
$sessionList = SessionManager::get_sessions_list();
$sessionIdList = array_column($sessionList, 'id');
$courseCodeList = array();
foreach ($sessionList as $session) {
$courses = SessionManager::get_course_list_by_session_id($session['id']);
$courseCodeList = array_merge($courseCodeList, array_column($courses, 'code'));
}
}
$searchByGroups = true;
}
if ($searchByGroups) {
$userGroup = new UserGroup();
$userIdList = array_merge($userIdList, $userGroup->getGroupUsersByUser(api_get_user_id()));
}
if (is_array($userIdList)) {
$userIdList = array_unique($userIdList);
示例5: api_protect_global_admin_script
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\Sequence;
$cidReset = true;
require_once '../inc/global.inc.php';
api_protect_global_admin_script();
// setting breadcrumbs
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$tpl = new Template(get_lang('ResourcesSequencing'));
$sessionListFromDatabase = SessionManager::get_sessions_list();
$sessionList = [];
if (!empty($sessionListFromDatabase)) {
foreach ($sessionListFromDatabase as $sessionItem) {
$sessionList[$sessionItem['id']] = $sessionItem['name'] . ' (' . $sessionItem['id'] . ')';
}
}
$formSequence = new FormValidator('sequence_form', 'post', api_get_self(), null, null, 'inline');
$formSequence->addText('name', get_lang('Sequence'), true, ['cols-size' => [3, 8, 1]]);
$formSequence->addButtonCreate(get_lang('AddSequence'), 'submit_sequence', false, ['cols-size' => [3, 8, 1]]);
$em = Database::getManager();
// Add sequence
if ($formSequence->validate()) {
$values = $formSequence->exportValues();
$sequence = new Sequence();
$sequence->setName($values['name']);
$em->persist($sequence);
$em->flush();
header('Location: ' . api_get_self());
exit;
}
示例6: array
if ($id == 'name') {
$item2['text'] = $internal;
}
}
$results2[] = $item2;
}
$results2[] = array('T', 'text' => 'TODOS', 'id' => 'T');
echo json_encode($results2);
} else {
echo json_encode(array(array('T', 'text' => 'TODOS', 'id' => 'T')));
}
}
break;
case 'search_session_by_course':
if (api_is_platform_admin()) {
$results = SessionManager::get_sessions_list(array('s.name' => array('operator' => 'like', 'value' => "%" . $_REQUEST['q'] . "%"), 'c.id' => array('operator' => '=', 'value' => $_REQUEST['course_id'])));
$results2 = array();
if (!empty($results)) {
foreach ($results as $item) {
$item2 = array();
foreach ($item as $id => $internal) {
if ($id == 'id') {
$item2[$id] = $internal;
}
if ($id == 'name') {
$item2['text'] = $internal;
}
}
$results2[] = $item2;
}
$results2[] = array('T', 'text' => 'TODOS', 'id' => 'T');
示例7: search_sessions
function search_sessions($needle, $type)
{
global $tbl_user, $elements_in;
$xajax_response = new XajaxResponse();
$return = '';
if (!empty($needle) && !empty($type)) {
// xajax send utf8 datas... datas in db can be non-utf8 datas
$charset = api_get_system_encoding();
$needle = Database::escape_string($needle);
$needle = api_convert_encoding($needle, $charset, 'utf-8');
if ($type == 'single') {
// search users where username or firstname or lastname begins likes $needle
/* $sql = 'SELECT user.user_id, username, lastname, firstname FROM '.$tbl_user.' user
WHERE (username LIKE "'.$needle.'%"
OR firstname LIKE "'.$needle.'%"
OR lastname LIKE "'.$needle.'%") AND user.user_id<>"'.$user_anonymous.'" AND user.status<>'.DRH.''.
$order_clause.
' LIMIT 11';*/
} else {
if ($type == 'searchbox') {
$session_list = SessionManager::get_sessions_list(array('s.name LIKE' => "%{$needle}%"));
} else {
$session_list = SessionManager::get_sessions_list(array('s.name LIKE' => "{$needle}%"));
}
}
$i = 0;
if ($type == 'single') {
/*
while ($user = Database :: fetch_array($rs)) {
$i++;
if ($i<=10) {
$person_name = api_get_person_name($user['firstname'], $user['lastname']);
$return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_session(\''.$user['user_id'].'\',\''.$person_name.' ('.$user['username'].')'.'\')">'.$person_name.' ('.$user['username'].')</a><br />';
} else {
$return .= '...<br />';
}
}
$xajax_response -> addAssign('ajax_list_users_single','innerHTML',api_utf8_encode($return));*/
} else {
$return .= '<select id="elements_not_in" name="elements_not_in_name[]" multiple="multiple" size="15" style="width:360px;">';
foreach ($session_list as $row) {
if (!in_array($row['id'], array_keys($elements_in))) {
$return .= '<option value="' . $row['id'] . '">' . $row['name'] . '</option>';
}
}
$return .= '</select>';
$xajax_response->addAssign('ajax_list_multiple', 'innerHTML', api_utf8_encode($return));
}
}
return $xajax_response;
}
示例8: search_courses
function search_courses($id_session, $type)
{
global $tbl_course, $tbl_session_rel_course, $course_list;
$xajax_response = new xajaxResponse();
$select_destination = '';
$return = null;
if (!empty($type)) {
$id_session = intval($id_session);
if ($type == 'origin') {
$course_list = SessionManager::get_course_list_by_session_id($id_session);
$temp_course_list = array();
$return .= '<select id="origin" name="SessionCoursesListOrigin[]" class="form-control" onclick="javascript: checkSelected(this.id,\'copy_option_2\',\'title_option2\',\'destination\');">';
foreach ($course_list as $course) {
$temp_course_list[] = "'{$course['code']}'";
$return .= '<option value="' . $course['code'] . '" title="' . @htmlspecialchars($course['title'] . ' (' . $course['visual_code'] . ')', ENT_QUOTES, api_get_system_encoding()) . '">' . $course['title'] . ' (' . $course['visual_code'] . ')</option>';
}
$return .= '</select>';
$_SESSION['course_list'] = $temp_course_list;
$_SESSION['session_origin'] = $id_session;
// Build select for destination sessions where is not included current session from select origin
if (!empty($id_session)) {
$sessions = SessionManager::get_sessions_list(array(), array('name', 'ASC'));
$select_destination .= '<select name="sessions_list_destination" class="form-control" onchange = "javascript: xajax_search_courses(this.value,\'destination\');">';
$select_destination .= '<option value = "0">-- ' . get_lang('SelectASession') . ' --</option>';
foreach ($sessions as $session) {
if ($id_session == $session['id']) {
continue;
}
if (!empty($session['category_name'])) {
$session['category_name'] = ' (' . $session['category_name'] . ') ';
}
$select_destination .= '<option value="' . $session['id'] . '">' . $session['name'] . ' ' . $session['category_name'] . '</option>';
}
$select_destination .= '</select>';
$xajax_response->addAssign('ajax_sessions_list_destination', 'innerHTML', api_utf8_encode($select_destination));
} else {
$select_destination .= '<select name="sessions_list_destination" class="form-control" onchange = "javascript: xajax_search_courses(this.value,\'destination\');">';
$select_destination .= '<option value = "0">' . get_lang('ThereIsNotStillASession') . '</option>';
$select_destination .= '</select>';
$xajax_response->addAssign('ajax_sessions_list_destination', 'innerHTML', api_utf8_encode($select_destination));
}
// Select multiple destination empty
$select_multiple_empty = '<select id="destination" name="SessionCoursesListDestination[]" class="form-control"></select>';
// Send response by ajax
$xajax_response->addAssign('ajax_list_courses_origin', 'innerHTML', api_utf8_encode($return));
$xajax_response->addAssign('ajax_list_courses_destination', 'innerHTML', api_utf8_encode($select_multiple_empty));
} else {
//Left Select - Destination
$list_courses_origin = implode(',', $_SESSION['course_list']);
$session_origin = $_SESSION['session_origin'];
// Search courses by id_session where course codes is include en courses list destination
$sql = "SELECT c.code, c.visual_code, c.title, src.session_id\n FROM {$tbl_course} c, {$tbl_session_rel_course} src\n WHERE src.c_id = c.id\n AND src.session_id = '" . intval($id_session) . "'";
//AND c.code IN ($list_courses_origin)";
$rs = Database::query($sql);
$course_list_destination = array();
$return .= '<select id="destination" name="SessionCoursesListDestination[]" class="form-control">';
while ($course = Database::fetch_array($rs)) {
$course_list_destination[] = $course['code'];
$return .= '<option value="' . $course['code'] . '" title="' . @htmlspecialchars($course['title'] . ' (' . $course['visual_code'] . ')', ENT_QUOTES, api_get_system_encoding()) . '">' . $course['title'] . ' (' . $course['visual_code'] . ')</option>';
}
$return .= '</select>';
$_SESSION['course_list_destination'] = $course_list_destination;
// Send response by ajax
$xajax_response->addAssign('ajax_list_courses_destination', 'innerHTML', api_utf8_encode($return));
}
}
return $xajax_response;
}
示例9: search_sessions
function search_sessions($needle, $type)
{
global $elements_in;
$xajax_response = new xajaxResponse();
$return = '';
if (!empty($needle) && !empty($type)) {
if ($type == 'single') {
// search users where username or firstname or lastname begins likes $needle
/* $sql = 'SELECT user.user_id, username, lastname, firstname FROM '.$tbl_user.' user
WHERE (username LIKE "'.$needle.'%"
OR firstname LIKE "'.$needle.'%"
OR lastname LIKE "'.$needle.'%") AND user.user_id<>"'.$user_anonymous.'" AND user.status<>'.DRH.''.
$order_clause.
' LIMIT 11';*/
} else {
if ($type == 'searchbox') {
$session_list = SessionManager::get_sessions_list(array('s.name' => array('operator' => 'LIKE', 'value' => "%{$needle}%")));
} else {
$session_list = SessionManager::get_sessions_list(array('s.name' => array('operator' => 'LIKE', 'value' => "{$needle}%")));
}
}
$i = 0;
if ($type == 'single') {
} else {
$return .= '<select id="elements_not_in" name="elements_not_in_name[]" multiple="multiple" size="15" style="width:360px;">';
foreach ($session_list as $row) {
if (!in_array($row['id'], array_keys($elements_in))) {
$return .= '<option value="' . $row['id'] . '">' . $row['name'] . '</option>';
}
}
$return .= '</select>';
$xajax_response->addAssign('ajax_list_multiple', 'innerHTML', api_utf8_encode($return));
}
}
return $xajax_response;
}
示例10: search_sessions
function search_sessions($needle, $type)
{
global $session_in_promotion;
$xajax_response = new XajaxResponse();
$return = '';
if (!empty($needle) && !empty($type)) {
// xajax send utf8 datas... datas in db can be non-utf8 datas
$charset = api_get_system_encoding();
$needle = Database::escape_string($needle);
$needle = api_convert_encoding($needle, $charset, 'utf-8');
$session_list = SessionManager::get_sessions_list(array('s.name LIKE' => "{$needle}%"));
$return .= '<select id="session_not_in_promotion" name="session_not_in_promotion_name[]" multiple="multiple" size="15" style="width:360px;">';
foreach ($session_list as $row) {
if (!in_array($row['id'], array_keys($session_in_promotion))) {
$return .= '<option value="' . $row['id'] . '">' . $row['name'] . '</option>';
}
}
$return .= '</select>';
$xajax_response->addAssign('ajax_list_multiple', 'innerHTML', api_utf8_encode($return));
}
return $xajax_response;
}
示例11: get_logged_user_course_html
/**
* Display code for one specific course a logged in user is subscribed to.
* Shows a link to the course, what's new icons...
*
* $my_course['d'] - course directory
* $my_course['i'] - course title
* $my_course['c'] - visual course code
* $my_course['k'] - system course code
*
* @param array Course details
* @param integer Session ID
* @param string CSS class to apply to course entry
* @param boolean Whether the session is supposedly accessible now (not in the case it has passed and is in invisible/unaccessible mode)
* @param bool Whether to show the document quick-loader or not
* @return string The HTML to be printed for the course entry
*
* @version 1.0.3
* @todo refactor into different functions for database calls | logic | display
* @todo replace single-character $my_course['d'] indices
* @todo move code for what's new icons to a separate function to clear things up
* @todo add a parameter user_id so that it is possible to show the courselist of other users (=generalisation). This will prevent having to write a new function for this.
*/
public static function get_logged_user_course_html($course, $session_id = 0, $class = 'courses', $session_accessible = true, $load_dirs = false)
{
global $nosession;
$user_id = api_get_user_id();
$course_info = api_get_course_info($course['code']);
$status_course = CourseManager::get_user_in_course_status($user_id, $course_info['code']);
$course_info['status'] = empty($session_id) ? $status_course : STUDENT;
$course_info['id_session'] = $session_id;
if (!$nosession) {
global $now, $date_start, $date_end;
}
if (empty($date_start) or empty($date_end)) {
$sess = SessionManager::get_sessions_list(array('s.id' => array('operator' => '=', 'value' => $course_info['id_session'])));
$date_start = $sess[$course_info['id_session']]['date_start'];
$date_end = $sess[$course_info['id_session']]['date_end'];
}
if (empty($now)) {
// maybe use api_get_utcdate() here?
$now = date('Y-m-d h:i:s');
}
// Table definitions
$main_user_table = Database::get_main_table(TABLE_MAIN_USER);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
$course_access_settings = CourseManager::get_access_settings($course_info['code']);
$course_visibility = $course_access_settings['visibility'];
if ($course_visibility == COURSE_VISIBILITY_HIDDEN) {
return '';
}
$user_in_course_status = CourseManager::get_user_in_course_status(api_get_user_id(), $course_info['code']);
$is_coach = api_is_coach($course_info['id_session'], $course['code']);
// Display course entry.
// Show a hyperlink to the course, unless the course is closed and user is not course admin.
$session_url = '';
$session_title = '';
if ($session_accessible) {
if ($course_visibility != COURSE_VISIBILITY_CLOSED || $user_in_course_status == COURSEMANAGER) {
if (!$nosession) {
if (empty($course_info['id_session'])) {
$course_info['id_session'] = 0;
}
$sessionCourseAvailable = false;
$sessionCourseStatus = api_get_session_visibility($session_id, $course_info['code']);
if (in_array($sessionCourseStatus, array(SESSION_VISIBLE_READ_ONLY, SESSION_VISIBLE, SESSION_AVAILABLE))) {
$sessionCourseAvailable = true;
}
if ($user_in_course_status == COURSEMANAGER || $sessionCourseAvailable) {
$session_url = api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/?id_session=' . $course_info['id_session'];
$session_title = '<a href="' . api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/?id_session=' . $course_info['id_session'] . '">' . $course_info['name'] . '</a>';
} else {
$session_title = $course_info['name'];
}
} else {
$session_url = api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/';
$session_title = '<a href="' . api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/">' . $course_info['name'] . '</a>';
}
} else {
$session_title = $course_info['name'] . ' ' . Display::tag('span', get_lang('CourseClosed'), array('class' => 'item_closed'));
}
} else {
$session_title = $course_info['name'];
}
$params = array();
$params['icon'] = Display::return_icon('blackboard_blue.png', api_htmlentities($course_info['name']), array(), ICON_SIZE_LARGE);
$showCustomIcon = api_get_configuration_value('course_images_in_courses_list');
$iconName = basename($course_info['course_image']);
if ($showCustomIcon && $iconName != 'course.png') {
$params['icon'] = Display::img($course_info['course_image'], api_htmlentities($course_info['name']), array());
}
$params['link'] = $session_url;
$params['title'] = $session_title;
$params['right_actions'] = '';
if ($course_visibility != COURSE_VISIBILITY_CLOSED && $course_visibility != COURSE_VISIBILITY_HIDDEN) {
if ($load_dirs) {
$params['right_actions'] .= '<a id="document_preview_' . $course_info['real_id'] . '_' . $course_info['id_session'] . '" class="document_preview" href="javascript:void(0);">' . Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
$params['right_actions'] .= Display::div('', array('id' => 'document_result_' . $course_info['real_id'] . '_' . $course_info['id_session'], 'class' => 'document_preview_container'));
}
}
//.........这里部分代码省略.........