function referentiel_print_taskid($taskid, $referentiel_instance)
{
    global $CFG;
    global $USER;
    static $isstudent = false;
    static $isauthor = false;
    static $iseditor = false;
    static $referentiel_id = NULL;
    global $DB;
    if (!empty($referentiel_instance)) {
        // contexte
        $cm = get_coursemodule_from_instance('referentiel', $referentiel_instance->id);
        $course = $DB->get_record('course', array("id" => "{$cm->course}"));
        if (empty($cm) or empty($course)) {
            print_error('REFERENTIEL_ERROR 5 :: print_lib_task.php :: You cannot call this script in that way');
        }
        // Valable pour Moodle 2.1 et Moodle 2.2
        //if ($CFG->version < 2011120100) {
        $context = context_module::instance($cm->id);
        //} else {
        // $context = context_module::instance($cm);
        //}
        $referentiel_id = $referentiel_instance->ref_referentiel;
        $isauthor = has_capability('mod/referentiel:addtask', $context);
        $isstudent = has_capability('mod/referentiel:selecttask', $context) && !$isauthor;
        $iseditor = has_capability('mod/referentiel:writereferentiel', $context);
        if (isset($referentiel_id) && $referentiel_id > 0) {
            $referentiel_referentiel = referentiel_get_referentiel_referentiel($referentiel_id);
            if (!$referentiel_referentiel) {
                if ($iseditor) {
                    error(get_string('creer_referentiel', 'referentiel'), "{$CFG->wwwroot}/mod/referentiel/edit.php?d={$referentiel_instance->id}&amp;mode=editreferentiel&amp;sesskey=" . sesskey());
                } else {
                    print_error(get_string('creer_referentiel', 'referentiel'), "{$CFG->wwwroot}/course/view.php?id={$course->id}&amp;sesskey=" . sesskey());
                }
            }
            $record = referentiel_get_task($taskid);
            // cette tache même si non auteur
            if ($record) {
                if (!$record->tache_masquee || $isauthor) {
                    // Afficher
                    referentiel_print_task_detail($record, $context);
                    referentiel_menu_task_detail($context, $record->id, $referentiel_instance->id, $record->date_fin < time(), $record->tache_masquee);
                }
            }
        }
        echo '<br /><br />' . "\n";
    }
}
 if (!isset($form->sesskey)) {
     $form->sesskey = sesskey();
 }
 if (!isset($form->modulename)) {
     $form->modulename = 'referentiel';
 }
 // preparer les variables globales pour Overlib
 referentiel_initialise_data_referentiel($referentiel_referentiel->id);
 // Charger la tache
 // filtres
 $isauthor = has_capability('mod/referentiel:addtask', $context);
 $iseditor = has_capability('mod/referentiel:writereferentiel', $context);
 // DEBUG
 // echo "<br />DEBUG :: task.html :: 299 :: TACHE : $taskid :: REFERENTIEL : $referentiel->id<br\n";
 $liste_codes_competence = referentiel_get_liste_codes_competence($referentiel_referentiel->id);
 $record_t = referentiel_get_task($taskid, 0);
 // print_r($record_t);
 if (!$record_t) {
     print_error(get_string('notask', 'referentiel'), "task.php?d={$referentiel->idid}&amp;select_acc={$select_acc}&amp;mode=update");
 } else {
     if ($record_t) {
         // DEBUG
         // echo "<br/>DEBUG ::<br />\n";
         // print_object($record_task);
         echo "\n" . '<script type="text/javascript" src="dhtmlgoodies_calendar.js"></script>' . "\n";
         $taskid = $record_t->id;
         $type_task = stripslashes($record_t->type_task);
         $description_task = stripslashes($record_t->description_task);
         $competences_task = stripslashes($record_t->competences_task);
         $criteres_evaluation = stripslashes($record_t->criteres_evaluation);
         $ref_instance = $record_t->ref_instance;