function referentiel_liste_tous_certificats($id_referentiel, $procole_link = '') { // MODIF JF 2012/02/18 if (!empty($id_referentiel)) { // DEBUG // echo "<br/>DEBUG :: $id_referentiel<br />\n"; // $seuil_certification = referentiel_get_seuil_certification($id_referentiel); $nb_items = referentiel_get_nb_items($id_referentiel); // empreintes $liste_empreintes = referentiel_purge_dernier_separateur(referentiel_get_liste_empreintes_competence($id_referentiel), '/'); $records = referentiel_get_certificats($id_referentiel); if (!$records) { print_print_error("nocertificat", "referentiel", "certificat.php?d={$id_referentiel}&mode=add"); } else { // afficher // DEBUG // echo "<br/>DEBUG ::<br />\n"; // print_r($records); foreach ($records as $record) { referentiel_print_certificat($record, $nb_items, $liste_empreintes, $seuil_certification, $protcloe_link); } } } }
/** * 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 = ""; // add comment // $expout .= "\n\n<!-- instance : ".$this->ireferentiel->id." -->\n"; // if ($this->ireferentiel) { // instance courante // DEBUG // echo "<br />DEBUG LIGNE 1348<br />\n"; // print_r($this->ireferentiel); $id = $this->writeraw($this->ireferentiel->id); $name = $this->writeraw(trim($this->ireferentiel->name)); $description_instance = $this->writetext(trim($this->ireferentiel->description_instance)); $label_domaine = $this->writeraw(trim($this->ireferentiel->label_domaine)); $label_competence = $this->writeraw(trim($this->ireferentiel->label_competence)); $label_item = $this->writeraw(trim($this->ireferentiel->label_item)); $date_instance = $this->writeraw(userdate($this->ireferentiel->date_instance)); $course = $this->writeraw($this->ireferentiel->course); $ref_referentiel = $this->writeraw($this->ireferentiel->ref_referentiel); $visible = $this->writeraw($this->ireferentiel->visible); if (!$this->format_condense) { $expout .= "<instance>\n"; $expout .= "<id>{$id}</id>\n"; $expout .= "<name>{$name}</name>\n"; $expout .= "<description_instance>\n{$description_instance}</description_instance>\n"; $expout .= "<label_domaine>{$label_domaine}</label_domaine>\n"; $expout .= "<label_competence>{$label_competence}</label_competence>\n"; $expout .= "<label_item>{$label_item}</label_item>\n"; $expout .= "<date_instance>{$date_instance}</date_instance>\n"; $expout .= "<course>{$course}</course>\n"; $expout .= "<visible>{$visible}</visible>\n"; // referentiel $expout .= "<ref_referentiel>{$ref_referentiel}</ref_referentiel>\n"; $expout .= "</instance>\n"; } } // CERTIFICATS if (!empty($this->rreferentiel)) { // referentiel_referentiel //$record_referentiel = referentiel_get_referentiel_referentiel($this->ireferentiel->ref_referentiel); $expout .= $this->write_referentiel(); if (empty($this->records_certificats)) { $this->records_certificats = referentiel_get_certificats($this->ireferentiel->ref_referentiel); } // echo "<br />DEBUG LIGNE 1377<br />\n"; // print_r($records_certificats); // exit; if ($this->records_certificats) { $expout .= "<certificats>\n"; foreach ($this->records_certificats as $record) { $expout .= $this->write_certificat($record); } $expout .= "</certificats>\n\n"; } } return $expout; }
function ooffice_write_certification($referentiel_instance, $referentiel_referentiel, $userid = 0, $param, $records_certificats) { global $CFG; global $odt; if ($referentiel_instance && $referentiel_referentiel) { // CERTIFICATS if (isset($referentiel_instance->ref_referentiel) && $referentiel_instance->ref_referentiel > 0) { // les empreintes $liste_empreintes = referentiel_purge_dernier_separateur(referentiel_get_liste_empreintes_competence($referentiel_instance->ref_referentiel), '/'); $liste_poids = referentiel_purge_dernier_separateur(referentiel_get_liste_poids($referentiel_instance->ref_referentiel), '|'); if ($userid > 0) { $record = referentiel_get_certificat_user($userid, $referentiel_instance->ref_referentiel); ooffice_write_certificat($record, $referentiel_instance, $referentiel_referentiel, $liste_empreintes, $liste_poids, $param); } else { if (!$records_certificats) { $records_certificats = referentiel_get_certificats($referentiel_instance->ref_referentiel); } if ($records_certificats) { foreach ($records_certificats as $record) { ooffice_write_certificat($record, $referentiel_instance, $referentiel_referentiel, $liste_empreintes, $liste_poids, $param); } } } // print_r($records_certificats); // exit; } } return ""; }
/** * 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; }
/** * Deletes a referentiel instance activity * * Deletes all database records, files and calendar events for this referentiel instance. * * @global object $CFG * @global object $DB * @param object $referentiel The referentiel to be purged * @param boolean purge : if true referentiel instance is deleted too * @return boolean False indicates error */ function delete_instance($referentiel, $purge = true) { global $CFG, $DB; $result = true; // now get rid of all files $fs = get_file_storage(); if ($cm = get_coursemodule_from_instance('referentiel', $referentiel->id)) { $context = context_module::instance($cm->id); $fs->delete_area_files($context->id); } // suppression des activites associees $activites = referentiel_get_activites_instance($referentiel->id); if ($activites) { foreach ($activites as $activite) { referentiel_delete_activity_record($activite->id); } } // suppression des taches associees $taches = referentiel_get_tasks_instance($referentiel->id); if ($taches) { foreach ($taches as $tache) { referentiel_delete_task_record($tache->id); } } // suppression des accompagnements $accompagnements = referentiel_get_accompagnements($referentiel->id); if ($accompagnements) { foreach ($accompagnements as $accompagnement) { referentiel_delete_accompagnement_record($accompagnement->id); } } // recalcul des certificats associes $certificats = referentiel_get_certificats($referentiel->ref_referentiel); if ($certificats) { foreach ($certificats as $certificat) { referentiel_recalcule_certificat($certificat); } } // suppression des evenements du calendrier if (!$DB->delete_records('event', array('modulename' => 'referentiel', 'instance' => $referentiel->id))) { $result = false; } if ($purge) { // on supprime aussi l'instance if (!$DB->delete_records('referentiel', array('id' => $referentiel->id))) { $result = false; } } else { // l'instance est conservee après avoir ete videe ; utile pour la reinitialisation du cours $result = true; } // $mod = $DB->get_field('modules','id',array('name'=>'referentiel')); // referentiel_grade_item_delete($referentiel); // existe pas return $result; }
/** * 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_liste_certificats($id_referentiel) { if (isset($id_referentiel) && $id_referentiel > 0) { $records_certificat = referentiel_get_certificats($id_referentiel); if (!$records_certificat) { print_error(get_string('nocertificat', 'referentiel'), "certificat.php?d={$id_referentiel}&mode=add"); } else { ?> <h3><?php print_string('certificat', 'referentiel'); ?> </h3> <table class="certificat" cellpadding="5"> <?php // afficher foreach ($records_certificat as $record_a) { $certificat_id = $record_a->id; $commentaire_certificat = stripslashes($record_a->commentaire_certificat); $competences_certificat = $record_a->competences_certificat; $decision_jury = stripslashes($record_a->decision_jury); $ref_referentiel = $record_a->ref_referentiel; $userid = $record_a->userid; $teacherid = $record_a->teacherid; $date_decision = $record_a->date_decision; ?> <tr valign="top" class="certificat" > <td class="certificat" align="right" width="20%"> <b><?php print_string('id', 'referentiel'); ?> : </b> </td> <td class="certificat" align="left"> <?php p($certificat_id); ?> </td> <td class="certificat" align="right" width="20%"> <b><?php print_string('etudiant', 'referentiel'); ?> : </b> </td> <td class="certificat" align="left"> <?php p($userid); ?> </td> </tr> <tr valign="top" class="certificat" > <td class="certificat" align="right" width="20%"> <b><?php print_string('decision_jury', 'referentiel'); ?> :</b> </td> <td class="certificat" align="left"> <?php echo nl2br($decision_jury); ?> </td> <td class="certificat" align="right" width="20%"> <b><?php print_string('date_decision', 'referentiel'); ?> : </b> </td> <td class="certificat" align="left"> <?php p($date_decision); ?> </td> </tr> <tr valign="top" class="certificat" > <td class="certificat" align="right" width="20%"> <b><?php print_string('commentaire', 'referentiel'); ?> :</b> </td> <td class="certificat" align="left" colspan="3"> <?php echo nl2br($commentaire_certificat); ?> </td> </tr> <tr valign="top" class="certificat" > <td class="certificat" align="right" width="20%"> <b><?php print_string('liste_codes_competence', 'referentiel'); ?> : </b> </td> <td class="certificat" align="left" colspan="3"> <?php p(referentiel_affiche_liste_codes_competence('/', $competences_certificat)); ?> </td> </tr> <tr valign="top" class="certificat" > <td class="certificat" align="right" width="20%"> <b><?php print_string('referent', 'referentiel'); ?> : </b> </td> <td class="certificat" align="left" colspan="3"> <?php p($teacherid); ?> </td> </tr> <?php } } ?> </table> <?php } }