function referentiel_select_referentiels($params)
{
    // affichage de la liste des referentiels plus bouton de selection
    $str = "";
    $referentiels = referentiel_get_referentiel_referentiels($params);
    if ($referentiels) {
        // DEBUG
        // echo "<br/>DEBUG :: print_lib_referentiel.php LIGNE 12 <br />\n";
        // print_r($referentiels);
        foreach ($referentiels as $record) {
            $referentiel_id = $record->id;
            $name = stripslashes($record->name);
            $code_referentiel = stripslashes($record->code_referentiel);
            /*
            $description_referentiel = $record->description_referentiel;
            $url_referentiel = $record->url_referentiel;
            $seuil_certificat = $record->seuil_certificat;
            $timemodified = $record->timemodified;
            $nb_domaines = $record->nb_domaines;
            */
            $liste_codes_competence = $record->liste_codes_competence;
            // cours ?
            if (isset($record->course)) {
                $referentiel_course = $record->course;
            } else {
                $referentiel_course = 0;
            }
            // local ou global ?
            if (isset($record->local)) {
                $referentiel_local = $record->local;
            } else {
                $referentiel_local = 0;
            }
            if (isset($record->pass_referentiel) && $record->pass_referentiel != '') {
                $referentiel_pass = $record->pass_referentiel;
            } else {
                $referentiel_pass = '';
            }
            $str .= '<input type="radio" name="referentiel_id" value="' . $referentiel_id . '" />';
            $str .= $name . " (" . $code_referentiel . ") ";
            if (isset($referentiel_local) && $referentiel_local != 0) {
                $str .= get_string("local", "referentiel") . "\n";
            } else {
                $str .= get_string("global", "referentiel") . "\n";
            }
            // echo("<br />".$liste_codes_competence);
            if ($referentiel_pass != '') {
                $str .= ' <i>' . get_string("check_pass_referentiel", "referentiel") . '</i> : <input type="password" name="referentiel_pass_' . $referentiel_id . '" id="referentiel_pass_' . $referentiel_id . '" value="" />';
                $str .= ' <input type="hidden" name="givepass_' . $referentiel_id . '" id="givepass_' . $referentiel_id . '" value="1" />';
            } else {
                $str .= ' <input type="hidden" name="givepass_' . $referentiel_id . '" id="givepass_' . $referentiel_id . '" value="0" />';
            }
            $str .= "\n<br />\n";
        }
        $str .= "\n";
    }
    return $str;
}
예제 #2
0
function referentiel_cron_archives()
{
    global $CFG;
    global $DB;
    if ($CFG->referentiel_purge_archives) {
        // purge automatique des archives
        require_once 'lib_archive.php';
        mtrace("DEBUT CRON PURGE REFERENTIEL ARCHIVES");
        // Archives older than REFERENTIEL_ARCHIVE_OBSOLETE days will be deleted.
        $delai_destruction = REFERENTIEL_ARCHIVE_OBSOLETE * 24 * 3600;
        /// Get all the appropriate data
        $referentiel_referentiels = referentiel_get_referentiel_referentiels(NULL);
        // Liste des occurrences de referentiels
        foreach ($referentiel_referentiels as $referentiel_referentiel) {
            if ($referentiel_referentiel) {
                // Liste d'instances de cette occurence
                $referentiel_instances = $DB->get_records("referentiel", array("ref_referentiel" => "{$referentiel_referentiel->id}"));
                if ($referentiel_instances) {
                    foreach ($referentiel_instances as $referentiel_instance) {
                        $course_instance = $DB->get_record('course', array('id' => $referentiel_instance->course));
                        if ($course_instance) {
                            $course_module = get_coursemodule_from_instance('referentiel', $referentiel_instance->id, $course_instance->id);
                            if ($course_module) {
                                $context_instance = context_module::instance($course_module->id);
                                if ($context_instance) {
                                    // purger les archives obsoletes
                                    referentiel_purge_archives($context_instance->id, $delai_destruction, true);
                                }
                            }
                        }
                    }
                }
            }
        }
        mtrace("FIN CRON PURGE REFERENTIEL ARCHIVES.\n");
    }
}
예제 #3
0
// d'après ./report/question/
require_once dirname(__FILE__) . '/../../config.php';
require_once $CFG->libdir . '/adminlib.php';
require_once $CFG->dirroot . '/mod/referentiel/lib.php';
require_once $CFG->dirroot . '/mod/referentiel/locallib.php';
require_once $CFG->dirroot . '/mod/referentiel/version.php';
require_once $CFG->dirroot . '/mod/referentiel/lib_archive.php';
// archivage
/// Get all required strings
$baseUrl = '/report/referentiel/';
$reportCss = $baseUrl . 'report_referentiel.css';
$base_url = $CFG->wwwroot . $baseUrl;
$strreferentiels = get_string("modulenameplural", "referentiel");
$strreferentiel = get_string("modulename", "referentiel");
/// Get all the appropriate data
$referentiel_referentiels = referentiel_get_referentiel_referentiels(NULL);
$joursdedelai = optional_param('joursdedelai', -1, PARAM_INT);
// desherence
if ($joursdedelai < 0) {
    if (isset($CFG->delaidesherence)) {
        $joursdedelai = $CFG->delaidesherence;
    } else {
        $joursdedelai = JOURS_DESHERENCE;
    }
}
if ($joursdedelai < 0) {
    $joursdedelai = 0;
}
$delai = 3600 * 24 * $joursdedelai;
$strselection = '';
if (!empty($CFG->ref_profilecategory) && !empty($CFG->ref_profilefield)) {