当前位置: 首页>>代码示例>>PHP>>正文


PHP badge::is_locked方法代码示例

本文整理汇总了PHP中badge::is_locked方法的典型用法代码示例。如果您正苦于以下问题:PHP badge::is_locked方法的具体用法?PHP badge::is_locked怎么用?PHP badge::is_locked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在badge的用法示例。


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

示例1: print_criteria_actions

 public function print_criteria_actions(badge $badge)
 {
     $table = new html_table();
     $table->attributes = array('class' => 'boxaligncenter', 'id' => 'badgeactions');
     $table->colclasses = array('activatebadge');
     $actions = array();
     if (!$badge->is_active() && !$badge->is_locked()) {
         $accepted = $badge->get_accepted_criteria();
         $potential = array_diff($accepted, array_keys($badge->criteria));
         if (!empty($potential)) {
             foreach ($potential as $p) {
                 if ($p != 0) {
                     $select[$p] = get_string('criteria_' . $p, 'badges');
                 }
             }
             $actions[] = get_string('addbadgecriteria', 'badges');
             $actions[] = $this->output->single_select(new moodle_url('/badges/criteria_settings.php', array('badgeid' => $badge->id, 'add' => true)), 'type', $select);
         } else {
             $actions[] = $this->output->box(get_string('nothingtoadd', 'badges'), 'clearfix');
         }
     }
     $table->data[] = $actions;
     return html_writer::table($table);
 }
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:24,代码来源:renderer.php

示例2: dirname

require_once dirname(dirname(__FILE__)) . '/config.php';
require_once $CFG->libdir . '/badgeslib.php';
$badgeid = optional_param('badgeid', 0, PARAM_INT);
// Badge ID.
$crit = optional_param('crit', 0, PARAM_INT);
$type = optional_param('type', 0, PARAM_INT);
// Criteria type.
$delete = optional_param('delete', 0, PARAM_BOOL);
$confirm = optional_param('confirm', 0, PARAM_BOOL);
require_login();
$return = new moodle_url('/badges/criteria.php', array('id' => $badgeid));
$badge = new badge($badgeid);
$context = $badge->get_context();
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type));
// Make sure that no actions available for locked or active badges.
if ($badge->is_active() || $badge->is_locked()) {
    redirect($return);
}
if ($badge->type == BADGE_TYPE_COURSE) {
    require_login($badge->courseid);
    $navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
}
$PAGE->set_context($context);
$PAGE->set_url('/badges/criteria_action.php');
$PAGE->set_pagelayout('standard');
$PAGE->set_heading($badge->name);
$PAGE->set_title($badge->name);
navigation_node::override_active_url($navurl);
if ($delete && has_capability('moodle/badges:configurecriteria', $context)) {
    if (!$confirm) {
        $optionsyes = array('confirm' => 1, 'sesskey' => sesskey(), 'badgeid' => $badgeid, 'delete' => true, 'type' => $type);
开发者ID:masaterutakeno,项目名称:MoodleMobile,代码行数:31,代码来源:criteria_action.php

示例3: redirect

    } else {
        if ($badge->is_locked()) {
            $badge->set_status(BADGE_STATUS_ACTIVE_LOCKED);
            $msg = get_string('activatesuccess', 'badges');
        } else {
            require_sesskey();
            $badge->set_status(BADGE_STATUS_ACTIVE);
            $msg = get_string('activatesuccess', 'badges');
        }
        $returnurl->param('msg', $msg);
        redirect($returnurl);
    }
} else {
    if ($deactivate && has_capability('moodle/badges:configuredetails', $PAGE->context)) {
        $badge = new badge($deactivate);
        if ($badge->is_locked()) {
            $badge->set_status(BADGE_STATUS_INACTIVE_LOCKED);
            $msg = get_string('deactivatesuccess', 'badges');
        } else {
            require_sesskey();
            $badge->set_status(BADGE_STATUS_INACTIVE);
            $msg = get_string('deactivatesuccess', 'badges');
        }
        $returnurl->param('msg', $msg);
        redirect($returnurl);
    }
}
echo $OUTPUT->header();
if ($type == BADGE_TYPE_SITE) {
    echo $OUTPUT->heading_with_help($PAGE->heading, 'sitebadges', 'badges');
} else {
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:31,代码来源:index.php

示例4: print_criteria_actions

 public function print_criteria_actions(badge $badge)
 {
     $output = '';
     if (!$badge->is_active() && !$badge->is_locked()) {
         $accepted = $badge->get_accepted_criteria();
         $potential = array_diff($accepted, array_keys($badge->criteria));
         if (!empty($potential)) {
             foreach ($potential as $p) {
                 if ($p != 0) {
                     $select[$p] = get_string('criteria_' . $p, 'badges');
                 }
             }
             $output .= $this->output->single_select(new moodle_url('/badges/criteria_settings.php', array('badgeid' => $badge->id, 'add' => true)), 'type', $select, '', array('' => 'choosedots'), null, array('label' => get_string('addbadgecriteria', 'badges')));
         } else {
             $output .= $this->output->box(get_string('nothingtoadd', 'badges'), 'clearfix');
         }
     }
     return $output;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:19,代码来源:renderer.php


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