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

PHP is_inside_frontpage函数代码示例

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

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



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

示例1: core_role_get_potential_user_selector

/**
 * Get the potential assignees selector for a given context.
 *
 * If this context is a course context, or inside a course context (module or
 * some blocks) then return a core_role_potential_assignees_below_course object. Otherwise
 * return a core_role_potential_assignees_course_and_above.
 *
 * @param context $context a context.
 * @param string $name passed to user selector constructor.
 * @param array $options to user selector constructor.
 * @return user_selector_base an appropriate user selector.
 */
function core_role_get_potential_user_selector(context $context, $name, $options)
{
    $blockinsidecourse = false;
    if ($context->contextlevel == CONTEXT_BLOCK) {
        $parentcontext = $context->get_parent_context();
        $blockinsidecourse = in_array($parentcontext->contextlevel, array(CONTEXT_MODULE, CONTEXT_COURSE));
    }
    if (($context->contextlevel == CONTEXT_MODULE || $blockinsidecourse) && !is_inside_frontpage($context)) {
        $potentialuserselector = new core_role_potential_assignees_below_course('addselect', $options);
    } else {
        $potentialuserselector = new core_role_potential_assignees_course_and_above('addselect', $options);
    }
    return $potentialuserselector;
}
开发者ID:evltuma,项目名称:moodle,代码行数:26,代码来源:lib.php


示例2: definition

    protected function definition() {
        $mform = $this->_form;

        $mform->addElement('header', 'preferencespage',
                get_string('preferencespage', 'quiz_overview'));

        if (!$this->_customdata['currentgroup']) {
            $studentsstring = get_string('participants');
        } else {
            $a = new stdClass();
            $a->coursestudent = get_string('participants');
            $a->groupname = groups_get_group_name($this->_customdata['currentgroup']);
            if (20 < strlen($a->groupname)) {
                $studentsstring = get_string('studentingrouplong', 'quiz_overview', $a);
            } else {
                $studentsstring = get_string('studentingroup', 'quiz_overview', $a);
            }
        }
        $options = array();
        if (!$this->_customdata['currentgroup']) {
            $options[quiz_attempts_report::ALL_ATTEMPTS] = get_string('optallattempts', 'quiz_overview');
        }
        if ($this->_customdata['currentgroup'] ||
                !is_inside_frontpage($this->_customdata['context'])) {
            $options[quiz_attempts_report::ALL_STUDENTS] =
                    get_string('optallstudents', 'quiz_overview', $studentsstring);
            $options[quiz_attempts_report::STUDENTS_WITH] =
                     get_string('optattemptsonly', 'quiz_overview', $studentsstring);
            $options[quiz_attempts_report::STUDENTS_WITH_NO] =
                    get_string('optnoattemptsonly', 'quiz_overview', $studentsstring);
        }
        $mform->addElement('select', 'attemptsmode',
                get_string('show', 'quiz_overview'), $options);

        $this->definition_inner($mform);

        $mform->addElement('header', 'preferencesuser',
                get_string('preferencesuser', 'quiz_overview'));

        $mform->addElement('text', 'pagesize', get_string('pagesize', 'quiz_overview'));
        $mform->setType('pagesize', PARAM_INT);

        $mform->addElement('submit', 'submitbutton',
                get_string('preferencessave', 'quiz_overview'));
    }
开发者ID:numbas,项目名称:moodle,代码行数:45,代码来源:attemptsreport_form.php


示例3: definition

 protected function definition()
 {
     $mform = $this->_form;
     $mform->addElement('header', 'preferencespage', get_string('preferencespage', 'quiz_overview'));
     if (!$this->_customdata['currentgroup']) {
         $studentsstring = get_string('participants');
     } else {
         $a = new stdClass();
         $a->coursestudent = get_string('participants');
         $a->groupname = groups_get_group_name($this->_customdata['currentgroup']);
         if (20 < strlen($a->groupname)) {
             $studentsstring = get_string('studentingrouplong', 'quiz_overview', $a);
         } else {
             $studentsstring = get_string('studentingroup', 'quiz_overview', $a);
         }
     }
     $options = array();
     if (!$this->_customdata['currentgroup']) {
         $options[QUIZ_REPORT_ATTEMPTS_ALL] = get_string('optallattempts', 'quiz_overview');
     }
     if ($this->_customdata['currentgroup'] || !is_inside_frontpage($this->_customdata['context'])) {
         $options[QUIZ_REPORT_ATTEMPTS_ALL_STUDENTS] = get_string('optallstudents', 'quiz_overview', $studentsstring);
         $options[QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH] = get_string('optattemptsonly', 'quiz_overview', $studentsstring);
         $options[QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH_NO] = get_string('optnoattemptsonly', 'quiz_overview', $studentsstring);
     }
     $mform->addElement('select', 'attemptsmode', get_string('show', 'quiz_overview'), $options);
     $showattemptsgrp = array();
     if ($this->_customdata['qmsubselect']) {
         $gm = '<span class="highlight">' . quiz_get_grading_option_name($this->_customdata['quiz']->grademethod) . '</span>';
         $showattemptsgrp[] = $mform->createElement('advcheckbox', 'qmfilter', get_string('showattempts', 'quiz_overview'), get_string('optonlygradedattempts', 'quiz_overview', $gm), null, array(0, 1));
     }
     if (has_capability('mod/quiz:regrade', $this->_customdata['context'])) {
         $showattemptsgrp[] = $mform->createElement('advcheckbox', 'regradefilter', get_string('showattempts', 'quiz_overview'), get_string('optonlyregradedattempts', 'quiz_overview'), null, array(0, 1));
     }
     if ($showattemptsgrp) {
         $mform->addGroup($showattemptsgrp, null, get_string('showattempts', 'quiz_overview'), '<br />', false);
     }
     $mform->addElement('header', 'preferencesuser', get_string('preferencesuser', 'quiz_overview'));
     $mform->addElement('text', 'pagesize', get_string('pagesize', 'quiz_overview'));
     $mform->setType('pagesize', PARAM_INT);
     $mform->addElement('selectyesno', 'detailedmarks', get_string('showdetailedmarks', 'quiz_overview'));
     $mform->addElement('submit', 'submitbutton', get_string('preferencessave', 'quiz_overview'));
 }
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:43,代码来源:overviewsettings_form.php


示例4: array

 if (!($contextusers = get_role_users($roleid, $context, false, 'u.id, u.firstname, u.lastname, u.email, ra.hidden'))) {
     $contextusers = array();
 }
 $select = "username <> 'guest' AND deleted = 0 AND confirmed = 1";
 $usercount = count_records_select('user', $select) - count($contextusers);
 $searchtext = trim($searchtext);
 if ($searchtext !== '') {
     // Search for a subset of remaining users
     $LIKE = sql_ilike();
     $FULLNAME = sql_fullname();
     $selectsql = " AND ({$FULLNAME} {$LIKE} '%{$searchtext}%' OR email {$LIKE} '%{$searchtext}%') ";
     $select .= $selectsql;
 } else {
     $selectsql = "";
 }
 if ($context->contextlevel > CONTEXT_COURSE && !is_inside_frontpage($context)) {
     // mod or block (or group?)
     /************************************************************************
      *                                                                      *
      * context level is above or equal course context level                 *
      * in this case we pull out all users matching search criteria (if any) *
      *                                                                      *
      * MDL-11324                                                            *
      * a mini get_users_by_capability() call here, this is done instead of  *
      * get_users_by_capability() because                                    *
      * 1) get_users_by_capability() does not deal with searching by name    *
      * 2) exceptions array can be potentially large for large courses       *
      * 3) get_recordset_sql() is more efficient                             *
      *                                                                      *
      ************************************************************************/
     if ($possibleroles = get_roles_with_capability('moodle/course:view', CAP_ALLOW, $context)) {
开发者ID:kai707,项目名称:ITSA-backup,代码行数:31,代码来源:assign.php


示例5: get_users_by_capability

/**
 * Who has this capability in this context?
 *
 * This can be a very expensive call - use sparingly and keep
 * the results if you are going to need them again soon.
 *
 * Note if $fields is empty this function attempts to get u.*
 * which can get rather large - and has a serious perf impact
 * on some DBs.
 *
 * @param context $context
 * @param string|array $capability - capability name(s)
 * @param string $fields - fields to be pulled. The user table is aliased to 'u'. u.id MUST be included.
 * @param string $sort - the sort order. Default is lastaccess time.
 * @param mixed $limitfrom - number of records to skip (offset)
 * @param mixed $limitnum - number of records to fetch
 * @param string|array $groups - single group or array of groups - only return
 *               users who are in one of these group(s).
 * @param string|array $exceptions - list of users to exclude, comma separated or array
 * @param bool $doanything_ignored not used any more, admin accounts are never returned
 * @param bool $view_ignored - use get_enrolled_sql() instead
 * @param bool $useviewallgroups if $groups is set the return users who
 *               have capability both $capability and moodle/site:accessallgroups
 *               in this context, as well as users who have $capability and who are
 *               in $groups.
 * @return mixed
 */
function get_users_by_capability(context $context, $capability, $fields = '', $sort = '', $limitfrom = '', $limitnum = '', $groups = '', $exceptions = '', $doanything_ignored = null, $view_ignored = null, $useviewallgroups = false)
{
    global $CFG, $DB;
    $defaultuserroleid = isset($CFG->defaultuserroleid) ? $CFG->defaultuserroleid : 0;
    $defaultfrontpageroleid = isset($CFG->defaultfrontpageroleid) ? $CFG->defaultfrontpageroleid : 0;
    $ctxids = trim($context->path, '/');
    $ctxids = str_replace('/', ',', $ctxids);
    // Context is the frontpage
    $iscoursepage = false;
    // coursepage other than fp
    $isfrontpage = false;
    if ($context->contextlevel == CONTEXT_COURSE) {
        if ($context->instanceid == SITEID) {
            $isfrontpage = true;
        } else {
            $iscoursepage = true;
        }
    }
    $isfrontpage = $isfrontpage || is_inside_frontpage($context);
    $caps = (array) $capability;
    // construct list of context paths bottom-->top
    list($contextids, $paths) = get_context_info_list($context);
    // we need to find out all roles that have these capabilities either in definition or in overrides
    $defs = array();
    list($incontexts, $params) = $DB->get_in_or_equal($contextids, SQL_PARAMS_NAMED, 'con');
    list($incaps, $params2) = $DB->get_in_or_equal($caps, SQL_PARAMS_NAMED, 'cap');
    $params = array_merge($params, $params2);
    $sql = "SELECT rc.id, rc.roleid, rc.permission, rc.capability, ctx.path\n              FROM {role_capabilities} rc\n              JOIN {context} ctx on rc.contextid = ctx.id\n             WHERE rc.contextid {$incontexts} AND rc.capability {$incaps}";
    $rcs = $DB->get_records_sql($sql, $params);
    foreach ($rcs as $rc) {
        $defs[$rc->capability][$rc->path][$rc->roleid] = $rc->permission;
    }
    // go through the permissions bottom-->top direction to evaluate the current permission,
    // first one wins (prohibit is an exception that always wins)
    $access = array();
    foreach ($caps as $cap) {
        foreach ($paths as $path) {
            if (empty($defs[$cap][$path])) {
                continue;
            }
            foreach ($defs[$cap][$path] as $roleid => $perm) {
                if ($perm == CAP_PROHIBIT) {
                    $access[$cap][$roleid] = CAP_PROHIBIT;
                    continue;
                }
                if (!isset($access[$cap][$roleid])) {
                    $access[$cap][$roleid] = (int) $perm;
                }
            }
        }
    }
    // make lists of roles that are needed and prohibited in this context
    $needed = array();
    // one of these is enough
    $prohibited = array();
    // must not have any of these
    foreach ($caps as $cap) {
        if (empty($access[$cap])) {
            continue;
        }
        foreach ($access[$cap] as $roleid => $perm) {
            if ($perm == CAP_PROHIBIT) {
                unset($needed[$cap][$roleid]);
                $prohibited[$cap][$roleid] = true;
            } else {
                if ($perm == CAP_ALLOW and empty($prohibited[$cap][$roleid])) {
                    $needed[$cap][$roleid] = true;
                }
            }
        }
        if (empty($needed[$cap]) or !empty($prohibited[$cap][$defaultuserroleid])) {
            // easy, nobody has the permission
            unset($needed[$cap]);
//.........这里部分代码省略.........
开发者ID:rolandovanegas,项目名称:moodle,代码行数:101,代码来源:accesslib.php


示例6: process_url_delete

 /**
  * Handle deleting a block.
  * @return boolean true if anything was done. False if not.
  */
 public function process_url_delete()
 {
     global $CFG, $PAGE, $OUTPUT;
     $blockid = optional_param('bui_deleteid', null, PARAM_INT);
     $confirmdelete = optional_param('bui_confirm', null, PARAM_INT);
     if (!$blockid) {
         return false;
     }
     require_sesskey();
     $block = $this->page->blocks->find_instance($blockid);
     if (!$this->user_can_delete_block($block)) {
         throw new moodle_exception('nopermissions', '', $this->page->url->out(), get_string('deleteablock'));
     }
     if (!$confirmdelete) {
         $deletepage = new moodle_page();
         $deletepage->set_pagelayout('admin');
         $deletepage->set_course($this->page->course);
         $deletepage->set_context($this->page->context);
         if ($this->page->cm) {
             $deletepage->set_cm($this->page->cm);
         }
         $deleteurlbase = str_replace($CFG->wwwroot . '/', '/', $this->page->url->out_omit_querystring());
         $deleteurlparams = $this->page->url->params();
         $deletepage->set_url($deleteurlbase, $deleteurlparams);
         $deletepage->set_block_actions_done();
         // At this point we are either going to redirect, or display the form, so
         // overwrite global $PAGE ready for this. (Formslib refers to it.)
         $PAGE = $deletepage;
         //some functions like MoodleQuickForm::addHelpButton use $OUTPUT so we need to replace that too
         $output = $deletepage->get_renderer('core');
         $OUTPUT = $output;
         $site = get_site();
         $blocktitle = $block->get_title();
         $strdeletecheck = get_string('deletecheck', 'block', $blocktitle);
         $message = get_string('deleteblockcheck', 'block', $blocktitle);
         // If the block is being shown in sub contexts display a warning.
         if ($block->instance->showinsubcontexts == 1) {
             $parentcontext = context::instance_by_id($block->instance->parentcontextid);
             $systemcontext = context_system::instance();
             $messagestring = new stdClass();
             $messagestring->location = $parentcontext->get_context_name();
             // Checking for blocks that may have visibility on the front page and pages added on that.
             if ($parentcontext->id != $systemcontext->id && is_inside_frontpage($parentcontext)) {
                 $messagestring->pagetype = get_string('showonfrontpageandsubs', 'block');
             } else {
                 $pagetypes = generate_page_type_patterns($this->page->pagetype, $parentcontext);
                 $messagestring->pagetype = $block->instance->pagetypepattern;
                 if (isset($pagetypes[$block->instance->pagetypepattern])) {
                     $messagestring->pagetype = $pagetypes[$block->instance->pagetypepattern];
                 }
             }
             $message = get_string('deleteblockwarning', 'block', $messagestring);
         }
         $PAGE->navbar->add($strdeletecheck);
         $PAGE->set_title($blocktitle . ': ' . $strdeletecheck);
         $PAGE->set_heading($site->fullname);
         echo $OUTPUT->header();
         $confirmurl = new moodle_url($deletepage->url, array('sesskey' => sesskey(), 'bui_deleteid' => $block->instance->id, 'bui_confirm' => 1));
         $cancelurl = new moodle_url($deletepage->url);
         $yesbutton = new single_button($confirmurl, get_string('yes'));
         $nobutton = new single_button($cancelurl, get_string('no'));
         echo $OUTPUT->confirm($message, $yesbutton, $nobutton);
         echo $OUTPUT->footer();
         // Make sure that nothing else happens after we have displayed this form.
         exit;
     } else {
         blocks_delete_instance($block->instance);
         // bui_deleteid and bui_confirm should not be in the PAGE url.
         $this->page->ensure_param_not_in_url('bui_deleteid');
         $this->page->ensure_param_not_in_url('bui_confirm');
         return true;
     }
 }
开发者ID:educakanchay,项目名称:campus,代码行数:77,代码来源:blocklib.php


示例7: require_login

    }
}
/// Check login and permissions.
require_login($course);
$canview = has_any_capability(array('moodle/role:assign', 'moodle/role:safeoverride', 'moodle/role:override', 'moodle/role:manage'), $context);
if (!$canview) {
    print_error('nopermissions', 'error', '', get_string('checkpermissions', 'role'));
}
/// These are needed early because of tabs.php
$assignableroles = get_assignable_roles($context, ROLENAME_BOTH);
$overridableroles = get_overridable_roles($context, ROLENAME_BOTH);
/// Get the user_selector we will need.
/// Teachers within a course just get to see the same list of people they can
/// assign roles to. Admins (people with moodle/role:manage) can run this report for any user.
$options = array('context' => $context, 'roleid' => 0);
if ($context->contextlevel > CONTEXT_COURSE && !is_inside_frontpage($context) && !has_capability('moodle/role:manage', $context)) {
    $userselector = new potential_assignees_below_course('reportuser', $options);
} else {
    $userselector = new potential_assignees_course_and_above('reportuser', $options);
}
$userselector->set_multiselect(false);
$userselector->set_rows(10);
/// Work out an appropriate page title.
$title = get_string('checkpermissionsin', 'role', $contextname);
$straction = get_string('checkpermissions', 'role');
// Used by tabs.php
/// Print the header and tabs
if ($context->contextlevel == CONTEXT_USER) {
    $user = get_record('user', 'id', $userid);
    $fullname = fullname($user, has_capability('moodle/site:viewfullnames', $context));
    /// course header
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:31,代码来源:check.php


示例8: get_users_by_capability


//.........这里部分代码省略.........
        // rolecaps from roles that also have
        // 'doanything' capabilities.
        $doanything_join = "LEFT OUTER JOIN (\n                              SELECT DISTINCT rc.roleid\n                              FROM {$CFG->prefix}role_capabilities rc\n                              WHERE rc.capability='moodle/site:doanything'\n                                    AND rc.permission=" . CAP_ALLOW . "\n                                    AND rc.contextid IN ({$ctxids})\n                          ) dar\n                             ON rc.roleid=dar.roleid";
        $doanything_cond = "AND dar.roleid IS NULL";
    }
    // fetch all capability records - we'll walk several
    // times over them, and should be a small set
    $negperm = false;
    // has any negative (<0) permission?
    $roleids = array();
    $sql = "SELECT rc.id, rc.roleid, rc.permission, rc.capability,\n                   ctx.depth AS ctxdepth, ctx.contextlevel AS ctxlevel\n            FROM {$CFG->prefix}role_capabilities rc\n            JOIN {$CFG->prefix}context ctx on rc.contextid = ctx.id\n            {$doanything_join}\n            WHERE rc.capability IN ({$caps}) AND ctx.id IN ({$ctxids})\n                  {$doanything_cond}\n            ORDER BY rc.roleid ASC, ctx.depth ASC";
    if ($capdefs = get_records_sql($sql)) {
        foreach ($capdefs as $rcid => $rc) {
            $roleids[] = (int) $rc->roleid;
            if ($rc->permission < 0) {
                $negperm = true;
            }
        }
    }
    $roleids = array_unique($roleids);
    if (count($roleids) === 0) {
        // noone here!
        return false;
    }
    // is the default role interesting? does it have
    // a relevant rolecap? (we use this a lot later)
    if (in_array((int) $CFG->defaultuserroleid, $roleids, true)) {
        $defaultroleinteresting = true;
    } else {
        $defaultroleinteresting = false;
    }
    // is the default role interesting? does it have
    // a relevant rolecap? (we use this a lot later)
    if (($isfrontpage or is_inside_frontpage($context)) and !empty($CFG->defaultfrontpageroleid) and in_array((int) $CFG->defaultfrontpageroleid, $roleids, true)) {
        if (!empty($CFG->fullusersbycapabilityonfrontpage)) {
            // new in 1.9.6 - full support for defaultfrontpagerole MDL-19039
            $frontpageroleinteresting = true;
        } else {
            // old style 1.9.0-1.9.5 - much faster + fewer negative override problems on frontpage
            $frontpageroleinteresting = $context->contextlevel == CONTEXT_COURSE;
        }
    } else {
        $frontpageroleinteresting = false;
    }
    //
    // Prepare query clauses
    //
    $wherecond = array();
    // Non-deleted users. We never return deleted users.
    $wherecond['nondeleted'] = 'u.deleted = 0';
    /// Groups
    if ($groups) {
        if (is_array($groups)) {
            $grouptest = 'gm.groupid IN (' . implode(',', $groups) . ')';
        } else {
            $grouptest = 'gm.groupid = ' . $groups;
        }
        $grouptest = 'u.id IN (SELECT userid FROM ' . $CFG->prefix . 'groups_members gm WHERE ' . $grouptest . ')';
        if ($useviewallgroups) {
            $viewallgroupsusers = get_users_by_capability($context, 'moodle/site:accessallgroups', 'u.id, u.id', '', '', '', '', $exceptions);
            $wherecond['groups'] = '(' . $grouptest . ' OR u.id IN (' . implode(',', array_keys($viewallgroupsusers)) . '))';
        } else {
            $wherecond['groups'] = '(' . $grouptest . ')';
        }
    }
    /// User exceptions
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:67,代码来源:accesslib.php



注:本文中的is_inside_frontpage函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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