function referentiel_print_task($record_t, $context, $userid = 0) { global $CFG; global $OUTPUT; // Moodle 2 pour les icones $s = ""; 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; $closed = $date_fin < time(); // 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_modif_info = userdate($date_modif); $date_debut_info = userdate($date_debut); $date_fin_info = userdate($date_fin); $has_capability_add = has_capability('mod/referentiel:addtask', $context); $has_capability_select = has_capability('mod/referentiel:selecttask', $context); $has_capability_view = has_capability('mod/referentiel:viewtask', $context); $is_owner = referentiel_task_isowner($taskid); if (!$tache_masquee || $has_capability_add) { $s .= '<tr><td>'; $s .= $taskid; $s .= '</td><td>'; $s .= $user_info; $s .= '</td><td>'; $s .= $type_task; // Modif JF 06/10/2010 if ($taskid) { // consignes associées à une tâche $titre_task = referentiel_get_theme_task($taskid); $info_task = referentiel_get_content_task($taskid); if ($info_task != '') { // lien vers la tâche $s .= '<br />' . referentiel_affiche_overlib_texte($titre_task, $info_task); } // documents associés à une tâche $s .= referentiel_print_liste_documents_task($taskid, $auteurid, $context); } $s .= '</td><td>'; $s .= referentiel_affiche_liste_codes_competence('/', $competences_task, $ref_referentiel); $s .= '</td><td>'; $s .= '<span class="small">' . $date_debut_info . '</span>'; $s .= '</td><td>'; $s .= '<span class="small">' . $date_fin_info . '</span>'; $s .= '</td><td>'; // Modalite souscription if ($souscription_libre == 1) { $s .= get_string('libre', 'referentiel') . ' '; } else { if ($cle_souscription != '') { $s .= get_string('obtenir_cle_souscription', 'referentiel', $user_info) . '</span>'; } else { $s .= get_string('avec_cle', 'referentiel') . '</span>'; } } $s .= '</td>'; // menu $s .= '<td align="center">' . "\n"; $s .= ' <a href="' . $CFG->wwwroot . '/mod/referentiel/task.php?d=' . $ref_instance . '&mode=listtasksingle&sesskey=' . sesskey() . '#task_' . $taskid . '"><img src="' . $OUTPUT->pix_url('search', 'referentiel') . '" alt="' . get_string('plus', 'referentiel') . '" title="' . get_string('plus', 'referentiel') . '" /></a>' . "\n"; if ($has_capability_add or $is_owner) { $s .= ' <a href="' . $CFG->wwwroot . '/mod/referentiel/task.php?d=' . $ref_instance . '&taskid=' . $taskid . '&mode=imposetask&sesskey=' . sesskey() . '"><img src="' . $OUTPUT->pix_url('assigner', 'referentiel') . '" alt="' . get_string('assigner', 'referentiel') . '" title="' . get_string('assigner', 'referentiel') . '" /></a>' . "\n"; $s .= ' <a href="' . $CFG->wwwroot . '/mod/referentiel/task.php?d=' . $ref_instance . '&taskid=' . $taskid . '&mode=updatetask&sesskey=' . sesskey() . '"><img src="' . $OUTPUT->pix_url('edit', 'referentiel') . '" alt="' . get_string('edit') . '" title="' . get_string('edit') . '" /></a>' . "\n"; $s .= ' <a href="' . $CFG->wwwroot . '/mod/referentiel/task.php?d=' . $ref_instance . '&taskid=' . $taskid . '&mode=deletetask&sesskey=' . sesskey() . '"><img src="' . $OUTPUT->pix_url('delete', 'referentiel') . '" alt="' . get_string('delete') . '" title="' . get_string('delete') . '" /></a>' . "\n"; $s .= ' <a href="' . $CFG->wwwroot . '/mod/referentiel/task.php?d=' . $ref_instance . '&taskid=' . $taskid . '&mode=deletetaskactivites&sesskey=' . sesskey() . '"><img src="' . $OUTPUT->pix_url('deleteall', 'referentiel') . '" alt="' . get_string('delete_all_task_associations', 'referentiel') . '" title="' . get_string('delete_all_task_associations', 'referentiel') . '" /></a>' . "\n"; if ($tache_masquee) { // masquee // http://localhost/moodle_dev/pix/t/hide.gif $s .= ' <a href="' . $CFG->wwwroot . '/mod/referentiel/task.php?d=' . $ref_instance . '&taskid=' . $taskid . '&hide=0&sesskey=' . sesskey() . '"><img src="' . $OUTPUT->pix_url('show', 'referentiel') . '" alt="' . get_string('show') . '" title="' . get_string('show') . '" /></a>' . "\n"; } else { // affichee $s .= ' <a href="' . $CFG->wwwroot . '/mod/referentiel/task.php?d=' . $ref_instance . '&taskid=' . $taskid . '&hide=1&sesskey=' . sesskey() . '"><img src="' . $OUTPUT->pix_url('hide', 'referentiel') . '" alt="' . get_string('hide') . '" title="' . get_string('hide') . '" /></a>' . "\n"; } } // selectionner if (has_capability('mod/referentiel:selecttask', $context)) { if (!$closed) { if ($userid && referentiel_user_tache_souscrite($userid, $taskid)) { $s .= ' <img src="' . $OUTPUT->pix_url('subscribed', 'referentiel') . '" alt="' . get_string('subscribed_task', 'referentiel') . '" title="' . get_string('subscribed_task', 'referentiel') . '" />' . "\n"; } else { $s .= ' <a href="' . $CFG->wwwroot . '/mod/referentiel/task.php?d=' . $ref_instance . '&taskid=' . $taskid . '&mode=selecttask&sesskey=' . sesskey() . '"><img src="' . $OUTPUT->pix_url('copy', 'referentiel') . '" alt="' . get_string('souscrire', 'referentiel') . '" title="' . get_string('souscrire', 'referentiel') . '" /></a>'; } } else { $s .= ' <img src="' . $OUTPUT->pix_url('stop', 'referentiel') . '" alt="' . get_string('closed_task', 'referentiel') . '" title="' . get_string('closed_task', 'referentiel') . '" />' . "\n"; } } // valider if (has_capability('mod/referentiel:approve', $context)) { if (!$closed) { $s .= ' <a href="' . $CFG->wwwroot . '/mod/referentiel/task.php?d=' . $ref_instance . '&taskid=' . $taskid . '&mode=approvetask&sesskey=' . sesskey() . '"><img src="' . $OUTPUT->pix_url('go', 'referentiel') . '" alt="' . get_string('approve', 'referentiel') . '" title="' . get_string('approve', 'referentiel') . '"/></a>' . "\n"; } else { $s .= ' <a href="' . $CFG->wwwroot . '/mod/referentiel/task.php?d=' . $ref_instance . '&taskid=' . $taskid . '&mode=approvetask&sesskey=' . sesskey() . '"><img src="' . $OUTPUT->pix_url('closed', 'referentiel') . '" alt="' . get_string('approve', 'referentiel') . '" title="' . get_string('approve', 'referentiel') . '" /></a>' . "\n"; } } $s .= '</td></tr>' . "\n"; } } return $s; }
/** Affiche une activite et les documents associés * * input @param record_a an object activite * detail true / false * numero integer * output null * **/ function referentiel_print_activite_detail($bareme, $record_a, $context, $detail = true, $numero = 0) { global $CFG; $s = ''; $s0 = ''; $s1 = ''; $s2 = ''; $nblignes = 4; // hauteur du tableau $nbressource = 0; 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 = $record_a->date_modif; $date_modif_student = $record_a->date_modif_student; $approved = $record_a->approved; $user_info = referentiel_get_user_info($userid); $teacher_info = referentiel_get_user_info($teacherid); if (empty($teacher_info)) { $teacher_info = get_string('inconnu', 'referentiel'); } // dates $date_creation_info = userdate($date_creation); if ($date_modif != 0) { $date_modif_info = userdate($date_modif); } else { $date_modif_info = ''; } if ($date_modif_student != 0) { $date_modif_student_info = userdate($date_modif_student); } else { $date_modif_student_info = ''; } $ref_task = $record_a->ref_task; $stask = ''; if ($ref_task) { // consignes associées à une tâche $titre_task = referentiel_get_theme_task($ref_task); $info_task = referentiel_get_content_task($ref_task); // $stask.='<br /><span class="light">'.get_string('task','referentiel').'</span>'."\n"; if ($info_task != '') { // lien vers la tâche $stask .= ' ' . referentiel_affiche_overlib_texte($titre_task, $info_task) . "\n"; } // documents associés à une tâche $stask .= referentiel_print_liste_documents_task($ref_task, referentiel_get_auteur_task($ref_task), $context); } $url_course = referentiel_get_course_link($ref_course); $url_instance = referentiel_get_instance_link($ref_instance); // preparation pour overlay if (empty($t_item_code) || empty($t_item_description_competence)) { referentiel_initialise_descriptions_items_referentiel($ref_referentiel); } $prioritaire = referentiel_activite_prioritaire($record_a); $s0 .= ' <a name="activite_' . $activite_id . '"></a>' . "\n"; if (!empty($prioritaire)) { $s0 .= '<div class="ref_affprioritaire">' . "\n"; } else { if (isset($approved) && $approved) { $s0 .= '<div class="ref_affvalide">' . "\n"; } else { $s0 .= '<div class="ref_affinvalide">' . "\n"; } } // entetete $s0 .= '<span class="bold">' . get_string('id_activite', 'referentiel', $activite_id) . '</span>'; $s0 .= '<span class="light">' . get_string('type_activite', 'referentiel') . '</span> ' . $type_activite . "\n"; $s0 .= $stask; $s0 .= '<span class="light">' . get_string('course') . '</span> ' . $url_course . "\n"; $s0 .= '<span class="light">' . get_string('instance', 'referentiel') . '</span> ' . '<i>' . $url_instance . '</i>' . "\n"; $s0 .= '</div>' . "\n"; // details if ($detail) { if ($numero % 2 == 0) { $s1 .= '<div class="ref_affact1">'; } else { $s1 .= '<div class="ref_affact2">'; } $s1 .= '<span class="light">' . get_string('auteur', 'referentiel') . '</span> ' . $user_info; $liste_groupes = referentiel_liste_groupes_user($ref_course, $userid); if (!empty($liste_groupes)) { $s1 .= ' <i>' . $liste_groupes . '</i>' . "\n"; } $s1 .= ' <span class="light">' . get_string('date_creation', 'referentiel') . '</span> <span class="ital">' . $date_creation_info . '</span>' . "\n"; if (!empty($date_modif_student_info) && $date_modif_student - $date_creation > 1000) { $s1 .= '<span class="light">' . get_string('date_modif_student', 'referentiel') . '</span> <span class="ital">' . $date_modif_student_info . '</span>' . "\n"; } if (!empty($date_modif_info)) { $s1 .= '<span class="light">' . get_string('date_modif', 'referentiel') . '</span> <span class="ital">' . $date_modif_info . '</span>' . "\n"; } $s1 .= '<br /><span class="light">' . get_string('referent', 'referentiel') . '</span> ' . $teacher_info . ' <span class="light">' . get_string('validation', 'referentiel') . '</span>' . "\n"; if (isset($approved) && $approved) { $s1 .= get_string('approved', 'referentiel'); } else { $s1 .= get_string('not_approved', 'referentiel'); } if (isset($approved) && $approved) { $s1 .= ' <span class="valide">' . "\n"; } else { $s1 .= ' <span class="invalide">' . "\n"; } $s1 .= '<br /><span class="light">' . get_string('liste_codes_competence', 'referentiel') . '</span> <span class="bold">' . "\n"; $s1 .= referentiel_affiche_liste_codes_competence('/', $competences_activite, $ref_referentiel) . "\n"; $s1 .= '</span>' . "\n"; /* if ($CFG->referentiel_use_scale){ require_once('lib_bareme.php'); if ($rec_assoc=referentiel_get_assoc_bareme_occurrence($ref_referentiel)){ if ($bareme=referentiel_get_bareme($rec_assoc->refscaleid)){ */ if (!empty($bareme)) { $competences_bareme = referentiel_get_competences_activite($activite_id, $bareme->id); if (empty($competences_bareme)) { // creer le bareme $competences_bareme = referentiel_creer_competences_activite($record_a, $bareme); } if ($competences_bareme) { if ($detail) { $s1 .= '</span><br /><span class="light">' . get_string('evaluation', 'referentiel') . '</span><br /><span class="white">' . referentiel_affiche_bareme_activite($competences_bareme, $bareme, true) . '</span>' . "\n"; } else { $s1 .= '</span><br /><span class="light">' . get_string('evaluation', 'referentiel') . '</span><br /><span class="white">' . referentiel_affiche_bareme_activite($competences_bareme, $bareme, false) . '</span>' . "\n"; } } } /* } } */ $s1 .= '</span>' . "\n"; //$s1.=$stask; $s1 .= '<br /><span class="light">' . get_string('description', 'referentiel') . '</span>' . "\n"; $s1 .= '<div class="ref_aff0">' . nl2br($description_activite) . '</div>' . "\n"; $s1 .= '<span class="light">' . get_string('commentaire', 'referentiel') . '</span>' . "\n"; $s1 .= '<div class="ref_aff1">' . nl2br($commentaire_activite) . '</div>' . "\n"; $s1 .= '</div>' . "\n"; } else { // NO details if ($numero % 2 == 0) { $s1 .= '<div class="ref_affact1">'; } else { $s1 .= '<div class="ref_affact2">'; } $s1 .= $user_info; $liste_groupes = referentiel_liste_groupes_user($ref_course, $userid); if (!empty($liste_groupes)) { $s1 .= ' <i>' . $liste_groupes . '</i>' . "\n"; } if (!empty($date_modif_student_info) && $date_modif_student - $date_creation > 1000) { $s1 .= ' <span class="ital">' . $date_modif_student_info . '</span>' . "\n"; } else { $s1 .= ' <span class="ital">' . $date_creation_info . '</span>' . "\n"; } $s1 .= ' <span class="light">' . get_string('referent', 'referentiel') . '</span> ' . $teacher_info; if (!empty($date_modif_info)) { $s1 .= ' <span class="ital">' . $date_modif_info . '</span>' . "\n"; } if (isset($approved) && $approved) { $s1 .= ' ' . get_string('approved', 'referentiel'); } else { $s1 .= ' ' . get_string('not_approved', 'referentiel'); } if (isset($approved) && $approved) { $s1 .= ' <span class="valide">' . "\n"; } else { $s1 .= ' <span class="invalide">' . "\n"; } $s1 .= '<br /><span class="bold">' . "\n"; $s1 .= referentiel_affiche_liste_codes_competence('/', $competences_activite, $ref_referentiel) . "\n"; $s1 .= '</span>' . "\n"; /* if ($CFG->referentiel_use_scale){ require_once('lib_bareme.php'); if ($rec_assoc=referentiel_get_assoc_bareme_occurrence($ref_referentiel)){ if ($bareme=referentiel_get_bareme($rec_assoc->refscaleid)){ $competences_bareme=referentiel_get_competences_activite($activite_id, $bareme->id); if (empty($competences_bareme)){ // creer le bareme $competences_bareme=referentiel_creer_competences_activite($record_a, $bareme); } if ($competences_bareme){ $s1.='</span><br /><span class="light">'.get_string('evaluation','referentiel').'</span><br /><span class="white">'.referentiel_affiche_bareme_activite($competences_bareme, $bareme, false).'</span>'."\n"; } } } } */ $s1 .= '</span>' . "\n"; //$s1.=$stask; $s1 .= '<div class="ref_aff0">' . nl2br($description_activite) . '</div>' . "\n"; if (!empty($commentaire_activite)) { $s1 .= '<div class="ref_aff1">' . nl2br($commentaire_activite) . '</div>' . "\n"; } $s1 .= '</div>' . "\n"; } // charger les documents associes à l'activite courante if (isset($activite_id) && $activite_id > 0) { $ref_activite = $activite_id; // plus pratique // AFFICHER LA LISTE DES DOCUMENTS $compteur_document = 0; $records_document = referentiel_get_documents($ref_activite); if ($records_document) { // afficher $nbressource = count($records_document); $s2 .= '<!-- DOCUMENTS --> <div class="ref_affdoc">' . "\n"; if ($detail) { if ($nbressource > 1) { $s2 .= '<span class="bold">' . get_string('ressources_associees', 'referentiel', $nbressource) . '</span>' . "\n"; } else { $s2 .= '<span class="bold">' . get_string('ressource_associee', 'referentiel', $nbressource) . '</span>' . "\n"; } $s2 .= "\n"; } foreach ($records_document as $record_d) { $compteur_document++; $document_id = $record_d->id; $type_document = stripslashes($record_d->type_document); $description_document = stripslashes($record_d->description_document); $url_document = $record_d->url_document; $ref_activite = $record_d->ref_activite; if (isset($record_d->cible_document) && $record_d->cible_document == 1) { $cible_document = '_blank'; // fenêtre cible } else { $cible_document = ''; } if (isset($record_d->etiquette_document)) { $etiquette_document = $record_d->etiquette_document; // fenêtre cible } else { $etiquette_document = ''; } if ($record_d->timestamp == 0) { $date_creation = ''; } else { $date_creation = userdate($record_d->timestamp); } // affichage de l'url if (preg_match('/moddata\\/referentiel/', $url_document)) { // l'URL doit être transformée $data_r = new stdClass(); $data_r->id = $document_id; $data_r->userid = $userid; $data_r->author = $user_info; $data_r->url = $url_document; $data_r->filearea = 'document'; $url_document = referentiel_m19_to_m2_file($data_r, $context, false, true); } if ($detail) { if ($date_modif < $record_d->timestamp) { $s .= '<span class="prioritaire">'; $s .= '<br /><span class="light">' . get_string('num', 'referentiel') . '</span> <span class="ital">' . $document_id . '</i></span></span> <span class="light">' . get_string('date_creation', 'referentiel') . '</span> : <span class="ital">' . $date_creation . '</span> <span class="light">' . get_string('type', 'referentiel') . '</span> : ' . $type_document . ' <span class="light">' . get_string('url', 'referentiel') . '</span> : '; $s .= referentiel_affiche_url($url_document, $etiquette_document, $cible_document); $s .= ' <span class="light">' . get_string('description', 'referentiel') . '</span> : ' . nl2br($description_document); $s .= '</span>' . "\n"; } else { $s .= '<br /><span class="light">' . get_string('num', 'referentiel') . '</span> <span class="ital">' . $document_id . '</span> <span class="light">' . get_string('date_creation', 'referentiel') . '</span> : <span class="ital">' . $date_creation . '</span> <span class="light">' . get_string('type', 'referentiel') . '</span> : ' . $type_document . ' <span class="light">' . get_string('url', 'referentiel') . '</span> : '; $s .= referentiel_affiche_url($url_document, $etiquette_document, $cible_document); $s .= ' <span class="light">' . get_string('description', 'referentiel') . '</span> : ' . nl2br($description_document) . "\n"; } } else { if ($date_modif < $record_d->timestamp) { $s .= '<span class="prioritaire">'; } $s .= ' ' . referentiel_affiche_url($url_document, $etiquette_document, $cible_document); if ($date_modif < $record_d->timestamp) { $s .= '</span>' . "\n"; } } } } } echo $s0 . $s1; if ($s2) { echo $s2; if ($s) { echo $s . "\n"; } echo '</div>' . "\n"; } } }