/** * Turns domaine into an xml segment * @param domaine object * @return string xml segment */ function write_domaine($domaine) { global $CFG; // initial string; $expout = ""; // add comment //$expout .= "\n\n<!-- domaine: $domaine->id -->\n"; // if ($domaine) { $id = $this->writeraw($domaine->id); $code = $this->writeraw(trim($domaine->code_domaine)); $description_domaine = $this->writetext(trim($domaine->description_domaine)); $ref_referentiel = $this->writeraw($domaine->ref_referentiel); $num_domaine = $this->writeraw($domaine->num_domaine); $nb_competences = $this->writeraw($domaine->nb_competences); $expout .= "<domaine>\n"; $expout .= "<id>{$id}</id>\n"; $expout .= "<code_domaine>{$code}</code_domaine>\n"; $expout .= "<description_domaine>\n{$description_domaine}</description_domaine>\n"; $expout .= "<ref_referentiel>{$ref_referentiel}</ref_referentiel>\n"; $expout .= "<num_domaine>{$num_domaine}</num_domaine>\n"; $expout .= "<nb_competences>{$nb_competences}</nb_competences>\n"; // LISTE DES COMPETENCES DE CE DOMAINE $compteur_competence = 0; $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) { $expout .= $this->write_competence($record_c); } } $expout .= " </domaine>\n"; } return $expout; }
function edit_domains_competencies_items() { global $OUTPUT, $CFG; $sform = ''; $mform =& $this->_form; // COMPTEURS $this->compteur_domain = 0; $this->compteur_competency = 0; $this->compteur_item = 0; $this->compteur_newdomain = 0; $this->compteur_newcompetency = 0; $this->compteur_newitem = 0; // List of Ids $this->list_domains = ''; $this->list_competencies = ''; $this->list_items = ''; $this->list_newdomains = ''; $this->list_newcompetencies = ''; $this->list_newitems = ''; // charger les domaines associes au referentiel courant if (!empty($this->referentiel->id)) { // Numbre of domains to create $objet_nb_domaines = referentiel_get_nb_domaines($this->referentiel->id); $nb_domaines = $objet_nb_domaines->nb_domaines; // DEBUG // $sform.= '"<br/>DEBUG :: NOMBRE DE DOMAINES A AJOUTER : $nb_domaines <br />\n"; $rec_domains = referentiel_get_domaines($this->referentiel->id); if ($rec_domains) { // add group for text areas $mform->addElement('header', 'domaininfo', get_string('editdomains', 'block_referentiel')); //$mform->setAdvanced('domaininfo'); $mform->addHelpButton('domaininfo', 'modifdomskillitemh', 'referentiel'); $sform = '<img class="selectallarrow" src="' . $OUTPUT->pix_url('arrow_ltr_bas', 'referentiel') . '" width="38" height="22" alt="Pour la sélection :" /> <i>' . get_string('cocher_enregistrer_domain', 'referentiel') . '</i> <br />' . "\n"; $mform->addElement('html', $sform); foreach ($rec_domains as $record) { if ($record) { $this->compteur_domain++; $this->edit_domain($record); // LISTE DES COMPETENCES DE CE DOMAINE $this->compteur_competency = 0; $records_competences = referentiel_get_competences($record->id); if ($records_competences) { foreach ($records_competences as $record_c) { if ($record_c) { $this->compteur_competency++; $this->edit_competency($record_c); } // LISTE DES ITEMS DE CETTE COMPETENCES $this->compteur_item = 0; $records_items = referentiel_get_item_competences($record_c->id); if ($records_items) { foreach ($records_items as $record_i) { if ($record_i) { $this->compteur_item++; $this->edit_item($record_i); } } } // NOMBRE DE NOUVEAUX ITEMS DE COMPETENCE DEMANDES $nb_items_a_afficher = $record_c->nb_item_competences - $this->compteur_item; // Tenir compte des items enregistres if (isset($nb_items_a_afficher) && $nb_items_a_afficher > 0) { for ($k = 0; $k < $nb_items_a_afficher; $k++) { $this->compteur_item++; $this->compteur_newitem++; $this->add_item($record_c->id); } } } } // NOUVELLE COMPETENCE // NOMBRE DE NOUVELLES COMPETENCES DEMANDEES $nb_competences_a_afficher = $record->nb_competences - $this->compteur_competency; // Tenir compte des competences enregistres if (isset($nb_competences_a_afficher) && $nb_competences_a_afficher > 0) { for ($i = 0; $i < $nb_competences_a_afficher; $i++) { $this->compteur_competency++; $this->compteur_newcompetency++; $this->add_competency($record->id, $this->compteur_competency); } } } } $sform = '<img class="selectallarrow" src="' . $OUTPUT->pix_url('arrow_ltr', 'referentiel') . '" width="38" height="22" alt="Pour la sélection :" /> <i>' . get_string('cocher_enregistrer_domain', 'referentiel') . '</i> <br />' . "\n"; $mform->addElement('html', $sform); } // NOMBRE DE NOUVEAUX DOMAINES DEMANDES $nb_domaines_a_afficher = $nb_domaines - $this->compteur_domain; // Tenir compte des domaines enregistres if (isset($nb_domaines_a_afficher) && $nb_domaines_a_afficher > 0) { // add group for text areas $mform->addElement('header', 'newdomaininfo', get_string('newdomains', 'block_referentiel')); $mform->addHelpButton('displayinfo', 'modifdomskillitemh', 'referentiel'); for ($j = 0; $j < $nb_domaines_a_afficher; $j++) { $this->compteur_domain++; $this->compteur_newdomain++; $this->add_domain(); } } $mform->addElement('hidden', 'list_domains', $this->list_domains); $mform->setType('list_domains', PARAM_TEXT); $mform->addElement('hidden', 'list_competencies', $this->list_competencies); $mform->setType('list_competencies', PARAM_TEXT); $mform->addElement('hidden', 'list_items', $this->list_items); $mform->setType('list_items', PARAM_TEXT); $mform->addElement('hidden', 'list_newdomains', $this->list_newdomains); $mform->setType('list_newdomains', PARAM_TEXT); $mform->addElement('hidden', 'list_newcompetencies', $this->list_newcompetencies); $mform->setType('list_newcompetencies', PARAM_TEXT); $mform->addElement('hidden', 'list_newitems', $this->list_newitems); $mform->setType('list_newitems', PARAM_TEXT); // buttons //$this->add_action_buttons(true); $buttonarray = array(); $buttonarray[] =& $mform->createElement('submit', 'submitbutton', get_string('savechanges')); $buttonarray[] =& $mform->createElement('reset', 'resetbutton', get_string('revert')); $buttonarray[] =& $mform->createElement('cancel'); $mform->addGroup($buttonarray, 'buttonar', '', array(' '), false); $mform->closeHeaderBefore('buttonar'); } }
/** * Gets Pository items and returns an array of outcomes * @params referentiel_referentiel record * @returns array of outcome objects */ function referentiel_get_outcomes($referentiel_referentiel) { // genere les outcomes (objectifs) pour le module grades (notes) a partir des items du r�f�rentiel $outcomes = array(); if ($referentiel_referentiel) { $code_referentiel = stripslashes($referentiel_referentiel->code_referentiel); // charger les domaines associes au referentiel courant if (isset($referentiel_referentiel->id) && $referentiel_referentiel->id > 0) { // AFFICHER LA LISTE DES DOMAINES $compteur_domaine = 0; $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) { $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; // LISTE DES COMPETENCES DE CE DOMAINE $compteur_competence = 0; $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) { $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; // ITEM $compteur_item = 0; $records_items = referentiel_get_item_competences($competence_id); if ($records_items) { // DEBUG // echo "<br/>DEBUG :: ITEMS <br />\n"; // print_r($records_items); 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; if (strlen($description_item) <= 60) { $desc_item = $description_item; } else { $desc_item = mb_substr($description_item, 0, 60); $desc_item = mb_substr($desc_item, 0, strrpos($desc_item, " ")); $desc_item .= ' (...)'; } $outcome = new stdClass(); $outcome->name = $code_referentiel . ' ' . $code_item . ' :: ' . $desc_item; $outcome->shortname = $code_item; $outcome->description = $description_item; $outcomes[] = $outcome; } } } } } } } } return $outcomes; }
/** * Turns domaine into an xml segment * @param domaine object * @return string xml segment */ function write_domaine($domaine) { global $CFG; // initial string; $expout = ""; // add comment if ($domaine) { $code = $domaine->code_domaine; $description_domaine = $domaine->description_domaine; $ref_referentiel = $domaine->ref_referentiel; $num_domaine = $domaine->num_domaine; $nb_competences = $domaine->nb_competences; $expout .= "<br /><table class='domaine'>\n"; $expout .= "<tr valign=\"top\">\n"; $expout .= " <th class=\"domaine\"><b>" . get_string('code_domaine', 'referentiel') . "</b></th>\n"; $expout .= " <th class=\"domaine\"><b>" . get_string('description_domaine', 'referentiel') . "</b></th>\n"; // $expout .= " <th class=\"domaine\"><b>".get_string('ref_referentiel','referentiel')."</b></th>\n"; $expout .= " <th class=\"domaine\"><b>" . get_string('num_domaine', 'referentiel') . "</b></th>\n"; $expout .= " <th class=\"domaine\"><b>" . get_string('nb_competences', 'referentiel') . "</b></th>\n"; $expout .= "</tr>\n"; $expout .= "<tr valign=\"top\">\n"; $expout .= " <td class=\"domaine\"> " . stripslashes($code) . "</td>\n"; $expout .= " <td class=\"domaine\"> " . stripslashes($description_domaine) . "</td>\n"; // $expout .= " </td><td class=\"domaine\"> $ref_referentiel</td>\n"; $expout .= " <td class=\"domaine\"> {$num_domaine}</td>\n"; $expout .= " <td class=\"domaine\"> {$nb_competences}</td>\n"; $expout .= "</tr>\n"; $expout .= "</table>\n"; // LISTE DES COMPETENCES DE CE DOMAINE $compteur_competence = 0; $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) { $expout .= $this->write_competence($record_c); } } } return $expout; }
function referentiel_get_maxnbitem($occurrence_id) { // Affiche le référentiel global $DB; $maxnbitem = 1; if (!empty($occurrence_id)) { if ($records_domaine = referentiel_get_domaines($occurrence_id)) { foreach ($records_domaine as $record_d) { if ($records_competences = referentiel_get_competences($record_d->id)) { foreach ($records_competences as $record_c) { if ($record_c->nb_item_competences > $maxnbitem) { $maxnbitem = $record_c->nb_item_competences; } } } } } } return $maxnbitem; }
/** * 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; }
/** * Turns domaine into an xml segment * @param domaine object * @return string xml segment */ function write_domaine($domaine) { global $CFG; // initial string; $expout = ""; if ($domaine) { $id_domaine = $domaine->id; $code = $domaine->code_domaine; $description_domaine = $domaine->description_domaine; $ref_referentiel = $domaine->ref_referentiel; $num_domaine = $domaine->num_domaine; $nb_competences = $domaine->nb_competences; $expout .= "#id_domaine;"; $expout .= $this->output_codage_caractere(trim($this->purge_sep(get_string('code_domaine', 'referentiel')))) . ";"; $expout .= $this->output_codage_caractere(trim($this->purge_sep(get_string('description_domaine', 'referentiel')))) . ";"; // $expout .= $this->output_codage_caractere(trim($this->purge_sep(get_string('ref_referentiel','referentiel')))).";"; $expout .= $this->output_codage_caractere(trim($this->purge_sep(get_string('num_domaine', 'referentiel')))) . ";"; $expout .= $this->output_codage_caractere(trim($this->purge_sep(get_string('nb_competences', 'referentiel')))) . ";"; $expout .= "\n"; $expout .= "{$id_domaine};"; $expout .= $this->output_codage_caractere(trim($this->purge_sep(stripslashes($code)))) . ";"; $expout .= $this->output_codage_caractere(trim($this->purge_sep(stripslashes($description_domaine)))) . ";"; // $expout .= "$ref_referentiel;"; $expout .= $num_domaine . ";"; $expout .= $nb_competences . ";"; $expout .= "\n"; // 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) { $expout .= $this->write_competence($record_c); } } } return $expout; }
/** * Turns domaine into an xml segment * @param domaine object * @return string xml segment */ function write_domaine($domaine) { global $CFG; // initial string; $expout = ""; // add comment $expout .= "\n\n<!-- domaine: {$domaine->id} -->\n<div class='domaine'>\n"; // if ($domaine) { $code = $domaine->code_domaine; $description_domaine = $domaine->description_domaine; $ref_referentiel = $domaine->ref_referentiel; $num_domaine = $domaine->num_domaine; $nb_competences = $domaine->nb_competences; $expout .= "<ul>\n"; $expout .= " <li><b>" . get_string('code_domaine', 'referentiel') . "</b> : " . stripslashes($code) . "</li>\n"; $expout .= " <li><b>" . get_string('description_domaine', 'referentiel') . "</b> : " . stripslashes($description_domaine) . "</li>\n"; // $expout .= " <li><b>".get_string('ref_referentiel','referentiel')."</b> : $ref_referentiel</li>\n"; $expout .= " <li><b>" . get_string('num_domaine', 'referentiel') . "</b> : {$num_domaine}</li>\n"; $expout .= " <li><b>" . get_string('nb_competences', 'referentiel') . "</b> : {$nb_competences}</li>\n"; // LISTE DES COMPETENCES DE CE DOMAINE $compteur_competence = 0; $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) { $expout .= $this->write_competence($record_c); } } $expout .= "</ul>\n"; } $expout .= "</div>\n"; return $expout; }
/** * Gets Pository items and returns an array of outcomes * @params referentiel_referentiel record * @returns array of outcome objects */ function referentiel_get_outcomes($occurrence, $scale_info) { // genere les outcomes (objectifs) pour le module competency a partir des domaine / competences / items du referentiel global $labeldomaine; $labeldomaine = "domaine"; global $labelcompetence; $labelcompetence = "competence"; global $labelitem; $labelitem = "item"; $outcomes = array(); if ($occurrence) { if (!empty($occurrence->label_domaine)) { $labeldomaine = $occurrence->label_domaine; } if (!empty($occurrence->label_competence)) { $labelcompetence = $occurrence->label_competence; } if (!empty($occurrence->label_item)) { $labelitem = $occurrence->label_item; } $code_referentiel = stripslashes($occurrence->code_referentiel); $outcome = new stdClass(); $outcome->parentid = ''; $outcome->idnumber = $code_referentiel; $outcome->shortname = $occurrence->name; $outcome->description = $occurrence->description_referentiel; $outcome->scalevalue = $scale_info->grades; // $outcome->scaleconfig='[{""scaleid"":""1""},{""id"":3,""scaledefault"":1,""proficient"":1}]'; $outcome->scaleconfig = '[{"scaleid":"1"}'; for ($i = 0; $i < $scale_info->nbvalues; $i++) { $index = $i + 1; $outcome->scaleconfig .= ',{"id":' . $index . ','; if (!empty($scale_info->values[$i]->default)) { $outcome->scaleconfig .= '"scaledefault":1,'; } else { $outcome->scaleconfig .= '"scaledefault":0,'; } if (!empty($scale_info->values[$i]->proficient)) { $outcome->scaleconfig .= '"proficient":1}'; } else { $outcome->scaleconfig .= '"proficient":0}'; } } $outcome->scaleconfig .= ']'; $outcome->exportedid = ''; $outcome->isframework = 1; $outcome->taxonomy = 'domain,competency,skill'; $outcomes[] = $outcome; $exportedid = 1; // charger les domaines associes au referentiel courant if (isset($occurrence->id) && $occurrence->id > 0) { // AFFICHER LA LISTE DES DOMAINES $compteur_domaine = 0; $records_domaine = referentiel_get_domaines($occurrence->id); if ($records_domaine) { // afficher // DEBUG // echo "<br/>DEBUG ::<br />\n"; // print_r($records_domaine); 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); if (strlen($description_domaine) <= 100) { $desc_dom = $description_domaine; } else { $desc_dom = mb_substr($description_domaine, 0, 100); $desc_dom = mb_substr($desc_dom, 0, strrpos($desc_dom, " ")); $desc_dom .= ' (...)'; } $outcome = new stdClass(); $outcome->parentid = ''; $outcome->idnumber = $code_domaine; $outcome->shortname = $desc_dom; $outcome->description = $description_domaine; $outcome->scalevalue = ''; $outcome->scaleconfig = ''; $outcome->exportedid = $exportedid; $outcome->isframework = ''; $outcome->taxonomy = ''; $outcomes[] = $outcome; $exportedid++; // LISTE DES COMPETENCES DE CE DOMAINE $compteur_competence = 0; $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) { $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); if (strlen($description_competence) <= 100) { $desc_comp = $description_competence; } else { $desc_comp = mb_substr($description_competence, 0, 100); $desc_comp = mb_substr($desc_comp, 0, strrpos($desc_comp, " ")); $desc_comp .= ' (...)'; } $outcome = new stdClass(); $outcome->parentid = $code_domaine; $outcome->idnumber = $code_competence; $outcome->shortname = $desc_comp; $outcome->description = $description_competence; $outcome->scalevalue = ''; $outcome->scaleconfig = ''; $outcome->exportedid = $exportedid; $outcome->isframework = ''; $outcome->taxonomy = ''; $outcomes[] = $outcome; $exportedid++; // ITEM $compteur_item = 0; $records_items = referentiel_get_item_competences($competence_id); if ($records_items) { // DEBUG // echo "<br/>DEBUG :: ITEMS <br />\n"; // print_r($records_items); 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); if (strlen($description_item) <= 100) { $desc_item = $description_item; } else { $desc_item = mb_substr($description_item, 0, 100); $desc_item = mb_substr($desc_item, 0, strrpos($desc_item, " ")); $desc_item .= ' (...)'; } $outcome = new stdClass(); $outcome->parentid = $code_competence; $outcome->idnumber = $code_item; $outcome->shortname = $desc_item; $outcome->description = $description_item; $outcome->scalevalue = ''; $outcome->scaleconfig = ''; $outcome->exportedid = $exportedid; $outcome->isframework = ''; $outcome->taxonomy = ''; $outcomes[] = $outcome; $exportedid++; } } } } } } } } return $outcomes; }
function view($params = NULL) { // Affiche referential occurrence 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 { $label_d = $this->referentiel->label_domaine; $label_c = $this->referentiel->label_competence; $label_i = $this->referentiel->label_item; } // affichage leger du referentiel $not_light_display = $this->get_display('ligth') > 0; if (!empty($this->referentiel)) { echo '<h3>' . get_string('occurrencereferentiel', 'referentiel') . '</h3>' . "\n"; echo '<div class="ref_aff0">' . "\n"; echo '<span class="bold">' . get_string('name', 'referentiel') . '</span> ' . $this->referentiel->name . ' ' . "\n"; echo '<span class="bold">' . get_string('code', 'referentiel') . '</span> ' . $this->referentiel->code_referentiel . ' ' . "\n"; echo '<br />' . '<span class="bold">' . get_string('description', 'referentiel') . '</span><div class="ref_aff1">' . $this->referentiel->description_referentiel . '</div>' . "\n"; echo '<span class="bold">' . get_string('url', 'referentiel') . '</span> <a target="_blank" href="' . $this->referentiel->url_referentiel . '">' . $this->referentiel->url_referentiel . '</a> ' . "\n"; if ($not_light_display) { echo '<br />' . '<span class="bold">' . get_string('seuil_certificat', 'referentiel') . '</span> ' . $this->referentiel->seuil_certificat . "\n"; echo ' ' . '<span class="bold">' . get_string('referentiel_global', 'referentiel') . '</span> '; if (!empty($this->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($this->referentiel->logo)) { echo referentiel_affiche_image($this->referentiel->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 />' . $this->display_liste_codes_empreintes_competence() . "\n"; } echo '</div>' . "\n"; echo '<br />' . "\n"; ?> <table class="referentiel" cellpadding="5"> <?php // charger les domaines associes au referentiel courant if (!empty($this->referentiel->id)) { // AFFICHER LA LISTE DES DOMAINES $compteur_domaine = 0; $records_domaine = referentiel_get_domaines($this->referentiel->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 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 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 } }
/** * Turns domaine into an xml segment * @param domaine object * @return string xml segment */ function ooffice_write_domaine($domaine) { global $odt; if ($domaine) { $code = $domaine->code_domaine; $description_domaine = $domaine->description_domaine; $ref_referentiel = $domaine->ref_referentiel; $num_domaine = $domaine->num_domaine; $nb_competences = $domaine->nb_competences; $odt->SetFont('Arial', 'B', 10); $odt->Write(0, recode_utf8_vers_latin1(trim(get_string('domaine', 'referentiel') . " : " . stripslashes($code)))); $odt->Ln(1); $odt->SetFont('Arial', '', 10); $odt->Write(0, recode_utf8_vers_latin1(trim(stripslashes($description_domaine)))); $odt->Ln(1); $odt->Ln(1); // LISTE DES COMPETENCES DE CE DOMAINE $records_competences = referentiel_get_competences($domaine->id); if ($records_competences) { foreach ($records_competences as $record_c) { ooffice_write_competence($record_c); } } } }
/** * Turns domaine into an xml segment * @param domaine object * @return string xml segment */ function pdf_write_domaine($domaine) { global $Refpdf; if ($domaine) { $code = $domaine->code_domaine; $description_domaine = $domaine->description_domaine; $ref_referentiel = $domaine->ref_referentiel; $num_domaine = $domaine->num_domaine; $nb_competences = $domaine->nb_competences; $Refpdf->SetFont('helvetica', 'B', 10); $Refpdf->Write(6, trim(get_string('domaine', 'referentiel') . " : " . stripslashes($code))); $Refpdf->Ln(6); $Refpdf->SetFont('helvetica', '', 10); $Refpdf->Write(6, trim(stripslashes($description_domaine))); $Refpdf->Ln(6); // LISTE DES COMPETENCES DE CE DOMAINE $records_competences = referentiel_get_competences($domaine->id); if ($records_competences) { foreach ($records_competences as $record_c) { pdf_write_competence($record_c); } } } }
echo '</td>'; echo '</tr>'; /* echo '<input type="hidden" name="nb_competences_'.$domaine_id.'" value="'.$nb_competences.'" /> '."\n"; */ echo '</table> '; echo ' <!-- SUPPRESSION DOMAINE --> <div align="right"> <span class="surligne"><a href="' . $CFG->wwwroot . '/mod/referentiel/edit.php?id=' . $cm->id . '&deleteid=' . $domaine_id . '&action=modifierdomaine&delete=' . get_string('delete') . '&pass='******'&sesskey=' . sesskey() . '">' . get_string('delete_domain', 'referentiel') . '</a></span> <span class="small"><i>' . get_string('deletedomainhelp', 'referentiel') . '</i></span> </div>' . "\n"; // LISTE DES COMPETENCES DE CE DOMAINE $compteur_competence = 0; $records_competences = referentiel_get_competences($domaine_id); if ($records_competences) { // afficher // DEBUG // echo "<br/>DEBUG :: COMPETENCES <br />\n"; // print_r($records_competences); foreach ($records_competences as $record_c) { $compteur_competence++; $competence_id = $record_c->id; $nb_item_competences = $record_c->nb_item_competences; $old_code_competence = $record_c->code_competence; $code_competence = $record_c->code_competence; $description_competence = stripslashes($record_c->description_competence); // MODIF JF 2012/02/20 if (isset($record_c->type_competence)) { $type_competence = $record_c->type_competence;
/** * Turns domaine into an xml segment * @param domaine object * @return string xml segment */ function write_domaine($domaine) { global $CFG; // initial string; $expout = "#domaine_id;code;description;ref_referentiel;num_domaine;nb_competences\n"; // add comment if ($domaine) { $code = $domaine->code_domaine; $description_domaine = $this->purge_sep($domaine->description_domaine); $ref_referentiel = $domaine->ref_referentiel; $num_domaine = $domaine->num_domaine; $nb_competences = $domaine->nb_competences; $expout .= stripslashes($this->output_codage_caractere($code)) . ";" . stripslashes($this->output_codage_caractere($description_domaine)) . ";{$ref_referentiel};{$num_domaine};{$nb_competences}\n"; // LISTE DES COMPETENCES DE CE DOMAINE $compteur_competence = 0; $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) { $expout .= "#id_competence;code_competence;description_competence;num_competence;nb_item_competences\n"; $expout .= $this->write_competence($record_c); } } } return $expout; }
/** * Turns domaine into an xml segment * @param domaine object * @return string xml segment */ function write_domaine($domaine) { global $CFG; // initial string; $expout = ""; if ($domaine) { $code = $domaine->code_domaine; $description_domaine = $domaine->description_domaine; $ref_referentiel = $domaine->ref_referentiel; $num_domaine = $domaine->num_domaine; $nb_competences = $domaine->nb_competences; // LISTE DES COMPETENCES DE CE DOMAINE $compteur_competence = 0; $records_competences = referentiel_get_competences($domaine->id); if ($records_competences) { $expout .= "<tr class='referentiel'>\n"; $expout .= " <td class='referentiel'>" . stripslashes($code) . "</td>\n"; $expout .= " <td class='referentiel'>" . stripslashes($description_domaine) . "</td>\n"; // $expout .= " <td class='referentiel'>".$ref_referentiel</td>\n"; $expout .= " <td class='referentiel'>" . $num_domaine . "</td>\n"; $expout .= " <td class='referentiel'>" . $nb_competences . "</td>\n"; $expout .= "</tr>\n"; foreach ($records_competences as $record_c) { $expout .= "<tr class='referentiel'>\n"; $expout .= "<th class='referentiel'>" . get_string('code_competence', 'referentiel') . "</th>\n"; $expout .= "<th class='referentiel'>" . get_string('description_competence', 'referentiel') . "</th>\n"; // $expout .= "<th class='referentiel'>".get_string('ref_domaine','referentiel')."</th>\n"; $expout .= "<th class='referentiel'>" . get_string('num_competence', 'referentiel') . "</th>\n"; $expout .= "<th class='referentiel'>" . get_string('nb_item_competences', 'referentiel') . "</th>\n"; $expout .= "</tr>\n"; $expout .= $this->write_competence($record_c); } } } return $expout; }