Ejemplo n.º 1
0
function journal_print_recent_activity($course, $isteacher, $timestart)
{
    global $CFG, $DB, $OUTPUT;
    if (!get_config('journal', 'showrecentactivity')) {
        return false;
    }
    $content = false;
    $journals = NULL;
    // log table should not be used here
    $select = "time > ? AND\n               course = ? AND\n               module = 'journal' AND\n               (action = 'add entry' OR action = 'update entry')";
    if (!($logs = $DB->get_records_select('log', $select, array($timestart, $course->id), 'time ASC'))) {
        return false;
    }
    $modinfo =& get_fast_modinfo($course);
    foreach ($logs as $log) {
        ///Get journal info.  I'll need it later
        $j_log_info = journal_log_info($log);
        $cm = $modinfo->instances['journal'][$j_log_info->id];
        if (!$cm->uservisible) {
            continue;
        }
        if (!isset($journals[$log->info])) {
            $journals[$log->info] = $j_log_info;
            $journals[$log->info]->time = $log->time;
            $journals[$log->info]->url = str_replace('&', '&', $log->url);
        }
    }
    if ($journals) {
        $content = true;
        echo $OUTPUT->heading(get_string('newjournalentries', 'journal') . ':', 3);
        foreach ($journals as $journal) {
            print_recent_activity_note($journal->time, $journal, $journal->name, $CFG->wwwroot . '/mod/journal/' . $journal->url);
        }
    }
    return $content;
}
Ejemplo n.º 2
0
Archivo: lib.php Proyecto: r007/PMoodle
function journal_print_recent_activity($course, $isteacher, $timestart)
{
    global $CFG;
    if (!empty($CFG->journal_showrecentactivity)) {
        // Don't even bother
        return false;
    }
    $content = false;
    $journals = NULL;
    // log table should not be used here
    if (!($logs = get_records_select('log', 'time > \'' . $timestart . '\' AND ' . 'course = \'' . $course->id . '\' AND ' . 'module = \'journal\' AND ' . '(action = \'add entry\' OR action = \'update entry\')', 'time ASC'))) {
        return false;
    }
    foreach ($logs as $log) {
        ///Get journal info.  I'll need it later
        $j_log_info = journal_log_info($log);
        $cm = $modinfo->instances['journal'][$j_log_info->id];
        if (!$cm->uservisible) {
            continue;
        }
        if (!isset($journals[$log->info])) {
            $journals[$log->info] = $j_log_info;
            $journals[$log->info]->time = $log->time;
            $journals[$log->info]->url = str_replace('&', '&', $log->url);
        }
    }
    if ($journals) {
        $content = true;
        print_headline(get_string('newjournalentries', 'journal') . ':');
        foreach ($journals as $journal) {
            print_recent_activity_note($journal->time, $journal, $journal->name, $CFG->wwwroot . '/mod/journal/' . $journal->url);
        }
    }
    return $content;
}
Ejemplo n.º 3
0
function journal_print_recent_activity($course, $isteacher, $timestart)
{
    global $CFG;
    if (!empty($CFG->journal_showrecentactivity)) {
        // Don't even bother
        return false;
    }
    $content = false;
    $journals = NULL;
    if (!($logs = get_records_select('log', 'time > \'' . $timestart . '\' AND ' . 'course = \'' . $course->id . '\' AND ' . 'module = \'journal\' AND ' . '(action = \'add entry\' OR action = \'update entry\')', 'time ASC'))) {
        return false;
    }
    foreach ($logs as $log) {
        ///Get journal info.  I'll need it later
        $j_log_info = journal_log_info($log);
        //Create a temp valid module structure (course,id)
        $tempmod->course = $log->course;
        $tempmod->id = $j_log_info->id;
        //Obtain the visible property from the instance
        $modvisible = instance_is_visible($log->module, $tempmod);
        //Only if the mod is visible
        if ($modvisible) {
            if (!isset($journals[$log->info])) {
                $journals[$log->info] = $j_log_info;
                $journals[$log->info]->time = $log->time;
                $journals[$log->info]->url = str_replace('&', '&', $log->url);
            }
        }
    }
    if ($journals) {
        $content = true;
        print_headline(get_string('newjournalentries', 'journal') . ':');
        foreach ($journals as $journal) {
            print_recent_activity_note($journal->time, $journal, $journal->name, $CFG->wwwroot . '/mod/journal/' . $journal->url);
        }
    }
    return $content;
}