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


PHP repository::get_instance方法代码示例

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


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

示例1: getPublicClientFromSession

 public static function getPublicClientFromSession($repositoryid)
 {
     global $SESSION;
     // Get the Soap Client connection to the Hive web services from the session
     $publicClient = unserialize($SESSION->{'publicClient' . $repositoryid});
     if (empty($publicClient)) {
         $options = repository::get_instance($repositoryid)->options;
         $publicClient = self::getPublicClient($options['hwsurl']);
     }
     $SESSION->{'publicClient' . $repositoryid} = serialize($publicClient);
     return $publicClient;
 }
开发者ID:harvestroad,项目名称:moodle-repository_hive,代码行数:12,代码来源:webservice.class.php

示例2: create

 /**
  * Create an instance for this plug-in
  *
  * @static
  * @param string $type the type of the repository
  * @param int $userid the user id
  * @param stdClass $context the context
  * @param array $params the options for this instance
  * @param int $readonly whether to create it readonly or not (defaults to not)
  * @return mixed
  */
 public static function create($type, $userid, $context, $params, $readonly = 0)
 {
     global $CFG, $DB;
     $params = (array) $params;
     require_once $CFG->dirroot . '/repository/' . $type . '/lib.php';
     $classname = 'repository_' . $type;
     if ($repo = $DB->get_record('repository', array('type' => $type))) {
         $record = new stdClass();
         $record->name = $params['name'];
         $record->typeid = $repo->id;
         $record->timecreated = time();
         $record->timemodified = time();
         $record->contextid = $context->id;
         $record->readonly = $readonly;
         $record->userid = $userid;
         $id = $DB->insert_record('repository_instances', $record);
         cache::make('core', 'repositories')->purge();
         $options = array();
         $configs = call_user_func($classname . '::get_instance_option_names');
         if (!empty($configs)) {
             foreach ($configs as $config) {
                 if (isset($params[$config])) {
                     $options[$config] = $params[$config];
                 } else {
                     $options[$config] = null;
                 }
             }
         }
         if (!empty($id)) {
             unset($options['name']);
             $instance = repository::get_instance($id);
             $instance->set_option($options);
             return $id;
         } else {
             return null;
         }
     } else {
         return null;
     }
 }
开发者ID:isuruAb,项目名称:moodle,代码行数:51,代码来源:lib.php

示例3: redirect

            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);
                }
                exit;
            }
            echo $OUTPUT->header();
            echo $OUTPUT->box_start('generalbox', 'notice');
开发者ID:nmicha,项目名称:moodle,代码行数:31,代码来源:repositoryinstance.php

示例4: required_param

<?php

require_once '../../config.php';
require_once $CFG->dirroot . '/repository/lib.php';
global $PAGE, $USER;
//this doesnt seem to work here. So had to put an echo "...embed-comressed.jpg" code below
//$PAGE->requires->js(new moodle_url($CFG->httpswwwroot . '/filter/poodll/flash/embed-compressed.js'),true);
// we get the request parameters:
// the repository ID controls where the file will be added
$repo_id = required_param('repo_id', PARAM_INT);
// repository ID
$filename = optional_param('filename', '', PARAM_TEXT);
// filename
// load the repository
$repo = repository::get_instance($repo_id);
if (empty($repo)) {
    die;
}
// we output a simple HTML page with the poodll recorder code in it
//$PAGE->set_generaltype('popup');
//we meed to do something like this to get a progress bar in the repo for html5
//$PAGE->requires->css(new moodle_url($CFG->httpswwwroot . '/filter/poodll/styles.css'));
echo "<link rel=\"stylesheet\" href=\"{$CFG->wwwroot}/filter/poodll/styles.css\" />";
$PAGE->set_context(context_user::instance($USER->id));
$PAGE->set_url($CFG->wwwroot . '/repository/poodll/record.php', array('repo_id' => $repo_id));
//print_header(null, get_string('recordnew', 'repository_poodll'),null, null, null, false);
?>

<div style="text-align: center;">
<?php 
if ($filename == '') {
开发者ID:laiello,项目名称:poodll.poodll23,代码行数:31,代码来源:recorder.php

示例5: update_references_to_storedfile

 /**
  * Updates all files that are referencing this file with the new contenthash
  * and filesize
  *
  * @param stored_file $storedfile
  */
 public function update_references_to_storedfile(stored_file $storedfile)
 {
     global $CFG, $DB;
     $params = array();
     $params['contextid'] = $storedfile->get_contextid();
     $params['component'] = $storedfile->get_component();
     $params['filearea'] = $storedfile->get_filearea();
     $params['itemid'] = $storedfile->get_itemid();
     $params['filename'] = $storedfile->get_filename();
     $params['filepath'] = $storedfile->get_filepath();
     $reference = self::pack_reference($params);
     $referencehash = sha1($reference);
     $sql = "SELECT repositoryid, id FROM {files_reference}\n                 WHERE referencehash = ? and reference = ?";
     $rs = $DB->get_recordset_sql($sql, array($referencehash, $reference));
     $now = time();
     foreach ($rs as $record) {
         require_once $CFG->dirroot . '/repository/lib.php';
         $repo = repository::get_instance($record->repositoryid);
         $lifetime = $repo->get_reference_file_lifetime($reference);
         $this->update_references($record->id, $now, $lifetime, $storedfile->get_contenthash(), $storedfile->get_filesize(), 0);
     }
     $rs->close();
 }
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:29,代码来源:file_storage.php


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