本文整理汇总了PHP中SessionManager::get_sessions_by_general_coach方法的典型用法代码示例。如果您正苦于以下问题:PHP SessionManager::get_sessions_by_general_coach方法的具体用法?PHP SessionManager::get_sessions_by_general_coach怎么用?PHP SessionManager::get_sessions_by_general_coach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SessionManager
的用法示例。
在下文中一共展示了SessionManager::get_sessions_by_general_coach方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
}
echo '</div>';
if ($displayMessage != "") {
Display::display_confirmation_message($displayMessage);
$displayMessage = "";
}
//Form
echo '<form class="form-horizontal" name="question_pool" method="GET" action="' . $url . '">';
//Title
echo '<legend>' . $nameTools . ' - ' . $titleAdd . '</legend>';
if (isset($type)) {
echo '<input type="hidden" name="type" value="1">';
}
echo '<input type="hidden" name="fromExercise" value="' . $fromExercise . '">';
// Session list, if sessions are used.
$session_list = SessionManager::get_sessions_by_general_coach(api_get_user_id());
$tabAttrParam = array('class' => 'chzn-select', 'onchange' => 'submit_form(this)');
// when sessions are used
$labelFormRow = get_lang('Session');
$session_select_list = array();
foreach ($session_list as $item) {
$session_select_list[$item['id']] = $item['name'];
}
$select_session_html = Display::select('session_id', $session_select_list, $session_id, $tabAttrParam);
echo Display::form_row($labelFormRow, $select_session_html);
// hub 13-10-2011
// Course list, get course list of session, or for course where user is admin
if (!empty($session_id) && $session_id != '-1') {
$course_list = SessionManager::get_course_list_by_session_id($session_id);
} else {
$course_list = CourseManager::get_course_list_of_user_as_course_admin(api_get_user_id());
示例2: getRules
/**
* @param string $courseCode
* @param array $rules
* @param array $columns
* @param array $column_model
* @return array
*/
public static function getRules($courseCode, &$rules, &$columns, &$column_model, $questionFields, $checkFields = false)
{
// sessions
// course
// categories
// exercises
// difficult
// type
if (empty($courseCode)) {
// Session.
$sessionList = SessionManager::get_sessions_by_general_coach(api_get_user_id());
$fields = array();
if (!empty($sessionList)) {
$new_options = array();
$new_options[] = "-1:" . get_lang('All');
foreach ($sessionList as $session) {
$new_options[] = "{$session['id']}:{$session['name']}";
}
$string = implode(';', $new_options);
$fields[] = array('field_display_text' => get_lang('Session'), 'field_variable' => 'session_id', 'field_type' => ExtraField::FIELD_TYPE_SELECT, 'field_default_value' => null, 'field_options' => $string);
}
} else {
// $courseList = array(api_get_course_info());
//$courseList = CourseManager::get_course_list_of_user_as_course_admin(api_get_user_id());
}
// Courses.
$courseList = CourseManager::get_course_list_of_user_as_course_admin(api_get_user_id());
if (!empty($courseList)) {
$new_options = array();
$new_options[] = "-1:" . get_lang('All');
foreach ($courseList as $course) {
$new_options[] = "{$course['id']}:{$course['title']}";
}
$string = implode(';', $new_options);
$fields[] = array('field_display_text' => get_lang('Course'), 'field_variable' => 'c_id', 'field_type' => ExtraField::FIELD_TYPE_SELECT, 'field_default_value' => null, 'field_options' => $string);
}
// Categories.
$string = null;
if (!empty($courseList)) {
$new_options = array();
$new_options[] = "-1:" . get_lang('All');
// Global categories
// @todo use tree view
$categories = Testcategory::getCategoriesIdAndName(0);
if (!empty($categories)) {
foreach ($categories as $id => $category) {
if (!empty($id)) {
$new_options[] = "{$id}:[Global] - " . $category;
}
}
}
foreach ($courseList as $course) {
$categories = Testcategory::getCategoriesIdAndName($course['real_id']);
if (!empty($categories)) {
foreach ($categories as $id => $category) {
if (!empty($id)) {
$new_options[] = "{$id}:" . $course['title'] . " - " . $category;
}
}
}
}
$string = implode(';', $new_options);
$fields[] = array('field_display_text' => get_lang('Category'), 'field_variable' => 'category_id', 'field_type' => ExtraField::FIELD_TYPE_SELECT, 'field_default_value' => null, 'field_options' => $string);
}
$course = api_get_course_int_id();
$sessionId = api_get_session_id();
// Exercises.
$exerciseList = ExerciseLib::get_all_exercises_for_course_id($sessionId, $course);
if (!empty($exerciseList)) {
$new_options = array();
$new_options[] = "-1:" . get_lang('All');
$new_options[] = "0:" . get_lang('Orphan');
foreach ($exerciseList as $exercise) {
$new_options[] = "{$exercise['iid']}:{$exercise['title']}";
}
$string = implode(';', $new_options);
$fields[] = array('field_display_text' => get_lang('Exercise'), 'field_variable' => 'exercise_id', 'field_type' => ExtraField::FIELD_TYPE_SELECT, 'field_default_value' => null, 'field_options' => $string);
}
// Question type.
$questionList = Question::get_question_type_list();
if (!empty($questionList)) {
$new_options = array();
$new_options[] = "-1:" . get_lang('All');
foreach ($questionList as $key => $question) {
$new_options[] = "{$key}:" . get_lang($question['1']);
}
$string = implode(';', $new_options);
$fields[] = array('field_display_text' => get_lang('AnswerType'), 'field_variable' => 'question_type', 'field_type' => ExtraField::FIELD_TYPE_SELECT, 'field_default_value' => null, 'field_options' => $string);
}
// Difficult.
$levels = Question::get_default_levels();
if (!empty($levels)) {
$new_options = array();
//.........这里部分代码省略.........
示例3: intval
<?php
/* For licensing terms, see /license.txt */
$user_id = intval($_REQUEST['user_id']);
$session_id = intval($_REQUEST['id_session']);
if (empty($user_id) && empty($session_id)) {
api_not_allowed(true);
}
SessionManager::protect_session_edit($session_id);
if (api_is_platform_admin()) {
$sessions = SessionManager::get_sessions_admin(array('order' => 'name'));
} else {
$sessions = SessionManager::get_sessions_by_general_coach(api_get_session_id());
}
$message = null;
$session_to_select = array();
foreach ($sessions as $session) {
if ($session_id != $session['id']) {
$session_to_select[$session['id']] = $session['name'];
}
}
$session_name = api_get_session_name($session_id);
$user_info = api_get_user_info($user_id);
//Check if user was already moved
$user_status = SessionManager::get_user_status_in_session($session_id, $user_id);
if (isset($user_status['moved_to']) && $user_status['moved_to'] != 0 || $user_status['moved_status'] == SessionManager::SESSION_CHANGE_USER_REASON_ENROLLMENT_ANNULATION) {
api_not_allowed(true);
}
$form = new FormValidator('change_user_session', 'post', api_get_self());
$form->addElement('hidden', 'user_id', $user_id);
$form->addElement('hidden', 'id_session', $session_id);