Exemple #1
0
}
if ($learnPath->current == $learnPath->get_last()) {
    $categories = Category::load(null, null, $course_code, null, null, $sessionId);
    if (!empty($categories)) {
        $gradebookEvaluations = $categories[0]->get_evaluations();
        $gradebookLinks = $categories[0]->get_links();
        if (count($gradebookEvaluations) === 0 && count($gradebookLinks) === 1 && $gradebookLinks[0]->get_type() == LINK_LEARNPATH && $gradebookLinks[0]->get_ref_id() == $learnPath->lp_id) {
            $gradebookMinScore = $categories[0]->get_certificate_min_score();
            $userScore = $gradebookLinks[0]->calc_score($user_id, 'best');
            if ($userScore[0] >= $gradebookMinScore) {
                Category::register_user_certificate($categories[0]->get_id(), $user_id);
            }
        }
    }
}
$template = \Chamilo\CoreBundle\Framework\Container::getTwig();
$template->addGlobal('glossary_extra_tools', api_get_setting('glossary.show_glossary_in_extra_tools'));
$fixLinkSetting = api_get_configuration_value('lp_fix_embed_content');
$fixLink = '';
if ($fixLinkSetting) {
    $fixLink = '{type:"script", id:"_fr10", src:"' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/fixlinks.js"}';
}
$template->addGlobal('fix_link', $fixLink);
$template->addGlobal('glossary_tool_availables', ['true', 'lp', 'exercise_and_lp']);
// If the global gamification mode is enabled...
$gamificationMode = api_get_setting('platform.gamification_mode');
// ...AND this learning path is set in gamification mode, then change the display
$gamificationMode = $gamificationMode && $learnPath->seriousgame_mode;
$template->addGlobal('show_glossary_in_documents', api_get_setting('document.show_glossary_in_documents'));
$template->addGlobal('jquery_web_path', api_get_jquery_web_path());
$template->addGlobal('jquery_ui_js_web_path', api_get_jquery_ui_js_web_path());
            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;
}
Exemple #3
0
$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]);
Exemple #4
0
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;
 /**
  * Return Session Catalogue rendered view
  * @param string $action
  * @param string $nameTools
  * @param array $limit
  */
 public function sessionsList($action, $nameTools, $limit = array())
 {
     $date = isset($_POST['date']) ? $_POST['date'] : date('Y-m-d');
     $hiddenLinks = isset($_GET['hidden_links']) ? intval($_GET['hidden_links']) == 1 : false;
     $limit = isset($limit) ? $limit : CourseCategoryManager::getLimitArray();
     $countSessions = $this->model->countSessions($date);
     $sessions = $this->model->browseSessions($date, $limit);
     $pageTotal = intval(ceil(intval($countSessions) / $limit['length']));
     // Do NOT show pagination if only one page or less
     $cataloguePagination = $pageTotal > 1 ? CourseCategoryManager::getCatalogPagination($limit['current'], $limit['length'], $pageTotal) : '';
     $sessionsBlocks = $this->getFormatedSessionsBlock($sessions);
     // Get session list catalogue URL
     //$sessionUrl = CourseCategoryManager::getCourseCategoryUrl(1, $limit['length'], null, 0, 'display_sessions');
     // Get session search catalogue URL
     $courseUrl = CourseCategoryManager::getCourseCategoryUrl(1, $limit['length'], null, 0, 'subscribe');
     $tpl = \Chamilo\CoreBundle\Framework\Container::getTwig();
     $tpl->addGlobal('show_courses', CoursesAndSessionsCatalog::showCourses());
     $tpl->addGlobal('show_sessions', CoursesAndSessionsCatalog::showSessions());
     $tpl->addGlobal('show_tutor', api_get_setting('session.show_session_coach') === 'true' ? true : false);
     $tpl->addGlobal('course_url', $courseUrl);
     $tpl->addGlobal('catalog_pagination', $cataloguePagination);
     $tpl->addGlobal('hidden_links', $hiddenLinks);
     $tpl->addGlobal('search_token', Security::get_token());
     $tpl->addGlobal('search_date', $date);
     $tpl->addGlobal('web_session_courses_ajax_url', api_get_path(WEB_AJAX_PATH) . 'course.ajax.php');
     $tpl->addGlobal('sessions', $sessionsBlocks);
     $tpl->addGlobal('already_subscribed_label', $this->getAlreadyRegisteredInSessionLabel());
     echo $tpl->render('@template_style/auth/session_catalog.html.twig');
 }
 /**
  * Shows the avatar block in social pages
  *
  * @param string highlight link possible values:
  * group_add,
  * home,
  * messages,
  * messages_inbox,
  * messages_compose,
  * messages_outbox,
  * invitations,
  * shared_profile,
  * friends,
  * groups search
  * @param int group id
  * @param int user id
  *
  */
 public static function show_social_avatar_block($show = '', $group_id = 0, $user_id = 0)
 {
     if (empty($user_id)) {
         $user_id = api_get_user_id();
     }
     $show_groups = array('groups', 'group_messages', 'messages_list', 'group_add', 'mygroups', 'group_edit', 'member_list', 'invite_friends', 'waiting_list', 'browse_groups');
     $template = Container::getTwig();
     if (in_array($show, $show_groups) && !empty($group_id)) {
         // Group image
         $userGroup = new UserGroup();
         $group_info = $userGroup->get($group_id);
         $userGroupImage = $userGroup->get_picture_group($group_id, $group_info['picture'], 160, GROUP_IMAGE_SIZE_BIG);
         $template->addGlobal('show_group', true);
         $template->addGlobal('group_id', $group_id);
         $template->addGlobal('user_group_image', $userGroupImage);
         $template->addGlobal('user_group', $group_info);
         $template->addGlobal('user_is_group_admin', $userGroup->is_group_admin($group_id, api_get_user_id()));
     } else {
         $template->addGlobal('show_group', false);
         $template->addGlobal('show_user', true);
         $template->addGlobal('user_image', ['big' => UserManager::getUserPicture($user_id, USER_IMAGE_SIZE_BIG), 'normal' => UserManager::getUserPicture($user_id, USER_IMAGE_SIZE_MEDIUM)]);
     }
     $content = $template->render('@template_style/social/avatar_block.html.twig');
     return $content;
 }
Exemple #7
0
                Display::addFlash(Display::return_message(get_lang('DocDeleted')));
                header('Location: ' . $url);
                exit;
                break;
        }
        $comments = getWorkComments($work);
        $commentForm = getWorkCommentForm($work);
        $tpl = Container::getTwig();
        $tpl->addGlobal('work', $work);
        $tpl->addGlobal('comments', $comments);
        $actions = '';
        if (isset($work['contains_file'])) {
            if (isset($work['download_url'])) {
                $actions .= Display::url(Display::return_icon('save.png', get_lang('Download'), null, ICON_SIZE_MEDIUM), $work['download_url']);
                if (isset($work['url_correction'])) {
                    $actions .= Display::url(Display::return_icon('check.png', get_lang('Correction'), null, ICON_SIZE_MEDIUM), $work['download_url'] . '&correction=1');
                }
            }
        }
        $tpl->addGlobal('actions', $actions);
        if (api_is_allowed_to_session_edit()) {
            $tpl->addGlobal('form', $commentForm);
        }
        $tpl->addGlobal('is_allowed_to_edit', api_is_allowed_to_edit());
        echo Container::getTwig()->render('@template_style/work/view.html.twig');
    } else {
        api_not_allowed(true);
    }
} else {
    api_not_allowed(true);
}