示例#1
0
 /**
  * Turns referentiel instance into an xml segment
  * @param referentiel instanceobject
  * @return string xml segment
  */
 function write_certificat($record)
 {
     global $CFG;
     // initial string;
     $expout = "";
     // add comment
     // $expout .= "\n\n<!-- certificat : $record->id  -->\n";
     //
     if ($record) {
         // DEBUG
         // echo "<br />DEBUG LIGNE 1298<br />\n";
         // print_r($record);
         $id = $this->writeraw($record->id);
         $commentaire_certificat = $this->writetext(trim($record->commentaire_certificat));
         $competences_certificat = $this->writeraw(trim($record->competences_certificat));
         $decision_jury = $this->writeraw(trim($record->decision_jury));
         $date_decision = $this->writeraw(userdate(trim($record->date_decision)));
         $userid = $this->writeraw($record->userid);
         $teacherid = $this->writeraw($record->teacherid);
         $ref_referentiel = $this->writeraw($record->ref_referentiel);
         $verrou = $this->writeraw($record->verrou);
         $valide = $this->writeraw($record->valide);
         $evaluation = $this->writeraw($record->evaluation);
         $synthese_certificat = $this->writetext(trim($record->synthese_certificat));
         // DEBUG
         // echo "<br />DEBUG LIGNE 1314<br />\n";
         // echo htmlentities ($expout, ENT_QUOTES, 'UTF-8')  ;
         // USER
         if (isset($record->userid) && $record->userid > 0) {
             $record_etudiant = referentiel_get_etudiant_user($record->userid);
             if (!$record_etudiant) {
                 // creer l'enregistrement car on en a besoin immediatement
                 if (referentiel_add_etudiant_user($record->userid)) {
                     $record_etudiant = referentiel_get_etudiant_user($record->userid);
                 }
             }
             if ($record_etudiant) {
                 $expout .= "<certificat>\n";
                 $expout .= $this->write_etudiant($record_etudiant);
                 if (!$this->format_condense) {
                     // la totale
                     $expout .= "<commentaire_certificat>\n{$commentaire_certificat}</commentaire_certificat>\n";
                     $expout .= "<competences_certificat>{$competences_certificat}</competences_certificat>\n";
                     $expout .= "<decision_jury>{$decision_jury}</decision_jury>\n";
                     $expout .= "<date_decision>{$date_decision}</date_decision>\n";
                     $expout .= "<ref_referentiel>{$ref_referentiel}</ref_referentiel>\n";
                     $expout .= "<verrou>{$verrou}</verrou>\n";
                     $expout .= "<valide>{$valide}</valide>\n";
                     $expout .= "<evaluation>{$evaluation}</evaluation>\n";
                     $expout .= "<synthese>\n{$synthese_certificat}</synthese>\n";
                 } else {
                     if ($this->format_condense == 1) {
                         // la partielle
                         $expout .= "<decision_jury>{$decision_jury}</decision_jury>\n";
                         $expout .= $this->certificat_pourcentage($competences_certificat, $this->ref_referentiel);
                     } else {
                         if ($this->format_condense == 2) {
                             $expout .= "<decision_jury>{$decision_jury}</decision_jury>\n";
                             $expout .= $this->certificat_items_binaire($competences_certificat, $this->ref_referentiel);
                         }
                     }
                 }
                 // PEDAGOGIES
                 if ($this->export_pedagos) {
                     // $expout .= ";promotion;formation;pedagogie;composante;num_groupe;commentaire;date_cloture";
                     $rec_pedago = referentiel_get_pedagogie_user($userid, $ref_referentiel);
                     if ($rec_pedago) {
                         $expout .= "<promotion>" . $this->writeraw(trim($rec_pedago->promotion)) . "</promotion>\n";
                         $expout .= "<formation>" . $this->writeraw(trim($rec_pedago->formation)) . "</formation>\n";
                         $expout .= "<pedagogie>" . $this->writeraw(trim($rec_pedago->pedagogie)) . "</pedagogie>\n";
                         $expout .= "<composante>" . $this->writeraw(trim($rec_pedago->composante)) . "</composante>\n";
                         $expout .= "<num_groupe>" . $this->writeraw(trim($rec_pedago->num_groupe)) . "</num_groupe>\n";
                         $expout .= "<commentaire>\n" . $this->writetext(trim($rec_pedago->commentaire)) . "</commentaire>\n";
                         $expout .= "<date_cloture>" . $this->writeraw(trim($rec_pedago->date_cloture)) . "</date_cloture>\n";
                     }
                 }
                 $expout .= "</certificat>\n\n";
             }
         }
     }
     // DEBUG
     // echo "<br />DEBUG LIGNE 1330<br />\n";
     // echo htmlentities ($expout, ENT_QUOTES, 'UTF-8')  ;
     return $expout;
 }
 function write_pedagogie($userid)
 {
     // $expout .= "promotion;formation;pedagogie;composante;num_groupe;commentaire;date_cloture";
     $expout = "";
     if ($userid) {
         $rec_pedago = referentiel_get_pedagogie_user($userid, $this->rreferentiel->id);
         if ($rec_pedago) {
             $expout .= "\n<table class=\"item\">\n<tr valign=\"top\">\n\n<th class=\"item\">" . get_string('promotion', 'referentiel') . "</th>\n<th class=\"item\">" . get_string('formation', 'referentiel') . "</th>\n<th class=\"item\">" . get_string('pedagogie', 'referentiel') . "</th>\n<th class=\"item\">" . get_string('composante', 'referentiel') . "</th>\n<th class=\"item\">" . get_string('num_groupe', 'referentiel') . "</th>\n<th class=\"item\">" . get_string('commentaire', 'referentiel') . "</th>\n<th class=\"item\">" . get_string('date_cloture', 'referentiel') . "</th>\n</tr>\n";
             $expout .= "<tr valign=\"top\">\n\n<td class=\"item\">" . $rec_pedago->promotion . "</td>\n<td class=\"item\">" . stripslashes($rec_pedago->formation) . "</td>\n<td class=\"item\">" . stripslashes($rec_pedago->pedagogie) . "</td>\n<td class=\"item\">" . stripslashes($rec_pedago->composante) . "</td>\n<td class=\"item\">" . stripslashes($rec_pedago->num_groupe) . "</td>\n<td class=\"item\">" . stripslashes($rec_pedago->commentaire) . "</td>\n<td class=\"item\">" . stripslashes($rec_pedago->date_cloture) . "</td>\n\n</tr></table>\n";
         }
     }
     return $expout;
 }
示例#3
0
    $url->param('id', $id);
} else {
    // print_error('You cannot call this script in that way');
    print_error(get_string('erreurscript', 'referentiel', 'Erreur01 : pedagogie.php'), 'referentiel');
}
// Moodle 2
$url->param('mode', $mode);
// Valable pour Moodle 2.1 et Moodle 2.2
//if ($CFG->version < 2011120100) {
$context = context_module::instance($cm->id);
//} else {
// $context = context_module::instance($cm);
//}
if (!empty($userid)) {
    // id pedago
    $record = referentiel_get_pedagogie_user($userid, $referentiel->id);
}
if (!empty($pedago_id)) {
    // id pedago
    if (!($record = referentiel_get_pedagogie($pedago_id))) {
        print_error('pedago id is incorrect');
    }
}
require_login($course->id, false, $cm);
// pas d'autologin guest
if (!isloggedin() or isguestuser()) {
    redirect($CFG->wwwroot . '/mod/referentiel/view.php?id=' . $cm->id . '&amp;non_redirection=1');
}
/// If it's hidden then it's don't show anything.  :)
/// Some capability checks.
if (empty($cm->visible) && (!has_capability('moodle/course:viewhiddenactivities', $context) && !has_capability('mod/referentiel:managecomments', $context))) {
 function write_pedagogie($userid)
 {
     // $expout .= "promotion;formation;pedagogie;composante;num_groupe;commentaire;date_cloture";
     $expout = "";
     if ($userid) {
         $rec_pedago = referentiel_get_pedagogie_user($userid, $this->rreferentiel->id);
         if ($rec_pedago) {
             $expout .= "\n<pedagos>\n";
             $expout .= "<promotion>" . $rec_pedago->promotion . "</promotion>\n<formation>" . stripslashes($rec_pedago->formation) . "</formation>\n<pedagogie>" . stripslashes($rec_pedago->pedagogie) . "</pedagogie>\n<composante>" . stripslashes($rec_pedago->composante) . "</composante>\n<num_groupe>" . stripslashes($rec_pedago->num_groupe) . "</num_groupe>\n<commentaire>" . stripslashes($rec_pedago->commentaire) . "</commentaire>\n<date_cloture>" . stripslashes($rec_pedago->date_cloture) . "</date_cloture>\n</pedagos>\n";
         }
     }
     return $expout;
 }
function referentiel_print_liste_associations($mode, $referentiel_instance, $userid_filtre = 0, $gusers)
{
    global $CFG;
    global $DB;
    global $USER;
    static $referentiel_id = NULL;
    // contexte
    $cm = get_coursemodule_from_instance('referentiel', $referentiel_instance->id);
    $course = $DB->get_record("course", array("id" => "{$cm->course}"));
    if (empty($cm) or empty($course)) {
        print_error('REFERENTIEL_ERROR :: lib_pedagogie.php :: 242 :: You cannot call this script in that way');
    }
    $context = context_module::instance($cm->id);
    $referentiel_id = $referentiel_instance->ref_referentiel;
    $roles = referentiel_roles_in_instance($referentiel_instance->id);
    $iseditor = $roles->is_editor;
    $isadmin = $roles->is_admin;
    $isteacher = $roles->is_teacher;
    $istutor = $roles->is_tutor;
    $isstudent = $roles->is_student;
    if (isset($referentiel_id) && $referentiel_id > 0) {
        $referentiel_referentiel = referentiel_get_referentiel_referentiel($referentiel_id);
        if (!$referentiel_referentiel) {
            if ($iseditor) {
                error(get_string('creer_referentiel', 'referentiel'), "{$CFG->wwwroot}/mod/referentiel/edit.php?d={$referentiel_instance->id}&amp;mode=editreferentiel&amp;sesskey=" . sesskey());
            } else {
                error(get_string('creer_referentiel', 'referentiel'), "{$CFG->wwwroot}/course/view.php?id={$course->id}&amp;sesskey=" . sesskey());
            }
        }
        // boite pour selectionner les utilisateurs ?
        if ($isteacher || $iseditor || $istutor) {
            // tous les users possibles (pour la boite de selection)
            // Get your userids the normal way
            $record_id_users = referentiel_get_students_course($course->id, 0, 0);
            //seulement les stagiaires
            if ($gusers && $record_id_users) {
                // liste des utilisateurs du groupe courant
                // echo "<br />DEBUG :: lib_pedagogie.php :: 130 :: GUSERS<br />\n";
                // print_object($gusers);
                // echo "<br />\n";
                $record_users = array_intersect($gusers, array_keys($record_id_users));
                // $record_users  = array_intersect_assoc($record_id_users, array_keys($gusers));
                // echo "<br />DEBUG :: lib_pedagogie.php :: 135 :: RECORD_USERS<br />\n";
                // print_r($record_users  );
                // echo "<br />\n";
                // recopier
                $record_id_users = array();
                foreach ($record_users as $record_id) {
                    $a_obj = new stdClass();
                    $a_obj->userid = $record_id;
                    $record_id_users[] = $a_obj;
                }
            }
            echo referentiel_select_users_pedagogie($record_id_users, "pedagogie.php", $mode, $userid_filtre);
        } else {
            $userid_filtre = $USER->id;
            // les étudiants ne peuvent voir que leur fiche
        }
        // recuperer les utilisateurs filtres
        // si $userid_filtre ==0 on retourne tous les utilisateurs du cours et du groupe
        if (!empty($userid_filtre)) {
            $record_id_users = referentiel_get_students_course($course->id, $userid_filtre, 0);
        } else {
            $record_id_users = referentiel_get_students_course($course->id, $userid_filtre, 0);
        }
        // groupes ?
        if ($gusers && $record_id_users) {
            $record_users = array_intersect($gusers, array_keys($record_id_users));
            // recopier
            $record_id_users = array();
            foreach ($record_users as $record_id) {
                $a_obj = new stdClass();
                $a_obj->userid = $record_id;
                $record_id_users[] = $a_obj;
            }
        }
        if ($record_id_users) {
            // Afficher
            echo referentiel_entete_asso_pedagogie($context);
            foreach ($record_id_users as $record_id) {
                // afficher la liste d'users
                // recupere les enregistrements de pedagogies
                $record_pedago = referentiel_get_pedagogie_user($record_id->userid, $referentiel_id);
                // DEBUG
                // echo "<br />DEBUG :: lib_pedagogie :: 326 ::<br />\n";
                // print_object($record_pedago);
                if ($record_pedago) {
                    $isauthor = referentiel_pedagogie_isowner($record_pedago->id, $USER->id);
                    if ($isauthor || $istutor || $isteacher || $iseditor) {
                        referentiel_print_association($record_pedago, $context, $record_id->userid, $referentiel_instance->id, $referentiel_instance->ref_referentiel);
                    }
                }
            }
            echo referentiel_enqueue_asso_pedagogie();
        }
        echo '<br /><br />' . "\n";
    }
}
示例#6
0
 /**
  *
  * @param referentiel instanceobject
  * @return string xml segment
  */
 function write_certificat($record)
 {
     global $CFG;
     // initial string;
     $expout = "";
     // $expout .= "\ncertificat : $record->id\n";
     // USER
     if ($record) {
         //$expout .= "#id_etudiant;user_id;login;num_etudiant;NOM;Prenom;ddn_etudiant;lieu_naissance;departement_naissance;adresse_etudiant;ref_etablissement;id_certificat;commentaire_certificat;competences_certificat;decision_jury;date_decision;ref_referentiel;verrou;valide;evaluation\n";
         $ok_etudiant = false;
         $record_etudiant = referentiel_get_etudiant_user($record->userid);
         if (!$record_etudiant) {
             // creer l'enregistrement car on en a besoin immediatement
             if (referentiel_add_etudiant_user($record->userid)) {
                 $record_etudiant = referentiel_get_etudiant_user($record->userid);
             }
         }
         if ($record_etudiant) {
             $id_etudiant = trim($record_etudiant->id);
             $ref_etablissement = trim($record_etudiant->ref_etablissement);
             $num_etudiant = trim($record_etudiant->num_etudiant);
             $ddn_etudiant = trim($record_etudiant->ddn_etudiant);
             $lieu_naissance = $this->purge_sep($record_etudiant->lieu_naissance);
             $departement_naissance = $this->purge_sep($record_etudiant->departement_naissance);
             $adresse_etudiant = $this->purge_sep($record_etudiant->adresse_etudiant);
             $login = trim(referentiel_get_user_login($record->userid));
             /*
                             if ($num_etudiant==$login){
                                 $texte=$num_etudiant;
                             }
                             elseif ($num_etudiant==''){
                                 $texte=$login;
                             }
                             else{
                                 $texte=$num_etudiant." (".$login.")";
                             }
             */
             if (!$this->format_condense) {
                 $expout .= "{$id_etudiant};" . $record->userid . ";" . $this->output_codage_caractere($login) . ";" . $this->output_codage_caractere($num_etudiant) . ";" . stripslashes($this->output_codage_caractere(referentiel_get_user_nom($record->userid))) . ";" . stripslashes($this->output_codage_caractere(referentiel_get_user_prenom($record->userid))) . ";{$ddn_etudiant};" . stripslashes($this->output_codage_caractere($lieu_naissance)) . ";" . stripslashes($this->output_codage_caractere($departement_naissance)) . ";" . stripslashes($this->output_codage_caractere($adresse_etudiant)) . ";{$ref_etablissement};";
             } elseif ($this->format_condense == 1) {
                 $expout .= $record->userid . ";" . $this->output_codage_caractere($login) . ";" . $this->output_codage_caractere($num_etudiant) . ";" . stripslashes($this->output_codage_caractere(referentiel_get_user_nom($record->userid))) . ";" . stripslashes($this->output_codage_caractere(referentiel_get_user_prenom($record->userid))) . ";";
             } elseif ($this->format_condense == 2) {
                 $expout .= $this->output_codage_caractere($login) . ";" . $this->output_codage_caractere($num_etudiant) . ";" . stripslashes($this->output_codage_caractere(referentiel_get_user_nom($record->userid))) . ";" . stripslashes($this->output_codage_caractere(referentiel_get_user_prenom($record->userid))) . ";";
             }
             $ok_etudiant = true;
         }
         if ($ok_etudiant == false) {
             if (!$this->format_condense) {
                 $expout .= ";" . $record->userid . ";;;;;;;;;;;";
             } else {
                 if ($this->format_condense == 1) {
                     $expout .= $record->userid . ";;;;;";
                 }
             }
         }
         // DEBUG
         // echo "<br />DEBUG LIGNE 1021<br />\n";
         // print_r($this->ireferentiel);
         $id = trim($record->id);
         $commentaire_certificat = $this->purge_sep($record->commentaire_certificat);
         $synthese_certificat = $this->purge_sep($record->synthese_certificat);
         $competences_certificat = trim($record->competences_certificat);
         $decision_jury = $this->purge_sep($record->decision_jury);
         $date_decision = trim($record->date_decision);
         $userid = trim($record->userid);
         $teacherid = trim($record->teacherid);
         $ref_referentiel = trim($record->ref_referentiel);
         $verrou = trim($record->verrou);
         $valide = trim($record->valide);
         $evaluation = trim($record->evaluation);
         $synthese_certificat = $this->purge_sep($record->synthese_certificat);
         if (!$this->format_condense) {
             $expout .= "{$id};" . stripslashes($this->output_codage_caractere($commentaire_certificat)) . ";" . stripslashes($this->output_codage_caractere($synthese_certificat)) . ";" . stripslashes($this->output_codage_caractere($competences_certificat)) . ";" . stripslashes($this->output_codage_caractere($decision_jury)) . ";" . referentiel_timestamp_date_special($date_decision) . ";{$ref_referentiel};{$verrou};{$valide};{$evaluation};{$synthese_certificat};";
         } elseif ($this->format_condense == 1) {
             $expout .= $this->certificat_pourcentage($competences_certificat, $this->ref_referentiel);
         } else {
             $expout .= stripslashes($this->output_codage_caractere($decision_jury)) . ";" . $this->certificat_items_binaire($competences_certificat, $this->ref_referentiel);
         }
         // PEDAGOGIES
         if ($this->export_pedagos) {
             // $expout .= "promotion;formation;pedagogie;composante;num_groupe;commentaire;date_cloture";
             $rec_pedago = referentiel_get_pedagogie_user($userid, $ref_referentiel);
             if ($rec_pedago) {
                 $expout .= stripslashes($this->output_codage_caractere($rec_pedago->promotion)) . ";" . stripslashes($this->output_codage_caractere($rec_pedago->formation)) . ";" . stripslashes($this->output_codage_caractere($rec_pedago->pedagogie)) . ";" . stripslashes($this->output_codage_caractere($rec_pedago->composante)) . ";" . stripslashes($this->output_codage_caractere($rec_pedago->num_groupe)) . ";" . stripslashes($this->output_codage_caractere($rec_pedago->commentaire)) . ";" . stripslashes($this->output_codage_caractere($rec_pedago->date_cloture));
             }
         }
         $expout .= "\n";
     }
     return $expout;
 }