本文整理汇总了PHP中badge::make_clone方法的典型用法代码示例。如果您正苦于以下问题:PHP badge::make_clone方法的具体用法?PHP badge::make_clone怎么用?PHP badge::make_clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类badge
的用法示例。
在下文中一共展示了badge::make_clone方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_clone_badge
public function test_clone_badge()
{
$badge = new badge($this->badgeid);
$newid = $badge->make_clone();
$cloned_badge = new badge($newid);
$this->assertEquals($badge->image, $cloned_badge->image);
$this->assertEquals($badge->description, $cloned_badge->description);
$this->assertEquals($badge->issuercontact, $cloned_badge->issuercontact);
$this->assertEquals($badge->issuername, $cloned_badge->issuername);
$this->assertEquals($badge->issuerurl, $cloned_badge->issuerurl);
$this->assertEquals($badge->expiredate, $cloned_badge->expiredate);
$this->assertEquals($badge->expireperiod, $cloned_badge->expireperiod);
$this->assertEquals($badge->type, $cloned_badge->type);
$this->assertEquals($badge->courseid, $cloned_badge->courseid);
$this->assertEquals($badge->message, $cloned_badge->message);
$this->assertEquals($badge->messagesubject, $cloned_badge->messagesubject);
$this->assertEquals($badge->attachment, $cloned_badge->attachment);
$this->assertEquals($badge->notification, $cloned_badge->notification);
}
示例2: array
} else {
$PAGE->set_pagelayout('admin');
navigation_node::override_active_url($navurl, true);
}
$PAGE->set_context($context);
$PAGE->set_url('/badges/action.php', array('id' => $badge->id));
if ($return !== 0) {
$returnurl = new moodle_url($return);
} else {
$returnurl = new moodle_url('/badges/overview.php', array('id' => $badge->id));
}
$returnurl->remove_params('awards');
if ($copy) {
require_sesskey();
require_capability('moodle/badges:createbadge', $context);
$cloneid = $badge->make_clone();
// If a user can edit badge details, they will be redirected to the edit page.
if (has_capability('moodle/badges:configuredetails', $context)) {
redirect(new moodle_url('/badges/edit.php', array('id' => $cloneid, 'action' => 'details')));
}
redirect(new moodle_url('/badges/overview.php', array('id' => $cloneid)));
}
if ($activate) {
require_capability('moodle/badges:configurecriteria', $context);
$PAGE->url->param('activate', 1);
$status = $badge->status == BADGE_STATUS_INACTIVE ? BADGE_STATUS_ACTIVE : BADGE_STATUS_ACTIVE_LOCKED;
if ($confirm == 1) {
require_sesskey();
$badge->set_status($status);
$returnurl->param('msg', 'activatesuccess');
if ($badge->type == BADGE_TYPE_SITE) {
示例3: test_badge_duplicated
/**
* Test the badge duplicated event.
*
*/
public function test_badge_duplicated()
{
$badge = new badge($this->badgeid);
$sink = $this->redirectEvents();
// Trigger and capture the event.
$newid = $badge->make_clone();
$events = $sink->get_events();
$event = reset($events);
$this->assertCount(1, $events);
// Check that the event data is valid.
$this->assertInstanceOf('\\core\\event\\badge_duplicated', $event);
$this->assertEquals($newid, $event->objectid);
$this->assertDebuggingNotCalled();
$sink->close();
}