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


PHP badge::delete方法代码示例

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


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

示例1: redirect

    redirect($CFG->wwwroot);
}
$PAGE->set_title($hdr);
$PAGE->requires->js('/badges/backpack.js');
$PAGE->requires->js_init_call('check_site_access', null, false);
$output = $PAGE->get_renderer('core', 'badges');
if ($delete && has_capability('moodle/badges:deletebadge', $PAGE->context)) {
    $badge = new badge($delete);
    if (!$confirm) {
        echo $output->header();
        echo $output->confirm(get_string('delconfirm', 'badges', $badge->name), new moodle_url($PAGE->url, array('delete' => $badge->id, 'confirm' => 1)), $returnurl);
        echo $output->footer();
        die;
    } else {
        require_sesskey();
        $badge->delete();
        redirect($returnurl);
    }
}
if ($activate && has_capability('moodle/badges:configuredetails', $PAGE->context)) {
    $badge = new badge($activate);
    if (!$badge->has_criteria()) {
        $err = get_string('error:cannotact', 'badges') . get_string('nocriteria', 'badges');
    } 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');
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:31,代码来源:index.php

示例2: test_delete_badge

 public function test_delete_badge()
 {
     $badge = new badge($this->badgeid);
     $badge->delete();
     // We don't actually delete badges. We archive them.
     $this->assertAttributeEquals(BADGE_STATUS_ARCHIVED, 'status', $badge);
 }
开发者ID:nikitskynikita,项目名称:moodle,代码行数:7,代码来源:badgeslib_test.php

示例3: test_badge_deleted

 /**
  * Test the badge deleted event.
  */
 public function test_badge_deleted()
 {
     $badge = new badge($this->badgeid);
     $sink = $this->redirectEvents();
     // Trigger and capture the event.
     $badge->delete(false);
     $events = $sink->get_events();
     $event = reset($events);
     $this->assertCount(1, $events);
     // Check that the event data is valid.
     $this->assertInstanceOf('\\core\\event\\badge_deleted', $event);
     $this->assertEquals($badge->id, $event->objectid);
     $this->assertDebuggingNotCalled();
     $sink->close();
 }
开发者ID:evltuma,项目名称:moodle,代码行数:18,代码来源:events_test.php

示例4: array

        // Archive this badge?
        echo $output->heading(get_string('archivebadge', 'badges', $badge->name));
        $archivebutton = $output->single_button(new moodle_url($PAGE->url, array('archive' => $badge->id, 'confirm' => 1)), get_string('archiveconfirm', 'badges'));
        echo $output->box(get_string('archivehelp', 'badges') . $archivebutton, 'generalbox');
        // Delete this badge?
        echo $output->heading(get_string('delbadge', 'badges', $badge->name));
        $deletebutton = $output->single_button(new moodle_url($PAGE->url, array('delete' => $badge->id, 'confirm' => 1)), get_string('delconfirm', 'badges'));
        echo $output->box(get_string('deletehelp', 'badges') . $deletebutton, 'generalbox');
        // Go back.
        echo $output->action_link($returnurl, get_string('cancel'));
        echo $output->footer();
        die;
    } else {
        require_sesskey();
        $archiveonly = $archive != 0 ? true : false;
        $badge->delete($archiveonly);
        redirect($returnurl);
    }
}
if ($deactivate && has_capability('moodle/badges:configuredetails', $PAGE->context)) {
    require_sesskey();
    $badge = new badge($deactivate);
    if ($badge->is_locked()) {
        $badge->set_status(BADGE_STATUS_INACTIVE_LOCKED);
    } else {
        $badge->set_status(BADGE_STATUS_INACTIVE);
    }
    $msg = 'deactivatesuccess';
    $returnurl->param('msg', $msg);
    redirect($returnurl);
}
开发者ID:sirromas,项目名称:lms,代码行数:31,代码来源:index.php


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