/** * Turns referentiel into an xml segment * @param competence object * @return string xml segment */ function write_referentiel() { global $CFG; // initial string; $expout = ""; // add comment // $rreferentiel if ($this->rreferentiel) { $id = $this->writeraw($this->rreferentiel->id); $name = $this->writeraw(trim($this->rreferentiel->name)); $code_referentiel = $this->writeraw(trim($this->rreferentiel->code_referentiel)); $description_referentiel = $this->writetext(trim($this->rreferentiel->description_referentiel)); $url_referentiel = $this->writeraw(trim($this->rreferentiel->url_referentiel)); $seuil_certificat = $this->writeraw($this->rreferentiel->seuil_certificat); // MODIF JF 2012/03/26 $minima_certificat = $this->writeraw($this->rreferentiel->minima_certificat); $timemodified = $this->writeraw($this->rreferentiel->timemodified); $nb_domaines = $this->writeraw($this->rreferentiel->nb_domaines); $liste_codes_competence = $this->writeraw(trim($this->rreferentiel->liste_codes_competence)); $liste_empreintes_competence = $this->writeraw(trim($this->rreferentiel->liste_empreintes_competence)); $local = $this->writeraw($this->rreferentiel->local); $logo_referentiel = $this->writeraw($this->rreferentiel->logo_referentiel); // $expout .= "<id>$id</id>\n"; $expout .= " <name>{$name}</name>\n"; $expout .= " <code_referentiel>{$code_referentiel}</code_referentiel>\n"; $expout .= " <description_referentiel>\n{$description_referentiel}</description_referentiel>\n"; $expout .= " <url_referentiel>{$url_referentiel}</url_referentiel>\n"; $expout .= " <seuil_certificat>{$seuil_certificat}</seuil_certificat>\n"; // MODIF JF 2012/03/26 $expout .= " <minima_certificat>{$minima_certificat}</minima_certificat>\n"; $expout .= " <timemodified>{$timemodified}</timemodified>\n"; $expout .= " <nb_domaines>{$nb_domaines}</nb_domaines>\n"; $expout .= " <liste_codes_competence>{$liste_codes_competence}</liste_codes_competence>\n"; $expout .= " <liste_empreintes_competence>{$liste_empreintes_competence}</liste_empreintes_competence>\n"; // $expout .= " <local>$local</local>\n"; // PAS DE LOGO ICI // $expout .= " <logo_referentiel>$logo_referentiel</logo_referentiel>\n"; // MODIF JF 2012/03/09 // PROTOCOLE if (!empty($this->rreferentiel->id)) { if ($record_protocol = referentiel_get_protocol($this->rreferentiel->id)) { $expout .= $this->write_protocol($record_protocol); } } // DOMAINES if (isset($this->rreferentiel->id) && $this->rreferentiel->id > 0) { // LISTE DES DOMAINES $compteur_domaine = 0; $records_domaine = referentiel_get_domaines($this->rreferentiel->id); if ($records_domaine) { // afficher // DEBUG // echo "<br/>DEBUG ::<br />\n"; // print_r($records_domaine); foreach ($records_domaine as $record_d) { // DEBUG // echo "<br/>DEBUG ::<br />\n"; // print_r($records_domaine); $expout .= $this->write_domaine($record_d); } } } } return $expout; }
/** * Function initialize field table referentiel_protocol * @input referentiel_referentiel id * @input new_code string * @input position int * @return true or false * @todo Finish documenting this function **/ function referentiel_delete_domaine_protocole($code, $refrefid) { global $DB; if (!empty($refrefid) && !empty($code)) { $protocole = referentiel_get_protocol($refrefid); if ($protocole) { if ($protocole->l_domaines_oblig) { $protocole->l_domaines_oblig = preg_replace('/' . preg_quote($code) . ':\\d\\//', '', $protocole->l_domaines_oblig); } if ($protocole->l_seuils_domaines) { $protocole->l_seuils_domaines = preg_replace('/' . preg_quote($code) . ':\\d+\\.?\\d*\\//', '', $protocole->l_seuils_domaines); } if ($protocole->l_minimas_domaines) { $protocole->l_minimas_domaines = preg_replace('/' . preg_quote($code) . ':\\d+\\//', '', $protocole->l_minimas_domaines); } $protocole->timemodified = time(); return $DB->update_record("referentiel_protocol", $protocole); } } }
/** * Turns referentiel into an xml segment * @param competence object * @return string xml segment */ function write_referentiel() { global $CFG; global $USER; // initial string; $expout = ""; $id = $this->rreferentiel->id; // add comment and div tags $expout .= "<!-- date: " . date("Y/m/d") . " referentiel: " . $this->rreferentiel->id . " name: " . stripslashes($this->rreferentiel->name) . " -->\n"; $expout .= "<div class=\"referentiel\">\n"; // add header $expout .= "<h3>" . stripslashes($this->rreferentiel->name) . "</h3>\n"; // $expout .= "<ul>\n"; if ($this->rreferentiel) { $name = $this->rreferentiel->name; $code_referentiel = $this->rreferentiel->code_referentiel; $description_referentiel = $this->rreferentiel->description_referentiel; $url_referentiel = $this->rreferentiel->url_referentiel; $seuil_certificat = $this->rreferentiel->seuil_certificat; $minima_certificat = $this->rreferentiel->minima_certificat; $timemodified = $this->rreferentiel->timemodified; $nb_domaines = $this->rreferentiel->nb_domaines; $liste_codes_competence = $this->rreferentiel->liste_codes_competence; $liste_empreintes_competence = $this->rreferentiel->liste_empreintes_competence; $local = $this->rreferentiel->local; $logo_referentiel = $this->rreferentiel->logo_referentiel; $expout .= " <li><b>" . get_string('name', 'referentiel') . "</b> : " . stripslashes($name) . "</li>\n"; $expout .= " <li><b>" . get_string('code_referentiel', 'referentiel') . "</b> : " . stripslashes($code_referentiel) . "</li>\n"; $expout .= " <li><b>" . get_string('description_referentiel', 'referentiel') . "</b> : " . stripslashes($description_referentiel) . "</li>\n"; $expout .= " <li><b>" . get_string('url_referentiel', 'referentiel') . "</b> : {$url_referentiel}</li>\n"; $expout .= " <li><b>" . get_string('seuil_certificat', 'referentiel') . "</b> : {$seuil_certificat}</li>\n"; $expout .= " <li><b>" . get_string('minima_certificat', 'referentiel') . "</b> : {$minima_certificat}</li>\n"; $expout .= " <li><b>" . get_string('nb_domaines', 'referentiel') . "</b> : {$nb_domaines}</li>\n"; $expout .= " <li><b>" . get_string('liste_codes_competence', 'referentiel') . "</b> : " . $this->write_ligne($liste_codes_competence, "/", 80) . "</li>\n"; $expout .= " <li><b>" . get_string('liste_empreintes_competence', 'referentiel') . "</b> : " . $this->write_ligne($liste_empreintes_competence, "/", 80) . "</li>\n"; // $expout .= " <li><b>".get_string('local','referentiel')."</b> : $local</li>\n"; $expout .= " <li><b>" . get_string('logo', 'referentiel') . "</b> : {$logo_referentiel}</li>\n"; // MODIF JF 2012/03/09 // PROTOCOLE if (!empty($this->rreferentiel->id)) { if ($record_protocol = referentiel_get_protocol($this->rreferentiel->id)) { $expout .= $this->write_protocol($record_protocol); } } // DOMAINES if (isset($this->rreferentiel->id) && $this->rreferentiel->id > 0) { // LISTE DES DOMAINES $compteur_domaine = 0; $records_domaine = referentiel_get_domaines($this->rreferentiel->id); if ($records_domaine) { // afficher // DEBUG // echo "<br/>DEBUG ::<br />\n"; // print_r($records_domaine); foreach ($records_domaine as $record_d) { // DEBUG // echo "<br/>DEBUG ::<br />\n"; // print_r($records_domaine); $expout .= $this->write_domaine($record_d); } } } } $expout .= "</ul>\n"; // close off div $expout .= "</div>\n\n\n"; return $expout; }
/** * Turns referentiel into an xml segment * @param competence object * @return string xml segment */ function write_referentiel() { global $CFG; // initial string; $expout = ""; // add header $expout .= "#code_referentiel;nom_referentiel;description_referentiel;url_referentiel;date_creation;nb_domaines;seuil_certificat;liste_codes_competences;liste_empreintes;logo_referentiel;minima_certificat\n"; if ($this->rreferentiel) { $id = $this->rreferentiel->id; $name = $this->rreferentiel->name; $code_referentiel = $this->rreferentiel->code_referentiel; $description_referentiel = $this->purge_sep($this->rreferentiel->description_referentiel); $url_referentiel = $this->rreferentiel->url_referentiel; $seuil_certificat = $this->rreferentiel->seuil_certificat; $minima_certificat = $this->rreferentiel->minima_certificat; $timemodified = $this->rreferentiel->timemodified; $nb_domaines = $this->rreferentiel->nb_domaines; $liste_codes_competence = $this->rreferentiel->liste_codes_competence; $local = $this->rreferentiel->local; $liste_empreintes_competence = $this->rreferentiel->liste_empreintes_competence; $logo_referentiel = $this->rreferentiel->logo_referentiel; // PAS DE LOGO ICI // $expout .= stripslashes($this->output_codage_caractere($code_referentiel)).";".stripslashes($this->output_codage_caractere($name)).";".$this->output_codage_caractere($description_referentiel).";$url_referentiel;$timemodified;$nb_domaines;$seuil_certificat;".stripslashes($this->output_codage_caractere($liste_codes_competence)).";".stripslashes($this->output_codage_caractere($liste_empreintes_competence)).";".$logo_referentiel."\n"; $expout .= stripslashes($this->output_codage_caractere($code_referentiel)) . ";" . stripslashes($this->output_codage_caractere($name)) . ";" . $this->output_codage_caractere($description_referentiel) . ";{$url_referentiel};" . referentiel_timestamp_date_special($timemodified) . ";{$nb_domaines};{$seuil_certificat};" . stripslashes($this->output_codage_caractere($liste_codes_competence)) . ";" . stripslashes($this->output_codage_caractere($liste_empreintes_competence)) . ";{$minima_certificat}\n"; // DOMAINES if (isset($this->rreferentiel->id) && $this->rreferentiel->id > 0) { // MODIF JF 2012/03/09 // PROTOCOLE if (!empty($this->rreferentiel->id)) { if ($record_protocol = referentiel_get_protocol($this->rreferentiel->id)) { $expout .= "#protocole_seuil;protocole_minima;l_domaines_oblig;l_seuils_domaines;l_minimas_domaines;l_competences_oblig;l_seuils_competences;l_minimas_competences;l_items_oblig;timemodified;actif;commentaire\n"; $expout .= $this->write_protocol($record_protocol); } } // LISTE DES DOMAINES $compteur_domaine = 0; $records_domaine = referentiel_get_domaines($this->rreferentiel->id); if ($records_domaine) { // afficher // DEBUG // echo "<br/>DEBUG ::<br />\n"; // print_r($records_domaine); foreach ($records_domaine as $record_d) { // DEBUG // echo "<br/>DEBUG ::<br />\n"; // print_r($records_domaine); $expout .= "#code_domaine;description_domaine;num_domaine;nb_competences;type_domaine;seuil_domaine;minima_domaine\n"; $expout .= $this->write_domaine($record_d); } } } } return $expout; }