本文整理汇总了PHP中CourseManager类的典型用法代码示例。如果您正苦于以下问题:PHP CourseManager类的具体用法?PHP CourseManager怎么用?PHP CourseManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CourseManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: slide_presentation_quiz
function slide_presentation_quiz(Quiz $quiz, $name)
{
global $tr;
$manageCourse = new CourseManager();
$c = $manageCourse->getById($quiz->getCourseId());
return "<div class='sp-presentation-content'>\r\n <div>\r\n <h4><strong>" . $tr->__("Author") . "</strong>: " . $name . "</h4>\r\n <h4><strong>" . $tr->__("Course") . "</strong>: " . $c->getName() . "</h4>\r\n <h4><strong>" . $tr->__("Duration") . "</strong>: " . $quiz->getDuration() . " min</h4>\r\n </div>\r\n <h2>" . $quiz->getName() . "</h2>\r\n\r\n </div>";
}
开发者ID:Cossumo,项目名称:studypress,代码行数:7,代码来源:player-quiz.controller.php
示例2: WSCourseListOfUser
/**
* Get a list of courses (code, url, title, teacher, language) for a specific
* user and return to caller
* Function registered as service. Returns strings in UTF-8.
* @param string User name in Chamilo
* @param string Signature (composed of the sha1(username+apikey)
* @return array Courses list (code=>[title=>'title',url='http://...',teacher=>'...',language=>''],code=>[...],...)
*/
function WSCourseListOfUser($username, $signature)
{
if (empty($username) or empty($signature)) {
return -1;
}
global $_configuration;
$info = api_get_user_info_from_username($username);
$user_id = $info['user_id'];
$list = UserManager::get_api_keys($user_id, 'dokeos');
$key = '';
foreach ($list as $key) {
break;
}
$local_key = $username . $key;
if (!api_is_valid_secret_key($signature, $local_key)) {
return -1;
// The secret key is incorrect.
}
$courses_list = array();
$courses_list_tmp = CourseManager::get_courses_list_by_user_id($user_id);
foreach ($courses_list_tmp as $index => $course) {
$course_info = CourseManager::get_course_information($course['code']);
$courses_list[] = array('code' => $course['code'], 'title' => api_utf8_encode($course_info['title']), 'url' => api_get_path(WEB_COURSE_PATH) . $course_info['directory'] . '/', 'teacher' => api_utf8_encode($course_info['tutor_name']), 'language' => $course_info['course_language']);
}
return $courses_list;
}
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:34,代码来源:user_info.soap.php
示例3: execute
public function execute(BlockContextInterface $blockContext, Response $response = null)
{
// merge settings
$settings = $blockContext->getSettings();
$hotCourses = \CourseManager::returnHotCourses();
return $this->renderResponse($blockContext->getTemplate(), array('hot_courses' => $hotCourses, 'block' => $blockContext->getBlock(), 'settings' => $settings), $response);
}
开发者ID:par-orillonsoft,项目名称:chamilo-lms,代码行数:7,代码来源:CourseBlockService.php
示例4: search_courses
function search_courses($needle, $type)
{
global $tbl_course, $tbl_course_rel_access_url, $user_id;
$xajax_response = new xajaxResponse();
$return = '';
if (!empty($needle) && !empty($type)) {
// xajax send utf8 datas... datas in db can be non-utf8 datas
$needle = Database::escape_string($needle);
$assigned_courses_to_hrm = CourseManager::get_courses_followed_by_drh($user_id);
$assigned_courses_code = array_keys($assigned_courses_to_hrm);
foreach ($assigned_courses_code as &$value) {
$value = "'" . $value . "'";
}
$without_assigned_courses = '';
if (count($assigned_courses_code) > 0) {
$without_assigned_courses = " AND c.code NOT IN(" . implode(',', $assigned_courses_code) . ")";
}
if (api_is_multiple_url_enabled()) {
$sql = "SELECT c.code, c.title\n FROM {$tbl_course} c\n\t\t\t\t\tLEFT JOIN {$tbl_course_rel_access_url} a\n ON (a.c_id = c.id)\n \tWHERE\n \t\tc.code LIKE '{$needle}%' {$without_assigned_courses} AND\n \t\taccess_url_id = " . api_get_current_access_url_id();
} else {
$sql = "SELECT c.code, c.title\n \t\tFROM {$tbl_course} c\n \tWHERE\n \t\tc.code LIKE '{$needle}%'\n \t\t{$without_assigned_courses} ";
}
$rs = Database::query($sql);
$return .= '<select id="origin" name="NoAssignedCoursesList[]" multiple="multiple" size="20" style="width:340px;">';
while ($course = Database::fetch_array($rs)) {
$return .= '<option value="' . $course['code'] . '" title="' . htmlspecialchars($course['title'], ENT_QUOTES) . '">' . $course['title'] . ' (' . $course['code'] . ')</option>';
}
$return .= '</select>';
$xajax_response->addAssign('ajax_list_courses_multiple', 'innerHTML', api_utf8_encode($return));
}
return $xajax_response;
}
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:32,代码来源:dashboard_add_courses_to_user.php
示例5: get_course_usage
/**
*
*/
function get_course_usage($course_code, $session_id = 0)
{
$table = Database::get_main_table(TABLE_MAIN_COURSE);
$course_code = Database::escape_string($course_code);
$sql = "SELECT * FROM {$table} WHERE code='" . $course_code . "'";
$res = Database::query($sql);
$course = Database::fetch_object($res);
// Learnpaths
$table = Database::get_course_table(TABLE_LP_MAIN);
$usage[] = array(get_lang(ucfirst(TOOL_LEARNPATH)), CourseManager::count_rows_course_table($table, $session_id, $course->id));
// Forums
$table = Database::get_course_table(TABLE_FORUM);
$usage[] = array(get_lang('Forums'), CourseManager::count_rows_course_table($table, $session_id, $course->id));
// Quizzes
$table = Database::get_course_table(TABLE_QUIZ_TEST);
$usage[] = array(get_lang(ucfirst(TOOL_QUIZ)), CourseManager::count_rows_course_table($table, $session_id, $course->id));
// Documents
$table = Database::get_course_table(TABLE_DOCUMENT);
$usage[] = array(get_lang(ucfirst(TOOL_DOCUMENT)), CourseManager::count_rows_course_table($table, $session_id, $course->id));
// Groups
$table = Database::get_course_table(TABLE_GROUP);
$usage[] = array(get_lang(ucfirst(TOOL_GROUP)), CourseManager::count_rows_course_table($table, $session_id, $course->id));
// Calendar
$table = Database::get_course_table(TABLE_AGENDA);
$usage[] = array(get_lang(ucfirst(TOOL_CALENDAR_EVENT)), CourseManager::count_rows_course_table($table, $session_id, $course->id));
// Link
$table = Database::get_course_table(TABLE_LINK);
$usage[] = array(get_lang(ucfirst(TOOL_LINK)), CourseManager::count_rows_course_table($table, $session_id, $course->id));
// Announcements
$table = Database::get_course_table(TABLE_ANNOUNCEMENT);
$usage[] = array(get_lang(ucfirst(TOOL_ANNOUNCEMENT)), CourseManager::count_rows_course_table($table, $session_id, $course->id));
return $usage;
}
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:36,代码来源:course_information.php
示例6: courses_list
/**
* Get a list of courses (code, url, title, teacher, language) and return to caller
* Function registered as service. Returns strings in UTF-8.
* @param string Security key (the Dokeos install's API key)
* @param mixed Array or string. Type of visibility of course (public, public-registered, private, closed)
* @return array Courses list (code=>[title=>'title',url='http://...',teacher=>'...',language=>''],code=>[...],...)
*/
function courses_list($security_key, $visibilities = 'public')
{
global $_configuration;
// Check if this script is launch by server and if security key is ok.
if ($security_key != $_configuration['security_key']) {
return array('error_msg' => 'Security check failed');
}
$vis = array('public' => '3', 'public-registered' => '2', 'private' => '1', 'closed' => '0');
$courses_list = array();
if (!is_array($visibilities)) {
$tmp = $visibilities;
$visibilities = array($tmp);
}
foreach ($visibilities as $visibility) {
if (!in_array($visibility, array_keys($vis))) {
return array('error_msg' => 'Security check failed');
}
$courses_list_tmp = CourseManager::get_courses_list(null, null, null, null, $vis[$visibility]);
foreach ($courses_list_tmp as $index => $course) {
$course_info = CourseManager::get_course_information($course['code']);
$courses_list[$course['code']] = array('title' => api_utf8_encode($course_info['title']), 'url' => api_get_path(WEB_COURSE_PATH) . $course_info['directory'] . '/', 'teacher' => api_utf8_encode($course_info['tutor_name']), 'language' => $course_info['course_language']);
}
}
return $courses_list;
}
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:32,代码来源:courses_list.rest.php
示例7: check_download_survey
/**
* @package chamilo.survey
* @author Arnaud Ligot <[email protected]>
* @version $Id: $
*
* A small peace of code to enable user to access images included into survey
* which are accessible by non authenticated users. This file is included
* by document/download.php
*/
function check_download_survey($course, $invitation, $doc_url)
{
require_once 'survey.lib.php';
// Getting all the course information
$_course = CourseManager::get_course_information($course);
$course_id = $_course['real_id'];
// Database table definitions
$table_survey = Database::get_course_table(TABLE_SURVEY);
$table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
$table_survey_question_option = Database::get_course_table(TABLE_SURVEY_QUESTION_OPTION);
$table_survey_invitation = Database::get_course_table(TABLE_SURVEY_INVITATION);
// Now we check if the invitationcode is valid
$sql = "SELECT * FROM {$table_survey_invitation}\n\t WHERE\n\t c_id = {$course_id} AND\n\t invitation_code = '" . Database::escape_string($invitation) . "'";
$result = Database::query($sql);
if (Database::num_rows($result) < 1) {
Display::display_error_message(get_lang('WrongInvitationCode'), false);
Display::display_footer();
exit;
}
$survey_invitation = Database::fetch_assoc($result);
// Now we check if the user already filled the survey
if ($survey_invitation['answered'] == 1) {
Display::display_error_message(get_lang('YouAlreadyFilledThisSurvey'), false);
Display::display_footer();
exit;
}
// Very basic security check: check if a text field from a survey/answer/option contains the name of the document requested
// Fetch survey ID
// If this is the case there will be a language choice
$sql = "SELECT * FROM {$table_survey}\n\t WHERE\n\t c_id = {$course_id} AND\n\t code='" . Database::escape_string($survey_invitation['survey_code']) . "'";
$result = Database::query($sql);
if (Database::num_rows($result) > 1) {
if ($_POST['language']) {
$survey_invitation['survey_id'] = $_POST['language'];
} else {
echo '<form id="language" name="language" method="POST" action="' . api_get_self() . '?course=' . $_GET['course'] . '&invitationcode=' . $_GET['invitationcode'] . '">';
echo ' <select name="language">';
while ($row = Database::fetch_assoc($result)) {
echo '<option value="' . $row['survey_id'] . '">' . $row['lang'] . '</option>';
}
echo '</select>';
echo ' <input type="submit" name="Submit" value="' . get_lang('Ok') . '" />';
echo '</form>';
display::display_footer();
exit;
}
} else {
$row = Database::fetch_assoc($result);
$survey_invitation['survey_id'] = $row['survey_id'];
}
$sql = "SELECT count(*)\n\t FROM {$table_survey}\n\t WHERE\n\t c_id = {$course_id} AND\n\t survey_id = " . $survey_invitation['survey_id'] . " AND (\n title LIKE '%{$doc_url}%'\n or subtitle LIKE '%{$doc_url}%'\n or intro LIKE '%{$doc_url}%'\n or surveythanks LIKE '%{$doc_url}%'\n )\n\t\t UNION\n\t\t SELECT count(*)\n\t\t FROM {$table_survey_question}\n\t\t WHERE\n\t\t c_id = {$course_id} AND\n\t\t survey_id = " . $survey_invitation['survey_id'] . " AND (\n survey_question LIKE '%{$doc_url}%'\n or survey_question_comment LIKE '%{$doc_url}%'\n )\n\t\t UNION\n\t\t SELECT count(*)\n\t\t FROM {$table_survey_question_option}\n\t\t WHERE\n\t\t c_id = {$course_id} AND\n\t\t survey_id = " . $survey_invitation['survey_id'] . " AND (\n option_text LIKE '%{$doc_url}%'\n )";
$result = Database::query($sql);
if (Database::num_rows($result) == 0) {
Display::display_error_message(get_lang('WrongInvitationCode'), false);
Display::display_footer();
exit;
}
return $_course;
}
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:68,代码来源:survey.download.inc.php
示例8: __construct
/**
* Constructor
*/
public function __construct($user_id)
{
$this->user_id = $user_id;
$this->path = 'block_daily';
if ($this->is_block_visible_for_user($user_id)) {
$this->courses = CourseManager::get_courses_followed_by_drh($user_id);
}
}
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:11,代码来源:block_daily.class.php
示例9: get_user_courses
function get_user_courses()
{
if (!is_null($this->_get_user_courses)) {
return $this->_get_user_courses;
}
$user_id = $this->user_id;
return $this->_get_user_courses = CourseManager::get_courses_list_by_user_id($user_id);
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:8,代码来源:course_notice_query.class.php
示例10: get_course_title
public function get_course_title($username, $password, $course_code)
{
if ($this->verifyUserPass($username, $password) == "valid") {
$course_info = CourseManager::get_course_information($course_code);
return $course_info['title'];
} else {
return get_lang('InvalidId');
}
}
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:9,代码来源:cm_webservice_courses.php
示例11: get_myagendaitems
/**
* This function retrieves all the agenda items of all the courses the user is subscribed to
*/
function get_myagendaitems($user_id, $courses_dbs, $month, $year)
{
global $setting_agenda_link;
$user_id = intval($user_id);
$items = array();
$my_list = array();
// get agenda-items for every course
foreach ($courses_dbs as $key => $array_course_info) {
//databases of the courses
$TABLEAGENDA = Database::get_course_table(TABLE_AGENDA);
$TABLE_ITEMPROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
$group_memberships = GroupManager::get_group_ids($array_course_info["real_id"], $user_id);
$course_user_status = CourseManager::get_user_in_course_status($user_id, $array_course_info["code"]);
// if the user is administrator of that course we show all the agenda items
if ($course_user_status == '1') {
//echo "course admin";
$sqlquery = "SELECT DISTINCT agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref\n\t\t\t\t\t\t\tFROM " . $TABLEAGENDA . " agenda,\n\t\t\t\t\t\t\t\t " . $TABLE_ITEMPROPERTY . " ip\n\t\t\t\t\t\t\tWHERE agenda.id = ip.ref\n\t\t\t\t\t\t\tAND MONTH(agenda.start_date)='" . $month . "'\n\t\t\t\t\t\t\tAND YEAR(agenda.start_date)='" . $year . "'\n\t\t\t\t\t\t\tAND ip.tool='" . TOOL_CALENDAR_EVENT . "'\n\t\t\t\t\t\t\tAND ip.visibility='1'\n\t\t\t\t\t\t\tGROUP BY agenda.id\n\t\t\t\t\t\t\tORDER BY start_date ";
} else {
// if the user is not an administrator of that course
if (is_array($group_memberships) && count($group_memberships) > 0) {
$sqlquery = "SELECT\tagenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref\n\t\t\t\t\t\t\t\tFROM " . $TABLEAGENDA . " agenda,\n\t\t\t\t\t\t\t\t\t" . $TABLE_ITEMPROPERTY . " ip\n\t\t\t\t\t\t\t\tWHERE agenda.id = ip.ref\n\t\t\t\t\t\t\t\tAND MONTH(agenda.start_date)='" . $month . "'\n\t\t\t\t\t\t\t\tAND YEAR(agenda.start_date)='" . $year . "'\n\t\t\t\t\t\t\t\tAND ip.tool='" . TOOL_CALENDAR_EVENT . "'\n\t\t\t\t\t\t\t\tAND\t( ip.to_user_id='" . $user_id . "' OR ip.to_group_id IN (0, " . implode(", ", $group_memberships) . ") )\n\t\t\t\t\t\t\t\tAND ip.visibility='1'\n\t\t\t\t\t\t\t\tORDER BY start_date ";
} else {
$sqlquery = "SELECT agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref\n\t\t\t\t\t\t\t\tFROM " . $TABLEAGENDA . " agenda,\n\t\t\t\t\t\t\t\t\t" . $TABLE_ITEMPROPERTY . " ip\n\t\t\t\t\t\t\t\tWHERE agenda.id = ip.ref\n\t\t\t\t\t\t\t\tAND MONTH(agenda.start_date)='" . $month . "'\n\t\t\t\t\t\t\t\tAND YEAR(agenda.start_date)='" . $year . "'\n\t\t\t\t\t\t\t\tAND ip.tool='" . TOOL_CALENDAR_EVENT . "'\n\t\t\t\t\t\t\t\tAND ( ip.to_user_id='" . $user_id . "' OR ip.to_group_id='0')\n\t\t\t\t\t\t\t\tAND ip.visibility='1'\n\t\t\t\t\t\t\t\tORDER BY start_date ";
}
}
$result = Database::query($sqlquery);
while ($item = Database::fetch_array($result, 'ASSOC')) {
$agendaday = -1;
if ($item['start_date'] != '0000-00-00 00:00:00') {
$item['start_date'] = api_get_local_time($item['start_date']);
$item['start_date_tms'] = api_strtotime($item['start_date']);
$agendaday = date("j", $item['start_date_tms']);
}
if ($item['end_date'] != '0000-00-00 00:00:00') {
$item['end_date'] = api_get_local_time($item['end_date']);
}
$url = api_get_path(WEB_CODE_PATH) . "calendar/agenda.php?cidReq=" . urlencode($array_course_info["code"]) . "&day={$agendaday}&month={$month}&year={$year}#{$agendaday}";
$item['url'] = $url;
$item['course_name'] = $array_course_info['title'];
$item['calendar_type'] = 'course';
$item['course_id'] = $array_course_info['course_id'];
$my_list[$agendaday][] = $item;
}
}
// sorting by hour for every day
$agendaitems = array();
while (list($agendaday, $tmpitems) = each($items)) {
if (!isset($agendaitems[$agendaday])) {
$agendaitems[$agendaday] = '';
}
sort($tmpitems);
while (list($key, $val) = each($tmpitems)) {
$agendaitems[$agendaday] .= $val;
}
}
return $my_list;
}
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:60,代码来源:myagenda.inc.php
示例12: indexAction
/**
* @Route("/courses/{cidReq}/{sessionId}")
* @Method({"GET"})
*
* @param string $cidReq
* @param int $id_session
* @return Response
*/
public function indexAction($cidReq, $id_session = null)
{
$courseCode = api_get_course_id();
$sessionId = api_get_session_id();
$userId = $this->getUser()->getUserId();
$coursesAlreadyVisited = $this->getRequest()->getSession()->get('coursesAlreadyVisited');
$result = $this->autolaunch();
$showAutoLaunchLpWarning = $result['show_autolaunch_lp_warning'];
$showAutoLaunchExerciseWarning = $result['show_autolaunch_exercise_warning'];
if ($showAutoLaunchLpWarning) {
$this->getTemplate()->assign('lp_warning', Display::return_message(get_lang('TheLPAutoLaunchSettingIsONStudentsWillBeRedirectToAnSpecificLP'), 'warning'));
}
if ($showAutoLaunchExerciseWarning) {
$this->getTemplate()->assign('exercise_warning', Display::return_message(get_lang('TheExerciseAutoLaunchSettingIsONStudentsWillBeRedirectToAnSpecificExercise'), 'warning'));
}
if ($this->isCourseTeacher()) {
$editIcons = Display::url(Display::return_icon('edit.png'), $this->generateUrl('course_home.controller:iconListAction', array('course' => api_get_course_id())));
$this->getTemplate()->assign('edit_icons', $editIcons);
}
if (!isset($coursesAlreadyVisited[$courseCode])) {
event_access_course();
$coursesAlreadyVisited[$courseCode] = 1;
$this->getRequest()->getSession()->set('coursesAlreadyVisited', $coursesAlreadyVisited);
}
$this->getRequest()->getSession()->remove('toolgroup');
$this->getRequest()->getSession()->remove('_gid');
$isSpecialCourse = \CourseManager::is_special_course($courseCode);
if ($isSpecialCourse) {
$autoreg = $this->getRequest()->get('autoreg');
if ($autoreg == 1) {
\CourseManager::subscribe_user($userId, $courseCode, STUDENT);
}
}
$script = 'activity.php';
if (api_get_setting('homepage_view') == 'activity' || api_get_setting('homepage_view') == 'activity_big') {
$script = 'activity.php';
} elseif (api_get_setting('homepage_view') == '2column') {
$script = '2column.php';
} elseif (api_get_setting('homepage_view') == '3column') {
$script = '3column.php';
} elseif (api_get_setting('homepage_view') == 'vertical_activity') {
$script = 'vertical_activity.php';
}
$result = (require_once api_get_path(SYS_CODE_PATH) . 'course_home/' . $script);
$toolList = $result['tool_list'];
$this->getTemplate()->assign('icons', $result['content']);
$introduction = Display::return_introduction_section($this->get('url_generator'), TOOL_COURSE_HOMEPAGE, $toolList);
$this->getTemplate()->assign('introduction_text', $introduction);
if (api_get_setting('show_session_data') == 'true' && $sessionId) {
$sessionInfo = \CourseHome::show_session_data($sessionId);
$this->getTemplate()->assign('session_info', $sessionInfo);
}
$response = $this->get('template')->render_template($this->getTemplatePath() . 'index.tpl');
return new Response($response, 200, array());
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:63,代码来源:CourseHomeController.php
示例13: exit_of_chat
/**
* @param integer
* @return void
*/
function exit_of_chat($user_id)
{
$user_id = intval($user_id);
$list_course = CourseManager::get_courses_list_by_user_id($user_id);
$tbl_chat_connected = Database::get_course_table(TABLE_CHAT_CONNECTED);
foreach ($list_course as $course) {
$response = user_connected_in_chat($user_id);
$sql = 'DELETE FROM ' . $tbl_chat_connected . ' WHERE c_id = ' . $course['real_id'] . ' AND user_id = ' . $user_id;
Database::query($sql);
}
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:15,代码来源:chat_functions.lib.php
示例14: __construct
/**
* Constructor
*/
public function __construct($user_id)
{
$this->user_id = $user_id;
$this->path = 'block_course';
if ($this->is_block_visible_for_user($user_id)) {
/*if (api_is_platform_admin()) {
$this->courses = CourseManager::get_real_course_list();
} else {*/
$this->courses = CourseManager::get_courses_followed_by_drh($user_id);
//}
}
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:15,代码来源:block_course.class.php
示例15: __construct
/**
* Constructor
*/
public function __construct($user_id)
{
$this->path = 'block_evaluation_graph';
$this->user_id = $user_id;
$this->bg_width = 450;
$this->bg_height = 350;
if ($this->is_block_visible_for_user($user_id)) {
if (!api_is_session_admin()) {
$this->courses = CourseManager::get_courses_followed_by_drh($user_id);
}
$this->sessions = SessionManager::get_sessions_followed_by_drh($user_id);
}
}
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:16,代码来源:block_evaluation_graph.class.php
示例16: indexAction
/**
* @Route("/", name="course_home")
* @Route("/index.php")
* @Method({"GET"})
*
* @param Request $request
* @return Response
*/
public function indexAction(Request $request)
{
$sessionId = api_get_session_id();
$course = $this->getCourse();
$courseCode = $course->getId();
$result = $this->autoLaunch();
$showAutoLaunchLpWarning = $result['show_autolaunch_lp_warning'];
$showAutoLaunchExerciseWarning = $result['show_autolaunch_exercise_warning'];
if ($showAutoLaunchLpWarning) {
$this->addFlash('warning', $this->trans('TheLPAutoLaunchSettingIsONStudentsWillBeRedirectToAnSpecificLP'));
}
if ($showAutoLaunchExerciseWarning) {
$this->addFlash('warning', $this->trans('TheExerciseAutoLaunchSettingIsONStudentsWillBeRedirectToAnSpecificExercise'));
}
if (true) {
$editIcons = Display::url(Display::return_icon('edit.png'), $this->generateUrl('chamilo_course_home_home_iconlist', array('course' => api_get_course_id())));
}
$isSpecialCourse = \CourseManager::isSpecialCourse($courseCode);
if ($isSpecialCourse) {
$user = $this->getUser();
if (!empty($user)) {
$userId = $this->getUser()->getId();
$autoreg = $request->get('autoreg');
if ($autoreg == 1) {
\CourseManager::subscribe_user($userId, $courseCode, STUDENT);
}
}
}
$homeView = api_get_setting('course.homepage_view');
if ($homeView == 'activity' || $homeView == 'activity_big') {
$result = $this->renderActivityView();
} elseif ($homeView == '2column') {
$result = $this->render2ColumnView();
} elseif ($homeView == '3column') {
$result = $this->render3ColumnView();
} elseif ($homeView == 'vertical_activity') {
$result = $this->renderVerticalActivityView();
}
$toolList = $result['tool_list'];
$introduction = Display::return_introduction_section(TOOL_COURSE_HOMEPAGE, $toolList);
$sessionInfo = null;
if (api_get_setting('session.show_session_data') == 'true' && $sessionId) {
$sessionInfo = CourseHome::show_session_data($sessionId);
}
return $this->render('ChamiloCourseBundle:Home:index.html.twig', array('course' => $course, 'session_info' => $sessionInfo, 'icons' => $result['content'], 'edit_icons' => $editIcons, 'introduction_text' => $introduction, 'exercise_warning' => null, 'lp_warning' => null));
}
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:54,代码来源:HomeController.php
示例17: fill_courses
/**
* Loads the data and injects it into the Chamilo database, using the Chamilo
* internal functions.
* @return array List of user IDs for the users that have just been inserted
*/
function fill_courses()
{
$eol = PHP_EOL;
$courses = array();
//declare only to avoid parsing notice
require_once 'data_courses.php';
//fill the $users array
$output = array();
$output[] = array('title' => 'Courses Filling Report: ');
$i = 1;
foreach ($courses as $i => $course) {
//first check that the first item doesn't exist already
$output[$i]['line-init'] = $course['title'];
$output[$i]['line-info'] = $res = CourseManager::create_course($course) ? $res : get_lang('NotInserted');
$i++;
}
return $output;
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:23,代码来源:fill_courses.php
示例18: get_announcements
private function get_announcements($username, $course_code, $announcement_id = 0)
{
$session_id = api_get_session_id();
$condition_session = api_get_session_condition($session_id);
$announcement_id = $announcement_id == 0 ? "" : "AND announcement.id=" . $announcement_id;
$user_id = UserManager::get_user_id_from_username($username);
//$listOfCourses = CourseManager::get_course_information_by_id($course_id);
$course_info = CourseManager::get_course_information($course_code);
$course_db = $course_info['db_name'];
$tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY, $course_db);
$tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT, $course_db);
$maximum = '12';
$group_memberships = GroupManager::get_group_ids($course_info['real_id'], $user_id);
if (api_get_group_id() == 0) {
$cond_user_id = " AND ( ip.to_user_id='" . $user_id . "'" . "OR ip.to_group_id IN (0, " . implode(", ", $group_memberships) . ")) ";
} else {
$cond_user_id = " AND ( ip.to_user_id='" . $user_id . "'" . "OR ip.to_group_id IN (0, " . api_get_group_id() . ")) ";
}
// the user is member of several groups => display personal announcements AND his group announcements AND the general announcements
if (is_array($group_memberships) && count($group_memberships) > 0) {
$sql = "SELECT\n announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id\n FROM {$tbl_announcement} announcement, {$tbl_item_property} ip\n WHERE announcement.id = ip.ref\n AND ip.tool='announcement'\n AND ip.visibility='1'\n {$announcement_id}\n {$cond_user_id}\n {$condition_session}\n GROUP BY ip.ref\n ORDER BY display_order DESC\n LIMIT 0,{$maximum}";
} else {
// the user is not member of any group
// this is an identified user => show the general announcements AND his personal announcements
if ($user_id) {
if (api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous()) {
$cond_user_id = " AND (ip.lastedit_user_id = '" . api_get_user_id() . "' OR ( ip.to_user_id='" . $user_id . "' OR ip.to_group_id='0')) ";
} else {
$cond_user_id = " AND ( ip.to_user_id='" . $user_id . "' OR ip.to_group_id='0') ";
}
$sql = "SELECT\n announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id\n FROM {$tbl_announcement} announcement, {$tbl_item_property} ip\n WHERE announcement.id = ip.ref\n AND ip.tool='announcement'\n AND ip.visibility='1'\n {$announcement_id}\n {$cond_user_id}\n {$condition_session}\n GROUP BY ip.ref\n ORDER BY display_order DESC\n LIMIT 0,{$maximum}";
} else {
if (api_get_course_setting('allow_user_edit_announcement')) {
$cond_user_id = " AND (ip.lastedit_user_id = '" . api_get_user_id() . "' OR ip.to_group_id='0') ";
} else {
$cond_user_id = " AND ip.to_group_id='0' ";
}
// the user is not identiefied => show only the general announcements
$sql = "SELECT\n announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id\n FROM {$tbl_announcement} announcement, {$tbl_item_property} ip\n WHERE announcement.id = ip.ref\n AND ip.tool='announcement'\n AND ip.visibility='1'\n AND ip.to_group_id='0'\n {$announcement_id}\n {$condition_session}\n GROUP BY ip.ref\n ORDER BY display_order DESC\n LIMIT 0,{$maximum}";
}
}
$result = Database::query($sql);
return $result;
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:44,代码来源:cm_webservice_announcements.php
示例19: WSCourseList
/**
* Get a list of courses (code, url, title, teacher, language) and return to caller
* Function registered as service. Returns strings in UTF-8.
* @param string User name in Chamilo
* @param string Signature (composed of the sha1(username+apikey)
* @param mixed Array or string. Type of visibility of course (public, public-registered, private, closed)
* @return array Courses list (code=>[title=>'title',url='http://...',teacher=>'...',language=>''],code=>[...],...)
*/
function WSCourseList($username, $signature, $visibilities = 'public')
{
if (empty($username) or empty($signature)) {
return -1;
}
global $_configuration;
$info = api_get_user_info_from_username($username);
$user_id = $info['user_id'];
if (!UserManager::is_admin($user_id)) {
return -1;
}
$list = UserManager::get_api_keys($user_id, 'dokeos');
$key = '';
foreach ($list as $key) {
break;
}
$local_key = $username . $key;
if (!api_is_valid_secret_key($signature, $local_key) && !api_is_valid_secret_key($signature, $username . $_configuration['security_key'])) {
return -1;
// The secret key is incorrect.
}
//public-registered = open
$vis = array('public' => '3', 'public-registered' => '2', 'private' => '1', 'closed' => '0');
$courses_list = array();
if (!is_array($visibilities)) {
$visibilities = split(',', $visibilities);
}
foreach ($visibilities as $visibility) {
if (!in_array($visibility, array_keys($vis))) {
return array('error_msg' => 'Security check failed');
}
$courses_list_tmp = CourseManager::get_courses_list(null, null, null, null, $vis[$visibility]);
foreach ($courses_list_tmp as $index => $course) {
$course_info = CourseManager::get_course_information($course['code']);
$courses_list[] = array('code' => $course['code'], 'title' => api_utf8_encode($course_info['title']), 'url' => api_get_path(WEB_COURSE_PATH) . $course_info['directory'] . '/', 'teacher' => api_utf8_encode($course_info['tutor_name']), 'language' => $course_info['course_language']);
}
}
return $courses_list;
}
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:47,代码来源:courses_list.soap.php
示例20: parse_content
/**
* @param $content
* @param $course_code
* @return mixed
*/
public static function parse_content($content, $course_code)
{
$reader_info = api_get_user_info(api_get_user_id());
$course_info = api_get_course_info($course_code);
$teacher_list = CourseManager::get_teacher_list_from_course_code($course_info['real_id']);
$teacher_name = '';
if (!empty($teacher_list)) {
foreach ($teacher_list as $teacher_data) {
$teacher_name = api_get_person_name($teacher_data['firstname'], $teacher_data['lastname']);
$teacher_email = $teacher_data['email'];
break;
}
}
$course_link = api_get_course_url();
$data['username'] = $reader_info['username'];
$data['teacher_name'] = $teacher_name;
$data['teacher_email'] = $teacher_email;
$data['course_title'] = $course_info['name'];
$data['course_link'] = Display::url($course_link, $course_link);
$content = str_replace(self::get_tags(), $data, $content);
return $content;
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:27,代码来源:announcements.inc.php
注:本文中的CourseManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论