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}&mode=editreferentiel&sesskey=" . sesskey()); } else { print_error(get_string('creer_referentiel', 'referentiel'), "{$CFG->wwwroot}/course/view.php?id={$course->id}&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_un_certificat_detail($certificat_id, $referentiel_instance, $userid = 0, $select_acc = 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 :: 1648 :: 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; if (!empty($referentiel_instance->ref_referentiel)) { $referentiel_referentiel = referentiel_get_referentiel_referentiel($referentiel_instance->ref_referentiel); if (!$referentiel_referentiel) { if ($isadmin || $isteacher) { 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()); } } $isreferentielauteur = referentiel_is_author($USER->id, $referentiel_referentiel, !$isstudent); // MODIF JF 2012/02/18 $seuil_certification = $referentiel_referentiel->seuil_certificat; $nb_items = referentiel_get_nb_items($referentiel_referentiel->id); // empreintes $liste_empreintes = referentiel_purge_dernier_separateur(referentiel_get_liste_empreintes_competence($referentiel_referentiel->id), '/'); $liste_poids = referentiel_purge_dernier_separateur(referentiel_get_liste_poids($referentiel_referentiel->id), '|'); if ($isadmin || $isreferentielauteur) { $protocole_link = "{$CFG->wwwroot}/mod/referentiel/edit_protocole.php?d={$referentiel_instance->id}&mode=protocole&sesskey=" . sesskey(); } else { $protocole_link = "{$CFG->wwwroot}/mod/referentiel/protocole.php?d={$referentiel_instance->id}&mode=protocole&sesskey=" . sesskey(); } // REGENERER LES CERTIFICATS // referentiel_regenere_certificats($referentiel_instance); // inutile $record = referentiel_get_certificat($certificat_id); if (!$record) { print_error(get_string('nocertificat', 'referentiel'), "activite.php?d=" . $referentiel_instance->id . "&mode=addactivity&sesskey=" . sesskey()); } // Afficher $isauthor = referentiel_certificat_isowner($record->id); if ($isauthor || $isteacher || $isadmin) { referentiel_print_certificat_detail_une_page($record, $nb_items, $liste_empreintes, $liste_poids, $seuil_certification, $protocole_link); referentiel_menu_certificat_detail($context, $record->id, $referentiel_instance->id, $record->verrou && $isstudent, $userid, $select_acc, $record->valide); } } }
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}&mode=editreferentiel&sesskey=" . sesskey()); } else { print_error(get_string('creer_referentiel', 'referentiel'), "../../course/view.php?id={$course->id}&sesskey=" . sesskey()); } } echo referentiel_affiche_protocole($referentiel_referentiel->id); } echo '<br /><br />' . "\n"; return true; }
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}&mode=editreferentiel&sesskey=" . sesskey()); } else { print_error(get_string('creer_referentiel', 'referentiel'), "{$CFG->wwwroot}/course/view.php?id={$course->id}&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; } }
/** * This function sets referentiel_referentiel contents in arrays * * @param id * @return int * @todo Finish documenting this function **/ function referentiel_initialise_data_referentiel_old($referentiel_referentiel_id) { // calcule la table des coefficients poids/empreintes pour les item, competences, domaines // necessaire à l'affichage de la liste des 'notes' dans un certificat (pourcentages de competences validees) // return true or false /* ALGO SOMME(V / E * P ) / SOMME(P) */ global $t_domaine; global $t_domaine_coeff; global $t_competence; global $t_competence_coeff; global $t_item_code; global $t_item_description_competence; // descriptifs global $t_item_coeff; // coefficients global $t_item_domaine; // index du domaine associé à un item global $t_item_competence; // index de la competence associée à un item global $t_item_poids; global $t_item_empreinte; global $t_nb_item_domaine; global $t_nb_item_competence; $cherche = array(); $remplace = array(); $compteur_domaine = 0; $compteur_competence = 0; $compteur_item = 0; // DOMAINES $t_domaine = array(); $t_domaine_coeff = array(); // COMPETENCES $t_competence = array(); $t_competence_coeff = array(); // ITEMS $t_item_domaine = array(); // table des domaines d' item $t_item_competence = array(); // table des competences d' item $t_item_description_competence = array(); // table des descriptions d'item $t_item_code = array(); $t_item_poids = array(); $t_item_empreinte = array(); $t_item_coeff = array(); // poids / empreinte $t_nb_item_domaine = array(); // nb item dans le domaine $t_nb_item_competence = array(); // nb items dans la competence if (isset($referentiel_referentiel_id) && $referentiel_referentiel_id > 0) { $record_a = referentiel_get_referentiel_referentiel($referentiel_referentiel_id); $code_referentiel = $record_a->code_referentiel; $seuil_certificat = $record_a->seuil_certificat; $nb_domaines = $record_a->nb_domaines; $liste_codes_competence = $record_a->liste_codes_competence; $liste_empreintes_competence = $record_a->liste_empreintes_competence; /* echo "<br />DEBUG :: lib.php :: Ligne 1959 :: ".$code_referentiel." ".$seuil_certificat."\n"; echo "<br />CODES : ".$liste_codes_competence." EMPREINTES : ".$liste_empreintes_competence."\n"; echo "<br /><br />".referentiel_affiche_liste_codes_empreintes_competence('/', $liste_codes_competence, $liste_empreintes_competence); */ // charger les domaines associes au referentiel courant // DOMAINES $records_domaine = referentiel_get_domaines($referentiel_referentiel_id); if ($records_domaine) { // afficher // DEBUG // echo "<br/>DEBUG ::<br />\n"; // print_r($records_domaine); foreach ($records_domaine as $record) { $domaine_id = $record->id; $nb_competences = $record->nb_competences; $t_domaine[$compteur_domaine] = stripslashes($record->code_domaine); $t_nb_item_domaine[$compteur_domaine] = 0; // LISTE DES COMPETENCES DE CE DOMAINE $records_competences = referentiel_get_competences($domaine_id); if ($records_competences) { // DEBUG // echo "<br/>DEBUG :: COMPETENCES <br />\n"; // print_r($records_competences); foreach ($records_competences as $record_c) { $competence_id = $record_c->id; $nb_item_competences = $record_c->nb_item_competences; $t_competence[$compteur_competence] = stripslashes($record_c->code_competence); $t_nb_item_competence[$compteur_competence] = 0; // ITEM $records_items = referentiel_get_item_competences($competence_id); if ($records_items) { foreach ($records_items as $record_i) { $t_item_code[$compteur_item] = stripslashes($record_i->code_item); $t_item_description_competence[$t_item_code[$compteur_item]] = referentiel_purge_caracteres_indesirables(stripslashes($record_i->description_item)); $t_item_poids[$compteur_item] = $record_i->poids_item; $t_item_empreinte[$compteur_item] = $record_i->empreinte_item; $t_item_domaine[$compteur_item] = $compteur_domaine; $t_item_competence[$compteur_item] = $compteur_competence; $t_nb_item_domaine[$compteur_domaine]++; $t_nb_item_competence[$compteur_competence]++; $compteur_item++; } } $compteur_competence++; } } $compteur_domaine++; } } // consolidation // somme des poids pour les domaines for ($i = 0; $i < count($t_domaine); $i++) { $t_domaine_coeff[$i] = 0.0; } for ($i = 0; $i < count($t_item_poids); $i++) { if ($t_item_poids[$i] && $t_item_empreinte[$i]) { // $t_domaine_coeff[$t_item_domaine[$i]]+= ((float)$t_item_poids[$i] / (float)$t_item_empreinte[$i]); $t_domaine_coeff[$t_item_domaine[$i]] += (double) $t_item_poids[$i]; } } // somme des poids pour les competences for ($i = 0; $i < count($t_competence); $i++) { $t_competence_coeff[$i] = 0.0; } for ($i = 0; $i < count($t_item_poids); $i++) { if ($t_item_poids[$i] > 0.0 && $t_item_empreinte[$i] > 0) { // $t_competence_coeff[$t_item_competence[$i]]+= ((float)$t_item_poids[$i] / (float)$t_item_empreinte[$i]); $t_competence_coeff[$t_item_competence[$i]] += (double) $t_item_poids[$i]; } } // coefficient poids / empreinte pour les items for ($i = 0; $i < count($t_competence); $i++) { $t_item_coeff[$i] = 0.0; } for ($i = 0; $i < count($t_item_poids); $i++) { if ($t_item_poids[$i] && $t_item_empreinte[$i]) { $t_item_coeff[$i] = (double) $t_item_poids[$i] / (double) $t_item_empreinte[$i]; } } } return $compteur_item > 0; }
function referentiel_print_repartition_objectifs($referentiel_instance) { // Affiche les repartitions d'affectations de competences // de cette instance de referentiel global $DB; 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 :: grades/print_outcomes.php :: 168 :: 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; $iseditor = has_capability('mod/referentiel:writereferentiel', $context); 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}&mode=editreferentiel&sesskey=" . sesskey()); } else { print_error(get_string('creer_referentiel', 'referentiel'), "../../course/view.php?id={$course->id}&sesskey=" . sesskey()); } } // codes item $t_codes_competence = explode('/', referentiel_purge_dernier_separateur($referentiel_referentiel->liste_codes_competence, '/')); referentiel_affiche_outcomes($referentiel_instance, $referentiel_referentiel, $course, $context, $t_codes_competence); } } }
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}&mode=editreferentiel&sesskey=" . sesskey()); } else { print_error(get_string('creer_referentiel', 'referentiel'), "../../course/view.php?id={$course->id}&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"; } }
/** * Turns referentiel instance into an xml segment * @param referentiel instanceobject * @return string xml segment */ function write_certification() { global $CFG; // initial string; $expout = ""; $id = $this->ireferentiel->id; // add comment and div tags $expout .= "<!-- certification : " . $this->ireferentiel->id . " name: " . $this->ireferentiel->name . " -->\n"; $expout .= "<div class=\"referentiel\">\n"; // add header $expout .= "<h2>" . $this->ireferentiel->name . "</h2>\n"; // $expout .= "<ul>\n"; // if ($this->ireferentiel) { $id = $this->ireferentiel->id; $name = trim($this->ireferentiel->name); $description = trim($this->ireferentiel->description_instance); $label_domaine = trim($this->ireferentiel->label_domaine); $label_competence = trim($this->ireferentiel->label_competence); $label_item = trim($this->ireferentiel->label_item); $date_instance = $this->ireferentiel->date_instance; $course = $this->ireferentiel->course; $ref_referentiel = $this->ireferentiel->ref_referentiel; $visible = $this->ireferentiel->visible; if ($this->format_condense) { $expout .= " <b>" . get_string('instance', 'referentiel') . "</b><li><b>" . get_string('name', 'referentiel') . "</b> : {$name}</li>\n"; $expout .= " <li><b>" . get_string('description', 'referentiel') . "</b> : {$description}</li>\n"; } else { $expout .= " <li><b>" . get_string('id', 'referentiel') . "</b> : {$id}</li>\n"; $expout .= " <li><b>" . get_string('name', 'referentiel') . "</b> : {$name}</li>\n"; $expout .= " <li><b>" . get_string('description', 'referentiel') . "</b> : {$description}</li>\n"; $expout .= " <li><b>" . get_string('label_domaine', 'referentiel') . "</b> : {$label_domaine}</li>\n"; $expout .= " <li><b>" . get_string('label_competence', 'referentiel') . "</b> : {$label_competence}</li>\n"; $expout .= " <li><b>" . get_string('label_item', 'referentiel') . "</b> : {$label_item}</li>\n"; $expout .= " <li><b>" . get_string('date_instance', 'referentiel') . "</b> : " . date("Y/m/d", $date_instance) . "</li>\n"; $expout .= " <li><b>" . get_string('course') . "</b> : {$course}</li>\n"; $expout .= " <li><b>" . get_string('ref_referentiel', 'referentiel') . "</b> : {$ref_referentiel}</li>\n"; $expout .= " <li><b>" . get_string('visible', 'referentiel') . "</b> : {$visible}</li>\n"; } } // CERTIFICATS if (empty($this->rreferentiel) && (!empty($this->ireferentiel->ref_referentiel) && $this->ireferentiel->ref_referentiel > 0)) { $this->rreferentiel = referentiel_get_referentiel_referentiel($this->ireferentiel->ref_referentiel); } if (!empty($this->rreferentiel)) { $expout .= $this->write_referentiel($this->rreferentiel); if (!$this->records_certificats) { $this->records_certificats = referentiel_get_certificats($this->rreferentiel->id); } // print_r($this->records_certificats); if ($this->records_certificats) { foreach ($this->records_certificats as $record) { $expout .= $this->write_certificat($record); } } } $expout .= " </ul>\n"; $expout .= "</div>\n"; return $expout; }
/** * Turns referentiel instance into an xml segment * @param referentiel instanceobject * @return string xml segment */ function write_certification() { global $CFG; // initial string; $expout = ""; $id = $this->ireferentiel->id; // if ($this->ireferentiel) { $id = $this->ireferentiel->id; $name = trim($this->ireferentiel->name); $description = trim($this->ireferentiel->description_instance); $label_domaine = trim($this->ireferentiel->label_domaine); $label_competence = trim($this->ireferentiel->label_competence); $label_item = trim($this->ireferentiel->label_item); $date_instance = $this->ireferentiel->date_instance; $course = $this->ireferentiel->course; $ref_referentiel = $this->ireferentiel->ref_referentiel; $visible = $this->ireferentiel->visible; $expout .= "<!-- certification : " . $this->ireferentiel->id . " name: " . $this->ireferentiel->name . " -->\n"; $expout .= "<h2>" . $this->ireferentiel->name . "</h2>\n"; if ($this->format_condense) { $expout .= "<table class=\"referentiel\">\n"; $expout .= "<tr>\n"; $expout .= " <td><b>" . get_string('instance', 'referentiel') . "</b></td>"; $expout .= " <td> {$name}</td>\n"; $expout .= " <td> {$description}</td>\n"; $expout .= "</tr>\n</table>"; } else { // $expout .= "<table class=\"referentiel\">\n"; $expout .= " <td colspan='10'><b>" . get_string('instance', 'referentiel') . "</b></td>"; $expout .= "</tr>\n<tr>\n"; $expout .= " <td><b>" . get_string('id', 'referentiel') . "</b></td><td><b>" . get_string('name', 'referentiel') . "</b></td><td><b>" . get_string('description', 'referentiel') . "</b></td>\n<td><b>" . get_string('label_domaine', 'referentiel') . "</b></td><td><b>" . get_string('label_competence', 'referentiel') . "</b></td><td><b>" . get_string('label_item', 'referentiel') . "</b></td>\n<td><b>" . get_string('date_instance', 'referentiel') . "</b></td><td><b>" . get_string('course') . "</b></td><td><b>" . get_string('ref_referentiel', 'referentiel') . "</b></td>\n<td><b>" . get_string('visible', 'referentiel') . "</b></td>\n"; $expout .= "</tr>\n<tr>\n"; $expout .= " <td> {$id}</td>\n"; $expout .= " <td> {$name}</td>\n"; $expout .= " <td> {$description}</td>\n"; $expout .= " <td> {$label_domaine}</td>\n"; $expout .= " <td> {$label_competence}</td>\n"; $expout .= " <td> {$label_item}</td>\n"; $expout .= " <td>" . date("Y-m-d H:i:s", $date_instance) . "</td>\n"; $expout .= " <td> {$course}</td>\n"; $expout .= " <td> {$ref_referentiel}</td>\n"; $expout .= " <td> {$visible}</td>\n"; $expout .= "</tr>\n</table><br />"; } } // CERTIFICATS if (empty($this->rreferentiel) && (!empty($this->ireferentiel->ref_referentiel) && $this->ireferentiel->ref_referentiel > 0)) { $this->rreferentiel = referentiel_get_referentiel_referentiel($this->ireferentiel->ref_referentiel); } if (!empty($this->rreferentiel)) { $expout .= $this->write_referentiel(); if (!$this->records_certificats) { $this->records_certificats = referentiel_get_certificats($this->rreferentiel->id); } // print_r($this->records_certificats); if ($this->records_certificats) { foreach ($this->records_certificats as $record) { $expout .= $this->write_certificat($record); } } } return $expout; }
/** * Turns referentiel instance into an xml segment * @param referentiel instanceobject * @return string xml segment */ function write_certification() { global $CFG; // initial string; $expout = ""; // if ($this->ireferentiel) { $id = $this->ireferentiel->id; $name = trim($this->ireferentiel->name); $description_instance = $this->purge_sep($this->ireferentiel->description_instance); $label_domaine = trim($this->ireferentiel->label_domaine); $label_competence = trim($this->ireferentiel->label_competence); $label_item = trim($this->ireferentiel->label_item); $date_instance = $this->ireferentiel->date_instance; $course = $this->ireferentiel->course; $ref_referentiel = $this->ireferentiel->ref_referentiel; $visible = $this->ireferentiel->visible; if ($this->format_condense == 0) { // $expout .= "#Instance de referentiel : $this->ireferentiel->name\n"; $expout .= "#id_instance;name;description_instance;label_domaine;label_competence;label_item;date_instance;course;ref_referentiel;visible\n"; $expout .= "{$id};" . stripslashes($this->output_codage_caractere($name)) . ";" . stripslashes($this->output_codage_caractere($description_instance)) . ";" . stripslashes($this->output_codage_caractere($label_domaine)) . ";" . stripslashes($this->output_codage_caractere($label_competence)) . ";" . stripslashes($this->output_codage_caractere($label_item)) . ";" . referentiel_timestamp_date_special($date_instance) . ";{$course};{$ref_referentiel};{$visible}\n"; } } if (empty($this->rreferentiel) && (!empty($this->ireferentiel->ref_referentiel) && $this->ireferentiel->ref_referentiel > 0)) { $this->rreferentiel = referentiel_get_referentiel_referentiel($this->ireferentiel->ref_referentiel); } if (!empty($this->rreferentiel)) { $expout .= $this->write_referentiel(); if (!$this->records_certificats) { $this->records_certificats = referentiel_get_certificats($this->rreferentiel->id); } if ($this->records_certificats) { if (!$this->format_condense) { $expout .= "#id_etudiant;user_id;login;num_etudiant;NOM;Prenom;ddn_etudiant;lieu_naissance;departement_naissance;adresse_etudiant;ref_etablissement;id_certificat;commentaire_certificat;synthese_certificat;competences_certificat;decision_jury;date_decision;ref_referentiel;verrou;valide;evaluation;"; if ($this->export_pedagos) { $expout .= "promotion;formation;pedagogie;composante;num_groupe;commentaire;date_cloture"; } $expout .= "\n"; } else { if ($this->format_condense == 1) { // $expout .= $this->write_liste_etablissements($this->rreferentiel); // $expout .= "#user_id;login;num_etudiant;NOM;Prenom;\n"; // la suite de l'entete est reportée dans l'affichage du referentiel car il faut aussi afficher les codes des items... } else { if ($this->format_condense == 2) { $expout .= "#login;num_etudiant;NOM;Prenom;decision_jury;"; $expout .= $this->liste_codes_items($this->ref_referentiel); if ($this->export_pedagos) { $expout .= "promotion;formation;pedagogie;composante;num_groupe;commentaire;date_cloture"; } $expout .= "\n"; } } } foreach ($this->records_certificats as $record) { $expout .= $this->write_certificat($record); } } } return $expout; }
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}&mode=editreferentiel&sesskey=" . sesskey()); } else { print_error(get_string('creer_referentiel', 'referentiel'), "../../course/view.php?id={$course->id}&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); } } }
/** * This function select users * * If select_all == 1 all pedagogies certificates are displayed * Else only course's user certificates are displayed * @param object referentiel_instance instance of referentiel * @param list_userids ;: a list of user from pedagogie * @param userid_filtre int * @param guser Object * @param mode string * @param appli : calling script * @param select_all : int * @param select_acc : int * @param affiche : boolean * @return objects * @todo Finish documenting this function **/ function referentiel_select_liste_certificats($referentiel_instance, $list_pedagoids = '', $userid_filtre = 0, $gusers, $select_acc = 0, $mode = 'listcertif', $appli = 'certificat.php', $select_all = 0, $sql_filtre_where = '', $data_param = NULL) { global $USER; global $existe_pedagos; /// renseigne au niveau de export_certificat static $referentiel_id = NULL; global $DB; // DEBUG // echo "<br />DEBUG :: lib_certificat.php :: 502 :: APPLI : $appli :: MODE : $mode :: LISTE_PEDAGO : $list_pedagoids :: SELECT_ACC : $select_acc :: SELECT_ALL : $select_all\n"; $records = array(); // 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 :: lib_certificat.php :: 438 :: 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; $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}&mode=editreferentiel&sesskey=" . sesskey()); } else { print_error(get_string('creer_referentiel', 'referentiel'), "../../course/view.php?id={$course->id}&sesskey=" . sesskey()); } } // Selectionner les utilisateurs pour les boîtes de selection if ($isadmin || $isteacher || $iseditor || $istutor) { if (!empty($select_acc)) { // eleves accompagnes $record_id_users = referentiel_get_accompagnements_teacher($referentiel_instance->id, $course->id, $USER->id); } else { // 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 } // tenir compte des groupes pour les boites de selection if ($isadmin && !$select_all || $isteacher || $iseditor || $istutor) { // groupe ? 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; } } } if ($isadmin) { // admin peut tout voir // PEDAGOGIES // DEBUG // variable globale // $existe_pedagos=referentiel_pedagogies_exists($referentiel_instance->ref_referentiel); // DEBUG //if ($existe_pedagos) echo "<br />DEBUG :: lib_certificat.php :: 493 :: EXISTE PEDAGOS :: LISTE_PEDAGO : $list_pedagoids :: SELECT_ACC : $select_acc :: SELECT_ALL : $select_all\n"; //else echo "<br />DEBUG :: lib_certificat.php :: 493 :: EXISTE PAS PEDAGOS :: LISTE_PEDAGO : $list_pedagoids :: SELECT_ACC : $select_acc :: SELECT_ALL : $select_all\n"; echo referentiel_select_all_certificates($referentiel_instance, $appli, $mode, $userid_filtre, $select_acc, $select_all, $existe_pedagos); if ($select_all != 2 || !$existe_pedagos) { echo referentiel_select_users_accompagnes($appli, $mode, $userid_filtre, $select_acc, $select_all); echo referentiel_select_users_certificat($record_id_users, $appli, $mode, $userid_filtre, $select_acc, $select_all); } else { if ($select_all == 2) { echo referentiel_select_pedagogies($referentiel_instance, $appli, $mode, $list_pedagoids, $select_acc, $select_all, $sql_filtre_where, $data_param); } } } else { echo referentiel_select_users_accompagnes($appli, $mode, $userid_filtre, $select_acc, $select_all); echo referentiel_select_users_certificat($record_id_users, $appli, $mode, $userid_filtre, $select_acc, $select_all); } } else { $userid_filtre = $USER->id; // les étudiants ne peuvent voir que leur fiche } // affiche } // if referentiel }
function referentiel_affiche_occurrence($cm, $instance_id, $occurrence_id, $params = NULL) { // Affiche le référentiel global $DB; $labels = NULL; $label_d = ''; $label_c = ''; $label_i = ''; if (!empty($params)) { if (isset($params->label_domaine)) { $label_d = $params->label_domaine; } if (isset($params->label_competence)) { $label_c = $params->label_competence; } if (isset($params->label_item)) { $label_i = $params->label_item; } } else { if ($referentiel_instance = $DB->get_record('referentiel', array("id" => $instance_id))) { if ($labels = referentiel_get_labels($referentiel_instance)) { $label_d = $labels->domaine; $label_c = $labels->competence; $label_i = $labels->item; } } } // affichage leger du referentiel $not_light_display = referentiel_site_light_display($instance_id) > 0; if (!empty($occurrence_id)) { $record_a = referentiel_get_referentiel_referentiel($occurrence_id); $referentiel_id = $record_a->id; $name = $record_a->name; $code_referentiel = stripslashes($record_a->code_referentiel); $description_referentiel = stripslashes($record_a->description_referentiel); $url_referentiel = referentiel_affiche_url($record_a->url_referentiel, ""); $seuil_certificat = $record_a->seuil_certificat; $timemodified = $record_a->timemodified; $nb_domaines = $record_a->nb_domaines; $liste_codes_competence = $record_a->liste_codes_competence; $liste_empreintes_competence = $record_a->liste_empreintes_competence; $liste_poids_competence = referentiel_get_liste_poids_competence($occurrence_id); // local ou global ? if (isset($record_a->local)) { $referentiel_local = $record_a->local; } else { $referentiel_local = 0; } $logo = $record_a->logo_referentiel; echo '<br /><h3>' . get_string('occurrencereferentiel', 'referentiel') . '</h3>' . "\n"; echo '<div class="ref_aff0">' . "\n"; echo '<span class="bold">' . get_string('name', 'referentiel') . '</span> ' . $name . ' ' . "\n"; echo '<span class="bold">' . get_string('code', 'referentiel') . '</span> ' . $code_referentiel . ' ' . "\n"; echo '<br />' . '<span class="bold">' . get_string('description', 'referentiel') . '</span><div class="ref_aff1">' . nl2br($description_referentiel) . '</div>' . "\n"; echo get_string('url', 'referentiel') . '</span> ' . $url_referentiel . ' ' . "\n"; if ($not_light_display) { echo '<br />' . '<span class="bold">' . get_string('seuil_certificat', 'referentiel') . '</span> ' . $seuil_certificat . "\n"; echo ' ' . '<span class="bold">' . get_string('referentiel_global', 'referentiel') . '</span> '; if (!empty($referentiel_local)) { echo ' ' . get_string("no") . ' ' . "\n"; } else { echo ' ' . get_string("yes") . ' ' . "\n"; } echo '<br />' . '<span class="bold">' . get_string('logo', 'referentiel') . '</span> ' . "\n"; if (!empty($logo)) { echo referentiel_affiche_image($logo) . ' ' . "\n"; } echo referentiel_menu_logo($cm, !empty($logo)) . "\n"; echo '<br />' . '<span class="bold">' . get_string('liste_codes_empreintes_competence', 'referentiel') . '</span>'; echo '<br />' . referentiel_affiche_liste_codes_empreintes_competence('/', $liste_codes_competence, $liste_empreintes_competence, $liste_poids_competence) . "\n"; } echo '</div>' . "\n"; echo '<br />' . "\n"; ?> <table class="referentiel" cellpadding="5"> <?php // charger les domaines associes au referentiel courant if (!empty($occurrence_id)) { // AFFICHER LA LISTE DES DOMAINES $compteur_domaine = 0; $records_domaine = referentiel_get_domaines($occurrence_id); if ($records_domaine) { // afficher foreach ($records_domaine as $record) { $compteur_domaine++; $domaine_id = $record->id; $nb_competences = $record->nb_competences; $code_domaine = stripslashes($record->code_domaine); $description_domaine = stripslashes($record->description_domaine); $num_domaine = $record->num_domaine; ?> <!-- DOMAINE --> <tr valign="top" bgcolor="#ffffcc"> <td class="domaine" align="left"><b> <?php if (!empty($label_d)) { p($label_d); } else { print_string('domaine', 'referentiel'); } echo ' <i>' . s($num_domaine) . '</i>'; ?> </b> </td> <td class="domaine" align="left"> <?php p($code_domaine); ?> </td> <td class="domaine" align="left" colspan="4"> <?php echo nl2br(stripslashes($record->description_domaine)); ?> </td> </tr> <?php // LISTE DES COMPETENCES DE CE DOMAINE $compteur_competence = 0; $records_competences = referentiel_get_competences($domaine_id); if ($records_competences) { foreach ($records_competences as $record_c) { $compteur_competence++; $competence_id = $record_c->id; $nb_item_competences = $record_c->nb_item_competences; $code_competence = stripslashes($record_c->code_competence); $description_competence = stripslashes($record_c->description_competence); $num_competence = $record_c->num_competence; $ref_domaine = $record_c->ref_domaine; ?> <!-- COMPETENCE --> <tr valign="top"> <td class="competence" align="left"> <b> <?php if (!empty($label_c)) { p($label_c); } else { print_string('competence', 'referentiel'); } ?> <i> <?php p(' ' . $num_competence); ?> </i> </b> </td> <td class="competence" align="left"> <?php p($code_competence); ?> </td> <td class="competence" align="left" colspan="4"> <?php echo nl2br(stripslashes($description_competence)); ?> </td> </tr> <?php // ITEM $compteur_item = 0; $records_items = referentiel_get_item_competences($competence_id); if ($records_items) { ?> <tr valign="top" bgcolor="#5555000"> <th class="item" align="right"> <?php if (!empty($label_i)) { p($label_i); } else { print_string('item', 'referentiel'); } echo ' :: <i>'; print_string('numero', 'referentiel'); echo '</i>'; ?> </th> <th class="item" align="left"> <?php print_string('code', 'referentiel'); ?> </th> <th class="item" align="left"> <?php print_string('description', 'referentiel'); ?> </th> <?php if ($not_light_display) { ?> <th class="item" align="left"> <?php print_string('t_item', 'referentiel'); ?> </th> <th class="item" align="left"> <?php print_string('p_item', 'referentiel'); ?> </th> <th class="item" align="left"> <?php print_string('e_item', 'referentiel'); ?> </th> <?php } else { // echo '<th class="item" colspan="3"> </th>'."\n"; } ?> </tr> <?php foreach ($records_items as $record_i) { $compteur_item++; $item_id = $record_i->id; $code_item = stripslashes($record_i->code_item); $description_item = stripslashes($record_i->description_item); $num_item = $record_i->num_item; $type_item = stripslashes($record_i->type_item); $poids_item = $record_i->poids_item; $empreinte_item = $record_i->empreinte_item; $ref_competence = $record_i->ref_competence; ?> <tr valign="top" bgcolor="#ffeefe"> <td class="item" align="right" bgcolor="#ffffff"> <i> <?php p($num_item); ?> </i> </td> <td class="item" align="left"> <?php p($code_item); ?> </td> <td class="item" align="left"> <?php echo nl2br(stripslashes($description_item)); ?> </td> <?php if ($not_light_display) { ?> <td class="item" align="left"> <?php p($type_item); ?> </td> <td class="poids" align="left"> <?php p($poids_item); ?> </td> <td class="empreinte" align="left"> <?php p($empreinte_item); ?> </td> <?php } else { // echo '<td colspan="3"> </td>'."\n"; } ?> </tr> <?php } } } } } } } ?> </table> <?php } }