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

PHP isguest函数代码示例

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

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



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

示例1: get_content

 function get_content()
 {
     global $THEME, $CFG, $USER;
     // only for logged in users!
     if (!isloggedin() || isguest()) {
         return false;
     }
     // check for outgoing roaming permission first
     if (!has_capability('moodle/site:mnetlogintoremote', get_context_instance(CONTEXT_SYSTEM), NULL, false)) {
         return '';
     }
     if ($this->content !== NULL) {
         return $this->content;
     }
     // TODO: Test this query - it's appropriate? It works?
     // get the hosts and whether we are doing SSO with them
     $sql = "\n             SELECT DISTINCT \n                 h.id, \n                 h.name,\n                 h.wwwroot,\n                 a.name as application,\n                 a.display_name\n             FROM \n                 {$CFG->prefix}mnet_host h,\n                 {$CFG->prefix}mnet_application a,\n                 {$CFG->prefix}mnet_host2service h2s_IDP,\n                 {$CFG->prefix}mnet_service s_IDP,\n                 {$CFG->prefix}mnet_host2service h2s_SP,\n                 {$CFG->prefix}mnet_service s_SP\n             WHERE\n                 h.id != '{$CFG->mnet_localhost_id}' AND\n                 h.id = h2s_IDP.hostid AND\n                 h.applicationid = a.id AND\n                 h2s_IDP.serviceid = s_IDP.id AND\n                 s_IDP.name = 'sso_idp' AND\n                 h2s_IDP.publish = '1' AND\n                 h.id = h2s_SP.hostid AND\n                 h2s_SP.serviceid = s_SP.id AND\n                 s_SP.name = 'sso_idp' AND\n                 h2s_SP.publish = '1'\n             ORDER BY\n                 a.display_name,\n                 h.name";
     $hosts = get_records_sql($sql);
     $this->content = new stdClass();
     $this->content->items = array();
     $this->content->icons = array();
     $this->content->footer = '';
     if ($hosts) {
         foreach ($hosts as $host) {
             $icon = '<img src="' . $CFG->pixpath . '/i/' . $host->application . '_host.gif"' . ' class="icon" alt="' . get_string('server', 'block_mnet_hosts') . '" />';
             $this->content->icons[] = $icon;
             if ($host->id == $USER->mnethostid) {
                 $this->content->items[] = "<a title=\"" . s($host->name) . "\" href=\"{$host->wwwroot}\">" . s($host->name) . "</a>";
             } else {
                 $this->content->items[] = "<a title=\"" . s($host->name) . "\" href=\"{$CFG->wwwroot}/auth/mnet/jump.php?hostid={$host->id}\">" . s($host->name) . "</a>";
             }
         }
     }
     return $this->content;
 }
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:35,代码来源:block_mnet_hosts.php


示例2: blog_check_and_install_blocks

/**
 * Checks to see if user has visited blogpages before, if not, install 2
 * default blocks (blog_menu and blog_tags).
 */
function blog_check_and_install_blocks()
{
    global $USER, $DB;
    if (isloggedin() && !isguest()) {
        // if this user has not visited this page before
        if (!get_user_preferences('blogpagesize')) {
            // find the correct ids for blog_menu and blog_from blocks
            $menublock = $DB->get_record('block', array('name' => 'blog_menu'));
            $tagsblock = $DB->get_record('block', array('name' => 'blog_tags'));
            // add those 2 into block_instance page
            // Commmented out since the block changes broke it. Hopefully nico will fix it ;-)
            //                // add blog_menu block
            //                $newblock = new object();
            //                $newblock->blockid  = $menublock->id;
            //                $newblock->pageid   = $USER->id;
            //                $newblock->pagetype = 'blog-view';
            //                $newblock->position = 'r';
            //                $newblock->weight   = 0;
            //                $newblock->visible  = 1;
            //                $DB->insert_record('block_instances', $newblock);
            //
            //                // add blog_tags menu
            //                $newblock -> blockid = $tagsblock->id;
            //                $newblock -> weight  = 1;
            //                $DB->insert_record('block_instances', $newblock);
            // finally we set the page size pref
            set_user_preference('blogpagesize', 10);
        }
    }
}
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:34,代码来源:lib.php


示例3: get_content

 function get_content()
 {
     global $USER, $CFG;
     if ($this->content !== NULL) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->text = '';
     $this->content->footer = '';
     if (empty($this->instance) or empty($USER->id) or isguest() or empty($CFG->messaging)) {
         return $this->content;
     }
     $this->content->footer = '<a href="' . $CFG->wwwroot . '/message/index.php" onclick="this.target=\'message\'; return openpopup(\'/message/index.php\', \'message\', \'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500\', 0);">' . get_string('messages', 'message') . '</a>...';
     $users = get_records_sql("SELECT m.useridfrom as id, COUNT(m.useridfrom) as count,\n                                         u.firstname, u.lastname, u.picture, u.lastaccess\n                                       FROM {$CFG->prefix}user u, \n                                            {$CFG->prefix}message m \n                                       WHERE m.useridto = '{$USER->id}' \n                                         AND u.id = m.useridfrom\n                                    GROUP BY m.useridfrom, u.firstname,u.lastname,u.picture,u.lastaccess");
     //Now, we have in users, the list of users to show
     //Because they are online
     if (!empty($users)) {
         $this->content->text .= '<ul class="list">';
         foreach ($users as $user) {
             $timeago = format_time(time() - $user->lastaccess);
             $this->content->text .= '<li class="listentry"><div class="user"><a href="' . $CFG->wwwroot . '/user/view.php?id=' . $user->id . '&amp;course=' . $this->instance->pageid . '" title="' . $timeago . '">';
             $this->content->text .= print_user_picture($user->id, $this->instance->pageid, $user->picture, 0, true, false, '', false);
             $this->content->text .= fullname($user) . '</a></div>';
             $this->content->text .= '<div class="message"><a href="' . $CFG->wwwroot . '/message/discussion.php?id=' . $user->id . '" onclick="this.target=\'message_' . $user->id . '\'; return openpopup(\'/message/discussion.php?id=' . $user->id . '\', \'message_' . $user->id . '\', \'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500\', 0);"><img class="iconsmall" src="' . $CFG->pixpath . '/t/message.gif" alt="" />&nbsp;' . $user->count . '</a>';
             $this->content->text .= '</div></li>';
         }
         $this->content->text .= '</ul>';
     } else {
         $this->content->text .= '<div class="info">';
         $this->content->text .= get_string('nomessages', 'message');
         $this->content->text .= '</div>';
     }
     return $this->content;
 }
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:34,代码来源:block_messages.php


示例4: blog_check_and_install_blocks

/**
 * Checks to see if user has visited blogpages before, if not, install 2
 * default blocks (blog_menu and blog_tags).
 */
function blog_check_and_install_blocks()
{
    global $USER;
    if (isloggedin() && !isguest()) {
        // if this user has not visited this page before
        if (!get_user_preferences('blogpagesize')) {
            // find the correct ids for blog_menu and blog_from blocks
            $menublock = get_record('block', 'name', 'blog_menu');
            $tagsblock = get_record('block', 'name', 'blog_tags');
            // add those 2 into block_instance page
            // add blog_menu block
            $newblock = new object();
            $newblock->blockid = $menublock->id;
            $newblock->pageid = $USER->id;
            $newblock->pagetype = 'blog-view';
            $newblock->position = 'r';
            $newblock->weight = 0;
            $newblock->visible = 1;
            insert_record('block_instance', $newblock);
            // add blog_tags menu
            $newblock->blockid = $tagsblock->id;
            $newblock->weight = 1;
            insert_record('block_instance', $newblock);
            // finally we set the page size pref
            set_user_preference('blogpagesize', 10);
        }
    }
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:32,代码来源:lib.php


示例5: doListAnnotations

 function doListAnnotations($url, $username, $block)
 {
     $query = new AnnotationSummaryQuery($url, $username, null, null);
     if ($query->error) {
         $this->httpError(400, 'Bad Request', 'Bad URL');
         return null;
     } elseif (isguest() && ANNOTATION_REQUIRE_USER) {
         $this->httpError(403, 'Forbidden', 'Anonymous listing not allowed');
         return null;
     } else {
         $querySql = $query->sql('section_type, section_name, quote_title');
         $annotationSet = get_records_sql($querySql);
         $annotations = array();
         if ($annotationSet) {
             $i = 0;
             foreach ($annotationSet as $r) {
                 $annotations[$i++] = AnnotationGlobals::recordToAnnotation($r);
             }
         }
         $format = $this->getQueryParam('format', 'atom');
         $logUrl = 'annotate.php?format=' . $format . ($username ? '&user=' . $username : '') . '&url=' . $url;
         add_to_log($query->handler->courseId, 'annotation', 'list', $logUrl);
         return $annotations;
     }
 }
开发者ID:njorth,项目名称:marginalia,代码行数:25,代码来源:annotate.php


示例6: user_is_editing

 function user_is_editing()
 {
     global $SESSION;
     if (isloggedin() && !isguest()) {
         $this->editing = !empty($SESSION->blog_editing_enabled);
         return $this->editing;
     }
     return false;
 }
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:9,代码来源:blogpage.php


示例7: print_header

 /**
  * Prints the page header.
  */
 function print_header()
 {
     global $CFG, $USER, $PAGE;
     require_once $CFG->libdir . '/blocklib.php';
     require_once $CFG->dirroot . '/course/lib.php';
     require_once $CFG->dirroot . '/my/pagelib.php';
     /// My Moodle arguments:
     $edit = optional_param('edit', -1, PARAM_BOOL);
     $blockaction = optional_param('blockaction', '', PARAM_ALPHA);
     $mymoodlestr = get_string('mymoodle', 'my');
     if (isguest()) {
         $wwwroot = $CFG->wwwroot . '/login/index.php';
         if (!empty($CFG->loginhttps)) {
             $wwwroot = str_replace('http:', 'https:', $wwwroot);
         }
         print_header($mymoodlestr);
         notice_yesno(get_string('noguest', 'my') . '<br /><br />' . get_string('liketologin'), $wwwroot, $CFG->wwwroot);
         print_footer();
         die;
     }
     /// Add curriculum stylesheets...
     if (file_exists($CFG->dirroot . '/curriculum/styles.css')) {
         $CFG->stylesheets[] = $CFG->wwwroot . '/curriculum/styles.css';
     }
     /// Fool the page library into thinking we're in My Moodle.
     $CFG->pagepath = $CFG->wwwroot . '/my/index.php';
     $PAGE = page_create_instance($USER->id);
     if ($section = optional_param('section', '', PARAM_ALPHAEXT)) {
         $PAGE->section = $section;
     }
     $this->pageblocks = blocks_setup($PAGE, BLOCKS_PINNED_BOTH);
     /// Make sure that the curriculum block is actually on this
     /// user's My Moodle page instance.
     if ($cablockid = get_field('block', 'id', 'name', 'curr_admin')) {
         if (!record_exists('block_pinned', 'blockid', $cablockid, 'pagetype', 'my-index')) {
             blocks_execute_action($PAGE, $this->pageblocks, 'add', (int) $cablockid, true, false);
         }
     }
     if ($edit != -1 and $PAGE->user_allowed_editing()) {
         $USER->editing = $edit;
     }
     //$PAGE->print_header($mymoodlestr);
     $title = $this->get_title();
     print_header($title, $title, build_navigation($this->get_navigation()));
     echo '<table border="0" cellpadding="3" cellspacing="0" width="100%" id="layout-table">';
     echo '<tr valign="top">';
     $blocks_preferred_width = bounded_number(180, blocks_preferred_width($this->pageblocks[BLOCK_POS_LEFT]), 210);
     if (blocks_have_content($this->pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing()) {
         echo '<td style="vertical-align: top; width: ' . $blocks_preferred_width . 'px;" id="left-column">';
         blocks_print_group($PAGE, $this->pageblocks, BLOCK_POS_LEFT);
         echo '</td>';
     }
     echo '<td valign="top" id="middle-column">';
     if (blocks_have_content($this->pageblocks, BLOCK_POS_CENTRE) || $PAGE->user_is_editing()) {
         blocks_print_group($PAGE, $this->pageblocks, BLOCK_POS_CENTRE);
     }
 }
开发者ID:remotelearner,项目名称:elis.cm,代码行数:60,代码来源:newpage.class.php


示例8: get_content

 function get_content()
 {
     global $CFG, $USER, $DB, $OUTPUT;
     // only for logged in users!
     if (!isloggedin() || isguest()) {
         return false;
     }
     if (!is_enabled_auth('mnet')) {
         // no need to query anything remote related
         debugging('mnet authentication plugin is not enabled', DEBUG_ALL);
         return '';
     }
     // check for outgoing roaming permission first
     if (!has_capability('moodle/site:mnetlogintoremote', get_context_instance(CONTEXT_SYSTEM), NULL, false)) {
         return '';
     }
     if ($this->content !== NULL) {
         return $this->content;
     }
     // TODO: Test this query - it's appropriate? It works?
     // get the hosts and whether we are doing SSO with them
     $sql = "\n             SELECT DISTINCT \n                 h.id, \n                 h.name,\n                 h.wwwroot,\n                 a.name as application,\n                 a.display_name\n             FROM \n                 {mnet_host} h,\n                 {mnet_application} a,\n                 {mnet_host2service} h2s_IDP,\n                 {mnet_service} s_IDP,\n                 {mnet_host2service} h2s_SP,\n                 {mnet_service} s_SP\n             WHERE\n                 h.id <> ? AND\n                 h.id = h2s_IDP.hostid AND\n                 h.deleted = 0 AND\n                 h.applicationid = a.id AND\n                 h2s_IDP.serviceid = s_IDP.id AND\n                 s_IDP.name = 'sso_idp' AND\n                 h2s_IDP.publish = '1' AND\n                 h.id = h2s_SP.hostid AND\n                 h2s_SP.serviceid = s_SP.id AND\n                 s_SP.name = 'sso_idp' AND\n                 h2s_SP.publish = '1'\n             ORDER BY\n                 a.display_name,\n                 h.name";
     $hosts = $DB->get_records_sql($sql, array($CFG->mnet_localhost_id));
     $this->content = new stdClass();
     $this->content->items = array();
     $this->content->icons = array();
     $this->content->footer = '';
     if ($hosts) {
         foreach ($hosts as $host) {
             $icon = '<img src="' . $OUTPUT->old_icon_url('i/' . $host->application . '_host') . '"' . ' class="icon" alt="' . get_string('server', 'block_mnet_hosts') . '" />';
             $this->content->icons[] = $icon;
             if ($host->id == $USER->mnethostid) {
                 $this->content->items[] = "<a title=\"" . s($host->name) . "\" href=\"{$host->wwwroot}\">" . s($host->name) . "</a>";
             } else {
                 $this->content->items[] = "<a title=\"" . s($host->name) . "\" href=\"{$CFG->wwwroot}/auth/mnet/jump.php?hostid={$host->id}\">" . s($host->name) . "</a>";
             }
         }
     }
     return $this->content;
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:40,代码来源:block_mnet_hosts.php


示例9: get_content

 function get_content()
 {
     global $USER, $CFG, $DB, $OUTPUT;
     if (!$CFG->messaging) {
         return '';
     }
     if ($this->content !== NULL) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->text = '';
     $this->content->footer = '';
     if (empty($this->instance) or empty($USER->id) or isguest() or empty($CFG->messaging)) {
         return $this->content;
     }
     $this->content->footer = '<a href="' . $CFG->wwwroot . '/message/index.php" onclick="this.target=\'message\'; return openpopup(\'/message/index.php\', \'message\', \'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500\', 0);">' . get_string('messages', 'message') . '</a>...';
     $users = $DB->get_records_sql("SELECT m.useridfrom AS id, COUNT(m.useridfrom) AS count,\n                                              u.firstname, u.lastname, u.picture, u.imagealt, u.lastaccess\n                                         FROM {user} u, {message} m \n                                        WHERE m.useridto = ? AND u.id = m.useridfrom\n                                     GROUP BY m.useridfrom, u.firstname,u.lastname,u.picture,u.lastaccess,u.imagealt", array($USER->id));
     //Now, we have in users, the list of users to show
     //Because they are online
     if (!empty($users)) {
         $this->content->text .= '<ul class="list">';
         foreach ($users as $user) {
             $timeago = format_time(time() - $user->lastaccess);
             $this->content->text .= '<li class="listentry"><div class="user"><a href="' . $CFG->wwwroot . '/user/view.php?id=' . $user->id . '&amp;course=' . SITEID . '" title="' . $timeago . '">';
             $this->content->text .= $OUTPUT->user_picture(moodle_user_picture::make($user, SITEID));
             $this->content->text .= fullname($user) . '</a></div>';
             $this->content->text .= '<div class="message"><a href="' . $CFG->wwwroot . '/message/discussion.php?id=' . $user->id . '" onclick="this.target=\'message_' . $user->id . '\'; return openpopup(\'/message/discussion.php?id=' . $user->id . '\', \'message_' . $user->id . '\', \'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500\', 0);"><img class="iconsmall" src="' . $OUTPUT->old_icon_url('t/message') . '" alt="" />&nbsp;' . $user->count . '</a>';
             $this->content->text .= '</div></li>';
         }
         $this->content->text .= '</ul>';
     } else {
         $this->content->text .= '<div class="info">';
         $this->content->text .= get_string('nomessages', 'message');
         $this->content->text .= '</div>';
     }
     return $this->content;
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:37,代码来源:block_messages.php


示例10: calendar_course_filter_selector

function calendar_course_filter_selector($getvars = '')
{
    global $USER, $SESSION;
    if (empty($USER->id) or isguest()) {
        return '';
    }
    if (has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_SYSTEM)) && !empty($CFG->calendar_adminseesall)) {
        $courses = get_courses('all', 'c.shortname', 'c.id,c.shortname');
    } else {
        $courses = get_my_courses($USER->id, 'shortname');
    }
    unset($courses[SITEID]);
    $courseoptions[SITEID] = get_string('fulllistofcourses');
    foreach ($courses as $course) {
        $courseoptions[$course->id] = format_string($course->shortname);
    }
    if (is_numeric($SESSION->cal_courses_shown)) {
        $selected = $SESSION->cal_courses_shown;
    } else {
        $selected = '';
    }
    return popup_form(CALENDAR_URL . 'set.php?var=setcourse&amp;' . $getvars . '&amp;id=', $courseoptions, 'cal_course_flt', $selected, '', '', '', true);
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:23,代码来源:view.php


示例11: tabobject

 $toprow[] = new tabobject('profile', $CFG->wwwroot . '/user/view.php?id=' . $user->id . '&amp;course=' . $course->id, get_string('profile'));
 $systemcontext = get_context_instance(CONTEXT_SYSTEM);
 $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
 $personalcontext = get_context_instance(CONTEXT_USER, $user->id);
 /// Can only edit profile if it belongs to user or current user is admin and not editing primary admin
 $mainadmin = get_admin();
 if (empty($CFG->loginhttps)) {
     $wwwroot = $CFG->wwwroot;
 } else {
     $wwwroot = str_replace('http:', 'https:', $CFG->wwwroot);
 }
 $edittype = 'none';
 if (is_mnet_remote_user($user)) {
     // cannot edit remote users
 } else {
     if (isguest() or !isloggedin()) {
         // can not edit guest like accounts - TODO: add capability to edit own profile
     } else {
         if ($USER->id == $user->id) {
             if (has_capability('moodle/user:update', $systemcontext)) {
                 $edittype = 'advanced';
             } else {
                 $edittype = 'normal';
             }
         } else {
             if ($user->id != $mainadmin->id) {
                 //no editing of primary admin!
                 if (has_capability('moodle/user:update', $systemcontext)) {
                     $edittype = 'advanced';
                 } else {
                     if (has_capability('moodle/user:editprofile', $personalcontext)) {
开发者ID:veritech,项目名称:pare-project,代码行数:31,代码来源:tabs.php


示例12: optional_param

// EntryID
$confirm = optional_param('confirm', 0, PARAM_INT);
// proceed. Edit the edtry
$mode = optional_param('mode', '', PARAM_ALPHA);
// categories if by category?
$hook = optional_param('hook', '', PARAM_ALPHANUM);
// CategoryID
if (!($cm = get_coursemodule_from_id('glossary', $id))) {
    error("Course Module ID was incorrect");
}
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
if (!($course = get_record("course", "id", $cm->course))) {
    error("Course is misconfigured");
}
require_login($course->id, false, $cm);
if (isguest()) {
    error("Guests are not allowed to edit glossaries", $_SERVER["HTTP_REFERER"]);
}
if (!($glossary = get_record("glossary", "id", $cm->instance))) {
    error("Course module is incorrect");
}
if ($e) {
    // if entry is specified
    if (!($entry = get_record("glossary_entries", "id", $e))) {
        error("Incorrect entry id");
    }
    $ineditperiod = time() - $entry->timecreated < $CFG->maxeditingtime || $glossary->editalways;
    if (!has_capability('mod/glossary:manageentries', $context) and !($entry->userid == $USER->id and ($ineditperiod and has_capability('mod/glossary:write', $context)))) {
        //expired edit time is the most probable cause here
        print_error('erredittimeexpired', 'glossary', "view.php?id={$cm->id}&amp;mode=entry&amp;hook={$e}");
    }
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:31,代码来源:edit.php


示例13: get_string

 echo "<form id='annotation-search' method='get' action='summary.php'>\n";
 echo "<fieldset>\n";
 echo "<label for='search-of'>" . get_string('prompt_find', ANNOTATION_STRINGS) . "</label>\n";
 if (isguest()) {
     echo "<input type='hidden' name='search_of' id='search_of' value='' />\n";
     echo get_string('search_of_all', ANNOTATION_STRINGS) . ' ';
 } else {
     echo "<select name='search-of' id='search-of'>\n";
     echo " <option value=''" . ('' == $searchOf ? " selected='selected'" : '') . '>' . get_string('search_of_all', ANNOTATION_STRINGS) . "</option>\n";
     echo " <option value='" . htmlspecialchars($USER->username) . "'" . ($searchOf == $USER->username ? " selected='selected'" : '') . '>' . get_string('search_of_self', ANNOTATION_STRINGS) . "</option>\n";
     echo "</select>\n";
 }
 echo "<label for='u'>" . get_string('prompt_by', ANNOTATION_STRINGS) . "</label>\n";
 echo "<select name='u' id='u'>\n";
 echo " <option value='' " . (!$searchUser ? "selected='selected'" : '') . '>' . get_string('search_by_all', ANNOTATION_STRINGS) . "</option>\n";
 if (!isguest()) {
     echo " <option value='" . htmlspecialchars($USER->username) . "' " . ($searchUser == $USER->username ? " selected='selected'" : '') . ">" . get_string('search_by_self', ANNOTATION_STRINGS) . "</option>\n";
 }
 //			echo " <option value='*teachers'".('*teachers'==$searchBy?" selected='selected'":'').'>'.get_string( 'search_by_teachers', ANNOTATION_STRINGS )."</option>\n";
 //			echo " <option value='*students'".('*students'==$searchBy?" selected='selected'":'').'>'.get_string( 'search_by_students', ANNOTATION_STRINGS )."</option>\n";
 echo "</select>\n";
 echo "<label for='search-text'>" . get_string('search_text', ANNOTATION_STRINGS) . "</label>\n";
 echo "<input type='text' id='search-text' name='q' value='" . htmlspecialchars($searchQuery) . "'/>\n";
 echo "<input type='submit' value='" . get_string('go') . "'/>\n";
 echo "<input type='hidden' name='url' value='" . htmlspecialchars($summaryUrl) . "'/>\n";
 echo "</fieldset>\n";
 echo "</form>";
 // If this page is an error, explain what it's about
 if ('range-mismatch' == $errorPage) {
     echo "<p class='error'><em class='range-error'>!</em>" . get_string('summary_range_error', ANNOTATION_STRINGS) . "</p>\n";
 }
开发者ID:njorth,项目名称:marginalia,代码行数:31,代码来源:summary.php


示例14: unset

 if (user_not_fully_set_up($USER)) {
     $urltogo = $CFG->wwwroot . '/user/edit.php';
     // We don't delete $SESSION->wantsurl yet, so we get there later
 } else {
     if (isset($SESSION->wantsurl) and strpos($SESSION->wantsurl, $CFG->wwwroot) === 0) {
         $urltogo = $SESSION->wantsurl;
         /// Because it's an address in this site
         unset($SESSION->wantsurl);
     } else {
         // no wantsurl stored or external - go to homepage
         $urltogo = $CFG->wwwroot . '/';
         unset($SESSION->wantsurl);
     }
 }
 /// Go to my-moodle page instead of homepage if mymoodleredirect enabled
 if (!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)) and !empty($CFG->mymoodleredirect) and !isguest()) {
     if ($urltogo == $CFG->wwwroot or $urltogo == $CFG->wwwroot . '/' or $urltogo == $CFG->wwwroot . '/index.php') {
         $urltogo = $CFG->wwwroot . '/my/';
     }
 }
 /// check if user password has expired
 /// Currently supported only for ldap-authentication module
 if (!empty($userauth->config->expiration) and $userauth->config->expiration == 1) {
     $days2expire = $userauth->password_expire($USER->username);
     if (intval($days2expire) > 0 && intval($days2expire) < intval($userauth->config->expiration_warning)) {
         print_header("{$site->fullname}: {$loginsite}", "{$site->fullname}", $loginsite, $focus, "", true, "<div class=\"langmenu\">{$langmenu}</div>");
         notice_yesno(get_string('auth_passwordwillexpire', 'auth', $days2expire), $passwordchangeurl, $urltogo);
         print_footer();
         exit;
     } elseif (intval($days2expire) < 0) {
         print_header("{$site->fullname}: {$loginsite}", "{$site->fullname}", $loginsite, $focus, "", true, "<div class=\"langmenu\">{$langmenu}</div>");
开发者ID:veritech,项目名称:pare-project,代码行数:31,代码来源:index.php


示例15: s

        echo '<input type="submit" value="' . s(get_string('unenrolme', '', $course->shortname)) . '" />';
        echo '</div>';
        echo '</form>';
    }
}
if (!$user->deleted and $USER->id != $user->id && empty($USER->realuser) && has_capability('moodle/user:loginas', $coursecontext) && !has_capability('moodle/site:doanything', $coursecontext, $user->id, false)) {
    echo '<form action="' . $CFG->wwwroot . '/course/loginas.php" method="get">';
    echo '<div>';
    echo '<input type="hidden" name="id" value="' . $course->id . '" />';
    echo '<input type="hidden" name="user" value="' . $user->id . '" />';
    echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
    echo '<input type="submit" value="' . get_string('loginas') . '" />';
    echo '</div>';
    echo '</form>';
}
if (!$user->deleted and !empty($CFG->messaging) and !isguest() and has_capability('moodle/site:sendmessage', get_context_instance(CONTEXT_SYSTEM))) {
    if (!empty($USER->id) and $USER->id == $user->id) {
        if ($countmessages = count_records('message', 'useridto', $user->id)) {
            $messagebuttonname = get_string("messages", "message") . "({$countmessages})";
        } else {
            $messagebuttonname = get_string("messages", "message");
        }
        echo "<form onclick=\"this.target='message'\" action=\"../message/index.php\" method=\"get\">";
        echo "<div>";
        echo "<input type=\"submit\" value=\"{$messagebuttonname}\" onclick=\"return openpopup('/message/index.php', 'message', 'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500', 0);\" />";
        echo "</div>";
        echo "</form>";
    } else {
        echo "<form onclick=\"this.target='message{$user->id}'\" action=\"../message/discussion.php\" method=\"get\">";
        echo "<div>";
        echo "<input type=\"hidden\" name=\"id\" value=\"{$user->id}\" />";
开发者ID:r007,项目名称:PMoodle,代码行数:31,代码来源:view.php


示例16: print_user

/**
 * Prints a summary of a user in a nice little box.
 *
 * @uses $CFG
 * @uses $USER
 * @param user $user A {@link $USER} object representing a user
 * @param course $course A {@link $COURSE} object representing a course
 */
function print_user($user, $course, $messageselect = false, $return = false)
{
    global $CFG, $USER;
    $output = '';
    static $string;
    static $datestring;
    static $countries;
    $context = get_context_instance(CONTEXT_COURSE, $course->id);
    if (isset($user->context->id)) {
        $usercontext = $user->context;
    } else {
        $usercontext = get_context_instance(CONTEXT_USER, $user->id);
    }
    if (empty($string)) {
        // Cache all the strings for the rest of the page
        $string->email = get_string('email');
        $string->city = get_string('city');
        $string->lastaccess = get_string('lastaccess');
        $string->activity = get_string('activity');
        $string->unenrol = get_string('unenrol');
        $string->loginas = get_string('loginas');
        $string->fullprofile = get_string('fullprofile');
        $string->role = get_string('role');
        $string->name = get_string('name');
        $string->never = get_string('never');
        $datestring->day = get_string('day');
        $datestring->days = get_string('days');
        $datestring->hour = get_string('hour');
        $datestring->hours = get_string('hours');
        $datestring->min = get_string('min');
        $datestring->mins = get_string('mins');
        $datestring->sec = get_string('sec');
        $datestring->secs = get_string('secs');
        $datestring->year = get_string('year');
        $datestring->years = get_string('years');
        $countries = get_list_of_countries();
    }
    /// Get the hidden field list
    if (has_capability('moodle/course:viewhiddenuserfields', $context)) {
        $hiddenfields = array();
    } else {
        $hiddenfields = array_flip(explode(',', $CFG->hiddenuserfields));
    }
    $output .= '<table class="userinfobox">';
    $output .= '<tr>';
    $output .= '<td class="left side">';
    $output .= print_user_picture($user, $course->id, $user->picture, true, true);
    $output .= '</td>';
    $output .= '<td class="content">';
    $output .= '<div class="username">' . fullname($user, has_capability('moodle/site:viewfullnames', $context)) . '</div>';
    $output .= '<div class="info">';
    if (!empty($user->role)) {
        $output .= $string->role . ': ' . $user->role . '<br />';
    }
    if ($user->maildisplay == 1 or $user->maildisplay == 2 and $course->id != SITEID and !isguest() or has_capability('moodle/course:viewhiddenuserfields', $context)) {
        $output .= $string->email . ': <a href="mailto:' . $user->email . '">' . $user->email . '</a><br />';
    }
    if (($user->city or $user->country) and (!isset($hiddenfields['city']) or !isset($hiddenfields['country']))) {
        $output .= $string->city . ': ';
        if ($user->city && !isset($hiddenfields['city'])) {
            $output .= $user->city;
        }
        if (!empty($countries[$user->country]) && !isset($hiddenfields['country'])) {
            if ($user->city && !isset($hiddenfields['city'])) {
                $output .= ', ';
            }
            $output .= $countries[$user->country];
        }
        $output .= '<br />';
    }
    if (!isset($hiddenfields['lastaccess'])) {
        if ($user->lastaccess) {
            $output .= $string->lastaccess . ': ' . userdate($user->lastaccess);
            $output .= '&nbsp; (' . format_time(time() - $user->lastaccess, $datestring) . ')';
        } else {
            $output .= $string->lastaccess . ': ' . $string->never;
        }
    }
    $output .= '</div></td><td class="links">';
    //link to blogs
    if ($CFG->bloglevel > 0) {
        $output .= '<a href="' . $CFG->wwwroot . '/blog/index.php?userid=' . $user->id . '">' . get_string('blogs', 'blog') . '</a><br />';
    }
    //link to notes
    if (!empty($CFG->enablenotes) and has_capability('moodle/notes:manage', $context) || has_capability('moodle/notes:view', $context)) {
        $output .= '<a href="' . $CFG->wwwroot . '/notes/index.php?course=' . $course->id . '&amp;user=' . $user->id . '">' . get_string('notes', 'notes') . '</a><br />';
    }
    if (has_capability('moodle/site:viewreports', $context) or has_capability('moodle/user:viewuseractivitiesreport', $usercontext)) {
        $output .= '<a href="' . $CFG->wwwroot . '/course/user.php?id=' . $course->id . '&amp;user=' . $user->id . '">' . $string->activity . '</a><br />';
    }
    if (has_capability('moodle/role:assign', $context) and get_user_roles($context, $user->id, false)) {
        // I can unassing and user has some role
//.........这里部分代码省略.........
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:101,代码来源:weblib.php


示例17: redirect

<?php

// $Id: enrol.php,v 1.50.2.1 2008/03/03 05:27:36 moodler Exp $
// Depending on the current enrolment method, this page
// presents the user with whatever they need to know when
// they try to enrol in a course.
require_once "../config.php";
require_once "lib.php";
require_once "{$CFG->dirroot}/enrol/enrol.class.php";
if (isloggedin() and !isguest()) {
    if (!iscreator() and !isteacherinanycourse()) {
        redirect($CFG->wwwroot . '/index.php');
    }
} else {
    redirect($CFG->wwwroot . '/index.php');
}
$id = required_param('id', PARAM_INT);
// Masoud Sadjadi: PARAM_ALPHANUM changed to PARAM_RAW to support emails being passed as user names.
// $username     = required_param('username', PARAM_ALPHANUM);
$username = required_param('username', PARAM_RAW);
$loginasguest = optional_param('loginasguest', 0, PARAM_BOOL);
// hmm, is this still needed?
if (!isloggedin()) {
    // do not use require_login here because we are usually comming from it
    redirect(get_login_url());
}
if (!($course = get_record('course', 'id', $id))) {
    print_error("That's an invalid course id");
}
if (!($context = get_context_instance(CONTEXT_COURSE, $course->id))) {
    print_error("That's an invalid course id");
开发者ID:arshanam,项目名称:Moodle-ITScholars-LMS,代码行数:31,代码来源:auto_enrol.php


示例18: data_print_comments

function data_print_comments($data, $record, $page = 0, $mform = false)
{
    global $CFG;
    $cm = get_coursemodule_from_instance('data', $data->id);
    $context = get_context_instance(CONTEXT_MODULE, $cm->id);
    $cancomment = has_capability('mod/data:comment', $context);
    echo '<a name="comments"></a>';
    if ($comments = get_records('data_comments', 'recordid', $record->id)) {
        foreach ($comments as $comment) {
            data_print_comment($data, $comment, $page);
        }
        echo '<br />';
    }
    if (!isloggedin() or isguest() or !$cancomment) {
        return;
    }
    $editor = optional_param('addcomment', 0, PARAM_BOOL);
    if (!$mform and !$editor) {
        echo '<div class="newcomment" style="text-align:center">';
        echo '<a href="view.php?d=' . $data->id . '&amp;rid=' . $record->id . '&amp;mode=single&amp;addcomment=1">' . get_string('addcomment', 'data') . '</a>';
        echo '</div>';
    } else {
        if (!$mform) {
            require_once 'comment_form.php';
            $mform = new mod_data_comment_form('comment.php');
            $mform->set_data(array('mode' => 'add', 'page' => $page, 'rid' => $record->id));
        }
        echo '<div class="newcomment" style="text-align:center">';
        $mform->display();
        echo '</div>';
    }
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:32,代码来源:lib.php


示例19: error


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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