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');
        }
    }
Ejemplo n.º 2
0
 /**
  * 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 header
     $expout .= "<h3 align=\"center\">" . stripslashes($this->rreferentiel->name) . "</h3>\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;
         $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;
         $liste_poids_competence = $this->rreferentiel->liste_poids_competence;
         $local = $this->rreferentiel->local;
         $logo_referentiel = $this->rreferentiel->logo_referentiel;
         $seuil_certificat = $this->rreferentiel->seuil_certificat;
         $minima_certificat = $this->rreferentiel->minima_certificat;
         $expout .= "<table class=\"referentiel\">\n";
         $expout .= "<tr valign=\"top\">\n";
         $expout .= " <th class=\"referentiel\">" . get_string('name', 'referentiel') . "</th>\n";
         $expout .= " <th class=\"referentiel\">" . get_string('code_referentiel', 'referentiel') . "</th>\n";
         $expout .= " <th class=\"referentiel\">" . get_string('description_referentiel', 'referentiel') . "</th>\n";
         $expout .= " <th class=\"referentiel\">" . get_string('url_referentiel', 'referentiel') . "</th>\n";
         $expout .= " </tr>\n";
         $expout .= "<tr valign=\"top\">\n";
         $expout .= " <td class=\"referentiel\">" . stripslashes($name) . "</td>\n";
         $expout .= " <td class=\"referentiel\">" . stripslashes($code_referentiel) . "</td>\n";
         $expout .= " <td class=\"referentiel\">" . stripslashes($description_referentiel) . "</td>\n";
         $expout .= " <td class=\"referentiel\"><a href=\"" . $url_referentiel . "\" title=\"" . $url_referentiel . "\" target=\"_blank\">" . $url_referentiel . "</a></td>\n";
         $expout .= " </tr>\n";
         $expout .= "<tr valign=\"top\">\n";
         $expout .= " <th class=\"referentiel\">" . get_string('liste_codes_competence', 'referentiel') . "</th>\n";
         $expout .= " <th class=\"referentiel\">" . get_string('liste_empreintes_competence', 'referentiel') . "</th>\n";
         $expout .= " <th class=\"referentiel\">" . get_string('liste_poids_competence', 'referentiel') . "</th>\n";
         $expout .= " <th class=\"referentiel\">" . get_string('seuil_certificat', 'referentiel') . " ";
         $expout .= get_string('minima_certificat', 'referentiel') . "</th>\n";
         //            $expout .= " <th class=\"referentiel\">".get_string('nb_domaines','referentiel')."</th>\n";
         // $expout .= " <td class\"referentiel\"><b>".get_string('local','referentiel')."</th>\n";
         $expout .= "</tr>\n";
         $expout .= " <td class=\"referentiel\"> " . $this->write_ligne($liste_codes_competence, "/", 60) . "</td>\n";
         $expout .= " <td class=\"referentiel\"> " . $this->write_ligne($liste_empreintes_competence, "/", 60) . "</td>\n";
         $expout .= " <td class=\"referentiel\"> " . $this->write_ligne($liste_poids_competence, "/", 60) . "</td>\n";
         $expout .= " <td class=\"referentiel\"> {$seuil_certificat} \n";
         $expout .= $minima_certificat . "</td>\n";
         //            $expout .= " <td class=\"referentiel\"> $nb_domaines</td>\n";
         // $expout .= " <td class\"referentiel\"> $local</td>\n";
         //			$expout .= " <td class\"referentiel\"> $logo_referentiel</td>\n";
         $expout .= "</tr>\n";
         $expout .= "</table>\n\n\n";
         // 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;
 }
Ejemplo n.º 3
0
 /**
  * Turns referentiel into an xml segment
  * @param competence object
  * @return string xml segment
  */
 function write_referentiel()
 {
     global $CFG;
     // initial string;
     $expout = "";
     // add comment
     // $expout .= "\n\n<!-- referentiel: $referentiel->id  -->\n";
     //
     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);
         $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));
         $local = $this->writeraw($this->rreferentiel->local);
         if ($this->format_condense == 1) {
             $expout .= "<name>{$name}</name>\n";
             $expout .= "<code_referentiel>{$code_referentiel}</code_referentiel>\n";
             $expout .= "<description_referentiel>\n{$description_referentiel}</description_referentiel>\n";
         } else {
             if ($this->format_condense == 2) {
                 $expout .= "<name>{$name}</name>\n";
                 $expout .= "<code_referentiel>{$code_referentiel}</code_referentiel>\n";
                 $expout .= "<description_referentiel>\n{$description_referentiel}</description_referentiel>\n";
             } else {
                 $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";
                 $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 .= "<local>{$local}</local>\n";
                 // 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;
 }
Ejemplo n.º 4
0
/**
 * 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;
}
/**
 * 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;
}
Ejemplo n.º 6
0
 /**
  * Turns referentiel into an xml segment
  * @param competence object
  * @return string xml segment
  */
 function write_referentiel($referentiel)
 {
     global $CFG;
     global $USER;
     // initial string;
     $expout = "";
     $id = $referentiel->id;
     // add comment and div tags
     $expout .= "<!-- date: " . date("Y/m/d") . " referentiel:  {$referentiel->id}  name: " . stripslashes($referentiel->name) . " -->\n";
     $expout .= "<div class=\"referentiel\">\n";
     // add header
     $expout .= "<h3>" . stripslashes($referentiel->name) . "</h3>\n";
     //
     $expout .= "<ul>\n";
     if ($referentiel) {
         $name = $referentiel->name;
         $code_referentiel = $referentiel->code_referentiel;
         $description_referentiel = $referentiel->description_referentiel;
         $url_referentiel = $referentiel->url_referentiel;
         $seuil_certificat = $referentiel->seuil_certificat;
         $timemodified = $referentiel->timemodified;
         $nb_domaines = $referentiel->nb_domaines;
         $liste_codes_competence = $referentiel->liste_codes_competence;
         $liste_empreintes_competence = $referentiel->liste_empreintes_competence;
         $local = $referentiel->local;
         $logo_referentiel = $referentiel->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('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";
         // DOMAINES
         if (isset($referentiel->id) && $referentiel->id > 0) {
             // LISTE DES DOMAINES
             $compteur_domaine = 0;
             $records_domaine = referentiel_get_domaines($referentiel->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;
 }
Ejemplo n.º 7
0
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;
}
    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> &nbsp; ' . $this->referentiel->name . ' &nbsp; &nbsp; ' . "\n";
            echo '<span class="bold">' . get_string('code', 'referentiel') . '</span> &nbsp; ' . $this->referentiel->code_referentiel . ' &nbsp; &nbsp; ' . "\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> &nbsp; <a target="_blank" href="' . $this->referentiel->url_referentiel . '">' . $this->referentiel->url_referentiel . '</a> &nbsp; &nbsp; ' . "\n";
            if ($not_light_display) {
                echo '<br />' . '<span class="bold">' . get_string('seuil_certificat', 'referentiel') . '</span> &nbsp; ' . $this->referentiel->seuil_certificat . "\n";
                echo ' &nbsp; ' . '<span class="bold">' . get_string('referentiel_global', 'referentiel') . '</span> ';
                if (!empty($this->referentiel->local)) {
                    echo '&nbsp;' . get_string("no") . ' &nbsp; &nbsp; ' . "\n";
                } else {
                    echo '&nbsp; ' . get_string("yes") . ' &nbsp; &nbsp; ' . "\n";
                }
                echo '<br />' . '<span class="bold">' . get_string('logo', 'referentiel') . '</span>  &nbsp; ' . "\n";
                if (!empty($this->referentiel->logo)) {
                    echo referentiel_affiche_image($this->referentiel->logo) . ' &nbsp; &nbsp; ' . "\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">&nbsp;</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">&nbsp;</td>'."\n";
                                        }
                                        ?>

</tr>
<?php 
                                    }
                                }
                            }
                        }
                    }
                }
            }
            ?>
</table>
<?php 
        }
    }
Ejemplo n.º 9
0
 /**
  * Turns referentiel instance into an xml segment
  * @param referentiel instanceobject
  * @return string xml segment
  */
 function write_certification()
 {
     global $CFG;
     $nbchamps = 0;
     // initial string;
     $expout = "";
     if ($this->referentiel_referentiel && $this->referentiel_instance) {
         $id_referentiel = trim($this->referentiel_referentiel->id);
         $name = trim($this->referentiel_referentiel->name);
         $code = trim($this->referentiel_referentiel->code_referentiel);
         $description = trim($this->referentiel_referentiel->description_referentiel);
         $id_instance = $this->referentiel_instance->id;
         $name_instance = trim($this->referentiel_instance->name);
         $description_instance = trim($this->referentiel_instance->description_instance);
         $label_domaine = trim($this->referentiel_instance->label_domaine);
         $label_competence = trim($this->referentiel_instance->label_competence);
         $label_item = trim($this->referentiel_instance->label_item);
         $date_instance = userdate($this->referentiel_instance->date_instance);
         $course = $this->referentiel_instance->course;
         $ref_referentiel = $this->referentiel_instance->ref_referentiel;
         $visible = $this->referentiel_instance->visible;
         //
         // add comment and div tags
         $expout .= $this->output_codage_caractere(trim(get_string('name', 'referentiel'))) . ";";
         $expout .= $this->output_codage_caractere(trim(get_string('description', 'referentiel'))) . ";\n";
         $expout .= $this->output_codage_caractere(trim($this->purge_sep($name . ' - (' . $code . ')'))) . ";";
         $expout .= $this->output_codage_caractere(trim($this->purge_sep($description))) . ";\n";
         $s = '';
         if ($this->certificat_sel_param->certificat_sel_referentiel_instance) {
             $s .= "#id_instance;";
             $s .= $this->output_codage_caractere(trim($this->purge_sep(get_string('name_instance', 'referentiel')))) . ";";
             $s .= $this->output_codage_caractere(trim($this->purge_sep(get_string('description_instance', 'referentiel')))) . ";";
             $s .= $this->output_codage_caractere(trim($this->purge_sep(get_string('label_domaine', 'referentiel')))) . ";";
             $s .= $this->output_codage_caractere(trim($this->purge_sep(get_string('label_competence', 'referentiel')))) . ";";
             $s .= $this->output_codage_caractere(trim($this->purge_sep(get_string('label_item', 'referentiel')))) . ";";
             $s .= $this->output_codage_caractere(trim($this->purge_sep(get_string('date_instance', 'referentiel')))) . ";";
             $s .= get_string('course') . ";";
             $s .= get_string('ref_referentiel', 'referentiel') . ";";
             $s .= $this->output_codage_caractere(trim($this->purge_sep(get_string('visible', 'referentiel')))) . ";";
             $nbchamps += 9;
         }
         if ($nbchamps == 0) {
             $nbchamps = 1;
         }
         if ($this->certificat_sel_param->certificat_sel_referentiel && isset($this->referentiel_referentiel->id) && $this->referentiel_referentiel->id > 0) {
             // DOMAINES
             // LISTE DES DOMAINES
             $compteur_domaine = 0;
             $records_domaine = referentiel_get_domaines($this->referentiel_referentiel->id);
             if ($records_domaine) {
                 foreach ($records_domaine as $record_d) {
                     $expout .= $this->write_domaine($record_d);
                 }
                 $expout .= "\n";
             }
         }
         if ($s != '') {
             $expout .= $s;
             $expout .= "\n";
         }
         $s = '';
         if ($this->certificat_sel_param->certificat_sel_referentiel_instance) {
             $s .= "{$id_instance};";
             $s .= $this->output_codage_caractere(trim($this->purge_sep($name_instance))) . ";";
             $s .= $this->output_codage_caractere(trim($this->purge_sep($description_instance))) . ";";
             $s .= $this->output_codage_caractere(trim($this->purge_sep($label_domaine))) . ";";
             $s .= $this->output_codage_caractere(trim($this->purge_sep($label_competence))) . ";";
             $s .= $this->output_codage_caractere(trim($this->purge_sep($label_item))) . ";";
             $s .= $this->output_codage_caractere(trim($this->purge_sep($date_instance))) . ";";
             $s .= "{$course};";
             $s .= "{$ref_referentiel};";
             $s .= $this->output_codage_caractere(trim($this->purge_sep($visible))) . ";";
         }
         if ($s != '') {
             $expout .= $s . "\n";
         }
         // CERTIFICATS
         if ($this->records_certificats) {
             foreach ($this->records_certificats as $record) {
                 if ($record) {
                     $expout .= $this->write_certificat($record);
                 }
             }
         }
     }
     return $expout;
 }
Ejemplo n.º 10
0
/**
 * Turns referentiel instance into an xml segment
 * @param referentiel instanceobject
 * @return string xml segment
 */
function ooffice_write_referentiel($referentiel_instance, $referentiel_referentiel, $param)
{
    global $CFG;
    global $odt;
    global $image_logo;
    $ok_saut_page = false;
    if ($referentiel_instance && $referentiel_referentiel) {
        $name = recode_utf8_vers_latin1(trim($referentiel_referentiel->name));
        $code = recode_utf8_vers_latin1(trim($referentiel_referentiel->code_referentiel));
        $description = recode_utf8_vers_latin1(trim($referentiel_referentiel->description_referentiel));
        $id = $referentiel_instance->id;
        $name_instance = recode_utf8_vers_latin1(trim($referentiel_instance->name));
        $description_instance = recode_utf8_vers_latin1(trim($referentiel_instance->description_instance));
        $label_domaine = recode_utf8_vers_latin1(trim($referentiel_instance->label_domaine));
        $label_competence = recode_utf8_vers_latin1(trim($referentiel_instance->label_competence));
        $label_item = recode_utf8_vers_latin1(trim($referentiel_instance->label_item));
        $date_instance = $referentiel_instance->date_instance;
        $course = $referentiel_instance->course;
        $ref_referentiel = $referentiel_instance->ref_referentiel;
        $visible = $referentiel_instance->visible;
        $id = $referentiel_instance->id;
        // $odt->SetDrawColor(128, 128, 128);
        // $odt->SetLineWidth(0.4);
        // logo
        // $posy=$odt->GetY();
        //if (isset($image_logo) && ($image_logo!="")){
        //	$odt->Image($image_logo,150,$posy,40);
        // }
        // $posy=$odt->GetY()+60;
        $odt->SetLeftMargin(15);
        // $odt->SetX(20);
        $odt->SetFont('Arial', 'B', 14);
        $odt->WriteParagraphe(0, get_string('certification', 'referentiel'));
        // $odt->Ln(1);
        $odt->SetFont('Arial', '', 12);
        $odt->WriteParagraphe(0, $name . '(' . $code . ')');
        // $odt->Ln(6);
        $odt->SetFont('Arial', '', 10);
        $odt->WriteParagraphe(0, $description);
        //$odt->Ln(6);
        if ($param->certificat_sel_referentiel) {
            // DOMAINES
            // LISTE DES DOMAINES
            $compteur_domaine = 0;
            $records_domaine = referentiel_get_domaines($referentiel_referentiel->id);
            if ($records_domaine) {
                foreach ($records_domaine as $record_d) {
                    ooffice_write_domaine($record_d);
                }
            }
            $ok_saut_page = true;
        }
        if ($param->certificat_sel_referentiel_instance) {
            $odt->SetFont('Arial', 'B', 10);
            $odt->SetFont('Arial', 'B', 14);
            $texte = recode_utf8_vers_latin1(get_string('certification', 'referentiel') . ' <i>' . $referentiel_instance->name . '</i>');
            $odt->WriteParagraphe(0, $texte);
            $odt->SetFont('Arial', 'N', 12);
            $texte = "{$name} : {$description_instance}";
            // $texte.= "$label_domaine, $label_competence,  $label_item";
            $odt->WriteParagraphe(0, $texte);
            /*
            $odt->Ln(2);
            $odt->Write(0,"Cours : $course");
            $odt->Ln();
                        $odt->Write(0,"R�f�rentiel :  $ref_referentiel");
            $odt->Ln();
                        $odt->Write(0,"Visible : $visible");
            $odt->Ln();
            */
            $ok_saut_page = true;
        }
        if ($ok_saut_page == true) {
            // forcer le saut de page
            $odt->AddPage();
        }
        return true;
    }
    return false;
}
/**
 * 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;
}
Ejemplo n.º 12
0
/**
 * Turns referentiel instance into an xml segment
 * @param referentiel instanceobject
 * @return string xml segment
 */
function pdf_write_referentiel($referentiel_instance, $referentiel_referentiel, $param)
{
    global $CFG;
    global $Refpdf;
    global $image_logo;
    $ok_saut_page = false;
    if ($referentiel_instance && $referentiel_referentiel) {
        $name = strip_tags(trim($referentiel_referentiel->name));
        $code = strip_tags(trim($referentiel_referentiel->code_referentiel));
        $description = strip_tags(trim($referentiel_referentiel->description_referentiel));
        $id = $referentiel_instance->id;
        $name_instance = strip_tags(trim($referentiel_instance->name));
        $description_instance = strip_tags(trim($referentiel_instance->description_instance));
        $label_domaine = strip_tags(trim($referentiel_instance->label_domaine));
        $label_competence = strip_tags(trim($referentiel_instance->label_competence));
        $label_item = strip_tags(trim($referentiel_instance->label_item));
        $date_instance = $referentiel_instance->date_instance;
        $course = $referentiel_instance->course;
        $ref_referentiel = $referentiel_instance->ref_referentiel;
        $visible = $referentiel_instance->visible;
        $Refpdf->AddPage();
        $Refpdf->SetAutoPageBreak(1, 27.0);
        $Refpdf->SetCol(0);
        $Refpdf->SetDrawColor(128, 128, 128);
        $Refpdf->SetLineWidth(0.4);
        // logo
        $posy = $Refpdf->GetY();
        if (isset($image_logo) && $image_logo != "") {
            $Refpdf->Image($image_logo, 150, $posy, 40);
        }
        $Refpdf->SetLeftMargin(15);
        $Refpdf->SetFont('helvetica', 'B', 14);
        $Refpdf->Write(6, get_string('certification', 'referentiel'));
        $Refpdf->Ln(6);
        $Refpdf->SetFont('helvetica', '', 12);
        $Refpdf->Write(6, $name . '(' . $code . ')');
        $Refpdf->Ln(6);
        $Refpdf->SetFont('helvetica', '', 10);
        $Refpdf->Write(6, $description);
        $Refpdf->Ln(6);
        if ($param->certificat_sel_referentiel) {
            // DOMAINES
            // LISTE DES DOMAINES
            $compteur_domaine = 0;
            $records_domaine = referentiel_get_domaines($referentiel_referentiel->id);
            if ($records_domaine) {
                foreach ($records_domaine as $record_d) {
                    pdf_write_domaine($record_d);
                }
            }
            $ok_saut_page = true;
        }
        if ($param->certificat_sel_referentiel_instance) {
            $Refpdf->SetFont('helvetica', 'B', 10);
            // $Refpdf->Write(6,"id : $id ");
            // $Refpdf->Ln(6);
            $Refpdf->Write(6, get_string('instance', 'referentiel') . " : " . $name_instance);
            $Refpdf->Ln(6);
            $Refpdf->SetFont('helvetica', '', 10);
            $Refpdf->Write(6, $description_instance);
            $Refpdf->Ln(6);
            $Refpdf->Write(6, $label_domaine . ", " . $label_competence . ", " . $label_item);
            /*
            $Refpdf->Write(6,"Cours : $course");
            $Refpdf->Ln(6);
            	            $Refpdf->Write(6,"Référentiel :  $ref_referentiel");
            $Refpdf->Ln(6);
                    	    $Refpdf->Write(6,"Visible : $visible");
            $Refpdf->Ln(6);
            */
            $ok_saut_page = true;
        }
        $Refpdf->Ln(6);
        if ($ok_saut_page == true) {
            // forcer le saut de page
            $Refpdf->Ln(290);
        }
    }
}
Ejemplo n.º 13
0
echo '<div align="center"><h3><img src="' . $icon . '" border="0" title="" alt="" /> ' . get_string('modifdomskillitemh', 'referentiel') . ' ' . $OUTPUT->help_icon('modifdomskillitemh', 'referentiel') . '</h3></div>' . "\n";
// charger les domaines associes au referentiel courant
if (isset($form->referentiel_id) && $form->referentiel_id > 0) {
    $ref_referentiel = $form->referentiel_id;
    // plus pratique
    // Nombre de domaines � creer
    $objet_nb_domaines = referentiel_get_nb_domaines($ref_referentiel);
    $nb_domaines = $objet_nb_domaines->nb_domaines;
    // DEBUG
    // echo "<br/>DEBUG :: NOMBRE DE DOMAINES A AJOUTER : $nb_domaines <br />\n";
    // AFFICHER LA LISTE DES DOMAINES
    $compteur_nouveau_domaine = 0;
    $compteur_nouveau_competence = 0;
    $compteur_nouveau_item = 0;
    $compteur_domaine = 0;
    $records_domaine = referentiel_get_domaines($ref_referentiel);
    if ($records_domaine) {
        // afficher
        // DEBUG
        // echo "<br/>DEBUG ::<br />\n";
        // print_r($records_domaine);
        // echo "<br/>DEBUG ::<br />\n";
        // Modif jf 2013/04/26
        echo '<form name="form" method="post" action="edit.php?d=' . $referentiel->id . '&pass='******'">' . "\n";
        echo '<br />
 <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>
<input type="submit" value="' . get_string("savechanges") . '" />
<input type="reset" value="' . get_string("corriger", "referentiel") . '" />
<input type="submit" name="cancel" value="' . get_string("quit", "referentiel") . '" />
<br />' . "\n";
Ejemplo n.º 14
0
 /**
  * Turns referentiel into an xml segment
  * @param competence object
  * @return string xml segment
  */
 function write_referentiel()
 {
     global $CFG;
     // initial string;
     $expout = "";
     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;
         $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;
         // $expout = "#Referentiel : ".$this->rreferentiel->id." : ".stripslashes($this->output_codage_caractere($this->rreferentiel->name))."\n";
         // add header
         if ($this->format_condense == 1) {
             $expout .= "#name;code_referentiel;description_referentiel;\n";
             $expout .= stripslashes($this->output_codage_caractere($name)) . ";" . stripslashes($this->output_codage_caractere($code_referentiel)) . ";" . stripslashes($this->output_codage_caractere($description_referentiel)) . "\n";
             $expout .= "#user_id;login;num_etudiant;NOM;Prenom;";
             $expout .= $this->liste_codes_competences($this->rreferentiel->id);
             if ($this->export_pedagos) {
                 $expout .= "promotion;formation;pedagogie;composante;num_groupe;commentaire;date_cloture";
             }
             $expout .= "\n";
         } else {
             if ($this->format_condense == 2) {
                 $expout .= "#name;code_referentiel;description_referentiel;\n";
                 $expout .= stripslashes($this->output_codage_caractere($name)) . ";" . stripslashes($this->output_codage_caractere($code_referentiel)) . ";" . stripslashes($this->output_codage_caractere($description_referentiel)) . "\n";
             } else {
                 $expout .= "#id_referentiel;name;code_referentiel;description_referentiel;url_referentiel;seuil_certificat;timemodified;nb_domaines;liste_codes_competences;liste_empreintes_competences;local\n";
                 $expout .= "{$id};" . stripslashes($this->output_codage_caractere($name)) . ";" . stripslashes($this->output_codage_caractere($code_referentiel)) . ";" . stripslashes($this->output_codage_caractere($description_referentiel)) . ";{$url_referentiel};{$seuil_certificat};" . referentiel_timestamp_date_special($timemodified) . ";{$nb_domaines};" . stripslashes($this->output_codage_caractere($liste_codes_competence)) . ";" . stripslashes($this->output_codage_caractere($liste_empreintes_competence)) . ";{$local}\n";
                 // 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;
 }
Ejemplo n.º 15
0
 /**
  * Turns referentiel instance into an xml segment
  * @param referentiel instanceobject
  * @return string xml segment
  */
 function write_certification()
 {
     global $CFG;
     $nbchamps = 0;
     // initial string;
     $expout = "";
     if ($this->referentiel_referentiel && $this->referentiel_instance) {
         $name = trim($this->referentiel_referentiel->name);
         $code = trim($this->referentiel_referentiel->code_referentiel);
         $description = trim($this->referentiel_referentiel->description_referentiel);
         $id = $this->referentiel_instance->id;
         $name_instance = trim($this->referentiel_instance->name);
         $description_instance = trim($this->referentiel_instance->description_instance);
         $label_domaine = trim($this->referentiel_instance->label_domaine);
         $label_competence = trim($this->referentiel_instance->label_competence);
         $label_item = trim($this->referentiel_instance->label_item);
         $date_instance = userdate($this->referentiel_instance->date_instance);
         $course = $this->referentiel_instance->course;
         $ref_referentiel = $this->referentiel_instance->ref_referentiel;
         $visible = $this->referentiel_instance->visible;
         // add comment and div tags
         $expout .= "<!-- certification-->\n";
         $expout .= "<h2>{$name} - ({$code})</h2>\n";
         $expout .= "<p>{$description}</p>\n";
         $s = '';
         if ($this->certificat_sel_param->certificat_sel_referentiel_instance) {
             //$expout .= "<th class='referentiel'>id</th>\n";
             $s .= "<th class='referentiel'>" . get_string('name_instance', 'referentiel') . "</th>\n";
             $s .= "<th class='referentiel'>" . get_string('description_instance', 'referentiel') . "</th>\n";
             $s .= "<th class='referentiel'>" . get_string('label_domaine', 'referentiel') . "</th>\n";
             $s .= "<th class='referentiel'>" . get_string('label_competence', 'referentiel') . "</th>\n";
             $s .= "<th class='referentiel'>" . get_string('label_item', 'referentiel') . "</th>\n";
             $s .= "<th class='referentiel'>" . get_string('date_instance', 'referentiel') . "</th>\n";
             $s .= "<th class='referentiel'>" . get_string('course') . "</th>\n";
             $s .= "<th class='referentiel'>" . get_string('ref_referentiel', 'referentiel') . "</th>\n";
             $s .= "<th class='referentiel'>" . get_string('visible', 'referentiel') . "</th>\n";
             $nbchamps += 9;
         }
         if ($nbchamps == 0) {
             $nbchamps = 1;
         }
         if ($this->certificat_sel_param->certificat_sel_referentiel && isset($this->referentiel_referentiel->id) && $this->referentiel_referentiel->id > 0) {
             // DOMAINES
             // LISTE DES DOMAINES
             $compteur_domaine = 0;
             $records_domaine = referentiel_get_domaines($this->referentiel_referentiel->id);
             if ($records_domaine) {
                 $expout .= "<table class='referentiel'>\n";
                 $expout .= "<tr class='referentiel'><th class='referentiel' colspan='" . $nbchamps . "'>" . get_string('detail_referentiel', 'referentiel') . "</th></tr>\n";
                 $expout .= "<tr class='referentiel'><td class='referentiel' colspan='" . $nbchamps . "'>\n";
                 $expout .= "<table class='referentiel'>\n";
                 foreach ($records_domaine as $record_d) {
                     $expout .= "<tr class='referentiel'>\n";
                     $expout .= "<th class='referentiel'>" . get_string('code_domaine', 'referentiel') . "</th>\n";
                     $expout .= "<th class='referentiel'>" . get_string('description_domaine', 'referentiel') . "</th>\n";
                     // $expout .= "<th class='referentiel'>".get_string('ref_referentiel','referentiel')."</th>\n";
                     $expout .= "<th class='referentiel'>" . get_string('num_domaine', 'referentiel') . "</th>\n";
                     $expout .= "<th class='referentiel'>" . get_string('nb_competences', 'referentiel') . "</th>\n";
                     $expout .= "</tr>\n";
                     $expout .= $this->write_domaine($record_d);
                 }
                 $expout .= "</table>\n</td></tr>\n";
             }
         }
         if ($s != '') {
             $expout .= "<tr class='referentiel'>\n";
             $expout .= $s;
             $expout .= "</tr>\n";
         }
         $s = '';
         if ($this->certificat_sel_param->certificat_sel_referentiel_instance) {
             // $expout .= " <td class='referentiel'>$id</td>\n";
             $s .= " <td class='referentiel'>{$name_instance}</td>\n";
             $s .= " <td class='referentiel'>{$description_instance}</td>\n";
             $s .= " <td class='referentiel'>{$label_domaine}</td>\n";
             $s .= " <td class='referentiel'>{$label_competence}</td>\n";
             $s .= " <td class='referentiel'>{$label_item}</td>\n";
             $s .= " <td class='referentiel'>{$date_instance}</td>\n";
             $s .= " <td class='referentiel'>{$course}</td>\n";
             $s .= " <td class='referentiel'>{$ref_referentiel}</td>\n";
             $s .= " <td class='referentiel'>{$visible}</td>\n";
         }
         if ($s != '') {
             $expout .= "<tr class='referentiel'>\n";
             $expout .= $s;
             $expout .= "</tr>\n";
         }
         $expout .= "</table>\n";
         // CERTIFICATS
         if ($this->records_certificats) {
             foreach ($this->records_certificats as $record) {
                 if ($record) {
                     $expout .= $this->write_certificat($record);
                 }
             }
         }
     }
     return $expout;
 }
Ejemplo n.º 16
0
 /**
  * Turns referentiel into an xml segment
  * @param competence object
  * @return string xml segment
  */
 function write_referentiel()
 {
     global $CFG;
     // initial string;
     $expout = "";
     // add comment
     //         $referentiel
     if ($this->referentiel) {
         $id = $this->writeraw($this->referentiel->id);
         $name = $this->writeraw(trim($this->referentiel->name));
         $code_referentiel = $this->writeraw(trim($this->referentiel->code_referentiel));
         $description_referentiel = $this->writetext(trim($this->referentiel->description_referentiel));
         $url_referentiel = $this->writeraw(trim($this->referentiel->url_referentiel));
         $seuil_certificat = $this->writeraw($this->referentiel->seuil_certificat);
         $minima_certificat = $this->writeraw($this->referentiel->minima_certificat);
         $timemodified = $this->writeraw($this->referentiel->timemodified);
         $nb_domaines = $this->writeraw($this->referentiel->nb_domaines);
         $liste_codes_competence = $this->writeraw(trim($this->referentiel->liste_codes_competence));
         $liste_empreintes_competence = $this->writeraw(trim($this->referentiel->liste_empreintes_competence));
         $local = $this->writeraw($this->referentiel->local);
         $logo_referentiel = $this->writeraw($this->referentiel->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";
         $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->referentiel->id)) {
             if ($record_protocol = referentiel_get_protocol($this->referentiel->id)) {
                 $expout .= $this->write_protocol($record_protocol);
             }
         }
         // DOMAINES
         if (isset($this->referentiel->id) && $this->referentiel->id > 0) {
             // LISTE DES DOMAINES
             $compteur_domaine = 0;
             $records_domaine = referentiel_get_domaines($this->referentiel->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;
 }