Exemplo n.º 1
0
function referentiel_print_liste_tasks($mode, $referentiel_instance, $userid_filtre = 0)
{
    global $CFG;
    global $USER;
    static $isteacher = false;
    static $isauthor = false;
    static $iseditor = false;
    static $referentiel_id = NULL;
    global $DB;
    if (!empty($referentiel_instance)) {
        $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 :: 568 :: You cannot call this script in that way');
        }
        $context = context_module::instance($cm->id);
        $records = array();
        $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) {
                    print_error(get_string('creer_referentiel', 'referentiel'), "edit.php?d={$referentiel_instance->id}&mode=editreferentiel&sesskey=" . sesskey());
                } else {
                    print_error(get_string('creer_referentiel', 'referentiel'), "../../course/view.php?id={$course->id}&sesskey=" . sesskey());
                }
            }
            // preparer les variables globales pour Overlib
            referentiel_initialise_data_referentiel($referentiel_referentiel->id);
            $record_tasks = referentiel_get_all_tasks($course->id, $referentiel_instance->id);
            // toutes les taches
            if ($record_tasks) {
                // Afficher
                if (isset($mode) && $mode == 'listtasksingle') {
                } else {
                    echo referentiel_print_entete_task();
                }
                $num = 0;
                foreach ($record_tasks as $record) {
                    // afficher les taches
                    if (!$record->tache_masquee || $isauthor) {
                        if (isset($mode) && $mode == 'listtasksingle') {
                            referentiel_print_task_detail($record, $context, 1, $num);
                            referentiel_menu_task_detail($context, $record->id, $referentiel_instance->id, $record->date_fin < time(), $record->tache_masquee);
                        } else {
                            if ($isstudent) {
                                echo referentiel_print_task($record, $context, $USER->id);
                            } else {
                                echo referentiel_print_task($record, $context);
                            }
                        }
                        $num++;
                    }
                }
                // Afficher
                if (isset($mode) && $mode == 'listtasksingle') {
                } else {
                    echo referentiel_print_enqueue_task();
                }
                echo '<br /><br />' . "\n";
            }
        }
    }
}
Exemplo n.º 2
0
            }
            if (!isset($form->url_consigne)) {
                $form->url_consigne = '';
            }
            if (!isset($form->sesskey)) {
                $form->sesskey = sesskey();
            }
            if (!isset($form->modulename)) {
                $form->modulename = 'referentiel';
            }
            // Charger les taches
            // filtres
            $isauthor = has_capability('mod/referentiel:addtask', $context);
            $iseditor = has_capability('mod/referentiel:writereferentiel', $context);
            $liste_codes_competence = referentiel_get_liste_codes_competence($referentiel_referentiel->id);
            $records_task = referentiel_get_all_tasks($course->id, $referentiel->id);
            if ($records_task) {
                // DEBUG
                // echo "<br/>DEBUG ::<br />\n";
                // print_object($records_task);
                // preparer les variables globales pour Overlib
                referentiel_initialise_data_referentiel($referentiel_referentiel->id);
                echo "\n" . '<link type="text/css" rel="stylesheet" href="dhtmlgoodies_calendar.css" media="screen"></link>
<script type="text/javascript" src="dhtmlgoodies_calendar.js"></script>' . "\n";
                foreach ($records_task as $record_t) {
                    $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;