• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP print_recent_activity_note函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中print_recent_activity_note函数的典型用法代码示例。如果您正苦于以下问题:PHP print_recent_activity_note函数的具体用法?PHP print_recent_activity_note怎么用?PHP print_recent_activity_note使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了print_recent_activity_note函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: assign_print_recent_activity

/**
 * Print recent activity from all assignments in a given course
 *
 * This is used by the recent activity block
 * @param mixed $course the course to print activity for
 * @param bool $viewfullnames boolean to determine whether to show full names or not
 * @param int $timestart the time the rendering started
 * @return bool true if activity was printed, false otherwise.
 */
function assign_print_recent_activity($course, $viewfullnames, $timestart)
{
    global $CFG, $USER, $DB, $OUTPUT;
    require_once $CFG->dirroot . '/mod/assign/locallib.php';
    // Do not use log table if possible, it may be huge.
    $dbparams = array($timestart, $course->id, 'assign', ASSIGN_SUBMISSION_STATUS_SUBMITTED);
    $namefields = user_picture::fields('u', null, 'userid');
    if (!($submissions = $DB->get_records_sql("SELECT asb.id, asb.timemodified, cm.id AS cmid, um.id as recordid,\n                                                     {$namefields}\n                                                FROM {assign_submission} asb\n                                                     JOIN {assign} a      ON a.id = asb.assignment\n                                                     JOIN {course_modules} cm ON cm.instance = a.id\n                                                     JOIN {modules} md        ON md.id = cm.module\n                                                     JOIN {user} u            ON u.id = asb.userid\n                                                LEFT JOIN {assign_user_mapping} um ON um.userid = u.id AND um.assignment = a.id\n                                               WHERE asb.timemodified > ? AND\n                                                     asb.latest = 1 AND\n                                                     a.course = ? AND\n                                                     md.name = ? AND\n                                                     asb.status = ?\n                                            ORDER BY asb.timemodified ASC", $dbparams))) {
        return false;
    }
    $modinfo = get_fast_modinfo($course);
    $show = array();
    $grader = array();
    $showrecentsubmissions = get_config('assign', 'showrecentsubmissions');
    foreach ($submissions as $submission) {
        if (!array_key_exists($submission->cmid, $modinfo->get_cms())) {
            continue;
        }
        $cm = $modinfo->get_cm($submission->cmid);
        if (!$cm->uservisible) {
            continue;
        }
        if ($submission->userid == $USER->id) {
            $show[] = $submission;
            continue;
        }
        $context = context_module::instance($submission->cmid);
        // The act of submitting of assignment may be considered private -
        // only graders will see it if specified.
        if (empty($showrecentsubmissions)) {
            if (!array_key_exists($cm->id, $grader)) {
                $grader[$cm->id] = has_capability('moodle/grade:viewall', $context);
            }
            if (!$grader[$cm->id]) {
                continue;
            }
        }
        $groupmode = groups_get_activity_groupmode($cm, $course);
        if ($groupmode == SEPARATEGROUPS && !has_capability('moodle/site:accessallgroups', $context)) {
            if (isguestuser()) {
                // Shortcut - guest user does not belong into any group.
                continue;
            }
            // This will be slow - show only users that share group with me in this cm.
            if (!$modinfo->get_groups($cm->groupingid)) {
                continue;
            }
            $usersgroups = groups_get_all_groups($course->id, $submission->userid, $cm->groupingid);
            if (is_array($usersgroups)) {
                $usersgroups = array_keys($usersgroups);
                $intersect = array_intersect($usersgroups, $modinfo->get_groups($cm->groupingid));
                if (empty($intersect)) {
                    continue;
                }
            }
        }
        $show[] = $submission;
    }
    if (empty($show)) {
        return false;
    }
    echo $OUTPUT->heading(get_string('newsubmissions', 'assign') . ':', 3);
    foreach ($show as $submission) {
        $cm = $modinfo->get_cm($submission->cmid);
        $context = context_module::instance($submission->cmid);
        $assign = new assign($context, $cm, $cm->course);
        $link = $CFG->wwwroot . '/mod/assign/view.php?id=' . $cm->id;
        // Obscure first and last name if blind marking enabled.
        if ($assign->is_blind_marking()) {
            $submission->firstname = get_string('participant', 'mod_assign');
            if (empty($submission->recordid)) {
                $submission->recordid = $assign->get_uniqueid_for_user($submission->userid);
            }
            $submission->lastname = $submission->recordid;
        }
        print_recent_activity_note($submission->timemodified, $submission, $cm->name, $link, false, $viewfullnames);
    }
    return true;
}
开发者ID:dg711,项目名称:moodle,代码行数:88,代码来源:lib.php


示例2: elluminate_print_recent_activity

function elluminate_print_recent_activity($course, $isteacher, $timestart)
{
    /// Given a course and a time, this module should find recent activity
    /// that has occurred in Blackboard Collaborate activities and print it out.
    /// Return true if there was output, or false is there was none.
    global $CFG;
    global $DB;
    $content = false;
    $meetings = NULL;
    $select = "time > {$timestart} AND course = {$course->id} AND " . "module = 'elluminate' AND action = 'view.meeting'";
    if (!($logs = $DB->get_records_select('log', $select, null, 'time ASC'))) {
        return false;
    }
    foreach ($logs as $log) {
        //Create a temp valid module structure (course,id)
        $tempmod = new stdClass();
        $tempmod->course = $log->course;
        $tempmod->id = $log->info;
        //Obtain the visible property from the instance
        $modvisible = instance_is_visible($log->module, $tempmod);
        //Only if the mod is visible
        if ($modvisible) {
            $sql = "SELECT e.name, u.firstname, u.lastname\n\t\t            FROM {elluminate} e,\n\t\t            {user} u" . "WHERE e.id = :elluminate\n            \t\tAND u.id = :log";
            $sql_params = array('elluminate' => $log->info, 'log' => $log->userid);
            $meetings[$log->info] = $DB->get_record_sql($sql, $sql_params);
            $meetings[$log->info]->time = $log->time;
            $meetings[$log->info]->url = str_replace('&', '&', $log->url);
        }
    }
    if ($meetings) {
        print_headline(get_string('newsubmissions', 'assignment') . ':');
        foreach ($meetings as $meeting) {
            print_recent_activity_note($meeting->time, $meeting, $isteacher, stripslashes($meeting->name), $CFG->wwwroot . '/mod/elluminate/' . $meeting->url);
        }
        $content = true;
    }
    return $content;
}
开发者ID:nadavkav,项目名称:Moodle2-Hebrew-plugins,代码行数:38,代码来源:lib.php


示例3: dialogue_print_recent_activity

/**
 * Prints any recent dialogue activity since a given time
 * @param   object  $course
 * @param   bool    $viewfullnames capability
 * @param   timestamp   $timestart
 * @return  bool    success
 */
function dialogue_print_recent_activity($course, $viewfullnames, $timestart)
{
    global $CFG;
    // have a look for new entries
    $addentrycontent = false;
    $tempmod = new object();
    // Create a temp valid module structure (only need courseid, moduleid)
    $tempmod->course = $course->id;
    if ($logs = dialogue_get_add_entry_logs($course, $timestart)) {
        // got some, see if any belong to a visible module
        foreach ($logs as $log) {
            $tempmod->id = $log->dialogueid;
            //Obtain the visible property from the instance
            if (instance_is_visible('dialogue', $tempmod)) {
                $addentrycontent = true;
                break;
            }
        }
        // if we got some "live" ones then output them
        if ($addentrycontent) {
            print_headline(get_string('newdialogueentries', 'dialogue') . ':');
            foreach ($logs as $log) {
                $tempmod->id = $log->dialogueid;
                $user = get_record('user', 'id', $log->userid);
                //Obtain the visible property from the instance
                if (instance_is_visible('dialogue', $tempmod)) {
                    print_recent_activity_note($log->time, $user, $log->subject, $CFG->wwwroot . '/mod/dialogue/' . str_replace('&', '&', $log->url));
                }
            }
        }
    }
    // have a look for open conversations
    $opencontent = false;
    if ($logs = dialogue_get_open_conversations($course)) {
        // got some, see if any belong to a visible module
        foreach ($logs as $log) {
            // Create a temp valid module structure (only need courseid, moduleid)
            $tempmod->id = $log->dialogueid;
            //Obtain the visible property from the instance
            if (instance_is_visible('dialogue', $tempmod)) {
                $opencontent = true;
                break;
            }
        }
        // if we got some 'live' ones then output them
        if ($opencontent) {
            print_headline(get_string('opendialogueentries', 'dialogue') . ':');
            foreach ($logs as $log) {
                //Create a temp valid module structure (only need courseid, moduleid)
                $tempmod->id = $log->dialogueid;
                $user = get_record('user', 'id', $log->userid);
                //Obtain the visible property from the instance
                if (instance_is_visible('dialogue', $tempmod)) {
                    print_recent_activity_note($log->time, $user, $log->name, $CFG->wwwroot . '/mod/dialogue/' . str_replace('&', '&', $log->url));
                }
            }
        }
    }
    return $addentrycontent or $opencontent;
}
开发者ID:netspotau,项目名称:moodle-mod_dialogue,代码行数:67,代码来源:lib.php


示例4: survey_print_recent_activity

/**
 * @global stdClass
 * @global object
 * @param object $course
 * @param mixed $viewfullnames
 * @param int $timestamp
 * @return bool
 */
function survey_print_recent_activity($course, $viewfullnames, $timestart) {
    global $CFG, $DB, $OUTPUT;

    $modinfo = get_fast_modinfo($course);
    $ids = array();
    foreach ($modinfo->cms as $cm) {
        if ($cm->modname != 'survey') {
            continue;
        }
        if (!$cm->uservisible) {
            continue;
        }
        $ids[$cm->instance] = $cm->instance;
    }

    if (!$ids) {
        return false;
    }

    $slist = implode(',', $ids); // there should not be hundreds of glossaries in one course, right?

    $allusernames = user_picture::fields('u');
    $rs = $DB->get_recordset_sql("SELECT sa.userid, sa.survey, MAX(sa.time) AS time,
                                         $allusernames
                                    FROM {survey_answers} sa
                                    JOIN {user} u ON u.id = sa.userid
                                   WHERE sa.survey IN ($slist) AND sa.time > ?
                                GROUP BY sa.userid, sa.survey, $allusernames
                                ORDER BY time ASC", array($timestart));
    if (!$rs->valid()) {
        $rs->close(); // Not going to iterate (but exit), close rs
        return false;
    }

    $surveys = array();

    foreach ($rs as $survey) {
        $cm = $modinfo->instances['survey'][$survey->survey];
        $survey->name = $cm->name;
        $survey->cmid = $cm->id;
        $surveys[] = $survey;
    }
    $rs->close();

    if (!$surveys) {
        return false;
    }

    echo $OUTPUT->heading(get_string('newsurveyresponses', 'survey').':', 3);
    foreach ($surveys as $survey) {
        $url = $CFG->wwwroot.'/mod/survey/view.php?id='.$survey->cmid;
        print_recent_activity_note($survey->time, $survey, $survey->name, $url, false, $viewfullnames);
    }

    return true;
}
开发者ID:nitinnagaraja,项目名称:moodle,代码行数:64,代码来源:lib.php


示例5: wiki_print_recent_activity

/**
 * Given a course and a time, this module should find recent activity
 * that has occurred in wiki activities and print it out.
 * Return true if there was output, or false is there was none.
 *
 * @global stdClass
 * @global object
 * @param object $course
 * @param bool $isteacher
 * @param int $timestart
 * @return bool
 */
function wiki_print_recent_activity($course, $isteacher, $timestart)
{
    global $CFG, $DB, $OUTPUT;
    $sql = "SELECT l.*, cm.instance\n              FROM {log} l JOIN {course_modules} cm ON l.cmid = cm.id \n             WHERE l.time > ? AND l.course = ? \n                   AND l.module = 'wiki' AND action LIKE 'edit%'\n          ORDER BY l.time ASC";
    if (!($logs = $DB->get_records_sql($sql, array($timestart, $course->id)))) {
        return false;
    }
    $modinfo = get_fast_modinfo($course);
    $wikis = array();
    foreach ($logs as $log) {
        $cm = $modinfo->instances['wiki'][$log->instance];
        if (!$cm->uservisible) {
            continue;
        }
        /// Process log->url and rebuild it here to properly clean the pagename - MDL-15896
        $extractedpage = preg_replace('/^.*&page=/', '', $log->url);
        $log->url = preg_replace('/page=.*$/', 'page=' . urlencode($extractedpage), $log->url);
        $wikis[$log->info] = wiki_log_info($log);
        $wikis[$log->info]->pagename = $log->info;
        $wikis[$log->info]->time = $log->time;
        $wikis[$log->info]->url = str_replace('&', '&', $log->url);
    }
    if (!$wikis) {
        return false;
    }
    echo $OUTPUT->heading(get_string("updatedwikipages", 'wiki') . ':', 3);
    foreach ($wikis as $wiki) {
        print_recent_activity_note($wiki->time, $wiki, $wiki->pagename, $CFG->wwwroot . '/mod/wiki/' . $wiki->url);
    }
    return false;
}
开发者ID:ajv,项目名称:Offline-Caching,代码行数:43,代码来源:lib.php


示例6: workshop_print_recent_activity

function workshop_print_recent_activity($course, $viewfullanmes, $timestart)
{
    global $CFG;
    $isteacher = has_capability('mod/workshop:manage', get_context_instance(CONTEXT_COURSE, $course->id));
    $modinfo = get_fast_modinfo($course);
    // have a look for agreed assessments for this user (agree)
    $agreecontent = false;
    if (!$isteacher) {
        // teachers only need to see submissions
        if ($logs = workshop_get_agree_logs($course, $timestart)) {
            $agreecontent = true;
            print_headline(get_string("workshopagreedassessments", "workshop") . ":");
            foreach ($logs as $log) {
                if (!workshop_is_teacher($workshop, $log->userid)) {
                    // don't break anonymous rule
                    $log->firstname = $course->student;
                    $log->lastname = '';
                }
                print_recent_activity_note($log->time, $log, $log->name, $CFG->wwwroot . '/mod/workshop/' . $log->url);
            }
        }
    }
    // have a look for new assessments for this user (assess)
    $assesscontent = false;
    if (!$isteacher) {
        // teachers only need to see submissions
        if ($logs = workshop_get_assess_logs($course, $timestart)) {
            // got some, see if any belong to a visible module
            foreach ($logs as $id => $log) {
                $cm = $modinfo->instances['workshop'][$log->workshopid];
                if (!$cm->uservisible) {
                    unset($logs[$id]);
                    continue;
                }
            }
            // if we got some "live" ones then output them
            if ($logs) {
                $assesscontent = true;
                print_headline(get_string("workshopassessments", "workshop") . ":");
                foreach ($logs as $log) {
                    if (!workshop_is_teacher($tempmod->id, $log->userid)) {
                        // don't break anonymous rule
                        $log->firstname = $course->student;
                        // Keep anonymous
                        $log->lastname = '';
                    }
                    print_recent_activity_note($log->time, $log, $log->name, $CFG->wwwroot . '/mod/workshop/' . $log->url);
                }
            }
        }
    }
    // have a look for new comments for this user (comment)
    $commentcontent = false;
    if (!$isteacher) {
        // teachers only need to see submissions
        if ($logs = workshop_get_comment_logs($course, $timestart)) {
            // got some, see if any belong to a visible module
            foreach ($logs as $id => $log) {
                $cm = $modinfo->instances['workshop'][$log->workshopid];
                if (!$cm->uservisible) {
                    unset($logs[$id]);
                    continue;
                }
            }
            // if we got some "live" ones then output them
            if ($logs) {
                $commentcontent = true;
                print_headline(get_string("workshopcomments", "workshop") . ":");
                foreach ($logs as $log) {
                    $log->firstname = $course->student;
                    // Keep anonymous
                    $log->lastname = '';
                    print_recent_activity_note($log->time, $log, $log->name, $CFG->wwwroot . '/mod/workshop/' . $log->url);
                }
            }
        }
    }
    // have a look for new assessment gradings for this user (grade)
    $gradecontent = false;
    if ($logs = workshop_get_grade_logs($course, $timestart)) {
        // got some, see if any belong to a visible module
        foreach ($logs as $id => $log) {
            $cm = $modinfo->instances['workshop'][$log->workshopid];
            if (!$cm->uservisible) {
                unset($logs[$id]);
                continue;
            }
        }
        // if we got some "live" ones then output them
        if ($logs) {
            $gradecontent = true;
            print_headline(get_string("workshopfeedback", "workshop") . ":");
            foreach ($logs as $log) {
                $log->firstname = $course->teacher;
                // Keep anonymous
                $log->lastname = '';
                print_recent_activity_note($log->time, $log, $log->name, $CFG->wwwroot . '/mod/workshop/' . $log->url);
            }
        }
    }
//.........这里部分代码省略.........
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:101,代码来源:lib.php


示例7: assignment_print_recent_activity

/**
 * Print recent activity from all assignments in a given course
 *
 * This is used by the recent activity block
 */
function assignment_print_recent_activity($course, $viewfullnames, $timestart) {
    global $CFG, $USER, $DB, $OUTPUT;

    // do not use log table if possible, it may be huge

    if (!$submissions = $DB->get_records_sql("SELECT asb.id, asb.timemodified, cm.id AS cmid, asb.userid,
                                                     u.firstname, u.lastname, u.email, u.picture
                                                FROM {assignment_submissions} asb
                                                     JOIN {assignment} a      ON a.id = asb.assignment
                                                     JOIN {course_modules} cm ON cm.instance = a.id
                                                     JOIN {modules} md        ON md.id = cm.module
                                                     JOIN {user} u            ON u.id = asb.userid
                                               WHERE asb.timemodified > ? AND
                                                     a.course = ? AND
                                                     md.name = 'assignment'
                                            ORDER BY asb.timemodified ASC", array($timestart, $course->id))) {
         return false;
    }

    $modinfo =& get_fast_modinfo($course); // reference needed because we might load the groups
    $show    = array();
    $grader  = array();

    foreach($submissions as $submission) {
        if (!array_key_exists($submission->cmid, $modinfo->cms)) {
            continue;
        }
        $cm = $modinfo->cms[$submission->cmid];
        if (!$cm->uservisible) {
            continue;
        }
        if ($submission->userid == $USER->id) {
            $show[] = $submission;
            continue;
        }

        // the act of sumbitting of assignment may be considered private - only graders will see it if specified
        if (empty($CFG->assignment_showrecentsubmissions)) {
            if (!array_key_exists($cm->id, $grader)) {
                $grader[$cm->id] = has_capability('moodle/grade:viewall', get_context_instance(CONTEXT_MODULE, $cm->id));
            }
            if (!$grader[$cm->id]) {
                continue;
            }
        }

        $groupmode = groups_get_activity_groupmode($cm, $course);

        if ($groupmode == SEPARATEGROUPS and !has_capability('moodle/site:accessallgroups', get_context_instance(CONTEXT_MODULE, $cm->id))) {
            if (isguestuser()) {
                // shortcut - guest user does not belong into any group
                continue;
            }

            if (is_null($modinfo->groups)) {
                $modinfo->groups = groups_get_user_groups($course->id); // load all my groups and cache it in modinfo
            }

            // this will be slow - show only users that share group with me in this cm
            if (empty($modinfo->groups[$cm->id])) {
                continue;
            }
            $usersgroups =  groups_get_all_groups($course->id, $submission->userid, $cm->groupingid);
            if (is_array($usersgroups)) {
                $usersgroups = array_keys($usersgroups);
                $intersect = array_intersect($usersgroups, $modinfo->groups[$cm->id]);
                if (empty($intersect)) {
                    continue;
                }
            }
        }
        $show[] = $submission;
    }

    if (empty($show)) {
        return false;
    }

    echo $OUTPUT->heading(get_string('newsubmissions', 'assignment').':', 3);

    foreach ($show as $submission) {
        $cm = $modinfo->cms[$submission->cmid];
        $link = $CFG->wwwroot.'/mod/assignment/view.php?id='.$cm->id;
        print_recent_activity_note($submission->timemodified, $submission, $cm->name, $link, false, $viewfullnames);
    }

    return true;
}
开发者ID:nuckey,项目名称:moodle,代码行数:93,代码来源:lib.php


示例8: wiki_print_recent_activity

function wiki_print_recent_activity($course, $isteacher, $timestart)
{
    /// Given a course and a time, this module should find recent activity
    /// that has occurred in wiki activities and print it out.
    /// Return true if there was output, or false is there was none.
    global $CFG;
    $sql = "SELECT l.*, cm.instance FROM {$CFG->prefix}log l \n                INNER JOIN {$CFG->prefix}course_modules cm ON l.cmid = cm.id \n            WHERE l.time > '{$timestart}' AND l.course = {$course->id} \n                AND l.module = 'wiki' AND action LIKE 'edit%'\n            ORDER BY l.time ASC";
    if (!($logs = get_records_sql($sql))) {
        return false;
    }
    foreach ($logs as $log) {
        //Create a temp valid module structure (course,id)
        $tempmod = new Object();
        $tempmod->course = $log->course;
        $tempmod->id = $log->instance;
        //Obtain the visible property from the instance
        $modvisible = instance_is_visible($log->module, $tempmod);
        //Only if the mod is visible
        if ($modvisible) {
            $wikis[$log->info] = wiki_log_info($log);
            $wikis[$log->info]->pagename = $log->info;
            $wikis[$log->info]->time = $log->time;
            $wikis[$log->info]->url = str_replace('&', '&', $log->url);
        }
    }
    if (isset($wikis)) {
        $content = true;
        print_headline(get_string('updatedwikipages', 'wiki') . ':', 3);
        foreach ($wikis as $wiki) {
            print_recent_activity_note($wiki->time, $wiki, $wiki->pagename, $CFG->wwwroot . '/mod/wiki/' . $wiki->url);
        }
    }
    return true;
    //  True if anything was printed, otherwise false
}
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:35,代码来源:lib.php


示例9: exercise_print_recent_activity

function exercise_print_recent_activity($course, $viewfullanmes, $timestart)
{
    global $CFG;
    $isteacher = has_capability('mod/exercise:assess', get_context_instance(CONTEXT_COURSE, $course->id));
    $modinfo = get_fast_modinfo($course);
    // have a look for new submissions (only show to teachers)
    $submitcontent = false;
    if ($isteacher) {
        if ($logs = exercise_get_submit_logs($course, $timestart)) {
            // if we got some 'live' ones then output them
            $submitcontent = true;
            print_headline(get_string('exercisesubmissions', 'exercise') . ':');
            foreach ($logs as $log) {
                print_recent_activity_note($log->time, $log, $log->name, $CFG->wwwroot . '/mod/exercise/' . str_replace('&', '&', $log->url));
            }
        }
    }
    // have a look for new assessment gradings for this user
    $gradecontent = false;
    if ($logs = exercise_get_grade_logs($course, $timestart)) {
        // got some, see if any belong to a visible module
        foreach ($logs as $id => $log) {
            $cm = $modinfo->instances['exercise'][$log->exerciseid];
            if (!$cm->uservisible) {
                unset($logs[$id]);
                continue;
            }
        }
        // if we got some "live" ones then output them
        if ($logs) {
            $gradecontent = true;
            print_headline(get_string('exercisefeedback', 'exercise') . ':');
            foreach ($logs as $log) {
                print_recent_activity_note($log->time, $log, $log->name, $CFG->wwwroot . '/mod/exercise/' . str_replace('&', '&', $log->url));
            }
        }
    }
    // have a look for new assessments for this user
    $assesscontent = false;
    if (!$isteacher) {
        // teachers only need to see submissions
        if ($logs = exercise_get_assess_logs($course, $timestart)) {
            // got some, see if any belong to a visible module
            foreach ($logs as $id => $log) {
                $cm = $modinfo->instances['exercise'][$log->exerciseid];
                if (!$cm->uservisible) {
                    unset($logs[$id]);
                    continue;
                }
            }
            // if we got some "live" ones then output them
            if ($logs) {
                $assesscontent = true;
                print_headline(get_string('exerciseassessments', 'exercise') . ':');
                foreach ($logs as $log) {
                    print_recent_activity_note($log->time, $log, $log->name, $CFG->wwwroot . '/mod/exercise/' . str_replace('&', '&', $log->url));
                }
            }
        }
    }
    return $submitcontent or $gradecontent or $assesscontent;
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:62,代码来源:lib.php


示例10: wiki_print_recent_activity

function wiki_print_recent_activity($course, $isteacher, $timestart)
{
    /// Given a course and a time, this module should find recent activity
    /// that has occurred in wiki activities and print it out.
    /// Return true if there was output, or false is there was none.
    global $CFG;
    if (!($logs = get_records_select('log', 'time > \'' . $timestart . '\' AND ' . 'course = \'' . $course->id . '\' AND ' . 'module = \'wiki\' AND ' . 'action LIKE \'edit%\' ', 'time ASC'))) {
        return false;
    }
    foreach ($logs as $log) {
        //Create a temp valid module structure (course,id)
        $tempmod = new Object();
        $tempmod->course = $log->course;
        $tempmod->id = $log->cmid;
        //Obtain the visible property from the instance
        $modvisible = instance_is_visible($log->module, $tempmod);
        /// Process log->url and rebuild it here to properly clean the pagename - MDL-15896
        $extractedpage = preg_replace('/^.*&page=/', '', $log->url);
        $log->url = preg_replace('/page=.*$/', 'page=' . urlencode($extractedpage), $log->url);
        //Only if the mod is visible
        if ($modvisible) {
            $wikis[$log->info] = wiki_log_info($log);
            $wikis[$log->info]->pagename = $log->info;
            $wikis[$log->info]->time = $log->time;
            $wikis[$log->info]->url = str_replace('&', '&', $log->url);
        }
    }
    if ($wikis) {
        $content = true;
        print_headline(get_string('updatedwikipages', 'wiki') . ':', 3);
        foreach ($wikis as $wiki) {
            print_recent_activity_note($wiki->time, $wiki, $wiki->pagename, $CFG->wwwroot . '/mod/wiki/' . $wiki->url);
        }
    }
    return true;
    //  True if anything was printed, otherwise false
}
开发者ID:veritech,项目名称:pare-project,代码行数:37,代码来源:lib.php


示例11: survey_print_recent_activity

function survey_print_recent_activity($course, $isteacher, $timestart)
{
    global $CFG;
    $content = false;
    $surveys = NULL;
    if (!($logs = get_records_select('log', 'time > \'' . $timestart . '\' AND ' . 'course = \'' . $course->id . '\' AND ' . 'module = \'survey\' AND ' . 'action = \'submit\' ', 'time ASC'))) {
        return false;
    }
    foreach ($logs as $log) {
        //Create a temp valid module structure (course,id)
        $tempmod->course = $log->course;
        $tempmod->id = $log->info;
        //Obtain the visible property from the instance
        $modvisible = instance_is_visible($log->module, $tempmod);
        //Only if the mod is visible
        if ($modvisible) {
            $surveys[$log->id] = survey_log_info($log);
            $surveys[$log->id]->time = $log->time;
            $surveys[$log->id]->url = str_replace('&', '&', $log->url);
        }
    }
    if ($surveys) {
        $content = true;
        print_headline(get_string('newsurveyresponses', 'survey') . ':');
        foreach ($surveys as $survey) {
            print_recent_activity_note($survey->time, $survey, $survey->name, $CFG->wwwroot . '/mod/survey/' . $survey->url);
        }
    }
    return $content;
}
开发者ID:veritech,项目名称:pare-project,代码行数:30,代码来源:lib.php


示例12: teamwork_print_recent_activity


//.........这里部分代码省略.........
                            $authorsgroups = array_keys($authorsgroups);
                            $intersect = array_intersect($authorsgroups, $modinfo->get_groups($cm->groupingid));
                            if (empty($intersect)) {
                                break;
                            } else {
                                // can see all submissions and shares a group with the author
                                $submissions[$activity->submissionid] = $s;
                                break;
                            }
                        }
                    } else {
                        // can see all submissions from all groups
                        $submissions[$activity->submissionid] = $s;
                    }
                }
            } while (0);
        }
        if ($activity->assessmentmodified > $timestart and empty($assessments[$activity->assessmentid])) {
            $a = new stdclass();
            $a->submissionid = $activity->submissionid;
            $a->submissiontitle = $activity->submissiontitle;
            $a->reviewerid = $activity->reviewerid;
            $a->timemodified = $activity->assessmentmodified;
            $a->cmid = $activity->cmid;
            if ($activity->reviewerid == $USER->id || has_capability('mod/teamwork:viewreviewernames', $context)) {
                $a->reviewernamevisible = true;
            } else {
                $a->reviewernamevisible = false;
            }
            // the following do-while wrapper allows to break from deeply nested if-statements
            do {
                if ($a->reviewerid === $USER->id) {
                    // own assessments always visible
                    $assessments[$activity->assessmentid] = $a;
                    break;
                }
                if (has_capability('mod/teamwork:viewallassessments', $context)) {
                    if ($groupmode == SEPARATEGROUPS and !has_capability('moodle/site:accessallgroups', $context)) {
                        if (isguestuser()) {
                            // shortcut - guest user does not belong into any group
                            break;
                        }
                        // this might be slow - show only submissions by users who share group with me in this cm
                        if (!$modinfo->get_groups($cm->groupingid)) {
                            break;
                        }
                        $reviewersgroups = groups_get_all_groups($course->id, $a->reviewerid, $cm->groupingid);
                        if (is_array($reviewersgroups)) {
                            $reviewersgroups = array_keys($reviewersgroups);
                            $intersect = array_intersect($reviewersgroups, $modinfo->get_groups($cm->groupingid));
                            if (empty($intersect)) {
                                break;
                            } else {
                                // can see all assessments and shares a group with the reviewer
                                $assessments[$activity->assessmentid] = $a;
                                break;
                            }
                        }
                    } else {
                        // can see all assessments from all groups
                        $assessments[$activity->assessmentid] = $a;
                    }
                }
            } while (0);
        }
    }
    $rs->close();
    $shown = false;
    if (!empty($submissions)) {
        $shown = true;
        echo $OUTPUT->heading(get_string('recentsubmissions', 'teamwork'), 3);
        foreach ($submissions as $id => $submission) {
            $link = new moodle_url('/mod/teamwork/submission.php', array('id' => $id, 'cmid' => $submission->cmid));
            if ($submission->authornamevisible) {
                $author = $users[$submission->authorid];
            } else {
                $author = null;
            }
            print_recent_activity_note($submission->timemodified, $author, $submission->title, $link->out(), false, $viewfullnames);
        }
    }
    if (!empty($assessments)) {
        $shown = true;
        echo $OUTPUT->heading(get_string('recentassessments', 'teamwork'), 3);
        core_collator::asort_objects_by_property($assessments, 'timemodified');
        foreach ($assessments as $id => $assessment) {
            $link = new moodle_url('/mod/teamwork/assessment.php', array('asid' => $id));
            if ($assessment->reviewernamevisible) {
                $reviewer = $users[$assessment->reviewerid];
            } else {
                $reviewer = null;
            }
            print_recent_activity_note($assessment->timemodified, $reviewer, $assessment->submissiontitle, $link->out(), false, $viewfullnames);
        }
    }
    if ($shown) {
        return true;
    }
    return false;
}
开发者ID:Gavinthisisit,项目名称:Moodle,代码行数:101,代码来源:lib.php


示例13: journal_print_recent_activity

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;
}
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:38,代码来源:lib.php


示例14: workshop_print_recent_activity


//.........这里部分代码省略.........
                    }
                }
            } while (0);
        }

        if ($activity->assessmentmodified > $timestart and empty($assessments[$activity->assessmentid])) {
            $a = new stdclass();
            $a->submissionid = $activity->submissionid;
            $a->submissiontitle = $activity->submissiontitle;
            $a->reviewerid = $activity->reviewerid;
            $a->timemodified = $activity->assessmentmodified;
            $a->cmid = $activity->cmid;
            if (has_capability('mod/workshop:viewreviewernames', $context)) {
                $a->reviewernamevisible = true;
            } else {
                $a->reviewernamevisible = false;
            }

            // the following do-while wrapper allows to break from deeply nested if-statements
            do {
                if ($a->reviewerid === $USER->id) {
                    // own assessments always visible
                    $assessments[$activity->assessmentid] = $a;
                    break;
                }

                if (has_capability('mod/workshop:viewallassessments', $context)) {
                    if ($groupmode == SEPARATEGROUPS and !has_capability('moodle/site:accessallgroups', $context)) {
                        if (isguestuser()) {
                            // shortcut - guest user does not belong into any group
                            break;
                        }

                        if (is_null($modinfo->groups)) {
                            $modinfo->groups = groups_get_user_groups($course->id); // load all my groups and cache it in modinfo
                        }

                        // this might be slow - show only submissions by users who share group with me in this cm
                        if (empty($modinfo->groups[$cm->id])) {
                            break;
                        }
                        $reviewersgroups = groups_get_all_groups($course->id, $a->reviewerid, $cm->groupingid);
                        if (is_array($reviewersgroups)) {
                            $reviewersgroups = array_keys($reviewersgroups);
                            $intersect = array_intersect($reviewersgroups, $modinfo->groups[$cm->id]);
                            if (empty($intersect)) {
                                break;
                            } else {
                                // can see all assessments and shares a group with the reviewer
                                $assessments[$activity->assessmentid] = $a;
                                break;
                            }
                        }

                    } else {
                        // can see all assessments from all groups
                        $assessments[$activity->assessmentid] = $a;
                    }
                }
            } while (0);
        }
    }
    $rs->close();

    $shown = false;

    if (!empty($submissions)) {
        $shown = true;
        echo $OUTPUT->heading(get_string('recentsubmissions', 'workshop'), 3);
        foreach ($submissions as $id => $submission) {
            $link = new moodle_url('/mod/workshop/submission.php', array('id'=>$id, 'cmid'=>$submission->cmid));
            if ($viewfullnames and $submission->authornamevisible) {
                $author = $users[$submission->authorid];
            } else {
                $author = null;
            }
            print_recent_activity_note($submission->timemodified, $author, $submission->title, $link->out(), false, $viewfullnames);
        }
    }

    if (!empty($assessments)) {
        $shown = true;
        echo $OUTPUT->heading(get_string('recentassessments', 'workshop'), 3);
        foreach ($assessments as $id => $assessment) {
            $link = new moodle_url('/mod/workshop/assessment.php', array('asid' => $id));
            if ($viewfullnames and $assessment->reviewernamevisible) {
                $reviewer = $users[$assessment->reviewerid];
            } else {
                $reviewer = null;
            }
            print_recent_activity_note($assessment->timemodified, $reviewer, $assessment->submissiontitle, $link->out(), false, $viewfullnames);
        }
    }

    if ($shown) {
        return true;
    }

    return false;
}
开发者ID:ncsu-delta,项目名称:moodle,代码行数:101,代码来源:lib.php


示例15: journal_print_recent_activity

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;
}
开发者ID:e-rasvet,项目名称:journal,

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP print_remote_course函数代码示例发布时间:2022-05-15
下一篇:
PHP print_radio_row函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap