示例#1
0
     if ($activites_instance) {
         $activites_data = count($activites_instance);
         //
         $activites_instance_a_suivre = referentiel_get_activites_instance_a_suivre($referentiel_instance->id, $delai);
         if ($activites_instance_a_suivre) {
             $a_suivre = count($activites_instance_a_suivre);
             $nbactivitedesherence += $a_suivre;
             $activites_data .= ' (<a href="' . $base_url . 'liste_activites.php?o=' . $referentiel_referentiel->id . '&joursdedelai=' . $joursdedelai . '"><b>&nbsp;' . $a_suivre . '&nbsp;</b></a>)';
         }
         // proposer archivage
         $archives_data .= "<a href=\"./archive.php?i={$referentiel_instance->id}\">" . get_string('gerer_archives', 'referentiel') . "</a>";
         if (!empty($context_instance)) {
             if ($CFG->referentiel_purge_archives) {
                 // Archives older than REFERENTIEL_ARCHIVE_OBSOLETE days will be deleted.
                 $delai_destruction = REFERENTIEL_ARCHIVE_OBSOLETE * 24 * 3600;
                 referentiel_purge_archives($context_instance->id, $delai_destruction, false);
             }
             $archive_info = referentiel_get_how_many_files($context_instance->id);
             if (!empty($archive_info->nfile)) {
                 $archives_data .= " &nbsp; " . display_size($archive_info->total_size) . "\n";
             }
         }
     }
     if ($ligne % 2 == 0) {
         $bgcolor = $bgc0;
     } else {
         $bgcolor = $bgc1;
     }
     $instance_data .= '<tr valign="top" bgcolor="' . $bgcolor . '"><td>' . $link_instance . '<br />(#' . $referentiel_instance->id . ') </td><td>' . stripslashes($referentiel_instance->description_instance) . '</td><td>' . $users_data . '</td><td>' . $activites_data . '</td><td>' . $link_course . '</td><td>' . $archives_data . '</td></tr>' . "\n";
     $ligne++;
 }
示例#2
0
function referentiel_cron_archives()
{
    global $CFG;
    global $DB;
    if ($CFG->referentiel_purge_archives) {
        // purge automatique des archives
        require_once 'lib_archive.php';
        mtrace("DEBUT CRON PURGE REFERENTIEL ARCHIVES");
        // Archives older than REFERENTIEL_ARCHIVE_OBSOLETE days will be deleted.
        $delai_destruction = REFERENTIEL_ARCHIVE_OBSOLETE * 24 * 3600;
        /// Get all the appropriate data
        $referentiel_referentiels = referentiel_get_referentiel_referentiels(NULL);
        // Liste des occurrences de referentiels
        foreach ($referentiel_referentiels as $referentiel_referentiel) {
            if ($referentiel_referentiel) {
                // Liste d'instances de cette occurence
                $referentiel_instances = $DB->get_records("referentiel", array("ref_referentiel" => "{$referentiel_referentiel->id}"));
                if ($referentiel_instances) {
                    foreach ($referentiel_instances as $referentiel_instance) {
                        $course_instance = $DB->get_record('course', array('id' => $referentiel_instance->course));
                        if ($course_instance) {
                            $course_module = get_coursemodule_from_instance('referentiel', $referentiel_instance->id, $course_instance->id);
                            if ($course_module) {
                                $context_instance = context_module::instance($course_module->id);
                                if ($context_instance) {
                                    // purger les archives obsoletes
                                    referentiel_purge_archives($context_instance->id, $delai_destruction, true);
                                }
                            }
                        }
                    }
                }
            }
        }
        mtrace("FIN CRON PURGE REFERENTIEL ARCHIVES.\n");
    }
}