本文整理汇总了PHP中repository::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP repository::__construct方法的具体用法?PHP repository::__construct怎么用?PHP repository::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类repository
的用法示例。
在下文中一共展示了repository::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array()) {
global $SESSION, $CFG, $DB, $PAGE;
if (!is_numeric($repositoryid)) {
// ELIS-8550: were constructing these with repositoryid = 'elisfiles'
$sql = 'SELECT MIN(ri.id)
FROM {repository} r
JOIN {repository_instances} ri
ON r.id = ri.typeid
WHERE r.type = ?';
$repositoryid = $DB->get_field_sql($sql, array($repositoryid));
}
parent::__construct($repositoryid, $context, $options);
require_once dirname(__FILE__). '/ELIS_files_factory.class.php';
if (is_object($context)) {
$this->context = $context;
} else {
$this->context = context::instance_by_id($context);
}
/// ELIS files class
$this->elis_files = repository_factory::factory();
$this->config = get_config('elisfiles');
$this->current_node = null;
// jQuery files required for file picker - just for this repository
$PAGE->requires->js('/repository/elisfiles/js/jquery-1.6.2.min.js');
$PAGE->requires->js('/repository/elisfiles/js/jquery-ui-1.8.16.custom.min.js');
$PAGE->requires->js('/repository/elisfiles/js/fileuploader.js');
$PAGE->requires->js('/repository/elisfiles/lib/HTML_TreeMenu-1.2.0/TreeMenu.js', true);
}
示例2: __construct
/**
* @param int $repositoryid
* @param object $context
* @param array $options
*/
public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array())
{
global $CFG;
parent::__construct($repositoryid, $context, $options);
$this->file_url = optional_param('file', '', PARAM_RAW);
$this->file_url = $this->escape_url($this->file_url);
}
示例3: __construct
public function __construct($repositoryid, $context = SITEID, $options = array())
{
global $SESSION, $CFG;
parent::__construct($repositoryid, $context, $options);
$this->sessname = 'alfresco_ticket_' . $this->id;
if (class_exists('SoapClient')) {
require_once $CFG->libdir . '/alfresco/Service/Repository.php';
require_once $CFG->libdir . '/alfresco/Service/Session.php';
require_once $CFG->libdir . '/alfresco/Service/SpacesStore.php';
require_once $CFG->libdir . '/alfresco/Service/Node.php';
// setup alfresco instance
$this->instance = new Alfresco_Repository($this->options['alfresco_url']);
$this->username = optional_param('al_username', '', PARAM_RAW);
$this->password = optional_param('al_password', '', PARAM_RAW);
try {
// deal with user logging in
if (empty($SESSION->{$this->sessname}) && !empty($this->username) && !empty($this->password)) {
$this->ticket = $this->instance->authenticate($this->username, $this->password);
$SESSION->{$this->sessname} = $this->ticket;
} else {
if (!empty($SESSION->{$this->sessname})) {
$this->ticket = $SESSION->{$this->sessname};
}
}
$this->user_session = $this->instance->createSession($this->ticket);
$this->store = new SpacesStore($this->user_session);
} catch (Exception $e) {
$this->logout();
}
$this->current_node = null;
} else {
$this->disabled = true;
}
}
示例4: __construct
/**
* Constructor
* @param int $repositoryid
* @param object $context
* @param array $options
*/
public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array())
{
global $CFG;
parent::__construct($repositoryid, $context, $options);
$this->access_key = get_config('s3', 'access_key');
$this->secret_key = get_config('s3', 'secret_key');
$this->endpoint = get_config('s3', 'endpoint');
if ($this->endpoint === false) {
// If no endpoint has been set, use the default.
$this->endpoint = 's3.amazonaws.com';
}
$this->s = new S3($this->access_key, $this->secret_key, false, $this->endpoint);
$this->s->setExceptions(true);
// Port of curl::__construct().
if (!empty($CFG->proxyhost)) {
if (empty($CFG->proxyport)) {
$proxyhost = $CFG->proxyhost;
} else {
$proxyhost = $CFG->proxyhost . ':' . $CFG->proxyport;
}
$proxytype = CURLPROXY_HTTP;
$proxyuser = null;
$proxypass = null;
if (!empty($CFG->proxyuser) and !empty($CFG->proxypassword)) {
$proxyuser = $CFG->proxyuser;
$proxypass = $CFG->proxypassword;
}
if (!empty($CFG->proxytype) && $CFG->proxytype == 'SOCKS5') {
$proxytype = CURLPROXY_SOCKS5;
}
$this->s->setProxy($proxyhost, $proxyuser, $proxypass, $proxytype);
}
}
示例5: __construct
public function __construct($repositoryid, $context, array $options, $readonly)
{
global $SESSION, $PAGE;
parent::__construct($repositoryid, $context, $options, $readonly);
$this->config = get_config('entermedia');
$PAGE->requires->js('/repository/entermedia/javascript/jquery.sumoselect.min.js');
$PAGE->requires->yui_module('moodle-repository_entermedia-filepicker', 'M.repository_entermedia.filepicker.init');
$PAGE->requires->strings_for_js(array('search_placeholder', 'search_selectall'), 'repository_entermedia');
// Handle login
if ($this->config->autologin_enable == 1) {
$username = $this->config->autologin_user;
$password = $this->config->autologin_password;
} else {
$username = optional_param('entermedia_username', '', PARAM_RAW);
$password = optional_param('entermedia_password', '', PARAM_RAW);
}
try {
if (empty($SESSION->entermediakey) && !empty($username) && !empty($password)) {
$maybeKey = $this->try_login($username, $password);
if ($maybeKey) {
$this->entermediakey = $SESSION->entermediakey = $maybeKey;
} else {
// TODO Handle error
}
} else {
if (!empty($SESSION->entermediakey)) {
$this->entermediakey = $SESSION->entermediakey;
}
}
} catch (GuzzleException $e) {
$this->logout();
}
}
示例6: __construct
public function __construct($repositoryid = 9, $context = SYSCONTEXTID, $options = array(), $readonly = 0)
{
global $USER, $COURSE, $DB;
$this->repositoryid = $repositoryid;
$this->context = $context;
$this->options = $options;
$this->readonly = $readonly;
$this->useremail = $COURSE->shortname . '@luther.edu';
if (!($this->admin = get_config('morsle', 'google_admin'))) {
throw new moodle_exception('Google admin not setup');
}
parent::__construct($this->repositoryid, $this->context, $this->options, $this->readonly);
// days past last enrollment day that morsle resources are retained
$this->expires = get_config('morsle', 'morsle_expiration') == 0 ? 600 * 24 * 60 * 60 : get_config('blocks/morsle', 'morsle_expiration') * 24 * 60 * 60;
$this->curtime = time();
// set basefeeds
$this->user_auth = "https://www.googleapis.com/auth/admin.directory.user";
$this->site_feed = "https://sites.google.com/feeds/site/{$this->domain}";
$this->drive_auth = 'https://www.googleapis.com/auth/drive ';
$this->file_auth = 'https://www.googleapis.com/auth/drive.file ';
$this->alias_feed = "https://apps-apis.google.com/a/feeds/alias/2.0/{$this->domain}/?start=aaaarnold@luther.edu";
$this->group_auth = 'https://www.googleapis.com/auth/admin.directory.group';
$this->id_feed = 'https://docs.google.com/feeds/id/';
$this->cal_auth = 'https://www.googleapis.com/auth/calendar';
$this->owncalendars_feed = 'https://www.google.com/calendar/feeds/default/owncalendars/full';
// skip marked for delete, unapproved and past term
$this->disregard = "'Past Term','DELETED'";
}
示例7: __construct
/**
* Constructor of dropbox plugin
*
* @param int $repositoryid
* @param stdClass $context
* @param array $options
*/
public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array())
{
global $CFG;
$options['page'] = optional_param('p', 1, PARAM_INT);
parent::__construct($repositoryid, $context, $options);
$this->setting = 'dropbox_';
$this->dropbox_key = $this->get_option('dropbox_key');
$this->dropbox_secret = $this->get_option('dropbox_secret');
// one day
$this->cachedfilettl = 60 * 60 * 24;
if (isset($options['access_key'])) {
$this->access_key = $options['access_key'];
} else {
$this->access_key = get_user_preferences($this->setting . '_access_key', '');
}
if (isset($options['access_secret'])) {
$this->access_secret = $options['access_secret'];
} else {
$this->access_secret = get_user_preferences($this->setting . '_access_secret', '');
}
if (!empty($this->access_key) && !empty($this->access_secret)) {
$this->logged = true;
}
$callbackurl = new moodle_url($CFG->wwwroot . '/repository/repository_callback.php', array('callback' => 'yes', 'repo_id' => $repositoryid));
$args = array('oauth_consumer_key' => $this->dropbox_key, 'oauth_consumer_secret' => $this->dropbox_secret, 'oauth_callback' => $callbackurl->out(false), 'api_root' => 'https://api.dropbox.com/1/oauth');
$this->dropbox = new dropbox($args);
}
示例8: __construct
public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array())
{
parent::__construct($repositoryid, $context, $options);
$this->keyword = optional_param('merlot_keyword', '', PARAM_RAW);
$this->author = optional_param('merlot_author', '', PARAM_RAW);
$this->licensekey = trim(get_config('merlot', 'licensekey'));
}
示例9: __construct
public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array())
{
parent::__construct($repositoryid, $context, $options);
$this->list_url = "https://media.heanet.ie/api/1.0/media_list.php?";
$this->check_login_url = "https://media.heanet.ie/api/1.0/media_list.php?";
$this->bind_url = "https://media.heanet.ie/secure/account/user_setguid.php?";
}
示例10: __construct
/**
* Constructor
* @param int $repositoryid
* @param object $context
* @param array $options
*/
public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array()) {
parent::__construct($repositoryid, $context, $options);
$this->access_key = get_config('s3', 'access_key');
$this->secret_key = get_config('s3', 'secret_key');
$this->s = new S3($this->access_key, $this->secret_key);
$this->s->setExceptions(true);
}
示例11: __construct
public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array())
{
parent::__construct($repositoryid, $context, $options);
// set up webdav client
if (empty($this->options['webdav_server'])) {
return;
}
if ($this->options['webdav_auth'] == 'none') {
$this->options['webdav_auth'] = false;
}
$this->dav = new webdav_client($this->options['webdav_server'], $this->options['webdav_user'], $this->options['webdav_password'], $this->options['webdav_auth']);
if (empty($this->options['webdav_type'])) {
$this->webdav_type = '';
} else {
$this->webdav_type = 'ssl://';
}
if (empty($this->options['webdav_port'])) {
if (empty($this->webdav_type)) {
$this->dav->port = 80;
} else {
$this->dav->port = 443;
}
$port = '';
} else {
$this->dav->port = $this->options['webdav_port'];
$port = ':' . $this->options['webdav_port'];
}
$this->webdav_host = $this->webdav_type . $this->options['webdav_server'] . $port;
$this->dav->debug = false;
}
示例12: __construct
/**
* Youtube plugin constructor
* @param int $repositoryid
* @param object $context
* @param array $options
*/
public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array())
{
$this->start = 1;
$this->max = 27;
$this->sort = optional_param('youtube_sort', 'relevance', PARAM_TEXT);
parent::__construct($repositoryid, $context, $options);
}
示例13: __construct
public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array())
{
$options['page'] = optional_param('p', 1, PARAM_INT);
parent::__construct($repositoryid, $context, $options);
// if moodle is telling us what kind of mimetypes it wants, we check to see if it happens to be just ZIP.
// If that's the case, we know we're on a SCORM page, because in all other cases supported_filetypes() will return web_image
// this allows us to override our own type and act like a SCORM supplier.
if (isset($options['mimetypes'])) {
if (in_array(".zip", $options['mimetypes'])) {
$this->fileTypes = "zipscorm";
$this->fileExtension = ".zip";
}
}
$this->setting = 'elevator_';
$elevatorURL = get_config('elevator', 'elevatorURL');
$apiKey = get_config('elevator', 'apiKey');
$apiSecret = get_config('elevator', 'apiSecret');
if (isset($options['userId'])) {
$this->userId = $options['userId'];
} else {
$this->userId = get_user_preferences($this->setting . '_userId', '');
}
$this->repositoryId = $repositoryid;
// initiate an instance of the elevator API, which handles all the backend communication.
$this->elevatorAPI = new elevatorAPI($elevatorURL, $apiKey, $apiSecret, $this->userId);
$this->elevatorAPI->fileTypes = $this->fileTypes;
if ($this->userId) {
$this->loggedIn = $this->testUserId();
$this->manageURL = $this->elevatorAPI->getManageURL();
}
}
示例14: __construct
public function __construct($repositoryid, $context = SITEID, $options = array())
{
parent::__construct($repositoryid, $context, $options);
if (empty($this->root_path)) {
return;
}
$this->root_path = trim($this->root_path);
if (!empty($options['ajax'])) {
// if created from filepicker
if (empty($this->root_path)) {
$ret = array();
$ret['msg'] = get_string('invalidpath', 'repository_filesystem');
$ret['nosearch'] = true;
echo json_encode($ret);
exit;
} else {
if (!is_dir($this->root_path)) {
$ret = array();
$ret['msg'] = get_string('invalidpath', 'repository_filesystem');
$ret['nosearch'] = true;
if ($options['ajax']) {
echo json_encode($ret);
exit;
}
}
}
if ($this->root_path[strlen($this->root_path) - 1] !== '/') {
$this->root_path .= '/';
}
}
}
示例15: __construct
/**
* constructor method
*
* @global object $CFG
* @global object $SESSION
* @param int $repositoryid
* @param int $context
* @param array $options
* @param boolean $readonly
*/
public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array(), $readonly=0) {
global $CFG, $SESSION;
parent::__construct($repositoryid, $context, $options,$readonly);
$this->api_key = $this->get_option('api_key');
$this->flickr = new phpFlickr($this->api_key);
$this->flickr_account = $this->get_option('email_address');
$this->usewatermarks = $this->get_option('usewatermarks');
$account = optional_param('flickr_account', '', PARAM_RAW);
$fulltext = optional_param('flickr_fulltext', '', PARAM_RAW);
if (empty($fulltext)) {
$fulltext = optional_param('s', '', PARAM_RAW);
}
$tag = optional_param('flickr_tag', '', PARAM_RAW);
$license = optional_param('flickr_license', '', PARAM_RAW);
$this->sess_account = 'flickr_public_'.$this->id.'_account';
$this->sess_tag = 'flickr_public_'.$this->id.'_tag';
$this->sess_text = 'flickr_public_'.$this->id.'_text';
if (!empty($account) or !empty($fulltext) or !empty($tag) or !empty($license)) {
$SESSION->{$this->sess_tag} = $tag;
$SESSION->{$this->sess_text} = $fulltext;
$SESSION->{$this->sess_account} = $account;
}
}