/** * Turns referentiel instance into an html segment * @param referentiel instanceobject * @return string xml segment */ function write_certificat($record) { global $CFG; // initial string; $expout = ""; // add comment and div tags if ($record) { // DEBUG // echo "<br />DEBUG LIGNE 1021<br />\n"; // print_r($referentiel_instance); $id = trim($record->id); if (isset($record->synthese_certificat)) { $synthese_certificat = trim($record->synthese_certificat); } else { $synthese_certificat = ''; } $commentaire_certificat = trim($record->commentaire_certificat); $synthese_certificat = trim($record->synthese_certificat); $competences_certificat = trim($record->competences_certificat); $decision_jury = trim($record->decision_jury); $date_decision = userdate(trim($record->date_decision)); $userid = trim($record->userid); $teacherid = trim($record->teacherid); $ref_referentiel = trim($record->ref_referentiel); $verrou = trim($record->verrou); $valide = trim($record->valide); $evaluation = trim($record->evaluation); $synthese_certificat = trim($record->synthese_certificat); // empreintes //$liste_empreintes=referentiel_purge_dernier_separateur(referentiel_get_liste_empreintes_competence($this->rreferentiel), '/'); // USER if (isset($userid) && $userid > 0) { $record_etudiant = referentiel_get_etudiant_user($userid); if (!$record_etudiant) { // creer l'enregistrement car on en a besoin immediatement if (referentiel_add_etudiant_user($userid)) { $record_etudiant = referentiel_get_etudiant_user($userid); } } if ($record_etudiant) { $expout .= $this->write_etudiant($record_etudiant); } if ($this->export_pedagos) { $expout .= $this->write_pedagogie($record->userid); } $expout .= "<table class=\"certificat\">\n"; $expout .= "<tr valign=\"top\">\n\n<th class=\"certificat\">" . get_string('commentaire_certificat', 'referentiel') . "</th>\n<th class=\"certificat\">" . get_string('synthese_certificat', 'referentiel') . "</th>\n"; if ($this->format_condense != 1) { $expout .= "<th class=\"certificat\">" . get_string('competences_certificat', 'referentiel') . "</th>\n"; } $expout .= "<th class=\"certificat\">" . get_string('decision_jury', 'referentiel') . "</th>\n<th class=\"certificat\">" . get_string('date_decision', 'referentiel') . "</th>\n<th class=\"certificat\">" . get_string('verrou', 'referentiel') . "</th>\n<th class=\"certificat\">" . get_string('evaluation', 'referentiel') . "</th>\n</tr>\n"; $expout .= "<tr valign=\"top\">\n\n<td class=\"certificat\"> {$commentaire_certificat}</td>\n<td class=\"certificat\"> {$synthese_certificat}</td>\n"; if ($this->format_condense != 1) { $expout .= "<td class=\"certificat\">" . $this->certificat_items_valides($competences_certificat, $this->rreferentiel->id) . "</td>\n"; } $expout .= "<td class=\"certificat\"> {$decision_jury}</td>\n<td class=\"certificat\"> {$date_decision}</td>\n<td class=\"certificat\"> {$verrou}</td>\n<td class=\"certificat\"> {$evaluation}</td>\n</tr>\n"; if ($this->format_condense == 1) { // couleur de fond pour le certificat if (isset($verrou) && $verrou != "") { if ($verrou != 0) { $bgcolor = 'verrouille'; } else { $bgcolor = 'deverrouille'; } } else { $bgcolor = 'deverrouille'; } $expout .= "<tr><th class=\"certificat\" colspan=\"6\">" . get_string('competences_certificat', 'referentiel') . "</th></tr>\n"; $expout .= "<tr><td class=\"certificat\" colspan=\"6\">\n"; $expout .= referentiel_retourne_certificat_consolide('/', ':', $competences_certificat, $this->rreferentiel->id, ' class="' . $bgcolor . '"'); $expout .= "</td></tr>\n"; } $expout .= "</table>\n"; } } return $expout; }
/** * Turns referentiel instance into an xml segment * @param referentiel instanceobject * @return string xml segment */ function write_certificat($record) { global $CFG; // initial string; $expout = ""; // add comment // $expout .= "\n\n<!-- certificat : $record->id -->\n"; // if ($record) { // DEBUG // echo "<br />DEBUG LIGNE 1298<br />\n"; // print_r($record); $id = $this->writeraw($record->id); $commentaire_certificat = $this->writetext(trim($record->commentaire_certificat)); $competences_certificat = $this->writeraw(trim($record->competences_certificat)); $decision_jury = $this->writeraw(trim($record->decision_jury)); $date_decision = $this->writeraw(userdate(trim($record->date_decision))); $userid = $this->writeraw($record->userid); $teacherid = $this->writeraw($record->teacherid); $ref_referentiel = $this->writeraw($record->ref_referentiel); $verrou = $this->writeraw($record->verrou); $valide = $this->writeraw($record->valide); $evaluation = $this->writeraw($record->evaluation); $synthese_certificat = $this->writetext(trim($record->synthese_certificat)); // DEBUG // echo "<br />DEBUG LIGNE 1314<br />\n"; // echo htmlentities ($expout, ENT_QUOTES, 'UTF-8') ; // USER if (isset($record->userid) && $record->userid > 0) { $record_etudiant = referentiel_get_etudiant_user($record->userid); if (!$record_etudiant) { // creer l'enregistrement car on en a besoin immediatement if (referentiel_add_etudiant_user($record->userid)) { $record_etudiant = referentiel_get_etudiant_user($record->userid); } } if ($record_etudiant) { $expout .= "<certificat>\n"; $expout .= $this->write_etudiant($record_etudiant); if (!$this->format_condense) { // la totale $expout .= "<commentaire_certificat>\n{$commentaire_certificat}</commentaire_certificat>\n"; $expout .= "<competences_certificat>{$competences_certificat}</competences_certificat>\n"; $expout .= "<decision_jury>{$decision_jury}</decision_jury>\n"; $expout .= "<date_decision>{$date_decision}</date_decision>\n"; $expout .= "<ref_referentiel>{$ref_referentiel}</ref_referentiel>\n"; $expout .= "<verrou>{$verrou}</verrou>\n"; $expout .= "<valide>{$valide}</valide>\n"; $expout .= "<evaluation>{$evaluation}</evaluation>\n"; $expout .= "<synthese>\n{$synthese_certificat}</synthese>\n"; } else { if ($this->format_condense == 1) { // la partielle $expout .= "<decision_jury>{$decision_jury}</decision_jury>\n"; $expout .= $this->certificat_pourcentage($competences_certificat, $this->ref_referentiel); } else { if ($this->format_condense == 2) { $expout .= "<decision_jury>{$decision_jury}</decision_jury>\n"; $expout .= $this->certificat_items_binaire($competences_certificat, $this->ref_referentiel); } } } // PEDAGOGIES if ($this->export_pedagos) { // $expout .= ";promotion;formation;pedagogie;composante;num_groupe;commentaire;date_cloture"; $rec_pedago = referentiel_get_pedagogie_user($userid, $ref_referentiel); if ($rec_pedago) { $expout .= "<promotion>" . $this->writeraw(trim($rec_pedago->promotion)) . "</promotion>\n"; $expout .= "<formation>" . $this->writeraw(trim($rec_pedago->formation)) . "</formation>\n"; $expout .= "<pedagogie>" . $this->writeraw(trim($rec_pedago->pedagogie)) . "</pedagogie>\n"; $expout .= "<composante>" . $this->writeraw(trim($rec_pedago->composante)) . "</composante>\n"; $expout .= "<num_groupe>" . $this->writeraw(trim($rec_pedago->num_groupe)) . "</num_groupe>\n"; $expout .= "<commentaire>\n" . $this->writetext(trim($rec_pedago->commentaire)) . "</commentaire>\n"; $expout .= "<date_cloture>" . $this->writeraw(trim($rec_pedago->date_cloture)) . "</date_cloture>\n"; } } $expout .= "</certificat>\n\n"; } } } // DEBUG // echo "<br />DEBUG LIGNE 1330<br />\n"; // echo htmlentities ($expout, ENT_QUOTES, 'UTF-8') ; return $expout; }
/** * Turns referentiel instance into an xml segment * @param referentiel instanceobject * @return string xml segment */ function write_certificat($record) { global $CFG; // initial string; $s1 = ''; $s2 = ''; $s3 = ''; $nbchamps = 0; $expout = ""; // add comment and div tags if ($record) { // DEBUG // echo "<br />DEBUG LIGNE 1021<br />\n"; // print_r($referentiel_instance); $id = trim($record->id); $commentaire_certificat = trim($record->commentaire_certificat); $synthese_certificat = trim($record->synthese_certificat); $competences_certificat = trim($record->competences_certificat); $competences_activite = trim($record->competences_activite); $decision_jury = trim($record->decision_jury); if ($record->date_decision) { $date_decision = userdate(trim($record->date_decision)); } else { $date_decision = ""; } $userid = trim($record->userid); $teacherid = trim($record->teacherid); if ($teacherid != 0) { $nom_prenom_teacher = referentiel_get_user_info($teacherid); } else { $nom_prenom_teacher = ""; } $ref_referentiel = trim($record->ref_referentiel); $verrou = trim($record->verrou); $valide = trim($record->valide); $evaluation = trim($record->evaluation); $pourcentages = ''; // calcul des pourcentages if ($this->certificat_sel_param->certificat_sel_certificat_pourcent) { if (isset($verrou) && $verrou != "") { if ($verrou != 0) { $bgcolor = 'verrouille'; } else { $bgcolor = 'deverrouille'; } } else { $bgcolor = 'deverrouille'; } // ligne des certificat $pourcentages = $this->affiche_certificat_consolide('/', ':', $competences_certificat, $ref_referentiel, ' class="' . $bgcolor . '"'); } // USER if (isset($record->userid) && $record->userid > 0) { $record_etudiant = referentiel_get_etudiant_user($record->userid); if (!$record_etudiant) { // creer l'enregistrement car on en a besoin immediatement if (referentiel_add_etudiant_user($record->userid)) { $record_etudiant = referentiel_get_etudiant_user($record->userid); } } if ($record_etudiant) { // ligne de presentation des champs etudiant $s3 = ''; $s3 .= $this->output_codage_caractere(trim($this->purge_sep(stripslashes('#' . get_string('etudiant', 'referentiel'))))) . ";\n"; $s3 .= "#id;"; if ($this->certificat_sel_param->certificat_sel_etudiant_nom_prenom) { $s3 .= $this->output_codage_caractere(trim($this->purge_sep(stripslashes(get_string('lastname'))) . ";" . $this->purge_sep(stripslashes(get_string('firstname'))))) . ";"; } if ($this->certificat_sel_param->certificat_sel_etudiant_numero) { $s3 .= $this->output_codage_caractere(trim($this->purge_sep(stripslashes(get_string('num_etudiant', 'referentiel'))))) . ";"; } if ($this->certificat_sel_param->certificat_sel_etudiant_ddn) { $s3 .= $this->output_codage_caractere(trim($this->purge_sep(stripslashes(get_string('ddn_etudiant', 'referentiel'))))) . ";"; } if ($this->certificat_sel_param->certificat_sel_etudiant_lieu_naissance) { $s3 .= $this->output_codage_caractere(trim($this->purge_sep(stripslashes(get_string('lieu_naissance', 'referentiel'))))) . ";"; $s3 .= $this->output_codage_caractere(trim($this->purge_sep(stripslashes(get_string('departement_naissance', 'referentiel'))))) . ";"; } if ($this->certificat_sel_param->certificat_sel_etudiant_adresse) { $s3 .= $this->output_codage_caractere(trim($this->purge_sep(stripslashes(get_string('adresse_etudiant', 'referentiel'))))) . ";"; } $s3 .= "\n"; $s1 .= $s3; // fin ligne presentation $s1 .= $this->write_etudiant($record_etudiant, $nbchamps); $s1 .= $this->output_codage_caractere(trim($this->purge_sep(stripslashes('#' . get_string('certificat', 'referentiel'))))) . ";\n"; $s2 = ''; if ($this->certificat_sel_param->certificat_sel_decision_jury) { $s2 .= $this->output_codage_caractere(trim($this->purge_sep('#' . get_string('decision', 'referentiel')))) . ";"; $s2 .= $this->output_codage_caractere(trim($this->purge_sep(get_string('datedecision', 'referentiel')))) . ";"; $s2 .= "\n"; $s2 .= $this->output_codage_caractere(trim($this->purge_sep(stripslashes($decision_jury)))) . ";"; if ($date_decision != "") { $s2 .= $this->output_codage_caractere(trim($this->purge_sep(stripslashes($date_decision)))) . ";"; } else { $s2 .= ";"; } $s2 .= "\n"; } if ($this->certificat_sel_param->certificat_sel_certificat_referents) { $s2 .= $this->output_codage_caractere(trim($this->purge_sep('#' . get_string('valide_par', 'referentiel')))) . ";"; $s2 .= $this->output_codage_caractere(trim($this->purge_sep(stripslashes($nom_prenom_teacher)))) . ";\n"; } if ($this->certificat_sel_param->certificat_sel_certificat_detail) { $s2 .= $this->output_codage_caractere(trim($this->purge_sep('#' . get_string('verrou', 'referentiel')))) . ";"; $s2 .= $verrou . ";"; $s2 .= $this->output_codage_caractere(trim($this->purge_sep(get_string('evaluation', 'referentiel')))) . ";"; $s2 .= $evaluation . ";"; $s2 .= "\n"; } if ($this->certificat_sel_param->certificat_sel_commentaire) { $s2 .= $this->output_codage_caractere(trim($this->purge_sep('#' . get_string('commentaire', 'referentiel')))) . ";\n"; $s2 .= $this->output_codage_caractere(trim($this->purge_sep(stripslashes($commentaire_certificat)))) . ";\n"; $s2 .= $this->output_codage_caractere(trim($this->purge_sep('#' . get_string('synthese_certificat', 'referentiel')))) . ";\n"; $s2 .= $this->output_codage_caractere(trim($this->purge_sep(stripslashes($synthese_certificat)))) . ";\n"; } if ($this->certificat_sel_param->certificat_sel_activite_competences) { $s2 .= $this->output_codage_caractere(trim($this->purge_sep('#' . get_string('competences_declare', 'referentiel')))) . ";\n"; $s2 .= $this->output_codage_caractere($this->affiche_competences_certificat('/', ':', $competences_activite, $this->liste_empreintes_competence, true)) . ";\n"; } if ($this->certificat_sel_param->certificat_sel_certificat_competences) { $s2 .= $this->output_codage_caractere(trim($this->purge_sep('#' . get_string('competences_certificat', 'referentiel')))) . ";\n"; $s2 .= $this->output_codage_caractere($this->affiche_competences_certificat('/', ':', $competences_certificat, $this->liste_empreintes_competence, true)) . ";\n"; } if ($this->certificat_sel_param->certificat_sel_certificat_competences && $this->certificat_sel_param->certificat_sel_certificat_detail) { $s2 .= "\n#" . $this->output_codage_caractere(trim($this->purge_sep(stripslashes(get_string('certificat_sel_certificat_detail', 'referentiel'))))) . ";\n"; $s2 .= "#" . $this->output_codage_caractere(trim($this->purge_sep(stripslashes(get_string('code', 'referentiel'))))) . ';' . $this->output_codage_caractere(trim($this->purge_sep(stripslashes(get_string('approved', 'referentiel'))))) . ';' . $this->output_codage_caractere(trim($this->purge_sep(stripslashes(get_string('description_item', 'referentiel'))))) . ';' . $this->output_codage_caractere(trim($this->purge_sep(stripslashes(get_string('p_item', 'referentiel'))))) . ';' . $this->output_codage_caractere(trim($this->purge_sep(stripslashes(get_string('e_item', 'referentiel'))))) . ';' . "\n"; $s2 .= $this->output_codage_caractere($this->affiche_detail_competences('/', ':', $competences_certificat, $this->liste_empreintes_competence, $this->liste_poids_competence)) . ";\n"; } if ($this->certificat_sel_param->certificat_sel_certificat_pourcent) { $s2 .= "\n#" . $this->output_codage_caractere(trim($this->purge_sep(stripslashes(get_string('pourcentage', 'referentiel'))))) . ";\n"; $s2 .= $pourcentages . ";\n"; } $s1 .= $s2; $s1 .= "\n\n"; $expout .= $s1; } } } return $expout; }
/** * Turns referentiel instance into an xml segment * @param referentiel instanceobject * @return string xml segment */ function write_liste_etudiants() { global $CFG; // initial string; $expout = ""; $id = $this->ireferentiel->id; // add comment and div tags // $expout .= "<!-- etudiants : $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; /* $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 H:i:s",$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"; */ // ETUDIANTS if (isset($this->ireferentiel->course) && $this->ireferentiel->course > 0) { // ETUDIANTS $records_all_students = referentiel_get_students_course($this->ireferentiel->course); if ($records_all_students) { foreach ($records_all_students as $record) { // USER if (isset($record->userid) && $record->userid > 0) { $record_etudiant = referentiel_get_etudiant_user($record->userid); if (!$record_etudiant) { // creer l'enregistrement car on en a besoin immediatement if (referentiel_add_etudiant_user($record->userid)) { $record_etudiant = referentiel_get_etudiant_user($record->userid); } } if ($record_etudiant) { $expout .= $this->write_etudiant($record_etudiant); } } } } } } /* $expout .= " </ul>\n"; $expout .= "</div>\n"; */ return $expout; }
/** * Turns referentiel instance into an xml segment * @param referentiel instanceobject * @return string xml segment */ function write_liste_etudiants() { global $CFG; // initial string; $expout = ""; $id = $this->ireferentiel->id; // add comment and div tags // $expout .= "<!-- etudiants : $this->ireferentiel->id name: $this->ireferentiel->name -->\n"; // add header $expout .= "<h2>" . get_string('etudiant', 'referentiel') . "</h2>\n"; // $expout .= "<table class=\"referentiel\">\n"; $expout .= "<tr>\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; /* $expout .= " <td><b>".get_string('id','referentiel')."</b></td><td> $id</td>\n"; $expout .= " <td><b>".get_string('name','referentiel')."</b></td><td> $name</td>\n"; $expout .= " <td><b>".get_string('description','referentiel')."</b></td><td> $description</td>\n"; $expout .= " <td><b>".get_string('label_domaine','referentiel')."</b></td><td> $label_domaine</td>\n"; $expout .= " <td><b>".get_string('label_competence','referentiel')."</b></td><td> $label_competence</td>\n"; $expout .= " <td><b>".get_string('label_item','referentiel')."</b></td><td> $label_item</td>\n"; $expout .= " <td><b>".get_string('date_instance','referentiel')."</b></td><td>".date("Y-m-d H:i:s",$date_instance)."</td>\n"; $expout .= " <td><b>".get_string('course')."</b></td><td> $course</td>\n"; $expout .= " <td><b>".get_string('ref_referentiel','referentiel')."</b></td><td> $ref_referentiel</td>\n"; $expout .= " <td><b>".get_string('visible','referentiel')."</b></td><td> $visible</td>\n"; */ // ETUDIANTS if (isset($this->ireferentiel->course) && $this->ireferentiel->course > 0) { // ETUDIANTS $records_all_students = referentiel_get_students_course($this->ireferentiel->course); if ($records_all_students) { $expout .= "<table class=\"referentiel\">\n"; // $expout .= "<h4>".get_string('etudiant','referentiel')."</h4>\n"; $expout .= "<tr>\n"; // $expout .= "<th>" . get_string('id', 'referentiel') . "</th>\n"; $expout .= " <th>" . get_string('userid', 'referentiel') . "</th>\n"; $expout .= " <th>" . get_string('nom_prenom', 'referentiel') . "</th>\n"; $expout .= " <th>" . get_string('num_etudiant', 'referentiel') . "</th>\n"; $expout .= " <th>" . get_string('ddn_etudiant', 'referentiel') . "</th>\n"; $expout .= " <th>" . get_string('lieu_naissance', 'referentiel') . "</th>\n"; $expout .= " <th>" . get_string('departement_naissance', 'referentiel') . "</th>\n"; $expout .= " <th>" . get_string('adresse_etudiant', 'referentiel') . "</th>\n"; $expout .= " <th>" . get_string('ref_etablissement', 'referentiel') . "</th>\n"; $expout .= " </tr>\n"; foreach ($records_all_students as $record) { // USER if (isset($record->userid) && $record->userid > 0) { $record_etudiant = referentiel_get_etudiant_user($record->userid); if (!$record_etudiant) { // creer l'enregistrement car on en a besoin immediatement if (referentiel_add_etudiant_user($record->userid)) { $record_etudiant = referentiel_get_etudiant_user($record->userid); } } if ($record_etudiant) { $expout .= $this->write_etudiant($record_etudiant); } } } $expout .= "</table>\n\n"; // } } } $expout .= " </tr>\n"; $expout .= "</table>\n"; return $expout; }
if (!$isteacher && !$iseditor) { $userid = $USER->id; $records_etudiant = referentiel_get_etudiant($userid); } else { $record_id_users = referentiel_select_liste_etudiants($initiale, $userids, $mode, $referentiel, $userid_filtre, $gusers, $select_acc); if ($record_id_users) { foreach ($record_id_users as $un_user_id) { // l'enregistrement existe-t-il ? // echo "<br />".$un_user_id->userid."\n"; if ($updateprofile) { $re = referentiel_update_profile_student($un_user_id->userid); } else { $re = $DB->get_record("referentiel_etudiant", array("userid" => "{$un_user_id->userid}")); } if (!$re) { if (referentiel_add_etudiant_user($un_user_id->userid)) { $re = $DB->get_record("referentiel_etudiant", array("userid" => $un_user_id->userid)); } } if ($re) { $records_etudiant[] = $re; } } } } if (!$records_etudiant) { print_error(get_string('noetudiant', 'referentiel'), "etudiant.php?d={$referentiel->id}&mode=add"); } else { if ($records_etudiant) { // DEBUG // echo "<br/>DEBUG ::<br />\n";
function referentiel_select_liste_etudiants($initiale, $userids, $mode, $referentiel_instance, $userid_filtre = 0, $gusers = NULL, $select_acc) { global $CFG; global $USER; global $DB; static $istutor = false; static $isteacher = false; static $isadmin = false; static $isstudent = false; static $iseditor = false; static $isauthor = false; 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); $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 ($isadmin) echo "Admin "; if ($isteacher) echo "Teacher "; if ($istutor) echo "Tutor "; if ($isstudent) echo "Student "; */ // Creer les enregistrements pour les etudiants $record_id_users = referentiel_get_students_course($course->id, 0, 0); // seulement les stagiaires // echo "<br />DEBUG :: print_lib_etudiant.php :: 219 :: RECORD_ID_USERS<br />\n"; // print_r($record_id_users); // echo "<br />\n"; if ($record_id_users) { foreach ($record_id_users as $un_user_id) { // l'enregistrement existe-t-il ? // echo "<br />".$un_user_id->userid."\n"; $re = $DB->get_record("referentiel_etudiant", array("userid" => "{$un_user_id->userid}")); if (!$re) { $id_etudiant = referentiel_add_etudiant_user($un_user_id->userid); } } } // selection sur les utilisateurs ? if ($isteacher || $iseditor || $isadmin) { // cr�er les enrgistrements etudiants si if ($gusers && $record_id_users) { // liste des utilisateurs du groupe courant // echo "<br />DEBUG :: print_lib_activite.php :: 740 :: GUSERS<br />\n"; // print_object($gusers); // echo "<br />\n"; $record_users = array_intersect($gusers, array_keys($record_id_users)); // $record_users = array_intersect_assoc($record_id_users, array_keys($gusers)); // echo "<br />DEBUG :: print_lib_etudiant.php:: 242 :: 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; } } $boite_selection = referentiel_select_users_etudiant($record_id_users, $mode, $userid_filtre, $initiale, $select_acc); } else { $boite_selection = ""; } // filtres if (!$isteacher && !$iseditor && !$isadmin) { $userid_filtre = $USER->id; } // recuperer les utilisateurs filtres $record_id_users = referentiel_get_students_course($course->id, $userid_filtre); 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; } } // ALPHABETIQUE if (!empty($userids)) { $t_users_select = explode('_', $userids); $record_id_users = array(); foreach ($t_users_select as $userid) { $a_obj = new stdClass(); $a_obj->userid = $userid; $record_id_users[] = $a_obj; } // DEBUG /* echo "<br />DEBUG :: print_lib_etudiant.php :: 2386<br />USERIDS : $userids<br />\n"; print_r($t_users_select); echo "<br />\n"; print_r($record_id_users); exit; */ } /* elseif ((($userid_filtre==$USER->id) || ($userid_filtre==0)) && ($isteacher || $iseditor|| $istutor)){ // Ajouter l'utilisateur courant pour qu'il puisse voir ses propres donnees $a_obj=new stdClass(); $a_obj->userid=$USER->id; $record_id_users[]=$a_obj; } */ echo $boite_selection; return $record_id_users; } return NULL; }
/** * * @param referentiel instanceobject * @return string xml segment */ function write_certificat($record) { global $CFG; // initial string; $expout = ""; // $expout .= "\ncertificat : $record->id\n"; // USER if ($record) { //$expout .= "#id_etudiant;user_id;login;num_etudiant;NOM;Prenom;ddn_etudiant;lieu_naissance;departement_naissance;adresse_etudiant;ref_etablissement;id_certificat;commentaire_certificat;competences_certificat;decision_jury;date_decision;ref_referentiel;verrou;valide;evaluation\n"; $ok_etudiant = false; $record_etudiant = referentiel_get_etudiant_user($record->userid); if (!$record_etudiant) { // creer l'enregistrement car on en a besoin immediatement if (referentiel_add_etudiant_user($record->userid)) { $record_etudiant = referentiel_get_etudiant_user($record->userid); } } if ($record_etudiant) { $id_etudiant = trim($record_etudiant->id); $ref_etablissement = trim($record_etudiant->ref_etablissement); $num_etudiant = trim($record_etudiant->num_etudiant); $ddn_etudiant = trim($record_etudiant->ddn_etudiant); $lieu_naissance = $this->purge_sep($record_etudiant->lieu_naissance); $departement_naissance = $this->purge_sep($record_etudiant->departement_naissance); $adresse_etudiant = $this->purge_sep($record_etudiant->adresse_etudiant); $login = trim(referentiel_get_user_login($record->userid)); /* if ($num_etudiant==$login){ $texte=$num_etudiant; } elseif ($num_etudiant==''){ $texte=$login; } else{ $texte=$num_etudiant." (".$login.")"; } */ if (!$this->format_condense) { $expout .= "{$id_etudiant};" . $record->userid . ";" . $this->output_codage_caractere($login) . ";" . $this->output_codage_caractere($num_etudiant) . ";" . stripslashes($this->output_codage_caractere(referentiel_get_user_nom($record->userid))) . ";" . stripslashes($this->output_codage_caractere(referentiel_get_user_prenom($record->userid))) . ";{$ddn_etudiant};" . stripslashes($this->output_codage_caractere($lieu_naissance)) . ";" . stripslashes($this->output_codage_caractere($departement_naissance)) . ";" . stripslashes($this->output_codage_caractere($adresse_etudiant)) . ";{$ref_etablissement};"; } elseif ($this->format_condense == 1) { $expout .= $record->userid . ";" . $this->output_codage_caractere($login) . ";" . $this->output_codage_caractere($num_etudiant) . ";" . stripslashes($this->output_codage_caractere(referentiel_get_user_nom($record->userid))) . ";" . stripslashes($this->output_codage_caractere(referentiel_get_user_prenom($record->userid))) . ";"; } elseif ($this->format_condense == 2) { $expout .= $this->output_codage_caractere($login) . ";" . $this->output_codage_caractere($num_etudiant) . ";" . stripslashes($this->output_codage_caractere(referentiel_get_user_nom($record->userid))) . ";" . stripslashes($this->output_codage_caractere(referentiel_get_user_prenom($record->userid))) . ";"; } $ok_etudiant = true; } if ($ok_etudiant == false) { if (!$this->format_condense) { $expout .= ";" . $record->userid . ";;;;;;;;;;;"; } else { if ($this->format_condense == 1) { $expout .= $record->userid . ";;;;;"; } } } // DEBUG // echo "<br />DEBUG LIGNE 1021<br />\n"; // print_r($this->ireferentiel); $id = trim($record->id); $commentaire_certificat = $this->purge_sep($record->commentaire_certificat); $synthese_certificat = $this->purge_sep($record->synthese_certificat); $competences_certificat = trim($record->competences_certificat); $decision_jury = $this->purge_sep($record->decision_jury); $date_decision = trim($record->date_decision); $userid = trim($record->userid); $teacherid = trim($record->teacherid); $ref_referentiel = trim($record->ref_referentiel); $verrou = trim($record->verrou); $valide = trim($record->valide); $evaluation = trim($record->evaluation); $synthese_certificat = $this->purge_sep($record->synthese_certificat); if (!$this->format_condense) { $expout .= "{$id};" . stripslashes($this->output_codage_caractere($commentaire_certificat)) . ";" . stripslashes($this->output_codage_caractere($synthese_certificat)) . ";" . stripslashes($this->output_codage_caractere($competences_certificat)) . ";" . stripslashes($this->output_codage_caractere($decision_jury)) . ";" . referentiel_timestamp_date_special($date_decision) . ";{$ref_referentiel};{$verrou};{$valide};{$evaluation};{$synthese_certificat};"; } elseif ($this->format_condense == 1) { $expout .= $this->certificat_pourcentage($competences_certificat, $this->ref_referentiel); } else { $expout .= stripslashes($this->output_codage_caractere($decision_jury)) . ";" . $this->certificat_items_binaire($competences_certificat, $this->ref_referentiel); } // PEDAGOGIES if ($this->export_pedagos) { // $expout .= "promotion;formation;pedagogie;composante;num_groupe;commentaire;date_cloture"; $rec_pedago = referentiel_get_pedagogie_user($userid, $ref_referentiel); if ($rec_pedago) { $expout .= stripslashes($this->output_codage_caractere($rec_pedago->promotion)) . ";" . stripslashes($this->output_codage_caractere($rec_pedago->formation)) . ";" . stripslashes($this->output_codage_caractere($rec_pedago->pedagogie)) . ";" . stripslashes($this->output_codage_caractere($rec_pedago->composante)) . ";" . stripslashes($this->output_codage_caractere($rec_pedago->num_groupe)) . ";" . stripslashes($this->output_codage_caractere($rec_pedago->commentaire)) . ";" . stripslashes($this->output_codage_caractere($rec_pedago->date_cloture)); } } $expout .= "\n"; } return $expout; }
/** * Turns referentiel instance into an xml segment * @param referentiel instanceobject * @return string xml segment */ function write_certificat($record) { global $CFG; // initial string; $s1 = ''; $s2 = ''; $nbchamps = 0; $expout = ""; // add comment and div tags if ($record) { // DEBUG // echo "<br />DEBUG LIGNE 1021<br />\n"; // print_r($referentiel_instance); $id = trim($record->id); $commentaire_certificat = trim($record->commentaire_certificat); $synthese_certificat = trim($record->synthese_certificat); $competences_certificat = trim($record->competences_certificat); $competences_activite = trim($record->competences_activite); $decision_jury = trim($record->decision_jury); if ($record->date_decision) { $date_decision = userdate(trim($record->date_decision)); } else { $date_decision = ""; } $userid = trim($record->userid); $teacherid = trim($record->teacherid); if ($teacherid != 0) { $nom_prenom_teacher = referentiel_get_user_info($teacherid); } else { $nom_prenom_teacher = ""; } $ref_referentiel = trim($record->ref_referentiel); $verrou = trim($record->verrou); $valide = trim($record->valide); $evaluation = trim($record->evaluation); $pourcentages = ''; // calcul des pourcentages if ($this->certificat_sel_param->certificat_sel_certificat_pourcent) { if (isset($verrou) && $verrou != "") { if ($verrou != 0) { $bgcolor = 'verrouille'; } else { $bgcolor = 'deverrouille'; } } else { $bgcolor = 'deverrouille'; } // Tableau $pourcentages = referentiel_retourne_certificat_consolide('/', ':', $competences_certificat, $ref_referentiel, ' class="' . $bgcolor . '"'); } // USER if (isset($record->userid) && $record->userid > 0) { $record_etudiant = referentiel_get_etudiant_user($record->userid); if (!$record_etudiant) { // creer l'enregistrement car on en a besoin immediatement if (referentiel_add_etudiant_user($record->userid)) { $record_etudiant = referentiel_get_etudiant_user($record->userid); } } if ($record_etudiant) { $s2 = ''; if ($this->certificat_sel_param->certificat_sel_decision_jury) { $s2 .= "<th class='referentiel'>" . get_string('decision', 'referentiel') . "</th>\n"; $s2 .= "<th class='referentiel'>" . get_string('datedecision', 'referentiel') . "</th>\n"; $nbchamps += 2; } if ($this->certificat_sel_param->certificat_sel_certificat_referents) { $s2 .= "<th class='referentiel'>" . get_string('valide_par', 'referentiel') . "</th>\n"; $nbchamps++; } if ($this->certificat_sel_param->certificat_sel_certificat_detail) { $s2 .= "<th class='referentiel'>" . get_string('verrou', 'referentiel') . "</th>\n"; $s2 .= "<th class='referentiel'>" . get_string('evaluation', 'referentiel') . "</th>\n"; $nbchamps += 2; } if ($this->certificat_sel_param->certificat_sel_commentaire) { $s2 .= "<th class='referentiel'>" . get_string('commentaire', 'referentiel') . "</th>\n"; $s2 .= "<th class='referentiel'>" . get_string('synthese', 'referentiel') . "</th>\n"; $nbchamps += 2; } if ($this->certificat_sel_param->certificat_sel_activite_competences) { $s2 .= "<th class='referentiel'>" . get_string('competences_declare', 'referentiel') . "</th>\n"; $nbchamps++; } if ($this->certificat_sel_param->certificat_sel_certificat_competences) { $s2 .= "<th class='referentiel'>" . get_string('competences_certificat', 'referentiel') . "</th>\n"; $nbchamps++; } $s1 .= "<!-- certification : {$record->id} -->\n"; $s1 .= "<table class='referentiel'>\n"; $s1 .= $this->write_etudiant($record_etudiant, $nbchamps); $s1 .= "<tr class='referentiel'><td class='referentiel' colspan='" . $nbchamps . "'><b>" . get_string('certificat', 'referentiel') . "</b></td></tr>\n"; $s1 .= "<tr class='referentiel'>\n</tr>\n"; $s1 .= $s2; $s1 .= "</tr>\n"; $s2 = ''; if ($this->certificat_sel_param->certificat_sel_decision_jury) { $s2 .= "<td class='referentiel'>{$decision_jury}</td>\n"; if ($date_decision != "") { $s2 .= "<td class='referentiel'>{$date_decision}</td>\n"; } else { $s2 .= "<td class='referentiel'> </td>\n"; } } if ($this->certificat_sel_param->certificat_sel_certificat_referents) { $s2 .= "<td class='referentiel'>" . $nom_prenom_teacher . "</td>\n"; } if ($this->certificat_sel_param->certificat_sel_certificat_detail) { $s2 .= "<td class='referentiel'>{$verrou}</td>\n"; $s2 .= "<td class='referentiel'>{$evaluation}</td>\n"; } if ($this->certificat_sel_param->certificat_sel_commentaire) { $s2 .= "<td class='referentiel'>{$commentaire_certificat} </td>\n"; $s2 .= "<td class='referentiel'>{$synthese_certificat} </td>\n"; } if ($this->certificat_sel_param->certificat_sel_activite_competences) { $s2 .= "<td class='referentiel'>" . referentiel_affiche_competences_certificat('/', ':', $competences_activite, $this->liste_empreintes_competence) . "</td>\n"; } if ($this->certificat_sel_param->certificat_sel_certificat_competences) { $s2 .= "<td class='referentiel'>" . referentiel_affiche_competences_certificat('/', ':', $competences_certificat, $this->liste_empreintes_competence, false) . "</td>\n"; } if ($this->certificat_sel_param->certificat_sel_certificat_competences && $this->certificat_sel_param->certificat_sel_certificat_detail) { $s2 .= "</tr>\n<tr class='referentiel'>\n<th class='referentiel' colspan='" . $nbchamps . "'>\n" . get_string('certificat_sel_certificat_detail', 'referentiel') . "</th></tr>\n"; $s2 .= "<tr class='referentiel'>\n<td class='referentiel' colspan='" . $nbchamps . "'>\n<table class='referentiel'>\n"; $s2 .= '<tr valign="top"><th>' . get_string('code', 'referentiel') . '</th><th>' . get_string('approved', 'referentiel') . '</th><th colspan="3">' . get_string('description_item', 'referentiel') . '</th><th>' . get_string('p_item', 'referentiel') . '</th><th>' . get_string('e_item', 'referentiel') . '</th></tr>' . "\n"; $s2 .= referentiel_affiche_detail_competences('/', ':', $competences_certificat, $this->liste_empreintes_competence, $this->liste_poids_competence) . "</table>\n</td>\n"; } if ($this->certificat_sel_param->certificat_sel_certificat_pourcent) { $s2 .= "</tr>\n<tr class='referentiel'>\n<th class='referentiel' colspan='" . $nbchamps . "'>\n" . get_string('pourcentage', 'referentiel') . "</th></tr>\n"; $s2 .= "<tr class='referentiel'>\n<td class='referentiel' colspan='" . $nbchamps . "'>" . $pourcentages . "</td>\n"; } $s1 .= "<tr class='referentiel'>\n"; $s1 .= $s2; $s1 .= "</tr>\n"; $s1 .= "</table>\n\n"; $expout .= $s1; } } } return $expout; }