/** * Constructor */ public function HTML_QuickForm_datepicker($elementName = null, $elementLabel = null, $attributes = null, $optionIncrement = null) { $js_form_name = api_get_unique_id(); HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes); $this->_persistantFreeze = true; $this->_appendName = true; $this->_type = 'datepicker'; $popup_link = '<a href="javascript:openCalendar(\'' . $js_form_name . '\',\'' . $elementName . '\')"> <img src="' . api_get_path(WEB_IMG_PATH) . 'calendar_select.gif" style="vertical-align:middle;" alt="Select Date" /></a>'; $hour_minute_devider = get_lang("HourMinuteDivider"); $special_chars = array('D', 'l', 'd', 'M', 'F', 'm', 'y', 'H', 'a', 'A', 's', 'i', 'h', 'g', ' '); foreach ($special_chars as $char) { $popup_link = str_replace($char, "\\" . $char, $popup_link); $hour_minute_devider = str_replace($char, "\\" . $char, $hour_minute_devider); } $lang_code = api_get_language_isocode(); // If translation not available in PEAR::HTML_QuickForm_date, add the Chamilo-translation if (!array_key_exists($lang_code, $this->_locale)) { $this->_locale[$lang_code]['months_long'] = api_get_months_long(); } $this->_options['format'] = 'dFY ' . $popup_link . ' H ' . $hour_minute_devider . ' i'; $this->_options['minYear'] = date('Y') - 5; $this->_options['maxYear'] = date('Y') + 10; $this->_options['language'] = $lang_code; if (isset($optionIncrement)) { $this->_options['optionIncrement']['i'] = intval($optionIncrement); } }
/** * Constructor */ function HTML_QuickForm_datepickerdate($elementName = null, $elementLabel = null, $attributes = null) { global $myMinYear, $myMaxYear; $js_form_name = $attributes['form_name']; unset($attributes['form_name']); HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes); $this->_persistantFreeze = true; $this->_appendName = true; $this->_type = 'datepicker'; $popup_link = '<a href="javascript:openCalendar(\'' . $js_form_name . '\',\'' . $elementName . '\')"><img src="' . api_get_path(WEB_IMG_PATH) . 'calendar_select.gif" style="vertical-align:middle;" alt="Select Date" /></a>'; $special_chars = array('D', 'l', 'd', 'M', 'F', 'm', 'y', 'H', 'a', 'A', 's', 'i', 'h', 'g', ' '); foreach ($special_chars as $index => $char) { $popup_link = str_replace($char, "\\" . $char, $popup_link); } $lang_code = api_get_language_isocode(); // If translation not available in PEAR::HTML_QuickForm_date, add the Chamilo-translation if (!array_key_exists($lang_code, $this->_locale)) { $this->_locale[$lang_code]['months_long'] = api_get_months_long(); } $this->_options['format'] = 'dFY ' . $popup_link; $this->_options['minYear'] = date('Y') - 5; $this->_options['maxYear'] = date('Y') + 10; $this->_options['language'] = $lang_code; //$this->_options['addEmptyOption'] = true; //$this->_options['emptyOptionValue'] = 0; //$this->_options['emptyOptionText'] = ' -- '; }
/** * @param $array * @return mixed */ public static function utf8_sort($array) { $old_locale = setlocale(LC_ALL, null); $code = api_get_language_isocode(); $locale_list = array($code . '.utf8', 'en.utf8', 'en_US.utf8', 'en_GB.utf8'); $try_sort = false; foreach ($locale_list as $locale) { $my_local = setlocale(LC_COLLATE, $locale); if ($my_local) { $try_sort = true; break; } } if ($try_sort) { uasort($array, 'strcoll'); } setlocale(LC_COLLATE, $old_locale); return $array; }
/** * Set header parameters */ private function set_header_parameters() { global $httpHeadXtra, $_course, $interbreadcrumb, $language_file, $noPHP_SELF, $_configuration, $this_section; $help = $this->help; $nameTools = $this->title; $navigation = return_navigation_array(); $this->menu_navigation = $navigation['menu_navigation']; $this->assign('system_charset', api_get_system_encoding()); if (isset($httpHeadXtra) && $httpHeadXtra) { foreach ($httpHeadXtra as & $thisHttpHead) { header($thisHttpHead); } } $this->assign('online_button', Display::return_icon('online.png')); $this->assign('offline_button',Display::return_icon('offline.png')); // Get language iso-code for this page - ignore errors $this->assign('document_language', api_get_language_isocode()); $course_title = isset($_course['name']) ? $_course['name'] : null; $title_list = array(); $title_list[] = api_get_setting('Institution'); $title_list[] = api_get_setting('siteName'); if (!empty($course_title)) { $title_list[] = $course_title; } if ($nameTools != '') { $title_list[] = $nameTools; } $title_string = ''; for ($i = 0; $i < count($title_list); $i++) { $title_string .= $title_list[$i]; if (isset($title_list[$i + 1])) { $item = trim($title_list[$i + 1]); if (!empty($item)) { $title_string .= ' - '; } } } $this->assign('title_string', $title_string); //Setting the theme and CSS files $this->set_css_files(); $this->set_js_files(); //$this->set_js_files_post(); $browser = api_browser_support('check_browser'); if ($browser[0] == 'Internet Explorer' && $browser[1] >= '11') { $browser_head = '<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" />'; $this->assign('browser_specific_head', $browser_head); } // Implementation of prefetch. // See http://cdn.chamilo.org/main/img/online.png for details $prefetch = ''; if (!empty($_configuration['cdn_enable'])) { $prefetch .= '<meta http-equiv="x-dns-prefetch-control" content="on">'; foreach ($_configuration['cdn'] as $host => $exts) { $prefetch .= '<link rel="dns-prefetch" href="'.$host.'">'; } } $this->assign('prefetch', $prefetch); $this->assign('text_direction', api_get_text_direction()); $this->assign('section_name', 'section-'.$this_section); $favico = '<link rel="shortcut icon" href="'.api_get_path(WEB_PATH).'favicon.ico" type="image/x-icon" />'; if (isset($_configuration['multiple_access_urls']) && $_configuration['multiple_access_urls']) { $access_url_id = api_get_current_access_url_id(); if ($access_url_id != -1) { $url_info = api_get_access_url($access_url_id); $url = api_remove_trailing_slash(preg_replace('/https?:\/\//i', '', $url_info['url'])); $clean_url = replace_dangerous_char($url); $clean_url = str_replace('/', '-', $clean_url); $clean_url .= '/'; $homep = api_get_path(REL_PATH).'home/'.$clean_url; //homep for Home Path $icon_real_homep = api_get_path(SYS_PATH).'home/'.$clean_url; //we create the new dir for the new sites if (is_file($icon_real_homep.'favicon.ico')) { $favico = '<link rel="shortcut icon" href="'.$homep.'favicon.ico" type="image/x-icon" />'; } } } $this->assign('favico', $favico); $this->set_help(); //@todo move this in the template $bug_notification_link = ''; if (api_get_setting('show_link_bug_notification') == 'true' && $this->user_is_logged_in) { $bug_notification_link = '<li class="report"> <a href="http://support.chamilo.org/projects/chamilo-18/wiki/How_to_report_bugs" target="_blank"> <img src="'.api_get_path(WEB_IMG_PATH).'bug.large.png" style="vertical-align: middle;" alt="'.get_lang('ReportABug').'" title="'.get_lang( 'ReportABug' ).'"/></a> </li>'; } $this->assign('bug_notification_link', $bug_notification_link); $notification = return_notification_menu(); $this->assign('notification_menu', $notification); //Preparing values for the menu //Logout link if (isset($_configuration['hide_logout_button']) && $_configuration['hide_logout_button'] == 'true') { $this->assign('logout_link', null); } else { $this->assign('logout_link', api_get_path(WEB_PATH).'index.php?logout=logout&uid='.api_get_user_id()); } //Profile link if (api_get_setting('allow_social_tool') == 'true') { $profile_url = api_get_path(WEB_CODE_PATH).'social/home.php'; $profile_link = Display::url(get_lang('Profile'), $profile_url); } else { $profile_url = api_get_path(WEB_CODE_PATH).'auth/profile.php'; $profile_link = Display::url(get_lang('Profile'), $profile_url); } $this->assign('profile_link', $profile_link); $this->assign('profile_url', $profile_url); //Message link $message_link = null; $message_url = null; if (api_get_setting('allow_message_tool') == 'true') { $message_url = api_get_path(WEB_CODE_PATH).'messages/inbox.php'; $message_link = '<a href="'.api_get_path(WEB_CODE_PATH).'messages/inbox.php">'.get_lang('Inbox').'</a>'; } $this->assign('message_link', $message_link); $this->assign('message_url', $message_url); $institution = api_get_setting('Institution'); $portal_name = empty($institution) ? api_get_setting('siteName') : $institution; $this->assign('portal_name', $portal_name); //Menu $menu = return_menu(); $this->assign('menu', $menu); //Setting notifications $count_unread_message = 0; if (api_get_setting('allow_message_tool') == 'true') { // get count unread message and total invitations $count_unread_message = MessageManager::get_number_of_messages(true); } $total_invitations = 0; if (api_get_setting('allow_social_tool') == 'true') { $number_of_new_messages_of_friend = SocialManager::get_message_number_invitation_by_user_id( api_get_user_id() ); $group_pending_invitations = GroupPortalManager::get_groups_by_user( api_get_user_id(), GROUP_USER_PERMISSION_PENDING_INVITATION, false ); $group_pending_invitations = 0; if (!empty($group_pending_invitations)) { $group_pending_invitations = count($group_pending_invitations); } $total_invitations = intval($number_of_new_messages_of_friend) + $group_pending_invitations + intval( $count_unread_message ); } $total_invitations = (!empty($total_invitations) ? Display::badge($total_invitations) : null); $this->assign('user_notifications', $total_invitations); //Breadcrumb $breadcrumb = return_breadcrumb($interbreadcrumb, $language_file, $nameTools); $this->assign('breadcrumb', $breadcrumb); //Extra content $extra_header = null; if (!api_is_platform_admin()) { $extra_header = trim(api_get_setting('header_extra_content')); } $this->assign('header_extra_content', $extra_header); //if ($this->show_header == 1) { header('Content-Type: text/html; charset='.api_get_system_encoding()); header( 'X-Powered-By: '.$_configuration['software_name'].' '.substr($_configuration['system_version'], 0, 1) ); //} }
/* For licensing terms, see /license.txt */ $language_file = 'agenda'; require_once dirname(__FILE__) . '/../../../global.inc.php'; //session if (isset($_GET['id_session'])) { $_SESSION['id_session'] = Security::remove_XSS($_GET['id_session']); } // the variables for the days and the months // Defining the shorts for the days $DaysShort = api_get_week_days_short(); // Defining the days of the week to allow translation of the days $DaysLong = api_get_week_days_long(); // Defining the months of the year to allow translation of the months $MonthsLong = api_get_months_long(); $iso_lang = api_get_language_isocode($language_interface); header('Content-Type: text/html; charset=' . api_get_system_encoding()); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $iso_lang; ?> " lang="<?php echo $iso_lang; ?> "> <head> <title>Calendar</title> <meta http-equiv="Content-Type" content="text/html; charset=<?php
$interbreadcrumb[] = array('url' => $document_sub_data['document_url'], 'name' => $document_sub_data['title']); } } Display::display_header($nameTools, 'Doc'); echo '<div class="actions">'; echo '<a href="document.php?id=' . $document_id . '">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('DocumentsOverview'), '', ICON_SIZE_MEDIUM) . '</a>'; echo '</div>'; ///pixlr // max size 1 Mb ?? $title = urlencode(utf8_encode(get_lang('NewImage'))); //TODO:check // $image = api_get_path(WEB_IMG_PATH) . 'canvas1024x768.png'; // $pixlr_code_translation_table = array('' => 'en', 'pt' => 'pt-Pt', 'sr' => 'sr_latn'); $langpixlr = api_get_language_isocode(); $langpixlr = isset($pixlr_code_translation_table[$langpixlr]) ? $pixlredit_code_translation_table[$langpixlr] : $langpixlr; $loc = $langpixlr; // deprecated ?? TODO:check pixlr read user browser $exit_path = api_get_path(WEB_CODE_PATH) . 'document/exit_pixlr.php'; $_SESSION['exit_pixlr'] = $document_data['path']; $referrer = "Chamilo"; $target_path = api_get_path(WEB_CODE_PATH) . 'document/save_pixlr.php'; $target = $target_path; $locktarget = "true"; $locktitle = "false"; if ($_SERVER['HTTP_HOST'] == "localhost") { $path_and_file = api_get_path(SYS_SERVER_ROOT_PATH) . '/crossdomain.xml'; if (!file_exists($path_and_file)) { $crossdomain = '<?xml version="1.0"?> <!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
/** * Returns isocode (see api_get_language_isocode()) which is purified accordingly to * be used by the php intl extension (ICU library). * @param string $language (optional) This is the name of the folder containing translations for the corresponding language. * If $language is omitted, interface language is assumed then. * @return string The found language locale id or null on error. Examples: bg, en, pt_BR, ... */ function _api_get_locale_from_language($language = null) { static $locale = array(); if (empty($language)) { $language = api_get_interface_language(); } if (!isset($locale[$language])) { $locale[$language] = str_replace('-', '_', api_get_language_isocode($language)); } return $locale[$language]; }
/** * // TODO: The output encoding should be equal to the system encoding. * * Exports the learning path as a SCORM package. This is the main function that * gathers the content, transforms it, writes the imsmanifest.xml file, zips the * whole thing and returns the zip. * * This method needs to be called in PHP5, as it will fail with non-adequate * XML package (like the ones for PHP4), and it is *not* a static method, so * you need to call it on a learnpath object. * @TODO The method might be redefined later on in the scorm class itself to avoid * creating a SCORM structure if there is one already. However, if the initial SCORM * path has been modified, it should use the generic method here below. * @TODO link this function with the export_lp() function in the same class * @param string Optional name of zip file. If none, title of learnpath is * domesticated and trailed with ".zip" * @return string Returns the zip package string, or null if error */ public function scorm_export() { $_course = api_get_course_info(); $course_id = api_get_course_int_id(); $links_to_create = null; // Remove memory and time limits as much as possible as this might be a long process... if (function_exists('ini_set')) { api_set_memory_limit('128M'); ini_set('max_execution_time', 600); } // Create the zip handler (this will remain available throughout the method). $archive_path = api_get_path(SYS_ARCHIVE_PATH); $sys_course_path = api_get_path(SYS_COURSE_PATH); $temp_dir_short = uniqid(); $temp_zip_dir = $archive_path . '/' . $temp_dir_short; $temp_zip_file = $temp_zip_dir . '/' . md5(time()) . '.zip'; $zip_folder = new PclZip($temp_zip_file); $current_course_path = api_get_path(SYS_COURSE_PATH) . api_get_course_path(); $root_path = $main_path = api_get_path(SYS_PATH); $files_cleanup = array(); // Place to temporarily stash the zipfiles. // create the temp dir if it doesn't exist // or do a cleanup befor creating the zipfile. if (!is_dir($temp_zip_dir)) { mkdir($temp_zip_dir, api_get_permissions_for_new_directories()); } else { // Cleanup: Check the temp dir for old files and delete them. $handle = opendir($temp_zip_dir); while (false !== ($file = readdir($handle))) { if ($file != '.' && $file != '..') { unlink("{$temp_zip_dir}/{$file}"); } } closedir($handle); } $zip_files = $zip_files_abs = $zip_files_dist = array(); if (is_dir($current_course_path . '/scorm/' . $this->path) && is_file($current_course_path . '/scorm/' . $this->path . '/imsmanifest.xml')) { // Remove the possible . at the end of the path. $dest_path_to_lp = substr($this->path, -1) == '.' ? substr($this->path, 0, -1) : $this->path; $dest_path_to_scorm_folder = str_replace('//', '/', $temp_zip_dir . '/scorm/' . $dest_path_to_lp); mkdir($dest_path_to_scorm_folder, api_get_permissions_for_new_directories(), true); $zip_files_dist = api_copyr($current_course_path . '/scorm/' . $this->path, $dest_path_to_scorm_folder, array('imsmanifest'), $zip_files); } // Build a dummy imsmanifest structure. Do not add to the zip yet (we still need it). // This structure is developed following regulations for SCORM 1.2 packaging in the SCORM 1.2 Content // Aggregation Model official document, secion "2.3 Content Packaging". $xmldoc = new DOMDocument('1.0'); // We are going to build a UTF-8 encoded manifest. Later we will recode it to the desired (and supported) encoding. $root = $xmldoc->createElement('manifest'); $root->setAttribute('identifier', 'SingleCourseManifest'); $root->setAttribute('version', '1.1'); $root->setAttribute('xmlns', 'http://www.imsproject.org/xsd/imscp_rootv1p1p2'); $root->setAttribute('xmlns:adlcp', 'http://www.adlnet.org/xsd/adlcp_rootv1p2'); $root->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); $root->setAttribute('xsi:schemaLocation', 'http://www.imsproject.org/xsd/imscp_rootv1p1p2 imscp_rootv1p1p2.xsd http://www.imsglobal.org/xsd/imsmd_rootv1p2p1 imsmd_rootv1p2p1.xsd http://www.adlnet.org/xsd/adlcp_rootv1p2 adlcp_rootv1p2.xsd'); // Build mandatory sub-root container elements. $metadata = $xmldoc->createElement('metadata'); $md_schema = $xmldoc->createElement('schema', 'ADL SCORM'); $metadata->appendChild($md_schema); $md_schemaversion = $xmldoc->createElement('schemaversion', '1.2'); $metadata->appendChild($md_schemaversion); $root->appendChild($metadata); $organizations = $xmldoc->createElement('organizations'); $resources = $xmldoc->createElement('resources'); // Build the only organization we will use in building our learnpaths. $organizations->setAttribute('default', 'chamilo_scorm_export'); $organization = $xmldoc->createElement('organization'); $organization->setAttribute('identifier', 'chamilo_scorm_export'); // To set the title of the SCORM entity (=organization), we take the name given // in Chamilo and convert it to HTML entities using the Chamilo charset (not the // learning path charset) as it is the encoding that defines how it is stored // in the database. Then we convert it to HTML entities again as the "&" character // alone is not authorized in XML (must be &). // The title is then decoded twice when extracting (see scorm::parse_manifest). $org_title = $xmldoc->createElement('title', api_utf8_encode($this->get_name())); $organization->appendChild($org_title); $folder_name = 'document'; // Removes the learning_path/scorm_folder path when exporting see #4841 $path_to_remove = null; $result = $this->generate_lp_folder($_course); if (isset($result['dir']) && strpos($result['dir'], 'learning_path')) { $path_to_remove = 'document' . $result['dir']; $path_to_replace = $folder_name . '/'; } //Fixes chamilo scorm exports if ($this->ref == 'chamilo_scorm_export') { $path_to_remove = 'scorm/' . $this->path . '/document/'; } // For each element, add it to the imsmanifest structure, then add it to the zip. // Always call the learnpathItem->scorm_export() method to change it to the SCORM format. $link_updates = array(); foreach ($this->items as $index => $item) { if (!in_array($item->type, array(TOOL_QUIZ, TOOL_FORUM, TOOL_THREAD, TOOL_LINK, TOOL_STUDENTPUBLICATION))) { // Get included documents from this item. if ($item->type == 'sco') { $inc_docs = $item->get_resources_from_source(null, api_get_path(SYS_COURSE_PATH) . api_get_course_path() . '/' . 'scorm/' . $this->path . '/' . $item->get_path()); } else { $inc_docs = $item->get_resources_from_source(); } // Give a child element <item> to the <organization> element. $my_item_id = $item->get_id(); $my_item = $xmldoc->createElement('item'); $my_item->setAttribute('identifier', 'ITEM_' . $my_item_id); $my_item->setAttribute('identifierref', 'RESOURCE_' . $my_item_id); $my_item->setAttribute('isvisible', 'true'); // Give a child element <title> to the <item> element. $my_title = $xmldoc->createElement('title', htmlspecialchars(api_utf8_encode($item->get_title()), ENT_QUOTES, 'UTF-8')); $my_item->appendChild($my_title); // Give a child element <adlcp:prerequisites> to the <item> element. $my_prereqs = $xmldoc->createElement('adlcp:prerequisites', $this->get_scorm_prereq_string($my_item_id)); $my_prereqs->setAttribute('type', 'aicc_script'); $my_item->appendChild($my_prereqs); // Give a child element <adlcp:maxtimeallowed> to the <item> element - not yet supported. //$xmldoc->createElement('adlcp:maxtimeallowed',''); // Give a child element <adlcp:timelimitaction> to the <item> element - not yet supported. //$xmldoc->createElement('adlcp:timelimitaction',''); // Give a child element <adlcp:datafromlms> to the <item> element - not yet supported. //$xmldoc->createElement('adlcp:datafromlms',''); // Give a child element <adlcp:masteryscore> to the <item> element. $my_masteryscore = $xmldoc->createElement('adlcp:masteryscore', $item->get_mastery_score()); $my_item->appendChild($my_masteryscore); // Attach this item to the organization element or hits parent if there is one. if (!empty($item->parent) && $item->parent != 0) { $children = $organization->childNodes; $possible_parent =& $this->get_scorm_xml_node($children, 'ITEM_' . $item->parent); if (is_object($possible_parent)) { $possible_parent->appendChild($my_item); } else { if ($this->debug > 0) { error_log('Parent ITEM_' . $item->parent . ' of item ITEM_' . $my_item_id . ' not found'); } } } else { if ($this->debug > 0) { error_log('No parent'); } $organization->appendChild($my_item); } // Get the path of the file(s) from the course directory root. $my_file_path = $item->get_file_path('scorm/' . $this->path . '/'); if (!empty($path_to_remove)) { //From docs $my_xml_file_path = str_replace($path_to_remove, $path_to_replace, $my_file_path); //From quiz if ($this->ref == 'chamilo_scorm_export') { $path_to_remove = 'scorm/' . $this->path . '/'; $my_xml_file_path = str_replace($path_to_remove, '', $my_file_path); } } else { $my_xml_file_path = $my_file_path; } $my_sub_dir = dirname($my_file_path); $my_sub_dir = str_replace('\\', '/', $my_sub_dir); //$my_xml_sub_dir = api_htmlentities(api_utf8_encode($my_sub_dir), ENT_QUOTES, 'UTF-8'); $my_xml_sub_dir = $my_sub_dir; // Give a <resource> child to the <resources> element $my_resource = $xmldoc->createElement('resource'); $my_resource->setAttribute('identifier', 'RESOURCE_' . $item->get_id()); $my_resource->setAttribute('type', 'webcontent'); $my_resource->setAttribute('href', $my_xml_file_path); // adlcp:scormtype can be either 'sco' or 'asset'. if ($item->type == 'sco') { $my_resource->setAttribute('adlcp:scormtype', 'sco'); } else { $my_resource->setAttribute('adlcp:scormtype', 'asset'); } // xml:base is the base directory to find the files declared in this resource. $my_resource->setAttribute('xml:base', ''); // Give a <file> child to the <resource> element. $my_file = $xmldoc->createElement('file'); $my_file->setAttribute('href', $my_xml_file_path); $my_resource->appendChild($my_file); // Dependency to other files - not yet supported. $i = 1; foreach ($inc_docs as $doc_info) { if (count($doc_info) < 1 || empty($doc_info[0])) { continue; } $my_dep = $xmldoc->createElement('resource'); $res_id = 'RESOURCE_' . $item->get_id() . '_' . $i; $my_dep->setAttribute('identifier', $res_id); $my_dep->setAttribute('type', 'webcontent'); $my_dep->setAttribute('adlcp:scormtype', 'asset'); $my_dep_file = $xmldoc->createElement('file'); // Check type of URL. //error_log(__LINE__.'Now dealing with '.$doc_info[0].' of type '.$doc_info[1].'-'.$doc_info[2], 0); if ($doc_info[1] == 'remote') { // Remote file. Save url as is. $my_dep_file->setAttribute('href', $doc_info[0]); $my_dep->setAttribute('xml:base', ''); } elseif ($doc_info[1] == 'local') { switch ($doc_info[2]) { case 'url': // Local URL - save path as url for now, don't zip file. $abs_path = api_get_path(SYS_PATH) . str_replace(api_get_path(WEB_PATH), '', $doc_info[0]); $current_dir = dirname($abs_path); $current_dir = str_replace('\\', '/', $current_dir); $file_path = realpath($abs_path); $file_path = str_replace('\\', '/', $file_path); $my_dep_file->setAttribute('href', $file_path); $my_dep->setAttribute('xml:base', ''); if (strstr($file_path, $main_path) !== false) { // The calculated real path is really inside Chamilo's root path. // Reduce file path to what's under the DocumentRoot. $file_path = substr($file_path, strlen($root_path) - 1); //echo $file_path;echo '<br /><br />'; //error_log(__LINE__.'Reduced url path: '.$file_path, 0); $zip_files_abs[] = $file_path; $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path); $my_dep_file->setAttribute('href', $file_path); $my_dep->setAttribute('xml:base', ''); } elseif (empty($file_path)) { /*$document_root = substr(api_get_path(SYS_PATH), 0, strpos(api_get_path(SYS_PATH), api_get_path(REL_PATH))); if (strpos($document_root, -1) == '/') { $document_root = substr(0, -1, $document_root); }*/ $file_path = $_SERVER['DOCUMENT_ROOT'] . $abs_path; $file_path = str_replace('//', '/', $file_path); if (file_exists($file_path)) { $file_path = substr($file_path, strlen($current_dir)); // We get the relative path. $zip_files[] = $my_sub_dir . '/' . $file_path; $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path); $my_dep_file->setAttribute('href', $file_path); $my_dep->setAttribute('xml:base', ''); } } break; case 'abs': // Absolute path from DocumentRoot. Save file and leave path as is in the zip. $my_dep_file->setAttribute('href', $doc_info[0]); $my_dep->setAttribute('xml:base', ''); //$current_dir = str_replace('\\', '/', dirname($current_course_path.'/'.$item->get_file_path())).'/'; // The next lines fix a bug when using the "subdir" mode of Chamilo, whereas // an image path would be constructed as /var/www/subdir/subdir/img/foo.bar $abs_img_path_without_subdir = $doc_info[0]; $relp = api_get_path(REL_PATH); // The url-append config param. $pos = strpos($abs_img_path_without_subdir, $relp); if ($pos === 0) { $abs_img_path_without_subdir = '/' . substr($abs_img_path_without_subdir, strlen($relp)); } //$file_path = realpath(api_get_path(SYS_PATH).$doc_info[0]); $file_path = realpath(api_get_path(SYS_PATH) . $abs_img_path_without_subdir); $file_path = str_replace('\\', '/', $file_path); $file_path = str_replace('//', '/', $file_path); //error_log(__LINE__.'Abs path: '.$file_path, 0); // Prepare the current directory path (until just under 'document') with a trailing slash. $cur_path = substr($current_course_path, -1) == '/' ? $current_course_path : $current_course_path . '/'; // Check if the current document is in that path. if (strstr($file_path, $cur_path) !== false) { // The document is in that path, now get the relative path // to the containing document. $orig_file_path = dirname($cur_path . $my_file_path) . '/'; $orig_file_path = str_replace('\\', '/', $orig_file_path); $relative_path = ''; if (strstr($file_path, $cur_path) !== false) { $relative_path = substr($file_path, strlen($orig_file_path)); $file_path = substr($file_path, strlen($cur_path)); } else { // This case is still a problem as it's difficult to calculate a relative path easily // might still generate wrong links. //$file_path = substr($file_path,strlen($cur_path)); // Calculate the directory path to the current file (without trailing slash). $my_relative_path = dirname($file_path); $my_relative_path = str_replace('\\', '/', $my_relative_path); $my_relative_file = basename($file_path); // Calculate the directory path to the containing file (without trailing slash). $my_orig_file_path = substr($orig_file_path, 0, -1); $dotdot = ''; $subdir = ''; while (strstr($my_relative_path, $my_orig_file_path) === false && strlen($my_orig_file_path) > 1 && strlen($my_relative_path) > 1) { $my_relative_path2 = dirname($my_relative_path); $my_relative_path2 = str_replace('\\', '/', $my_relative_path2); $my_orig_file_path = dirname($my_orig_file_path); $my_orig_file_path = str_replace('\\', '/', $my_orig_file_path); $subdir = substr($my_relative_path, strlen($my_relative_path2) + 1) . '/' . $subdir; $dotdot += '../'; $my_relative_path = $my_relative_path2; } $relative_path = $dotdot . $subdir . $my_relative_file; } // Put the current document in the zip (this array is the array // that will manage documents already in the course folder - relative). $zip_files[] = $file_path; // Update the links to the current document in the containing document (make them relative). $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $relative_path); $my_dep_file->setAttribute('href', $file_path); $my_dep->setAttribute('xml:base', ''); } elseif (strstr($file_path, $main_path) !== false) { // The calculated real path is really inside Chamilo's root path. // Reduce file path to what's under the DocumentRoot. $file_path = substr($file_path, strlen($root_path)); //echo $file_path;echo '<br /><br />'; //error_log('Reduced path: '.$file_path, 0); $zip_files_abs[] = $file_path; $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path); $my_dep_file->setAttribute('href', 'document/' . $file_path); $my_dep->setAttribute('xml:base', ''); } elseif (empty($file_path)) { /*$document_root = substr(api_get_path(SYS_PATH), 0, strpos(api_get_path(SYS_PATH), api_get_path(REL_PATH))); if(strpos($document_root,-1) == '/') { $document_root = substr(0, -1, $document_root); }*/ $file_path = $_SERVER['DOCUMENT_ROOT'] . $doc_info[0]; $file_path = str_replace('//', '/', $file_path); if (file_exists($file_path)) { $file_path = substr($file_path, strlen($current_dir)); // We get the relative path. $zip_files[] = $my_sub_dir . '/' . $file_path; $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path); $my_dep_file->setAttribute('href', 'document/' . $file_path); $my_dep->setAttribute('xml:base', ''); } } break; case 'rel': // Path relative to the current document. Save xml:base as current document's directory and save file in zip as subdir.file_path if (substr($doc_info[0], 0, 2) == '..') { // Relative path going up. $current_dir = dirname($current_course_path . '/' . $item->get_file_path()) . '/'; $current_dir = str_replace('\\', '/', $current_dir); $file_path = realpath($current_dir . $doc_info[0]); $file_path = str_replace('\\', '/', $file_path); //error_log($file_path.' <-> '.$main_path,0); if (strstr($file_path, $main_path) !== false) { // The calculated real path is really inside Chamilo's root path. // Reduce file path to what's under the DocumentRoot. $file_path = substr($file_path, strlen($root_path)); //error_log('Reduced path: '.$file_path, 0); $zip_files_abs[] = $file_path; $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path); $my_dep_file->setAttribute('href', 'document/' . $file_path); $my_dep->setAttribute('xml:base', ''); } } else { $zip_files[] = $my_sub_dir . '/' . $doc_info[0]; $my_dep_file->setAttribute('href', $doc_info[0]); $my_dep->setAttribute('xml:base', $my_xml_sub_dir); } break; default: $my_dep_file->setAttribute('href', $doc_info[0]); $my_dep->setAttribute('xml:base', ''); break; } } $my_dep->appendChild($my_dep_file); $resources->appendChild($my_dep); $dependency = $xmldoc->createElement('dependency'); $dependency->setAttribute('identifierref', $res_id); $my_resource->appendChild($dependency); $i++; } //$my_dependency = $xmldoc->createElement('dependency'); //$my_dependency->setAttribute('identifierref', ''); $resources->appendChild($my_resource); $zip_files[] = $my_file_path; //error_log('File '.$my_file_path. ' added to $zip_files', 0); } else { // If the item is a quiz or a link or whatever non-exportable, we include a step indicating it. switch ($item->type) { case TOOL_LINK: $my_item = $xmldoc->createElement('item'); $my_item->setAttribute('identifier', 'ITEM_' . $item->get_id()); $my_item->setAttribute('identifierref', 'RESOURCE_' . $item->get_id()); $my_item->setAttribute('isvisible', 'true'); // Give a child element <title> to the <item> element. $my_title = $xmldoc->createElement('title', htmlspecialchars(api_utf8_encode($item->get_title()), ENT_QUOTES, 'UTF-8')); $my_item->appendChild($my_title); // Give a child element <adlcp:prerequisites> to the <item> element. $my_prereqs = $xmldoc->createElement('adlcp:prerequisites', $item->get_prereq_string()); $my_prereqs->setAttribute('type', 'aicc_script'); $my_item->appendChild($my_prereqs); // Give a child element <adlcp:maxtimeallowed> to the <item> element - not yet supported. //$xmldoc->createElement('adlcp:maxtimeallowed', ''); // Give a child element <adlcp:timelimitaction> to the <item> element - not yet supported. //$xmldoc->createElement('adlcp:timelimitaction', ''); // Give a child element <adlcp:datafromlms> to the <item> element - not yet supported. //$xmldoc->createElement('adlcp:datafromlms', ''); // Give a child element <adlcp:masteryscore> to the <item> element. $my_masteryscore = $xmldoc->createElement('adlcp:masteryscore', $item->get_mastery_score()); $my_item->appendChild($my_masteryscore); // Attach this item to the organization element or its parent if there is one. if (!empty($item->parent) && $item->parent != 0) { $children = $organization->childNodes; for ($i = 0; $i < $children->length; $i++) { $item_temp = $children->item($i); if ($item_temp->nodeName == 'item') { if ($item_temp->getAttribute('identifier') == 'ITEM_' . $item->parent) { $item_temp->appendChild($my_item); } } } } else { $organization->appendChild($my_item); } $my_file_path = 'link_' . $item->get_id() . '.html'; $sql = 'SELECT url, title FROM ' . Database::get_course_table(TABLE_LINK) . ' WHERE c_id = ' . $course_id . ' AND id=' . $item->path; $rs = Database::query($sql); if ($link = Database::fetch_array($rs)) { $url = $link['url']; $title = stripslashes($link['title']); $links_to_create[$my_file_path] = array('title' => $title, 'url' => $url); //$my_xml_file_path = api_htmlentities(api_utf8_encode($my_file_path), ENT_QUOTES, 'UTF-8'); $my_xml_file_path = $my_file_path; $my_sub_dir = dirname($my_file_path); $my_sub_dir = str_replace('\\', '/', $my_sub_dir); //$my_xml_sub_dir = api_htmlentities(api_utf8_encode($my_sub_dir), ENT_QUOTES, 'UTF-8'); $my_xml_sub_dir = $my_sub_dir; // Give a <resource> child to the <resources> element. $my_resource = $xmldoc->createElement('resource'); $my_resource->setAttribute('identifier', 'RESOURCE_' . $item->get_id()); $my_resource->setAttribute('type', 'webcontent'); $my_resource->setAttribute('href', $my_xml_file_path); // adlcp:scormtype can be either 'sco' or 'asset'. $my_resource->setAttribute('adlcp:scormtype', 'asset'); // xml:base is the base directory to find the files declared in this resource. $my_resource->setAttribute('xml:base', ''); // give a <file> child to the <resource> element. $my_file = $xmldoc->createElement('file'); $my_file->setAttribute('href', $my_xml_file_path); $my_resource->appendChild($my_file); $resources->appendChild($my_resource); } break; case TOOL_QUIZ: require_once api_get_path(SYS_CODE_PATH) . 'exercice/exercise.class.php'; $exe_id = $item->path; // Should be using ref when everything will be cleaned up in this regard. $exe = new Exercise(); $exe->read($exe_id); $my_item = $xmldoc->createElement('item'); $my_item->setAttribute('identifier', 'ITEM_' . $item->get_id()); $my_item->setAttribute('identifierref', 'RESOURCE_' . $item->get_id()); $my_item->setAttribute('isvisible', 'true'); // Give a child element <title> to the <item> element. $my_title = $xmldoc->createElement('title', htmlspecialchars(api_utf8_encode($item->get_title()), ENT_QUOTES, 'UTF-8')); $my_item->appendChild($my_title); $my_max_score = $xmldoc->createElement('max_score', $item->get_max()); //$my_item->appendChild($my_max_score); // Give a child element <adlcp:prerequisites> to the <item> element. $my_prereqs = $xmldoc->createElement('adlcp:prerequisites', $item->get_prereq_string()); $my_prereqs->setAttribute('type', 'aicc_script'); $my_item->appendChild($my_prereqs); // Give a child element <adlcp:masteryscore> to the <item> element. $my_masteryscore = $xmldoc->createElement('adlcp:masteryscore', $item->get_mastery_score()); $my_item->appendChild($my_masteryscore); // Attach this item to the organization element or hits parent if there is one. if (!empty($item->parent) && $item->parent != 0) { $children = $organization->childNodes; for ($i = 0; $i < $children->length; $i++) { $item_temp = $children->item($i); if ($item_temp->nodeName == 'item') { if ($item_temp->getAttribute('identifier') == 'ITEM_' . $item->parent) { $item_temp->appendChild($my_item); } } } } else { $organization->appendChild($my_item); } // Include export scripts. require_once api_get_path(SYS_CODE_PATH) . 'exercice/export/scorm/scorm_export.php'; // Get the path of the file(s) from the course directory root //$my_file_path = $item->get_file_path('scorm/'.$this->path.'/'); $my_file_path = 'quiz_' . $item->get_id() . '.html'; // Write the contents of the exported exercise into a (big) html file // to later pack it into the exported SCORM. The file will be removed afterwards. $contents = export_exercise($exe_id, true); $tmp_file_path = $archive_path . $temp_dir_short . '/' . $my_file_path; $res = file_put_contents($tmp_file_path, $contents); if ($res === false) { error_log('Could not write into file ' . $tmp_file_path . ' ' . __FILE__ . ' ' . __LINE__, 0); } $files_cleanup[] = $tmp_file_path; //error_log($tmp_path); die(); //$my_xml_file_path = api_htmlentities(api_utf8_encode($my_file_path), ENT_QUOTES, 'UTF-8'); $my_xml_file_path = $my_file_path; $my_sub_dir = dirname($my_file_path); $my_sub_dir = str_replace('\\', '/', $my_sub_dir); //$my_xml_sub_dir = api_htmlentities(api_utf8_encode($my_sub_dir), ENT_QUOTES, 'UTF-8'); $my_xml_sub_dir = $my_sub_dir; // Give a <resource> child to the <resources> element. $my_resource = $xmldoc->createElement('resource'); $my_resource->setAttribute('identifier', 'RESOURCE_' . $item->get_id()); $my_resource->setAttribute('type', 'webcontent'); $my_resource->setAttribute('href', $my_xml_file_path); // adlcp:scormtype can be either 'sco' or 'asset'. $my_resource->setAttribute('adlcp:scormtype', 'sco'); // xml:base is the base directory to find the files declared in this resource. $my_resource->setAttribute('xml:base', ''); // Give a <file> child to the <resource> element. $my_file = $xmldoc->createElement('file'); $my_file->setAttribute('href', $my_xml_file_path); $my_resource->appendChild($my_file); // Get included docs. $inc_docs = $item->get_resources_from_source(null, $tmp_file_path); // Dependency to other files - not yet supported. $i = 1; foreach ($inc_docs as $doc_info) { if (count($doc_info) < 1 || empty($doc_info[0])) { continue; } $my_dep = $xmldoc->createElement('resource'); $res_id = 'RESOURCE_' . $item->get_id() . '_' . $i; $my_dep->setAttribute('identifier', $res_id); $my_dep->setAttribute('type', 'webcontent'); $my_dep->setAttribute('adlcp:scormtype', 'asset'); $my_dep_file = $xmldoc->createElement('file'); // Check type of URL. //error_log(__LINE__.'Now dealing with '.$doc_info[0].' of type '.$doc_info[1].'-'.$doc_info[2], 0); if ($doc_info[1] == 'remote') { // Remote file. Save url as is. $my_dep_file->setAttribute('href', $doc_info[0]); $my_dep->setAttribute('xml:base', ''); } elseif ($doc_info[1] == 'local') { switch ($doc_info[2]) { case 'url': // Local URL - save path as url for now, don't zip file. // Save file but as local file (retrieve from URL). $abs_path = api_get_path(SYS_PATH) . str_replace(api_get_path(WEB_PATH), '', $doc_info[0]); $current_dir = dirname($abs_path); $current_dir = str_replace('\\', '/', $current_dir); $file_path = realpath($abs_path); $file_path = str_replace('\\', '/', $file_path); $my_dep_file->setAttribute('href', 'document/' . $file_path); $my_dep->setAttribute('xml:base', ''); if (strstr($file_path, $main_path) !== false) { // The calculated real path is really inside the chamilo root path. // Reduce file path to what's under the DocumentRoot. $file_path = substr($file_path, strlen($root_path)); //echo $file_path;echo '<br /><br />'; //error_log('Reduced path: '.$file_path, 0); $zip_files_abs[] = $file_path; $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => 'document/' . $file_path); $my_dep_file->setAttribute('href', 'document/' . $file_path); $my_dep->setAttribute('xml:base', ''); } elseif (empty($file_path)) { /*$document_root = substr(api_get_path(SYS_PATH), 0, strpos(api_get_path(SYS_PATH),api_get_path(REL_PATH))); if (strpos($document_root,-1) == '/') { $document_root = substr(0, -1, $document_root); }*/ $file_path = $_SERVER['DOCUMENT_ROOT'] . $abs_path; $file_path = str_replace('//', '/', $file_path); if (file_exists($file_path)) { $file_path = substr($file_path, strlen($current_dir)); // We get the relative path. $zip_files[] = $my_sub_dir . '/' . $file_path; $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => 'document/' . $file_path); $my_dep_file->setAttribute('href', 'document/' . $file_path); $my_dep->setAttribute('xml:base', ''); } } break; case 'abs': // Absolute path from DocumentRoot. Save file and leave path as is in the zip. $current_dir = dirname($current_course_path . '/' . $item->get_file_path()) . '/'; $current_dir = str_replace('\\', '/', $current_dir); $file_path = realpath($doc_info[0]); $file_path = str_replace('\\', '/', $file_path); $my_dep_file->setAttribute('href', $file_path); $my_dep->setAttribute('xml:base', ''); if (strstr($file_path, $main_path) !== false) { // The calculated real path is really inside the chamilo root path. // Reduce file path to what's under the DocumentRoot. $file_path = substr($file_path, strlen($root_path)); //echo $file_path;echo '<br /><br />'; //error_log('Reduced path: '.$file_path, 0); $zip_files_abs[] = $file_path; $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path); $my_dep_file->setAttribute('href', 'document/' . $file_path); $my_dep->setAttribute('xml:base', ''); } elseif (empty($file_path)) { /*$document_root = substr(api_get_path(SYS_PATH), 0, strpos(api_get_path(SYS_PATH), api_get_path(REL_PATH))); if (strpos($document_root,-1) == '/') { $document_root = substr(0, -1, $document_root); }*/ $file_path = $_SERVER['DOCUMENT_ROOT'] . $doc_info[0]; $file_path = str_replace('//', '/', $file_path); if (file_exists($file_path)) { $file_path = substr($file_path, strlen($current_dir)); // We get the relative path. $zip_files[] = $my_sub_dir . '/' . $file_path; $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path); $my_dep_file->setAttribute('href', 'document/' . $file_path); $my_dep->setAttribute('xml:base', ''); } } break; case 'rel': // Path relative to the current document. Save xml:base as current document's directory and save file in zip as subdir.file_path if (substr($doc_info[0], 0, 2) == '..') { // Relative path going up. $current_dir = dirname($current_course_path . '/' . $item->get_file_path()) . '/'; $current_dir = str_replace('\\', '/', $current_dir); $file_path = realpath($current_dir . $doc_info[0]); $file_path = str_replace('\\', '/', $file_path); //error_log($file_path.' <-> '.$main_path, 0); if (strstr($file_path, $main_path) !== false) { // The calculated real path is really inside Chamilo's root path. // Reduce file path to what's under the DocumentRoot. $file_path = substr($file_path, strlen($root_path)); $file_path_dest = $file_path; // File path is courses/CHAMILO/document/.... $info_file_path = explode('/', $file_path); if ($info_file_path[0] == 'courses') { // Add character "/" in file path. $file_path_dest = 'document/' . $file_path; } //error_log('Reduced path: '.$file_path, 0); $zip_files_abs[] = $file_path; $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path_dest); $my_dep_file->setAttribute('href', 'document/' . $file_path); $my_dep->setAttribute('xml:base', ''); } } else { $zip_files[] = $my_sub_dir . '/' . $doc_info[0]; $my_dep_file->setAttribute('href', $doc_info[0]); $my_dep->setAttribute('xml:base', $my_xml_sub_dir); } break; default: $my_dep_file->setAttribute('href', $doc_info[0]); // ../../courses/ $my_dep->setAttribute('xml:base', ''); break; } } $my_dep->appendChild($my_dep_file); $resources->appendChild($my_dep); $dependency = $xmldoc->createElement('dependency'); $dependency->setAttribute('identifierref', $res_id); $my_resource->appendChild($dependency); $i++; } $resources->appendChild($my_resource); $zip_files[] = $my_file_path; break; default: // Get the path of the file(s) from the course directory root $my_file_path = 'non_exportable.html'; //$my_xml_file_path = api_htmlentities(api_utf8_encode($my_file_path), ENT_COMPAT, 'UTF-8'); $my_xml_file_path = $my_file_path; $my_sub_dir = dirname($my_file_path); $my_sub_dir = str_replace('\\', '/', $my_sub_dir); //$my_xml_sub_dir = api_htmlentities(api_utf8_encode($my_sub_dir), ENT_COMPAT, 'UTF-8'); $my_xml_sub_dir = $my_sub_dir; // Give a <resource> child to the <resources> element. $my_resource = $xmldoc->createElement('resource'); $my_resource->setAttribute('identifier', 'RESOURCE_' . $item->get_id()); $my_resource->setAttribute('type', 'webcontent'); $my_resource->setAttribute('href', $folder_name . '/' . $my_xml_file_path); // adlcp:scormtype can be either 'sco' or 'asset'. $my_resource->setAttribute('adlcp:scormtype', 'asset'); // xml:base is the base directory to find the files declared in this resource. $my_resource->setAttribute('xml:base', ''); // Give a <file> child to the <resource> element. $my_file = $xmldoc->createElement('file'); $my_file->setAttribute('href', 'document/' . $my_xml_file_path); $my_resource->appendChild($my_file); $resources->appendChild($my_resource); break; } } } $organizations->appendChild($organization); $root->appendChild($organizations); $root->appendChild($resources); $xmldoc->appendChild($root); // TODO: Add a readme file here, with a short description and a link to the Reload player // then add the file to the zip, then destroy the file (this is done automatically). // http://www.reload.ac.uk/scormplayer.html - once done, don't forget to close FS#138 //error_log(print_r($zip_files,true), 0); foreach ($zip_files as $file_path) { if (empty($file_path)) { continue; } //error_log(__LINE__.'getting document from '.$sys_course_path.$_course['path'].'/'.$file_path.' removing '.$sys_course_path.$_course['path'].'/',0); $dest_file = $archive_path . $temp_dir_short . '/' . $file_path; $this->create_path($dest_file); //error_log('copy '.api_get_path(SYS_COURSE_PATH).$_course['path'].'/'.$file_path.' to '.api_get_path(SYS_ARCHIVE_PATH).$temp_dir_short.'/'.$file_path,0); //echo $main_path.$file_path.'<br />'; @copy($sys_course_path . $_course['path'] . '/' . $file_path, $dest_file); // Check if the file needs a link update. if (in_array($file_path, array_keys($link_updates))) { $string = file_get_contents($dest_file); unlink($dest_file); foreach ($link_updates[$file_path] as $old_new) { //error_log('Replacing '.$old_new['orig'].' by '.$old_new['dest'].' in '.$file_path, 0); // This is an ugly hack that allows .flv files to be found by the flv player that // will be added in document/main/inc/lib/flv_player/flv_player.swf and that needs // to find the flv to play in document/main/, so we replace main/ in the flv path by // ../../.. to return from inc/lib/flv_player to the document/main path. if (substr($old_new['dest'], -3) == 'flv' && substr($old_new['dest'], 0, 5) == 'main/') { $old_new['dest'] = str_replace('main/', '../../../', $old_new['dest']); } elseif (substr($old_new['dest'], -3) == 'flv' && substr($old_new['dest'], 0, 6) == 'video/') { $old_new['dest'] = str_replace('video/', '../../../../video/', $old_new['dest']); } //Fix to avoid problems with default_course_document if (strpos("main/default_course_document", $old_new['dest'] === false)) { $new_dest = str_replace('document/', $mult . 'document/', $old_new['dest']); } else { //$new_dest = str_replace('main/default_course_document', $mult.'document/main/default_course_document', $old_new['dest']); $new_dest = $old_new['dest']; } //$string = str_replace($old_new['orig'], $old_new['dest'], $string); $string = str_replace($old_new['orig'], $new_dest, $string); //Add files inside the HTMLs $new_path = str_replace('/courses/', '', $old_new['orig']); //var_dump($sys_course_path.$new_path); var_dump($archive_path.$temp_dir_short.'/'.$old_new['dest']); echo '---'; if (file_exists($sys_course_path . $new_path)) { copy($sys_course_path . $new_path, $archive_path . $temp_dir_short . '/' . $old_new['dest']); } } file_put_contents($dest_file, $string); } } foreach ($zip_files_abs as $file_path) { if (empty($file_path)) { continue; } //error_log(__LINE__.'checking existence of '.$main_path.$file_path.'', 0); if (!is_file($main_path . $file_path) || !is_readable($main_path . $file_path)) { continue; } //error_log(__LINE__.'getting document from '.$main_path.$file_path.' removing '.api_get_path(SYS_COURSE_PATH).$_course['path'].'/', 0); $dest_file = $archive_path . $temp_dir_short . '/document/' . $file_path; $this->create_path($dest_file); //error_log('Created path '.api_get_path(SYS_ARCHIVE_PATH).$temp_dir_short.'/document/'.$file_path, 0); //error_log('copy '.api_get_path(SYS_COURSE_PATH).$_course['path'].'/'.$file_path.' to '.api_get_path(SYS_ARCHIVE_PATH).$temp_dir_short.'/'.$file_path, 0); //echo $main_path.$file_path.' - '.$dest_file.'<br />'; copy($main_path . $file_path, $dest_file); // Check if the file needs a link update. if (in_array($file_path, array_keys($link_updates))) { $string = file_get_contents($dest_file); unlink($dest_file); foreach ($link_updates[$file_path] as $old_new) { //error_log('Replacing '.$old_new['orig'].' by '.$old_new['dest'].' in '.$file_path, 0); // This is an ugly hack that allows .flv files to be found by the flv player that // will be added in document/main/inc/lib/flv_player/flv_player.swf and that needs // to find the flv to play in document/main/, so we replace main/ in the flv path by // ../../.. to return from inc/lib/flv_player to the document/main path. if (substr($old_new['dest'], -3) == 'flv' && substr($old_new['dest'], 0, 5) == 'main/') { $old_new['dest'] = str_replace('main/', '../../../', $old_new['dest']); } $string = str_replace($old_new['orig'], $old_new['dest'], $string); } file_put_contents($dest_file, $string); } } if (is_array($links_to_create)) { foreach ($links_to_create as $file => $link) { $file_content = '<!DOCTYPE html> <head> <meta charset="' . api_get_language_isocode() . '" /> <title>' . $link['title'] . '</title> </head> <body dir="' . api_get_text_direction() . '"> <div style="text-align:center"> <a href="' . $link['url'] . '">' . $link['title'] . '</a></div> </body> </html>'; file_put_contents($archive_path . $temp_dir_short . '/' . $file, $file_content); } } // Add non exportable message explanation. $lang_not_exportable = get_lang('ThisItemIsNotExportable'); $file_content = '<!DOCTYPE html> <head> <meta charset="' . api_get_language_isocode() . '" /> <title>' . $lang_not_exportable . '</title> <meta http-equiv="Content-Type" content="text/html; charset=' . api_get_system_encoding() . '" /> </head> <body dir="' . api_get_text_direction() . '">'; $file_content .= <<<EOD <style> .error-message { font-family: arial, verdana, helvetica, sans-serif; border-width: 1px; border-style: solid; left: 50%; margin: 10px auto; min-height: 30px; padding: 5px; right: 50%; width: 500px; background-color: #FFD1D1; border-color: #FF0000; color: #000; } </style> <body> <div class="error-message"> {$lang_not_exportable} </div> </body> </html> EOD; if (!is_dir($archive_path . $temp_dir_short . '/document')) { @mkdir($archive_path . $temp_dir_short . '/document', api_get_permissions_for_new_directories()); } file_put_contents($archive_path . $temp_dir_short . '/document/non_exportable.html', $file_content); // Add the extra files that go along with a SCORM package. $main_code_path = api_get_path(SYS_CODE_PATH) . 'newscorm/packaging/'; $extra_files = scandir($main_code_path); foreach ($extra_files as $extra_file) { if (strpos($extra_file, '.') === 0) { continue; } else { $dest_file = $archive_path . $temp_dir_short . '/' . $extra_file; $this->create_path($dest_file); copy($main_code_path . $extra_file, $dest_file); } } // Finalize the imsmanifest structure, add to the zip, then return the zip. $manifest = @$xmldoc->saveXML(); $manifest = Text::api_utf8_decode_xml($manifest); // The manifest gets the system encoding now. file_put_contents($archive_path . '/' . $temp_dir_short . '/imsmanifest.xml', $manifest); $zip_folder->add($archive_path . '/' . $temp_dir_short, PCLZIP_OPT_REMOVE_PATH, $archive_path . '/' . $temp_dir_short . '/'); // Clean possible temporary files. foreach ($files_cleanup as $file) { $res = unlink($file); if ($res === false) { error_log('Could not delete temp file ' . $file . ' ' . __FILE__ . ' ' . __LINE__, 0); } } // Send file to client $name = api_replace_dangerous_char($this->get_name()) . '.zip'; DocumentManager::file_send_for_download($temp_zip_file, true, $name); }
/** * Set header parameters * @param bool $sendHeaders send headers */ private function set_header_parameters($sendHeaders) { global $httpHeadXtra, $interbreadcrumb, $language_file, $_configuration, $this_section; $_course = api_get_course_info(); $help = $this->help; $nameTools = $this->title; $navigation = return_navigation_array(); $this->menu_navigation = $navigation['menu_navigation']; $this->assign('system_charset', api_get_system_encoding()); if (isset($httpHeadXtra) && $httpHeadXtra) { foreach ($httpHeadXtra as &$thisHttpHead) { header($thisHttpHead); } } $this->assign('online_button', Display::return_icon('statusonline.png', null, null, ICON_SIZE_ATOM)); $this->assign('offline_button', Display::return_icon('statusoffline.png', null, null, ICON_SIZE_ATOM)); // Get language iso-code for this page - ignore errors $this->assign('document_language', api_get_language_isocode()); $course_title = isset($_course['name']) ? $_course['name'] : null; $title_list = array(); $title_list[] = api_get_setting('platform.institution'); $title_list[] = api_get_setting('platform.site_name'); if (!empty($course_title)) { $title_list[] = $course_title; } if ($nameTools != '') { $title_list[] = $nameTools; } $title_string = ''; for ($i = 0; $i < count($title_list); $i++) { $title_string .= $title_list[$i]; if (isset($title_list[$i + 1])) { $item = trim($title_list[$i + 1]); if (!empty($item)) { $title_string .= ' - '; } } } $this->assign('title_string', $title_string); //Setting the theme and CSS files $css = $this->setCssFiles(); $this->set_js_files(); $this->setCssCustomFiles($css); //$this->set_js_files_post(); $browser = api_browser_support('check_browser'); if ($browser[0] == 'Internet Explorer' && $browser[1] >= '11') { $browser_head = '<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" />'; $this->assign('browser_specific_head', $browser_head); } // Implementation of prefetch. // See http://cdn.chamilo.org/main/img/online.png for details $prefetch = ''; if (!empty($_configuration['cdn_enable'])) { $prefetch .= '<meta http-equiv="x-dns-prefetch-control" content="on">'; foreach ($_configuration['cdn'] as $host => $exts) { $prefetch .= '<link rel="dns-prefetch" href="' . $host . '">'; } } $this->assign('prefetch', $prefetch); $this->assign('text_direction', api_get_text_direction()); $this->assign('section_name', 'section-' . $this_section); //Defaul root chamilo favicon $favico = '<link rel="shortcut icon" href="' . api_get_path(WEB_PATH) . 'favicon.ico" type="image/x-icon" />'; //Added to verify if in the current Chamilo Theme exist a favicon $favicoThemeUrl = api_get_path(SYS_CSS_PATH) . 'themes/' . $this->theme . '/images/'; //If exist pick the current chamilo theme favicon if (is_file($favicoThemeUrl . 'favicon.ico')) { $favico = '<link rel="shortcut icon" href="' . api_get_path(WEB_CSS_PATH) . 'themes/' . $this->theme . '/images/favicon.ico" type="image/x-icon" />'; } if (api_is_multiple_url_enabled()) { $access_url_id = api_get_current_access_url_id(); if ($access_url_id != -1) { $url_info = api_get_access_url($access_url_id); $url = api_remove_trailing_slash(preg_replace('/https?:\\/\\//i', '', $url_info['url'])); $clean_url = api_replace_dangerous_char($url); $clean_url = str_replace('/', '-', $clean_url); $clean_url .= '/'; $homep = api_get_path(REL_PATH) . 'home/' . $clean_url; //homep for Home Path $icon_real_homep = api_get_path(SYS_APP_PATH) . 'home/' . $clean_url; //we create the new dir for the new sites if (is_file($icon_real_homep . 'favicon.ico')) { $favico = '<link rel="shortcut icon" href="' . $homep . 'favicon.ico" type="image/x-icon" />'; } } } $this->assign('favico', $favico); $this->setHelp(); //@todo move this in the template $bug_notification_link = ''; if (api_get_setting('show_link_bug_notification') == 'true' && $this->user_is_logged_in) { $bug_notification_link = '<li class="report"> <a href="http://support.chamilo.org/projects/chamilo-18/wiki/How_to_report_bugs" target="_blank"> <img src="' . api_get_path(WEB_IMG_PATH) . 'bug.large.png" style="vertical-align: middle;" alt="' . get_lang('ReportABug') . '" title="' . get_lang('ReportABug') . '"/></a> </li>'; } $this->assign('bug_notification_link', $bug_notification_link); $notification = return_notification_menu(); $this->assign('notification_menu', $notification); $resize = ''; if (api_get_setting('accessibility_font_resize') == 'true') { $resize .= '<div class="resize_font">'; $resize .= '<div class="btn-group">'; $resize .= '<a title="' . get_lang('DecreaseFontSize') . '" href="#" class="decrease_font btn btn-default"><em class="fa fa-font"></em></a>'; $resize .= '<a title="' . get_lang('ResetFontSize') . '" href="#" class="reset_font btn btn-default"><em class="fa fa-font"></em></a>'; $resize .= '<a title="' . get_lang('IncreaseFontSize') . '" href="#" class="increase_font btn btn-default"><em class="fa fa-font"></em></a>'; $resize .= '</div>'; $resize .= '</div>'; } $this->assign('accessibility', $resize); // Preparing values for the menu // Logout link $hideLogout = api_get_setting('hide_logout_button'); if ($hideLogout === 'true') { $this->assign('logout_link', null); } else { $this->assign('logout_link', api_get_path(WEB_PATH) . 'index.php?logout=logout&uid=' . api_get_user_id()); } //Profile link if (api_get_setting('social.allow_social_tool') == 'true') { $profile_url = api_get_path(WEB_CODE_PATH) . 'social/home.php'; $profile_link = Display::url(get_lang('Profile'), $profile_url); } else { $profile_url = api_get_path(WEB_CODE_PATH) . 'auth/profile.php'; $profile_link = Display::url(get_lang('Profile'), $profile_url); } $this->assign('profile_link', $profile_link); $this->assign('profile_url', $profile_url); //Message link $message_link = null; $message_url = null; if (api_get_setting('message.allow_message_tool') == 'true') { $message_url = api_get_path(WEB_CODE_PATH) . 'messages/inbox.php'; $message_link = '<a href="' . api_get_path(WEB_CODE_PATH) . 'messages/inbox.php">' . get_lang('Inbox') . '</a>'; } $this->assign('message_link', $message_link); $this->assign('message_url', $message_url); $institution = api_get_setting('platform.institution'); $portal_name = empty($institution) ? api_get_setting('platform.site_name') : $institution; $this->assign('portal_name', $portal_name); //Menu $menu = return_menu(); $this->assign('menu', $menu); // Setting notifications $count_unread_message = 0; if (api_get_setting('message.allow_message_tool') == 'true') { // get count unread message and total invitations $count_unread_message = MessageManager::get_number_of_messages(true); } $total_invitations = 0; if (api_get_setting('social.allow_social_tool') == 'true') { $number_of_new_messages_of_friend = SocialManager::get_message_number_invitation_by_user_id(api_get_user_id()); $usergroup = new UserGroup(); $group_pending_invitations = $usergroup->get_groups_by_user(api_get_user_id(), GROUP_USER_PERMISSION_PENDING_INVITATION, false); if (!empty($group_pending_invitations)) { $group_pending_invitations = count($group_pending_invitations); } else { $group_pending_invitations = 0; } $total_invitations = intval($number_of_new_messages_of_friend) + $group_pending_invitations + intval($count_unread_message); } $total_invitations = !empty($total_invitations) ? Display::badge($total_invitations) : null; $this->assign('user_notifications', $total_invitations); // Block Breadcrumb $breadcrumb = return_breadcrumb($interbreadcrumb, $language_file, $nameTools); $this->assign('breadcrumb', $breadcrumb); //Extra content $extra_header = null; if (!api_is_platform_admin()) { $extra_header = trim(api_get_setting('header_extra_content')); } $this->assign('header_extra_content', $extra_header); if ($sendHeaders) { header('Content-Type: text/html; charset=' . api_get_system_encoding()); header('X-Powered-By: ' . $_configuration['software_name'] . ' ' . substr($_configuration['system_version'], 0, 1)); } $socialMeta = ''; $metaTitle = api_get_setting('meta_title'); if (!empty($metaTitle)) { $socialMeta .= '<meta name="twitter:card" content="summary" />' . "\n"; $socialMeta .= '<meta property="og:title" content="' . $metaTitle . '" />' . "\n"; $socialMeta .= '<meta property="og:url" content="' . api_get_path(WEB_PATH) . '" />' . "\n"; $metaDescription = api_get_setting('meta_description'); if (!empty($metaDescription)) { $socialMeta .= '<meta property="og:description" content="' . $metaDescription . '" />' . "\n"; } $metaSite = api_get_setting('meta_twitter_site'); if (!empty($metaSite)) { $socialMeta .= '<meta name="twitter:site" content="' . $metaSite . '" />' . "\n"; $metaCreator = api_get_setting('meta_twitter_creator'); if (!empty($metaCreator)) { $socialMeta .= '<meta name="twitter:creator" content="' . $metaCreator . '" />' . "\n"; } } $metaImage = api_get_setting('meta_image_path'); if (!empty($metaImage)) { if (is_file(api_get_path(SYS_PATH) . $metaImage)) { $path = api_get_path(WEB_PATH) . $metaImage; $socialMeta .= '<meta property="og:image" content="' . $path . '" />' . "\n"; } } } $this->assign('social_meta', $socialMeta); }
/** * The ajax call must contain an array of id and text * @return string */ public function toHtml() { $formatResult = $this->getAttribute('formatResult'); $formatCondition = null; if (!empty($formatResult)) { $formatCondition = ', templateResult : ' . $formatResult . ', templateSelection : ' . $formatResult; } $width = 'element'; $givenWidth = '100%'; if (!empty($givenWidth)) { $width = $givenWidth; } //Get the minimumInputLength for select2 $minimumInputLength = $this->getAttribute('minimumInputLength') > 3 ? $this->getAttribute('minimumInputLength') : 3; $plHolder = $this->getAttribute('placeholder'); if (empty($plHolder)) { $plHolder = get_lang('SelectAnOption'); } $id = $this->getAttribute('id'); if (empty($id)) { $id = $this->getAttribute('name'); $this->setAttribute('id', $id); } //$iso = Container $url = $this->getAttribute('url'); $iso = api_get_language_isocode(); $languageCondition = "language: '{$iso}',"; if (!$url) { $url = $this->getAttribute('url_function'); } else { $url = "'{$url}'"; } $html = <<<JS <script> \$(function(){ \$('#{$this->getAttribute('id')}').select2({ {$languageCondition} placeholder: '{$plHolder}', allowClear: true, width: '{$width}', minimumInputLength: '{$minimumInputLength}', ajax: { url: {$url}, dataType: 'json', data: function(params) { return { q: params.term, // search term page_limit: 10, }; }, processResults: function (data, page) { //parse the results into the format expected by Select2 return { results: data.items }; } {$formatCondition} } }); }); </script> JS; $this->removeAttribute('formatResult'); $this->removeAttribute('minimumInputLength'); $this->removeAttribute('placeholder'); $this->removeAttribute('class'); $this->removeAttribute('url'); $this->removeAttribute('url_function'); $this->setAttribute('style', 'width: 100%;'); return parent::toHtml() . $html; }
function return_help() { $user_selected_language = api_get_language_isocode(); $sys_path = api_get_path(SYS_PATH); $platformLanguage = api_get_setting('language.platform_language'); // Help section. /* Hide right menu "general" and other parts on anonymous right menu. */ if (!isset($user_selected_language)) { $user_selected_language = $platformLanguage; } $html = null; $home_menu = @(string) file_get_contents($sys_path . $this->home . 'home_menu_' . $user_selected_language . '.html'); if (!empty($home_menu)) { $home_menu_content = '<ul class="nav nav-pills nav-stacked">'; $home_menu_content .= api_to_system_encoding($home_menu, api_detect_encoding(strip_tags($home_menu))); $home_menu_content .= '</ul>'; $html .= self::show_right_block(get_lang('MenuGeneral'), $home_menu_content, 'help_block', null, 'helps', 'helpsCollapse'); } return $html; }
foreach ($_languages['name'] as $key => $value) { $english_name = $_languages['folder'][$key]; if ($language == $english_name) { $html .= '<option value="' . $english_name . '" selected="selected">' . $value . '</option>'; } else { $html .= '<option value="' . $english_name . '">' . $value . '</option>'; } } $html .= '</select></td></tr>'; $form->addElement('html', $html); } $default[$name] = str_replace('{rel_path}', api_get_path(REL_PATH), $open); $form->addHtmlEditor($name, '', true, false, array('ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400')); $form->addElement('checkbox', 'all_langs', null, get_lang('ApplyAllLanguages'), array('id' => 'all_langs')); $form->addElement('html', '<table id="table_langs" style="margin-left:5px;"><tr>'); $currentLanguage = api_get_language_isocode(); $i = 0; foreach ($_languages['name'] as $key => $value) { $lang_name = $_languages['folder'][$key]; $i++; $checked = null; if ($languageGet == $lang_name) { $checked = "checked"; } $html_langs = '<td width="300">'; $html_langs .= '<label><input type="checkbox" ' . $checked . ' id="lang" name="' . $lang_name . '" /> ' . $value . '<label/>'; $html_langs .= '</td>'; if ($i % 5 == 0) { $html_langs .= '</tr><tr>'; } $form->addElement('html', $html_langs);
/** * Converts the classic chamilo lang into folders example: locale/trad4all/en.po, locale/trad4all/es.po, etc * @param string $destinationLanguage Chamilo language 'spanish', 'french', etc * @param OutputInterface $output */ private function convertLanguageToGettextDivideInFolders($destinationLanguage, OutputInterface $output) { /** @var \Silex\Application $app */ $app = $this->getApplication()->getSilexApplication(); //$tempPath = $app['paths']['path.temp'].'langs'; $tempPath = $app['paths']['sys_root'] . 'main/locale'; if (!is_dir($tempPath)) { mkdir($tempPath); $output->writeln('<info>folder $tempPath created </info>'); } $isocode = api_get_language_isocode($destinationLanguage); $englishPath = $app['paths']['root_sys'] . 'main/lang/english/'; // Translate this language. $toLanguagePath = $app['paths']['root_sys'] . 'main/lang/' . $destinationLanguage; if (is_dir($englishPath)) { if ($dh = opendir($englishPath)) { while (($file = readdir($dh)) !== false) { $info = pathinfo($file); if ($info['extension'] != 'php') { continue; } $info['filename'] = explode('.', $info['filename']); $info['filename'] = $info['filename'][0]; if ($info['filename'] != 'admin') { //continue; } $translations = array(); $filename = $englishPath . '/' . $file; $po = file($filename); if (!file_exists($filename) || !file_exists($toLanguagePath . '/' . $file)) { continue; } foreach ($po as $line) { $pos = strpos($line, '='); if ($pos) { $variable = substr($line, 1, $pos - 1); $variable = trim($variable); require $filename; $my_variable_in_english = ${$variable}; require $toLanguagePath . '/' . $file; $my_variable = ${$variable}; /** This fixes a notice due an array in the lang files */ if (strpos($variable, 'langNameOfLang') === false) { $translations[] = array('msgid' => $variable, 'msgstr' => $my_variable); } else { continue; } } } if (!is_dir($tempPath . '/' . $info['filename'])) { mkdir($tempPath . '/' . $info['filename']); $output->writeln('<info>folder ' . $tempPath . '/' . $info['filename'] . ' created </info>'); } $new_po_file = $tempPath . '/' . $info['filename'] . '/' . $isocode . '.po'; $fp = fopen($new_po_file, 'w'); $header = 'msgid ""' . "\n" . 'msgstr ""' . "\n" . '"Content-Type: text/plain; charset=utf-8 \\n"'; fwrite($fp, $header); fwrite($fp, "\n\n"); foreach ($translations as $item) { $line = 'msgid "' . addslashes($item['msgid']) . '"' . "\n"; $translated = $item['msgstr']; $translated = addslashes($translated); $translated = str_replace(array("\\'"), "'", $translated); $line .= 'msgstr "' . $translated . '"' . "\n\n"; fwrite($fp, $line); } fclose($fp); $message = "File {$file} converted to " . $new_po_file; $output->writeln($message); } closedir($dh); } } }
$po = file($phpFilePath); $translations = array(); $englishFile = $englishDir . '/' . $phpFile->getBasename(); foreach ($po as $line) { $pos = strpos($line, '='); if ($pos) { $variable = substr($line, 1, $pos - 1); $variable = trim($variable); require $englishFile; $my_variable_in_english = $variable; require $phpFilePath; $my_variable = ${$variable}; $translations[] = array('msgid' => $my_variable_in_english, 'msgstr' => $my_variable); } } $code = api_get_language_isocode($folder->getBasename()); //LC_MESSAGES $new_po_file = $save_path . $folder->getBasename() . '/' . $phpFile->getBasename('.php') . '.po'; if (!is_dir($save_path . $folder->getBasename())) { mkdir($save_path . $folder->getBasename()); } $fp = fopen($new_po_file, 'w'); foreach ($translations as $item) { $line = 'msgid "' . addslashes($item['msgid']) . '"' . "\n"; $line .= 'msgstr "' . addslashes($item['msgstr']) . '"' . "\n\n"; fwrite($fp, $line); } fclose($fp); } if ($folder->getBasename() == 'bosnian') { //exit;
} $tbl_admin_languages = Database::get_main_table(TABLE_MAIN_LANGUAGE); $sql_select = "SELECT * FROM {$tbl_admin_languages}"; $result_select = Database::query($sql_select); $options = $options_pedia = array(); $selected_language = null; while ($row = Database::fetch_array($result_select)) { $options[$row['isocode']] = $row['original_name'] . ' (' . $row['english_name'] . ')'; if (in_array($row['isocode'], array('de', 'en', 'es', 'fr'))) { $options_pedia[$row['isocode']] = $row['original_name'] . ' (' . $row['english_name'] . ')'; } } $icon = Display::return_icon('text2audio.png', get_lang('HelpText2Audio'), '', ICON_SIZE_MEDIUM); echo '<div class="page-header"><h2>' . $icon . get_lang('HelpText2Audio') . '</h2></div>'; if (Security::remove_XSS($_GET['dt2a']) == 'google') { $selected_language = api_get_language_isocode(); //lang default is the course language echo '<div>'; $form = new FormValidator('form1', 'post', null, '', array('id' => 'form1')); $form->addElement('hidden', 'text2voice_mode', 'google'); $form->addElement('hidden', 'id', $document_id); $form->addElement('text', 'title', get_lang('Title')); $form->addElement('select', 'lang', get_lang('Language'), $options); $form->addElement('textarea', 'text', get_lang('InsertText2Audio'), array('id' => 'textarea_google')); //echo Display :: return_icon('info3.gif', get_lang('HelpGoogleAudio'), array('align' => 'absmiddle', 'hspace' => '3px'), false); $form->addButtonSave(get_lang('SaveMP3')); $defaults = array(); $defaults['lang'] = $selected_language; $form->setDefaults($defaults); $form->display(); echo '</div>';
/** * Returns formatted date/time, correspondent to a given language. * The given date should be in the timezone chosen by the administrator * and/or user. Use api_get_local_time to get it. * * @author Patrick Cool <*****@*****.**>, Ghent University * @author Christophe Gesche<*****@*****.**> * originally inspired from from PhpMyAdmin * @author Ivan Tcholakov, 2009, code refactoring, adding support for predefined date/time formats. * @author Guillaume Viguier <*****@*****.**> * * @param mixed Timestamp or datetime string * @param mixed Date format (string or int; see date formats in the Chamilo system: TIME_NO_SEC_FORMAT, DATE_FORMAT_SHORT, DATE_FORMAT_LONG, DATE_TIME_FORMAT_LONG) * @param string $language (optional) Language identificator. If it is omited, the current interface language is assumed. * @return string Returns the formatted date. * * @link http://php.net/manual/en/function.strftime.php */ function api_format_date($time, $format = null, $language = null) { $system_timezone = date_default_timezone_get(); date_default_timezone_set(_api_get_timezone()); if (is_string($time)) { $time = strtotime($time); } if (is_null($format)) { $format = DATE_TIME_FORMAT_LONG; } $datetype = null; $timetype = null; if (is_int($format)) { switch ($format) { case DATE_FORMAT_ONLY_DAYNAME: $date_format = get_lang('dateFormatOnlyDayName', '', $language); if (INTL_INSTALLED) { $datetype = IntlDateFormatter::SHORT; $timetype = IntlDateFormatter::NONE; } break; case DATE_FORMAT_NUMBER_NO_YEAR: $date_format = get_lang('dateFormatShortNumberNoYear', '', $language); if (INTL_INSTALLED) { $datetype = IntlDateFormatter::SHORT; $timetype = IntlDateFormatter::NONE; } break; case DATE_FORMAT_NUMBER: $date_format = get_lang('dateFormatShortNumber', '', $language); if (INTL_INSTALLED) { $datetype = IntlDateFormatter::SHORT; $timetype = IntlDateFormatter::NONE; } break; case TIME_NO_SEC_FORMAT: $date_format = get_lang('timeNoSecFormat', '', $language); if (INTL_INSTALLED) { $datetype = IntlDateFormatter::NONE; $timetype = IntlDateFormatter::SHORT; } break; case DATE_FORMAT_SHORT: $date_format = get_lang('dateFormatShort', '', $language); if (INTL_INSTALLED) { $datetype = IntlDateFormatter::LONG; $timetype = IntlDateFormatter::NONE; } break; case DATE_FORMAT_LONG: $date_format = get_lang('dateFormatLong', '', $language); if (INTL_INSTALLED) { $datetype = IntlDateFormatter::FULL; $timetype = IntlDateFormatter::NONE; } break; case DATE_TIME_FORMAT_LONG: $date_format = get_lang('dateTimeFormatLong', '', $language); if (INTL_INSTALLED) { $datetype = IntlDateFormatter::FULL; $timetype = IntlDateFormatter::SHORT; } break; case DATE_FORMAT_LONG_NO_DAY: $date_format = get_lang('dateFormatLongNoDay', '', $language); if (INTL_INSTALLED) { $datetype = IntlDateFormatter::FULL; $timetype = IntlDateFormatter::SHORT; } break; case DATE_TIME_FORMAT_SHORT: $date_format = get_lang('dateTimeFormatShort', '', $language); if (INTL_INSTALLED) { $datetype = IntlDateFormatter::FULL; $timetype = IntlDateFormatter::SHORT; } break; case DATE_TIME_FORMAT_SHORT_TIME_FIRST: $date_format = get_lang('dateTimeFormatShortTimeFirst', '', $language); if (INTL_INSTALLED) { $datetype = IntlDateFormatter::FULL; $timetype = IntlDateFormatter::SHORT; } break; case DATE_TIME_FORMAT_LONG_24H: $date_format = get_lang('dateTimeFormatLong24H', '', $language); if (INTL_INSTALLED) { $datetype = IntlDateFormatter::FULL; $timetype = IntlDateFormatter::SHORT; } break; default: $date_format = get_lang('dateTimeFormatLong', '', $language); if (INTL_INSTALLED) { $datetype = IntlDateFormatter::FULL; $timetype = IntlDateFormatter::SHORT; } } } else { $date_format = $format; } if (0) { //if using PHP 5.3 format dates like: $dateFormatShortNumber, can't be used // // Use ICU if (is_null($language)) { $language = api_get_language_isocode(); } $date_formatter = new IntlDateFormatter($language, $datetype, $timetype, date_default_timezone_get()); //$date_formatter->setPattern($date_format); $formatted_date = api_to_system_encoding($date_formatter->format($time), 'UTF-8'); } else { // We replace %a %A %b %B masks of date format with translated strings $translated =& _api_get_day_month_names($language); $date_format = str_replace(array('%A', '%a', '%B', '%b'), array($translated['days_long'][(int) strftime('%w', $time)], $translated['days_short'][(int) strftime('%w', $time)], $translated['months_long'][(int) strftime('%m', $time) - 1], $translated['months_short'][(int) strftime('%m', $time) - 1]), $date_format); $formatted_date = api_to_system_encoding(strftime($date_format, $time), 'UTF-8'); } date_default_timezone_set($system_timezone); return $formatted_date; }
/** * Returns formatted date/time, correspondent to a given language. * The given date should be in the timezone chosen by the administrator and/or user. Use api_get_local_time to get it. * * @author Patrick Cool <*****@*****.**>, Ghent University * @author Christophe Gesche<*****@*****.**> * originally inspired from from PhpMyAdmin * @author Ivan Tcholakov, 2009, code refactoring, adding support for predefined date/time formats. * @author Guillaume Viguier <*****@*****.**> * * @param mixed Timestamp or datetime string * @param mixed Date format (string or int; see date formats in the Chamilo system: TIME_NO_SEC_FORMAT, DATE_FORMAT_SHORT, DATE_FORMAT_LONG, DATE_TIME_FORMAT_LONG) * @param string $language (optional) Language indentificator. If it is omited, the current interface language is assumed. * @return string Returns the formatted date. * * @link http://php.net/manual/en/function.strftime.php */ function api_format_date($time, $format = null, $language = null) { if (is_string($time)) { $time = strtotime($time); } if (is_null($format)) { $format = DATE_TIME_FORMAT_LONG; } $datetype = null; $timetype = null; if (is_int($format)) { switch ($format) { case DATE_FORMAT_ONLY_DAYNAME: $datetype = IntlDateFormatter::SHORT; $timetype = IntlDateFormatter::NONE; break; case DATE_FORMAT_NUMBER_NO_YEAR: $datetype = IntlDateFormatter::SHORT; $timetype = IntlDateFormatter::NONE; break; case DATE_FORMAT_NUMBER: $datetype = IntlDateFormatter::SHORT; $timetype = IntlDateFormatter::NONE; break; case TIME_NO_SEC_FORMAT: $datetype = IntlDateFormatter::NONE; $timetype = IntlDateFormatter::SHORT; break; case DATE_FORMAT_SHORT: $datetype = IntlDateFormatter::LONG; $timetype = IntlDateFormatter::NONE; break; case DATE_FORMAT_LONG: $datetype = IntlDateFormatter::FULL; $timetype = IntlDateFormatter::NONE; break; case DATE_TIME_FORMAT_LONG: $datetype = IntlDateFormatter::FULL; $timetype = IntlDateFormatter::SHORT; break; case DATE_FORMAT_LONG_NO_DAY: $datetype = IntlDateFormatter::FULL; $timetype = IntlDateFormatter::SHORT; break; case DATE_TIME_FORMAT_SHORT: $datetype = IntlDateFormatter::FULL; $timetype = IntlDateFormatter::SHORT; break; case DATE_TIME_FORMAT_SHORT_TIME_FIRST: $datetype = IntlDateFormatter::FULL; $timetype = IntlDateFormatter::SHORT; break; case DATE_TIME_FORMAT_LONG_24H: $datetype = IntlDateFormatter::FULL; $timetype = IntlDateFormatter::SHORT; break; default: $datetype = IntlDateFormatter::FULL; $timetype = IntlDateFormatter::SHORT; } } // Use ICU if (is_null($language)) { $language = api_get_language_isocode(); } $date_formatter = new IntlDateFormatter($language, $datetype, $timetype, date_default_timezone_get()); $formatted_date = api_to_system_encoding($date_formatter->format($time), 'UTF-8'); return $formatted_date; }
/** * @deprecated Use api_get_language_isocode($language) instead. */ public static function get_language_isocode($language) { return api_get_language_isocode($language); }
} $id = explode('_', $_GET['id']); $type = $id[0]; $id = $id[1]; $agenda = new Agenda(); $agenda->type = $type; //course,admin or personal if (isset($_GET['course_id'])) { $course_info = api_get_course_info_by_id($_GET['course_id']); if (!empty($course_info)) { $agenda->set_course($course_info); } } $event = $agenda->get_event($id); if (!empty($event)) { define('ICAL_LANG', api_get_language_isocode()); $ical = new vcalendar(); $ical->setConfig('unique_id', api_get_path(WEB_PATH)); $ical->setProperty('method', 'PUBLISH'); $ical->setConfig('url', api_get_path(WEB_PATH)); $vevent = new vevent(); switch ($_GET['class']) { case 'public': $vevent->setClass('PUBLIC'); break; case 'private': $vevent->setClass('PRIVATE'); break; case 'confidential': $vevent->setClass('CONFIDENTIAL'); break;
// Moved here to include extra fields when creating a user. Formerly placed after user creation // Register extra fields $extras = array(); foreach ($values as $key => $value) { if (substr($key, 0, 6) == 'extra_') { //an extra field $extras[substr($key, 6)] = $value; } elseif (strpos($key, 'remove_extra_') !== false) { $extra_value = Security::filter_filename(urldecode(key($value))); // To remove from user_field_value and folder UserManager::update_extra_field_value($user_id, substr($key, 13), $extra_value); } } $status = isset($values['status']) ? $values['status'] : STUDENT; $phone = isset($values['phone']) ? $values['phone'] : null; $values['language'] = isset($values['language']) ? $values['language'] : api_get_language_isocode(); // Creates a new user $user_id = UserManager::create_user($values['firstname'], $values['lastname'], $status, $values['email'], $values['username'], $values['pass1'], $values['official_code'], $values['language'], $phone, null, PLATFORM_AUTH_SOURCE, null, 1, 0, $extras, null, true); //update the extra fields $count_extra_field = count($extras); if ($count_extra_field > 0) { foreach ($extras as $key => $value) { // For array $value -> if exists key 'tmp_name' then must not be empty // This avoid delete from user field value table when doesn't upload a file if (is_array($value)) { if (array_key_exists('tmp_name', $value) && empty($value['tmp_name'])) { //Nothing to do } else { if (array_key_exists('tmp_name', $value)) { $value['tmp_name'] = Security::filter_filename($value['tmp_name']); }
// Interbreadcrumb for the current directory root path if (empty($document_data['parents'])) { $interbreadcrumb[] = array('url' => '#', 'name' => $document_data['title']); } else { foreach ($document_data['parents'] as $document_sub_data) { $interbreadcrumb[] = array('url' => $document_sub_data['document_url'], 'name' => $document_sub_data['title']); } } Display::display_header($nameTools, 'Doc'); echo '<div class="actions">'; echo '<a href="document.php?id=' . $document_id . '">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('DocumentsOverview'), '', ICON_SIZE_MEDIUM) . '</a>'; echo '</div>'; if (api_browser_support('svg')) { //automatic loading the course language $svgedit_code_translation_table = array('' => 'en', 'pt' => 'pt-Pt', 'sr' => 'sr_latn'); $langsvgedit = api_get_language_isocode(); $langsvgedit = isset($svgedit_code_translation_table[$langsvgedit]) ? $svgedit_code_translation_table[$langsvgedit] : $langsvgedit; $langsvgedit = file_exists(api_get_path(LIBRARY_PATH) . 'svg-edit/locale/lang.' . $langsvgedit . '.js') ? $langsvgedit : 'en'; $svg_url = api_get_path(WEB_LIBRARY_PATH) . 'svg-edit/svg-editor.php?lang=' . $langsvgedit; ?> <script> document.write ('<iframe id="frame" frameborder="0" scrolling="no" src="<?php echo $svg_url; ?> " width="100%" height="100%"><noframes><p>Sorry, your browser does not handle frames</p></noframes></iframe>'); function resizeIframe() { var height = window.innerHeight -50; //max lower size if (height<550) { height=550; }
function channel() { $result = (object) array(); $result->title = $this->get_title(); $result->description = $this->get_description(); $result->link = Uri::www(); $result->last_build_date = time(); $result->language = api_get_language_isocode(); $result->update_period = 'hourly'; $result->update_frequency = 1; $result->generator = Uri::chamilo(); $items = $this->get_query()->get_items(); $items = $this->format($items); $result->items = $items; return $result; }
echo get_lang('ActivateEvent'); ?> </label> </span> <br /> <select id="languages" name="languages" style="margin-top:20px;" onclick='confirmMessage(this.name); return false;'> <?php foreach ($languages["name"] as $key => $value) { $english_name = $languages['folder'][$key]; ?> <option value="<?php echo $english_name; ?> " <?php echo $english_name == api_get_language_isocode() ? "selected=selected" : ""; ?> ><?php echo $value; ?> </option> <?php } ?> </select> <input type="hidden" name="action" value="modEventType" /> <input type="hidden" name="eventId" id="eventId" /> <input type="hidden" name="eventUsers" id="eventUsers" /> <input type="hidden" id="eventName" value="<?php echo $event_name;
/** * Returns an HTML block with the notice, as found in the * home/home_notice_[lang].html file * @return string HTML <div> block */ public function returnNotice() { $sys_path = api_get_path(SYS_PATH); $user_selected_language = api_get_language_isocode(); $home = api_get_home_path(); // Notice $home_notice = @(string) file_get_contents($sys_path . $home . 'home_notice_' . $user_selected_language . '.html'); if (empty($home_notice)) { $home_notice = @(string) file_get_contents($sys_path . $home . 'home_notice.html'); } if (!empty($home_notice)) { $home_notice = api_to_system_encoding($home_notice, api_detect_encoding(strip_tags($home_notice))); $home_notice = Display::div($home_notice, array('class' => 'homepage_notice')); $this->show_right_block(get_lang('Notice'), null, 'notice_block', array('content' => $home_notice)); } }
/** * The ajax call must contain an array of id and text * @return string */ function toHtml() { $html = api_get_asset('select2/dist/js/select2.min.js'); $iso = api_get_language_isocode(api_get_interface_language()); $languageCondition = ''; if (file_exists(api_get_path(SYS_PATH) . "web/assets/select2/dist/js/i18n/{$iso}.js")) { $html .= api_get_asset("select2/dist/js/i18n/{$iso}.js"); $languageCondition = "language: '{$iso}',"; } $html .= api_get_css(api_get_path(WEB_PATH) . 'web/assets/select2/dist/css/select2.min.css'); $formatResult = $this->getAttribute('formatResult'); $formatCondition = null; if (!empty($formatResult)) { $formatCondition = ', templateResult : ' . $formatResult . ', templateSelection : ' . $formatResult; } $defaultValues = $this->getAttribute('defaults'); $defaultValues = empty($defaultValues) ? [] : $defaultValues; $width = 'element'; $givenWidth = $this->getAttribute('width'); if (!empty($givenWidth)) { $width = $givenWidth; } //Get the minimumInputLength for select2 $minimumInputLength = $this->getAttribute('minimumInputLength') > 3 ? $this->getAttribute('minimumInputLength') : 3; $plHolder = $this->getAttribute('placeholder'); if (empty($plHolder)) { $plHolder = get_lang('SelectAnOption'); } $html .= <<<JS <script> \$(function(){ \$('#{$this->getAttribute('name')}').select2({ {$languageCondition} placeholder_: '{$plHolder}', allowClear: true, width: '{$width}', minimumInputLength: '{$minimumInputLength}', // instead of writing the function to execute the request we use Select2s convenient helper ajax: { url: '{$this->getAttribute('url')}', dataType: 'json', data: function(params) { return { q: params.term, // search term page_limit: 10, }; }, processResults: function (data, page) { //parse the results into the format expected by Select2 return { results: data.items }; } {$formatCondition} } }); }); </script> JS; $html .= Display::select($this->getAttribute('name'), $defaultValues, array_keys($defaultValues), ['id' => $this->getAttribute('name'), 'style' => 'width: 100%;'], false); return $html; }
/** * Returns the jquery library js and css headers * * @param array list of jquery libraries supported jquery-ui, jqgrid * @param bool add the jquery library * @return string html tags * */ function api_get_jquery_libraries_js($libraries) { $js = ''; //jqgrid js and css if (in_array('jqgrid', $libraries)) { $languaje = 'en'; $platform_isocode = strtolower(api_get_language_isocode()); //languages supported by jqgrid see files in main/inc/lib/javascript/jqgrid/js/i18n $jqgrid_langs = array('bg', 'bg1251', 'cat', 'cn', 'cs', 'da', 'de', 'el', 'en', 'es', 'fa', 'fi', 'fr', 'gl', 'he', 'hu', 'is', 'it', 'ja', 'nl', 'no', 'pl', 'pt-br', 'pt', 'ro', 'ru', 'sk', 'sr', 'sv', 'tr', 'ua'); if (in_array($platform_isocode, $jqgrid_langs)) { $languaje = $platform_isocode; } //$js .= '<link rel="stylesheet" href="'.$js_path.'jqgrid/css/ui.jqgrid.css" type="text/css">'; $js .= api_get_css('components/jqgrid/css/ui.jqgrid.css'); $js .= api_get_css('components/jqgrid/js/i18n/grid.locale-' . $languaje . '.js'); $js .= api_get_js('components/jqgrid/js/minified/jquery.jqGrid.min.js'); } //Document multiple upload funcionality /* if (in_array('jquery-upload', $libraries)) { $js .= api_get_js('jquery-upload/jquery.fileupload.js'); $js .= api_get_js('jquery-upload/jquery.fileupload-ui.js'); $js .= api_get_css($js_path.'jquery-upload/jquery.fileupload-ui.css'); }*/ // jquery datepicker if (in_array('datepicker', $libraries)) { $languaje = 'en-GB'; $platform_isocode = strtolower(api_get_language_isocode()); // languages supported by jqgrid see files in main/inc/lib/javascript/jqgrid/js/i18n $datapicker_langs = array('af', 'ar', 'ar-DZ', 'az', 'bg', 'bs', 'ca', 'cs', 'cy-GB', 'da', 'de', 'el', 'en-AU', 'en-GB', 'en-NZ', 'eo', 'es', 'et', 'eu', 'fa', 'fi', 'fo', 'fr', 'fr-CH', 'gl', 'he', 'hi', 'hr', 'hu', 'hy', 'id', 'is', 'it', 'ja', 'ka', 'kk', 'km', 'ko', 'lb', 'lt', 'lv', 'mk', 'ml', 'ms', 'nl', 'nl-BE', 'no', 'pl', 'pt', 'pt-BR', 'rm', 'ro', 'ru', 'sk', 'sl', 'sq', 'sr', 'sr-SR', 'sv', 'ta', 'th', 'tj', 'tr', 'uk', 'vi', 'zh-CN', 'zh-HK', 'zh-TW'); if (in_array($platform_isocode, $datapicker_langs)) { $languaje = $platform_isocode; } $js .= api_get_js('components/jquery-ui/jquery-ui-i18n.min.js'); $script = '<script> $(function(){ $.datepicker.setDefaults($.datepicker.regional["' . $languaje . '"]); $.datepicker.regional["local"] = $.datepicker.regional["' . $languaje . '"]; }); </script> '; $js .= $script; } return $js; }
* Initialization is to be done by lp_controller.php. */ /** * Switching within the field to update */ $msg = $_SESSION['oLP']->get_message(); error_log('New LP - Loaded lp_save : ' . $_SERVER['REQUEST_URI'] . ' from ' . $_SERVER['HTTP_REFERER'], 0); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo api_get_language_isocode(); ?> " lang="<?php echo api_get_language_isocode(); ?> "> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo api_get_system_encoding(); ?> " /> <script language='javascript'> <?php if ($_SESSION['oLP']->mode != 'fullscreen') { } ?> </script> </head>
/** * Returns an array of translated week days and months, short and normal names. * @param string $language (optional) Language id. If it is omitted, the current interface language is assumed. * @return array Returns a multidimensional array with translated week days and months. */ function &_api_get_day_month_names($language = null) { static $date_parts = array(); if (empty($language)) { $language = api_get_language_isocode(); } if (!isset($date_parts[$language])) { $week_day = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'); $month = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); for ($i = 0; $i < 7; $i++) { $date_parts[$language]['days_short'][] = get_lang($week_day[$i] . 'Short', '', $language); $date_parts[$language]['days_long'][] = get_lang($week_day[$i] . 'Long', '', $language); } for ($i = 0; $i < 12; $i++) { $date_parts[$language]['months_short'][] = get_lang($month[$i] . 'Short', '', $language); $date_parts[$language]['months_long'][] = get_lang($month[$i] . 'Long', '', $language); } } return $date_parts[$language]; }
} } } if ($user_info['user_id'] == api_get_user_id()) { $isSelfUser = true; } else { $isSelfUser = false; } $userIsOnline = user_is_online($user_id); $libpath = api_get_path(LIBRARY_PATH); require_once $libpath . 'magpierss/rss_fetch.inc'; $ajax_url = api_get_path(WEB_AJAX_PATH) . 'message.ajax.php'; $socialAjaxUrl = api_get_path(WEB_AJAX_PATH) . 'social.ajax.php'; $javascriptDir = api_get_path(LIBRARY_PATH) . 'javascript/'; api_block_anonymous_users(); $locale = api_get_language_isocode(); // Add Jquery scroll pagination plugin $htmlHeadXtra[] = api_get_js('jscroll/jquery.jscroll.js'); // Add Jquery Time ago plugin $htmlHeadXtra[] = api_get_asset('jquery-timeago/jquery.timeago.js'); $timeAgoLocaleDir = $javascriptDir . 'jquery-timeago/locales/jquery.timeago.' . $locale . '.js'; if (file_exists($timeAgoLocaleDir)) { $htmlHeadXtra[] = api_get_js('jquery-timeago/locales/jquery.timeago.' . $locale . '.js'); } $htmlHeadXtra[] = '<script> $(document).ready(function (){ var container = $("#wallMessages"); container.jscroll({ loadingHtml: "<div class=\\"well_border\\">' . get_lang('Loading') . ' </div>", nextSelector: "a.nextPage:last",
break; } //Setting translations $day_short = api_get_week_days_short(); $days = api_get_week_days_long(); $months = api_get_months_long(); $months_short = api_get_months_short(); //Setting calendar translations $tpl->addGlobal('month_names', json_encode($months)); $tpl->addGlobal('month_names_short', json_encode($months_short)); $tpl->addGlobal('day_names', json_encode($days)); $tpl->addGlobal('day_names_short', json_encode($day_short)); $tpl->addGlobal('button_text', json_encode(array('today' => get_lang('Today'), 'month' => get_lang('Month'), 'week' => get_lang('Week'), 'day' => get_lang('Day')))); //see http://docs.jquery.com/UI/Datepicker/$.datepicker.formatDate $tpl->addGlobal('js_format_date', 'D d M yy'); $region_value = api_get_language_isocode(); if ($region_value == 'en') { $region_value = 'en-GB'; } $tpl->addGlobal('region_value', $region_value); $export_icon = api_get_path(WEB_IMG_PATH) . 'img/export.png'; $export_icon_low = api_get_path(WEB_IMG_PATH) . 'img/export_low_fade.png'; $export_icon_high = api_get_path(WEB_IMG_PATH) . 'img/export_high_fade.png'; $tpl->addGlobal('export_ical_confidential_icon', Display::return_icon($export_icon_high, get_lang('ExportiCalConfidential'))); $actions = $agenda->displayActions('calendar', $userId); $tpl->addGlobal('actions', $actions); // Calendar Type : course, admin, personal $tpl->addGlobal('type', $type); $type_event_class = $type . '_event'; $type_label = get_lang(ucfirst($type) . 'Calendar'); if ($type == 'course' && !empty($group_id)) {