/** * Returns an HTML block with the user picture (as a link in a <div>) * @param int User ID (if not provided, will use the user ID from session) * @return string HTML div with a link to the user's profile * @uses UserManager::get_user_pictur_path_by_id() to get the image path * @uses UserManager::get_picture_user() to get the details of the image in a specific format * @uses PageController::show_right_block() to include the image in a larger user block */ public function setUserImageBlock($user_id = null) { if (empty($user_id)) { $user_id = api_get_user_id(); } //Always show the user image $img_array = UserManager::get_user_picture_path_by_id($user_id, 'web', true, true); $no_image = false; if ($img_array['file'] == 'unknown.jpg') { $no_image = true; } $img_array = UserManager::get_picture_user($user_id, $img_array['file'], 100, USER_IMAGE_SIZE_ORIGINAL); $profile_content = null; if (api_get_setting('social.allow_social_tool') == 'true') { if (!$no_image) { $profile_content .= '<a style="text-align:center" href="' . api_get_path(WEB_CODE_PATH) . 'social/home.php"> <img src="' . $img_array['file'] . '"></a>'; } else { $profile_content .= '<a style="text-align:center" href="' . Container::getRouter()->generate('fos_user_profile_edit') . '"> <img title="' . get_lang('EditProfile') . '" src="' . $img_array['file'] . '"></a>'; } } if (!empty($profile_content)) { $this->show_right_block(null, null, 'user_image_block', array('content' => $profile_content)); } }
/** * @param string $name * @param Request $request * @return Response */ public function classicAction($name, Request $request) { // get. $_GET = $request->query->all(); // post. $_POST = $request->request->all(); $rootDir = $this->get('kernel')->getRealRootDir(); //$_REQUEST = $request->request->all(); $mainPath = $rootDir . 'main/'; $fileToLoad = $mainPath . $name; // Setting legacy values inside the container /** @var Connection $dbConnection */ $dbConnection = $this->container->get('database_connection'); $em = $this->get('kernel')->getContainer()->get('doctrine.orm.entity_manager'); $database = new \Database($dbConnection, array()); $database->setConnection($dbConnection); $database->setManager($em); Container::$container = $this->container; Container::$dataDir = $this->container->get('kernel')->getDataDir(); Container::$courseDir = $this->container->get('kernel')->getDataDir(); //Container::$configDir = $this->container->get('kernel')->getConfigDir(); $this->container->get('twig')->addGlobal('api_get_cidreq', api_get_cidreq()); //$breadcrumb = $this->container->get('chamilo_core.block.breadcrumb'); if (is_file($fileToLoad) && \Security::check_abs_path($fileToLoad, $mainPath)) { // Files inside /main need this variables to be set $is_allowed_in_course = api_is_allowed_in_course(); $is_courseAdmin = api_is_course_admin(); $is_platformAdmin = api_is_platform_admin(); $toolNameFromFile = basename(dirname($fileToLoad)); $charset = 'UTF-8'; // Default values $_course = api_get_course_info(); $_user = api_get_user_info(); $debug = $this->container->get('kernel')->getEnvironment() == 'dev' ? true : false; // Loading file ob_start(); require_once $fileToLoad; $out = ob_get_contents(); ob_end_clean(); // No browser cache when executing an exercise. if ($name == 'exercice/exercise_submit.php') { $responseHeaders = array('cache-control' => 'no-store, no-cache, must-revalidate'); } $js = isset($htmlHeadXtra) ? $htmlHeadXtra : array(); // $interbreadcrumb is loaded in the require_once file. $interbreadcrumb = isset($interbreadcrumb) ? $interbreadcrumb : null; $template = Container::$legacyTemplate; $defaultLayout = 'layout_one_col.html.twig'; if (!empty($template)) { $defaultLayout = $template; } return $this->render('ChamiloCoreBundle::' . $defaultLayout, array('legacy_breadcrumb' => $interbreadcrumb, 'content' => $out, 'js' => $js)); } else { // Found does not exist throw new NotFoundHttpException(); } }
/** * Class Constructor * @param string $name * @param string $elementLabel HTML editor label * @param array $attributes Attributes for the textarea * @param array $config Optional configuration settings for the online editor. * */ public function __construct($name = null, $elementLabel = null, $attributes = [], $config = []) { if (empty($name)) { return false; } parent::__construct($name, $elementLabel, $attributes); $this->_persistantFreeze = true; $this->_type = 'html_editor'; $editor = Container::getHtmlEditor(); if ($editor) { $this->editor = $editor; $this->editor->setName($name); $this->editor->processConfig($config); } }
/** * Class constructor * @param string HTML editor name/id * @param string HTML editor label * @param array Attributes for the textarea * @param array $config Optional configuration settings for the online editor. * @return bool */ public function HTML_QuickForm_html_editor($name = null, $label = null, $attributes = null, $config = null) { if (empty($name)) { return false; } HTML_QuickForm_element::HTML_QuickForm_element($name, $label, $attributes); $this->_persistantFreeze = true; $this->_type = 'html_editor'; global $fck_attribute; $editor = Container::getHtmlEditor(); if ($editor) { $this->editor = $editor; $this->editor->setName($name); $this->editor->processConfig($fck_attribute); $this->editor->processConfig($config); } }
/** * Class constructor */ function HTML_QuickForm_Select_Language($elementName = null, $elementLabel = null, $options = null, $attributes = null) { if (!isset($attributes['class'])) { $attributes['class'] = 'chzn-select'; } parent::HTML_QuickForm_Select($elementName, $elementLabel, $options, $attributes); // Get all languages $languages = api_get_languages(); $this->_options = array(); $this->_values = array(); $platformLanguage = Container::getTranslator()->getLocale(); foreach ($languages as $language) { if ($language['isocode'] == $platformLanguage) { $this->addOption($language['english_name'], $language['isocode'], array('selected' => 'selected')); } else { $this->addOption($language['english_name'], $language['isocode']); } } }
$template->addGlobal('is_allowed_to_edit', $is_allowed_to_edit); $template->addGlobal('gamification_mode', $gamificationMode); $template->addGlobal('breadcrumb', $breadcrumb); $template->addGlobal('button_home_url', $buttonHomeUrl); $template->addGlobal('button_home_text', $buttonHomeText); $template->addGlobal('navigation_bar', $navigation_bar); $template->addGlobal('progress_bar', $progress_bar); $template->addGlobal('show_audio_player', $show_audioplayer); $template->addGlobal('media_player', $mediaplayer); $template->addGlobal('toc_list', $get_toc_list); $template->addGlobal('teacher_toc_buttons', $get_teacher_buttons); $template->addGlobal('iframe_src', $src); $template->addGlobal('navigation_bar_bottom', $navigation_bar_bottom); if ($gamificationMode == 1) { $template->addGlobal('gamification_stars', $learnPath->getCalculateStars($sessionId)); $template->addGlobal('gamification_points', $learnPath->getCalculateScore($sessionId)); } $template->addGlobal('lp_preview_image', Display::img($lpPreviewImagePath, $learnPath->name, array('class' => 'img-circle'), ICON_SIZE_BIG)); $template->addGlobal('lp_author', $learnPath->get_author()); $template->addGlobal('lp_mode', $learnPath->mode); $template->addGlobal('lp_title_scorm', $learnPath->name); $template->addGlobal('lp_html_toc', $learnPath->get_html_toc($get_toc_list)); $template->addGlobal('lp_id', $learnPath->lp_id); $template->addGlobal('lp_current_item_id', $learnPath->get_current_item_id()); $content = $template->render('@template_style/learnpath/view.html.twig'); echo $content; // Restore a global setting. $_setting['show_navigation_menu'] = $save_setting; // Hide headers Container::$legacyTemplate = 'layout_one_col_no_content.html.twig'; $learnPath->updateCurrentLpFromSession();
$text_after_registration .= $form_register->returnForm(); // Just in case Session::erase('course_redirect'); Session::erase('exercise_redirect'); if (CustomPages::enabled()) { CustomPages::display(CustomPages::REGISTRATION_FEEDBACK, array('info' => $text_after_registration)); } else { //$tpl = new Template($tool_name); echo Container::getTemplating()->render('@template_style/auth/inscription.html.twig', ['inscription_content' => $content, 'text_after_registration' => $text_after_registration, 'hide_header' => $hideHeaders]); } } else { // Custom pages if (CustomPages::enabled()) { CustomPages::display(CustomPages::REGISTRATION, array('form' => $form)); } else { if (!api_is_anonymous()) { // Saving user to course if it was set. if (!empty($course_code_redirect)) { $course_info = api_get_course_info($course_code_redirect); if (!empty($course_info)) { if (in_array($course_info['visibility'], array(COURSE_VISIBILITY_OPEN_PLATFORM, COURSE_VISIBILITY_OPEN_WORLD))) { CourseManager::subscribe_user($user_id, $course_info['code']); } } } CourseManager::redirectToCourse([]); } //$tpl = new Template($tool_name); echo Container::getTemplating()->render('@template_style/auth/inscription.html.twig', ['inscription_header' => Display::page_header($tool_name), 'inscription_content' => $content, 'hide_header' => $hideHeaders, 'form', $form->returnForm()]); } }
$course['teachers'] = $course_teachers; //$course['user_id'] = $teacher_id; $course['wanted_code'] = $course['visual_code']; $course['gradebook_model_id'] = isset($course['gradebook_model_id']) ? $course['gradebook_model_id'] : null; // Fixing category code $course['course_category'] = $course['category_code']; $course_info = CourseManager::create_course($course); header('Location: course_list.php'.($course_info===false?'?action=show_msg&warn='.api_get_last_failure():'')); exit; }*/ // Display the form. $content = $form->return_form(); //echo $content; $em = Container::getEntityManager(); $request = Container::getRequest(); $course = new Course(); $builder = Container::getFormFactory()->createBuilder(new CourseType(), $course); $form = $builder->getForm(); $form->handleRequest($request); if ($form->isValid()) { $course = $form->getData(); $em->persist($course); $em->flush(); Container::addFlash(get_lang('Updated')); $url = Container::getRouter()->generate('main', array('name' => 'admin/course_list.php')); header('Location: ' . $url); exit; } echo Container::getTemplate()->render('ChamiloCoreBundle:Legacy:form.html.twig', array('form' => $form->createView(), 'url' => api_get_self()));
if (isset($_REQUEST['cidReq']) && !empty($_REQUEST['cidReq'])) { $type = 'course'; } $agenda = new Agenda(); $agenda->type = $type; $is_group_tutor = false; $session_id = api_get_session_id(); $group_id = api_get_group_id(); if (!empty($group_id)) { $is_group_tutor = GroupManager::is_tutor_of_group(api_get_user_id(), $group_id); $group_properties = GroupManager::get_group_properties($group_id); $interbreadcrumb[] = array("url" => api_get_path(WEB_CODE_PATH) . "group/group.php?" . api_get_cidreq(), "name" => get_lang('Groups')); $interbreadcrumb[] = array("url" => api_get_path(WEB_CODE_PATH) . "group/group_space.php?" . api_get_cidreq(), "name" => get_lang('GroupSpace') . ' ' . $group_properties['name']); } $app['title'] = get_lang('Agenda'); $tpl = Container::getTwig(); $tpl->addGlobal('use_google_calendar', 0); $can_add_events = 0; switch ($type) { case 'admin': api_protect_admin_script(); $this_section = SECTION_PLATFORM_ADMIN; if (api_is_platform_admin()) { $can_add_events = 1; } break; case 'course': api_protect_course_script(true); $this_section = SECTION_COURSES; if (api_is_allowed_to_edit()) { $can_add_events = 1;
} $courses_controller->sessionsList($action, $nameTools, $limit); break; case 'subscribe_to_session': if (!$user_can_view_page) { api_not_allowed(true); } $userId = api_get_user_id(); $confirmed = isset($_GET['confirm']); $sessionId = intval($_GET['session_id']); if (empty($userId)) { api_not_allowed(); exit; } if (!$confirmed) { echo Container::getTemplating()->render('@template_style/auth/confirm_session_subscription.html.twig', ['session_id' => $sessionId]); exit; } $registrationAllowed = api_get_setting('session.catalog_allow_session_auto_subscription'); if ($registrationAllowed === 'true') { $entityManager = Database::getManager(); $repository = $entityManager->getRepository('ChamiloCoreBundle:SequenceResource'); $sequences = $repository->getRequirements($sessionId, SequenceResource::SESSION_TYPE); if (count($sequences) > 0) { $requirementsData = SequenceResourceManager::checkRequirementsForUser($sequences, SequenceResource::SESSION_TYPE, $userId); $continueWithSubscription = SequenceResourceManager::checkSequenceAreCompleted($requirementsData); if (!$continueWithSubscription) { header('Location: ' . api_get_path(WEB_CODE_PATH) . 'auth/courses.php'); exit; } }
// Setting the extension $extension = 'html'; $content = Security::remove_XSS($values['content'], COURSEMANAGERLOWSECURITY); /*if (strpos($content, '/css/frames.css') == false) { $content = str_replace('</head>', '<link rel="stylesheet" href="./css/frames.css" type="text/css" /><style> body{margin:50px;}</style></head>', $content); }*/ // Don't create file with the same name. if (file_exists($filepath . $filename . '.' . $extension)) { Display::display_header($nameTools, 'Doc'); Display::display_error_message(get_lang('FileExists') . ' ' . $title, false); Display::display_footer(); exit; } if ($fp = @fopen($filepath . $filename . '.' . $extension, 'w')) { //$courseUrl = \Chamilo\CoreBundle\Framework\Container::getUrlGenerator()->generate('course_url').'/'; $content = str_replace(api_get_path(WEB_COURSE_PATH), Container::getUrlAppend() . '/courses/', $content); fputs($fp, $content); fclose($fp); chmod($filepath . $filename . '.' . $extension, api_get_permissions_for_new_files()); $file_size = filesize($filepath . $filename . '.' . $extension); $save_file_path = $dir . $filename . '.' . $extension; $document_id = add_document($_course, $save_file_path, 'file', $file_size, $title, null, $readonly); if ($document_id) { api_item_property_update($_course, TOOL_DOCUMENT, $document_id, 'DocumentAdded', $userId, $to_group_id, null, null, null, $current_session_id); // Update parent folders item_property_update_on_folder($_course, $dir, $userId); $new_comment = isset($_POST['comment']) ? trim($_POST['comment']) : ''; $new_title = isset($_POST['title']) ? trim($_POST['title']) : ''; $new_title = htmlspecialchars($new_title); if ($new_comment || $new_title) { $ct = '';
/** * Get HTML code block for user skills * @param int $userId The user ID * @return string */ public static function getSkillBlock($userId) { if (api_get_setting('skill.allow_skills_tool') !== 'true') { return null; } $skill = new Skill(); $ranking = $skill->get_user_skill_ranking($userId); $skills = $skill->get_user_skills($userId, true); return Container::getTemplating()->render('@template_style/social/skills_block.html.twig', ['ranking' => $ranking, 'skills' => $skills, 'user_id' => $userId, 'show_skills_report_link' => api_is_student() || api_is_student_boss() || api_is_drh()]); }
/** * @return null|string */ public function return_user_image_block() { $html = null; if (!api_is_anonymous()) { $userPicture = UserManager::getUserPicture(api_get_user_id()); $content = null; if (api_get_setting('social.allow_social_tool') == 'true') { $content .= '<a style="text-align:center" href="' . api_get_path(WEB_PATH) . 'main/social/home.php"> <img class="img-circle" src="' . $userPicture . '" ></a>'; } else { $edit = Container::getRouter()->generate('fos_user_profile_edit'); $content .= '<a style="text-align:center" href="' . $edit . '"> <img class="img-circle" title="' . get_lang('EditProfile') . '" src="' . $userPicture . '" ></a>'; } $html = self::show_right_block(null, $content, 'user_image_block', array('style' => 'text-align:center;')); } return $html; }
/** * Formats the content in order to add the welcome message, * the notification preference, etc * @param string $content * @param array $senderInfo result of api_get_user_info() or * GroupPortalManager:get_group_data() * * @return string * */ public function formatContent($content, $senderInfo) { $hook = HookNotificationContent::create(); if (!empty($hook)) { $hook->setEventData(array('content' => $content)); $data = $hook->notifyNotificationContent(HOOK_EVENT_TYPE_PRE); if (isset($data['content'])) { $content = $data['content']; } } $newMessageText = $linkToNewMessage = ''; switch ($this->type) { case self::NOTIFICATION_TYPE_DIRECT_MESSAGE: $newMessageText = ''; $linkToNewMessage = Display::url(get_lang('SeeMessage'), api_get_path(WEB_CODE_PATH) . 'messages/inbox.php'); break; case self::NOTIFICATION_TYPE_MESSAGE: if (!empty($senderInfo)) { $senderName = api_get_person_name($senderInfo['firstname'], $senderInfo['lastname'], null, PERSON_NAME_EMAIL_ADDRESS); $newMessageText = sprintf(get_lang('YouHaveANewMessageFromX'), $senderName); } $linkToNewMessage = Display::url(get_lang('SeeMessage'), api_get_path(WEB_CODE_PATH) . 'messages/inbox.php'); break; case self::NOTIFICATION_TYPE_INVITATION: if (!empty($senderInfo)) { $senderName = api_get_person_name($senderInfo['firstname'], $senderInfo['lastname'], null, PERSON_NAME_EMAIL_ADDRESS); $newMessageText = sprintf(get_lang('YouHaveANewInvitationFromX'), $senderName); } $linkToNewMessage = Display::url(get_lang('SeeInvitation'), api_get_path(WEB_CODE_PATH) . 'social/invitations.php'); break; case self::NOTIFICATION_TYPE_GROUP: $topic_page = intval($_REQUEST['topics_page_nr']); if (!empty($senderInfo)) { $senderName = $senderInfo['group_info']['name']; $newMessageText = sprintf(get_lang('YouHaveReceivedANewMessageInTheGroupX'), $senderName); $senderName = api_get_person_name($senderInfo['user_info']['firstname'], $senderInfo['user_info']['lastname'], null, PERSON_NAME_EMAIL_ADDRESS); $senderName = Display::url($senderName, api_get_path(WEB_CODE_PATH) . 'social/profile.php?' . $senderInfo['user_info']['user_id']); $newMessageText .= '<br />' . get_lang('User') . ': ' . $senderName; } $group_url = api_get_path(WEB_CODE_PATH) . 'social/group_topics.php?id=' . $senderInfo['group_info']['id'] . '&topic_id=' . $senderInfo['group_info']['topic_id'] . '&msg_id=' . $senderInfo['group_info']['msg_id'] . '&topics_page_nr=' . $topic_page; $linkToNewMessage = Display::url(get_lang('SeeMessage'), $group_url); break; } $preference_url = Container::getRouter()->generate('fos_user_profile_edit'); // You have received a new message text if (!empty($newMessageText)) { $content = $newMessageText . '<br /><hr><br />' . $content; } // See message with link text if (!empty($linkToNewMessage) && api_get_setting('message.allow_message_tool') == 'true') { $content = $content . '<br /><br />' . $linkToNewMessage; } // You have received this message because you are subscribed text $content = $content . '<br /><hr><i>' . sprintf(get_lang('YouHaveReceivedThisNotificationBecauseYouAreSubscribedOrInvolvedInItToChangeYourNotificationPreferencesPleaseClickHereX'), Display::url($preference_url, $preference_url)) . '</i>'; if (!empty($hook)) { $hook->setEventData(array('content' => $content)); $data = $hook->notifyNotificationContent(HOOK_EVENT_TYPE_POST); if (isset($data['content'])) { $content = $data['content']; } } return $content; }
} else { // Update $sequenceResource->getSequence()->setGraphAndSerialize($graph); } $em->persist($sequenceResource); $em->flush(); echo Display::return_message(get_lang('Saved'), 'success'); break; } break; case 'get_requirements': $userId = api_get_user_id(); switch ($type) { case SequenceResource::SESSION_TYPE: $session = api_get_session_info($id); $sequences = $repository->getRequirements($session['id'], $type); if (count($sequences) === 0) { break; } $sequenceList = SequenceResourceManager::checkRequirementsForUser($sequences, $type, $userId); $allowSubscription = SequenceResourceManager::checkSequenceAreCompleted($sequenceList); $courseController = new CoursesController(); $subscribeButton = ''; if ($allowSubscription) { $subscribeButton = $courseController->getRegisteredInSessionButton($session['id'], $session['name'], false); } echo Container::getTemplating()->render('@template_style/sequence_resource/session_requirements.html.twig', ['sequences' => $sequenceList, 'allow_subscription' => $allowSubscription, 'subscribe_button' => $subscribeButton]); break; } break; }
} } $courses[] = ['course' => $sessionCourse, 'description' => $courseDescription, 'tags' => $courseTags, 'objectives' => $courseObjectives, 'topics' => $courseTopics, 'coaches' => $coachesData, 'extra_fields' => $courseValues->getAllValuesForAnItem($sessionCourse->getId())]; } $sessionDates = SessionManager::parseSessionDates(['display_start_date' => $session->getDisplayStartDate(), 'display_end_date' => $session->getDisplayEndDate(), 'access_start_date' => $session->getAccessStartDate(), 'access_end_date' => $session->getAccessEndDate(), 'coach_access_start_date' => $session->getCoachAccessStartDate(), 'coach_access_end_date' => $session->getCoachAccessEndDate()]); $sessionRequirements = $sequenceResourceRepo->getRequirements($session->getId(), SequenceResource::SESSION_TYPE); $hasRequirements = false; foreach ($sessionRequirements as $sequence) { if (!empty($sequence['requirements'])) { $hasRequirements = true; break; } } $courseController = new CoursesController(); /* View */ //$template = new Template($session->getName(), true, true, false, true, false); $template = \Chamilo\CoreBundle\Framework\Container::getTwig(); $template->addGlobal('show_tutor', api_get_setting('session.show_session_coach') === 'true' ? true : false); $template->addGlobal('pageUrl', api_get_path(WEB_PATH) . "session/{$session->getId()}/about/"); $template->addGlobal('session', $session); $template->addGlobal('session_date', $sessionDates); $template->addGlobal('is_subscribed', SessionManager::isUserSubscribedAsStudent($session->getId(), api_get_user_id())); $template->addGlobal('subscribe_button', $courseController->getRegisteredInSessionButton($session->getId(), $session->getName(), $hasRequirements)); $template->addGlobal('courses', $courses); $template->addGlobal('essence', \Essence\Essence::instance()); $template->addGlobal('session_extra_fields', $sessionValues->getAllValuesForAnItem($session->getId(), true)); $template->addGlobal('has_requirements', $hasRequirements); $template->addGlobal('sequences', $sessionRequirements); //$templateFolder = api_get_configuration_value('default_template'); echo $template->render('@template_style/session/about.html.twig'); //$template->assign('header', $session->getName());
/** * Destroy */ static function destroy() { $session = Container::getSession(); $session->invalidate(); }
$glossary_id = Security::remove_XSS($_POST['glossary_id']); $glossary_description_by_id = GlossaryManager::get_glossary_term_by_glossary_id($glossary_id); $glossary_description_by_id = str_replace($path_image_search, $path_image, $glossary_description_by_id); echo api_xml_http_response_encode($glossary_description_by_id); } elseif (isset($_POST['glossary_data']) && $_POST['glossary_data'] == 'true') { //get_glossary_terms $glossary_data = GlossaryManager::get_glossary_terms(); $glossary_all_data = array(); if (count($glossary_data) > 0) { foreach ($glossary_data as $glossary_index => $glossary_value) { $glossary_all_data[] = $glossary_value['id'] . '__|__|' . $glossary_value['name']; } $glossary_all_data = implode('[|.|_|.|-|.|]', $glossary_all_data); echo api_xml_http_response_encode($glossary_all_data); } } elseif (isset($_POST['glossary_name'])) { $my_glossary_name = Security::remove_XSS($_POST['glossary_name']); $my_glossary_name = api_convert_encoding($my_glossary_name, $charset, 'UTF-8'); $my_glossary_name = trim($my_glossary_name); $glossary_description = GlossaryManager::get_glossary_term_by_glossary_name($my_glossary_name); $glossary_description = str_replace($path_image_search, $path_image, $glossary_description); if (is_null($glossary_description) || strlen(trim($glossary_description)) == 0) { echo api_xml_http_response_encode(get_lang('NoResults')); } else { echo api_xml_http_response_encode($glossary_description); } } else { echo api_xml_http_response_encode(get_lang('NoResults')); } Container::$legacyTemplate = 'layout_empty.html.twig';
<?php /* For licensing terms, see /license.txt */ use Chamilo\CoreBundle\Framework\Container; /** * Show information about Mozilla OpenBadges * @author Angel Fernando Quiroz Campos <*****@*****.**> * @package chamilo.admin.openbadges */ $cidReset = true; //require_once '../inc/global.inc.php'; $this_section = SECTION_PLATFORM_ADMIN; if (!api_is_platform_admin() || api_get_setting('skill.allow_skills_tool') !== 'true') { api_not_allowed(true); } $backpack = 'https://backpack.openbadges.org/'; $configBackpack = api_get_setting('gradebook.openbadges_backpack'); if (strcmp($backpack, $configBackpack) !== 0) { $backpack = $configBackpack; } $interbreadcrumb = array(array('url' => api_get_path(WEB_CODE_PATH) . 'admin/index.php', 'name' => get_lang('Administration'))); $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Badges')); $toolbar = Display::toolbarButton(get_lang('ManageSkills'), api_get_path(WEB_CODE_PATH) . 'admin/skill_list.php', 'list', 'primary', ['title' => get_lang('ManageSkills')]); //$tpl = new Template(get_lang('Badges')); echo $toolbar; echo Container::getTemplating()->render('@template_style/skill/badge.html.twig', ['backpack' => $backpack]);
/** * Subscribes students to the given session and optionally (default) unsubscribes previous users * * @author Carlos Vargas from existing code * @author Julio Montoya. Cleaning code. * @param int $id_session * @param array $user_list * @param int $session_visibility * @param bool $empty_users * @return bool */ public static function suscribe_users_to_session($id_session, $user_list, $session_visibility = SESSION_VISIBLE_READ_ONLY, $empty_users = true) { if ($id_session != strval(intval($id_session))) { return false; } foreach ($user_list as $intUser) { if ($intUser != strval(intval($intUser))) { return false; } } $tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE); $tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); $tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER); $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); $entityManager = Database::getManager(); $session = $entityManager->find('ChamiloCoreBundle:Session', $id_session); // from function parameter if (empty($session_visibility)) { $session_visibility = $session->getVisibility(); //default status loaded if empty if (empty($session_visibility)) { $session_visibility = SESSION_VISIBLE_READ_ONLY; } // by default readonly 1 } else { if (!in_array($session_visibility, array(SESSION_VISIBLE_READ_ONLY, SESSION_VISIBLE, SESSION_INVISIBLE))) { $session_visibility = SESSION_VISIBLE_READ_ONLY; } } $sql = "SELECT user_id FROM {$tbl_session_rel_course_rel_user}\n WHERE session_id = {$id_session} AND status = 0"; $result = Database::query($sql); $existingUsers = array(); while ($row = Database::fetch_array($result)) { $existingUsers[] = $row['user_id']; } $sql = "SELECT c_id FROM {$tbl_session_rel_course}\n WHERE session_id = {$id_session}"; $result = Database::query($sql); $course_list = array(); while ($row = Database::fetch_array($result)) { $course_list[] = $row['c_id']; } if ($session->getSendSubscriptionNotification() && is_array($user_list)) { // Sending emails only foreach ($user_list as $user_id) { if (in_array($user_id, $existingUsers)) { continue; } $subject = Container::getTemplating()->render('@template_style/mail/subject_subscription_to_session_confirmation.html.twig'); $user_info = api_get_user_info($user_id); $content = Container::getTemplating()->render('@template_style/mail/content_subscription_to_session_confirmation.html.twig', ['complete_name' => stripslashes($user_info['complete_name']), 'session_name' => $session->getName(), 'session_coach' => $session->getGeneralCoach()->getCompleteName()]); api_mail_html($user_info['complete_name'], $user_info['mail'], $subject, $content, api_get_person_name(api_get_setting('admin.administrator_name'), api_get_setting('admin.administrator_surname')), api_get_setting('admin.administrator_email')); } } foreach ($course_list as $courseId) { // for each course in the session $nbr_users = 0; $courseId = intval($courseId); $sql = "SELECT DISTINCT user_id\n FROM {$tbl_session_rel_course_rel_user}\n WHERE\n session_id = {$id_session} AND\n c_id = {$courseId} AND\n status = 0\n "; $result = Database::query($sql); $existingUsers = array(); while ($row = Database::fetch_array($result)) { $existingUsers[] = $row['user_id']; } // Delete existing users if ($empty_users) { foreach ($existingUsers as $existing_user) { if (!in_array($existing_user, $user_list)) { $sql = "DELETE FROM {$tbl_session_rel_course_rel_user}\n WHERE\n session_id = {$id_session} AND\n c_id = {$courseId} AND\n user_id = {$existing_user} AND\n status = 0 "; $result = Database::query($sql); Event::addEvent(LOG_SESSION_DELETE_USER_COURSE, LOG_USER_ID, $existing_user, api_get_utc_datetime(), api_get_user_id(), $courseId, $id_session); if (Database::affected_rows($result)) { $nbr_users--; } } } } // Replace with this new function // insert new users into session_rel_course_rel_user and ignore if they already exist foreach ($user_list as $enreg_user) { if (!in_array($enreg_user, $existingUsers)) { $enreg_user = Database::escape_string($enreg_user); $sql = "INSERT IGNORE INTO {$tbl_session_rel_course_rel_user} (session_id, c_id, user_id, visibility, status)\n VALUES({$id_session}, {$courseId}, {$enreg_user}, {$session_visibility}, 0)"; $result = Database::query($sql); Event::addEvent(LOG_SESSION_ADD_USER_COURSE, LOG_USER_ID, $enreg_user, api_get_utc_datetime(), api_get_user_id(), $courseId, $id_session); if (Database::affected_rows($result)) { $nbr_users++; } } } // Count users in this session-course relation $sql = "SELECT COUNT(user_id) as nbUsers\n FROM {$tbl_session_rel_course_rel_user}\n WHERE session_id = {$id_session} AND c_id = {$courseId} AND status<>2"; $rs = Database::query($sql); list($nbr_users) = Database::fetch_array($rs); // update the session-course relation to add the users total $sql = "UPDATE {$tbl_session_rel_course} SET nbr_users = {$nbr_users}\n WHERE session_id = {$id_session} AND c_id = {$courseId}"; Database::query($sql); } // Delete users from the session if ($empty_users === true) { $sql = "DELETE FROM {$tbl_session_rel_user}\n WHERE session_id = {$id_session} AND relation_type<>" . SESSION_RELATION_TYPE_RRHH . ""; Database::query($sql); } // Insert missing users into session $nbr_users = 0; foreach ($user_list as $enreg_user) { $enreg_user = Database::escape_string($enreg_user); $nbr_users++; $sql = "INSERT IGNORE INTO {$tbl_session_rel_user} (relation_type, session_id, user_id, registered_at)\n VALUES (0, {$id_session}, {$enreg_user}, '" . api_get_utc_datetime() . "')"; Database::query($sql); } // update number of users in the session $nbr_users = count($user_list); if ($empty_users) { // update number of users in the session $sql = "UPDATE {$tbl_session} SET nbr_users= {$nbr_users}\n WHERE id = {$id_session} "; Database::query($sql); } else { $sql = "UPDATE {$tbl_session} SET nbr_users = nbr_users + {$nbr_users}\n WHERE id = {$id_session}"; Database::query($sql); } }
/** * Gets language isocode column from the language table, taking the given language as a query parameter. * @param string $language This is the name of the folder containing translations for the corresponding language (e.g arabic, english). * @param string $default_code This is the value to be returned if there was no code found corresponding to the given language. * If $language is omitted, interface language is assumed then. * @return string The found isocode or null on error. * Returned codes are according to the following standards (in order of preference): * - ISO 639-1 : Alpha-2 code (two-letters code - en, fr, es, ...) * - RFC 4646 : five-letter code based on the ISO 639 two-letter language codes * and the ISO 3166 two-letter territory codes (pt-BR, ...) * - ISO 639-2 : Alpha-3 code (three-letters code - ast, fur, ...) */ function api_get_language_isocode($language = null, $default_code = 'en') { return Container::getTranslator()->getLocale(); }
/** * Show the Session Catalogue with filtered session by a query term * @param array $limit */ public function sessionListBySearch(array $limit) { $q = isset($_REQUEST['q']) ? Security::remove_XSS($_REQUEST['q']) : null; $hiddenLinks = isset($_GET['hidden_links']) ? intval($_GET['hidden_links']) == 1 : false; $courseUrl = CourseCategoryManager::getCourseCategoryUrl(1, $limit['length'], null, 0, 'subscribe'); $searchDate = isset($_POST['date']) ? $_POST['date'] : date('Y-m-d'); $sessions = $this->model->browseSessionsBySearch($q, $limit); $sessionsBlocks = $this->getFormatedSessionsBlock($sessions); echo Container::getTemplating()->render('@temaplte_style/auth/session_catalog.html.twig', ['show_courses' => CoursesAndSessionsCatalog::showCourses(), 'show_sessions' => CoursesAndSessionsCatalog::showSessions(), 'show_tutor' => api_get_setting('session.show_session_coach') === 'true' ? true : false, 'course_url' => $courseUrl, 'already_subscribed_label' => $this->getAlreadyRegisteredInSessionLabel(), 'hidden_links' => $hiddenLinks, 'search_token' => Security::get_token(), 'search_date' => Security::remove_XSS($searchDate), 'search_tag' => Security::remove_XSS($q), 'sessions' => $sessionsBlocks]); }
$sessionId = api_get_session_id(); $files = DocumentManager::getDeletedDocuments($courseInfo, $sessionId); $actions = Display::url(get_lang('DownloadAll'), api_get_self() . '?' . api_get_cidreq() . '&action=download_all', ['class' => 'btn btn-default']); $actions .= Display::url(get_lang('DeleteAll'), api_get_self() . '?' . api_get_cidreq() . '&action=delete_all', ['class' => 'btn btn-danger']); $action = isset($_GET['action']) ? $_GET['action'] : ''; $id = isset($_GET['id']) ? intval($_GET['id']) : ''; $currentUrl = api_get_self() . '?' . api_get_cidreq(); switch ($action) { case 'delete': DocumentManager::purgeDocument($id, $courseInfo, $sessionId); Display::addFlash(Display::return_message(get_lang('Deleted'))); header('Location: ' . $currentUrl); exit; break; case 'delete_all': DocumentManager::purgeDocuments($courseInfo, $sessionId); Display::addFlash(Display::return_message(get_lang('Deleted'))); header('Location: ' . $currentUrl); exit; break; case 'download': DocumentManager::downloadDeletedDocument($id, $courseInfo, $sessionId); break; case 'download_all': DocumentManager::downloadAllDeletedDocument($courseInfo, $sessionId); break; } $interbreadcrumb[] = array("url" => api_get_path(WEB_CODE_PATH) . 'document/document.php?' . api_get_cidreq(), "name" => get_lang('Documents')); //$template = new Template(get_lang('DeletedDocuments')); $template = Container::getTwig(); echo $template->render('@template_style/document/recycle.html.twig', ['files' => $files, 'actions' => $actions]);
$objSkill = new Skill(); $skills = $objSkill->get($skillId); $unbakedBadge = api_get_path(SYS_UPLOAD_PATH) . "badges/" . $skills['icon']; $unbakedBadge = file_get_contents($unbakedBadge); $badgeInfoError = false; $personalBadge = ""; $png = new PNGImageBaker($unbakedBadge); if ($png->checkChunks("tEXt", "openbadges")) { $bakedInfo = $png->addChunk("tEXt", "openbadges", $assertionUrl); $bakedBadge = UserManager::getUserPathById($userId, "system"); $bakedBadge = $bakedBadge . 'badges'; if (!file_exists($bakedBadge)) { mkdir($bakedBadge, api_get_permissions_for_new_directories(), true); } $skillRelUserId = $userSkills[0]->getId(); if (!file_exists($bakedBadge . "/badge_" . $skillRelUserId)) { file_put_contents($bakedBadge . "/badge_" . $skillRelUserId . ".png", $bakedInfo); } //Process to validate a baked badge $badgeContent = file_get_contents($bakedBadge . "/badge_" . $skillRelUserId . ".png"); $verifyBakedBadge = $png->extractBadgeInfo($badgeContent); if (!is_array($verifyBakedBadge)) { $badgeInfoError = true; } if (!$badgeInfoError) { $personalBadge = UserManager::getUserPathById($userId, "web"); $personalBadge = $personalBadge . "badges/badge_" . $skillRelUserId . ".png"; } } echo Container::getTemplating()->render('@template_style/skill/issued.html.twig', ['assertions' => $badgeAssertions, 'skill_info' => $skillInfo, 'user_info' => $userInfo, 'allow_export' => $allowExport, 'badge_error' => $badgeInfoError, 'personal_badge' => $personalBadge]); //$template->assign('header', get_lang('IssuedBadgeInformation'));
/** * @param GetResponseEvent $event */ public function onKernelRequest(GetResponseEvent $event) { $kernel = $event->getKernel(); $request = $event->getRequest(); $session = $request->getSession(); /** @var ContainerInterface $container */ $container = $this->container; // Setting container Container::setContainer($container); // Setting session. Container::setSession($request->getSession()); // Setting database. $dbConnection = $container->get('database_connection'); // Setting DB connection and Doctrine Manager. $database = new \Database(); $database->setConnection($dbConnection); $entityManager = $container->get('doctrine')->getManager(); $database->setManager($entityManager); // Setting course tool chain (in order to create tools to a course) \CourseManager::setToolList($container->get('chamilo_course.tool_chain')); \CourseManager::setEntityManager($entityManager); \CourseManager::setCourseManager($container->get('chamilo_core.manager.course')); \CourseManager::setCourseSettingsManager($container->get('chamilo_course.settings.manager')); Container::$mailer = $container->get('mailer'); // Setting legacy properties. Container::$urlGenerator = $container->get('router'); Container::$security = $container->get('security.context'); Container::$translator = $container->get('translator'); // Setting paths. Container::$rootDir = $container->get('kernel')->getRealRootDir(); Container::$logDir = $container->get('kernel')->getLogDir(); Container::$dataDir = $container->get('kernel')->getDataDir(); Container::$tempDir = $container->get('kernel')->getCacheDir(); Container::$courseDir = $container->get('kernel')->getDataDir(); //Container::$configDir = $container->get('kernel')->getConfigDir(); Container::$assets = $container->get('templating.helper.assets'); Container::$roles = $container->get('security.role_hierarchy'); // Setting editor Container::$htmlEditor = $container->get('chamilo_core.html_editor'); if (!defined('DEFAULT_DOCUMENT_QUOTA')) { $default_quota = api_get_setting('document.default_document_quotum'); // Just in case the setting is not correctly set if (empty($default_quota)) { $default_quota = 100000000; } define('DEFAULT_DOCUMENT_QUOTA', $default_quota); } // Access URL (multiple URL) /** @var \Sonata\PageBundle\Model\SnapshotPageProxy $page */ $page = $request->get('page'); if (isset($page) && !is_numeric($page)) { $siteId = $page->getSite()->getId(); $request->getSession()->set('url_info', $page->getSite()); } else { $siteId = 1; } $request->getSession()->set('url_id', $siteId); /* // Loading portal settings from DB. $settingsRefreshInfo = $em->getRepository('ChamiloCoreBundle:SettingsCurrent')->findOneByVariable('settings_latest_update'); $settingsLatestUpdate = !empty($settingsRefreshInfo) ? $settingsRefreshInfo->getSelectedValue() : null; $settings = $session->get('_setting'); if (empty($settings)) { api_set_settings_and_plugins(); } else { if (isset($settings['settings_latest_update']) && $settings['settings_latest_update'] != $settingsLatestUpdate ) { api_set_settings_and_plugins(); } }*/ }
/* For licensing terms, see /license.txt */ use Chamilo\CoreBundle\Framework\Container; /** * Index of the admin tools * * @package chamilo.admin */ // resetting the course id $cidReset = true; // setting the section (for the tabs) $this_section = SECTION_PLATFORM_ADMIN; // Access restrictions api_protect_admin_script(true); $nameTools = get_lang('PlatformAdmin'); // setting breadcrumbs $interbreadcrumb[] = array('url' => Container::getRouter()->generate('administration'), "name" => $nameTools); // setting the name of the tool $nameTools = get_lang('DataFiller'); $output = array(); if (!empty($_GET['fill'])) { switch ($_GET['fill']) { case 'users': require api_get_path(SYS_TEST_PATH) . 'datafiller/fill_users.php'; $output = fill_users(); break; case 'courses': require api_get_path(SYS_TEST_PATH) . 'datafiller/fill_courses.php'; $output = fill_courses(); break; default: break;
/* For licensing terms, see /license.txt */ use ChamiloSession as Session; use Chamilo\CoreBundle\Framework\Container; /** * Create skill form * @author Angel Fernando Quiroz Campos <*****@*****.**> * @package chamilo.admin */ $cidReset = true; //require_once '../inc/global.inc.php'; $this_section = SECTION_PLATFORM_ADMIN; api_protect_admin_script(); if (api_get_setting('skill.allow_skills_tool') != 'true') { api_not_allowed(); } $interbreadcrumb[] = array('url' => Container::getRouter()->generate('administration'), "name" => get_lang('PlatformAdmin')); $interbreadcrumb[] = array('url' => 'skill_list.php', 'name' => get_lang('ManageSkills')); $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('CreateSkill')); /* Process data */ $skillParentId = isset($_GET['parent']) ? intval($_GET['parent']) : 0; $formDefaultValues = []; $objSkill = new Skill(); $objGradebook = new Gradebook(); if ($skillParentId > 0) { $skillParentInfo = $objSkill->get_skill_info($skillParentId); $formDefaultValues = ['parent_id' => $skillParentInfo['id'], 'gradebook_id' => []]; foreach ($skillParentInfo['gradebooks'] as $gradebook) { $formDefaultValues['gradebook_id'][] = intval($gradebook['id']); } } $allSkills = $objSkill->get_all();
/** * Sends an HTML email using the phpmailer class (and multipart/alternative to downgrade gracefully) * Sender name and email can be specified, if not specified * name and email of the platform admin are used * * @author Bert Vanderkimpen ICT&O UGent * @author Yannick Warnier <*****@*****.**> * * @param string name of recipient * @param string email of recipient * @param string email subject * @param string email body * @param string sender name * @param string sender e-mail * @param array extra headers in form $headers = array($name => $value) to allow parsing * @param array data file (path and filename) * @param array data to attach a file (optional) * @param bool True for attaching a embedded file inside content html (optional) * @return returns true if mail was sent * @see class.phpmailer.php */ function api_mail_html($recipient_name, $recipient_email, $subject, $message, $senderName = '', $senderEmail = '', $extra_headers = array(), $data_file = array(), $embedded_image = false, $additionalParameters = array()) { // Default values $notification = new Notification(); $defaultEmail = $notification->getDefaultPlatformSenderEmail(); $defaultName = $notification->getDefaultPlatformSenderName(); // If the parameter is set don't use the admin. $senderName = !empty($senderName) ? $senderName : $defaultName; $senderEmail = !empty($senderEmail) ? $senderEmail : $defaultEmail; $link = isset($additionalParameters['link']) ? $additionalParameters['link'] : ''; $swiftMessage = \Swift_Message::newInstance()->setSubject($subject)->setFrom($senderEmail, $senderName)->setTo($recipient_email, $recipient_name)->setBody(Container::getTemplating()->render('ChamiloCoreBundle:default/mail:mail.html.twig', array('content' => $message, 'link' => $link)), 'text/html'); if (!empty($additionalParameters)) { $plugin = new AppPlugin(); $smsPlugin = $plugin->getSMSPluginLibrary(); if ($smsPlugin) { $smsPlugin->send($additionalParameters); } } Container::getMailer()->send($swiftMessage); return 1; global $platform_email; $mail = new PHPMailer(); $mail->Mailer = $platform_email['SMTP_MAILER']; $mail->Host = $platform_email['SMTP_HOST']; $mail->Port = $platform_email['SMTP_PORT']; $mail->CharSet = $platform_email['SMTP_CHARSET']; // Stay far below SMTP protocol 980 chars limit. $mail->WordWrap = 200; if ($platform_email['SMTP_AUTH']) { $mail->SMTPAuth = 1; $mail->Username = $platform_email['SMTP_USER']; $mail->Password = $platform_email['SMTP_PASS']; } // 5 = low, 1 = high $mail->Priority = 3; $mail->SMTPKeepAlive = true; // Default values $notification = new Notification(); $defaultEmail = $notification->getDefaultPlatformSenderEmail(); $defaultName = $notification->getDefaultPlatformSenderName(); // Error to admin. $mail->AddCustomHeader('Errors-To: ' . $defaultEmail); // If the parameter is set don't use the admin. $senderName = !empty($senderName) ? $senderName : $defaultName; $senderEmail = !empty($senderEmail) ? $senderEmail : $defaultEmail; // Reply to first if (isset($extra_headers['reply_to'])) { $mail->AddReplyTo($extra_headers['reply_to']['mail'], $extra_headers['reply_to']['name']); $mail->Sender = $extra_headers['reply_to']['mail']; unset($extra_headers['reply_to']); } //If the SMTP configuration only accept one sender if ($platform_email['SMTP_UNIQUE_SENDER']) { $senderName = $platform_email['SMTP_FROM_NAME']; $senderEmail = $platform_email['SMTP_FROM_EMAIL']; } $mail->SetFrom($senderEmail, $senderName); $mail->Subject = $subject; $mail->AltBody = strip_tags(str_replace('<br />', "\n", api_html_entity_decode($message))); // Send embedded image. if ($embedded_image) { // Get all images html inside content. preg_match_all("/<img\\s+.*?src=[\"\\']?([^\"\\' >]*)[\"\\']?[^>]*>/i", $message, $m); // Prepare new tag images. $new_images_html = array(); $i = 1; if (!empty($m[1])) { foreach ($m[1] as $image_path) { $real_path = realpath($image_path); $filename = basename($image_path); $image_cid = $filename . '_' . $i; $encoding = 'base64'; $image_type = mime_content_type($real_path); $mail->AddEmbeddedImage($real_path, $image_cid, $filename, $encoding, $image_type); $new_images_html[] = '<img src="cid:' . $image_cid . '" />'; $i++; } } // Replace origin image for new embedded image html. $x = 0; if (!empty($m[0])) { foreach ($m[0] as $orig_img) { $message = str_replace($orig_img, $new_images_html[$x], $message); $x++; } } } $message = str_replace(array("\n\r", "\n", "\r"), '<br />', $message); $mailView = new Template(null, false, false, false, false, false, false); $mailView->assign('content', $message); $link = $additionalParameters['link']; $mailView->assign('link', $link); $layout = $mailView->get_template('mail/mail.tpl'); $mail->Body = $mailView->fetch($layout); // Attachment ... if (!empty($data_file)) { $mail->AddAttachment($data_file['path'], $data_file['filename']); } // Only valid addresses are accepted. if (is_array($recipient_email)) { foreach ($recipient_email as $dest) { if (api_valid_email($dest)) { $mail->AddAddress($dest, $recipient_name); } } } else { if (api_valid_email($recipient_email)) { $mail->AddAddress($recipient_email, $recipient_name); } else { return 0; } } if (is_array($extra_headers) && count($extra_headers) > 0) { foreach ($extra_headers as $key => $value) { switch (strtolower($key)) { case 'encoding': case 'content-transfer-encoding': $mail->Encoding = $value; break; case 'charset': $mail->Charset = $value; break; case 'contenttype': case 'content-type': $mail->ContentType = $value; break; default: $mail->AddCustomHeader($key . ':' . $value); break; } } } else { if (!empty($extra_headers)) { $mail->AddCustomHeader($extra_headers); } } // WordWrap the html body (phpMailer only fixes AltBody) FS#2988 $mail->Body = $mail->WrapText($mail->Body, $mail->WordWrap); // Send the mail message. if (!$mail->Send()) { error_log('ERROR: mail not sent to ' . $recipient_name . ' (' . $recipient_email . ') because of ' . $mail->ErrorInfo . '<br />'); return 0; } if (!empty($additionalParameters)) { $plugin = new AppPlugin(); $smsPlugin = $plugin->getSMSPluginLibrary(); if ($smsPlugin) { $smsPlugin->send($additionalParameters); } } // Clear all the addresses. $mail->ClearAddresses(); return 1; }
if (!isset($_POST['group_id'])) { $default['users'] = isset($_POST['users']) ? $_POST['users'] : null; } else { $default['group_id'] = $_POST['group_id']; } if (isset($_POST['hidden_user'])) { $default['users'] = array($_POST['hidden_user']); } $social_right_content .= manage_form($default); } else { $social_right_content .= Display::return_message(get_lang('ErrorSendingMessage'), 'error'); } } } if (api_get_setting('social.allow_social_tool') == 'true') { $social_right_content .= '</div>'; $social_right_content .= '</div>'; } //$tpl = new Template(get_lang('ComposeMessage')); $tpl = \Chamilo\CoreBundle\Framework\Container::getTwig(); // Block Social Avatar SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'messages'); if (api_get_setting('social.allow_social_tool') == 'true') { $tpl->addGlobal('social_menu_block', $social_menu_block); $tpl->addGlobal('social_right_content', $social_right_content); echo $tpl->render('@template_style/social/inbox.html.twig'); } else { $content = $social_right_content; echo $actions; echo $content; }
/** * Gets current language iso code * * @return string */ function api_get_language_isocode() { return Container::getTranslator()->getLocale(); }