} else {
            $userList = array();
            if (!empty($filterOfficialCodeGet)) {
                $userList = UserManager::getUsersByOfficialCode($filterOfficialCodeGet);
            }
        }
        Category::exportAllCertificates($cat_id, $userList);
        break;
    case 'generate_all_certificates':
        $user_list = CourseManager::get_user_list_from_course_code(api_get_course_id(), api_get_session_id());
        if (!empty($user_list)) {
            foreach ($user_list as $user_info) {
                if ($user_info['status'] == INVITEE) {
                    continue;
                }
                Category::register_user_certificate($cat_id, $user_info['user_id']);
            }
        }
        break;
    case 'delete_all_certificates':
        Category::deleteAllCertificates($cat_id);
        break;
}
$course_code = api_get_course_id();
$interbreadcrumb[] = array('url' => Security::remove_XSS($_SESSION['gradebook_dest']) . '?', 'name' => get_lang('Gradebook'));
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('GradebookListOfStudentsCertificates'));
$this_section = SECTION_COURSES;
Display::display_header('');
if (isset($_GET['action']) && $_GET['action'] == 'delete') {
    $check = Security::check_token('get');
    if ($check) {
Example #2
0
} else {
    $addparams['cidReq'] = '';
}
$no_qualification = false;
// Show certificate link.
$certificate = array();
$actionsLeft = '';
if ($category != '0') {
    $cat = new Category();
    $category_id = intval($_GET['selectcat']);
    $course_id = CourseManager::get_course_by_category($category_id);
    $show_message = $cat->show_message_resource_delete($course_id);
    if ($show_message == '') {
        // Student
        if (!api_is_allowed_to_edit() && !api_is_excluded_user_type()) {
            $certificate = Category::register_user_certificate($category_id, $stud_id);
            if (isset($certificate['pdf_url'])) {
                $actionsLeft .= Display::url(Display::returnFontAwesomeIcon('file-pdf-o') . get_lang('DownloadCertificatePdf'), $certificate['pdf_url'], ['class' => 'btn btn-default']);
            }
            $currentScore = Category::getCurrentScore($stud_id, $category_id, $course_code, $session_id, true);
            Category::registerCurrentScore($currentScore, $stud_id, $category_id);
        }
    }
}
if (!api_is_allowed_to_edit(null, true)) {
    $actionsLeft .= Display::url(Display::returnFontAwesomeIcon('file-pdf-o') . get_lang('DownloadReportPdf'), api_get_self() . "?" . api_get_self() . "&action=export_table", ['class' => 'btn btn-default']);
}
echo $toolbar = Display::toolbarAction('gradebook-student-actions', array(0 => $actionsLeft, 1 => ''));
if (api_is_allowed_to_edit(null, true)) {
    // Tool introduction
    Display::display_introduction_section(TOOL_GRADEBOOK, array('ToolbarSet' => 'AssessmentsIntroduction'));
Example #3
0
    $buttonHomeText = get_lang('LearningPathList');
}
$lpPreviewImagePath = api_get_path(WEB_IMG_PATH) . 'icons/64/unknown.png';
if ($learnPath->get_preview_image()) {
    $lpPreviewImagePath = $learnPath->get_preview_image_path();
}
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');
<?php

/* For licensing terms, see /license.txt */
/**
 * Adds gradebook certificates to gradebook_certificate table from users
 * who have achieved the requirements but have not reviewed them yet
 * @package chamilo.cron
 * @author Imanol Losada <*****@*****.**>
 */
require_once __DIR__ . '/../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH) . 'database.lib.php';
require_once api_get_path(SYS_CODE_PATH) . 'gradebook/lib/gradebook_functions.inc.php';
/**
 * Get all categories and users ids from gradebook
 * @return array Categories and users ids
 */
function getAllCategoriesAndUsers()
{
    $table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_RESULT);
    $jointable = Database::get_main_table(TABLE_MAIN_GRADEBOOK_EVALUATION);
    $joinStatement = ' JOIN ' . $jointable . ' ON ' . $table . '.evaluation_id = ' . $jointable . '.id';
    return Database::select('DISTINCT ' . $jointable . '.category_id,' . $table . '.user_id', $table . $joinStatement);
}
if ($categoriesAndUsers = getAllCategoriesAndUsers()) {
    foreach ($categoriesAndUsers as $categoryAndUser) {
        Category::register_user_certificate($categoryAndUser['category_id'], $categoryAndUser['user_id']);
    }
}