本文整理汇总了PHP中CourseManager::getTeacherListFromCourseToString方法的典型用法代码示例。如果您正苦于以下问题:PHP CourseManager::getTeacherListFromCourseToString方法的具体用法?PHP CourseManager::getTeacherListFromCourseToString怎么用?PHP CourseManager::getTeacherListFromCourseToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CourseManager
的用法示例。
在下文中一共展示了CourseManager::getTeacherListFromCourseToString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: return_title
/**
* Display the title of a course in course catalog
* @param $course
*/
function return_title($course)
{
$html = '';
$linkCourse = api_get_course_url($course['code']);
$title = cut($course['title'], 70);
$ajax_url = api_get_path(WEB_AJAX_PATH) . 'course.ajax.php?a=add_course_vote';
$teachers = CourseManager::getTeacherListFromCourseToString($course['real_id']);
$rating = Display::return_rating_system('star_' . $course['real_id'], $ajax_url . '&course_id=' . $course['real_id'], $course['point_info']);
$html .= '<h4 class="title"><a href="' . $linkCourse . '">' . cut($title, 60) . '</a></h4>';
$html .= '<div class="teachers">' . $teachers . '</div>';
$html .= '<div class="ranking">' . $rating . '</div>';
return $html;
}
示例2: getCourseParamsForDisplay
/**
* Return tab of params to display a course title in the My Courses tab
* Check visibility, right, and notification icons, and load_dirs option
* @param $courseId
* @param bool $loadDirs
* @return array
*/
public static function getCourseParamsForDisplay($courseId, $loadDirs = false)
{
$user_id = api_get_user_id();
// Table definitions
$TABLECOURS = Database::get_main_table(TABLE_MAIN_COURSE);
$TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$TABLE_ACCESS_URL_REL_COURSE = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$current_url_id = api_get_current_access_url_id();
// Get course list auto-register
$special_course_list = self::get_special_course_list();
$without_special_courses = '';
if (!empty($special_course_list)) {
$without_special_courses = ' AND course.code NOT IN ("' . implode('","', $special_course_list) . '")';
}
//AND course_rel_user.relation_type<>".COURSE_RELATION_TYPE_RRHH."
$sql = "SELECT course.id, course.title, course.code, course.subscribe subscr, course.unsubscribe unsubscr, course_rel_user.status status,\n course_rel_user.sort sort, course_rel_user.user_course_cat user_course_cat\n FROM\n {$TABLECOURS} course,\n {$TABLECOURSUSER} course_rel_user, " . $TABLE_ACCESS_URL_REL_COURSE . " url\n WHERE\n course.id=" . intval($courseId) . " AND\n course.id = course_rel_user.c_id AND\n url.c_id = course.id AND\n course_rel_user.user_id = " . intval($user_id) . "\n {$without_special_courses}\n ";
// If multiple URL access mode is enabled, only fetch courses
// corresponding to the current URL.
if (api_get_multiple_access_url() && $current_url_id != -1) {
$sql .= " AND url.course_code=course.code AND access_url_id=" . intval($current_url_id);
}
// Use user's classification for courses (if any).
$sql .= " ORDER BY course_rel_user.user_course_cat, course_rel_user.sort ASC";
$result = Database::query($sql);
// Browse through all courses. We can only have one course because
// of the course.id=".intval($courseId) in sql query
$course = Database::fetch_array($result);
$course_info = api_get_course_info_by_id($courseId);
if (empty($course_info)) {
return '';
}
//$course['id_session'] = null;
$course_info['id_session'] = null;
$course_info['status'] = $course['status'];
// For each course, get if there is any notification icon to show
// (something that would have changed since the user's last visit).
$show_notification = Display::show_notification($course_info);
// New code displaying the user's status in respect to this course.
$status_icon = Display::return_icon('blackboard.png', $course_info['title'], array(), ICON_SIZE_LARGE);
$params = array();
$params['right_actions'] = '';
if (api_is_platform_admin()) {
if ($loadDirs) {
$params['right_actions'] .= '<a id="document_preview_' . $course_info['real_id'] . '_0" 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'] .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code'] . '">' . Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
$params['right_actions'] .= Display::div('', array('id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container'));
} else {
$params['right_actions'] .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code'] . '">' . Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
}
if ($course_info['status'] == COURSEMANAGER) {
//echo Display::return_icon('teachers.gif', get_lang('Status').': '.get_lang('Teacher'), array('style'=>'width: 11px; height: 11px;'));
}
} else {
if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED) {
if ($loadDirs) {
$params['right_actions'] .= '<a id="document_preview_' . $course_info['real_id'] . '_0" 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'] . '_0', 'class' => 'document_preview_container'));
} else {
if ($course_info['status'] == COURSEMANAGER) {
$params['right_actions'] .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code'] . '">' . Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
}
}
}
}
$course_title_url = '';
if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED || $course['status'] == COURSEMANAGER) {
$course_title_url = api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/?id_session=0';
$course_title = Display::url($course_info['title'], $course_title_url);
} else {
$course_title = $course_info['title'] . " " . Display::tag('span', get_lang('CourseClosed'), array('class' => 'item_closed'));
}
// Start displaying the course block itself
if (api_get_setting('course.display_coursecode_in_courselist') == 'true') {
$course_title .= ' (' . $course_info['visual_code'] . ') ';
}
$teachers = '';
if (api_get_setting('course.display_teacher_in_courselist') == 'true') {
$teachers = CourseManager::getTeacherListFromCourseToString($course['real_id'], self::USER_SEPARATOR, true);
}
$params['link'] = $course_title_url;
$params['icon'] = $status_icon;
$params['title'] = $course_title;
$params['teachers'] = $teachers;
if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED) {
$params['notifications'] = $show_notification;
}
return $params;
}
示例3: FormValidator
// Create a search-box.
$form_search = new FormValidator('search_simple', 'GET', api_get_path(WEB_CODE_PATH) . 'tracking/courseLog.php?' . api_get_cidreq(), '', array(), FormValidator::LAYOUT_INLINE);
$form_search->addElement('hidden', 'from', Security::remove_XSS($from));
$form_search->addElement('hidden', 'session_id', $sessionId);
$form_search->addElement('hidden', 'id_session', $sessionId);
$form_search->addElement('text', 'user_keyword');
$form_search->addButtonSearch(get_lang('SearchUsers'));
echo Display::toolbarAction('toolbar-courselog', array(0 => $actionsLeft, 1 => $form_search->returnForm(), 2 => $actionsRight), 3);
$course_name = get_lang('Course') . ' ' . $courseInfo['name'];
if ($session_id) {
$titleSession = Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL) . ' ' . api_get_session_name($session_id);
$titleCourse = Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL) . ' ' . $course_name;
} else {
$titleSession = Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL) . ' ' . $courseInfo['name'];
}
$teacherList = CourseManager::getTeacherListFromCourseToString($courseInfo['real_id'], ',', false, true);
$coaches = null;
if (!empty($session_id)) {
$coaches = CourseManager::get_coachs_from_course_to_string($session_id, $courseInfo['real_id'], ',', false, true);
}
$html = '';
if (!empty($teacherList)) {
$html .= Display::page_subheader2(get_lang('Teachers'));
$html .= $teacherList;
}
if (!empty($coaches)) {
$html .= Display::page_subheader2(get_lang('Coaches'));
$html .= $coaches;
}
$sessionList = SessionManager::get_session_by_course($courseInfo['real_id']);
if (!empty($sessionList)) {
示例4: return_courses_in_categories
//.........这里部分代码省略.........
if ($thereIsSubCat) {
$result .= $htmlListCat;
}
while ($categoryName = Database::fetch_array($resCats)) {
$result .= '<h3>' . $categoryName['name'] . "</h3>\n";
}
$numrows = Database::num_rows($sql_result_courses);
$courses_list_string = '';
$courses_shown = 0;
if ($numrows > 0) {
$courses_list_string .= Display::page_header(get_lang('CourseList'));
$courses_list_string .= "<ul>";
if (api_get_user_id()) {
$courses_of_user = self::get_courses_of_user(api_get_user_id());
}
foreach ($course_list as $course) {
// $setting_show_also_closed_courses
if ($course['visibility'] == COURSE_VISIBILITY_HIDDEN) {
continue;
}
if (!$setting_show_also_closed_courses) {
// If we do not show the closed courses
// we only show the courses that are open to the world (to everybody)
// and the courses that are open to the platform (if the current user is a registered user.
if ($user_identified && $course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM || $course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD) {
$courses_shown++;
$courses_list_string .= "<li>";
$courses_list_string .= '<a href="' . $web_course_path . $course['directory'] . '/">' . $course['title'] . '</a><br />';
$course_details = array();
if (api_get_setting('course.display_coursecode_in_courselist') == 'true') {
$course_details[] = $course['visual_code'];
}
if (api_get_setting('course.display_teacher_in_courselist') == 'true') {
$course_details[] = CourseManager::getTeacherListFromCourseToString($course['real_id']);
}
if (api_get_setting('show_different_course_language') == 'true' && $course['course_language'] != api_get_setting('language.platform_language')) {
$course_details[] = $course['course_language'];
}
$courses_list_string .= implode(' - ', $course_details);
$courses_list_string .= "</li>";
}
} else {
// We DO show the closed courses.
// The course is accessible if (link to the course homepage):
// 1. the course is open to the world (doesn't matter if the user is logged in or not): $course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD);
// 2. the user is logged in and the course is open to the world or open to the platform: ($user_identified && $course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM);
// 3. the user is logged in and the user is subscribed to the course and the course visibility is not COURSE_VISIBILITY_CLOSED;
// 4. the user is logged in and the user is course admin of te course (regardless of the course visibility setting);
// 5. the user is the platform admin api_is_platform_admin().
$courses_shown++;
$courses_list_string .= "<li>";
if ($course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD || $user_identified && $course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM || $user_identified && array_key_exists($course['code'], $courses_of_user) && $course['visibility'] != COURSE_VISIBILITY_CLOSED || $courses_of_user[$course['code']]['status'] == '1' || api_is_platform_admin()) {
$courses_list_string .= '<a href="' . $web_course_path . $course['directory'] . '/">';
}
$courses_list_string .= $course['title'];
if ($course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD || $user_identified && $course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM || $user_identified && array_key_exists($course['code'], $courses_of_user) && $course['visibility'] != COURSE_VISIBILITY_CLOSED || $courses_of_user[$course['code']]['status'] == '1' || api_is_platform_admin()) {
$courses_list_string .= '</a><br />';
}
$course_details = array();
if (api_get_setting('course.display_coursecode_in_courselist') == 'true') {
$course_details[] = $course['visual_code'];
}
// if (api_get_setting('course.display_coursecode_in_courselist') == 'true' && api_get_setting('course.display_teacher_in_courselist') == 'true') {
// $courses_list_string .= ' - ';
// }
if (api_get_setting('course.display_teacher_in_courselist') == 'true') {
示例5: html_to_pdf_with_template
/**
* Export the given HTML to PDF, using a global template
*
* @uses export/table_pdf.tpl
* @param $content
* @param bool|false $saveToFile
* @param bool|false $returnHtml
*
* @return string
*/
public function html_to_pdf_with_template($content, $saveToFile = false, $returnHtml = false)
{
if (empty($this->template)) {
$tpl = new Template('', false, false, false);
} else {
$tpl = $this->template;
}
// Assignments
// Assignments
$tpl->assign('pdf_content', $content);
$organization = api_get_setting('platform.institution');
$img = api_get_path(SYS_CSS_PATH) . 'themes/' . api_get_visual_theme() . '/images/header-logo.png';
// Search for classic logo
if (file_exists($img)) {
$img = api_get_path(WEB_CSS_PATH) . 'themes/' . api_get_visual_theme() . '/images/header-logo.png';
$organization = "<img src='{$img}'>";
} else {
// Just use the platform title.
if (!empty($organization)) {
$organization = '<h2 align="left">' . $organization . '</h2>';
}
}
// Use custom logo image.
$pdfLogo = api_get_setting('pdf_logo_header');
if ($pdfLogo === 'true') {
$visualTheme = api_get_visual_theme();
$img = api_get_path(SYS_CSS_PATH) . 'themes/' . $visualTheme . '/images/pdf_logo_header.png';
if (file_exists($img)) {
$img = api_get_path(WEB_CSS_PATH) . 'themes/' . $visualTheme . '/images/pdf_logo_header.png';
$organization = "<img src='{$img}'>";
}
}
$tpl->assign('organization', $organization);
//Showing only the current teacher/admin instead the all teacher list name see BT#4080
if (isset($this->params['show_real_course_teachers']) && $this->params['show_real_course_teachers']) {
if (isset($this->params['session_info']) && !empty($this->params['session_info'])) {
$teacher_list = SessionManager::getCoachesByCourseSessionToString($this->params['session_info']['id'], $this->params['course_info']['real_id']);
} else {
$teacher_list = CourseManager::getTeacherListFromCourseToString($this->params['course_code']);
}
} else {
$user_info = api_get_user_info();
if ($this->params['show_teacher_as_myself']) {
$teacher_list = $user_info['complete_name'];
}
}
$tpl->assign('pdf_course', $this->params['course_code']);
$tpl->assign('pdf_course_info', $this->params['course_info']);
$tpl->assign('pdf_session_info', $this->params['session_info']);
$tpl->assign('pdf_date', $this->params['pdf_date']);
$tpl->assign('pdf_teachers', $teacher_list);
$tpl->assign('pdf_title', $this->params['pdf_title']);
$tpl->assign('pdf_student_info', $this->params['student_info']);
$tpl->assign('show_grade_generated_date', $this->params['show_grade_generated_date']);
$tpl->assign('add_signatures', $this->params['add_signatures']);
// Getting template
$tableTemplate = $tpl->get_template('export/table_pdf.tpl');
$html = $tpl->fetch($tableTemplate);
$html = api_utf8_encode($html);
$css_file = api_get_path(SYS_CSS_PATH) . '/print.css';
$css = file_exists($css_file) ? @file_get_contents($css_file) : '';
$html = self::content_to_pdf($html, $css, $this->params['filename'], $this->params['course_code'], 'D', $saveToFile, null, $returnHtml);
if ($returnHtml) {
return $html;
}
}
示例6: exportAllStudentWorkFromPublication
/**
* @param int $workId
* @param array $courseInfo
* @param int $sessionId
* @param string $format
* @return bool
*/
function exportAllStudentWorkFromPublication($workId, $courseInfo, $sessionId, $format = 'pdf')
{
if (empty($courseInfo)) {
return false;
}
$workData = get_work_data_by_id($workId);
if (empty($workData)) {
return false;
}
$assignment = get_work_assignment_by_id($workId);
$courseCode = $courseInfo['code'];
$header = get_lang('Course') . ': ' . $courseInfo['title'];
$teachers = CourseManager::getTeacherListFromCourseToString($courseInfo['real_id']);
if (!empty($sessionId)) {
$sessionInfo = api_get_session_info($sessionId);
if (!empty($sessionInfo)) {
$header .= ' - ' . $sessionInfo['name'];
$header .= '<br />' . $sessionInfo['description'];
$teachers = SessionManager::getCoachesByCourseSessionToString($sessionId, $courseInfo['real_id']);
}
}
$header .= '<br />' . get_lang('Teachers') . ': ' . $teachers . '<br />';
$header .= '<br />' . get_lang('Date') . ': ' . api_get_local_time() . '<br />';
$header .= '<br />' . get_lang('WorkName') . ': ' . $workData['title'] . '<br />';
$content = null;
$expiresOn = null;
if (!empty($assignment) && isset($assignment['expires_on'])) {
$content .= '<br /><strong>' . get_lang('ExpirationDate') . '</strong>: ' . api_get_local_time($assignment['expires_on']);
$expiresOn = api_get_local_time($assignment['expires_on']);
}
if (!empty($workData['description'])) {
$content .= '<br /><strong>' . get_lang('Description') . '</strong>: ' . $workData['description'];
}
$workList = get_work_user_list(null, null, null, null, $workId);
switch ($format) {
case 'pdf':
if (!empty($workList)) {
$table = new HTML_Table(array('class' => 'data_table'));
$headers = array(get_lang('Name'), get_lang('User'), get_lang('HandOutDateLimit'), get_lang('SentDate'), get_lang('FileName'), get_lang('Score'), get_lang('Feedback'));
$column = 0;
foreach ($headers as $header) {
$table->setHeaderContents(0, $column, $header);
$column++;
}
$row = 1;
//$pdf->set_custom_header($header);
foreach ($workList as $work) {
$content .= '<hr />';
// getWorkComments need c_id
$work['c_id'] = $courseInfo['real_id'];
//$content .= get_lang('Date').': '.api_get_local_time($work['sent_date_from_db']).'<br />';
$score = null;
if (!empty($work['qualification_only'])) {
$score = $work['qualification_only'];
}
//$content .= get_lang('Description').': '.$work['description'].'<br />';
$comments = getWorkComments($work);
$feedback = null;
if (!empty($comments)) {
$content .= '<h4>' . get_lang('Feedback') . ': </h4>';
foreach ($comments as $comment) {
$feedback .= get_lang('User') . ': ' . api_get_person_name($comment['firstname'], $comment['lastname']) . '<br />';
$feedback .= $comment['comment'] . '<br />';
}
}
$table->setCellContents($row, 0, strip_tags($workData['title']));
$table->setCellContents($row, 1, api_get_person_name(strip_tags($work['firstname']), strip_tags($work['lastname'])));
$table->setCellContents($row, 2, $expiresOn);
$table->setCellContents($row, 3, api_get_local_time($work['sent_date_from_db']));
$table->setCellContents($row, 4, strip_tags($work['title']));
$table->setCellContents($row, 5, $score);
$table->setCellContents($row, 6, $feedback);
$row++;
}
$content = $table->toHtml();
if (!empty($content)) {
$params = array('filename' => $workData['title'] . '_' . api_get_local_time(), 'pdf_title' => api_replace_dangerous_char($workData['title']), 'course_code' => $courseInfo['code'], 'add_signatures' => false);
$pdf = new PDF('A4', null, $params);
$pdf->html_to_pdf_with_template($content);
}
exit;
}
break;
}
}