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

PHP print_headline函数代码示例

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

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



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

示例1: 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;
    }
    $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;
    }
    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 false;
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:34,代码来源:lib.php


示例2: 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, $isteacher, $timestart)
{
    global $CFG;
    $content = false;
    $assignments = array();
    if (!($logs = get_records_select('log', 'time > \'' . $timestart . '\' AND ' . 'course = \'' . $course->id . '\' AND ' . 'module = \'assignment\' AND ' . 'action = \'upload\' ', '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->info;
        //Obtain the visible property from the instance
        $modvisible = instance_is_visible($log->module, $tempmod);
        //Only if the mod is visible
        if ($modvisible) {
            if ($info = assignment_log_info($log)) {
                $assignments[$log->info] = $info;
                $assignments[$log->info]->time = $log->time;
                $assignments[$log->info]->url = str_replace('&', '&', $log->url);
            }
        }
    }
    if (!empty($assignments)) {
        print_headline(get_string('newsubmissions', 'assignment') . ':');
        foreach ($assignments as $assignment) {
            print_recent_activity_note($assignment->time, $assignment, $assignment->name, $CFG->wwwroot . '/mod/assignment/' . $assignment->url);
        }
        $content = true;
    }
    return $content;
}
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:38,代码来源:lib.php


示例3: workshop_print_recent_activity

function workshop_print_recent_activity($course, $isteacher, $timestart)
{
    global $CFG;
    // 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)) {
            // 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->course = $course->id;
                $tempmod->id = $log->workshopid;
                //Obtain the visible property from the instance
                if (instance_is_visible("workshop", $tempmod)) {
                    $agreecontent = true;
                    break;
                }
            }
            // if we got some "live" ones then output them
            if ($agreecontent) {
                print_headline(get_string("workshopagreedassessments", "workshop") . ":");
                foreach ($logs as $log) {
                    //Create a temp valid module structure (only need courseid, moduleid)
                    $tempmod->course = $course->id;
                    $tempmod->id = $log->workshopid;
                    //Obtain the visible property from the instance
                    if (instance_is_visible("workshop", $tempmod)) {
                        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 $log) {
                // Create a temp valid module structure (only need courseid, moduleid)
                $tempmod->course = $course->id;
                $tempmod->id = $log->workshopid;
                //Obtain the visible property from the instance
                if (instance_is_visible("workshop", $tempmod)) {
                    $assesscontent = true;
                    break;
                }
            }
            // if we got some "live" ones then output them
            if ($assesscontent) {
                print_headline(get_string("workshopassessments", "workshop") . ":");
                foreach ($logs as $log) {
                    //Create a temp valid module structure (only need courseid, moduleid)
                    $tempmod->course = $course->id;
                    $tempmod->id = $log->workshopid;
                    //Obtain the visible property from the instance
                    if (instance_is_visible("workshop", $tempmod)) {
                        if (!workshop_is_teacher($tempmod->id, $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 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 $log) {
                // Create a temp valid module structure (only need courseid, moduleid)
                $tempmod->course = $course->id;
                $tempmod->id = $log->workshopid;
                //Obtain the visible property from the instance
                if (instance_is_visible("workshop", $tempmod)) {
                    $commentcontent = true;
                    break;
                }
            }
            // if we got some "live" ones then output them
            if ($commentcontent) {
                print_headline(get_string("workshopcomments", "workshop") . ":");
                foreach ($logs as $log) {
                    //Create a temp valid module structure (only need courseid, moduleid)
                    $tempmod->course = $course->id;
                    $tempmod->id = $log->workshopid;
                    //Obtain the visible property from the instance
                    if (instance_is_visible("workshop", $tempmod)) {
//.........这里部分代码省略.........
开发者ID:veritech,项目名称:pare-project,代码行数:101,代码来源:lib.php


示例4: hotpot_print_recent_activity

function hotpot_print_recent_activity($course, $isteacher, $timestart)
{
    /// Given a course and a time, this module should find recent activity
    /// that has occurred in hotpot activities and print it out.
    /// Return true if there was output, or false is there was none.
    global $CFG;
    $result = false;
    $records = get_records_sql("\n        SELECT\n            h.id AS id,\n            h.name AS name,\n            COUNT(*) AS count_attempts\n        FROM\n            {$CFG->prefix}hotpot h,\n            {$CFG->prefix}hotpot_attempts a\n        WHERE\n            h.course = {$course->id}\n            AND h.id = a.hotpot\n            AND a.id = a.clickreportid\n            AND a.starttime > {$timestart}\n        GROUP BY\n            h.id, h.name\n    ");
    // note that PostGreSQL requires h.name in the GROUP BY clause
    if ($records) {
        $names = array();
        foreach ($records as $id => $record) {
            if ($cm = get_coursemodule_from_instance('hotpot', $record->id, $course->id)) {
                $context = get_context_instance(CONTEXT_MODULE, $cm->id);
                if (has_capability('mod/hotpot:viewreport', $context)) {
                    $href = "{$CFG->wwwroot}/mod/hotpot/view.php?hp={$id}";
                    $name = '&nbsp;<a href="' . $href . '">' . $record->name . '</a>';
                    if ($record->count_attempts > 1) {
                        $name .= " ({$record->count_attempts})";
                    }
                    $names[] = $name;
                }
            }
        }
        if (count($names) > 0) {
            print_headline(get_string('modulenameplural', 'hotpot') . ':');
            if ($CFG->version >= 2005050500) {
                // Moodle 1.5+
                echo '<div class="head"><div class="name">' . implode('<br />', $names) . '</div></div>';
            } else {
                // Moodle 1.4.x (or less)
                echo '<font size="1">' . implode('<br />', $names) . '</font>';
            }
            $result = true;
        }
    }
    return $result;
    //  True if anything was printed, otherwise false
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:39,代码来源:lib.php


示例5: 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;
    // do not use log table if possible, it may be huge
    if (!($submissions = get_records_sql("SELECT asb.id, asb.timemodified, cm.id AS cmid, asb.userid,\n                                                u.firstname, u.lastname, u.email, u.picture\n                                           FROM {$CFG->prefix}assignment_submissions asb\n                                                JOIN {$CFG->prefix}assignment a      ON a.id = asb.assignment\n                                                JOIN {$CFG->prefix}course_modules cm ON cm.instance = a.id\n                                                JOIN {$CFG->prefix}modules md        ON md.id = cm.module\n                                                JOIN {$CFG->prefix}user u            ON u.id = asb.userid\n                                          WHERE asb.timemodified > {$timestart} AND\n                                                a.course = {$course->id} AND\n                                                md.name = 'assignment'\n                                       ORDER BY asb.timemodified ASC"))) {
        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, $cm->userid, $cm->groupingid);
            if (is_array($usersgroups)) {
                $usersgroups = array_keys($usersgroups);
                $interset = array_intersect($usersgroups, $modinfo->groups[$cm->id]);
                if (empty($intersect)) {
                    continue;
                }
            }
        }
        $show[] = $submission;
    }
    if (empty($show)) {
        return false;
    }
    print_headline(get_string('newsubmissions', 'assignment') . ':');
    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:nadavkav,项目名称:MoodleTAO,代码行数:73,代码来源:lib.php


示例6: 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('&', '&amp;', $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


示例7: forum_print_recent_activity

/**
 * Given a course and a date, prints a summary of all the new
 * messages posted in the course since that date
 * @param object $course
 * @param bool $viewfullnames capability
 * @param int $timestart
 * @return bool success
 */
function forum_print_recent_activity($course, $viewfullnames, $timestart)
{
    global $CFG, $USER;
    // do not use log table if possible, it may be huge and is expensive to join with other tables
    if (!($posts = get_records_sql("SELECT p.*, f.type AS forumtype, d.forum, d.groupid,\n                                          d.timestart, d.timeend, d.userid AS duserid,\n                                          u.firstname, u.lastname, u.email, u.picture\n                                     FROM {$CFG->prefix}forum_posts p\n                                          JOIN {$CFG->prefix}forum_discussions d ON d.id = p.discussion\n                                          JOIN {$CFG->prefix}forum f             ON f.id = d.forum\n                                          JOIN {$CFG->prefix}user u              ON u.id = p.userid\n                                    WHERE p.created > {$timestart} AND f.course = {$course->id}\n                                 ORDER BY p.id ASC"))) {
        // order by initial posting date
        return false;
    }
    $modinfo =& get_fast_modinfo($course);
    $groupmodes = array();
    $cms = array();
    $strftimerecent = get_string('strftimerecent');
    $printposts = array();
    foreach ($posts as $post) {
        if (!isset($modinfo->instances['forum'][$post->forum])) {
            // not visible
            continue;
        }
        $cm = $modinfo->instances['forum'][$post->forum];
        if (!$cm->uservisible) {
            continue;
        }
        $context = get_context_instance(CONTEXT_MODULE, $cm->id);
        if (!has_capability('mod/forum:viewdiscussion', $context)) {
            continue;
        }
        if (!empty($CFG->forum_enabletimedposts) and $USER->id != $post->duserid and ($post->timestart > 0 and $post->timestart > time() or $post->timeend > 0 and $post->timeend < time())) {
            if (!has_capability('mod/forum:viewhiddentimedposts', $context)) {
                continue;
            }
        }
        $groupmode = groups_get_activity_groupmode($cm, $course);
        if ($groupmode) {
            if ($post->groupid == -1 or $groupmode == VISIBLEGROUPS or has_capability('moodle/site:accessallgroups', $context)) {
                // oki (Open discussions have groupid -1)
            } else {
                // separate mode
                if (isguestuser()) {
                    // shortcut
                    continue;
                }
                if (is_null($modinfo->groups)) {
                    $modinfo->groups = groups_get_user_groups($course->id);
                    // load all my groups and cache it in modinfo
                }
                if (!array_key_exists($post->groupid, $modinfo->groups[0])) {
                    continue;
                }
            }
        }
        $printposts[] = $post;
    }
    unset($posts);
    if (!$printposts) {
        return false;
    }
    print_headline(get_string('newforumposts', 'forum') . ':', 3);
    echo "\n<ul class='unlist'>\n";
    foreach ($printposts as $post) {
        $subjectclass = empty($post->parent) ? ' bold' : '';
        echo '<li><div class="head">' . '<div class="date">' . userdate($post->modified, $strftimerecent) . '</div>' . '<div class="name">' . fullname($post, $viewfullnames) . '</div>' . '</div>';
        echo '<div class="info' . $subjectclass . '">';
        if (empty($post->parent)) {
            echo '"<a href="' . $CFG->wwwroot . '/mod/forum/discuss.php?d=' . $post->discussion . '">';
        } else {
            echo '"<a href="' . $CFG->wwwroot . '/mod/forum/discuss.php?d=' . $post->discussion . '&amp;parent=' . $post->parent . '#p' . $post->id . '">';
        }
        $post->subject = break_up_long_words(format_string($post->subject, true));
        echo $post->subject;
        echo "</a>\"</div></li>\n";
    }
    echo "</ul>\n";
    return true;
}
开发者ID:r007,项目名称:PMoodle,代码行数:82,代码来源: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;
    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('&', '&amp;', $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


示例9: 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('&', '&amp;', $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


示例10: 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('&', '&amp;', $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


示例11: chat_print_recent_activity

function chat_print_recent_activity($course, $viewfullnames, $timestart)
{
    /// Given a course and a date, prints a summary of all chat rooms past and present
    /// This function is called from course/lib.php: print_recent_activity()
    global $CFG, $USER;
    // this is approximate only, but it is really fast ;-)
    $timeout = $CFG->chat_old_ping * 10;
    if (!($mcms = get_records_sql("SELECT cm.id, MAX(chm.timestamp) AS lasttime\n                                    FROM {$CFG->prefix}course_modules cm\n                                         JOIN {$CFG->prefix}modules md        ON md.id = cm.module\n                                         JOIN {$CFG->prefix}chat ch           ON ch.id = cm.instance\n                                         JOIN {$CFG->prefix}chat_messages chm ON chm.chatid = ch.id\n                                   WHERE chm.timestamp > {$timestart} AND ch.course = {$course->id} AND md.name = 'chat'\n                                GROUP BY cm.id\n                                ORDER BY lasttime ASC"))) {
        return false;
    }
    $past = array();
    $current = array();
    $modinfo =& get_fast_modinfo($course);
    // reference needed because we might load the groups
    foreach ($mcms as $cmid => $mcm) {
        if (!array_key_exists($cmid, $modinfo->cms)) {
            continue;
        }
        $cm = $modinfo->cms[$cmid];
        $cm->lasttime = $mcm->lasttime;
        if (!$modinfo->cms[$cm->id]->uservisible) {
            continue;
        }
        if (groups_get_activity_groupmode($cm) != SEPARATEGROUPS or has_capability('moodle/site:accessallgroups', get_context_instance(CONTEXT_MODULE, $cm->id))) {
            if ($timeout > time() - $cm->lasttime) {
                $current[] = $cm;
            } else {
                $past[] = $cm;
            }
            continue;
        }
        if (is_null($modinfo->groups)) {
            $modinfo->groups = groups_get_user_groups($course->id);
            // load all my groups and cache it in modinfo
        }
        // verify groups in separate mode
        if (!($mygroupids = $modinfo->groups[$cm->groupingid])) {
            continue;
        }
        // ok, last post was not for my group - we have to query db to get last message from one of my groups
        // only minor problem is that the order will not be correct
        $mygroupids = implode(',', $mygroupids);
        $cm->mygroupids = $mygroupids;
        if (!($mcm = get_record_sql("SELECT cm.id, MAX(chm.timestamp) AS lasttime\n                                      FROM {$CFG->prefix}course_modules cm\n                                           JOIN {$CFG->prefix}chat ch           ON ch.id = cm.instance\n                                           JOIN {$CFG->prefix}chat_messages chm ON chm.chatid = ch.id\n                                     WHERE chm.timestamp > {$timestart} AND cm.id = {$cm->id} AND\n                                           (chm.groupid IN ({$mygroupids}) OR chm.groupid = 0)\n                                  GROUP BY cm.id"))) {
            continue;
        }
        $cm->lasttime = $mcm->lasttime;
        if ($timeout > time() - $cm->lasttime) {
            $current[] = $cm;
        } else {
            $past[] = $cm;
        }
    }
    if (!$past and !$current) {
        return false;
    }
    $strftimerecent = get_string('strftimerecent');
    if ($past) {
        print_headline(get_string('pastchats', 'chat') . ':');
        foreach ($past as $cm) {
            $link = $CFG->wwwroot . '/mod/chat/view.php?id=' . $cm->id;
            $date = userdate($cm->lasttime, $strftimerecent);
            echo '<div class="head"><div class="date">' . $date . '</div></div>';
            echo '<div class="info"><a href="' . $link . '">' . format_string($cm->name, true) . '</a></div>';
        }
    }
    if ($current) {
        print_headline(get_string('currentchats', 'chat') . ':');
        $oldest = floor((time() - $CFG->chat_old_ping) / 10) * 10;
        // better db caching
        $timeold = time() - $CFG->chat_old_ping;
        $timeold = floor($timeold / 10) * 10;
        // better db caching
        $timeoldext = time() - $CFG->chat_old_ping * 10;
        // JSless gui_basic needs much longer timeouts
        $timeoldext = floor($timeoldext / 10) * 10;
        // better db caching
        $timeout = "AND (chu.version<>'basic' AND chu.lastping>{$timeold}) OR (chu.version='basic' AND chu.lastping>{$timeoldext})";
        foreach ($current as $cm) {
            //count users first
            if (isset($cm->mygroupids)) {
                $groupselect = "AND (chu.groupid IN ({$cm->mygroupids}) OR chu.groupid = 0)";
            } else {
                $groupselect = "";
            }
            if (!($users = get_records_sql("SELECT u.id, u.firstname, u.lastname, u.email, u.picture\n                                             FROM {$CFG->prefix}course_modules cm\n                                             JOIN {$CFG->prefix}chat ch        ON ch.id = cm.instance\n                                             JOIN {$CFG->prefix}chat_users chu ON chu.chatid = ch.id\n                                             JOIN {$CFG->prefix}user u         ON u.id = chu.userid\n                                            WHERE cm.id = {$cm->id} {$timeout} {$groupselect}\n                                         GROUP BY u.id, u.firstname, u.lastname, u.email, u.picture"))) {
            }
            $link = $CFG->wwwroot . '/mod/chat/view.php?id=' . $cm->id;
            $date = userdate($cm->lasttime, $strftimerecent);
            echo '<div class="head"><div class="date">' . $date . '</div></div>';
            echo '<div class="info"><a href="' . $link . '">' . format_string($cm->name, true) . '</a></div>';
            echo '<div class="userlist">';
            if ($users) {
                echo '<ul>';
                foreach ($users as $user) {
                    echo '<li>' . fullname($user, $viewfullnames) . '</li>';
                }
                echo '</ul>';
            }
            echo '</div>';
//.........这里部分代码省略.........
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:101,代码来源:lib.php


示例12: oublog_print_recent_activity

/**
 * Given a course and a time, this module should find recent activity
 * that has occurred in newmodule activities and print it out.
 * Return true if there was output, or false is there was none.
 *
 * @param object $course
 * @param bool $isteacher
 * @param int $timestart
 * @return boolean true on success, false on failure.
 **/
function oublog_print_recent_activity($course, $isteacher, $timestart)
{
    global $CFG;
    include_once 'locallib.php';
    $sql = "SELECT i.oublogid, p.id AS postid, p.*, u.firstname, u.lastname, u.email, u.idnumber, i.userid\r\n            FROM {$CFG->prefix}oublog_posts p\r\n                INNER JOIN {$CFG->prefix}oublog_instances i ON p.oubloginstancesid = i.id\r\n                INNER JOIN {$CFG->prefix}oublog b ON i.oublogid = b.id\r\n                INNER JOIN {$CFG->prefix}user u ON i.userid = u.id\r\n            WHERE b.course = {$course->id} AND p.deletedby IS NULL AND p.timeposted >= {$timestart} ";
    if (!($rs = get_recordset_sql($sql))) {
        return true;
    }
    $modinfo =& get_fast_modinfo($course);
    $strftimerecent = get_string('strftimerecent');
    print_headline(get_string('newblogposts', 'oublog') . ':', 3);
    echo "\n<ul class='unlist'>\n";
    while ($blog = rs_fetch_next_record($rs)) {
        if (!isset($modinfo->instances['oublog'][$blog->oublogid])) {
            // not visible
            continue;
        }
        $cm = $modinfo->instances['oublog'][$blog->oublogid];
        if (!$cm->uservisible) {
            continue;
        }
        if (!has_capability('mod/oublog:view', get_context_instance(CONTEXT_MODULE, $cm->id))) {
            continue;
        }
        if (!has_capability('mod/oublog:view', get_context_instance(CONTEXT_USER, $blog->userid))) {
            continue;
        }
        $groupmode = oublog_get_activity_groupmode($cm, $course);
        if ($groupmode) {
            if ($blog->groupid && $groupmode != VISIBLEGROUPS) {
                // separate mode
                if (isguestuser()) {
                    // shortcut
                    continue;
                }
                if (is_null($modinfo->groups)) {
                    $modinfo->groups = groups_get_user_groups($course->id);
                    // load all my groups and cache it in modinfo
                }
                if (!array_key_exists($blog->groupid, $modinfo->groups[0])) {
                    continue;
                }
            }
        }
        echo '<li><div class="head">' . '<div class="date">' . oublog_date($blog->timeposted, $strftimerecent) . '</div>' . '<div class="name">' . fullname($blog) . '</div>' . '</div>';
        echo '<div class="info">';
        echo "<a href=\"{$CFG->wwwroot}/mod/oublog/viewpost.php?post={$blog->postid}\">";
        echo break_up_long_words(format_string(empty($blog->title) ? $blog->message : $blog->title));
        echo '</a>';
        echo '</div>';
    }
    echo "</ul>\n";
    rs_close($rs);
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:64,代码来源:lib.php


示例13: lightboxgallery_print_recent_activity

function lightboxgallery_print_recent_activity($course, $viewfullnames, $timestart)
{
    global $CFG;
    $sql = "SELECT c.*, l.name, u.firstname, u.lastname\n              FROM {$CFG->prefix}lightboxgallery_comments c\n                   JOIN {$CFG->prefix}lightboxgallery l ON l.id = c.gallery\n                   JOIN {$CFG->prefix}user            u ON u.id = c.userid\n             WHERE c.timemodified > {$timestart} AND l.course = {$course->id}\n          ORDER BY c.timemodified ASC";
    if ($comments = get_records_sql($sql)) {
        print_headline(get_string('newgallerycomments', 'lightboxgallery') . ':', 3);
        echo '<ul class="unlist">';
        $strftimerecent = get_string('strftimerecent');
        foreach ($comments as $comment) {
            $display = lightboxgallery_resize_text(trim(strip_tags($comment->comment)), MAX_COMMENT_PREVIEW);
            echo '<li>' . ' <div class="head">' . '  <div class="date">' . userdate($comment->timemodified, $strftimerecent) . '</div>' . '  <div class="name">' . fullname($comment, $viewfullnames) . ' - ' . format_string($comment->name) . '</div>' . ' </div>' . ' <div class="info">' . '  "<a href="' . $CFG->wwwroot . '/mod/lightboxgallery/view.php?l=' . $comment->gallery . '#c' . $comment->id . '">' . $display . '</a>"' . ' </div>' . '</li>';
        }
        echo '</ul>';
    }
    return true;
}
开发者ID:kai707,项目名称:ITSA-backup,代码行数:16,代码来源:lib.php


示例14: 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('&', '&amp;', $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


示例15: dimdim_print_recent_activity

function dimdim_print_recent_activity($course, $isteacher, $timestart)
{
    /// Given a course and a date, prints a summary of all dimdim rooms
    /// that currently have people in them.
    /// This function is called from course/lib.php: print_recent_activity()
    global $CFG;
    $timeold = time() - $CFG->dimdim_old_ping;
    $lastpingsearch = $CFG->dimdim_method == 'sockets' ? '' : 'AND cu.lastping > \'' . $timeold . '\'';
    if (!($dimdimusers = get_records_sql("SELECT u.id, cu.dimdimid, u.firstname, u.lastname\n                                        FROM {$CFG->prefix}dimdim_users as cu,\n                                             {$CFG->prefix}dimdim as ch,\n                                             {$CFG->prefix}user as u\n                                       WHERE cu.userid = u.id\n                                         AND cu.dimdimid = ch.id {$lastpingsearch}\n                                         AND ch.course = '{$course->id}'\n                                       ORDER BY cu.dimdimid ASC"))) {
        return false;
    }
    $isteacher = isteacher($course->id);
    $outputstarted = false;
    $current = 0;
    foreach ($dimdimusers as $dimdimuser) {
        if ($current != $dimdimuser->dimdimid) {
            if ($current) {
                echo '</ul></div>';
                // room
                $current = 0;
            }
            if ($dimdim = get_record('dimdim', 'id', $dimdimuser->dimdimid)) {
                if (!($isteacher or instance_is_visible('dimdim', $dimdim))) {
                    // dimdim hidden to students
                    continue;
                }
                if (!$outputstarted) {
                    print_headline(get_string('currentdimdims', 'dimdim') . ':');
                    $outputstarted = true;
                }
                echo '<div class="room"><p class="head"><a href="' . $CFG->wwwroot . '/mod/dimdim/view.php?c=' . $dimdim->id . '">' . format_string($dimdim->name, true) . '</a></p><ul>';
            }
            $current = $dimdimuser->dimdimid;
        }
        $fullname = fullname($dimdimuser, $isteacher);
        echo '<li class="info name">' . $fullname . '</li>';
    }
    if ($current) {
        echo '</ul></div>';
        // room
    }
    return true;
}
开发者ID:kai707,项目名称:ITSA-backup,代码行数:43,代码来源:lib.php


示例16: 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-> 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP print_help函数代码示例发布时间:2022-05-15
下一篇:
PHP print_heading_with_help函数代码示例发布时间: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