예제 #1
0
 function presave_process($content)
 {
     // override method to allow us to add xhtml headers and footers
     global $CFG;
     global $USER;
     $xp = "#Moodle Referentiel CSV Export;latin1;" . referentiel_get_user_info($USER->id) . "\n";
     $xp .= $content;
     return $xp;
 }
예제 #2
0
                        $souscription_libre = 1;
                    }
                    if (isset($record_t->cle_souscription)) {
                        $cle_souscription = $record_t->cle_souscription;
                    } else {
                        $cle_souscription = '';
                    }
                    if (isset($record_t->tache_masquee)) {
                        $tache_masquee = $record_t->tache_masquee;
                    } else {
                        $tache_masquee = 0;
                    }
                    // DEBUG
                    // echo "<br/>DEBUG ::<br />\n";
                    // print_object($record_t);
                    $auteur_info = referentiel_get_user_info($auteurid);
                    // dates
                    $date_creation_info = userdate($date_creation);
                    $date_modif_info = userdate($date_modif);
                    // $date_debut_info=userdate($date_debut);
                    // $date_fin_info=userdate($date_fin);
                    $date_debut_info = $date_debut;
                    $date_fin_info = $date_fin;
                    // AFFICHER tache
                    ?>
<div align="center">
<h3><?php 
                    print_string('modifier_task', 'referentiel');
                    ?>
</h3>
<form name="form" method="post" action="<?php 
function referentiel_print_notification_user($instanceid, $courseid, $context, $t_codes_competence, $userid, $records_teacher)
{
    $s = "";
    $s_entete = "";
    $s_debut = "";
    $s_competences = "";
    if (!empty($records_teacher) && !empty($instanceid) && !empty($courseid) && !empty($userid) && !empty($t_codes_competence)) {
        $nb_lig = 0;
        $nb_col = 0;
        $maxcol = 8;
        // nombre max de colonnes par page : une colonne = un teacher
        $colwidth = (int) (100 / ($maxcol + 1)) . '%';
        // DEBUG
        //echo("TEACHERS<br />\n");
        //print_object($records_teacher);
        //echo("<br />\n");
        foreach ($records_teacher as $record_t) {
            // liste d'id teachers
            if ($record_t) {
                $t_teachers[] = $record_t->userid;
            }
        }
        $teachers_list = implode(',', $t_teachers);
        $nb_teachers = count($t_teachers);
        $nb_lig = $nb_teachers % $maxcol;
        // nombre de pages
        $identite_user = referentiel_get_user_info($userid);
        if ($identite_user) {
            $message = '<h3>' . get_string('liste_repartition', 'referentiel') . get_string('identite_utilisateur', 'referentiel', $identite_user) . '</h3>';
        } else {
            $message = '<h3>' . get_string('liste_repartition', 'referentiel') . '</h3>';
        }
        $t_teacherids_accompagnement = referentiel_get_accompagnements_user($instanceid, $courseid, $userid);
        // DEBUG
        /*
                        echo("print_lib_repartition.php :: 134 :: TEACHERS ACCOMPAGNATEURS pour $userid<br />\n");
                        print_object($t_teacherids_accompagnement);
                        echo("<br />\n");
                        // DEBUG
                        echo("codes <br />\n");
                        print_object($t_codes_competence);
                        echo("<br />\n");
        */
        $t_repartition_competences = referentiel_get_repartition_notification($instanceid, $courseid, $t_codes_competence, $t_teacherids_accompagnement, $records_teacher);
        /*
        // DEBUG
        echo("print_lib_repartition.php :: 122:: COMPETENCES<br />\n");
        print_object($t_repartition_competences);
        echo("<br />\n");
        */
        if ($t_repartition_competences) {
            // DEBUG
            /*
                        echo("print_lib_repartition.php :: 130 :: COMPETENCES<br />\n");
                        print_object($t_repartition_competences);
                        echo("<br />\n");
                        //exit;
            */
            $col = 0;
            $lig = 0;
            $s_debut .= '<div align="center">' . "\n";
            $s_debut .= $message . "\n";
            $s_debut .= '<table class="activite">' . "\n";
            // teachers
            $max_index = min($nb_teachers, $maxcol);
            $index_teacher_deb = 0;
            $index_teacher_fin = $max_index;
            $k = 0;
            $j = 0;
            $col = 0;
            while ($k < $nb_teachers) {
                if ($col == 0) {
                    $s_entete = "<tr valign='top'><th align='left' width='10%'>" . get_string('item', 'referentiel') . ' \\ ' . get_string('referent', 'referentiel') . "</th>\n";
                    for ($j = $index_teacher_deb; $j < $index_teacher_fin; $j++) {
                        $s_entete .= "<th width='" . $colwidth . "'>\n";
                        $s_entete .= "<b>" . referentiel_get_user_nom($t_teachers[$j]) . ' ' . referentiel_get_user_prenom($t_teachers[$j]) . "</b>\n";
                        $s_entete .= "</th>\n";
                    }
                    $s_entete .= "</tr>\n";
                    $s .= $s_entete;
                    $k += $max_index;
                }
                // competences
                $s_competences = "";
                foreach ($t_repartition_competences as $cle => $une_repartition) {
                    if ($une_repartition) {
                        // DEBUG
                        // echo("print_lib_repartition.php :: 173 :: CLE $cle <br />REPARTITION<br />\n");
                        // print_object($une_repartition);
                        // echo("<br />EXIT :: print_lib_repartition.php :: 188 \n");
                        // exit;
                        $s_competences .= "<tr valign='top'><td>\n";
                        $s_competences .= "<b>" . $cle . "</b>\n";
                        $s_competences .= "</td>";
                        while (list($key, $val) = each($une_repartition)) {
                            if ($index_teacher_deb <= $key && $key < $index_teacher_fin) {
                                $s_competences .= "<td>{$val}</td>";
                            }
                        }
                        $s_competences .= "</tr>\n";
                    }
                }
                $s .= $s_competences;
                // saut de table ?
                $col += $maxcol;
                if ($col == $max_index) {
                    $col = 0;
                    $index_teacher_deb += $max_index;
                    $max_index = min($nb_teachers - $index_teacher_fin, $maxcol);
                    $index_teacher_fin += $max_index;
                }
            }
        }
        $s = $s_debut . "\n" . $s . '</table>' . "\n";
        $s .= '</div>' . "\n";
    }
    return $s;
}
function referentiel_print_graph_certificats($referentiel_instance, $referentiel_referentiel, $gusers, $currentgroup = 0)
{
    global $DB;
    global $CFG;
    global $USER;
    // 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 5 :: print_lib_certificat.php :: You cannot call this script in that way');
    }
    $context = context_module::instance($cm->id);
    $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;
    $isguest = $roles->is_guest;
    // codes item
    $liste_codes = referentiel_purge_dernier_separateur($referentiel_referentiel->liste_codes_competence, '/');
    // empreintes
    $liste_empreintes = referentiel_purge_dernier_separateur($referentiel_referentiel->liste_empreintes_competence, '/');
    // poids
    $liste_poids = referentiel_purge_dernier_separateur($referentiel_referentiel->liste_poids_competence, '/');
    // cours ?
    if (!empty($course)) {
        $course_name = $course->shortname;
    } else {
        $course_name = "";
    }
    // groupes ?
    if (!empty($currentgroup)) {
        $group_name = groups_get_group_name($currentgroup);
    } else {
        $group_name = "";
    }
    $titre = get_string('certification_etat', 'referentiel');
    if (!empty($course_name)) {
        $titre .= ' (' . $course_name;
        if (!empty($group_name)) {
            $titre .= ' - ' . $group_name;
        }
        $titre .= ')';
    }
    $titre = str_replace(' ', '_', $titre);
    // utilisateurs
    $record_id_users = referentiel_get_students_course($course->id, 0, 0);
    //seulement les stagiaires
    // 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
        foreach ($record_id_users as $record_id) {
            // afficher la liste d'users
            // recupere les enregistrements de certificats ou les cree si necessaire
            $records_c[] = referentiel_certificat_user($record_id->userid, $referentiel_referentiel->id);
        }
        if ($records_c) {
            // Let's get the datas
            $separateur1 = '/';
            $separateur2 = ':';
            $separateur3 = '|';
            $t_user = array();
            // tableau des userid
            $t_code = explode($separateur1, $liste_codes);
            $t_empreinte = explode($separateur1, $liste_empreintes);
            $t_poids = explode($separateur1, $liste_poids);
            $moyennes = array();
            $t_valides = array(array());
            // $t_declarees = array(array());
            $user_name_souligne = "";
            foreach ($records_c as $record_c) {
                // pour tous les certificats
                if ($record_c) {
                    $certificat_id = $record_c->id;
                    $commentaire_certificat = stripslashes($record_c->commentaire_certificat);
                    $synthese_certificat = stripslashes($record_c->synthese_certificat);
                    $competences_certificat = $record_c->competences_certificat;
                    $competences_activites = $record_c->competences_activite;
                    $decision_jury = stripslashes($record_c->decision_jury);
                    $date_decision = $record_c->date_decision;
                    $ref_referentiel = $record_c->ref_referentiel;
                    $user_id = $record_c->userid;
                    $teacherid = $record_c->teacherid;
                    $verrou = $record_c->verrou;
                    $dossier_ferme = $record_c->valide;
                    $evaluation = $record_c->evaluation;
                    $user_name = referentiel_get_user_nom($user_id) . ' ' . referentiel_get_user_prenom($user_id);
                    $user_info = referentiel_get_user_info($user_id);
                    $teacher_info = referentiel_get_user_info($teacherid);
                    // dates
                    $date_decision_info = userdate($date_decision);
                    //$t_user[]=$user_name;
                    $t_user[] = $user_id;
                    // competences validees dans le certificat
                    $tc = array();
                    $lcc = referentiel_purge_dernier_separateur($competences_certificat, $separateur1);
                    if (!empty($lcc)) {
                        $tc = explode($separateur1, $lcc);
                        // A.1.1:1 A.1.2:1 A.1.3:1 A.1.4:0/A.1.5:0/A.2.1:1/A.2.2:0/A.2.3:0/A.3.1:0/A.3.2:0/A.3.3:0/A.3.4:0/B.1.1:0/B.1.2:0/B.1.3:0/B.2.1:1/B.2.2:1/B.2.3:0/B.2.4:0/B.3.1:0/B.3.2:0/B.3.3:0/B.3.4:0/B.3.5:0/B.4.1:0/B.4.2:0/B.4.3:0/
                        $i = 0;
                        while ($i < count($tc)) {
                            // CODE1:N1
                            // DEBUG
                            // echo "<br />".$tc[$i]." <br />\n";
                            if ($tc[$i] != '') {
                                $tcc = explode($separateur2, $tc[$i]);
                                // A.1.1 1
                                if (isset($tcc[1])) {
                                    // $t_valides[$userid][]=$tcc[1];
                                    //$t_valides[$user_name][]=min($tcc[1], $t_empreinte[$i]) ;
                                    $t_valides[$user_id][] = min($tcc[1], $t_empreinte[$i]);
                                }
                            }
                            $i++;
                        }
                    }
                    /*
                        // competences declarees dans les activites
                        $tc=array();
                        $lcd=referentiel_purge_dernier_separateur($competences_activites, $separateur1);
                        if (!empty($lcd)){
                            $tc = explode ($separateur1, $lcd);
                            // A.1.1:1 A.1.2:1 A.1.3:1 A.1.4:0/A.1.5:0/A.2.1:1/A.2.2:0/A.2.3:0/A.3.1:0/A.3.2:0/A.3.3:0/A.3.4:0/B.1.1:0/B.1.2:0/B.1.3:0/B.2.1:1/B.2.2:1/B.2.3:0/B.2.4:0/B.3.1:0/B.3.2:0/B.3.3:0/B.3.4:0/B.3.5:0/B.4.1:0/B.4.2:0/B.4.3:0/
                            $i=0;
                            while ($i<count($tc)){
                                // CODE1:N1
                                // DEBUG
                                // echo "<br />".$tc[$i]." <br />\n";
                                // exit;
                                if ($tc[$i]!=''){
                                    $tcc=explode($separateur2, $tc[$i]);
                                    // A.1.1 1
                                    if (isset($tcc[1])){
                    					                   $t_declarees[$user_name][]=$tcc[1];
                    				}
                    			                    }
                                $i++;
                            }
                        }
                    */
                }
            }
            // calculer la moyenne
            $n = 0;
            for ($i = 0; $i < count($t_user); $i++) {
                //$valeurs=$t_valides[$t_user[$i]];
                // moyenne
                $n++;
                $moyennes = referentiel_somme_valeur($moyennes, $t_valides[$t_user[$i]]);
            }
            $moyennes = referentiel_quotient_valeur($moyennes, $n);
            $lmoyennes = implode("/", $moyennes);
            // Distribuer les data sur plusieurs images
            // pagination
            $page0 = 0;
            $page1 = 0;
            $nbuser = count($t_user);
            $page = 0;
            $pagemax = min($nbuser, MAXLIGNEGRAPH);
            $npages = (int) ($nbuser / $pagemax);
            $reste = (int) ($nbuser % $pagemax);
            if ($reste) {
                $npages++;
            }
            /*
                    // DEBUG
                    echo "<br />DEBUG :: 1858 :: CODE<br />\n";
                    print_r($t_code);
                    echo "<br /> EMPREINTES<br />\n";
                    print_r($t_empreinte);
                    echo "<br /> POIDS<br />\n";
                    print_r($t_poids);
            
                    echo "<br />DEBUG :: 1858 :: USERS<br />\n";
                    print_r($t_user);
                    echo "<br />COMPETENCES VALIDES<br />\n";
                    for ($i=0; $i<$nbuser; $i++){
                        echo "<br />User:"******" <br />\n";
                        print_r($t_valides[$t_user[$i]]);
                    }
            */
            // echo "<br />NBUSER: $nbuser  NBPAGES: $npages  PAGEMAX: $pagemax\n";
            for ($page = 0; $page < $npages; $page++) {
                // preparer les donnees
                $t_data = array(array());
                $j = 0;
                for ($j = 0; $j < $pagemax; $j++) {
                    if (isset($t_user[$page * $pagemax + $j])) {
                        $user_name = referentiel_get_user_nom($t_user[$page * $pagemax + $j]) . ' ' . referentiel_get_user_prenom($t_user[$page * $pagemax + $j]);
                        $t_data[$user_name] = $t_valides[$t_user[$page * $pagemax + $j]];
                    }
                }
                // DEBUG
                //echo "<br />DEBUG :: 1876 :: DATA<br />\n";
                //print_r($t_data);
                //echo "<br />DEBUG :: 1885 :: DATA<br />\n";
                $ltdata = "";
                foreach ($t_data as $key => $data) {
                    if ($data) {
                        //echo "<br />$key<br />\n";
                        //print_r($data);
                        $ldata = implode("/", $data);
                        $ltdata .= "{$key}:{$ldata}|";
                    }
                }
                // Afficher
                //echo '<br />DATA -&gt;'.$ltdata."\n";
                $num_page = $page + 1;
                if ($isteacher || $istutor || $isadmin) {
                    $affichage_complet = 1;
                } else {
                    $affichage_complet = 0;
                }
                //echo "<br />AFFCOMPLET : $affichage_complet\n";
                //redirect ($CFG->wwwroot.'/mod/referentiel/graph_certificats.php?d='.$referentiel_instance->id.'&amp;ltdata='.$ltdata.'&amp;lmoyennes='.$lmoyennes.'&amp;lcode='.$liste_codes.'&amp;lempreinte='.$liste_empreintes.'&amp;lpoids='.$liste_poids.'&amp;affcomplet='.$affichage_complet.'&amp;titre='.$titre.'&amp;page='.$num_page.'&amp;npages='.$npages);
                echo '<div align="center"><img src="' . $CFG->wwwroot . '/mod/referentiel/graph_certificats.php?d=' . $referentiel_instance->id . '&amp;ltdata=' . $ltdata . '&amp;lmoyennes=' . $lmoyennes . '&amp;lcode=' . $liste_codes . '&amp;lempreinte=' . $liste_empreintes . '&amp;lpoids=' . $liste_poids . '&amp;affcomplet=' . $affichage_complet . '&amp;titre=' . $titre . '&amp;page=' . $num_page . '&amp;npages=' . $npages . '" border="0" title="' . get_string('statcertif', 'referentiel') . '" /></div>' . "\n";
                echo '<br />' . "\n";
            }
        }
    }
}
예제 #5
0
function referentiel_print_task_detail($record_t, $context, $detail = true, $numero = 0)
{
    $s = '';
    $s0 = '';
    $s1 = '';
    $s2 = '';
    $nblignes = 4;
    // hauteur du tableau
    if ($record_t) {
        $taskid = $record_t->id;
        $type_task = stripslashes($record_t->type_task);
        $description_task = stripslashes($record_t->description_task);
        $competences_task = $record_t->competences_task;
        $criteres_evaluation = stripslashes($record_t->criteres_evaluation);
        $ref_instance = $record_t->ref_instance;
        $ref_referentiel = $record_t->ref_referentiel;
        $ref_course = $record_t->ref_course;
        $auteurid = $record_t->auteurid;
        $date_creation = $record_t->date_creation;
        $date_modif = $record_t->date_modif;
        $date_debut = $record_t->date_debut;
        $date_fin = $record_t->date_fin;
        // Modalite souscription
        $souscription_libre = $record_t->souscription_libre;
        $cle_souscription = stripslashes($record_t->cle_souscription);
        $tache_masquee = $record_t->tache_masquee;
        $user_info = referentiel_get_user_info($auteurid);
        // dates
        $date_creation_info = userdate($date_creation);
        $date_modification_info = userdate($date_modif);
        $date_debut_info = userdate($date_debut);
        $date_fin_info = userdate($date_fin);
        // charger les consignes associees à la tache courante
        if (!empty($taskid)) {
            // AFFICHER LA LISTE DES consigneS
            $compteur_consigne = 0;
            $records_consigne = referentiel_get_consignes($taskid);
            if ($records_consigne) {
                // afficher
                // DEBUG
                // echo "<br/>DEBUG ::<br />\n";
                // print_r($records_consigne);
                $nbconsigne = count($records_consigne);
                $s1 .= '<!-- CONSIGNES -->
<div class="ref_affdoc">' . "\n";
                if ($nbconsigne > 1) {
                    $s1 .= '<span class="bold">' . get_string('consignes_associees', 'referentiel', $nbconsigne) . '</span>' . "\n";
                } else {
                    $s1 .= '<span class="bold">' . get_string('consigne_associee', 'referentiel', $nbconsigne) . '</span>' . "\n";
                }
                $s1 .= "\n";
                foreach ($records_consigne as $record_d) {
                    $consigne_id = $record_d->id;
                    $type_consigne = stripslashes($record_d->type_consigne);
                    $description_consigne = stripslashes($record_d->description_consigne);
                    $url_consigne = $record_d->url_consigne;
                    $ref_task = $record_d->ref_task;
                    if (isset($record_d->cible_consigne) && $record_d->cible_consigne == 1) {
                        $cible_consigne = '_blank';
                        // fenêtre cible
                    } else {
                        $cible_consigne = '';
                    }
                    if (isset($record_d->etiquette_consigne)) {
                        $etiquette_consigne = $record_d->etiquette_consigne;
                        // fenêtre cible
                    } else {
                        $etiquette_consigne = '';
                    }
                    // affichage de l'url
                    if (preg_match('/moddata\\/referentiel/', $url_consigne)) {
                        // l'URL doit être transformée
                        $data_r = new Object();
                        $data_r->id = $consigne_id;
                        $data_r->userid = $auteurid;
                        $data_r->author = referentiel_get_user_info($auteurid);
                        $data_r->url = $url_consigne;
                        $data_r->filearea = 'consigne';
                        $url_consigne = referentiel_m19_to_m2_file($data_r, $context, false, true);
                    }
                    $date_creation = userdate($record_d->timestamp);
                    if ($detail) {
                        $s2 .= '<span class="bold">' . get_string('consigne', 'referentiel') . '</span><i>' . $consigne_id . '</i>
<span class="bold">' . get_string('date_creation', 'referentiel') . '</span>
<i>' . $date_creation . '</i>
<span class="bold">' . get_string('type', 'referentiel') . '</span>
' . $type_consigne . '
<span class="bold">' . get_string('description', 'referentiel') . '</span><span class="white">
' . nl2br($description_consigne) . '</span>
<span class="bold">' . get_string('url', 'referentiel') . '</span>' . "\n";
                        $s2 .= referentiel_affiche_url($url_consigne, $etiquette_consigne, $cible_consigne);
                        $s2 .= '<br />' . "\n";
                    } else {
                        $s2 .= ' &nbsp; ' . referentiel_affiche_url($url_consigne, $etiquette_consigne, $cible_consigne);
                    }
                }
            }
        }
        $s0 .= '
<a name="task_' . $taskid . '"></a>' . "\n";
        // details
        if ($numero % 2 == 0) {
            $s0 .= '<div class="ref_affact1">';
        } else {
            $s0 .= '<div class="ref_affact2">';
        }
        $s0 .= '<span class="titre"><span class="bold">' . get_string('type_task', 'referentiel') . '</span>"' . $type_task . '"</span>' . "\n";
        $s0 .= '<br /><span class="bold">' . get_string('task', 'referentiel') . ' ' . get_string('numero', 'referentiel') . '</span>' . $taskid . ' <span class="bold">' . get_string('auteur', 'referentiel') . '</span>' . $user_info . "\n";
        $s0 .= '<br /><span class="bold">' . get_string('date_creation', 'referentiel') . '</span>
<span class="small">' . $date_creation_info . '</span>
<span class="bold">' . get_string('date_modification', 'referentiel') . '</span>
<span class="small">' . $date_modification_info . '</span>
<span class="bold">' . get_string('date_debut', 'referentiel') . '</span>
<span class="small">' . $date_debut_info . '</span>
<span class="bold">' . get_string('date_fin', 'referentiel') . '</span>
<span class="small">' . $date_fin_info . '</span>
<br />
<span class="bold">' . get_string('souscription', 'referentiel') . '</span> ' . "\n";
        // Modalite souscription
        if ($souscription_libre == 1) {
            $s0 .= get_string('libre', 'referentiel') . ' ';
        } else {
            if ($cle_souscription != '') {
                $s0 .= get_string('obtenir_cle_souscription', 'referentiel', $user_info) . ' ';
            } else {
                $s0 .= get_string('avec_cle', 'referentiel') . ' ';
            }
        }
        $s0 .= '<span class="bold">' . get_string('liste_codes_competence', 'referentiel') . '</span><span class="white">' . referentiel_affiche_liste_codes_competence('/', $competences_task, $ref_referentiel) . "\n";
        $s0 .= '</span><br /><span class="bold">' . get_string('description', 'referentiel') . '</span>' . "\n" . '<div class="ref_aff0">' . nl2br($description_task) . '</div></span><br /><span class="bold">' . get_string('criteres_evaluation', 'referentiel') . '</span>
<div class="ref_aff0">' . nl2br($criteres_evaluation) . '</div>' . "\n";
        // affichage
        if ($s1) {
            $s0 .= $s1;
            if ($s2) {
                $s0 .= $s2;
            }
            $s0 .= '</div>' . "\n";
        }
        echo $s0 . '</div>' . "\n";
    }
}
 function write_index()
 {
     // add xhtml headers and footers
     global $CFG;
     global $USER;
     // get css bit
     $css_lines = file("{$CFG->dirroot}/mod/referentiel/format/html/html.css");
     $css = implode(' ', $css_lines);
     $xp = "<html>\n";
     $xp .= "<head>\n";
     $xp .= "<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\" />\n";
     $xp .= "<meta author=\"" . referentiel_get_user_info($USER->id) . "\">\n";
     $xp .= "<title>" . get_string('archive_file', 'referentiel') . "</title>\n";
     $xp .= $css;
     $xp .= "</head>\n";
     $xp .= "<body>\n";
     $xp .= "<div id='dataDiv'><h1 align='center'>" . get_string('generatedby', 'referentiel') . "</h1>\n";
     $xp .= "<p align='center'>" . date("Y-m-d H:g:s") . "</p>\n";
     $xp .= "<div align='center'>\n";
     $xp .= $this->get_url_users() . "\n";
     $xp .= "</div>\n";
     $xp .= "</body>\n";
     $xp .= "</html>\n";
     return $xp;
 }
 function definition()
 {
     $mform =& $this->_form;
     $arguments = $this->_customdata;
     // arguments
     if (isset($arguments['options'])) {
         $options = $arguments['options'];
     } else {
         $option = NULL;
     }
     if (isset($arguments['context'])) {
         $this->context = $arguments['context'];
     } else {
         $this->context = NULL;
     }
     if (isset($arguments['userid'])) {
         $this->userid = $arguments['userid'];
     } else {
         $this->userid = 0;
     }
     if (isset($arguments['instanceid'])) {
         $this->instanceid = $arguments['instanceid'];
     } else {
         $this->instanceid = 0;
     }
     if (isset($arguments['occurrenceid'])) {
         $this->occurrenceid = $arguments['occurrenceid'];
     } else {
         $this->occurrenceid = 0;
     }
     if (isset($arguments['activite'])) {
         $this->activiteid = $arguments['activite'];
     } else {
         $this->activite = NULL;
     }
     if (!empty($this->activite)) {
         if (isset($this->activite->id)) {
             $activite_id = $this->activite->id;
         } else {
             $activite_id = 0;
         }
         if (isset($this->activite->type_activite)) {
             $type_activite = $this->activite->type_activite;
         } else {
             $type_activite = '';
         }
         if (isset($this->activite->description_activite)) {
             $description_activite = $this->activite->description_activite;
         } else {
             $description_activite = '';
         }
         if (isset($this->activite->competences_activite)) {
             $competences_activite = $this->activite->competences_activite;
         } else {
             $competences_activite = '';
             // referentiel_get_liste_codes_competence($this->occurrenceid);
         }
         $old_liste_competences = $competences_activite;
         if (isset($this->activite->commentaire_activite)) {
             $commentaire_activite = $this->activite->commentaire_activite;
         } else {
             $commentaire_activite = '';
         }
         if (isset($this->activite->userid)) {
             $userid = $this->activite->userid;
         } else {
             $userid = $this->userid;
         }
         if (isset($this->activite->teacherid)) {
             $teacherid = $this->activite->teacherid;
         } else {
             $teacherid = 0;
         }
         if (isset($this->activite->approved)) {
             $approved = $this->activite->approved;
         } else {
             $approved = 0;
         }
         if (isset($this->activite->ref_task)) {
             $ref_task = $this->activite->ref_task;
         } else {
             $ref_task = 0;
         }
     } else {
         $activite_id = 0;
         $type_activite = '';
         $description_activite = '';
         $competences_activite = '';
         // referentiel_get_liste_codes_competence($this->occurrenceid);
         $old_liste_competences = '';
         $commentaire_activite = '';
         $userid = $this->userid;
         $teacherid = 0;
         $approved = 0;
         $ref_task = 0;
     }
     if (isset($option->mode)) {
         $mode = $option->mode;
     } else {
         $mode = '';
     }
     if (isset($option->modulename)) {
         $modulename = $option->modulename;
     } else {
         $modulename = '';
     }
     if (isset($option->select_acc)) {
         $select_acc = $option->select_acc;
     } else {
         $select_acc = 0;
     }
     if (isset($option->data_filtre)) {
         $data_filtre = $option->data_filtre;
     } else {
         $data_filtre = NULL;
     }
     if (isset($arguments['action'])) {
         $action = $arguments['action'];
     } else {
         $action = 'addactivity';
     }
     // visible elements
     $mform->addElement('header', 'general', $arguments['msg']);
     $mform->addHelpButton('general', 'creer_activiteh', 'referentiel');
     // preparer les variables globales pour Overlib
     referentiel_initialise_data_referentiel($this->occurrenceid);
     if (has_capability('mod/referentiel:managecertif', $this->context)) {
         // enseignant
         $mform->addElement('html', '<p><i>' . get_string('creer_activite_teacher', 'referentiel') . '</i></p>' . "\n");
     }
     $jauge_activite_declarees = referentiel_print_jauge_activite($userid, $this->occurrenceid);
     if ($jauge_activite_declarees) {
         $jauge_activite_declarees = get_string('competences_declarees', 'referentiel', referentiel_get_user_info($userid)) . ' ' . $jauge_activite_declarees . "\n";
         $mform->addElement('html', '<div class="qheader">' . $jauge_activite_declarees . '</div>');
     }
     $mform->addElement('text', 'type_activite', get_string('type_activite', 'referentiel'), array('size' => '40'));
     $mform->setType('type_activite', PARAM_ALPHA);
     $mform->addRule('type_activite', get_string('missingtype', 'referentiel'), 'required', null, 'server');
     $mform->setDefault('type_activite', $type_activite);
     $mform->addElement('editor', 'description_activite', get_string('description', 'referentiel'));
     $mform->setType('description_activite', PARAM_TEXT);
     $mform->addRule('description_activite', get_string('missingdescription', 'referentiel'), 'required', null, 'server');
     $mform->setDefault('description_activite', $description_activite);
     //if (isteacher($this->userid)){
     if (has_capability('mod/referentiel:approve', $this->context)) {
         $mform->addElement('textarea', 'commentaire_activite', get_string('commentaire', 'referentiel'), 'wrap="virtual" cols="80" rows="5"');
         $mform->setType('commentaire_activite', PARAM_TEXT);
         $mform->setDefault('commentaire_activite', $commentaire_activite);
     } else {
         //echo get_string('commentaire','referentiel').': '.$commentaire_activite."\n";
         $mform->addElement('hidden', 'commentaire_activite', $commentaire_activite);
         $mform->setType('commentaire_activite', PARAM_TEXT);
     }
     // $saisie_competences=referentiel_modifier_selection_codes_item_hierarchique($this->occurrenceid, $competences_activite, $ref_task, $activite_id, '', 1);
     // $saisie_competences=referentiel_modifier_selection_codes_item_hierarchique($this->occurrenceid, '', $ref_task, $activite_id, '', 1);
     // Cette approche ne fonctionne pas
     // $mform->addElement('html', "\n".'<br /><div class="qheader">'.$saisie_competences.'</div><br />'."\n");
     $this->modifier_selection_codes_item_hierarchique($mform, $this->occurrenceid, '', $ref_task, $activite_id, '', 1);
     /*
     echo '<br />'."\n";
     referentiel_selection_liste_codes_item_hierarchique($this->occurrenceid);
     echo '<br />'."\n";
     */
     $radioarray = array();
     $radioarray[] = $mform->createElement('radio', 'depot_document', '', get_string('yes'), 1, NULL);
     $radioarray[] = $mform->createElement('radio', 'depot_document', '', get_string('no'), 0, NULL);
     $mform->addGroup($radioarray, 'depot_document', get_string('depot_document', 'referentiel'), array(' '), false);
     $mform->setDefault('depot_document', 0);
     //echo get_string('notification_activite','referentiel');
     $radioarray = array();
     $radioarray[] = $mform->createElement('radio', 'mailnow', '', get_string('yes'), 1, NULL);
     $radioarray[] = $mform->createElement('radio', 'mailnow', '', get_string('no'), 0, NULL);
     $mform->addGroup($radioarray, 'mailnow', get_string('notification_activite', 'referentiel'), array(' '), false);
     $mform->setDefault('mailnow', 0);
     // echo get_string('validation','referentiel').': '."\n";
     if (has_capability('mod/referentiel:approve', $this->context)) {
         $radioarray = array();
         $radioarray[] = $mform->createElement('radio', 'approved', '', get_string('yes'), 1, NULL);
         $radioarray[] = $mform->createElement('radio', 'approved', '', get_string('no'), 0, NULL);
         $mform->addGroup($radioarray, 'approved', get_string('approved', 'referentiel'), array(' '), false);
         $mform->setDefault('approved', $approved);
     } else {
         /*
         if ($approved){
             echo get_string('approved','referentiel');
         }
         else{
             echo get_string('not_approved','referentiel');
         }
         */
         $mform->addElement('hidden', 'approved', $approved);
         $mform->setType('approved', PARAM_INT);
     }
     /*
             //$mform->addElement('filemanager', 'newfile', get_string('uploadafile'));
             //$mform->addElement('filemanager', 'referentiel_file', get_string('uploadafile'), null, $arguments['options']);
     
             // pour une importation puis suppression
             $mform->addElement('filepicker', 'referentiel_file', get_string('uploadafile'), null, $arguments['options']);
     */
     // hidden params
     $mform->addElement('hidden', 'activite_id', $activite_id);
     $mform->setType('activite_id', PARAM_INT);
     $mform->addElement('hidden', 'ref_task', $ref_task);
     $mform->setType('ref_task', PARAM_INT);
     $mform->addElement('hidden', 'old_liste_competences', $old_liste_competences);
     $mform->setType('old_liste_competences', PARAM_TEXT);
     $mform->addElement('hidden', 'userid', $userid);
     $mform->setType('userid', PARAM_INT);
     $mform->addElement('hidden', 'teacherid', $teacherid);
     $mform->setType('teacherid', PARAM_INT);
     $mform->addElement('hidden', 'd', $this->instanceid);
     $mform->setType('d', PARAM_INT);
     $mform->addElement('hidden', 'contextid', $this->context->id);
     $mform->setType('contextid', PARAM_INT);
     $mform->addElement('hidden', 'ref_referentiel', $this->occurrenceid);
     $mform->setType('ref_referentiel', PARAM_INT);
     $mform->addElement('hidden', 'course', $this->courseid);
     $mform->setType('course', PARAM_INT);
     $mform->addElement('hidden', 'ref_instance', $this->instanceid);
     $mform->setType('ref_instance', PARAM_INT);
     $mform->addElement('hidden', 'instance', $this->instanceid);
     // ??? résidu d'ancienne version ??
     $mform->setType('instance', PARAM_INT);
     $mform->addElement('hidden', 'modulename', $modulename);
     $mform->setType('modulename', PARAM_TEXT);
     $mform->addElement('hidden', 'mode', $mode);
     $mform->setType('mode', PARAM_TEXT);
     $mform->addElement('hidden', 'sesskey', sesskey());
     $mform->setType('sesskey', PARAM_TEXT);
     // Ajout pour les filtres
     $mform->addElement('hidden', 'select_acc', $select_acc);
     $mform->setType('select_acc', PARAM_INT);
     if (!empty($data_filtre)) {
         $mform->addElement('hidden', 'filtre_auteur', $data_filtre->filtre_auteur);
         $mform->setType('filtre_auteur', PARAM_INT);
         $mform->addElement('hidden', 'filtre_validation', $data_filtre->filtre_validation);
         $mform->setType('filtre_validation', PARAM_INT);
         $mform->addElement('hidden', 'filtre_referent', $data_filtre->filtre_referent);
         $mform->setType('filtre_referent', PARAM_INT);
         $mform->addElement('hidden', 'filtre_date_modif', $data_filtre->filtre_date_modif);
         $mform->setType('filtre_date_modif', PARAM_INT);
         $mform->addElement('hidden', 'filtre_date_modif_student', $data_filtre->filtre_date_modif_student);
         $mform->setType('filtre_date_modif_student', PARAM_INT);
     }
     $mform->addElement('hidden', 'action', $action);
     $mform->setType('action', PARAM_ALPHA);
     // buttons
     $this->add_action_buttons(true);
 }
예제 #8
0
 function write_etudiant($record)
 {
     // initial string;
     $expout = "";
     // add comment
     //        $expout .= "\n\n<!-- etudiant: $record->id  -->\n";
     if ($record) {
         // add header
         //			$expout .= "<div class=\"referentiel\">\n";
         //    		$expout .= "<h4>Etudiant</h4>\n";
         //
         $expout .= "<ul>\n";
         //
         $id = trim($record->id);
         $userid = trim($record->userid);
         $ref_etablissement = trim($record->ref_etablissement);
         $num_etudiant = trim($record->num_etudiant);
         $ddn_etudiant = trim($record->ddn_etudiant);
         $lieu_naissance = trim($record->lieu_naissance);
         $departement_naissance = trim($record->departement_naissance);
         $adresse_etudiant = trim($record->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 . ")";
         }
         $expout .= " <li><b>" . get_string('id', 'referentiel') . "</b> : {$id}</li>\n";
         $expout .= " <li><b>" . get_string('userid', 'referentiel') . "</b> : {$userid}</li>\n";
         $expout .= " <li><b>" . get_string('nom_prenom', 'referentiel') . "</b> : " . referentiel_get_user_info($record->userid) . "</li>\n";
         $expout .= " <li><b>" . get_string('num_etudiant', 'referentiel') . "</b> : {$texte}</li>\n";
         $expout .= " <li><b>" . get_string('ddn_etudiant', 'referentiel') . "</b> : {$ddn_etudiant}</li>\n";
         $expout .= " <li><b>" . get_string('lieu_naissance', 'referentiel') . "</b> : {$lieu_naissance}</li>\n";
         $expout .= " <li><b>" . get_string('departement_naissance', 'referentiel') . "</b> : {$departement_naissance}</li>\n";
         $expout .= " <li><b>" . get_string('adresse_etudiant', 'referentiel') . "</b> : {$adresse_etudiant}</li>\n";
         $expout .= " <li><b>" . get_string('ref_etablissement', 'referentiel') . "</b> : {$ref_etablissement}</li>\n";
         /*
         // Etablissement
         $record_etablissement=referentiel_get_etablissement($record->ref_etablissement);
         	    	if ($record_etablissement){
         	$expout .= $this->write_etablissement( $record_etablissement );
         }
         */
         $expout .= " </ul>\n";
         //			$expout .= "</div>\n";
     }
     return $expout;
 }
예제 #9
0
<input type="submit" name="cancel" value="' . get_string("quit", "referentiel") . '" />
<br />' . "\n";
                foreach ($records_etudiant as $record) {
                    $etudiant_id = $record->id;
                    $num_etudiant = $record->num_etudiant;
                    $ddn_etudiant = $record->ddn_etudiant;
                    $lieu_naissance = $record->lieu_naissance;
                    $departement_naissance = $record->departement_naissance;
                    $adresse_etudiant = $record->adresse_etudiant;
                    $ref_etablissement = $record->ref_etablissement;
                    $userid = $record->userid;
                    $user_info = referentiel_get_user_info($record->userid);
                    // DEBUG
                    // echo "<br/>DEBUG ::<br />\n";
                    // print_object($record);
                    $user_info = referentiel_get_user_info($userid);
                    // AFFICHER etudiant
                    echo '<hr><h3 align="center">' . get_string('student', 'referentiel') . '</h3>
<input type="checkbox" name="tetudiant_id[]" id="tetudiant_id_' . $etudiant_id . '" value="' . $etudiant_id . '" />
<b>' . get_string('select_student', 'referentiel') . '</b>
<br />' . "\n";
                    echo '
<table cellpadding="5" width="80%">
<tr valign="top">
    <td align="right">
	<b>' . get_string('nom_prenom', 'referentiel') . ':</b>
	</td>
    <td align="left">' . $user_info . '</td>
</tr>

<tr valign="top">
         if ($user_nb_activities_displayed == 0) {
             // Afficher les predecesseurs sans activite avant d'afficher les declarations de celui-ci
             $s_no_activity = '';
             $k = $index_user - 1;
             // rechercher le successeur sans activite
             while ($k > 0 && $t_users_count[$k] == 0) {
                 $s_no_activity = '<div align="center" class="grise">' . referentiel_print_aucune_activite_user($t_users[$k]) . '</div>' . "\n" . $s_no_activity;
                 $k--;
             }
             if (!empty($s_no_activity)) {
                 echo $s_no_activity;
             }
         }
         $first_activity = 0;
     }
     echo '<div align="center">' . get_string('competences_declarees', 'referentiel', '<span class="bold">' . referentiel_get_user_info($record_a->userid) . '</span>') . "\n" . referentiel_print_jauge_activite($record_a->userid, $referentiel_referentiel->id) . '</div>' . "\n";
     if ($modeaff == 2) {
         //
         if ($index_user >= 0 && isset($t_users_count[$index_user]) && $t_users_count[$index_user] > 0) {
             // nb activites
             echo '<div align="center"><i>' . get_string('activitynumber', 'referentiel', $t_users_count[$index_user]) . '</i></div>' . "\n";
         }
     }
 }
 referentiel_print_activite_detail($bareme, $record_a, $context, $modeaff == 1);
 if ($record_a->ref_course == $course->id) {
     referentiel_menu_activite($cm, $context, $record_a->id, $record_a->userid, $referentiel->id, $record_a->approved, $selacc, $modeaff == 1, $mode);
     if (!$record_a->approved) {
         echo '<div align="center">' . referentiel_ajout_document($record_a, $mode, $selacc) . "</div>\n";
     }
 } else {
예제 #11
0
function referentiel_conversion_url_m19($delete = false, $verbose = false)
{
    // move all m19 links and data to m2.x links and files
    global $CFG;
    global $DB;
    // documents
    $params = array('urlm19' => '%/moddata/referentiel/%');
    $sql = "SELECT id, ref_activite, url_document FROM {referentiel_document} WHERE url_document LIKE :urlm19 ORDER BY ref_activite ";
    $recs_documents = $DB->get_records_sql($sql, $params);
    if (!empty($recs_documents)) {
        $activiteid = 0;
        foreach ($recs_documents as $doc) {
            if ($doc->ref_activite != $activiteid) {
                $activiteid = $doc->ref_activite;
                $activite = $DB->get_record('referentiel_activite', array('id' => $doc->ref_activite));
                $cm = get_coursemodule_from_instance('referentiel', $activite->ref_instance, $activite->ref_course);
                $context = context_module::instance($cm->id);
            }
            $data_r = new Object();
            $data_r->id = $doc->id;
            $data_r->userid = $activite->userid;
            $data_r->author = referentiel_get_user_info($activite->userid);
            $data_r->url = $doc->url_document;
            $data_r->filearea = 'document';
            $url_document = referentiel_m19_to_m2_file($data_r, $context, $verbose, $delete);
        }
    }
    // consignes
    $params = array('urlm19' => '%/moddata/referentiel/%');
    $sql = "SELECT id, ref_task, url_consigne FROM {referentiel_consigne} WHERE url_consigne LIKE :urlm19 ORDER BY ref_task ";
    $recs_consignes = $DB->get_records_sql($sql, $params);
    if (!empty($recs_consignes)) {
        $taskid = 0;
        foreach ($recs_consignes as $doc) {
            if ($doc->ref_task != $taskid) {
                $taskid = $doc->ref_task;
                $task = $DB->get_record('referentiel_task', array('id' => $doc->ref_task));
                $cm = get_coursemodule_from_instance('referentiel', $task->ref_instance, $task->ref_course);
                $context = context_module::instance($cm->id);
            }
            $data_r = new Object();
            $data_r->id = $doc->id;
            $data_r->userid = $task->auteurid;
            $data_r->author = referentiel_get_user_info($task->auteurid);
            $data_r->url = $doc->url_consigne;
            $data_r->filearea = 'consigne';
            $url_consigne = referentiel_m19_to_m2_file($data_r, $context, $verbose, $delete);
        }
    }
    //$CFG->referentiel_migration_19_2x=0;
    // pas de nouvelle conversion en principe...
}
function referentiel_print_etudiant_2($userid, $referentiel_id, $context, $appli)
{
    //	fusion de referentiel_print_etudiant($record) et de referentiel_menu_etudiant($context, $record->id, $referentiel_instance->id, $record->approved);
    global $CFG;
    global $USER;
    global $OUTPUT;
    $s = "";
    if ($userid) {
        $record = referentiel_get_etudiant_user($userid);
        if ($record) {
            $s .= '<tr bgcolor="white">';
            $s .= '<td>' . referentiel_get_user_login($userid);
            $s .= '</td><td>' . referentiel_get_user_info($record->userid);
            $s .= '</td><td>';
            if ($record->num_etudiant == 'l_inconnu') {
                $s .= get_string('l_inconnu', 'referentiel');
            } else {
                $s .= stripslashes($record->num_etudiant);
            }
            $s .= '</td><td>';
            if ($record->ddn_etudiant == 'l_inconnu') {
                $s .= get_string('l_inconnu', 'referentiel');
            } else {
                $s .= stripslashes($record->ddn_etudiant);
            }
            $s .= '</td><td>';
            if ($record->lieu_naissance == 'l_inconnu') {
                $s .= get_string('l_inconnu', 'referentiel');
            } else {
                $s .= stripslashes($record->lieu_naissance);
            }
            $s .= '</td><td>';
            if ($record->departement_naissance == 'l_inconnu') {
                $s .= get_string('l_inconnu', 'referentiel');
            } else {
                $s .= stripslashes($record->departement_naissance);
            }
            $s .= '</td><td>';
            if ($record->adresse_etudiant == 'l_inconnu') {
                $s .= get_string('l_inconnu', 'referentiel');
            } else {
                $s .= stripslashes($record->adresse_etudiant);
            }
            $s .= '</td><td>';
            $s .= referentiel_select_etablissement($record->userid, $record->ref_etablissement, $appli);
            $s .= '</td><td>';
            // menu
            if (has_capability('mod/referentiel:managecertif', $context) or $USER->id == $record->userid) {
                $s .= '&nbsp; <a href="' . $CFG->wwwroot . '/mod/referentiel/etudiant.php?d=' . $referentiel_id . '&amp;userid=' . $record->userid . '&amp;mode=updateetudiant&amp;sesskey=' . sesskey() . '"><img src="' . $OUTPUT->pix_url('/t/edit') . '" alt="' . get_string('edit') . '" title="' . get_string('edit') . '" /></a>' . "\n";
            }
            if (has_capability('mod/referentiel:managecertif', $context)) {
                $s .= '&nbsp; <a href="' . $CFG->wwwroot . '/mod/referentiel/etudiant.php?d=' . $referentiel_id . '&amp;userid=' . $record->userid . '&amp;mode=deleteetudiant&amp;sesskey=' . sesskey() . '"><img src="' . $OUTPUT->pix_url('/t/delete') . '" alt="' . get_string('delete') . '" title="' . get_string('delete') . '" /></a>' . "\n";
            }
            $s .= '</td></tr>' . "\n";
        }
    }
    return $s;
}
예제 #13
0
 /**
  * Turns referentiel instance into an xml segment
  * @param referentiel instanceobject
  * @return string xml segment
  */
 function write_certificat($record)
 {
     global $CFG;
     // initial string;
     $s1 = '';
     $s2 = '';
     $nbchamps = 0;
     $expout = "";
     // add comment and div tags
     if ($record) {
         // DEBUG
         // echo "<br />DEBUG LIGNE 1021<br />\n";
         // print_r($referentiel_instance);
         $id = trim($record->id);
         $commentaire_certificat = trim($record->commentaire_certificat);
         $synthese_certificat = trim($record->synthese_certificat);
         $competences_certificat = trim($record->competences_certificat);
         $competences_activite = trim($record->competences_activite);
         $decision_jury = trim($record->decision_jury);
         if ($record->date_decision) {
             $date_decision = userdate(trim($record->date_decision));
         } else {
             $date_decision = "";
         }
         $userid = trim($record->userid);
         $teacherid = trim($record->teacherid);
         if ($teacherid != 0) {
             $nom_prenom_teacher = referentiel_get_user_info($teacherid);
         } else {
             $nom_prenom_teacher = "";
         }
         $ref_referentiel = trim($record->ref_referentiel);
         $verrou = trim($record->verrou);
         $valide = trim($record->valide);
         $evaluation = trim($record->evaluation);
         $pourcentages = '';
         // calcul des pourcentages
         if ($this->certificat_sel_param->certificat_sel_certificat_pourcent) {
             if (isset($verrou) && $verrou != "") {
                 if ($verrou != 0) {
                     $bgcolor = 'verrouille';
                 } else {
                     $bgcolor = 'deverrouille';
                 }
             } else {
                 $bgcolor = 'deverrouille';
             }
             // Tableau
             $pourcentages = referentiel_retourne_certificat_consolide('/', ':', $competences_certificat, $ref_referentiel, ' class="' . $bgcolor . '"');
         }
         // 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) {
                 $s2 = '';
                 if ($this->certificat_sel_param->certificat_sel_decision_jury) {
                     $s2 .= "<th class='referentiel'>" . get_string('decision', 'referentiel') . "</th>\n";
                     $s2 .= "<th class='referentiel'>" . get_string('datedecision', 'referentiel') . "</th>\n";
                     $nbchamps += 2;
                 }
                 if ($this->certificat_sel_param->certificat_sel_certificat_referents) {
                     $s2 .= "<th class='referentiel'>" . get_string('valide_par', 'referentiel') . "</th>\n";
                     $nbchamps++;
                 }
                 if ($this->certificat_sel_param->certificat_sel_certificat_detail) {
                     $s2 .= "<th class='referentiel'>" . get_string('verrou', 'referentiel') . "</th>\n";
                     $s2 .= "<th class='referentiel'>" . get_string('evaluation', 'referentiel') . "</th>\n";
                     $nbchamps += 2;
                 }
                 if ($this->certificat_sel_param->certificat_sel_commentaire) {
                     $s2 .= "<th class='referentiel'>" . get_string('commentaire', 'referentiel') . "</th>\n";
                     $s2 .= "<th class='referentiel'>" . get_string('synthese', 'referentiel') . "</th>\n";
                     $nbchamps += 2;
                 }
                 if ($this->certificat_sel_param->certificat_sel_activite_competences) {
                     $s2 .= "<th class='referentiel'>" . get_string('competences_declare', 'referentiel') . "</th>\n";
                     $nbchamps++;
                 }
                 if ($this->certificat_sel_param->certificat_sel_certificat_competences) {
                     $s2 .= "<th class='referentiel'>" . get_string('competences_certificat', 'referentiel') . "</th>\n";
                     $nbchamps++;
                 }
                 $s1 .= "<!-- certification : {$record->id}  -->\n";
                 $s1 .= "<table class='referentiel'>\n";
                 $s1 .= $this->write_etudiant($record_etudiant, $nbchamps);
                 $s1 .= "<tr class='referentiel'><td class='referentiel' colspan='" . $nbchamps . "'><b>" . get_string('certificat', 'referentiel') . "</b></td></tr>\n";
                 $s1 .= "<tr class='referentiel'>\n</tr>\n";
                 $s1 .= $s2;
                 $s1 .= "</tr>\n";
                 $s2 = '';
                 if ($this->certificat_sel_param->certificat_sel_decision_jury) {
                     $s2 .= "<td class='referentiel'>{$decision_jury}</td>\n";
                     if ($date_decision != "") {
                         $s2 .= "<td class='referentiel'>{$date_decision}</td>\n";
                     } else {
                         $s2 .= "<td class='referentiel'>&nbsp;</td>\n";
                     }
                 }
                 if ($this->certificat_sel_param->certificat_sel_certificat_referents) {
                     $s2 .= "<td class='referentiel'>" . $nom_prenom_teacher . "</td>\n";
                 }
                 if ($this->certificat_sel_param->certificat_sel_certificat_detail) {
                     $s2 .= "<td class='referentiel'>{$verrou}</td>\n";
                     $s2 .= "<td class='referentiel'>{$evaluation}</td>\n";
                 }
                 if ($this->certificat_sel_param->certificat_sel_commentaire) {
                     $s2 .= "<td class='referentiel'>{$commentaire_certificat} &nbsp;</td>\n";
                     $s2 .= "<td class='referentiel'>{$synthese_certificat} &nbsp;</td>\n";
                 }
                 if ($this->certificat_sel_param->certificat_sel_activite_competences) {
                     $s2 .= "<td class='referentiel'>" . referentiel_affiche_competences_certificat('/', ':', $competences_activite, $this->liste_empreintes_competence) . "</td>\n";
                 }
                 if ($this->certificat_sel_param->certificat_sel_certificat_competences) {
                     $s2 .= "<td class='referentiel'>" . referentiel_affiche_competences_certificat('/', ':', $competences_certificat, $this->liste_empreintes_competence, false) . "</td>\n";
                 }
                 if ($this->certificat_sel_param->certificat_sel_certificat_competences && $this->certificat_sel_param->certificat_sel_certificat_detail) {
                     $s2 .= "</tr>\n<tr class='referentiel'>\n<th class='referentiel' colspan='" . $nbchamps . "'>\n" . get_string('certificat_sel_certificat_detail', 'referentiel') . "</th></tr>\n";
                     $s2 .= "<tr class='referentiel'>\n<td class='referentiel' colspan='" . $nbchamps . "'>\n<table class='referentiel'>\n";
                     $s2 .= '<tr valign="top"><th>' . get_string('code', 'referentiel') . '</th><th>' . get_string('approved', 'referentiel') . '</th><th colspan="3">' . get_string('description_item', 'referentiel') . '</th><th>' . get_string('p_item', 'referentiel') . '</th><th>' . get_string('e_item', 'referentiel') . '</th></tr>' . "\n";
                     $s2 .= referentiel_affiche_detail_competences('/', ':', $competences_certificat, $this->liste_empreintes_competence, $this->liste_poids_competence) . "</table>\n</td>\n";
                 }
                 if ($this->certificat_sel_param->certificat_sel_certificat_pourcent) {
                     $s2 .= "</tr>\n<tr class='referentiel'>\n<th class='referentiel' colspan='" . $nbchamps . "'>\n" . get_string('pourcentage', 'referentiel') . "</th></tr>\n";
                     $s2 .= "<tr class='referentiel'>\n<td class='referentiel' colspan='" . $nbchamps . "'>" . $pourcentages . "</td>\n";
                 }
                 $s1 .= "<tr class='referentiel'>\n";
                 $s1 .= $s2;
                 $s1 .= "</tr>\n";
                 $s1 .= "</table>\n\n";
                 $expout .= $s1;
             }
         }
     }
     return $expout;
 }
function referentiel_liste_activite($record_a, $classcolor)
{
    global $CFG;
    $s = "";
    if ($record_a) {
        $activite_id = $record_a->id;
        $type_activite = stripslashes($record_a->type_activite);
        $description_activite = stripslashes($record_a->description_activite);
        $competences_activite = $record_a->competences_activite;
        $commentaire_activite = stripslashes($record_a->commentaire_activite);
        $ref_instance = $record_a->ref_instance;
        $ref_referentiel = $record_a->ref_referentiel;
        $ref_course = $record_a->ref_course;
        $userid = $record_a->userid;
        $teacherid = $record_a->teacherid;
        $date_creation = $record_a->date_creation;
        $date_modif_student = $record_a->date_modif_student;
        $date_modif = $record_a->date_modif;
        $approved = $record_a->approved;
        $ref_task = $record_a->ref_task;
        $user_info = referentiel_get_user_info($userid);
        $teacher_info = referentiel_get_user_info($teacherid);
        // dates
        if ($date_creation != 0) {
            $date_creation_info = userdate($date_creation);
        } else {
            $date_creation_info = '';
        }
        if ($date_modif != 0) {
            $date_modif_info = userdate($date_modif);
        } else {
            $date_modif_info = '';
        }
        if ($date_modif_student == 0) {
            $date_modif_student = $date_creation;
        }
        if ($date_modif_student != 0) {
            $date_modif_student_info = userdate($date_modif_student);
        } else {
            $date_modif_student_info = '';
        }
        $s .= "\n" . '<div class="activite_' . $classcolor . '">';
        $s .= ' <a href="' . $CFG->wwwroot . '/mod/referentiel/activite.php?d=' . $ref_instance . '&activite_id=' . $activite_id . '">' . get_string('activite', 'referentiel') . ' ' . $activite_id . '</a>' . "\n";
        $s .= ' <b>' . $type_activite . '</b> ';
        $s .= '<br />' . get_string('auteur', 'referentiel') . ' <b>' . $user_info . '</b> ';
        // MODIF JF 2012/05/06
        $group_info = referentiel_liste_groupes_user($ref_course, $userid);
        if (!empty($group_info)) {
            $s .= ' (' . $group_info . ') ';
        }
        $s .= ' (<i>' . get_string('date_modif_student', 'referentiel') . ' ' . $date_modif_student_info . '</i>) ';
        if (!empty($competences_activite)) {
            $s .= '<br />';
            $s .= get_string('competences', 'referentiel') . ' ';
            $s .= ' ' . referentiel_affiche_liste_codes_competence('/', $competences_activite, $ref_referentiel);
        }
        if (!empty($description_activite)) {
            $s .= '<br />';
            $s .= get_string('description', 'referentiel') . '<i><span class="small">';
            if (strlen($description_activite) > 1024) {
                $s .= substr(nl2br($description_activite), 0, 1024) . '(...)';
            } else {
                $s .= nl2br($description_activite);
            }
            $s .= '</span></i> ';
        }
        $s .= '<br />';
        if ($teacher_info) {
            $s .= get_string('referent', 'referentiel') . ' <b>' . $teacher_info . '</b>';
        } else {
            $s .= '<span class="alerte">' . get_string('pasdereferent', 'referentiel') . '</span>';
        }
        if ($date_modif_info) {
            $s .= ' (<i>';
            $s .= get_string('date_modif', 'referentiel') . ' ' . $date_modif_info;
            $s .= '</i>) ';
        }
        if ($commentaire_activite) {
            $s .= '<br />';
            $s .= '<i><span class="small">';
            if (strlen($commentaire_activite) > 1024) {
                $s .= substr(nl2br($commentaire_activite), 0, 1024) . '(...)';
            } else {
                $s .= nl2br($commentaire_activite);
            }
            $s .= '</i></span>' . "\n";
        }
        $s .= '</div>' . "\n";
    }
    return $s;
}
예제 #15
0
 /**
  * Turns task into an xml segment
  * @param task object
  * @return string xml segment
  */
 function write_task($task)
 {
     global $CFG;
     // initial string;
     $expout = "";
     // add comment
     if ($task) {
         // DEBUG
         // echo "<br />\n";
         // print_r($task);
         $id = $task->id;
         $type_task = trim($task->type_task);
         $description_task = trim($task->description_task);
         $competences_task = trim($task->competences_task);
         $criteres_evaluation = trim($task->criteres_evaluation);
         $ref_instance = $task->ref_instance;
         $ref_referentiel = $task->ref_referentiel;
         $ref_course = $task->ref_course;
         $auteurid = trim($task->auteurid);
         $date_creation = $task->date_creation;
         $date_modif = $task->date_modif;
         $date_debut = $task->date_debut;
         $date_fin = $task->date_fin;
         $expout .= "\n\n<!-- task: {$task->id}  -->\n";
         $expout .= "<table class='competence'>\n";
         $expout .= "<tr>\n";
         $expout .= "    <th class=\"competence\"><b>" . get_string('id', 'referentiel') . "</b></th>\n";
         $expout .= "    <th class=\"competence\"><b>" . get_string('type_task', 'referentiel') . "</b></th>\n";
         $expout .= "    <th class=\"competence\"><b>" . get_string('description', 'referentiel') . "</b></th>\n";
         $expout .= "    <th class=\"competence\"><b>" . get_string('competences', 'referentiel') . "</b></th>\n";
         $expout .= "    <th class=\"competence\"><b>" . get_string('criteres_evaluation', 'referentiel') . "</b></th>\n";
         // $expout .= "    <th class=\"competence\"><b>".get_string('instance','referentiel')."</b></th>\n";
         // $expout .= "    <th class=\"competence\"><b>".get_string('referentiel','referentiel')."</b></th>\n";
         $expout .= "    <th class=\"competence\"><b>" . get_string('course') . "</b></th>\n";
         $expout .= "    <th class=\"competence\"><b>" . get_string('auteur', 'referentiel') . "</b></th>\n";
         $expout .= "    <th class=\"competence\"><b>" . get_string('date_creation', 'referentiel') . "</b></th>\n";
         $expout .= "    <th class=\"competence\"><b>" . get_string('date_modif', 'referentiel') . "</b></th>\n";
         $expout .= "    <th class=\"competence\"><b>" . get_string('date_debut', 'referentiel') . "</b></th>\n";
         $expout .= "    <th class=\"competence\"><b>" . get_string('date_fin', 'referentiel') . "</b></th>\n";
         $expout .= "</tr>\n";
         $expout .= "<tr>\n";
         $expout .= "<td class=\"competence\"> {$id}</td>\n";
         $expout .= "<td class=\"competence\"> {$type_task}</td>\n";
         $expout .= "<td class=\"competence\"> {$description_task}</td>\n";
         $expout .= "<td class=\"competence\"> {$competences_task}</td>\n";
         $expout .= "<td class=\"competence\"> {$criteres_evaluation}</td>\n";
         /*
                     $expout .= "<td class=\"competence\"> $ref_instance</td>\n";
                     $expout .= "<td class=\"competence\"> $ref_referentiel</td>\n";
         */
         $expout .= "<td class=\"competence\">" . referentiel_get_course_link($ref_course, true) . "</td>\n";
         $expout .= "<td class=\"competence\">" . referentiel_get_user_info($auteurid) . "</td>\n";
         $expout .= "<td class=\"competence\">" . date("Y-m-d H:i:s", $date_creation) . "</td>\n";
         $expout .= "<td class=\"competence\">" . date("Y-m-d H:i:s", $date_modif) . "</td>\n";
         $expout .= "<td class=\"competence\">" . date("Y-m-d H:i:s", $date_debut) . "</td>\n";
         $expout .= "<td class=\"competence\">" . date("Y-m-d H:i:s", $date_fin) . "</td>\n";
         $expout .= "</tr>\n";
         $expout .= "</table>\n";
         // consigneS
         $records_consignes = referentiel_get_consignes($task->id);
         if ($records_consignes) {
             // DEBUG
             // echo "<br/>DEBUG :: ITEMS <br />\n";
             // print_r($records_consignes);
             $expout .= "<table class='item'>\n";
             $expout .= "   <tr>\n";
             $expout .= "     <th class=\"item\"><b>" . get_string('type_consigne', 'referentiel') . "</b></th>\n";
             $expout .= "     <th class=\"item\"><b>" . get_string('description', 'referentiel') . "</b></th>\n";
             $expout .= "     <th class=\"item\"><b>" . get_string('url', 'referentiel') . "</b></th>\n";
             $expout .= "     <th class=\"item\"><b>" . get_string('task', 'referentiel') . "</b></th>\n";
             $expout .= "   </tr>\n";
             foreach ($records_consignes as $record_d) {
                 $expout .= $this->write_consigne($record_d);
             }
             $expout .= "</table>\n";
         }
     }
     return $expout;
 }
예제 #16
0
 /**
  * Turns referentiel instance into an xml segment
  * @param referentiel instanceobject
  * @return string xml segment
  */
 function write_certificat($record)
 {
     global $CFG;
     // initial string;
     $s1 = '';
     $s2 = '';
     $s3 = '';
     $nbchamps = 0;
     $expout = "";
     // add comment and div tags
     if ($record) {
         // DEBUG
         // echo "<br />DEBUG LIGNE 1021<br />\n";
         // print_r($referentiel_instance);
         $id = trim($record->id);
         $commentaire_certificat = trim($record->commentaire_certificat);
         $synthese_certificat = trim($record->synthese_certificat);
         $competences_certificat = trim($record->competences_certificat);
         $competences_activite = trim($record->competences_activite);
         $decision_jury = trim($record->decision_jury);
         if ($record->date_decision) {
             $date_decision = userdate(trim($record->date_decision));
         } else {
             $date_decision = "";
         }
         $userid = trim($record->userid);
         $teacherid = trim($record->teacherid);
         if ($teacherid != 0) {
             $nom_prenom_teacher = referentiel_get_user_info($teacherid);
         } else {
             $nom_prenom_teacher = "";
         }
         $ref_referentiel = trim($record->ref_referentiel);
         $verrou = trim($record->verrou);
         $valide = trim($record->valide);
         $evaluation = trim($record->evaluation);
         $pourcentages = '';
         // calcul des pourcentages
         if ($this->certificat_sel_param->certificat_sel_certificat_pourcent) {
             if (isset($verrou) && $verrou != "") {
                 if ($verrou != 0) {
                     $bgcolor = 'verrouille';
                 } else {
                     $bgcolor = 'deverrouille';
                 }
             } else {
                 $bgcolor = 'deverrouille';
             }
             // ligne des certificat
             $pourcentages = $this->affiche_certificat_consolide('/', ':', $competences_certificat, $ref_referentiel, ' class="' . $bgcolor . '"');
         }
         // 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) {
                 // ligne de presentation des champs etudiant
                 $s3 = '';
                 $s3 .= $this->output_codage_caractere(trim($this->purge_sep(stripslashes('#' . get_string('etudiant', 'referentiel'))))) . ";\n";
                 $s3 .= "#id;";
                 if ($this->certificat_sel_param->certificat_sel_etudiant_nom_prenom) {
                     $s3 .= $this->output_codage_caractere(trim($this->purge_sep(stripslashes(get_string('lastname'))) . ";" . $this->purge_sep(stripslashes(get_string('firstname'))))) . ";";
                 }
                 if ($this->certificat_sel_param->certificat_sel_etudiant_numero) {
                     $s3 .= $this->output_codage_caractere(trim($this->purge_sep(stripslashes(get_string('num_etudiant', 'referentiel'))))) . ";";
                 }
                 if ($this->certificat_sel_param->certificat_sel_etudiant_ddn) {
                     $s3 .= $this->output_codage_caractere(trim($this->purge_sep(stripslashes(get_string('ddn_etudiant', 'referentiel'))))) . ";";
                 }
                 if ($this->certificat_sel_param->certificat_sel_etudiant_lieu_naissance) {
                     $s3 .= $this->output_codage_caractere(trim($this->purge_sep(stripslashes(get_string('lieu_naissance', 'referentiel'))))) . ";";
                     $s3 .= $this->output_codage_caractere(trim($this->purge_sep(stripslashes(get_string('departement_naissance', 'referentiel'))))) . ";";
                 }
                 if ($this->certificat_sel_param->certificat_sel_etudiant_adresse) {
                     $s3 .= $this->output_codage_caractere(trim($this->purge_sep(stripslashes(get_string('adresse_etudiant', 'referentiel'))))) . ";";
                 }
                 $s3 .= "\n";
                 $s1 .= $s3;
                 // fin ligne presentation
                 $s1 .= $this->write_etudiant($record_etudiant, $nbchamps);
                 $s1 .= $this->output_codage_caractere(trim($this->purge_sep(stripslashes('#' . get_string('certificat', 'referentiel'))))) . ";\n";
                 $s2 = '';
                 if ($this->certificat_sel_param->certificat_sel_decision_jury) {
                     $s2 .= $this->output_codage_caractere(trim($this->purge_sep('#' . get_string('decision', 'referentiel')))) . ";";
                     $s2 .= $this->output_codage_caractere(trim($this->purge_sep(get_string('datedecision', 'referentiel')))) . ";";
                     $s2 .= "\n";
                     $s2 .= $this->output_codage_caractere(trim($this->purge_sep(stripslashes($decision_jury)))) . ";";
                     if ($date_decision != "") {
                         $s2 .= $this->output_codage_caractere(trim($this->purge_sep(stripslashes($date_decision)))) . ";";
                     } else {
                         $s2 .= ";";
                     }
                     $s2 .= "\n";
                 }
                 if ($this->certificat_sel_param->certificat_sel_certificat_referents) {
                     $s2 .= $this->output_codage_caractere(trim($this->purge_sep('#' . get_string('valide_par', 'referentiel')))) . ";";
                     $s2 .= $this->output_codage_caractere(trim($this->purge_sep(stripslashes($nom_prenom_teacher)))) . ";\n";
                 }
                 if ($this->certificat_sel_param->certificat_sel_certificat_detail) {
                     $s2 .= $this->output_codage_caractere(trim($this->purge_sep('#' . get_string('verrou', 'referentiel')))) . ";";
                     $s2 .= $verrou . ";";
                     $s2 .= $this->output_codage_caractere(trim($this->purge_sep(get_string('evaluation', 'referentiel')))) . ";";
                     $s2 .= $evaluation . ";";
                     $s2 .= "\n";
                 }
                 if ($this->certificat_sel_param->certificat_sel_commentaire) {
                     $s2 .= $this->output_codage_caractere(trim($this->purge_sep('#' . get_string('commentaire', 'referentiel')))) . ";\n";
                     $s2 .= $this->output_codage_caractere(trim($this->purge_sep(stripslashes($commentaire_certificat)))) . ";\n";
                     $s2 .= $this->output_codage_caractere(trim($this->purge_sep('#' . get_string('synthese_certificat', 'referentiel')))) . ";\n";
                     $s2 .= $this->output_codage_caractere(trim($this->purge_sep(stripslashes($synthese_certificat)))) . ";\n";
                 }
                 if ($this->certificat_sel_param->certificat_sel_activite_competences) {
                     $s2 .= $this->output_codage_caractere(trim($this->purge_sep('#' . get_string('competences_declare', 'referentiel')))) . ";\n";
                     $s2 .= $this->output_codage_caractere($this->affiche_competences_certificat('/', ':', $competences_activite, $this->liste_empreintes_competence, true)) . ";\n";
                 }
                 if ($this->certificat_sel_param->certificat_sel_certificat_competences) {
                     $s2 .= $this->output_codage_caractere(trim($this->purge_sep('#' . get_string('competences_certificat', 'referentiel')))) . ";\n";
                     $s2 .= $this->output_codage_caractere($this->affiche_competences_certificat('/', ':', $competences_certificat, $this->liste_empreintes_competence, true)) . ";\n";
                 }
                 if ($this->certificat_sel_param->certificat_sel_certificat_competences && $this->certificat_sel_param->certificat_sel_certificat_detail) {
                     $s2 .= "\n#" . $this->output_codage_caractere(trim($this->purge_sep(stripslashes(get_string('certificat_sel_certificat_detail', 'referentiel'))))) . ";\n";
                     $s2 .= "#" . $this->output_codage_caractere(trim($this->purge_sep(stripslashes(get_string('code', 'referentiel'))))) . ';' . $this->output_codage_caractere(trim($this->purge_sep(stripslashes(get_string('approved', 'referentiel'))))) . ';' . $this->output_codage_caractere(trim($this->purge_sep(stripslashes(get_string('description_item', 'referentiel'))))) . ';' . $this->output_codage_caractere(trim($this->purge_sep(stripslashes(get_string('p_item', 'referentiel'))))) . ';' . $this->output_codage_caractere(trim($this->purge_sep(stripslashes(get_string('e_item', 'referentiel'))))) . ';' . "\n";
                     $s2 .= $this->output_codage_caractere($this->affiche_detail_competences('/', ':', $competences_certificat, $this->liste_empreintes_competence, $this->liste_poids_competence)) . ";\n";
                 }
                 if ($this->certificat_sel_param->certificat_sel_certificat_pourcent) {
                     $s2 .= "\n#" . $this->output_codage_caractere(trim($this->purge_sep(stripslashes(get_string('pourcentage', 'referentiel'))))) . ";\n";
                     $s2 .= $pourcentages . ";\n";
                 }
                 $s1 .= $s2;
                 $s1 .= "\n\n";
                 $expout .= $s1;
             }
         }
     }
     return $expout;
 }
예제 #17
0
function referentiel_print_association($record_pedago, $context, $userid, $refid, $refrefid)
{
    if ($record_pedago) {
        $username = '';
        $user_info = '';
        if ($userid) {
            $username = referentiel_get_user_login($userid);
            $user_info = referentiel_get_user_info($userid);
        }
        // dates
        $date_cloture = $record_pedago->date_cloture;
        ?>

<a name="<?php 
        echo "pedago_{$record_pedago->id}";
        ?>
"></a>

<tr valign="top">
    <td align="left">
		<?php 
        p($username);
        ?>
    </td>
    <td align="left">
		<?php 
        p($user_info);
        ?>
    </td>
    <td align="left">
		<?php 
        echo $date_cloture;
        ?>
    </td>		
    <td align="left">
		<?php 
        echo $record_pedago->promotion;
        ?>
    </td>		
    <td align="left">
		<?php 
        echo stripslashes($record_pedago->formation);
        ?>
    </td>		
    <td align="left">
		<?php 
        echo stripslashes($record_pedago->pedagogie);
        ?>
    </td>		
    <td align="left">
		<?php 
        echo stripslashes($record_pedago->composante);
        ?>
    </td>
    <td align="left">
		<?php 
        echo stripslashes($record_pedago->num_groupe);
        ?>
    </td>

<?php 
        if (has_capability('mod/referentiel:managecertif', $context)) {
            echo '<td align="left">';
            echo referentiel_menu_association($context, $refid, $userid);
            echo '</td>' . "\n";
        }
        ?>
    </tr>
<?php 
    }
}
/** Affiche le nombre d'activites de l'utilisateur
 *
 *  input @param record_a  an object
 *  numero integer
 *  output string                                                     *
**/
function referentiel_print_bilan_activite_user($record_a, $courseid)
{
    $s = '';
    if ($record_a) {
        $userid = $record_a->userid;
        $activitynumber = $record_a->activitynumber;
        $user_info = referentiel_get_user_info($userid);
        $liste_groupes = referentiel_liste_groupes_user($courseid, $userid);
        // Affichage
        $s .= '<a name="userid_' . $userid . '"></a>' . "\n";
        if ($activitynumber > 0) {
            $s .= '<div align="center">';
            $s .= $user_info;
            if (!empty($liste_groupes)) {
                $s .= ' &nbsp; <i>' . $liste_groupes . '</i>' . "\n";
            }
            $s .= ' &nbsp; (<span class="light">' . get_string('activitynumber', 'referentiel') . '</span> <span class="ital">' . $activitynumber . '</span>)' . "\n";
            $s .= '<br /><br />' . "\n";
        } else {
            $date_modif_info = userdate(time());
            $s .= '<div class="error">';
            $s .= get_string('zero_activite', 'referentiel', $date_modif_info) . ' ' . $user_info . "\n";
        }
        $s .= '</div>' . "\n";
    }
    return $s;
}
예제 #19
0
function referentiel_get_manage_archives($contextid, $titre, $appli, $userid_filtre = 0, $instanceid = 0, $ok_portfolio = false, $report = false, $export_format = '')
{
    // retourne la liste des liens vers des fichiers stockes dans le filearea
    // propose la suppression
    global $CFG;
    global $OUTPUT;
    // Archives older than REFERENTIEL_ARCHIVE_OBSOLETE days will be deleted.
    $delai_destruction = REFERENTIEL_ARCHIVE_OBSOLETE * 24 * 3600;
    $date_obsolete = time() - $delai_destruction;
    $msg = get_string('archive_deleted', 'referentiel', date("Y-m-d H:i:s.", $date_obsolete));
    $s = '';
    $total_size = 0;
    $nfile = 0;
    // fileareas autorisees
    $filearea = 'archive';
    $strauthor = get_string('auteur', 'referentiel');
    $strfilename = get_string('filename', 'referentiel');
    $strfilesize = get_string('filesize', 'referentiel');
    $strtimecreated = get_string('timecreated', 'referentiel');
    $strtimemodified = get_string('timemodified', 'referentiel');
    $strmimetype = get_string('mimetype', 'referentiel');
    $strmenu = get_string('delete');
    $strportfolio = get_string('publishporttfolio', 'referentiel');
    $strurl = get_string('url');
    // publication via potfolio
    if ($ok_portfolio) {
        require_once $CFG->libdir . '/portfoliolib.php';
    }
    $fs = get_file_storage();
    if ($files = $fs->get_area_files($contextid, 'mod_referentiel', $filearea, 0, "timemodified", false)) {
        $table = new html_table();
        if ($ok_portfolio) {
            $table->head = array($strauthor, $strfilename, $strfilesize, $strtimecreated, $strtimemodified, $strmimetype, $strmenu, $strportfolio);
            $table->align = array("right", "center", "left", "left", "left", "center", "center", "center");
        } else {
            $table->head = array($strauthor, $strfilename, $strfilesize, $strtimecreated, $strtimemodified, $strmimetype, $strmenu);
            $table->align = array("right", "center", "left", "left", "left", "center", "center");
        }
        $ok = false;
        //drapeau d'affichage
        foreach ($files as $file) {
            // print_object($file);
            $filesize = $file->get_filesize();
            $filename = $file->get_filename();
            $mimetype = $file->get_mimetype();
            $filepath = $file->get_filepath();
            $iconimage = '<img src="' . $OUTPUT->pix_url(file_mimetype_icon($mimetype)) . '" class="icon" alt="' . $mimetype . '" />';
            $userid = 0;
            $author = '';
            $parts = explode('/', $filepath);
            if (is_array($parts)) {
                $refrefid = $parts[1];
                if (isset($parts[2])) {
                    $userid = trim($parts[2]);
                    // echo "<br />USER:$userid\n";
                    $author = '#' . $userid . ' ' . referentiel_get_user_info($userid);
                }
            }
            $fullpath = '/' . $contextid . '/mod_referentiel/' . $filearea . '/' . '0' . $filepath . $filename;
            // echo "<br />FULPATH :: $fullpath \n";
            $timecreated = userdate($file->get_timecreated(), "%Y/%m/%d-%H:%M", 99, false);
            $timemodified = userdate($file->get_timemodified(), "%Y/%m/%d-%H:%M", 99, false);
            $link = new moodle_url($CFG->wwwroot . '/pluginfile.php' . $fullpath);
            $url = ' <a href="' . $link . '" target="_blank">' . $iconimage . $filename . '</a><br />' . "\n";
            $delete_link = '<input type="checkbox" name="deletefile[]"  value="' . $fullpath . '" />' . "\n";
            if ($userid && ($userid_filtre == 0 || $userid == $userid_filtre)) {
                // afficher ce fichier
                $ok = true;
                $output_button = '';
                // Publish button
                if ($ok_portfolio) {
                    $params = array('instanceid' => $instanceid, 'attachment' => $file->get_id(), 'report' => $report, 'export_format' => $export_format);
                    // DEBUG
                    /*
                    echo "<br />DEBUG :: lib_archive.php :: 585 :: PARAM PORTFOLIO<br />\n";
                    print_object($params);
                    echo "<br />\n";
                    // exit;
                    */
                    $button = new portfolio_add_button();
                    // Version anterieure à Moodle 2.4
                    //                    $button->set_callback_options('referentiel_portfolio_caller',
                    //                        $params, '/mod/referentiel/portfolio/mahara/locallib_portfolio.php');
                    // Version Moodle 2.4
                    $button->set_callback_options('referentiel_portfolio_caller', $params, 'mod_referentiel');
                    $button->set_format_by_file($file);
                    // $button->set_formats(array(PORTFOLIO_FORMAT_FILE));
                    // $output_button = "<a href=\"$path\">$iconimage</a> ";
                    $output_button .= $button->to_html(PORTFOLIO_ADD_ICON_LINK);
                    $table->data[] = array($author, $url, display_size($filesize), $timecreated, $timemodified, $mimetype, $delete_link, $output_button);
                } else {
                    $table->data[] = array($author, $url, display_size($filesize), $timecreated, $timemodified, $mimetype, $delete_link);
                }
                $total_size += $filesize;
                $nfile++;
            }
        }
        if ($ok) {
            if ($ok_portfolio) {
                $table->data[] = array('', get_string('nbfile', 'referentiel', $nfile), get_string('totalsize', 'referentiel', display_size($total_size)), '', '', '', '');
            } else {
                $table->data[] = array('', get_string('nbfile', 'referentiel', $nfile), get_string('totalsize', 'referentiel', display_size($total_size)), '', '');
            }
            echo $OUTPUT->box_start('generalbox  boxaligncenter');
            echo '<div align="center">' . "\n";
            echo '<h3>' . $titre . '</h3>' . "\n";
            // message d'information
            echo '<p><i>' . $msg . '</i></p>' . "\n";
            echo '<form method="post" action="' . $appli . '">' . "\n";
            echo "\n" . '<input type="hidden" name="sesskey" value="' . sesskey() . '" />' . "\n";
            echo '<div align="center">' . "\n";
            echo '<input type="button" name="select_all_archive" id="select_tous_enseignants" value="' . get_string('select_all', 'referentiel') . '"  onClick="return checkall()" />' . "\n";
            //        echo '&nbsp; &nbsp; &nbsp; <input type="button" name="select_not_any_archive" id="select_aucun_enseignant" value="'.get_string('select_not_any', 'referentiel').'"  onClick="return uncheckall()" />'."\n";
            //        echo '<input type="reset" value="'.get_string('corriger', 'referentiel').'" />'."\n";
            echo '&nbsp; <input type="reset" value="' . get_string('select_not_any', 'referentiel') . '" />' . "\n";
            echo '&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;';
            echo '<input type="submit" name="save" value="' . get_string('deletefile', 'referentiel') . '" />' . "\n";
            echo '<input type="submit" name="cancel" value="' . get_string('quit', 'referentiel') . '" />' . "\n";
            echo '</div>' . "\n";
            echo html_writer::table($table);
            echo '<div align="center">' . "\n";
            echo '<input type="button" name="select_all_archive" id="select_tous_enseignants" value="' . get_string('select_all', 'referentiel') . '"  onClick="return checkall()" />' . "\n";
            //        echo '&nbsp; &nbsp; &nbsp; <input type="button" name="select_not_any_archive" id="select_aucun_enseignant" value="'.get_string('select_not_any', 'referentiel').'"  onClick="return uncheckall()" />'."\n";
            //        echo '<input type="reset" value="'.get_string('corriger', 'referentiel').'" />'."\n";
            echo '&nbsp;  <input type="reset" value="' . get_string('select_not_any', 'referentiel') . '" />' . "\n";
            echo '&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;';
            echo '<input type="submit" name="save" value="' . get_string('deletefile', 'referentiel') . '" />' . "\n";
            echo '<input type="submit" name="cancel" value="' . get_string('quit', 'referentiel') . '" />' . "\n";
            echo '</div>' . "\n";
            echo '</form>' . "\n";
            echo '</div>' . "\n";
            echo $OUTPUT->box_end();
        }
    }
}
예제 #20
0
 /**
  * this is a very cut down version of what is in referentiel_certificat print_lib
  *
  * @global object
  * @return string
  */
 private function prepare_certificat()
 {
     global $DB;
     $output = '';
     if (!empty($this->certificat)) {
         $fullname = '';
         $fullnameteacher = get_string('l_inconnu', 'referentiel');
         if (!empty($this->certificat->userid)) {
             $user = $DB->get_record('user', array('id' => $this->certificat->userid));
             if ($user) {
                 $fullname = fullname($user, true);
                 $login = $user->username;
             }
         }
         if (!empty($this->certificat->teacherid)) {
             $teacher = $DB->get_record('user', array('id' => $this->certificat->teacherid));
             if ($teacher) {
                 $fullnameteacher = fullname($teacher, true);
             }
         }
         $by = new stdClass();
         $by->name = $fullnameteacher;
         $by->date = date("Y-m-d H:i:s");
         $liste_empreintes = referentiel_purge_dernier_separateur(referentiel_get_liste_empreintes_competence($this->certificat->ref_referentiel), '/');
         $liste_description_competences_poids = referentiel_purge_dernier_separateur(referentiel_get_liste_poids($this->certificat->ref_referentiel), '|');
         // $liste_competences=referentiel_affiche_competences_certificat('/',':',$this->certificat->competences_certificat, $liste_empreintes);
         $liste_competences = $this->affiche_competences_validees('/', ':', $this->certificat->competences_certificat, $liste_empreintes, $liste_description_competences_poids);
         // format the body
         $s = '<h3>' . get_string('certification', 'referentiel') . ' ';
         if (!empty($this->occurrence->url_referentiel)) {
             $s .= get_string('referentiel', 'referentiel') . ' <a href="' . $this->occurrence->url_referentiel . '" target="_blank">' . $this->occurrence->code_referentiel . '</a></h3>' . "\n";
         } else {
             $s .= get_string('referentiel', 'referentiel') . ' ' . $this->occurrence->code_referentiel . '</h3>' . "\n";
         }
         $s .= '<p><b>' . get_string('name', 'referentiel') . ':</b> ' . $fullname . ' (<i>' . $login . '</i>)<br />' . '<b>' . get_string('userid', 'referentiel') . '</b>: #' . $this->certificat->userid . '<br />' . '<b>' . get_string('id', 'referentiel') . get_string('certificat', 'referentiel') . '</b>: #' . $this->certificat->id . '<br />' . '<b>' . get_string('competences_certificat', 'referentiel') . ':</b><br />' . $liste_competences . '<br />' . "\n";
         //                    .'<b>'.get_string('competences_declarees', 'referentiel', $fullname).':</b><br />'.$this->certificat->competences_activite.'<br />'
         if (!empty($this->certificat->verrou)) {
             $s .= '<i>' . get_string('certificat', 'referentiel') . ' ' . get_string('verrou', 'referentiel') . '</i><br />' . "\n";
         }
         if (!empty($this->certificat->synthese_certificat)) {
             $s .= '<b>' . get_string('synthese_certificat', 'referentiel') . ':</b> ' . $this->certificat->synthese_certificat . '<br />' . "\n";
         }
         if (empty($this->certificat->decision_jury)) {
             $s .= '<b>' . get_string('decisionnotfound', 'referentiel', date("Y-m-d")) . '</b><br />';
         } else {
             $s .= '<b>' . get_string('decision_jury', 'referentiel') . ':</b> ' . $this->certificat->decision_jury . '<br />';
         }
         if (!empty($this->certificat->teacherid)) {
             $s .= '<b>' . get_string('referent', 'referentiel') . ':</b> ' . referentiel_get_user_info($this->certificat->teacherid) . '<br />';
         }
         if (!empty($this->certificat->date_decision)) {
             $s .= '<b>' . get_string('date_decision', 'referentiel') . ':</b> ' . userdate($this->certificat->date_decision) . '<br />';
         }
         if (!empty($this->certificat->commentaire_certificat)) {
             $s .= '<b>' . get_string('commentaire_certificat', 'referentiel') . ': </b>' . $this->certificat->commentaire_certificat . '</p>' . "\n";
         }
         $s .= '</p>' . "\n";
         // echo $s;
         // exit;
         $options = portfolio_format_text_options();
         $format = $this->get('exporter')->get('format');
         $formattedtext = format_text($s, FORMAT_HTML, $options);
         // $formattedtext = portfolio_rewrite_pluginfile_urls($formattedtext, $this->context->id, 'mod_referentiel', 'certificat', $certificat->id, $format);
         $output = '<table border="0" cellpadding="3" cellspacing="1" bgcolor="#333300">';
         $output .= '<tr valign="top" bgcolor="#ffffff"><td>';
         $output .= '<div><b>' . get_string('certificat', 'referentiel') . ' ' . format_string($this->occurrence->code_referentiel) . '</b></div>';
         if (!empty($this->certificat->decision_jury)) {
             $output .= '<div>' . get_string('proposedbynameondate', 'referentiel', $by) . '</div>';
         } else {
             $output .= '<div>' . get_string('evaluatedbynameondate', 'referentiel', $by) . '</div>';
         }
         $output .= '</td></tr>';
         $output .= '<tr valign="top" bgcolor="#ffffff"><td align="left">';
         $output .= $formattedtext;
         $output .= '</td></tr></table>' . "\n\n";
     }
     return $output;
 }
function referentiel_activite_id($context, $mode, $cm, $instance, $activite_id, $bareme, $select_acc = 0, $detail = true)
{
    global $COURSE;
    // Specifique car on a l'id de l'activite
    if ($activite_id) {
        $record_a = referentiel_get_activite($activite_id);
        if (!empty($record_a)) {
            echo '<div align="center">' . get_string('competences_declarees', 'referentiel', '<span class="bold">' . referentiel_get_user_info($record_a->userid) . '</span>') . "\n" . referentiel_print_jauge_activite($record_a->userid, $instance->ref_referentiel) . '</div>' . "\n";
            referentiel_print_activite_detail($bareme, $record_a, $context, true, 0);
            if (!$record_a->approved) {
                echo '<div align="center">' . referentiel_ajout_document($record_a, $mode, $select_acc) . "</div>\n";
            }
            // afficher le menu si on l'activité est affichee dans son propre cours de création
            if ($record_a->ref_course == $COURSE->id) {
                referentiel_menu_activite($cm, $context, $record_a->id, $record_a->userid, $instance->id, $record_a->approved, 0, $detail, $mode);
            } else {
                echo '<div align="center">' . get_string('activite_exterieure', 'referentiel') . '</div>' . "\n";
            }
        }
    }
}
예제 #22
0
 function write_etudiant($record)
 {
     // initial string;
     $expout = "";
     // add comment
     $expout .= "\n\n<!-- etudiant: {$record->id}  -->\n";
     if ($record) {
         // DEBUG
         // echo "<br />\n";
         // print_r($record);
         $id = $this->writeraw($record->id);
         $userid = $this->writeraw($record->userid);
         $ref_etablissement = $this->writeraw($record->ref_etablissement);
         $num_etudiant = $this->writeraw($record->num_etudiant);
         $ddn_etudiant = $this->writeraw($record->ddn_etudiant);
         $lieu_naissance = $this->writeraw($record->lieu_naissance);
         $departement_naissance = $this->writeraw($record->departement_naissance);
         $adresse_etudiant = $this->writeraw($record->adresse_etudiant);
         $expout .= "<etudiant>\n";
         $expout .= "<id>{$id}</id>\n";
         $expout .= "<userid>{$userid}</userid>\n";
         $expout .= "<login>" . referentiel_get_user_login($userid) . "</login>\n";
         $expout .= "<lastname_firstname>" . referentiel_get_user_info($record->userid) . "</lastname_firstname>\n";
         $expout .= "<num_etudiant>{$num_etudiant}</num_etudiant>\n";
         $expout .= "<ddn_etudiant>{$ddn_etudiant}</ddn_etudiant>\n";
         $expout .= "<lieu_naissance>{$lieu_naissance}</lieu_naissance>\n";
         $expout .= "<departement_naissance>{$departement_naissance}</departement_naissance>\n";
         $expout .= "<adresse_etudiant>{$adresse_etudiant}</adresse_etudiant>\n";
         $expout .= "<ref_etablissement>{$ref_etablissement}</ref_etablissement>\n";
         /*
         		// Etablissement
         		$record_etablissement=referentiel_get_etablissement($record->ref_etablissement);
             	if ($record_etablissement){
         			$expout .= $this->write_etablissement( $record_etablissement );
         		}
         */
         $expout .= "</etudiant>\n";
     }
     return $expout;
 }
예제 #23
0
/**
 * Turns referentiel instance into an xml segment
 * @param referentiel instanceobject
 * @return string xml segment
 */
function ooffice_write_certificat($record, $referentiel_instance, $referentiel_referentiel, $liste_empreintes, $liste_poids, $param)
{
    global $CFG;
    global $odt;
    // add comment and div tags
    if ($record) {
        // DEBUG
        // echo "DEBUG LIGNE 1021";
        // print_r($referentiel_instance);
        $id = trim($record->id);
        $commentaire_certificat = recode_utf8_vers_latin1(trim($record->commentaire_certificat));
        $synthese_certificat = recode_utf8_vers_latin1(trim($record->synthese_certificat));
        $competences_activite = recode_utf8_vers_latin1(trim($record->competences_activite));
        $competences_certificat = recode_utf8_vers_latin1(trim($record->competences_certificat));
        $decision_jury = recode_utf8_vers_latin1(trim($record->decision_jury));
        if ($record->date_decision) {
            $date_decision = userdate(trim($record->date_decision));
        } else {
            $date_decision = "";
        }
        $userid = trim($record->userid);
        $teacherid = trim($record->teacherid);
        if ($teacherid != 0) {
            $nom_prenom_teacher = recode_utf8_vers_latin1(referentiel_get_user_info($teacherid));
        } else {
            $nom_prenom_teacher = "";
        }
        $ref_referentiel = trim($record->ref_referentiel);
        // $ref_referentiel=$referentiel_id;
        $verrou = trim($record->verrou);
        $valide = trim($record->valide);
        $evaluation = trim($record->evaluation);
        // USER
        if (isset($record->userid) && $record->userid > 0) {
            $record_etudiant = referentiel_get_etudiant_user($record->userid);
            if ($record_etudiant) {
                $odt->SetLeftMargin(15);
                ooffice_write_referentiel($referentiel_instance, $referentiel_referentiel, $param);
                ooffice_write_etudiant($record_etudiant, $param);
                $odt->SetFont('Arial', '', 12);
                if ($param->certificat_sel_decision_jury) {
                    if ($date_decision != "" && $decision_jury != "") {
                        $odt->Write(1, $decision_jury);
                    }
                    $odt->Ln(1);
                }
                // $odt->SetFont('Arial','B',10);
                // $odt->Write(1,"ID : ");
                // $odt->SetFont('Arial','',10);
                // $odt->Write(1,"$id");
                // $odt->Ln(1);
                $odt->SetFont('Arial', 'B', 12);
                $odt->Write(1, recode_utf8_vers_latin1(get_string('competences', 'referentiel')) . ": ");
                $odt->Ln(1);
                if ($param->certificat_sel_activite_competences) {
                    $odt->SetFont('Arial', 'B', 9);
                    $odt->Write(1, recode_utf8_vers_latin1(get_string('competences_activite', 'referentiel')) . ": ");
                    $odt->Ln(1);
                    ooffice_liste_competences_certificat($ref_referentiel, '/', ':', $competences_activite, $liste_empreintes, 0, 9, 8);
                    $odt->Ln(1);
                }
                if ($param->certificat_sel_certificat_competences) {
                    $odt->SetFont('Arial', 'B', 10);
                    $odt->Write(1, recode_utf8_vers_latin1(get_string('competences_certificat', 'referentiel')) . ": ");
                    $odt->Ln(1);
                    ooffice_liste_competences_certificat($ref_referentiel, '/', ':', $competences_certificat, $liste_empreintes, 0, 10, 9);
                    $odt->Ln(1);
                }
                if ($param->certificat_sel_certificat_competences && $param->certificat_sel_certificat_detail) {
                    ooffice_referentiel_affiche_detail_competences('/', ':', $competences_certificat, $liste_empreintes, $liste_poids);
                }
                if ($param->certificat_sel_certificat_pourcent) {
                    // $odt->SetFont('Arial','B',10);
                    // $odt->Write(1,recode_utf8_vers_latin1(get_string('pourcentage','referentiel'))." :");
                    // $odt->Ln(1);
                    ooffice_referentiel_affiche_certificat_consolide($ref_referentiel, '/', ':', $competences_certificat, 10, 9, 8);
                }
                if ($param->certificat_sel_commentaire) {
                    $odt->SetFont('Arial', 'B', 10);
                    $odt->Write(1, recode_utf8_vers_latin1(get_string('commentaire', 'referentiel')) . ": ");
                    $odt->SetFont('Arial', '', 10);
                    $odt->Write(1, "{$commentaire_certificat} ");
                    $odt->Ln(1);
                    $odt->SetFont('Arial', 'B', 10);
                    $odt->Write(1, recode_utf8_vers_latin1(get_string('synthese_certificat', 'referentiel')) . ": ");
                    $odt->SetFont('Arial', '', 10);
                    $odt->Write(1, "{$synthese_certificat} ");
                    $odt->Ln(1);
                }
                if ($param->certificat_sel_decision_jury) {
                    $odt->SetFont('Arial', 'B', 10);
                    $odt->Write(1, recode_utf8_vers_latin1(get_string('decision', 'referentiel')) . " : ");
                    $odt->SetFont('Arial', '', 10);
                    $odt->Write(1, "{$decision_jury}");
                    $odt->Ln(1);
                }
                if ($param->certificat_sel_certificat_referents) {
                    $odt->SetFont('Arial', 'B', 10);
                    $odt->Write(1, recode_utf8_vers_latin1(get_string('enseignant', 'referentiel')) . " : ");
                    $odt->SetFont('Arial', '', 10);
                    $odt->Write(1, $nom_prenom_teacher);
                    $odt->Ln(1);
                }
                /*
                $odt->Write(1," R�f�rentiel : $ref_referentiel");
                $odt->Ln(1);
                		            $odt->Write(1," Verrou : $verrou, Valide : $valide, Evaluation : $evaluation");
                $odt->Ln(1);
                */
                $odt->Ln(20);
                $odt->Writeparagraphe(1, get_string('date_signature', 'referentiel', date("d/m/Y")));
                $odt->AddPage();
            }
        }
    }
    return "";
}
                        // MODIF JF 27/10/2009
                        $date_modif_student = $record->date_modif_student;
                        if ($date_modif_student != 0) {
                            $date_modif_student_info = userdate($date_modif_student);
                        } else {
                            $date_modif_student_info = '';
                        }
                        $link_documents = referentiel_get_liens_documents($activite_id, $userid, $context);
                        if ($link_documents) {
                            echo '<br />' . "\n";
                        }
                        // preparer les variables globales pour Overlib
                        referentiel_initialise_data_referentiel($ref_referentiel);
                        $jauge_activite_declarees = referentiel_print_jauge_activite($userid, $ref_referentiel);
                        if ($jauge_activite_declarees) {
                            print_string('competences_declarees', 'referentiel', referentiel_get_user_info($userid));
                            //echo '<br />DEBUT DEBUG'."\n";
                            echo $jauge_activite_declarees . "\n";
                            //echo '<br />FIN DEBUG'."\n";
                        }
                        echo '<div class="ref_saisie1">
<form name="form" method="post" action="' . s("activite.php?id={$cm->id}") . '">
<span class="bold">' . get_string('id', 'referentiel') . '</span>';
                        echo $activite_id;
                        echo '<span class="bold">' . get_string('type_activite', 'referentiel') . '</span>' . s($type_activite) . '
<br /><span class="bold">' . get_string('auteur', 'referentiel') . '</span>' . s($user_info);
                        echo ' <span class="bold">' . get_string('date_creation', 'referentiel') . '</span>' . s($date_creation_info);
                        echo '<br />' . "\n";
                        if (isset($approved) && $approved) {
                            echo ' <span class="valide">' . "\n";
                        } else {
예제 #25
0
function referentiel_validation_activite_task($ref_task, $select = '')
{
    // Effectue la validation des activités souscrites a la tache
    global $DB;
    global $USER;
    // DEBUG
    // echo '<br />DEBUG :: lib_task.php :: 669 :: Tache : '.$ref_task."<br />Selection :".$select."\n";
    if ($ref_task > 0) {
        $info_valideur = referentiel_get_user_info($USER->id);
        // verifier si association existe
        $params1 = array("ref_task" => "{$ref_task}");
        $sql1 = "SELECT * FROM {referentiel_a_user_task}  WHERE ref_task=:ref_task ";
        if (!empty($select)) {
            $sql1 .= ' ' . $select . ' ';
        }
        // echo '<br />DEBUG :: lib_task.php :: 677 :: SQL: '.$sql1."\n";
        $records_association = $DB->get_records_sql($sql1, $params1);
        if ($records_association) {
            foreach ($records_association as $record_association) {
                if ($record_association) {
                    $ref_user = $record_association->ref_user;
                    $ref_activite = $record_association->ref_activite;
                    // DEBUG
                    //print_object($record_association);
                    //echo "<br />";
                    // Approuver l'activite
                    // recuperer l'info sur l'activite
                    if ($approverecord = $DB->get_record('referentiel_activite', array("id" => "{$ref_activite}"))) {
                        $approverecord->approved = 1;
                        $approverecord->teacherid = $USER->id;
                        $approverecord->date_modif = time();
                        $approverecord->type_activite = $approverecord->type_activite;
                        $approverecord->description_activite = $approverecord->description_activite;
                        $approverecord->commentaire_activite = $approverecord->commentaire_activite . "\n" . get_string('approved_task_by', 'referentiel') . " " . $info_valideur . " (" . date("d/m/Y H:i") . ")\n";
                        // DEBUG
                        // print_r($approverecord);
                        // echo "<br />\n";
                        if ($DB->update_record('referentiel_activite', $approverecord)) {
                            // regeneration du certificat associe a cette personne pour ce referentiel
                            // Modif JF 2012/10/07
                            // referentiel_certificat_user_invalider($approverecord->userid, $approverecord->ref_referentiel);
                            referentiel_regenere_certificat_user($approverecord->userid, $approverecord->ref_referentiel);
                        }
                    }
                }
            }
        }
    }
}
function referentiel_print_aucun_accompagnement_user($userid)
{
    $s = "";
    if ($userid) {
        $user_info = referentiel_get_user_info($userid);
    } else {
        $user_info = "&nbsp;";
    }
    $s .= '<tr><td class="zero">&nbsp;</td><td class="zero">';
    $s .= $user_info;
    $s .= '</td><td class="invalide" colspan="2">';
    $s .= '<span class="small">' . get_string('notmatched', 'referentiel') . '</span>';
    $s .= '</td><td class="zero">&nbsp;</td></tr>' . "\n";
    return $s;
}
예제 #27
0
/**
 * Builds and returns the body of the email notification in plain text.
 *
 * @param object $course
 * @param object $forum
 * @param object $discussion
 * @param object $post
 * @param object $userfrom
 * @param object $userto
 * @param boolean $bare
 * @return string The email body in plain text format.
 */
function referentiel_make_mail_text($type, $context, $course, $post, $userfrom, $userto, $bare = false)
{
    global $CFG, $USER;
    // DEBUG : cron_lib.php :
    // mtrace("referentiel_make_mail_text()");
    if (!isset($userto->viewfullnames[$post->id])) {
        $viewfullnames = has_capability('moodle/site:viewfullnames', $context, $userto->id);
    } else {
        $viewfullnames = $userto->viewfullnames[$post->id];
    }
    // groups
    if (isset($userfrom->groups)) {
        $groups = $userfrom->groups[$post->id];
    } else {
        $groups = groups_get_all_groups($course->id, $userfrom->id, $cm->groupingid);
    }
    $groupname = '';
    if ($groups) {
        // mtrace("\n lib.php :: 2038\n");
        // print_r($groups);
        foreach ($groups as $groupe) {
            // mtrace("\n lib.php :: 2041\n");
            // print_r($groupe);
            if (!empty($groupe->name)) {
                $groupname .= $groupe->name . ' ';
            }
        }
    }
    $by = new stdClass();
    $by->name = fullname($userfrom, $viewfullnames);
    $a = new stdClass();
    $a->site = $course->shortname;
    $posttext = '';
    if ($type == TYPE_CERTIFICAT) {
        if ($post->date_decision) {
            $by->date = userdate($post->date_decision, "", $userto->timezone);
        } else {
            $by->date = userdate(time(), "", $userto->timezone);
        }
        $strbynameondate = get_string('bynameondate', 'referentiel', $by);
        if (!empty($groupname)) {
            $strbynameondate .= ' - ' . get_string('groupe', 'referentiel', $groupname);
        }
        $strreferentiel = get_string('certificat', 'referentiel') . ' ' . referentiel_get_referentiel_name($post->ref_referentiel);
        if (!$bare) {
            $posttext = "{$course->shortname} -> ";
            $posttext .= format_string($strreferentiel, true);
            $posttext .= " ({$CFG->wwwroot}/)";
        }
        $posttext .= "\n" . $strbynameondate . "\n";
        $posttext .= format_text_email(trusttext_strip(get_string('certificat', 'referentiel') . ' ' . $post->id), FORMAT_PLAIN);
        $posttext .= "\n\n";
        $posttext .= format_text_email(trusttext_strip(get_string('certificat_sel_certificat_competences', 'referentiel')), FORMAT_PLAIN);
        $posttext .= "\n";
        $posttext .= format_text_email(trusttext_strip($post->competences_certificat), FORMAT_PLAIN);
        $posttext .= "\n\n";
        if ($post->commentaire_certificat) {
            $posttext .= format_text_email(trusttext_strip($post->commentaire_certificat), FORMAT_PLAIN);
            $posttext .= "\n\n";
        }
        if ($post->synthese_certificat) {
            $posttext .= format_text_email(trusttext_strip($post->synthese_certificat), FORMAT_PLAIN);
            $posttext .= "\n\n";
        }
        if (!$bare) {
            $posttext .= "---------------------------------------------------------------------\n";
            $a->type = get_string('certificat', 'referentiel');
            $posttext .= get_string("postmailinfo", "referentiel", $a) . "\n";
            $posttext .= "{$CFG->wwwroot}/\n";
        }
    } else {
        if ($type == TYPE_TACHE) {
            if (isset($post->auteurid) && $post->auteurid) {
                $auteur_info = referentiel_get_user_info($post->auteurid);
            } else {
                $auteur_info = get_string('un_enseignant', 'referentiel');
            }
            if ($post->date_modif) {
                $by->date = userdate($post->date_modif, "", $userto->timezone);
            } else {
                $by->date = userdate($post->date_creation, "", $userto->timezone);
            }
            $strbynameondate = get_string('bynameondate', 'referentiel', $by);
            if (!empty($groupname)) {
                $strbynameondate .= ' - ' . get_string('groupe', 'referentiel', $groupname);
            }
            $strreferentiel = get_string('referentiel', 'referentiel') . ': ' . referentiel_get_instance_name($post->ref_referentiel);
            if (!$bare) {
                $posttext = "{$course->shortname} -> {$strreferentiel} -> " . format_string($post->type_task, true);
            }
            $posttext .= "\n" . $strbynameondate . "\n";
            $posttext .= "\n---------------------------------------------------------------------\n";
            $posttext .= format_text_email(trusttext_strip(get_string('task', 'referentiel') . ' ' . $post->id), FORMAT_PLAIN);
            $posttext .= "\n---------------------------------------------------------------------\n\n";
            $posttext .= format_string($post->type_task, true);
            if ($bare) {
                $posttext .= "(" . get_string('postincontext', 'referentiel') . " {$CFG->wwwroot}/mod/referentiel/task.php?d={$post->ref_instance}&task_id={$post->id})";
            }
            $posttext .= "\n\n";
            $posttext .= format_text_email(trusttext_strip($post->description_task), FORMAT_PLAIN);
            $posttext .= "\n\n";
            $posttext .= format_text_email(trusttext_strip(get_string('certificat_sel_activite_competences', 'referentiel')), FORMAT_PLAIN);
            $posttext .= "\n";
            $posttext .= format_text_email(trusttext_strip($post->competences_task), FORMAT_PLAIN);
            $posttext .= "\n\n";
            if ($post->criteres_evaluation) {
                $posttext .= format_text_email(trusttext_strip(get_string('criteres_evaluation', 'referentiel') . ': ' . $post->criteres_evaluation), FORMAT_PLAIN);
                $posttext .= "\n\n";
            }
            if ($post->souscription_libre) {
                $posttext .= format_text_email(trusttext_strip(get_string('souscription_libre', 'referentiel')), FORMAT_PLAIN);
                $posttext .= "\n";
            }
            if (isset($post->cle_souscription) && $post->cle_souscription != '') {
                $posttext .= format_text_email(trusttext_strip(get_string('obtenir_cle_souscription', 'referentiel', $auteur_info)), FORMAT_PLAIN);
                $posttext .= "\n";
            }
            if (isset($post->tache_masquee) && $post->tache_masquee != 0) {
                $posttext .= format_text_email(trusttext_strip(get_string('tache_masquee_num', 'referentiel', $post->id)), FORMAT_PLAIN);
                $posttext .= "\n";
            }
            $posttext .= "\n";
            if (!$bare) {
                $posttext .= "---------------------------------------------------------------------\n";
                $a->type = get_string('task', 'referentiel');
                $posttext .= get_string("postmailinfo", "referentiel", $a) . "\n";
                $posttext .= "{$CFG->wwwroot}/mod/referentiel/task.php?d={$post->ref_instance}&task_id={$post->id}\n";
            }
        } else {
            // ACTIVITE
            if ($post->date_modif) {
                $by->date = userdate($post->date_modif, "", $userto->timezone);
            } else {
                if ($post->date_modif_student) {
                    $by->date = userdate($post->date_modif_student, "", $userto->timezone);
                } else {
                    $by->date = userdate($post->date_creation, "", $userto->timezone);
                }
            }
            $strbynameondate = get_string('bynameondate', 'referentiel', $by);
            if (!empty($groupname)) {
                $strbynameondate .= ' - ' . get_string('groupe', 'referentiel', $groupname);
            }
            $strreferentiel = get_string('referentiel', 'referentiel') . ': ' . referentiel_get_instance_name($post->ref_referentiel);
            if (!$bare) {
                $posttext = "{$course->shortname} -> {$strreferentiel} -> " . format_string($post->type_activite, true);
            }
            $posttext .= "\n" . $strbynameondate . "\n";
            $posttext .= "\n---------------------------------------------------------------------\n";
            $posttext .= format_text_email(trusttext_strip(get_string('activite', 'referentiel') . ' ' . $post->id), FORMAT_PLAIN);
            $posttext .= "\n---------------------------------------------------------------------\n";
            $posttext .= format_string($post->type_activite, true);
            if ($bare) {
                $posttext .= "(" . get_string('postincontext', 'referentiel') . " {$CFG->wwwroot}/mod/referentiel/activite.php?d={$post->ref_instance}&activite_id={$post->id})";
            }
            $posttext .= "\n";
            $posttext .= format_text_email(trusttext_strip(get_string('auteur', 'referentiel') . ' '), FORMAT_PLAIN);
            $posttext .= format_text_email(trusttext_strip(referentiel_get_user_info($post->userid)), FORMAT_PLAIN);
            $posttext .= "\n";
            $posttext .= format_text_email(trusttext_strip($post->type_activite), FORMAT_PLAIN);
            $posttext .= "\n";
            $posttext .= format_text_email(trusttext_strip($post->description_activite), FORMAT_PLAIN);
            $posttext .= "\n\n";
            $posttext .= format_text_email(trusttext_strip(get_string('certificat_sel_activite_competences', 'referentiel')), FORMAT_PLAIN);
            $posttext .= "\n";
            $posttext .= format_text_email(trusttext_strip($post->competences_activite), FORMAT_PLAIN);
            $posttext .= "\n\n";
            if ($post->commentaire_activite) {
                $posttext .= format_text_email(trusttext_strip($post->commentaire_activite), FORMAT_PLAIN);
                $posttext .= "\n\n";
            }
            if (!$bare) {
                $posttext .= "---------------------------------------------------------------------\n";
                $a->type = get_string('activite', 'referentiel');
                $posttext .= get_string("postmailinfo", "referentiel", $a) . "\n";
                $posttext .= "{$CFG->wwwroot}/mod/referentiel/activite.php?d={$post->ref_instance}&activite_id={$post->id}\n";
            }
        }
    }
    return $posttext;
}