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


PHP badge::is_active方法代码示例

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


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

    }
    require_login($badge->courseid);
    $navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
}
require_capability('moodle/badges:awardbadge', $context);
$url = new moodle_url('/badges/award.php', array('id' => $badgeid, 'role' => $role));
$PAGE->set_url($url);
$PAGE->set_context($context);
// Set up navigation and breadcrumbs.
$strrecipients = get_string('recipients', 'badges');
navigation_node::override_active_url($navurl);
$PAGE->navbar->add($badge->name, new moodle_url('overview.php', array('id' => $badge->id)))->add($strrecipients);
$PAGE->set_title($strrecipients);
$PAGE->set_heading($badge->name);
$PAGE->set_pagelayout('standard');
if (!$badge->is_active()) {
    echo $OUTPUT->header();
    echo $OUTPUT->notification(get_string('donotaward', 'badges'));
    echo $OUTPUT->footer();
    die;
}
$output = $PAGE->get_renderer('core', 'badges');
// Roles that can award this badge.
$acceptedroles = array_keys($badge->criteria[BADGE_CRITERIA_TYPE_MANUAL]->params);
if (count($acceptedroles) > 1) {
    // If there is more than one role that can award a badge, prompt user to make a selection.
    // If it is an admin, include all accepted roles, otherwise only the ones that current user has in this context.
    if ($isadmin) {
        $selection = $acceptedroles;
    } else {
        // Get all the roles that user has and use the ones required by this badge.
开发者ID:masaterutakeno,项目名称:MoodleMobile,代码行数:31,代码来源:award.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

示例5: badges_award_handle_manual_criteria_review

/**
 * Triggered when badge is manually awarded.
 *
 * @param   object      $data
 * @return  boolean
 */
function badges_award_handle_manual_criteria_review(stdClass $data)
{
    $criteria = $data->crit;
    $userid = $data->userid;
    $badge = new badge($criteria->badgeid);
    if (!$badge->is_active() || $badge->is_issued($userid)) {
        return true;
    }
    if ($criteria->review($userid)) {
        $criteria->mark_complete($userid);
        if ($badge->criteria[BADGE_CRITERIA_TYPE_OVERALL]->review($userid)) {
            $badge->criteria[BADGE_CRITERIA_TYPE_OVERALL]->mark_complete($userid);
            $badge->issue($userid);
        }
    }
    return true;
}
开发者ID:Gavinthisisit,项目名称:Moodle,代码行数:23,代码来源:badgeslib.php

示例6: profile_criteria_review

 /**
  * Triggered when 'user_updated' event happens.
  *
  * @param \core\event\user_updated $event event generated when user profile is updated.
  */
 public static function profile_criteria_review(\core\event\user_updated $event)
 {
     global $DB, $CFG;
     if (!empty($CFG->enablebadges)) {
         require_once $CFG->dirroot . '/lib/badgeslib.php';
         $userid = $event->objectid;
         if ($rs = $DB->get_records('badge_criteria', array('criteriatype' => BADGE_CRITERIA_TYPE_PROFILE))) {
             foreach ($rs as $r) {
                 $badge = new badge($r->badgeid);
                 if (!$badge->is_active() || $badge->is_issued($userid)) {
                     continue;
                 }
                 if ($badge->criteria[BADGE_CRITERIA_TYPE_PROFILE]->review($userid)) {
                     $badge->criteria[BADGE_CRITERIA_TYPE_PROFILE]->mark_complete($userid);
                     if ($badge->criteria[BADGE_CRITERIA_TYPE_OVERALL]->review($userid)) {
                         $badge->criteria[BADGE_CRITERIA_TYPE_OVERALL]->mark_complete($userid);
                         $badge->issue($userid);
                     }
                 }
             }
         }
     }
 }
开发者ID:evltuma,项目名称:moodle,代码行数:28,代码来源:observer.php


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