本文整理汇总了PHP中api_get_session_name函数的典型用法代码示例。如果您正苦于以下问题:PHP api_get_session_name函数的具体用法?PHP api_get_session_name怎么用?PHP api_get_session_name使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了api_get_session_name函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* constructor
* @path the path to a folder
* @calculateSubdir force to get the subdirectories information
*/
function __construct($path = null, $calculateSubdir = true)
{
$this->calculateSubdir = $calculateSubdir;
if (defined('CONFIG_SYS_FOLDER_SHOWN_ON_TOP')) {
$this->forceFolderOnTop = CONFIG_SYS_FOLDER_SHOWN_ON_TOP;
}
if (!is_null($path)) {
$this->currentFolderPath = $path;
} elseif (isset($_GET[$this->folderPathIndex]) && file_exists(base64_decode($_GET[$this->folderPathIndex])) && !is_file(base64_decode($_GET[$this->folderPathIndex]))) {
$this->currentFolderPath = api_htmlentities(Security::remove_XSS($_GET[$this->folderPathIndex]));
} elseif (isset($_SESSION[$this->lastVisitedFolderPathIndex]) && file_exists($_SESSION[$this->lastVisitedFolderPathIndex]) && !is_file($_SESSION[$this->lastVisitedFolderPathIndex])) {
$this->currentFolderPath = $_SESSION[$this->lastVisitedFolderPathIndex];
} else {
$this->currentFolderPath = CONFIG_SYS_DEFAULT_PATH;
}
$this->currentFolderPath = isUnderRoot($this->getCurrentFolderPath()) ? backslashToSlash(addTrailingSlash($this->getCurrentFolderPath())) : $this->currentFolderPath;
$this->currentFolderPath = base64_encode($this->currentFolderPath);
if ($this->calculateSubdir) {
// keep track of this folder path in session
$_SESSION[$this->lastVisitedFolderPathIndex] = $this->currentFolderPath;
}
if (is_dir($this->getCurrentFolderPath())) {
$file = new file($this->getCurrentFolderPath());
$folderInfo = $file->getFileInfo();
if (sizeof($folderInfo)) {
//for Chamilo in a name folder, replace num user by user names
if (preg_match('/sf_user_/', basename($this->getCurrentFolderPath()))) {
$userinfo = api_get_user_info(substr(basename($this->getCurrentFolderPath()), 8));
$this->currentFolderInfo['name'] = $userinfo['complete_name'];
} else {
$this->currentFolderInfo['name'] = str_replace('_', ' ', basename($this->getCurrentFolderPath()));
//for Chamilo. Prevent long directory name
}
if (preg_match('/shared_folder/', basename($this->getCurrentFolderPath()))) {
$this->currentFolderInfo['name'] = get_lang('UserFolders');
}
if (preg_match('/shared_folder_session_/', basename($this->getCurrentFolderPath()))) {
$session = explode('_', basename($this->getCurrentFolderPath()));
$session = strtolower($session[sizeof($session) - 1]);
$this->currentFolderInfo['name'] = get_lang('UserFolders') . ' (' . api_get_session_name($session) . ')*';
}
//end Chamilo
$this->currentFolderInfo['subdir'] = 0;
$this->currentFolderInfo['file'] = 0;
$this->currentFolderInfo['ctime'] = $folderInfo['ctime'];
$this->currentFolderInfo['mtime'] = $folderInfo['mtime'];
$this->currentFolderInfo['is_readable'] = $folderInfo['is_readable'];
$this->currentFolderInfo['is_writable'] = $folderInfo['is_writable'];
$this->currentFolderInfo['path'] = $this->getCurrentFolderPath();
$this->currentFolderInfo['path_base64'] = base64_encode($this->getCurrentFolderPath());
$this->currentFolderInfo['friendly_path'] = transformFilePath($this->getCurrentFolderPath());
$this->currentFolderInfo['type'] = 'folder';
$this->currentFolderInfo['cssClass'] = 'folder';
//$this->currentFolderInfo['flag'] = $folderInfo['flag'];
}
}
if ($calculateSubdir && !file_exists($this->getCurrentFolderPath())) {
die(ERR_FOLDER_NOT_FOUND . $this->getCurrentFolderPath());
}
}
示例2: html_to_pdf_with_template
/**
* Export the given HTML to PDF, using a global template
* @param string the HTML content
* @uses export/table_pdf.tpl
*/
function html_to_pdf_with_template($content)
{
Display::display_no_header();
//Assignments
Display::$global_template->assign('pdf_content', $content);
$organization = api_get_setting('Institution');
$img = api_get_path(SYS_CODE_PATH) . 'css/' . api_get_visual_theme() . '/images/header-logo.png';
if (file_exists($img)) {
$img = api_get_path(WEB_CODE_PATH) . 'css/' . api_get_visual_theme() . '/images/header-logo.png';
$organization = "<img src='{$img}'>";
} else {
if (!empty($organization)) {
$organization = '<h2 align="left">' . $organization . '</h2>';
}
}
Display::$global_template->assign('organization', $organization);
//Showing only the current teacher/admin instead the all teacherlist name see BT#4080
$user_info = api_get_user_info();
$teacher_list = $user_info['complete_name'];
$session_name = api_get_session_name(api_get_session_id());
if (!empty($session_name)) {
Display::$global_template->assign('pdf_session', $session_name);
}
Display::$global_template->assign('pdf_course', $this->params['course_code']);
Display::$global_template->assign('pdf_date', api_format_date(api_get_utc_datetime(), DATE_TIME_FORMAT_LONG));
Display::$global_template->assign('pdf_teachers', $teacher_list);
Display::$global_template->assign('pdf_title', $this->params['pdf_title']);
Display::$global_template->assign('add_signatures', $this->params['add_signatures']);
//Getting template
$tpl = Display::$global_template->get_template('export/table_pdf.tpl');
$html = Display::$global_template->fetch($tpl);
$html = api_utf8_encode($html);
$css_file = api_get_path(TO_SYS, WEB_CSS_PATH) . '/print.css';
$css = file_exists($css_file) ? @file_get_contents($css_file) : '';
self::content_to_pdf($html, $css, $this->params['filename'], $this->params['course_code']);
}
示例3: show_add_forum_form
/**
* This function displays the form that is used to add a forum category.
*
* @param array $inputvalues
* @param int $lp_id
* @return void HTML
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @author Juan Carlos Raña Trabado (return to lp_id)
*
* @version may 2011, Chamilo 1.8.8
*/
function show_add_forum_form($inputvalues = array(), $lp_id)
{
$_course = api_get_course_info();
$form = new FormValidator('forumcategory', 'post', 'index.php?' . api_get_cidreq());
// The header for the form
if (!empty($inputvalues)) {
$form_title = get_lang('EditForum');
} else {
$form_title = get_lang('AddForum');
}
$session_header = api_get_session_name();
$form->addElement('header', $form_title . $session_header);
// We have a hidden field if we are editing.
if (!empty($inputvalues) && is_array($inputvalues)) {
$my_forum_id = isset($inputvalues['forum_id']) ? $inputvalues['forum_id'] : null;
$form->addElement('hidden', 'forum_id', $my_forum_id);
}
$lp_id = intval($lp_id);
// hidden field if from learning path
$form->addElement('hidden', 'lp_id', $lp_id);
// The title of the forum
$form->addElement('text', 'forum_title', get_lang('Title'), array('autofocus'));
// The comment of the forum.
$form->addHtmlEditor('forum_comment', get_lang('Description'), null, null, array('ToolbarSet' => 'Forum', 'Width' => '98%', 'Height' => '200'));
// Dropdown list: Forum categories
$forum_categories = get_forum_categories();
foreach ($forum_categories as $key => $value) {
$forum_categories_titles[$value['cat_id']] = $value['cat_title'];
}
$form->addElement('select', 'forum_category', get_lang('InForumCategory'), $forum_categories_titles);
$form->applyFilter('forum_category', 'html_filter');
if ($_course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD) {
// This is for horizontal
$group = array();
$group[] = $form->createElement('radio', 'allow_anonymous', null, get_lang('Yes'), 1);
$group[] = $form->createElement('radio', 'allow_anonymous', null, get_lang('No'), 0);
$form->addGroup($group, 'allow_anonymous_group', get_lang('AllowAnonymousPosts'), ' ');
}
$form->addButtonAdvancedSettings('advanced_params');
$form->addElement('html', '<div id="advanced_params_options" style="display:none">');
$group = array();
$group[] = $form->createElement('radio', 'moderated', null, get_lang('Yes'), 1);
$group[] = $form->createElement('radio', 'moderated', null, get_lang('No'), 0);
$form->addGroup($group, 'moderated', get_lang('ModeratedForum'), ' ');
$group = array();
$group[] = $form->createElement('radio', 'students_can_edit', null, get_lang('Yes'), 1);
$group[] = $form->createElement('radio', 'students_can_edit', null, get_lang('No'), 0);
$form->addGroup($group, 'students_can_edit_group', get_lang('StudentsCanEdit'), ' ');
$group = array();
$group[] = $form->createElement('radio', 'approval_direct', null, get_lang('Approval'), 1);
$group[] = $form->createElement('radio', 'approval_direct', null, get_lang('Direct'), 0);
$group = array();
$group[] = $form->createElement('radio', 'allow_attachments', null, get_lang('Yes'), 1);
$group[] = $form->createElement('radio', 'allow_attachments', null, get_lang('No'), 0);
$group = array();
$group[] = $form->createElement('radio', 'allow_new_threads', null, get_lang('Yes'), 1);
$group[] = $form->createElement('radio', 'allow_new_threads', null, get_lang('No'), 0);
$form->addGroup($group, 'allow_new_threads_group', get_lang('AllowNewThreads'), ' ');
$group = array();
$group[] = $form->createElement('radio', 'default_view_type', null, get_lang('Flat'), 'flat');
$group[] = $form->createElement('radio', 'default_view_type', null, get_lang('Threaded'), 'threaded');
$group[] = $form->createElement('radio', 'default_view_type', null, get_lang('Nested'), 'nested');
$form->addGroup($group, 'default_view_type_group', get_lang('DefaultViewType'), ' ');
// Drop down list: Groups
$groups = GroupManager::get_group_list();
$groups_titles[0] = get_lang('NotAGroupForum');
foreach ($groups as $key => $value) {
$groups_titles[$value['id']] = $value['name'];
}
$form->addElement('select', 'group_forum', get_lang('ForGroup'), $groups_titles);
// Public or private group forum
$group = array();
$group[] = $form->createElement('radio', 'public_private_group_forum', null, get_lang('Public'), 'public');
$group[] = $form->createElement('radio', 'public_private_group_forum', null, get_lang('Private'), 'private');
$form->addGroup($group, 'public_private_group_forum_group', get_lang('PublicPrivateGroupForum'), '');
// Forum image
$form->add_progress_bar();
if (isset($inputvalues['forum_image']) && strlen($inputvalues['forum_image']) > 0) {
$image_path = api_get_path(WEB_COURSE_PATH) . api_get_course_path() . '/upload/forum/images/' . $inputvalues['forum_image'];
$image_size = api_getimagesize($image_path);
$img_attributes = '';
if (!empty($image_size)) {
if ($image_size['width'] > 100 || $image_size['height'] > 100) {
//limit display width and height to 100px
$img_attributes = 'width="100" height="100"';
}
$show_preview_image = '<img src="' . $image_path . '" ' . $img_attributes . '>';
$form->addElement('label', get_lang('PreviewImage'), $show_preview_image);
//.........这里部分代码省略.........
示例4: getToolInformation
/**
* @param $userId
* @param $courseInfo
* @param int $sessionId
* @return array
*/
public static function getToolInformation($userId, $courseInfo, $sessionId = 0)
{
$csvContent = array();
$courseToolInformation = null;
$headerTool = array(array(get_lang('Title')), array(get_lang('CreatedAt')), array(get_lang('UpdatedAt')));
$headerListForCSV = array();
foreach ($headerTool as $item) {
$headerListForCSV[] = $item[0];
}
$courseForumInformationArray = getForumCreatedByUser($userId, $courseInfo['real_id'], $sessionId);
if (!empty($courseForumInformationArray)) {
$csvContent[] = array();
$csvContent[] = get_lang('Forums');
$csvContent[] = $headerListForCSV;
foreach ($courseForumInformationArray as $row) {
$csvContent[] = $row;
}
$courseToolInformation .= Display::page_subheader2(get_lang('Forums'));
$courseToolInformation .= Display::return_sortable_table($headerTool, $courseForumInformationArray);
}
$courseWorkInformationArray = getWorkCreatedByUser($userId, $courseInfo['real_id'], $sessionId);
if (!empty($courseWorkInformationArray)) {
$csvContent[] = null;
$csvContent[] = get_lang('Works');
$csvContent[] = $headerListForCSV;
foreach ($courseWorkInformationArray as $row) {
$csvContent[] = $row;
}
$csvContent[] = null;
$courseToolInformation .= Display::page_subheader2(get_lang('Works'));
$courseToolInformation .= Display::return_sortable_table($headerTool, $courseWorkInformationArray);
}
$courseToolInformationTotal = null;
if (!empty($courseToolInformation)) {
$sessionTitle = null;
if (!empty($sessionId)) {
$sessionTitle = ' (' . api_get_session_name($sessionId) . ')';
}
$courseToolInformationTotal .= Display::page_subheader($courseInfo['title'] . $sessionTitle);
$courseToolInformationTotal .= $courseToolInformation;
}
return array('array' => $csvContent, 'html' => $courseToolInformationTotal);
}
示例5: build_document_icon_tag
/**
* Builds an img html tag for the file type
*
* @param string $type (file/folder)
* @param string $path
* @return string img html tag
*/
public static function build_document_icon_tag($type, $path)
{
$basename = basename($path);
$current_session_id = api_get_session_id();
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
$user_image = false;
if ($type == 'file') {
$icon = choose_image($basename);
if (preg_match('/_chnano_.wav$/i', $basename)) {
$icon = "jplayer_play.png";
$basename = 'wav' . ' ' . '(Nanogong)';
} else {
$basename = substr(strrchr($basename, '.'), 1);
}
} else {
if ($path == '/shared_folder') {
$icon = 'folder_users.gif';
if ($is_allowed_to_edit) {
$basename = get_lang('HelpUsersFolder');
} else {
$basename = get_lang('UserFolders');
}
} elseif (strstr($basename, 'sf_user_')) {
$userinfo = api_get_user_info(substr($basename, 8));
$icon = $userinfo['avatar_small'];
$basename = get_lang('UserFolder') . ' ' . $userinfo['complete_name'];
$user_image = true;
} elseif (strstr($path, 'shared_folder_session_')) {
if ($is_allowed_to_edit) {
$basename = '***(' . api_get_session_name($current_session_id) . ')*** ' . get_lang('HelpUsersFolder');
} else {
$basename = get_lang('UserFolders') . ' (' . api_get_session_name($current_session_id) . ')';
}
$icon = 'folder_users.gif';
} else {
$icon = 'folder_document.gif';
if ($path == '/audio') {
$icon = 'folder_audio.gif';
if (api_is_allowed_to_edit()) {
$basename = get_lang('HelpDefaultDirDocuments');
} else {
$basename = get_lang('Audio');
}
} elseif ($path == '/flash') {
$icon = 'folder_flash.gif';
if (api_is_allowed_to_edit()) {
$basename = get_lang('HelpDefaultDirDocuments');
} else {
$basename = get_lang('Flash');
}
} elseif ($path == '/images') {
$icon = 'folder_images.gif';
if (api_is_allowed_to_edit()) {
$basename = get_lang('HelpDefaultDirDocuments');
} else {
$basename = get_lang('Images');
}
} elseif ($path == '/video') {
$icon = 'folder_video.gif';
if (api_is_allowed_to_edit()) {
$basename = get_lang('HelpDefaultDirDocuments');
} else {
$basename = get_lang('Video');
}
} elseif ($path == '/images/gallery') {
$icon = 'folder_gallery.gif';
if (api_is_allowed_to_edit()) {
$basename = get_lang('HelpDefaultDirDocuments');
} else {
$basename = get_lang('Gallery');
}
} elseif ($path == '/chat_files') {
$icon = 'folder_chat.png';
if (api_is_allowed_to_edit()) {
$basename = get_lang('HelpFolderChat');
} else {
$basename = get_lang('ChatFiles');
}
} elseif ($path == '/learning_path') {
$icon = 'folder_learningpath.gif';
if (api_is_allowed_to_edit()) {
$basename = get_lang('HelpFolderLearningPaths');
} else {
$basename = get_lang('LearningPaths');
}
}
}
}
if ($user_image) {
return Display::img($icon, $basename, array(), false);
}
return Display::return_icon($icon, $basename, array());
}
示例6: array
$data = array();
//when file type is csv, add a header to the output file
if ($file_type == 'csv') {
$alldata[] = array('username', 'official_code', 'lastname', 'firstname', 'score', 'date');
}
// export results to pdf file
if ($file_type == 'pdf') {
$number_decimals = api_get_setting('gradebook_number_decimals');
$datagen = new ResultsDataGenerator($eval[0], $allresults);
// set headers pdf
!empty($_user['official_code']) ? $officialcode = $_user['official_code'] . ' - ' : '';
$h1 = array(get_lang('Teacher'), $officialcode . $_user['firstName'] . ', ' . $_user['lastName']);
$h2 = array(get_lang('Score'), $eval[0]->get_max());
$h3 = array(get_lang('Course'), $_course['name']);
$h4 = array(get_lang('Weight'), $eval[0]->get_weight());
$h5 = array(get_lang('Session'), api_get_session_name(api_get_session_id()));
$date = date('d-m-Y H:i:s', time());
$h6 = array(get_lang('DateTime'), api_convert_and_format_date($date, "%d/%m/%Y %H:%M"));
$header_pdf = array($h1, $h2, $h3, $h4, $h5, $h6);
// set footer pdf
$f1 = '<hr />' . get_lang('Drh');
$f2 = '<hr />' . get_lang('Teacher');
$f3 = '<hr />' . get_lang('Date');
$footer_pdf = array($f1, $f2, $f3);
// set title pdf
$title_pdf = $eval[0]->get_name();
// set headers data table
$head_ape_name = '';
if (api_is_western_name_order()) {
$head_ape_name = get_lang('FirstName') . ', ' . get_lang('LastName');
} else {
示例7: count
}
}
//Courses for the user
$count_courses = count($courses);
//Sessions for the user
$count_sessions = count($sessions);
}
if ($count_courses || $count_sessions) {
// If we are in course.
if (empty($session_id)) {
if ($count_courses) {
$title = '<img src="' . api_get_path(WEB_IMG_PATH) . 'course.gif"> ' . get_lang('Courses') . ' (' . $count_courses . ') ';
}
} else {
//If we are in Course Session
$session_name = api_get_session_name($session_id);
$title = Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL) . ' ' . $session_name;
$menu_items[] = '<a href="' . api_get_self() . '?view=teacher">' . get_lang('TeacherInterface') . '</a>';
}
}
if ((api_is_allowed_to_create_course() || api_is_drh()) && in_array($view, array('teacher', 'drh'))) {
//Courses
if ($count_courses) {
echo Display::page_subheader($title);
$data = MySpace::get_course_data(null, null, null, null, $courses, $csv_content, $charset);
$table = new SortableTable('courses_my_space', 'get_number_of_courses');
$parameters['view'] = 'teacher';
$parameters['class'] = 'data_table';
$table->set_additional_parameters($parameters);
$table->set_header(0, get_lang('CourseTitle'), false);
$table->set_header(1, get_lang('NbStudents'), false);
示例8: create_unexisting_directory
//$groupId = 0;
$visibility = 1;
create_unexisting_directory($courseInfo, api_get_user_id(), $sessionId, 0, $to_user_id, $base_work_dir, $usf_dir_name, $usf_dir_title, $visibility);
}
} else {
// Create shared folder session.
if (!file_exists($base_work_dir . '/shared_folder_session_' . $sessionId)) {
$usf_dir_title = get_lang('UserFolders') . ' (' . api_get_session_name($sessionId) . ')';
$usf_dir_name = '/shared_folder_session_' . $sessionId;
//$groupId = 0;
$visibility = 0;
create_unexisting_directory($courseInfo, api_get_user_id(), $sessionId, 0, $to_user_id, $base_work_dir, $usf_dir_name, $usf_dir_title, $visibility);
}
//Create dynamic user shared folder into a shared folder session
if (!file_exists($base_work_dir . '/shared_folder_session_' . $sessionId . '/sf_user_' . $userId)) {
$usf_dir_title = $userInfo['complete_name'] . '(' . api_get_session_name($sessionId) . ')';
$usf_dir_name = '/shared_folder_session_' . $sessionId . '/sf_user_' . $userId;
//$groupId = 0;
$visibility = 1;
create_unexisting_directory($courseInfo, $userId, $sessionId, 0, $to_user_id, $base_work_dir, $usf_dir_name, $usf_dir_title, $visibility);
}
}
/* MAIN SECTION */
// Slideshow inititalisation
$_SESSION['image_files_only'] = '';
$image_files_only = '';
if ($is_certificate_mode) {
$interbreadcrumb[] = array('url' => '../gradebook/index.php', 'name' => get_lang('Gradebook'));
} else {
if (isset($_GET['id']) && $_GET['id'] != 0 || isset($_GET['curdirpath']) || isset($_GET['createdir'])) {
$interbreadcrumb[] = array('url' => 'document.php', 'name' => get_lang('Documents'));
示例9: api_get_user_id
$to_group_id = 0;
$visibility = 1;
FileManager::create_unexisting_directory($course_info, api_get_user_id(), api_get_session_id(), $to_group_id, $to_user_id, $base_work_dir, $usf_dir_name, $usf_dir_title, $visibility);
}
} else {
//Create shared folder session
if (!file_exists($base_work_dir . '/shared_folder_session_' . $session_id)) {
$usf_dir_title = get_lang('UserFolders') . ' (' . api_get_session_name($session_id) . ')';
$usf_dir_name = '/shared_folder_session_' . $session_id;
$to_group_id = 0;
$visibility = 0;
FileManager::create_unexisting_directory($course_info, api_get_user_id(), api_get_session_id(), $to_group_id, $to_user_id, $base_work_dir, $usf_dir_name, $usf_dir_title, $visibility);
}
//Create dynamic user shared folder into a shared folder session
if (!file_exists($base_work_dir . '/shared_folder_session_' . $session_id . '/sf_user_' . api_get_user_id())) {
$usf_dir_title = api_get_person_name($_user['firstName'], $_user['lastName']) . '(' . api_get_session_name($session_id) . ')';
$usf_dir_name = '/shared_folder_session_' . $session_id . '/sf_user_' . api_get_user_id();
$to_group_id = 0;
$visibility = 1;
FileManager::create_unexisting_directory($course_info, api_get_user_id(), api_get_session_id(), $to_group_id, $to_user_id, $base_work_dir, $usf_dir_name, $usf_dir_title, $visibility);
}
}
/* MAIN SECTION */
// Slideshow inititalisation
$_SESSION['image_files_only'] = '';
$image_files_only = '';
if ($is_certificate_mode) {
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'gradebook/index.php', 'name' => get_lang('Gradebook'));
} else {
if (isset($_GET['id']) && $_GET['id'] != 0 || isset($_GET['curdirpath']) || isset($_GET['createdir'])) {
$interbreadcrumb[] = array('url' => 'document.php', 'name' => get_lang('Documents'));
示例10: generateTable
/**
* @param int $userId
* @param int $categoryId
* @param bool $saveToFile
* @param bool $saveToHtmlFile
*
* @return string
*/
public static function generateTable($userId, $categoryId, $saveToFile = false, $saveToHtmlFile = false)
{
$courseInfo = api_get_course_info();
$userInfo = api_get_user_info($userId);
$cats = Category::load($categoryId, null, null, null, null, null, false);
$cat = $cats[0];
$allcat = $cats[0]->get_subcategories($userId, api_get_course_id(), api_get_session_id());
$alleval = $cats[0]->get_evaluations($userId);
$alllink = $cats[0]->get_links($userId);
$gradebooktable = new GradebookTable($cat, $allcat, $alleval, $alllink, null, true, false, $userId);
if (api_is_allowed_to_edit()) {
$gradebooktable->td_attributes = [4 => 'class=centered'];
} else {
$gradebooktable->td_attributes = [3 => 'class=centered', 4 => 'class=centered', 5 => 'class=centered', 6 => 'class=centered', 7 => 'class=centered'];
}
$table = $gradebooktable->return_table();
$graph = $gradebooktable->getGraph();
$sessionName = api_get_session_name(api_get_session_id());
$sessionName = !empty($sessionName) ? " - {$sessionName}" : '';
$params = array('pdf_title' => $courseInfo['title'] . $sessionName, 'course_code' => api_get_course_id(), 'session_info' => api_get_session_info(api_get_session_id()), 'add_signatures' => false, 'student_info' => $userInfo, 'show_grade_generated_date' => true, 'show_real_course_teachers' => true);
$file = api_get_path(SYS_ARCHIVE_PATH) . uniqid() . '.html';
$content = $table . $graph . '<br />' . get_lang('Feedback') . '<br />
<textarea rows="5" cols="100" ></textarea>';
$pdf = new PDF('A4', $params['orientation'], $params);
$result = $pdf->html_to_pdf_with_template($content, $saveToFile, $saveToHtmlFile);
if ($saveToHtmlFile) {
file_put_contents($file, $result);
return $file;
}
return $file;
}
示例11: displayForm
/**
* Show the form to copy courses
* @global string $returnLink
* @global string $courseCode
*/
function displayForm()
{
global $returnLink, $courseCode;
$courseInfo = api_get_course_info();
$sessionId = api_get_session_id();
$userId = api_get_user_id();
$sessions = SessionManager::getSessionsCoachedByUser($userId);
$html = '';
// Actions
$html .= '<div class="actions">';
// Link back to the documents overview
$html .= '<a href="' . $returnLink . '">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('Maintenance'), '', ICON_SIZE_MEDIUM) . '</a>';
$html .= '</div>';
$html .= Display::return_message(get_lang('CopyCourseFromSessionToSessionExplanation'));
$html .= '<form name="formulaire" method="post" action="' . api_get_self() . '?' . api_get_cidreq() . '" >';
$html .= '<table border="0" cellpadding="5" cellspacing="0" width="100%">';
// Source
$html .= '<tr><td width="15%"><b>' . get_lang('OriginCoursesFromSession') . ':</b></td>';
$html .= '<td width="10%" align="left">' . api_get_session_name($sessionId) . '</td>';
$html .= '<td width="50%">';
$html .= "{$courseInfo['title']} ({$courseInfo['code']})" . '</td></tr>';
// Destination
$html .= '<tr><td width="15%"><b>' . get_lang('DestinationCoursesFromSession') . ':</b></td>';
$html .= '<td width="10%" align="left"><div id="ajax_sessions_list_destination">';
$html .= '<select name="sessions_list_destination" onchange="javascript: xajax_searchCourses(this.value,\'destination\');">';
if (empty($sessions)) {
$html .= '<option value = "0">' . get_lang('ThereIsNotStillASession') . '</option>';
} else {
$html .= '<option value = "0">' . get_lang('SelectASession') . '</option>';
foreach ($sessions as $session) {
if ($session['id'] == $sessionId) {
continue;
}
if (!SessionManager::sessionHasCourse($session['id'], $courseCode)) {
continue;
}
$html .= '<option value="' . $session['id'] . '">' . $session['name'] . '</option>';
}
}
$html .= '</select ></div></td>';
$html .= '<td width="50%">';
$html .= '<div id="ajax_list_courses_destination">';
$html .= '<select id="destination" name="SessionCoursesListDestination[]" style="width:380px;" ></select></div></td>';
$html .= '</tr></table>';
$html .= "<fieldset>";
$html .= '<legend>' . get_lang('TypeOfCopy') . ' <small>(' . get_lang('CopyOnlySessionItems') . ')</small></legend>';
$html .= '<label class="radio"><input type="radio" id="copy_option_1" name="copy_option" value="full_copy" checked="checked"/>';
$html .= get_lang('FullCopy') . '</label>';
$html .= '<label class="radio"><input type="radio" id="copy_option_2" name="copy_option" value="select_items"/>';
$html .= ' ' . get_lang('LetMeSelectItems') . '</label><br/>';
$html .= "</fieldset>";
$html .= '<button class="save" type="submit" onclick="javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)) . "'" . ')) return false;">' . get_lang('CopyCourse') . '</button>';
$html .= '</form>';
echo $html;
}
示例12: create_default_course_gradebook
function create_default_course_gradebook($course_code = null, $gradebook_model_id = 0, $session_id = null)
{
$category_id = null;
//if (api_is_allowed_to_edit(true, true)) {
if (!isset($course_code) || empty($course_code)) {
$course_code = api_get_course_id();
}
if (empty($session_id)) {
$session_id = api_get_session_id();
}
$t = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
$sql = "SELECT * FROM {$t} WHERE course_code = '" . Database::escape_string($course_code) . "' ";
if (!empty($session_id)) {
$sql .= " AND session_id = " . (int) $session_id;
} else {
$sql .= " AND (session_id IS NULL OR session_id = 0) ";
}
$sql .= " ORDER BY id";
$res = Database::query($sql);
if (Database::num_rows($res) < 1) {
//there is no unique category for this course+session combination,
$cat = new Category();
if (!empty($session_id)) {
$s_name = api_get_session_name($session_id);
$cat->set_name($course_code . ' - ' . get_lang('Session') . ' ' . $s_name);
$cat->set_session_id($session_id);
} else {
$cat->set_name($course_code);
}
$cat->set_course_code($course_code);
$cat->set_description(null);
$cat->set_user_id(api_get_user_id());
$cat->set_parent_id(0);
$default_weight_setting = api_get_setting('gradebook_default_weight');
$default_weight = isset($default_weight_setting) && !empty($default_weight_setting) ? $default_weight_setting : 100;
$cat->set_weight($default_weight);
$cat->set_grade_model_id($gradebook_model_id);
$cat->set_certificate_min_score(75);
$cat->set_visible(0);
$cat->add();
$category_id = $cat->get_id();
unset($cat);
} else {
$row = Database::fetch_array($res);
$category_id = $row['id'];
}
//}
return $category_id;
}
示例13: returnBreadcrumb
/**
* Return breadcrumb
* @return string
*/
public function returnBreadcrumb()
{
$interbreadcrumb = $this->app['breadcrumb'];
$session_id = api_get_session_id();
$session_name = api_get_session_name($session_id);
$_course = api_get_course_info();
/* If the user is a coach he can see the users who are logged in its session */
$navigation = array();
// part 1: Course Homepage. If we are in a course then the first breadcrumb is a link to the course homepage
// hide_course_breadcrumb the parameter has been added to hide the name of the course, that appeared in the default $interbreadcrumb
$session_name = Text::cut($session_name, MAX_LENGTH_BREADCRUMB);
$my_session_name = is_null($session_name) ? '' : ' (' . $session_name . ')';
if (!empty($_course) && !isset($_GET['hide_course_breadcrumb'])) {
$navigation_item['url'] = $this->urlGenerator->generate('course_home.controller:indexAction', array('courseCode' => $_course['code'], 'sessionId' => $session_id));
//$navigation_item['url'] = $web_course_path.$_course['path'].'/index.php'.(!empty($session_id) ? '?id_session='.$session_id : '');
$course_title = Text::cut($_course['name'], MAX_LENGTH_BREADCRUMB);
switch (api_get_setting('course.breadcrumbs_course_homepage')) {
case 'get_lang':
$navigation_item['title'] = get_lang('CourseHomepageLink');
break;
case 'course_code':
$navigation_item['title'] = $_course['official_code'];
break;
case 'session_name_and_course_title':
$navigation_item['title'] = $course_title . $my_session_name;
break;
default:
if (api_get_session_id() != -1) {
$navigation_item['title'] = $course_title . $my_session_name;
} else {
$navigation_item['title'] = $course_title;
}
break;
}
$navigation[] = $navigation_item;
}
// Part 2: breadcrumbs.
// If there is an array $interbreadcrumb defined then these have to appear before the last breadcrumb
// (which is the tool itself)
if (isset($interbreadcrumb) && is_array($interbreadcrumb)) {
foreach ($interbreadcrumb as $breadcrumb_step) {
if ($breadcrumb_step['url'] != '#') {
$sep = strrchr($breadcrumb_step['url'], '?') ? '&' : '?';
$navigation_item['url'] = $breadcrumb_step['url'] . $sep . api_get_cidreq();
} else {
$navigation_item['url'] = '#';
}
$navigation_item['title'] = $breadcrumb_step['name'];
// titles for shared folders
if ($breadcrumb_step['name'] == 'shared_folder') {
$navigation_item['title'] = get_lang('UserFolders');
} elseif (strstr($breadcrumb_step['name'], 'shared_folder_session_')) {
$navigation_item['title'] = get_lang('UserFolders');
} elseif (strstr($breadcrumb_step['name'], 'sf_user_')) {
$userinfo = api_get_user_info(substr($breadcrumb_step['name'], 8));
$navigation_item['title'] = $userinfo['complete_name'];
} elseif ($breadcrumb_step['name'] == 'chat_files') {
$navigation_item['title'] = get_lang('ChatFiles');
} elseif ($breadcrumb_step['name'] == 'images') {
$navigation_item['title'] = get_lang('Images');
} elseif ($breadcrumb_step['name'] == 'video') {
$navigation_item['title'] = get_lang('Video');
} elseif ($breadcrumb_step['name'] == 'audio') {
$navigation_item['title'] = get_lang('Audio');
} elseif ($breadcrumb_step['name'] == 'flash') {
$navigation_item['title'] = get_lang('Flash');
} elseif ($breadcrumb_step['name'] == 'gallery') {
$navigation_item['title'] = get_lang('Gallery');
}
// Fixes breadcrumb title now we applied the Security::remove_XSS and we cut the string depending of the MAX_LENGTH_BREADCRUMB value
$navigation_item['title'] = Text::cut($navigation_item['title'], MAX_LENGTH_BREADCRUMB);
$navigation_item['title'] = Security::remove_XSS($navigation_item['title']);
$navigation[] = $navigation_item;
}
}
// part 3: The tool itself. If we are on the course homepage we do not want to display the title of the course because this
// is the same as the first part of the breadcrumbs (see part 1)
$final_navigation = array();
$counter = 0;
$navigation[] = array('url' => '#', 'title' => strip_tags($this->title));
return $navigation;
foreach ($navigation as $index => $navigation_info) {
if (!empty($navigation_info['title'])) {
if ($navigation_info['url'] == '#') {
$final_navigation[$index] = $navigation_info['title'];
} else {
$final_navigation[$index] = '<a href="' . $navigation_info['url'] . '" class="" target="_top">' . $navigation_info['title'] . '</a>';
}
$counter++;
}
}
$html = '';
if (!empty($final_navigation)) {
$lis = '';
$i = 0;
if (!empty($final_navigation)) {
//.........这里部分代码省略.........
示例14: get_block
/**
* This method return content html containing information about sessions and its position for showing it inside dashboard interface
* it's important to use the name 'get_block' for beeing used from dashboard controller
* @return array column and content html
*/
public function get_block()
{
global $charset;
$column = 1;
$data = array();
$evaluations_base_courses_graph = $this->get_evaluations_base_courses_graph();
$evaluations_courses_in_sessions_graph = $this->get_evaluations_courses_in_sessions_graph();
$html = '<div class="panel panel-default" id="intro">
<div class="panel-heading">
' . get_lang('EvaluationsGraph') . '
<div class="pull-right"><a class="btn btn-danger btn-xs" onclick="javascript:if(!confirm(\'' . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)) . '\')) return false;" href="index.php?action=disable_block&path=' . $this->path . '">
<em class="fa fa-times"></em>
</a></div>
</div>
<div class="panel-body">';
if (empty($evaluations_base_courses_graph) && empty($evaluations_courses_in_sessions_graph)) {
$html .= '<p>' . api_convert_encoding(get_lang('GraphicNotAvailable'), 'UTF-8') . '</p>';
} else {
// display evaluations base courses graph
if (!empty($evaluations_base_courses_graph)) {
foreach ($evaluations_base_courses_graph as $course_code => $img_html) {
$html .= '<div><strong>' . $course_code . '</strong></div>';
$html .= $img_html;
}
}
// display evaluations base courses graph
if (!empty($evaluations_courses_in_sessions_graph)) {
foreach ($evaluations_courses_in_sessions_graph as $session_id => $courses) {
$session_name = api_get_session_name($session_id);
$html .= '<div><strong>' . $session_name . ':' . get_lang('Evaluations') . '</strong></div>';
foreach ($courses as $course_code => $img_html) {
$html .= '<div><strong>' . $course_code . '</strong></div>';
$html .= $img_html;
}
}
}
}
$html .= '</div>
</div>';
$data['column'] = $column;
$data['content_html'] = $html;
return $data;
}
示例15: build_document_icon_tag
/**
* Builds an img html tag for the filetype
*
* @param string $type (file/folder)
* @param string $path
* @return string img html tag
*/
function build_document_icon_tag($type, $path)
{
$basename = basename($path);
$current_session_id = api_get_session_id();
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
if ($type == 'file') {
$icon = FileManager::choose_image($basename);
if (preg_match('/_chnano_.wav$/i', $basename)) {
$icon = "jplayer_play.png";
$basename = 'wav' . ' ' . '(Nanogong)';
} else {
$basename = substr(strrchr($basename, '.'), 1);
}
} else {
if ($path == '/shared_folder') {
$icon = 'folder_users.gif';
if ($is_allowed_to_edit) {
$basename = get_lang('HelpUsersFolder');
} else {
$basename = get_lang('UserFolders');
}
} elseif (strstr($basename, 'sf_user_')) {
$userinfo = api_get_user_info(substr($basename, 8));
$image_path = UserManager::get_user_picture_path_by_id(substr($basename, 8), 'web', false, true);
if ($image_path['file'] == 'unknown.jpg') {
$icon = $image_path['file'];
} else {
$icon = '../upload/users/' . substr($basename, 8) . '/' . $image_path['file'];
}
$basename = get_lang('UserFolder') . ' ' . $userinfo['complete_name'];
} elseif (strstr($path, 'shared_folder_session_')) {
if ($is_allowed_to_edit) {
$basename = '***(' . api_get_session_name($current_session_id) . ')*** ' . get_lang('HelpUsersFolder');
} else {
$basename = get_lang('UserFolders') . ' (' . api_get_session_name($current_session_id) . ')';
}
$icon = 'folder_users.gif';
} else {
$icon = 'folder_document.gif';
if ($path == '/audio') {
$icon = 'folder_audio.gif';
if (api_is_allowed_to_edit()) {
$basename = get_lang('HelpDefaultDirDocuments');
} else {
$basename = get_lang('Audio');
}
} elseif ($path == '/flash') {
$icon = 'folder_flash.gif';
if (api_is_allowed_to_edit()) {
$basename = get_lang('HelpDefaultDirDocuments');
} else {
$basename = get_lang('Flash');
}
} elseif ($path == '/images') {
$icon = 'folder_images.gif';
if (api_is_allowed_to_edit()) {
$basename = get_lang('HelpDefaultDirDocuments');
} else {
$basename = get_lang('Images');
}
} elseif ($path == '/video') {
$icon = 'folder_video.gif';
if (api_is_allowed_to_edit()) {
$basename = get_lang('HelpDefaultDirDocuments');
} else {
$basename = get_lang('Video');
}
} elseif ($path == '/images/gallery') {
$icon = 'folder_gallery.gif';
if (api_is_allowed_to_edit()) {
$basename = get_lang('HelpDefaultDirDocuments');
} else {
$basename = get_lang('Gallery');
}
} elseif ($path == '/chat_files') {
$icon = 'folder_chat.gif';
if (api_is_allowed_to_edit()) {
$basename = get_lang('HelpFolderChat');
} else {
$basename = get_lang('ChatFiles');
}
} elseif ($path == '/learning_path') {
$icon = 'folder_learningpath.gif';
if (api_is_allowed_to_edit()) {
$basename = get_lang('HelpFolderLearningPaths');
} else {
$basename = get_lang('LearningPaths');
}
}
}
}
return Display::return_icon($icon, $basename, array());
}