function referentiel_boites_selections($context, $mode, $cm, $course, $referentiel_instance, $initiale = 0, $userids = '', $userid_filtre = 0, $gusers = NULL, $data_f, $select_acc = 0)
{
    global $CFG;
    global $DB;
    global $USER;
    static $istutor = false;
    static $isteacher = false;
    static $isadmin = false;
    static $iseditor = false;
    static $referentiel_id = NULL;
    global $COURSE;
    $records = array();
    $referentiel_id = $referentiel_instance->ref_referentiel;
    $roles = referentiel_roles_in_instance($referentiel_instance->id);
    $iseditor = $roles->is_editor;
    $isadmin = $roles->is_admin;
    $isteacher = $roles->is_teacher;
    $istutor = $roles->is_tutor;
    $isstudent = $roles->is_student;
    $isguest = $roles->is_guest;
    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'), "{$CFG->wwwroot}/mod/referentiel/edit.php?d={$referentiel_instance->id}&mode=editreferentiel&sesskey=" . sesskey());
            } else {
                print_error(get_string('creer_referentiel', 'referentiel'), "{$CFG->wwwroot}/course/view.php?id={$course->id}&sesskey=" . sesskey());
            }
        }
        // global variables for Overlib
        referentiel_initialise_descriptions_items_referentiel($referentiel_referentiel->id);
        // Users select Boxes - boite pour selectionner les utilisateurs
        if ($isteacher || $iseditor || $istutor) {
            referentiel_boites_selections_users($cm, $course, $context, $mode, $referentiel_instance, $initiale, $userids, $userid_filtre, $gusers, $select_acc);
        } else {
            $userid_filtre = $USER->id;
            // les étudiants ne peuvent voir que leur fiche
        }
        echo referentiel_modifie_entete_activite_complete_filtre("activite.php?id={$cm->id}&select_acc={$select_acc}&courseid={$course->id}&userid={$userid_filtre}&mode={$mode}&sesskey=" . sesskey(), $data_f, false, false);
        //echo referentiel_print_enqueue_activite();
        echo '<br /><br />' . "\n";
    }
}
function referentiel_select_accompagnement($mode, $referentiel_instance, $teacherid = 0, $userid_filtre = 0, $gusers = NULL, $select_acc = 0)
{
    global $CFG;
    global $DB;
    global $USER;
    static $istutor = false;
    static $isteacher = false;
    static $isadmin = false;
    static $isstudent = false;
    static $referentiel_id = NULL;
    // A COMPLETER
    $data = NULL;
    // 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_accompagnement.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);
    //}
    $records = array();
    $referentiel_id = $referentiel_instance->ref_referentiel;
    $roles = referentiel_roles_in_instance($referentiel_instance->id);
    $iseditor = $roles->is_editor;
    $isadmin = $roles->is_admin;
    $isteacher = $roles->is_teacher;
    $istutor = $roles->is_tutor;
    $isstudent = $roles->is_student;
    /*
    // DEBUG
        if ($iseditor) echo "Editor ";
        if ($isadmin) echo "Admin ";
    if ($isteacher) echo "Teacher ";
    if ($istutor) echo "Tutor ";
    if ($isstudent) echo "Student ";
    */
    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'), "{$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());
            }
        }
        // boite pour selectionner les utilisateurs ?
        if ($isadmin || $isteacher || $istutor) {
            // tous les users possibles (pour la boite de selection)
            // Get your userids the normal way
            // ICI on affiche tous les utilisateurs
            $record_id_users = referentiel_get_students_course($course->id, 0, 0);
            //seulement les stagiaires
            if ($gusers && $record_id_users) {
                // liste des utilisateurs du groupe courant
                // echo "<br />DEBUG :: print_lib_accompagnement.php :: 740 :: GUSERS<br />\n";
                // print_object($gusers);
                // echo "<br />\n";
                // exit;
                $record_users = array_intersect($gusers, array_keys($record_id_users));
                // echo "<br />DEBUG :: print_lib_accompagnement.php :: 745 :: RECORD_USERS<br />\n";
                // print_r($record_users  );
                // echo "<br />\n";
                // recopier
                $record_id_users = array();
                foreach ($record_users as $record_id) {
                    $a_obj = new stdClass();
                    $a_obj->userid = $record_id;
                    $record_id_users[] = $a_obj;
                }
            }
            $record_teachers = referentiel_get_teachers_course($course->id);
            echo referentiel_select_accompagnement_users_teachers($referentiel_instance->id, $course->id, $mode, $record_id_users, $record_teachers, $userid_filtre, $select_acc);
        }
    }
    echo '<br /><br />' . "\n";
    return true;
}
function referentiel_print_graph_certificats($referentiel_instance, $referentiel_referentiel, $gusers, $currentgroup = 0)
{
    global $DB;
    global $CFG;
    global $USER;
    // 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_certificat.php :: You cannot call this script in that way');
    }
    $context = context_module::instance($cm->id);
    $roles = referentiel_roles_in_instance($referentiel_instance->id);
    $iseditor = $roles->is_editor;
    $isadmin = $roles->is_admin;
    $isteacher = $roles->is_teacher;
    $istutor = $roles->is_tutor;
    $isstudent = $roles->is_student;
    $isguest = $roles->is_guest;
    // codes item
    $liste_codes = referentiel_purge_dernier_separateur($referentiel_referentiel->liste_codes_competence, '/');
    // empreintes
    $liste_empreintes = referentiel_purge_dernier_separateur($referentiel_referentiel->liste_empreintes_competence, '/');
    // poids
    $liste_poids = referentiel_purge_dernier_separateur($referentiel_referentiel->liste_poids_competence, '/');
    // cours ?
    if (!empty($course)) {
        $course_name = $course->shortname;
    } else {
        $course_name = "";
    }
    // groupes ?
    if (!empty($currentgroup)) {
        $group_name = groups_get_group_name($currentgroup);
    } else {
        $group_name = "";
    }
    $titre = get_string('certification_etat', 'referentiel');
    if (!empty($course_name)) {
        $titre .= ' (' . $course_name;
        if (!empty($group_name)) {
            $titre .= ' - ' . $group_name;
        }
        $titre .= ')';
    }
    $titre = str_replace(' ', '_', $titre);
    // utilisateurs
    $record_id_users = referentiel_get_students_course($course->id, 0, 0);
    //seulement les stagiaires
    // groupes ?
    if ($gusers && $record_id_users) {
        $record_users = array_intersect($gusers, array_keys($record_id_users));
        // recopier
        $record_id_users = array();
        foreach ($record_users as $record_id) {
            $a_obj = new stdClass();
            $a_obj->userid = $record_id;
            $record_id_users[] = $a_obj;
        }
    }
    if ($record_id_users) {
        // Afficher
        foreach ($record_id_users as $record_id) {
            // afficher la liste d'users
            // recupere les enregistrements de certificats ou les cree si necessaire
            $records_c[] = referentiel_certificat_user($record_id->userid, $referentiel_referentiel->id);
        }
        if ($records_c) {
            // Let's get the datas
            $separateur1 = '/';
            $separateur2 = ':';
            $separateur3 = '|';
            $t_user = array();
            // tableau des userid
            $t_code = explode($separateur1, $liste_codes);
            $t_empreinte = explode($separateur1, $liste_empreintes);
            $t_poids = explode($separateur1, $liste_poids);
            $moyennes = array();
            $t_valides = array(array());
            // $t_declarees = array(array());
            $user_name_souligne = "";
            foreach ($records_c as $record_c) {
                // pour tous les certificats
                if ($record_c) {
                    $certificat_id = $record_c->id;
                    $commentaire_certificat = stripslashes($record_c->commentaire_certificat);
                    $synthese_certificat = stripslashes($record_c->synthese_certificat);
                    $competences_certificat = $record_c->competences_certificat;
                    $competences_activites = $record_c->competences_activite;
                    $decision_jury = stripslashes($record_c->decision_jury);
                    $date_decision = $record_c->date_decision;
                    $ref_referentiel = $record_c->ref_referentiel;
                    $user_id = $record_c->userid;
                    $teacherid = $record_c->teacherid;
                    $verrou = $record_c->verrou;
                    $dossier_ferme = $record_c->valide;
                    $evaluation = $record_c->evaluation;
                    $user_name = referentiel_get_user_nom($user_id) . ' ' . referentiel_get_user_prenom($user_id);
                    $user_info = referentiel_get_user_info($user_id);
                    $teacher_info = referentiel_get_user_info($teacherid);
                    // dates
                    $date_decision_info = userdate($date_decision);
                    //$t_user[]=$user_name;
                    $t_user[] = $user_id;
                    // competences validees dans le certificat
                    $tc = array();
                    $lcc = referentiel_purge_dernier_separateur($competences_certificat, $separateur1);
                    if (!empty($lcc)) {
                        $tc = explode($separateur1, $lcc);
                        // A.1.1:1 A.1.2:1 A.1.3:1 A.1.4:0/A.1.5:0/A.2.1:1/A.2.2:0/A.2.3:0/A.3.1:0/A.3.2:0/A.3.3:0/A.3.4:0/B.1.1:0/B.1.2:0/B.1.3:0/B.2.1:1/B.2.2:1/B.2.3:0/B.2.4:0/B.3.1:0/B.3.2:0/B.3.3:0/B.3.4:0/B.3.5:0/B.4.1:0/B.4.2:0/B.4.3:0/
                        $i = 0;
                        while ($i < count($tc)) {
                            // CODE1:N1
                            // DEBUG
                            // echo "<br />".$tc[$i]." <br />\n";
                            if ($tc[$i] != '') {
                                $tcc = explode($separateur2, $tc[$i]);
                                // A.1.1 1
                                if (isset($tcc[1])) {
                                    // $t_valides[$userid][]=$tcc[1];
                                    //$t_valides[$user_name][]=min($tcc[1], $t_empreinte[$i]) ;
                                    $t_valides[$user_id][] = min($tcc[1], $t_empreinte[$i]);
                                }
                            }
                            $i++;
                        }
                    }
                    /*
                        // competences declarees dans les activites
                        $tc=array();
                        $lcd=referentiel_purge_dernier_separateur($competences_activites, $separateur1);
                        if (!empty($lcd)){
                            $tc = explode ($separateur1, $lcd);
                            // A.1.1:1 A.1.2:1 A.1.3:1 A.1.4:0/A.1.5:0/A.2.1:1/A.2.2:0/A.2.3:0/A.3.1:0/A.3.2:0/A.3.3:0/A.3.4:0/B.1.1:0/B.1.2:0/B.1.3:0/B.2.1:1/B.2.2:1/B.2.3:0/B.2.4:0/B.3.1:0/B.3.2:0/B.3.3:0/B.3.4:0/B.3.5:0/B.4.1:0/B.4.2:0/B.4.3:0/
                            $i=0;
                            while ($i<count($tc)){
                                // CODE1:N1
                                // DEBUG
                                // echo "<br />".$tc[$i]." <br />\n";
                                // exit;
                                if ($tc[$i]!=''){
                                    $tcc=explode($separateur2, $tc[$i]);
                                    // A.1.1 1
                                    if (isset($tcc[1])){
                    					                   $t_declarees[$user_name][]=$tcc[1];
                    				}
                    			                    }
                                $i++;
                            }
                        }
                    */
                }
            }
            // calculer la moyenne
            $n = 0;
            for ($i = 0; $i < count($t_user); $i++) {
                //$valeurs=$t_valides[$t_user[$i]];
                // moyenne
                $n++;
                $moyennes = referentiel_somme_valeur($moyennes, $t_valides[$t_user[$i]]);
            }
            $moyennes = referentiel_quotient_valeur($moyennes, $n);
            $lmoyennes = implode("/", $moyennes);
            // Distribuer les data sur plusieurs images
            // pagination
            $page0 = 0;
            $page1 = 0;
            $nbuser = count($t_user);
            $page = 0;
            $pagemax = min($nbuser, MAXLIGNEGRAPH);
            $npages = (int) ($nbuser / $pagemax);
            $reste = (int) ($nbuser % $pagemax);
            if ($reste) {
                $npages++;
            }
            /*
                    // DEBUG
                    echo "<br />DEBUG :: 1858 :: CODE<br />\n";
                    print_r($t_code);
                    echo "<br /> EMPREINTES<br />\n";
                    print_r($t_empreinte);
                    echo "<br /> POIDS<br />\n";
                    print_r($t_poids);
            
                    echo "<br />DEBUG :: 1858 :: USERS<br />\n";
                    print_r($t_user);
                    echo "<br />COMPETENCES VALIDES<br />\n";
                    for ($i=0; $i<$nbuser; $i++){
                        echo "<br />User:"******" <br />\n";
                        print_r($t_valides[$t_user[$i]]);
                    }
            */
            // echo "<br />NBUSER: $nbuser  NBPAGES: $npages  PAGEMAX: $pagemax\n";
            for ($page = 0; $page < $npages; $page++) {
                // preparer les donnees
                $t_data = array(array());
                $j = 0;
                for ($j = 0; $j < $pagemax; $j++) {
                    if (isset($t_user[$page * $pagemax + $j])) {
                        $user_name = referentiel_get_user_nom($t_user[$page * $pagemax + $j]) . ' ' . referentiel_get_user_prenom($t_user[$page * $pagemax + $j]);
                        $t_data[$user_name] = $t_valides[$t_user[$page * $pagemax + $j]];
                    }
                }
                // DEBUG
                //echo "<br />DEBUG :: 1876 :: DATA<br />\n";
                //print_r($t_data);
                //echo "<br />DEBUG :: 1885 :: DATA<br />\n";
                $ltdata = "";
                foreach ($t_data as $key => $data) {
                    if ($data) {
                        //echo "<br />$key<br />\n";
                        //print_r($data);
                        $ldata = implode("/", $data);
                        $ltdata .= "{$key}:{$ldata}|";
                    }
                }
                // Afficher
                //echo '<br />DATA -&gt;'.$ltdata."\n";
                $num_page = $page + 1;
                if ($isteacher || $istutor || $isadmin) {
                    $affichage_complet = 1;
                } else {
                    $affichage_complet = 0;
                }
                //echo "<br />AFFCOMPLET : $affichage_complet\n";
                //redirect ($CFG->wwwroot.'/mod/referentiel/graph_certificats.php?d='.$referentiel_instance->id.'&amp;ltdata='.$ltdata.'&amp;lmoyennes='.$lmoyennes.'&amp;lcode='.$liste_codes.'&amp;lempreinte='.$liste_empreintes.'&amp;lpoids='.$liste_poids.'&amp;affcomplet='.$affichage_complet.'&amp;titre='.$titre.'&amp;page='.$num_page.'&amp;npages='.$npages);
                echo '<div align="center"><img src="' . $CFG->wwwroot . '/mod/referentiel/graph_certificats.php?d=' . $referentiel_instance->id . '&amp;ltdata=' . $ltdata . '&amp;lmoyennes=' . $lmoyennes . '&amp;lcode=' . $liste_codes . '&amp;lempreinte=' . $liste_empreintes . '&amp;lpoids=' . $liste_poids . '&amp;affcomplet=' . $affichage_complet . '&amp;titre=' . $titre . '&amp;page=' . $num_page . '&amp;npages=' . $npages . '" border="0" title="' . get_string('statcertif', 'referentiel') . '" /></div>' . "\n";
                echo '<br />' . "\n";
            }
        }
    }
}
Exemplo n.º 4
0
 function display()
 {
     global $USER;
     global $CFG;
     if (!empty($this->instance) && !empty($this->course) && !empty($this->cm)) {
         // Rôles dans le cours
         $roles = referentiel_roles_in_instance($this->instance->id);
         //print_object($roles);
         //exit;
         $isadmin = $roles->is_admin;
         $isstudent = $roles->is_student;
         $isguest = $roles->is_guest;
         $isreferentielauteur = referentiel_is_author($USER->id, $this->occurrence, !($isstudent or $isguest));
         // verifier si l'utilisateur peut ajouter des activites ou modifier son certificat
         $edition_autorisee = true;
         if ($isstudent) {
             $edition_autorisee = !referentiel_certificat_user_is_closed($USER->id, $this->occurrence->id);
         }
         $tabs = array();
         $row = array();
         $inactive = NULL;
         $activetwo = NULL;
         $url_param = array('id' => $this->cm->id, 'non_redirection' => '0', 'sesskey' => sesskey());
         // echo "<br>DEBUG :: onglets.php :: 105\n";
         // print_object($this->tfiltre);
         foreach ($this->tfiltre as $key => $value) {
             // echo '<br>'.$key.' : '.$value;
             $url_param[$key] = $value;
         }
         //echo "<br>DEBUG :: onglets.php :: 108\n";
         //print_object($url_param);
         //exit;
         // premier onglet
         if (has_capability('mod/referentiel:view', $this->context)) {
             $url_param['non_redirection'] = 1;
             $row[] = new tabobject('referentiel', new moodle_url('/mod/referentiel/view.php', $url_param), get_string('referentiel', 'referentiel'));
             $url_param['non_redirection'] = 0;
         }
         if (isloggedin()) {
             // accompagnement
             if (has_capability('mod/referentiel:write', $this->context)) {
                 $url_param['mode'] = 'accompagnement';
                 $row[] = new tabobject('menuacc', new moodle_url('/mod/referentiel/accompagnement.php', $url_param), get_string('accompagnement', 'referentiel'));
             }
             // activites
             if (referentiel_user_can_addactivity($this->instance)) {
                 $url_param['mode'] = 'list';
                 $row[] = new tabobject('list', new moodle_url('/mod/referentiel/activite.php?id', $url_param), get_string('edit_activity', 'referentiel'));
             }
             // taches
             if (has_capability('mod/referentiel:addtask', $this->context) || has_capability('mod/referentiel:viewtask', $this->context)) {
                 $url_param['mode'] = 'listtasksingle';
                 $row[] = new tabobject('task', new moodle_url('/mod/referentiel/task.php?', $url_param), get_string('tasks', 'referentiel'));
             }
             // gestion des certificats
             $certification_active = referentiel_get_certification_active($this->instance->id);
             if ($certification_active) {
                 if (has_capability('mod/referentiel:write', $this->context)) {
                     $url_param['mode'] = 'listcertif';
                     $row[] = new tabobject('certificat', new moodle_url('/mod/referentiel/certificat.php', $url_param), get_string('certificat', 'referentiel'));
                 }
             }
             // archivage du dossier numerique
             if (has_capability('mod/referentiel:write', $this->context)) {
                 $url_param['mode'] = 'archive';
                 $row[] = new tabobject('archive', new moodle_url('/mod/referentiel/archive.php', $url_param), get_string('archive', 'referentiel'));
             }
             // scolarite
             $scolarite_locale_visible = referentiel_get_item_configuration('scol', $this->instance->id) == 0;
             if ($scolarite_locale_visible && has_capability('mod/referentiel:viewscolarite', $this->context) || has_capability('mod/referentiel:managescolarite', $this->context)) {
                 $url_param['mode'] = 'listetudiant';
                 $row[] = new tabobject('scolarite', new moodle_url('/mod/referentiel/etudiant.php', $url_param), get_string('scolarite', 'referentiel'));
                 $url_param['mode'] = 'pedago';
                 $row[] = new tabobject('pedago', new moodle_url('/mod/referentiel/pedagogie.php', $url_param), get_string('formation', 'referentiel'));
             }
             $tabs[] = $row;
             // sous-onglets
             // ACCOMPAGNEMENT
             if (isset($this->currenttab) && has_capability('mod/referentiel:write', $this->context) && ($this->currenttab == 'menuacc' || $this->currenttab == 'accompagnement' || $this->currenttab == 'suivi' || $this->currenttab == 'notification')) {
                 $row = array();
                 $inactive[] = 'menuacc';
                 $row[] = new tabobject('accompagnement', new moodle_url('/mod/referentiel/accompagnement.php', $url_param), get_string('accompagnement', 'referentiel'));
                 $url_param['mode'] = 'suivi';
                 $row[] = new tabobject('suivi', new moodle_url('/mod/referentiel/accompagnement.php', $url_param), get_string('repartition', 'referentiel'));
                 if (has_capability('mod/referentiel:managecertif', $this->context)) {
                     // r�le enseignant
                     $url_param['mode'] = 'notification';
                     $row[] = new tabobject('notification', new moodle_url('/mod/referentiel/accompagnement.php', $url_param), get_string('notification', 'referentiel'));
                 }
                 $tabs[] = $row;
                 $activetwo = array('menuacc');
             }
             // ACTIVITE
             if (isset($this->currenttab) && ($this->currenttab == 'list' || $this->currenttab == 'listactivity' || $this->currenttab == 'listactivityall' || $this->currenttab == 'addactivity' || $this->currenttab == 'updateactivity' || $this->currenttab == 'exportactivity')) {
                 $row = array();
                 $inactive[] = 'list';
                 $url_param['mode'] = 'listactivity';
                 $row[] = new tabobject('listactivity', new moodle_url('/mod/referentiel/activite.php', $url_param), get_string('listactivity', 'referentiel'));
                 $url_param['mode'] = 'listactivityall';
                 $row[] = new tabobject('listactivityall', new moodle_url('/mod/referentiel/activite.php', $url_param), get_string('listactivityall', 'referentiel'));
                 if (has_capability('mod/referentiel:addactivity', $this->context)) {
                     if ($edition_autorisee) {
                         $url_param['mode'] = 'addactivity';
                         $row[] = new tabobject('addactivity', new moodle_url('/mod/referentiel/activite.php', $url_param), get_string('addactivity', 'referentiel'));
                     }
                 }
                 if (!has_capability('mod/referentiel:managecertif', $this->context)) {
                     // role etudiant : uniquement pour modifier une activite
                     if ($this->mode == 'modifactivity') {
                         $url_param['mode'] = 'modifactivity';
                         $row[] = new tabobject('modifactivity', new moodle_url('/mod/referentiel/activite.php', $url_param), get_string('modifactivity', 'referentiel'));
                     }
                 } else {
                     $url_param['mode'] = 'updateactivity';
                     $row[] = new tabobject('updateactivity', new moodle_url('/mod/referentiel/activite.php', $url_param), get_string('updateactivity', 'referentiel'));
                 }
                 if (has_capability('mod/referentiel:export', $this->context)) {
                     $url_param['mode'] = 'exportactivity';
                     $row[] = new tabobject('exportactivity', new moodle_url('/mod/referentiel/export_activite.php', $url_param), get_string('export', 'referentiel'));
                 }
                 $tabs[] = $row;
                 $activetwo = array('list');
             }
             // TACHES
             if (isset($this->currenttab) && ($this->currenttab == 'listtask' || $this->currenttab == 'listtasksingle' || $this->currenttab == 'selecttask' || $this->currenttab == 'imposetask' || $this->currenttab == 'addtask' || $this->currenttab == 'updatetask' || $this->currenttab == 'exporttask' || $this->currenttab == 'importtask')) {
                 $row = array();
                 $inactive[] = 'task';
                 if (has_capability('mod/referentiel:viewtask', $this->context)) {
                     $url_param['mode'] = 'listtask';
                     $row[] = new tabobject('listtask', new moodle_url('/mod/referentiel/task.php', $url_param), get_string('listtask', 'referentiel'));
                     $url_param['mode'] = 'listtasksingle';
                     $row[] = new tabobject('listtasksingle', new moodle_url('/mod/referentiel/task.php', $url_param), get_string('listtasksingle', 'referentiel'));
                 }
                 if (has_capability('mod/referentiel:addtask', $this->context)) {
                     $url_param['mode'] = 'addtask';
                     $row[] = new tabobject('addtask', new moodle_url('/mod/referentiel/task.php', $url_param), get_string('addtask', 'referentiel'));
                     $url_param['mode'] = 'updatetask';
                     $row[] = new tabobject('updatetask', new moodle_url('/mod/referentiel/task.php', $url_param), get_string('updatetask', 'referentiel'));
                 }
                 if (has_capability('mod/referentiel:import', $this->context)) {
                     $url_param['mode'] = 'importtask';
                     $row[] = new tabobject('importtask', new moodle_url('/mod/referentiel/import_task.php', $url_param), get_string('import', 'referentiel'));
                 }
                 if (has_capability('mod/referentiel:export', $this->context)) {
                     $url_param['mode'] = 'exporttask';
                     $row[] = new tabobject('exporttask', new moodle_url('/mod/referentiel/export_task.php', $url_param), get_string('export', 'referentiel'));
                 }
                 $tabs[] = $row;
                 $activetwo = array('task');
             }
             // SCOLARITE
             // http://localhost/moodle25/moodle/mod/referentiel/etudiant.php?id=7&non_redirection=0&sesskey=6AeeQWDljY&select_acc=0&mode=listcertif
             if (isset($this->currenttab) && (has_capability('mod/referentiel:viewscolarite', $this->context) || has_capability('mod/referentiel:managescolarite', $this->context)) && ($scolarite_locale_visible && $this->currenttab == 'scolarite' || $this->currenttab == 'listetudiant' || $this->currenttab == 'manageetab' || $this->currenttab == 'addetab' || $this->currenttab == 'listeetab' || $this->currenttab == 'exportetudiant' || $this->currenttab == 'importetudiant' || $this->currenttab == 'editetudiant')) {
                 $row = array();
                 $inactive[] = 'scolarite';
                 $url_param['mode'] = '';
                 $row[] = new tabobject('listetudiant', new moodle_url('/mod/referentiel/etudiant.php', $url_param), get_string('listetudiant', 'referentiel'));
                 if (has_capability('mod/referentiel:managescolarite', $this->context)) {
                     // import export
                     //if ($this->currenttab == 'editetudiant'){
                     $url_param['mode'] = 'updateetudiant';
                     $row[] = new tabobject('editetudiant', new moodle_url('/mod/referentiel/etudiant.php', $url_param), get_string('editetudiant', 'referentiel'));
                     //}
                     $url_param['mode'] = 'exportetudiant';
                     $row[] = new tabobject('exportetudiant', new moodle_url('/mod/referentiel/export_etudiant.php', $url_param), get_string('exportetudiant', 'referentiel'));
                     $url_param['mode'] = 'importetudiant';
                     $row[] = new tabobject('importetudiant', new moodle_url('/mod/referentiel/import_etudiant.php', $url_param), get_string('importetudiant', 'referentiel'));
                 }
                 if (has_capability('mod/referentiel:viewscolarite', $this->context)) {
                     // etablissement
                     $url_param['mode'] = 'listeetab';
                     $row[] = new tabobject('listeetab', new moodle_url('/mod/referentiel/etablissement.php', $url_param), get_string('etablissements', 'referentiel'));
                 }
                 if (has_capability('mod/referentiel:managescolarite', $this->context)) {
                     // etablissement
                     $url_param['mode'] = 'addetab';
                     $row[] = new tabobject('manageetab', new moodle_url('/mod/referentiel/etablissement.php', $url_param), get_string('manageetab', 'referentiel'));
                 }
                 if ($this->currenttab == '') {
                     $this->currenttab = 'listetudiant';
                     $this->mode = 'listetudiant';
                 }
                 $tabs[] = $row;
                 $activetwo = array('scolarite');
             }
             // PEDAGOGIE
             if (isset($this->currenttab) && (has_capability('mod/referentiel:viewscolarite', $this->context) || has_capability('mod/referentiel:managescolarite', $this->context)) && ($scolarite_locale_visible && $this->currenttab == 'pedago' || $this->currenttab == 'addpedago' || $this->currenttab == 'editpedago' || $this->currenttab == 'listpedago' || $this->currenttab == 'listasso' || $this->currenttab == 'selectasso' || $this->currenttab == 'editasso' || $this->currenttab == 'importpedago' || $this->currenttab == 'exportpedago')) {
                 $row = array();
                 $inactive[] = 'pedago';
                 $url_param['mode'] = 'listpedago';
                 $row[] = new tabobject('listpedago', new moodle_url('/mod/referentiel/pedagogie.php', $url_param), get_string('listpedago', 'referentiel'));
                 $url_param['mode'] = 'listasso';
                 $row[] = new tabobject('listasso', new moodle_url('/mod/referentiel/pedagogie.php', $url_param), get_string('listasso', 'referentiel'));
                 if (has_capability('mod/referentiel:managescolarite', $this->context)) {
                     // import export
                     $url_param['mode'] = 'addpedago';
                     $row[] = new tabobject('addpedago', new moodle_url('/mod/referentiel/pedagogie.php', $url_param), get_string('addpedago', 'referentiel'));
                     if ($this->currenttab == 'editpedago') {
                         $url_param['mode'] = 'updatepedago';
                         $row[] = new tabobject('editpedago', new moodle_url('/mod/referentiel/pedagogie.php', $url_param), get_string('editpedago', 'referentiel'));
                     }
                     $url_param['mode'] = 'editasso';
                     $row[] = new tabobject('editasso', new moodle_url('/mod/referentiel/pedagogie.php', $url_param), get_string('editasso', 'referentiel'));
                     $url_param['mode'] = 'importpedago';
                     $row[] = new tabobject('importpedago', new moodle_url('/mod/referentiel/import_pedagogie.php', $url_param), get_string('importpedago', 'referentiel'));
                     $url_param['mode'] = 'exportpedago';
                     $row[] = new tabobject('exportpedago', new moodle_url('/mod/referentiel/export_pedagogie.php', $url_param), get_string('exportpedago', 'referentiel'));
                 }
                 if ($this->currenttab == '') {
                     $this->currenttab = 'listpedago';
                     $this->mode = 'listpedago';
                 }
                 $tabs[] = $row;
                 $activetwo = array('pedago');
             }
             // CERTIFICATS
             if (isset($this->currenttab) && ($this->currenttab == 'certificat' || $this->currenttab == 'verroucertif' || $this->currenttab == 'statcertif' || $this->currenttab == 'listcertif' || $this->currenttab == 'listcertifsingle' || $this->currenttab == 'scolarite' || $this->currenttab == 'addcertif' || $this->currenttab == 'editcertif' || $this->currenttab == 'printcertif' || $this->currenttab == 'managecertif' || $this->currenttab == 'importcertif' || $this->currenttab == 'manageobjectif')) {
                 $row = array();
                 $inactive[] = 'certificat';
                 if (has_capability('mod/referentiel:view', $this->context)) {
                     // afficher un certificat
                     $url_param['mode'] = 'listcertif';
                     $row[] = new tabobject('listcertif', new moodle_url('/mod/referentiel/certificat.php', $url_param), get_string('listcertif', 'referentiel'));
                     if (has_capability('mod/referentiel:rate', $this->context)) {
                         // rediger un certificat
                         $label_thumb = get_string('editcertif', 'referentiel');
                     } else {
                         $label_thumb = get_string('synthese_certificat', 'referentiel');
                     }
                     $url_param['mode'] = 'editcertif';
                     $row[] = new tabobject('editcertif', new moodle_url('/mod/referentiel/certificat.php', $url_param), $label_thumb);
                     if (referentiel_site_can_print_graph($this->instance->id)) {
                         $url_param['mode'] = 'statcertif';
                         $row[] = new tabobject('statcertif', new moodle_url('/mod/referentiel/certificat.php', $url_param), get_string('statcertif', 'referentiel'));
                     }
                 }
                 if (has_capability('mod/referentiel:managecertif', $this->context)) {
                     $url_param['mode'] = 'managecertif';
                     $row[] = new tabobject('managecertif', new moodle_url('/mod/referentiel/export_certificat.php', $url_param), get_string('managecertif', 'referentiel'));
                     $url_param['mode'] = 'importcertif';
                     $row[] = new tabobject('importcertif', new moodle_url('/mod/referentiel/import_certificat.php', $url_param), get_string('importcertif', 'referentiel'));
                     if (referentiel_site_can_print_referentiel($this->instance->id)) {
                         $url_param['mode'] = 'printcertif';
                         $row[] = new tabobject('printcertif', new moodle_url('/mod/referentiel/print_certificat.php', $url_param), get_string('printcertif', 'referentiel'));
                     }
                     $url_param['mode'] = 'verroucertif';
                     $row[] = new tabobject('verroucertif', new moodle_url('/mod/referentiel/verrou_certificat.php', $url_param), get_string('verroucertif', 'referentiel'));
                     // OUTCOMES
                     if (!empty($CFG->enableoutcomes) && REFERENTIEL_OUTCOMES) {
                         $url_param['mode'] = 'manageobjectif';
                         $row[] = new tabobject('manageobjectif', new moodle_url('/mod/referentiel/outcomes.php', $url_param), get_string('outcomes', 'referentiel'));
                     }
                 }
                 $tabs[] = $row;
                 $activetwo = array('certificat');
             }
             // ARCHIVES
             if (isset($this->currenttab) && $this->currenttab == 'archive') {
                 $row = array();
                 $inactive[] = 'archive';
                 // archiver les activites et le certificat
                 if (has_capability('mod/referentiel:archive', $this->context)) {
                     $url_param['mode'] = 'archive';
                     $row[] = new tabobject('archive', new moodle_url('/mod/referentiel/archive.php', $url_param), get_string('archive', 'referentiel'));
                 }
                 if ($this->currenttab == '') {
                     $this->currenttab = $mode = 'archive';
                 }
                 $tabs[] = $row;
                 $activetwo = array('archive');
             }
             // REFERENTIELS
             if (isset($this->currenttab) && ($this->currenttab == 'bareme' || $this->currenttab == 'protocole' || $this->currenttab == 'referentiel' || $this->currenttab == 'listreferentiel' || $this->currenttab == 'configref' || $this->currenttab == 'editreferentiel' || $this->currenttab == 'deletereferentiel' || $this->currenttab == 'import' || $this->currenttab == 'import_simple' || $this->currenttab == 'export')) {
                 $row = array();
                 $inactive[] = 'referentiel';
                 if (has_capability('mod/referentiel:view', $this->context)) {
                     $url_param['mode'] = 'listreferentiel';
                     $url_param['non_redirection'] = '1';
                     $row[] = new tabobject('listreferentiel', new moodle_url('/mod/referentiel/view.php', $url_param), get_string('listreferentiel', 'referentiel'));
                     $url_param['non_redirection'] = 0;
                     $url_param['mode'] = 'protocole';
                     $row[] = new tabobject('protocole', new moodle_url('/mod/referentiel/protocole.php', $url_param), get_string('protocole', 'referentiel'));
                     if ($CFG->referentiel_use_scale) {
                         $url_param['mode'] = 'bareme';
                         $row[] = new tabobject('bareme', new moodle_url('/mod/referentiel/bareme.php', $url_param), get_string('scale'));
                     }
                 }
                 if (!empty($isadmin) || isset($isreferentielauteur) && $isreferentielauteur || referentiel_site_can_write_or_import_referentiel($this->instance->id) && empty($isstudent) && empty($isguest)) {
                     if (!REFERENTIEL_BLOCK_REF) {
                         if (has_capability('mod/referentiel:writereferentiel', $this->context)) {
                             if ($CFG->referentiel_use_scale) {
                                 $url_param['mode'] = 'bareme';
                                 $row[] = new tabobject('bareme', new moodle_url('/mod/referentiel/bareme.php', $url_param), get_string('scale'));
                             }
                             $url_param['mode'] = 'configref';
                             $row[] = new tabobject('configref', new moodle_url('/mod/referentiel/config_ref.php', $url_param), get_string('configref', 'referentiel'));
                             $url_param['mode'] = 'editreferentiel';
                             $row[] = new tabobject('editreferentiel', new moodle_url('/mod/referentiel/edit.php', $url_param), get_string('editreferentiel', 'referentiel'));
                             $url_param['mode'] = 'deleteferentiel';
                             $row[] = new tabobject('deletereferentiel', new moodle_url('/mod/referentiel/delete.php', $url_param), get_string('deletereferentiel', 'referentiel'));
                         }
                         if (has_capability('mod/referentiel:import', $this->context)) {
                             $url_param['mode'] = 'import';
                             $row[] = new tabobject('import', new moodle_url('/mod/referentiel/import.php', $url_param), get_string('import', 'referentiel'));
                         }
                     }
                     if (has_capability('mod/referentiel:export', $this->context)) {
                         $url_param['mode'] = 'export';
                         $row[] = new tabobject('export', new moodle_url('/mod/referentiel/export.php', $url_param), get_string('export', 'referentiel'));
                     }
                 }
                 $tabs[] = $row;
                 $activetwo = array('referentiel');
             }
         } else {
             // pas d'autre possibilite que l'affichage du referentiel
             $tabs[] = $row;
             $this->currenttab = 'referentiel';
         }
         /// Print out the tabs and continue!
         print_tabs($tabs, $this->currenttab, $inactive, $activetwo);
     }
 }
function referentiel_print_protocole($mode, $referentiel_instance, $select_acc = 0)
{
    global $DB;
    global $CFG;
    global $USER;
    static $istutor = false;
    static $isteacher = false;
    static $isadmin = false;
    static $iseditor = false;
    static $referentiel_id = NULL;
    // 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_protocole.php :: 46 :: You cannot call this script in that way');
    }
    $context = context_module::instance($cm->id);
    $roles = referentiel_roles_in_instance($referentiel_instance->id);
    $iseditor = $roles->is_editor;
    $isadmin = $roles->is_admin;
    $isteacher = $roles->is_teacher;
    $istutor = $roles->is_tutor;
    $isstudent = $roles->is_student;
    /*
    // DEBUG
    if ($isadmin) echo "Admin ";
    if ($isteacher) echo "Teacher ";
    if ($istutor) echo "Tutor ";
    if ($isstudent) echo "Student ";
    */
    if (!empty($referentiel_instance->ref_referentiel)) {
        $referentiel_referentiel = referentiel_get_referentiel_referentiel($referentiel_instance->ref_referentiel);
        if (!$referentiel_referentiel) {
            if ($iseditor) {
                print_error(get_string('creer_referentiel', 'referentiel'), "edit.php?d={$referentiel_instance->id}&amp;mode=editreferentiel&amp;sesskey=" . sesskey());
            } else {
                print_error(get_string('creer_referentiel', 'referentiel'), "../../course/view.php?id={$course->id}&amp;sesskey=" . sesskey());
            }
        }
        echo referentiel_affiche_protocole($referentiel_referentiel->id);
    }
    echo '<br /><br />' . "\n";
    return true;
}
     if ($okbareme) {
         echo "\n" . '<input type="hidden" name="userbareme" value="1" />' . "\n";
         echo '<input type="hidden" name="baremeid" value="' . $bareme->id . '" />' . "\n";
         echo '<input type="hidden" name="threshold" value="' . $bareme->threshold . '" />' . "\n";
         echo '<input type="hidden" name="competencesbareme" value="' . $competences_bareme . '" />' . "\n";
     }
     echo '</div>' . "\n";
 } else {
     // activite normale
     echo '<br /><br /><span class="bold">' . get_string('aide_saisie_competences', 'referentiel') . '</span>' . "\n";
     if (isset($approved) && $approved) {
         echo '<div class="valide">' . "\n";
     } else {
         echo '<div class="invalide">' . "\n";
     }
     $roles = referentiel_roles_in_instance($referentiel->id);
     if ($USER->id == $userid && ($roles->is_student || $roles->is_guest)) {
         // c'est l'auteur qui affiche
         if (!referentiel_hierarchical_display($referentiel->id)) {
             echo referentiel_modifier_selection_liste_codes_item_competence('/', $liste_codes_competences_tache, $competences_activite, $activite_id);
         } else {
             echo referentiel_modifier_selection_codes_item_hierarchique($referentiel_referentiel->id, $competences_activite, true);
         }
     } else {
         // c'est un referent qui affiche
         //Modif bareme
         if ($okbareme) {
             $competences_bareme = referentiel_get_competences_activite($activite_id, $bareme->id);
             $str_a_evaluer = referentiel_affiche_liste_codes_competence('/', $competences_activite, $referentiel_referentiel->id) . "\n";
             if (!empty($str_a_evaluer)) {
                 echo '<br /><span class="bold">' . get_string('liste_competence_cochees', 'referentiel') . '</span> ' . "\n" . " " . $str_a_evaluer;
Exemplo n.º 7
0
function referentiel_print_selection_user_tache($taskid, $mode, $referentiel_instance, $userid_filtre = 0, $gusers = NULL, $sql_filtre_where = '', $sql_filtre_order = '', $data_filtre = NULL)
{
    global $CFG;
    global $USER;
    static $istutor = false;
    static $isteacher = false;
    static $isauthor = false;
    static $iseditor = false;
    static $referentiel_id = NULL;
    // A COMPLETER
    $data = NULL;
    // contexte
    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');
        }
        $context = context_module::instance($cm->id);
        $records = array();
        $referentiel_id = $referentiel_instance->ref_referentiel;
        $roles = referentiel_roles_in_instance($referentiel_instance->id);
        $iseditor = $roles->is_editor;
        $isadmin = $roles->is_admin;
        $isteacher = $roles->is_teacher;
        $istutor = $roles->is_tutor;
        $isstudent = $roles->is_student;
        $isguest = $roles->is_guest;
        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'), "{$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());
                }
            }
            // boite pour selectionner les utilisateurs ?
            if ($isteacher || $iseditor || $istutor) {
                // tous les users possibles (pour la boite de selection)
                // Get your userids the normal way
                $record_id_users = referentiel_get_students_course($course->id, 0, 0);
                //seulement les stagiaires
                if ($gusers && $record_id_users) {
                    // liste des utilisateurs du groupe courant
                    // echo "<br />DEBUG :: print_lib_task.php :: 740 :: GUSERS<br />\n";
                    // print_object($gusers);
                    // echo "<br />\n";
                    // exit;
                    $record_users = array_intersect($gusers, array_keys($record_id_users));
                    // echo "<br />DEBUG :: print_lib_task.php :: 745 :: RECORD_USERS<br />\n";
                    // print_r($record_users  );
                    // echo "<br />\n";
                    // recopier
                    $record_id_users = array();
                    foreach ($record_users as $record_id) {
                        $a_obj = new stdClass();
                        $a_obj->userid = $record_id;
                        $record_id_users[] = $a_obj;
                    }
                }
                echo referentiel_select_users_tache($taskid, $mode, $record_id_users, $userid_filtre);
            }
        }
        echo '<br /><br />' . "\n";
        return true;
    }
}
Exemplo n.º 8
0
function referentiel_select_associations($mode, $referentiel_instance, $userid_filtre, $gusers)
{
    global $DB;
    global $CFG;
    global $USER;
    static $referentiel_id = NULL;
    // A COMPLETER
    $data = NULL;
    // 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 :: lib_pedagogie.php :: 926 :: You cannot call this script in that way');
    }
    $context = context_module::instance($cm->id);
    $records = array();
    $referentiel_id = $referentiel_instance->ref_referentiel;
    $roles = referentiel_roles_in_instance($referentiel_instance->id);
    $iseditor = $roles->is_editor;
    $isadmin = $roles->is_admin;
    $isteacher = $roles->is_teacher;
    $istutor = $roles->is_tutor;
    $isstudent = $roles->is_student;
    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}&amp;mode=editreferentiel&amp;sesskey=" . sesskey());
            } else {
                print_error(get_string('creer_referentiel', 'referentiel'), "../../course/view.php?id={$course->id}&amp;sesskey=" . sesskey());
            }
        }
        // boite pour selectionner les utilisateurs ?
        if ($isteacher || $iseditor || $istutor) {
            if (!empty($userid_filtre)) {
                $record_id_users = referentiel_get_students_course($course->id, $userid_filtre, 0);
            } else {
                $record_id_users = referentiel_get_students_course($course->id, 0, 0);
                //seulement les stagiaires
                if ($gusers && $record_id_users) {
                    // liste des utilisateurs du groupe courant
                    $record_users = array_intersect($gusers, array_keys($record_id_users));
                    // recopier
                    $record_id_users = array();
                    foreach ($record_users as $record_id) {
                        $a_obj = new stdClass();
                        $a_obj->userid = $record_id;
                        $record_id_users[] = $a_obj;
                    }
                }
            }
            // boites de selection
            // echo referentiel_select_users_accompagnes("pedagogie.php", $mode, $userid_filtre);
            // echo referentiel_select_users_pedagogie($record_id_users, "pedagogie.php", $mode,  $userid_filtre);
            // Afficher les pedagogies
            // recupere les enregistrements de pedagogies
            $records_pedago = referentiel_get_pedagogies();
            if ($records_pedago) {
                /*
                echo referentiel_entete_pedagogie();
                foreach ($records_pedago as $record_pedago) {
                    referentiel_print_pedagogie($record_pedago, $context, $referentiel_instance->id);
                }
                echo referentiel_enqueue_pedagogie();
                */
                // Afficher
                if ($record_id_users) {
                    if ($userid_filtre) {
                        echo referentiel_select_asso_user_pedago($course->id, $referentiel_instance->id, $referentiel_referentiel->id, $mode, $record_id_users, $records_pedago);
                    } else {
                        echo referentiel_pagination_users_pedago($course->id, $referentiel_instance->id, $referentiel_referentiel->id, $mode, $record_id_users, $records_pedago);
                    }
                }
            }
        }
        echo '<br /><br />' . "\n";
    }
}
function referentiel_print_liste_etudiants($initiale, $userids, $mode, $referentiel_instance, $userid_filtre = 0, $gusers = NULL, $select_acc)
{
    global $USER, $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_etudiant.php :: You cannot call this script in that way');
        }
        $context = context_module::instance($cm->id);
        $roles = referentiel_roles_in_instance($referentiel_instance->id);
        $iseditor = $roles->is_editor;
        $isadmin = $roles->is_admin;
        $isteacher = $roles->is_teacher;
        $istutor = $roles->is_tutor;
        $isstudent = $roles->is_student;
        $record_id_users = referentiel_select_liste_etudiants($initiale, $userids, $mode, $referentiel_instance, $userid_filtre, $gusers, $select_acc);
        if ($record_id_users) {
            echo '<table class="certificat">
<tr><th>' . get_string('userid', 'referentiel') . '</th><th>' . get_string('nom_prenom', 'referentiel') . '</th><th>' . get_string('num_etudiant', 'referentiel') . '</th><th>' . get_string('ddn_etudiant', 'referentiel') . '</th><th>' . get_string('lieu_naissance', 'referentiel') . '</th><th>' . get_string('departement_naissance', 'referentiel') . '</th><th>' . get_string('adresse_etudiant', 'referentiel') . '</th><th>' . get_string('ref_etablissement', 'referentiel') . '</th></tr>' . "\n";
            foreach ($record_id_users as $record) {
                // afficher la liste d'etudiant
                // Afficher
                // print_r($record);
                if ($record->userid) {
                    $isauthor = $USER->id == $record->userid;
                    if ($isauthor || $isteacher || $iseditor) {
                        // echo referentiel_print_etudiant($record->userid, $CFG->wwwroot.'/mod/referentiel/etudiant.php?d='.$referentiel_instance->id.'&amp;mode=selectetab&amp;sesskey='.sesskey());
                        // echo '<tr><td colspan="7" align="center">'.referentiel_menu_etudiant($context, $referentiel_instance->id, $record->userid).'</td></tr>'."\n";
                        echo referentiel_print_etudiant_2($record->userid, $referentiel_instance->id, $context, "etudiant.php?d=" . $referentiel_instance->id . "&amp;mode=selectetab");
                    }
                }
            }
            echo '</table><br /><br />' . "\n";
        }
    }
}
function referentiel_print_liste_repartitions($referentiel_instance)
{
    // Affiche les repartitions d'affectations de competences de cette instance de referentiel
    global $DB;
    static $istutor = false;
    static $isteacher = false;
    static $isadmin = false;
    static $iseditor = false;
    static $referentiel_id = NULL;
    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 :: print_lib_repartition.php :: 166 :: You cannot call this script in that way');
        }
        // echo "<br />DEBUG :: 220 ::<br />REFERENTIEL_Instance : $referentiel_instance->id <br /> Course_id : $referentiel_instance->course\n";
        $context = context_module::instance($cm->id);
        $referentiel_id = $referentiel_instance->ref_referentiel;
        $roles = referentiel_roles_in_instance($referentiel_instance->id);
        $iseditor = $roles->is_editor;
        $isadmin = $roles->is_admin;
        $isteacher = $roles->is_teacher;
        $istutor = $roles->is_tutor;
        $isstudent = $roles->is_student;
        /*
        // DEBUG
        if ($isadmin) echo "Admin ";
        if ($isteacher) echo "Teacher ";
        if ($istutor) echo "Tutor ";
        if ($isstudent) echo "Student ";
        */
        if (!empty($referentiel_id)) {
            $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}&amp;mode=editreferentiel&amp;sesskey=" . sesskey());
                } else {
                    print_error(get_string('creer_referentiel', 'referentiel'), "../../course/view.php?id={$course->id}&amp;sesskey=" . sesskey());
                }
            }
            $records_teacher = referentiel_get_teachers_course($course->id);
            // codes item
            $t_codes_competence = explode('/', referentiel_purge_dernier_separateur($referentiel_referentiel->liste_codes_competence, '/'));
            echo referentiel_print_repartition($referentiel_instance->id, $course->id, $context, $t_codes_competence, $records_teacher);
        }
    }
}
Exemplo n.º 11
0
/**
 * This function returns records of users ids
 *
 * If select_all == 1 all certificates users are displayed
 * Else only course's users are displayed
 * @param object referentiel_instance instance of referentiel
 * @param userid_filtre int
 * @param guser Object
 * @param mode string
 * @param select_all : int
 * @param select_acc : int
 * @param affiche : boolean
 * @return objects
 * @todo Finish documenting this function
 **/
function referentiel_get_liste_users($referentiel_instance, $course, $context, $list_userids = '', $userid_filtre = 0, $gusers, $select_acc = 0, $select_all = 0)
{
    global $debug_special;
    global $USER;
    static $referentiel_id = NULL;
    $records = array();
    if ($referentiel_instance) {
        $roles = referentiel_roles_in_instance($referentiel_instance->id);
        $iseditor = $roles->is_editor;
        $isadmin = $roles->is_admin;
        $isteacher = $roles->is_teacher;
        $istutor = $roles->is_tutor;
        $isstudent = $roles->is_student;
        // recuperer les certificats
        if (!empty($list_userids)) {
            // liste d'utilisateurs obtenus par les pedagogies
            $tuserids = explode(',', $list_userids);
            foreach ($tuserids as $userid) {
                // forcer la generation
                if ($userid) {
                    $records[] = $userid;
                }
            }
        } else {
            if ($isadmin && $select_all) {
                // tous les utilisateurs ayant un certificat
                // tous les utilisateurs ayant un certificat
                if ($record_id_users = referentiel_get_certificats_id_users($referentiel_instance->ref_referentiel)) {
                    foreach ($record_id_users as $record_id) {
                        $records[] = $record_id->userid;
                    }
                }
            } else {
                // recuperer les utilisateurs filtres
                if (!empty($userid_filtre)) {
                    // un seul certificat
                    $records[] = $userid_filtre;
                } else {
                    // teachers    :: les certificats du cours seulement
                    if (!empty($select_acc)) {
                        // eleves accompagnes
                        $record_id_users = referentiel_get_accompagnements_teacher($referentiel_instance->id, $course->id, $USER->id);
                    } else {
                        $record_id_users = referentiel_get_students_course($course->id, $userid_filtre, 0);
                    }
                    // groupes ?
                    if ($gusers && $record_id_users) {
                        $record_users = array_intersect($gusers, array_keys($record_id_users));
                        // recopier
                        $record_id_users = array();
                        foreach ($record_users as $record_id) {
                            $a_obj = new stdClass();
                            $a_obj->userid = $record_id;
                            $record_id_users[] = $a_obj;
                        }
                    }
                    if ($record_id_users) {
                        foreach ($record_id_users as $record_id) {
                            // afficher la liste d'users
                            $records[] = $record_id->userid;
                        }
                    }
                }
            }
        }
    }
    //  if referentiel
    return $records;
}