function referentiel_print_certificat_detail_une_page($record_a, $nb_items = 0, $liste_empreintes = '', $liste_poids = '', $seuil_certification = 0, $protocole_link = '')
{
    // MODIF JF 2012/02/18
    if ($record_a) {
        $certificat_id = $record_a->id;
        $commentaire_certificat = stripslashes($record_a->commentaire_certificat);
        $synthese_certificat = stripslashes($record_a->synthese_certificat);
        $competences_certificat = $record_a->competences_certificat;
        $decision_jury = stripslashes($record_a->decision_jury);
        $date_decision = $record_a->date_decision;
        $ref_referentiel = $record_a->ref_referentiel;
        $userid = $record_a->userid;
        $teacherid = $record_a->teacherid;
        $verrou = $record_a->verrou;
        $dossier_ferme = $record_a->valide;
        $evaluation = $record_a->evaluation;
        $user_info = referentiel_get_user_info($userid);
        $teacher_info = referentiel_get_user_info($teacherid);
        // dates
        $date_decision_info = userdate($date_decision);
        // MODIF JF 2012/02/13
        // nb items
        if (empty($nb_items)) {
            $nb_items = referentiel_get_nb_items($ref_referentiel);
        }
        // empreintes
        if (empty($liste_empreintes)) {
            $liste_empreintes = referentiel_purge_dernier_separateur(referentiel_get_liste_empreintes_competence($ref_referentiel), '/');
        }
        if (empty($liste_poids)) {
            $liste_poids = referentiel_purge_dernier_separateur(referentiel_get_liste_poids($ref_referentiel), '|');
        }
        // MODIF JF 2012/02/13
        // Protocole de certification
        $certificat_validable = referentiel_certificat_valide($competences_certificat, $ref_referentiel);
        // DEBUG
        // echo "<br />DEBUG :: 595 print_lib_certificat.php :: <br />EMPREINTES :  $liste_empreintes<br />POIDS : $liste_poids\n";
        ?>

<a name="<?php 
        echo "certificat_{$certificat_id}";
        ?>
"></a>
<hr />
<table class="certificat">
<tr valign="top">
    <td width="5%">
	<b><?php 
        print_string('id', 'referentiel');
        ?>
 : </b>
	<?php 
        p($certificat_id);
        ?>
    </td>
    <td>
     <b><?php 
        print_string('etudiant', 'referentiel');
        ?>
 : </b>
		<?php 
        p($user_info);
        ?>
    </td>
	<td>
	<b><?php 
        print_string('date_decision', 'referentiel');
        ?>
 : </b>
		<?php 
        echo '<span class="small">' . $date_decision_info . '</span>';
        ?>
    </td>		
<?php 
        // MODIF JF 2012/02/18
        //if (isset($evaluation) && $seuil_certification) {
        if (isset($evaluation)) {
            // if ($evaluation > $seuil_certification){
            if ($certificat_validable) {
                echo '<td class="prioritaire">';
                echo '<b>' . get_string('competences_certificat', 'referentiel') . '</b> : ';
                echo " <b>{$evaluation}</b>";
                if ($nb_items > 0) {
                    echo " / {$nb_items}\n";
                }
                if ($seuil_certification > 0) {
                    echo " (<i>{$seuil_certification}</i>)\n";
                }
                if (!empty($protocole_link)) {
                    echo ' &nbsp; &nbsp; &nbsp; <a href="' . $protocole_link . '">' . get_string('validable', 'referentiel') . '</a>' . "\n";
                } else {
                    echo get_string('validable', 'referentiel');
                }
                echo "\n";
            } else {
                echo '<td>';
                echo '<b>' . get_string('competences_certificat', 'referentiel') . '</b> : ';
                echo " <b>{$evaluation}</b>";
                if ($nb_items > 0) {
                    echo " / {$nb_items}\n";
                }
                if ($seuil_certification > 0) {
                    echo " (<i>{$seuil_certification}</i>)\n";
                }
                echo ' &nbsp; &nbsp; &nbsp; ';
                if (!empty($protocole_link)) {
                    echo ' &nbsp; &nbsp; &nbsp; <a href="' . $protocole_link . '">' . get_string('non_validable', 'referentiel') . '</a>' . "\n";
                } else {
                    echo get_string('non_validable', 'referentiel');
                }
                echo "\n";
            }
            echo ' &nbsp; &nbsp; &nbsp; ';
        } else {
            echo '<td>';
            echo '<b>' . get_string('competences_certificat', 'referentiel') . '</b> : ';
            echo get_string('l_inconnu', 'referentiel');
        }
        echo '</td>' . "\n";
        if (!isset($verrou) or $verrou == "" or $verrou == 0) {
            echo '<td class="deverrouille">';
            echo '<b>' . get_string('certificat_etat', 'referentiel') . '</b> : ';
            echo get_string('deverrouille', 'referentiel');
        } else {
            echo '<td class="verrouille">';
            echo '<b>' . get_string('certificat_etat', 'referentiel') . '</b> : ';
            echo get_string('verrouille', 'referentiel');
        }
        echo '</td>' . "\n";
        if (!isset($dossier_ferme) or $dossier_ferme == "" or $dossier_ferme == 0) {
            echo '<td>';
            echo '<b>' . get_string('f_valide', 'referentiel') . '</b> : ';
            echo get_string('dossier_ouvert', 'referentiel');
        } else {
            echo '<td class="prioritaire">';
            echo '<b>' . get_string('f_valide', 'referentiel') . '</b> : ';
            echo get_string('dossier_ferme', 'referentiel');
        }
        echo '</td>' . "\n";
        ?>
    <td>
     <b><?php 
        print_string('referent', 'referentiel');
        ?>
 : </b>
	<?php 
        p($teacher_info);
        ?>
    </td>
    <td>
     <b><?php 
        print_string('validation', 'referentiel');
        ?>
 : </b>
<?php 
        if (isset($decision_jury) && $decision_jury != "") {
            p($decision_jury);
        } else {
            echo '&nbsp;' . "\n";
        }
        ?>

<tr valign="top">
    <td>
	<b><?php 
        print_string('code', 'referentiel');
        ?>
 </b>
    </td>
    <td>
	<b><?php 
        print_string('competences_valides', 'referentiel');
        ?>
 </b>
    </td>
    <td colspan="4">
	<b><?php 
        print_string('description_item', 'referentiel');
        ?>
 </b>
    </td>
    <td>
	<b><?php 
        print_string('p_item', 'referentiel');
        ?>
 </b>
    </td>
    <td>
	<b><?php 
        print_string('e_item', 'referentiel');
        ?>
 </b>
    </td>
</tr>
<?php 
        echo referentiel_affiche_detail_competences('/', ':', $competences_certificat, $liste_empreintes, $liste_poids);
        ?>
<tr valign="top">
    <td colspan="8">
	<b><?php 
        print_string('synthese_certificat', 'referentiel');
        ?>
 :</b>
        <?php 
        echo nl2br($synthese_certificat);
        ?>
    </td>
</tr>
<tr valign="top">
    <td colspan="8">
	<b><?php 
        print_string('commentaire', 'referentiel');
        ?>
 :</b>
        <?php 
        echo nl2br($commentaire_certificat);
        ?>
    </td>
</tr>
</table>
<?php 
    }
}
Example #2
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;
 }