本文整理汇总了PHP中repository::get_type_by_typename方法的典型用法代码示例。如果您正苦于以下问题:PHP repository::get_type_by_typename方法的具体用法?PHP repository::get_type_by_typename怎么用?PHP repository::get_type_by_typename使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类repository
的用法示例。
在下文中一共展示了repository::get_type_by_typename方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: xmldb_repository_boxnet_upgrade
/**
* Upgrade function.
*
* @param int $oldversion the version we are upgrading from.
* @return bool result
*/
function xmldb_repository_boxnet_upgrade($oldversion)
{
global $CFG, $DB;
$dbman = $DB->get_manager();
if ($oldversion < 2013110503) {
// Delete old user preferences containing auth tokens.
$DB->delete_records('user_preferences', array('name' => 'boxnet__auth_token'));
upgrade_plugin_savepoint(true, 2013110503, 'repository', 'boxnet');
}
if ($oldversion < 2013110700) {
require_once $CFG->dirroot . '/repository/lib.php';
require_once $CFG->dirroot . '/repository/boxnet/db/upgradelib.php';
$clientid = get_config('boxnet', 'clientid');
$clientsecret = get_config('boxnet', 'clientsecret');
// Only proceed if the repository hasn't been set for APIv2 yet.
if ($clientid === false && $clientsecret === false) {
$params = array();
$params['context'] = array();
$params['onlyvisible'] = false;
$params['type'] = 'boxnet';
$instances = repository::get_instances($params);
// Notify the admin about the migration process if they are using the repo.
if (!empty($instances)) {
repository_boxnet_admin_upgrade_notification();
}
// Hide the repository.
$repositorytype = repository::get_type_by_typename('boxnet');
if (!empty($repositorytype)) {
$repositorytype->update_visibility(false);
}
}
upgrade_plugin_savepoint(true, 2013110700, 'repository', 'boxnet');
}
// Moodle v2.6.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.7.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.8.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
示例2: print_error
} else {
print_error('instancenotsaved', 'repository', $parenturl);
}
exit;
} else {
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('configplugin', 'repository_' . $plugin));
echo $OUTPUT->box_start();
$mform->display();
echo $OUTPUT->box_end();
$return = false;
}
}
} else {
if (!empty($hide)) {
$instance = repository::get_type_by_typename($hide);
$instance->hide();
$return = true;
} else {
if (!empty($delete)) {
$instance = repository::get_instance($delete);
//if you try to delete an instance set as readonly, display an error message
if ($instance->readonly) {
throw new repository_exception('readonlyinstance', 'repository');
}
if ($sure) {
if ($instance->delete($downloadcontents)) {
$deletedstr = get_string('instancedeleted', 'repository');
redirect($parenturl, $deletedstr, 3);
} else {
print_error('instancenotdeleted', 'repository', $parenturl);
示例3: get_string
$pagename = get_string("personalrepositories", 'repository');
//is the user looking at its own repository instances
if ($USER->id != $context->instanceid) {
print_error('notyourinstances', 'repository');
}
$user = $USER;
} else {
// throw an error here
print_error('wrongcontextid');
exit;
}
}
$baseurl = $CFG->wwwroot . '/repository/manage_instances.php?contextid=' . $contextid . '&sesskey=' . sesskey();
/// Security: we cannot perform any action if the type is not visible or if the context has been disabled
if (!empty($new)) {
$type = repository::get_type_by_typename($new);
} else {
if (!empty($edit)) {
$instance = repository::get_instance($edit);
$type = repository::get_type_by_id($instance->typeid);
} else {
if (!empty($delete)) {
$instance = repository::get_instance($delete);
$type = repository::get_type_by_id($instance->typeid);
}
}
}
if (isset($type) && (!$type->get_visible() || !$type->get_contextvisibility($context->contextlevel))) {
print_error('typenotvisible', 'repository', $baseurl);
}
/// Create navigation links
示例4: print_error
} else {
print_error('instancenotdeleted', 'repository', $baseurl);
}
exit;
} else {
echo $OUTPUT->header();
echo $OUTPUT->confirm(get_string('confirmremove', 'repository', $repositorytype->get_readablename()), $sesskeyurl . '&action=delete&repos=' . $repository . '&sure=yes', $baseurl);
$return = false;
}
} else {
if ($action == 'moveup') {
$repositorytype = repository::get_type_by_typename($repository);
$repositorytype->move_order('up');
} else {
if ($action == 'movedown') {
$repositorytype = repository::get_type_by_typename($repository);
$repositorytype->move_order('down');
} else {
// If page is loaded directly
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('manage', 'repository'));
// Get strings that are used
$strshow = get_string('on', 'repository');
$strhide = get_string('off', 'repository');
$strdelete = get_string('disabled', 'repository');
$actionchoicesforexisting = array('show' => $strshow, 'hide' => $strhide, 'delete' => $strdelete);
$actionchoicesfornew = array('newon' => $strshow, 'newoff' => $strhide, 'delete' => $strdelete);
$output = '';
$output .= $OUTPUT->box_start('generalbox');
// Set strings that are used multiple times
$settingsstr = get_string('settings');
示例5: is_enabled
function is_enabled()
{
global $DB;
$repositorytype = repository::get_type_by_typename($this->plugin);
if (empty($repositorytype)) {
return null;
}
return $repositorytype->get_visible();
}