本文整理汇总了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);
}
示例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);
示例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 {
示例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;
}