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


PHP repository::get_type_by_typename方法代码示例

本文整理汇总了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;
}
开发者ID:alanaipe2015,项目名称:moodle,代码行数:51,代码来源:upgrade.php

示例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);
开发者ID:nmicha,项目名称:moodle,代码行数:31,代码来源:repositoryinstance.php

示例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 . '&amp;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
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:31,代码来源:manage_instances.php

示例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');
开发者ID:vuchannguyen,项目名称:web,代码行数:31,代码来源:repository.php

示例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();
 }
开发者ID:OctaveBabel,项目名称:moodle-itop,代码行数:9,代码来源:pluginscontrolslib.php


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