本文整理汇总了PHP中repository类的典型用法代码示例。如果您正苦于以下问题:PHP repository类的具体用法?PHP repository怎么用?PHP repository使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了repository类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$clientId = $this->userRepository->find(Auth::user()->id)->client->id;
$orders = $this->repository->scopeQuery(function ($query) use($clientId) {
return $query->where('client_id', '=', $clientId);
})->paginate();
return view('customer.order.index', compact('orders'));
}
示例2: shutdown
function shutdown()
{
global $db, $repoinprogress;
if ($repoinprogress) {
echo "DISTRUZIONE REPOSITORY ({$repoinprogress}) in corso...";
$rep = new repository($repoinprogress);
$repoinprogress = 0;
$rep->drop();
echo "REPOSITORY DISTRUTTO.";
}
echo "Chiusura applicazione";
flush();
}
示例3: __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 .= '/';
}
}
}
示例4: __construct
public function __construct($repositoryid, $context = SITEID, $options = array())
{
parent::__construct($repositoryid, $context, $options);
// set up webdav client
$this->wd = new webdav_client();
if (empty($this->options['webdav_server'])) {
return;
}
if (empty($this->options['webdav_type'])) {
$this->options['webdav_type'] = '';
} else {
$this->options['webdav_type'] = 'ssl://';
}
$this->wd->set_server($this->options['webdav_server']);
if (empty($this->options['webdav_port'])) {
if (empty($this->options['webdav_type'])) {
$this->wd->set_port(80);
} else {
$this->wd->set_port(443);
}
$port = '';
} else {
$this->wd->set_port($this->options['webdav_port']);
$port = ':' . $this->options['webdav_port'];
}
$this->webdav_host = $this->options['webdav_type'] . $this->options['webdav_server'] . $port;
if (!empty($this->options['webdav_user'])) {
$this->wd->set_user($this->options['webdav_user']);
}
if (!empty($this->options['webdav_password'])) {
$this->wd->set_pass($this->options['webdav_password']);
}
$this->wd->set_protocol(1);
$this->wd->set_debug(false);
}
示例5: xmldb_repository_alfresco_upgrade
/**
* Upgrade function.
*
* @param int $oldversion the version we are upgrading from.
* @return bool result
*/
function xmldb_repository_alfresco_upgrade($oldversion)
{
global $CFG, $DB;
$dbman = $DB->get_manager();
if ($oldversion < 2014020301) {
require_once $CFG->dirroot . '/repository/lib.php';
require_once $CFG->dirroot . '/repository/alfresco/db/upgradelib.php';
$params = array();
$params['context'] = array();
$params['onlyvisible'] = false;
$params['type'] = 'alfresco';
$instances = repository::get_instances($params);
// Notify the admin about the migration process if they are using the repo.
if (!empty($instances)) {
repository_alfresco_admin_security_key_notice();
}
upgrade_plugin_savepoint(true, 2014020301, 'repository', 'alfresco');
}
// 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.
return true;
}
示例6: createdb
public function createdb()
{
if (!$this->dropdb()) {
return false;
}
if (!$this->db->query(repository::sql())) {
return false;
}
if (!$this->db->query(package::sql())) {
return false;
}
if (!$this->db->query(filelist::sql())) {
return false;
}
if (!$this->db->query(guestbook::sql())) {
return false;
}
if (!$this->db->query("\n\t\t CREATE TABLE IF NOT EXISTS #__mixed (\n\t\t field VARCHAR( 255 ) NOT NULL ,\n value VARCHAR( 255 ) NULL ,\n PRIMARY KEY ( field )\n\t\t ) ENGINE = MyISAM;\n\t\t")) {
return false;
}
if (!$this->db->query("\n\t\t CREATE TABLE IF NOT EXISTS #__searches (\n\t\t dt DATETIME,\n\t\t sname VARCHAR(50),\n\t\t sdesc VARCHAR(50),\n\t\t sfile VARCHAR(50),\n\t\t ip VARCHAR(15),\n\t\t srepo INT,\n\t\t results INT,\n\t\t duration INT\n\t\t ) ENGINE = MyISAM;\n\t ")) {
return false;
}
$this->db->query("INSERT INTO #__mixed (field,value) value ('count_visits','1');");
$this->db->query("INSERT INTO #__mixed (field,value) value ('count_searches','1');");
$this->db->query("INSERT INTO #__mixed (field,value) value ('count_srctxt','1');");
$this->db->query("INSERT INTO #__mixed (field,value) value ('count_srcxml','1');");
return true;
}
示例7: __construct
/**
* Constructor, this constructor should be called ONLY from the file_storage class!
*
* @param file_storage $fs file storage instance
* @param stdClass $file_record description of file
* @param string $filedir location of file directory with sh1 named content files
*/
public function __construct(file_storage $fs, stdClass $file_record, $filedir)
{
global $DB, $CFG;
$this->fs = $fs;
$this->file_record = clone $file_record;
// prevent modifications
$this->filedir = $filedir;
// keep secret, do not expose!
if (!empty($file_record->repositoryid)) {
require_once "{$CFG->dirroot}/repository/lib.php";
$this->repository = repository::get_repository_by_id($file_record->repositoryid, SYSCONTEXTID);
if ($this->repository->supported_returntypes() & FILE_REFERENCE != FILE_REFERENCE) {
// Repository cannot do file reference.
throw new moodle_exception('error');
}
} else {
$this->repository = null;
}
// make sure all reference fields exist in file_record even when it is not a reference
foreach (array('referencelastsync', 'referencefileid', 'reference', 'repositoryid') as $key) {
if (empty($this->file_record->{$key})) {
$this->file_record->{$key} = null;
}
}
}
示例8: __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);
}
示例9: __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;
}
示例10: __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);
}
示例11: __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'";
}
示例12: __construct
public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array())
{
parent::__construct($repositoryid, $context, $options);
$this->keyword = optional_param('wikimedia_keyword', '', PARAM_RAW);
if (empty($this->keyword)) {
$this->keyword = optional_param('s', '', PARAM_RAW);
}
}
示例13: get_listing
/**
*
* @global <type> $CFG
* @param <type> $encodedpath
* @param <type> $search
* @return <type>
*/
public function get_listing($encodedpath = '', $page = '', $search = '')
{
global $CFG;
try {
return repository::get_user_file_tree($search);
} catch (Exception $e) {
throw new repository_exception('emptyfilelist', 'repository_local');
}
}
示例14: __construct
/**
* Constructor
*
* @param int $repositoryid repository instance id
* @param int|stdClass $context a context id or context object
* @param array $options repository options
*/
public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array()) {
parent::__construct($repositoryid, $context, $options);
if (isset($this->options['mimetypes'])) {
$mt = $this->options['mimetypes'];
if (!empty($mt) && is_array($mt) && !in_array('*', $mt)) {
$this->mimetypes = array_unique(array_map(array($this, 'to_mime_type'), $mt));
}
}
}
示例15: toHtml
public function toHtml()
{
global $CFG, $COURSE, $USER, $PAGE, $OUTPUT;
$id = $this->_attributes['id'];
$elname = $this->_attributes['name'];
if ($this->_flagFrozen) {
return $this->getFrozenHtml();
}
if (!($draftitemid = (int) $this->getValue())) {
// no existing area info provided - let's use fresh new draft area
$draftitemid = file_get_unused_draft_itemid();
$this->setValue($draftitemid);
}
if ($COURSE->id == SITEID) {
$context = context_system::instance();
} else {
$context = context_course::instance($COURSE->id);
}
$client_id = uniqid();
$args = new stdClass();
// Need these three to filter repositories list.
$args->accepted_types = $this->_options['accepted_types'] ? $this->_options['accepted_types'] : '*';
$args->return_types = $this->_options['return_types'];
$args->itemid = $draftitemid;
$args->maxbytes = 0;
$args->context = $PAGE->context;
$args->buttonname = $elname . 'choose';
$args->elementname = $elname;
// We can only tell the filepicker that we want FILE_REFERENCE repos
// and which specific repo types we don't want. So here we build a list
// of all FILE_REFERENCE supplying repos that aren't thebox to force
// it to only display that one.
$refrepos = repository::get_instances(array('currentcontext' => $PAGE->context, 'return_types' => FILE_REFERENCE));
$disabled = array();
foreach ($refrepos as $repo) {
if (($name = $repo->get_typename()) != $this->repo) {
$disabled[] = $name;
}
}
$args->disable_types = $disabled;
$html = $this->_getTabs();
$fp = new file_picker($args);
$options = $fp->options;
$options->context = $PAGE->context;
$html .= $OUTPUT->render($fp);
$html .= '<input type="hidden" name="' . $elname . '" id="' . $id . '" value="' . $draftitemid . '" class="filepickerhidden"/>';
$module = array('name' => 'form_filepicker', 'fullpath' => '/lib/form/filepicker.js', 'requires' => array('core_filepicker', 'node', 'node-event-simulate', 'core_dndupload'));
$PAGE->requires->js_init_call('M.form_filepicker.init', array($fp->options), true, $module);
$nonjsfilepicker = new moodle_url('/repository/draftfiles_manager.php', array('env' => 'filepicker', 'action' => 'browse', 'itemid' => $draftitemid, 'subdirs' => 0, 'maxbytes' => 0, 'maxfiles' => 1, 'ctx_id' => $PAGE->context->id, 'course' => $PAGE->course->id, 'sesskey' => sesskey()));
// non js file picker
$html .= '<noscript>';
$html .= "<div><object type='text/html' data='{$nonjsfilepicker}' height='160' width='600' style='border:1px solid #000'></object></div>";
$html .= '</noscript>';
return $html;
}