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


PHP registration_manager类代码示例

本文整理汇总了PHP中registration_manager的典型用法代码示例。如果您正苦于以下问题:PHP registration_manager类的具体用法?PHP registration_manager怎么用?PHP registration_manager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: execute

 /**
  * Do the job.
  * Throw exceptions on errors (the job will be retried).
  */
 public function execute()
 {
     global $CFG;
     require_once $CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php';
     $registrationmanager = new \registration_manager();
     $registrationmanager->cron();
 }
开发者ID:evltuma,项目名称:moodle,代码行数:11,代码来源:registration_cron_task.php

示例2: cron_run


//.........这里部分代码省略.........
    require_once "{$CFG->dirroot}/calendar/lib.php";
    calendar_cron();
    // Run external blog cron if needed
    if (!empty($CFG->enableblogs) && $CFG->useexternalblogs) {
        require_once $CFG->dirroot . '/blog/lib.php';
        mtrace("Fetching external blog entries...", '');
        cron_trace_time_and_memory();
        $sql = "timefetched < ? OR timefetched = 0";
        $externalblogs = $DB->get_records_select('blog_external', $sql, array(time() - $CFG->externalblogcrontime));
        foreach ($externalblogs as $eb) {
            blog_sync_external_entries($eb);
        }
        mtrace('done.');
    }
    // Run blog associations cleanup
    if (!empty($CFG->enableblogs) && $CFG->useblogassociations) {
        require_once $CFG->dirroot . '/blog/lib.php';
        // delete entries whose contextids no longer exists
        mtrace("Deleting blog associations linked to non-existent contexts...", '');
        cron_trace_time_and_memory();
        $DB->delete_records_select('blog_association', 'contextid NOT IN (SELECT id FROM {context})');
        mtrace('done.');
    }
    // Run question bank clean-up.
    mtrace("Starting the question bank cron...", '');
    cron_trace_time_and_memory();
    require_once $CFG->libdir . '/questionlib.php';
    question_bank::cron();
    mtrace('done.');
    //Run registration updated cron
    mtrace(get_string('siteupdatesstart', 'hub'));
    cron_trace_time_and_memory();
    require_once $CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php';
    $registrationmanager = new registration_manager();
    $registrationmanager->cron();
    mtrace(get_string('siteupdatesend', 'hub'));
    // If enabled, fetch information about available updates and eventually notify site admins
    if (empty($CFG->disableupdatenotifications)) {
        $updateschecker = \core\update\checker::instance();
        $updateschecker->cron();
    }
    //cleanup old session linked tokens
    //deletes the session linked tokens that are over a day old.
    mtrace("Deleting session linked tokens more than one day old...", '');
    cron_trace_time_and_memory();
    $DB->delete_records_select('external_tokens', 'lastaccess < :onedayago AND tokentype = :tokentype', array('onedayago' => time() - DAYSECS, 'tokentype' => EXTERNAL_TOKEN_EMBEDDED));
    mtrace('done.');
    // all other plugins
    cron_execute_plugin_type('message', 'message plugins');
    cron_execute_plugin_type('filter', 'filters');
    cron_execute_plugin_type('editor', 'editors');
    cron_execute_plugin_type('format', 'course formats');
    cron_execute_plugin_type('profilefield', 'profile fields');
    cron_execute_plugin_type('webservice', 'webservices');
    cron_execute_plugin_type('repository', 'repository plugins');
    cron_execute_plugin_type('qbehaviour', 'question behaviours');
    cron_execute_plugin_type('qformat', 'question import/export formats');
    cron_execute_plugin_type('qtype', 'question types');
    cron_execute_plugin_type('plagiarism', 'plagiarism plugins');
    cron_execute_plugin_type('theme', 'themes');
    cron_execute_plugin_type('tool', 'admin tools');
    // and finally run any local cronjobs, if any
    if ($locals = core_component::get_plugin_list('local')) {
        mtrace('Processing customized cron scripts ...', '');
        // new cron functions in lib.php first
        cron_execute_plugin_type('local');
开发者ID:tyleung,项目名称:CMPUT401MoodleExams,代码行数:67,代码来源:cronlib.php

示例3: time

             $publication = $publicationmanager->get_publication($sitecourse['id'], $hub->huburl);
             if (!empty($publication)) {
                 $publication->status = $sitecourse['privacy'];
                 $publication->timechecked = time();
                 $publicationmanager->update_publication($publication);
             } else {
                 $msgparams = new stdClass();
                 $msgparams->id = $sitecourse['id'];
                 $msgparams->hubname = html_writer::tag('a', $hub->hubname, array('href' => $hub->huburl));
                 $confirmmessage .= $OUTPUT->notification(get_string('detectednotexistingpublication', 'hub', $msgparams));
             }
         }
     }
 }
 //if the site os registered on no hub display an error page
 $registrationmanager = new registration_manager();
 $registeredhubs = $registrationmanager->get_registered_on_hubs();
 if (empty($registeredhubs)) {
     echo $OUTPUT->header();
     echo $OUTPUT->heading(get_string('publishon', 'hub'), 3, 'main');
     echo $OUTPUT->box(get_string('notregisteredonhub', 'hub'));
     echo $OUTPUT->footer();
     die;
 }
 $renderer = $PAGE->get_renderer('core', 'publish');
 /// UNPUBLISH
 $cancel = optional_param('cancel', 0, PARAM_BOOL);
 if (!empty($cancel) and confirm_sesskey()) {
     $confirm = optional_param('confirm', 0, PARAM_BOOL);
     $hubcourseid = optional_param('hubcourseid', 0, PARAM_INT);
     $publicationid = optional_param('publicationid', 0, PARAM_INT);
开发者ID:vuchannguyen,项目名称:web,代码行数:31,代码来源:index.php

示例4: optional_param

 * directory later by web service.
 */
require '../../config.php';
require_once $CFG->libdir . '/adminlib.php';
require_once $CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php';
$newtoken = optional_param('newtoken', '', PARAM_ALPHANUM);
$url = optional_param('url', '', PARAM_URL);
$hubname = optional_param('hubname', '', PARAM_TEXT);
$token = optional_param('token', '', PARAM_TEXT);
$error = optional_param('error', '', PARAM_ALPHANUM);
admin_externalpage_setup('registrationhubs');
if (!empty($error) and $error == 'urlalreadyexist') {
    throw new moodle_exception('urlalreadyregistered', 'hub', $CFG->wwwroot . '/' . $CFG->admin . '/registration/index.php');
}
//check that we are waiting a confirmation from this hub, and check that the token is correct
$registrationmanager = new registration_manager();
$registeredhub = $registrationmanager->get_unconfirmedhub($url);
if (!empty($registeredhub) and $registeredhub->token == $token) {
    echo $OUTPUT->header();
    echo $OUTPUT->heading(get_string('registrationconfirmed', 'hub'), 3, 'main');
    $hublink = html_writer::tag('a', $hubname, array('href' => $url));
    $registeredhub->token = $newtoken;
    $registeredhub->confirmed = 1;
    $registeredhub->hubname = $hubname;
    $registrationmanager->update_registeredhub($registeredhub);
    //display notficiation message
    $notificationmessage = $OUTPUT->notification(get_string('registrationconfirmedon', 'hub', $hublink), 'notifysuccess');
    echo $notificationmessage;
    //display continue button
    $registrationpage = new moodle_url('/admin/registration/index.php');
    $continuebutton = $OUTPUT->render(new single_button($registrationpage, get_string('continue', 'hub')));
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:31,代码来源:confirmregistration.php

示例5: registration_manager

    echo $OUTPUT->header();
    echo $OUTPUT->heading(get_string('publishcourseon', 'hub', !empty($hubname) ? $hubname : $huburl), 3, 'main');
    if ($backup->enforce_changed_dependencies()) {
        echo $renderer->dependency_notification(get_string('dependenciesenforced', 'backup'));
    }
    echo $renderer->progress_bar($backup->get_progress_bar());
    echo $backup->display();
    echo $OUTPUT->footer();
    die;
}
//$backupfile = $backup->get_stage_results();
$backupfile = $bc->get_results();
$backupfile = $backupfile['backup_destination'];
//END backup processing
//retrieve the token to call the hub
$registrationmanager = new registration_manager();
$registeredhub = $registrationmanager->get_registeredhub($huburl);
//display the sending file page
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('sendingcourse', 'hub'), 3, 'main');
$renderer = $PAGE->get_renderer('core', 'publish');
echo $renderer->sendingbackupinfo($backupfile);
if (ob_get_level()) {
    ob_flush();
}
flush();
//send backup file to the hub
$curl = new curl();
$params = array();
$params['filetype'] = HUB_BACKUP_FILE_TYPE;
$params['courseid'] = $hubcourseid;
开发者ID:nmicha,项目名称:moodle,代码行数:31,代码来源:backup.php

示例6: block_community_download_course_backup

 /**
  * Download the community course backup and save it in file API
  * @param integer $courseid
  * @param string $huburl
  * @return array 'privatefile' the file name saved in private area
  *               'tmpfile' the file name saved in the moodledata temp dir (for restore)
  */
 public function block_community_download_course_backup($course)
 {
     global $CFG, $USER;
     require_once $CFG->libdir . "/filelib.php";
     require_once $CFG->dirroot . "/course/publish/lib.php";
     $params['courseid'] = $course->id;
     $params['filetype'] = HUB_BACKUP_FILE_TYPE;
     make_upload_directory('temp/backup');
     $filename = md5(time() . '-' . $course->id . '-' . $USER->id . '-' . random_string(20));
     $url = new moodle_url($course->huburl . '/local/hub/webservice/download.php', $params);
     $path = $CFG->dataroot . '/temp/backup/' . $filename . ".mbz";
     $fp = fopen($path, 'w');
     $curlurl = $course->huburl . '/local/hub/webservice/download.php?filetype=' . HUB_BACKUP_FILE_TYPE . '&courseid=' . $course->id;
     //send an identification token if the site is registered on the hub
     require_once $CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php';
     $registrationmanager = new registration_manager();
     $registeredhub = $registrationmanager->get_registeredhub($course->huburl);
     if (!empty($registeredhub)) {
         $token = $registeredhub->token;
         $curlurl .= '&token=' . $token;
     }
     $ch = curl_init($curlurl);
     curl_setopt($ch, CURLOPT_FILE, $fp);
     $data = curl_exec($ch);
     curl_close($ch);
     fclose($fp);
     $fs = get_file_storage();
     $record = new stdClass();
     $record->contextid = get_context_instance(CONTEXT_USER, $USER->id)->id;
     $record->component = 'user';
     $record->filearea = 'private';
     $record->itemid = 0;
     $record->filename = urlencode($course->fullname) . "_" . time() . ".mbz";
     $record->filepath = '/downloaded_backup/';
     if (!$fs->file_exists($record->contextid, $record->component, $record->filearea, 0, $record->filepath, $record->filename)) {
         $fs->create_file_from_pathname($record, $CFG->dataroot . '/temp/backup/' . $filename . ".mbz");
     }
     $filenames = array();
     $filenames['privatefile'] = $record->filename;
     $filenames['tmpfile'] = $filename;
     return $filenames;
 }
开发者ID:vuchannguyen,项目名称:web,代码行数:49,代码来源:locallib.php

示例7: optional_param

 }
 if ($fromformdata['audience'] != 'all') {
     $options->audience = $fromformdata['audience'];
 }
 if ($fromformdata['educationallevel'] != 'all') {
     $options->educationallevel = $fromformdata['educationallevel'];
 }
 if ($fromformdata['language'] != 'all') {
     $options->language = $fromformdata['language'];
 }
 $options->orderby = $fromformdata['orderby'];
 //the range of course requested
 $options->givememore = optional_param('givememore', 0, PARAM_INT);
 //check if the selected hub is from the registered list (in this case we use the private token)
 $token = 'publichub';
 $registrationmanager = new registration_manager();
 $registeredhubs = $registrationmanager->get_registered_on_hubs();
 foreach ($registeredhubs as $registeredhub) {
     if ($huburl == $registeredhub->huburl) {
         $token = $registeredhub->token;
     }
 }
 $function = 'hub_get_courses';
 $params = array('search' => $search, 'downloadable' => $downloadable, 'enrollable' => !$downloadable, 'options' => $options);
 $serverurl = $huburl . "/local/hub/webservice/webservices.php";
 require_once $CFG->dirroot . "/webservice/xmlrpc/lib.php";
 $xmlrpcclient = new webservice_xmlrpc_client($serverurl, $token);
 try {
     $result = $xmlrpcclient->call($function, $params);
     $courses = $result['courses'];
     $coursetotal = $result['coursetotal'];
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:31,代码来源:communitycourse.php

示例8: definition

 public function definition()
 {
     global $CFG, $USER, $OUTPUT;
     $strrequired = get_string('required');
     $mform =& $this->_form;
     //set default value
     $search = $this->_customdata['search'];
     if (isset($this->_customdata['coverage'])) {
         $coverage = $this->_customdata['coverage'];
     } else {
         $coverage = 'all';
     }
     if (isset($this->_customdata['licence'])) {
         $licence = $this->_customdata['licence'];
     } else {
         $licence = 'all';
     }
     if (isset($this->_customdata['subject'])) {
         $subject = $this->_customdata['subject'];
     } else {
         $subject = 'all';
     }
     if (isset($this->_customdata['audience'])) {
         $audience = $this->_customdata['audience'];
     } else {
         $audience = 'all';
     }
     if (isset($this->_customdata['language'])) {
         $language = $this->_customdata['language'];
     } else {
         $language = current_language();
     }
     if (isset($this->_customdata['educationallevel'])) {
         $educationallevel = $this->_customdata['educationallevel'];
     } else {
         $educationallevel = 'all';
     }
     if (isset($this->_customdata['downloadable'])) {
         $downloadable = $this->_customdata['downloadable'];
     } else {
         $downloadable = 1;
     }
     if (isset($this->_customdata['orderby'])) {
         $orderby = $this->_customdata['orderby'];
     } else {
         $orderby = 'newest';
     }
     if (isset($this->_customdata['huburl'])) {
         $huburl = $this->_customdata['huburl'];
     } else {
         $huburl = HUB_MOODLEORGHUBURL;
     }
     $mform->addElement('header', 'site', get_string('search', 'block_community'));
     //add the course id (of the context)
     $mform->addElement('hidden', 'courseid', $this->_customdata['courseid']);
     $mform->setType('courseid', PARAM_INT);
     $mform->addElement('hidden', 'executesearch', 1);
     $mform->setType('executesearch', PARAM_INT);
     //retrieve the hub list on the hub directory by web service
     $function = 'hubdirectory_get_hubs';
     $params = array();
     $serverurl = HUB_HUBDIRECTORYURL . "/local/hubdirectory/webservice/webservices.php";
     require_once $CFG->dirroot . "/webservice/xmlrpc/lib.php";
     $xmlrpcclient = new webservice_xmlrpc_client($serverurl, 'publichubdirectory');
     try {
         $hubs = $xmlrpcclient->call($function, $params);
     } catch (Exception $e) {
         $hubs = array();
         $error = $OUTPUT->notification(get_string('errorhublisting', 'block_community', $e->getMessage()));
         $mform->addElement('static', 'errorhub', '', $error);
     }
     //display list of registered on hub
     $registrationmanager = new registration_manager();
     $registeredhubs = $registrationmanager->get_registered_on_hubs();
     //retrieve some additional hubs that we will add to
     //the hub list got from the hub directory
     $additionalhubs = array();
     foreach ($registeredhubs as $registeredhub) {
         $inthepubliclist = false;
         foreach ($hubs as $hub) {
             if ($hub['url'] == $registeredhub->huburl) {
                 $inthepubliclist = true;
                 $hub['registeredon'] = true;
             }
         }
         if (!$inthepubliclist) {
             $additionalhub = array();
             $additionalhub['name'] = $registeredhub->hubname;
             $additionalhub['url'] = $registeredhub->huburl;
             $additionalhubs[] = $additionalhub;
         }
     }
     if (!empty($additionalhubs)) {
         $hubs = array_merge($hubs, $additionalhubs);
     }
     if (!empty($hubs)) {
         $htmlhubs = array();
         foreach ($hubs as $hub) {
             // Name can come from hub directory - need some cleaning.
             $hubname = clean_text($hub['name'], PARAM_TEXT);
//.........这里部分代码省略.........
开发者ID:Chocolate-lightning,项目名称:moodle,代码行数:101,代码来源:forms.php

示例9: admin_externalpage_setup

 * a specific hub
 */
require '../../config.php';
require_once $CFG->libdir . '/adminlib.php';
require_once $CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php';
require_once $CFG->dirroot . '/' . $CFG->admin . '/registration/forms.php';
require_once $CFG->dirroot . '/course/publish/lib.php';
require_once $CFG->dirroot . "/webservice/xmlrpc/lib.php";
admin_externalpage_setup('registrationindex');
$renderer = $PAGE->get_renderer('core', 'register');
$unregistration = optional_param('unregistration', 0, PARAM_INT);
$cleanregdata = optional_param('cleanregdata', 0, PARAM_BOOL);
$confirm = optional_param('confirm', 0, PARAM_INT);
$huburl = optional_param('huburl', '', PARAM_URL);
$cancel = optional_param('cancel', null, PARAM_ALPHA);
$registrationmanager = new registration_manager();
$publicationmanager = new course_publish_manager();
$errormessage = '';
if (empty($cancel) and $unregistration and $confirm and confirm_sesskey()) {
    $hub = $registrationmanager->get_registeredhub($huburl);
    //unpublish course and unregister the site by web service
    if (!$cleanregdata) {
        //check if we need to unpublish courses
        //enrollable courses
        $unpublishalladvertisedcourses = optional_param('unpublishalladvertisedcourses', 0, PARAM_INT);
        $hubcourseids = array();
        if ($unpublishalladvertisedcourses) {
            $enrollablecourses = $publicationmanager->get_publications($huburl, null, 1);
            if (!empty($enrollablecourses)) {
                foreach ($enrollablecourses as $enrollablecourse) {
                    $hubcourseids[] = $enrollablecourse->hubcourseid;
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:31,代码来源:index.php

示例10: definition

 public function definition()
 {
     global $CFG, $DB, $USER, $OUTPUT;
     $strrequired = get_string('required');
     $mform =& $this->_form;
     $huburl = $this->_customdata['huburl'];
     $hubname = $this->_customdata['hubname'];
     $course = $this->_customdata['course'];
     $advertise = $this->_customdata['advertise'];
     $share = $this->_customdata['share'];
     $page = $this->_customdata['page'];
     $site = get_site();
     //hidden parameters
     $mform->addElement('hidden', 'huburl', $huburl);
     $mform->addElement('hidden', 'hubname', $hubname);
     //check on the hub if the course has already been published
     $registrationmanager = new registration_manager();
     $registeredhub = $registrationmanager->get_registeredhub($huburl);
     $publicationmanager = new course_publish_manager();
     $publications = $publicationmanager->get_publications($registeredhub->huburl, $course->id, $advertise);
     if (!empty($publications)) {
         //get the last publication of this course
         $publication = array_pop($publications);
         $function = 'hub_get_courses';
         $options = new stdClass();
         $options->ids = array($publication->hubcourseid);
         $options->allsitecourses = 1;
         $params = array('search' => '', 'downloadable' => $share, 'enrollable' => !$share, 'options' => $options);
         $serverurl = $huburl . "/local/hub/webservice/webservices.php";
         require_once $CFG->dirroot . "/webservice/xmlrpc/lib.php";
         $xmlrpcclient = new webservice_xmlrpc_client($serverurl, $registeredhub->token);
         try {
             $result = $xmlrpcclient->call($function, $params);
             $publishedcourses = $result['courses'];
         } catch (Exception $e) {
             $error = $OUTPUT->notification(get_string('errorcourseinfo', 'hub', $e->getMessage()));
             $mform->addElement('static', 'errorhub', '', $error);
         }
     }
     if (!empty($publishedcourses)) {
         $publishedcourse = $publishedcourses[0];
         $hubcourseid = $publishedcourse['id'];
         $defaultfullname = $publishedcourse['fullname'];
         $defaultshortname = $publishedcourse['shortname'];
         $defaultsummary = $publishedcourse['description'];
         $defaultlanguage = $publishedcourse['language'];
         $defaultpublishername = $publishedcourse['publishername'];
         $defaultpublisheremail = $publishedcourse['publisheremail'];
         $defaultcontributornames = $publishedcourse['contributornames'];
         $defaultcoverage = $publishedcourse['coverage'];
         $defaultcreatorname = $publishedcourse['creatorname'];
         $defaultlicenceshortname = $publishedcourse['licenceshortname'];
         $defaultsubject = $publishedcourse['subject'];
         $defaultaudience = $publishedcourse['audience'];
         $defaulteducationallevel = $publishedcourse['educationallevel'];
         $defaultcreatornotes = $publishedcourse['creatornotes'];
         $defaultcreatornotesformat = $publishedcourse['creatornotesformat'];
         $screenshotsnumber = $publishedcourse['screenshots'];
         $privacy = $publishedcourse['privacy'];
         if ($screenshotsnumber > 0 and !empty($privacy)) {
             $page->requires->yui_module('moodle-block_community-imagegallery', 'M.blocks_community.init_imagegallery', array(array('imageids' => array($hubcourseid), 'imagenumbers' => array($screenshotsnumber), 'huburl' => $huburl)));
         }
     } else {
         $defaultfullname = $course->fullname;
         $defaultshortname = $course->shortname;
         $defaultsummary = clean_param($course->summary, PARAM_TEXT);
         if (empty($course->lang)) {
             $language = get_site()->lang;
             if (empty($language)) {
                 $defaultlanguage = current_language();
             } else {
                 $defaultlanguage = $language;
             }
         } else {
             $defaultlanguage = $course->lang;
         }
         $defaultpublishername = $USER->firstname . ' ' . $USER->lastname;
         $defaultpublisheremail = $USER->email;
         $defaultcontributornames = '';
         $defaultcoverage = '';
         $defaultcreatorname = $USER->firstname . ' ' . $USER->lastname;
         $defaultlicenceshortname = 'cc';
         $defaultsubject = 'none';
         $defaultaudience = HUB_AUDIENCE_STUDENTS;
         $defaulteducationallevel = HUB_EDULEVEL_TERTIARY;
         $defaultcreatornotes = '';
         $defaultcreatornotesformat = FORMAT_HTML;
         $screenshotsnumber = 0;
     }
     //the input parameters
     $mform->addElement('header', 'moodle', get_string('publicationinfo', 'hub'));
     $mform->addElement('text', 'name', get_string('coursename', 'hub'), array('class' => 'metadatatext'));
     $mform->addRule('name', $strrequired, 'required', null, 'client');
     $mform->setType('name', PARAM_TEXT);
     $mform->setDefault('name', $defaultfullname);
     $mform->addHelpButton('name', 'name', 'hub');
     $mform->addElement('hidden', 'id', $this->_customdata['id']);
     if ($share) {
         $buttonlabel = get_string('shareon', 'hub', !empty($hubname) ? $hubname : $huburl);
         $mform->addElement('hidden', 'share', $share);
//.........这里部分代码省略.........
开发者ID:vuchannguyen,项目名称:web,代码行数:101,代码来源:forms.php

示例11: definition

 public function definition()
 {
     global $CFG, $DB;
     $strrequired = get_string('required');
     $mform =& $this->_form;
     $huburl = $this->_customdata['huburl'];
     $hubname = $this->_customdata['hubname'];
     $password = $this->_customdata['password'];
     $admin = get_admin();
     $site = get_site();
     //retrieve config for this hub and set default if they don't exist
     $cleanhuburl = clean_param($huburl, PARAM_ALPHANUMEXT);
     $sitename = get_config('hub', 'site_name_' . $cleanhuburl);
     if ($sitename === false) {
         $sitename = format_string($site->fullname, true, array('context' => context_course::instance(SITEID)));
     }
     $sitedescription = get_config('hub', 'site_description_' . $cleanhuburl);
     if ($sitedescription === false) {
         $sitedescription = $site->summary;
     }
     $contactname = get_config('hub', 'site_contactname_' . $cleanhuburl);
     if ($contactname === false) {
         $contactname = fullname($admin, true);
     }
     $contactemail = get_config('hub', 'site_contactemail_' . $cleanhuburl);
     if ($contactemail === false) {
         $contactemail = $admin->email;
     }
     $contactphone = get_config('hub', 'site_contactphone_' . $cleanhuburl);
     if ($contactphone === false) {
         $contactphone = $admin->phone1;
     }
     $imageurl = get_config('hub', 'site_imageurl_' . $cleanhuburl);
     $privacy = get_config('hub', 'site_privacy_' . $cleanhuburl);
     $address = get_config('hub', 'site_address_' . $cleanhuburl);
     $region = get_config('hub', 'site_region_' . $cleanhuburl);
     $country = get_config('hub', 'site_country_' . $cleanhuburl);
     if ($country === false) {
         $country = $admin->country;
     }
     $language = get_config('hub', 'site_language_' . $cleanhuburl);
     if ($language === false) {
         $language = current_language();
     }
     $geolocation = get_config('hub', 'site_geolocation_' . $cleanhuburl);
     $contactable = get_config('hub', 'site_contactable_' . $cleanhuburl);
     $emailalert = get_config('hub', 'site_emailalert_' . $cleanhuburl);
     $emailalert = $emailalert === 0 ? 0 : 1;
     $coursesnumber = get_config('hub', 'site_coursesnumber_' . $cleanhuburl);
     $usersnumber = get_config('hub', 'site_usersnumber_' . $cleanhuburl);
     $roleassignmentsnumber = get_config('hub', 'site_roleassignmentsnumber_' . $cleanhuburl);
     $postsnumber = get_config('hub', 'site_postsnumber_' . $cleanhuburl);
     $questionsnumber = get_config('hub', 'site_questionsnumber_' . $cleanhuburl);
     $resourcesnumber = get_config('hub', 'site_resourcesnumber_' . $cleanhuburl);
     $badgesnumber = get_config('hub', 'site_badges_' . $cleanhuburl);
     $issuedbadgesnumber = get_config('hub', 'site_issuedbadges_' . $cleanhuburl);
     $mediancoursesize = get_config('hub', 'site_mediancoursesize_' . $cleanhuburl);
     $participantnumberaveragecfg = get_config('hub', 'site_participantnumberaverage_' . $cleanhuburl);
     $modulenumberaveragecfg = get_config('hub', 'site_modulenumberaverage_' . $cleanhuburl);
     //hidden parameters
     $mform->addElement('hidden', 'huburl', $huburl);
     $mform->setType('huburl', PARAM_URL);
     $mform->addElement('hidden', 'hubname', $hubname);
     $mform->setType('hubname', PARAM_TEXT);
     $mform->addElement('hidden', 'password', $password);
     $mform->setType('password', PARAM_RAW);
     //the input parameters
     $mform->addElement('header', 'moodle', get_string('registrationinfo', 'hub'));
     $mform->addElement('text', 'name', get_string('sitename', 'hub'), array('class' => 'registration_textfield'));
     $mform->addRule('name', $strrequired, 'required', null, 'client');
     $mform->setType('name', PARAM_TEXT);
     $mform->setDefault('name', $sitename);
     $mform->addHelpButton('name', 'sitename', 'hub');
     $options = array();
     $registrationmanager = new registration_manager();
     $options[HUB_SITENOTPUBLISHED] = $registrationmanager->get_site_privacy_string(HUB_SITENOTPUBLISHED);
     $options[HUB_SITENAMEPUBLISHED] = $registrationmanager->get_site_privacy_string(HUB_SITENAMEPUBLISHED);
     $options[HUB_SITELINKPUBLISHED] = $registrationmanager->get_site_privacy_string(HUB_SITELINKPUBLISHED);
     $mform->addElement('select', 'privacy', get_string('siteprivacy', 'hub'), $options);
     $mform->setDefault('privacy', $privacy);
     $mform->setType('privacy', PARAM_ALPHA);
     $mform->addHelpButton('privacy', 'privacy', 'hub');
     unset($options);
     $mform->addElement('textarea', 'description', get_string('sitedesc', 'hub'), array('rows' => 8, 'cols' => 41));
     $mform->addRule('description', $strrequired, 'required', null, 'client');
     $mform->setDefault('description', $sitedescription);
     $mform->setType('description', PARAM_TEXT);
     $mform->addHelpButton('description', 'sitedesc', 'hub');
     $languages = get_string_manager()->get_list_of_languages();
     collatorlib::asort($languages);
     $mform->addElement('select', 'language', get_string('sitelang', 'hub'), $languages);
     $mform->setType('language', PARAM_ALPHANUMEXT);
     $mform->addHelpButton('language', 'sitelang', 'hub');
     $mform->setDefault('language', $language);
     $mform->addElement('textarea', 'address', get_string('postaladdress', 'hub'), array('rows' => 4, 'cols' => 41));
     $mform->setType('address', PARAM_TEXT);
     $mform->setDefault('address', $address);
     $mform->addHelpButton('address', 'postaladdress', 'hub');
     //TODO: use the region array I generated
     //        $mform->addElement('select', 'region', get_string('selectaregion'), array('-' => '-'));
//.........这里部分代码省略.........
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:101,代码来源:forms.php

示例12: optional_param

 * @author     Jerome Mouneyrac <jerome@mouneyrac.com>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL
 * @copyright  (C) 1999 onwards Martin Dougiamas  http://dougiamas.com
 *
 * The administrator is redirect to this page from the hub to renew a registration
 * process because
 */
require '../../config.php';
require_once $CFG->libdir . '/adminlib.php';
require_once $CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php';
$url = optional_param('url', '', PARAM_URL);
$hubname = optional_param('hubname', '', PARAM_TEXT);
$token = optional_param('token', '', PARAM_TEXT);
admin_externalpage_setup('registrationindex');
//check that we are waiting a confirmation from this hub, and check that the token is correct
$registrationmanager = new registration_manager();
$registeredhub = $registrationmanager->get_unconfirmedhub($url);
if (!empty($registeredhub) and $registeredhub->token == $token) {
    echo $OUTPUT->header();
    echo $OUTPUT->heading(get_string('renewregistration', 'hub'), 3, 'main');
    $hublink = html_writer::tag('a', $hubname, array('href' => $url));
    $registrationmanager->delete_registeredhub($url);
    //Mooch case, need to recreate the siteidentifier
    if ($url == HUB_MOODLEORGHUBURL) {
        $CFG->siteidentifier = null;
        get_site_identifier();
    }
    $deletedregmsg = get_string('previousregistrationdeleted', 'hub', $hublink);
    $button = new single_button(new moodle_url('/admin/registration/index.php'), get_string('restartregistration', 'hub'));
    $button->class = 'restartregbutton';
    echo html_writer::tag('div', $deletedregmsg . $OUTPUT->render($button), array('class' => 'mdl-align'));
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:31,代码来源:renewregistration.php

示例13: require_sesskey

require_sesskey();
require_capability('moodle/site:config', context_system::instance());
$strheading = get_string('requestaccesskey', 'message_airnotifier');
$PAGE->navbar->add(get_string('administrationsite'));
$PAGE->navbar->add(get_string('plugins', 'admin'));
$PAGE->navbar->add(get_string('messageoutputs', 'message'));
$returl = new moodle_url('/admin/settings.php', array('section' => 'messagesettingairnotifier'));
$PAGE->navbar->add(get_string('pluginname', 'message_airnotifier'), $returl);
$PAGE->navbar->add($strheading);
$PAGE->set_heading($strheading);
$PAGE->set_title($strheading);
$msg = "";
// If we are requesting a key to the official message system, verify first that this site is registered.
// This check is also done in Airnotifier.
if (strpos($CFG->airnotifierurl, AIRNOTIFIER_PUBLICURL) !== false) {
    $registrationmanager = new registration_manager();
    if (!$registrationmanager->get_registeredhub(HUB_MOODLEORGHUBURL)) {
        $msg = get_string('sitemustberegistered', 'message_airnotifier');
        $msg .= $OUTPUT->continue_button($returl);
        echo $OUTPUT->header();
        echo $OUTPUT->box($msg, 'generalbox');
        echo $OUTPUT->footer();
        die;
    }
}
$manager = new message_airnotifier_manager();
if ($key = $manager->request_accesskey()) {
    set_config('airnotifieraccesskey', $key);
    $msg = get_string('keyretrievedsuccessfully', 'message_airnotifier');
} else {
    $msg = get_string('errorretrievingkey', 'message_airnotifier');
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:requestaccesskey.php

示例14: definition

 public function definition()
 {
     global $CFG, $USER, $OUTPUT;
     $strrequired = get_string('required');
     $mform =& $this->_form;
     //set default value
     $search = $this->_customdata['search'];
     if (isset($this->_customdata['coverage'])) {
         $coverage = $this->_customdata['coverage'];
     } else {
         $coverage = 'all';
     }
     if (isset($this->_customdata['licence'])) {
         $licence = $this->_customdata['licence'];
     } else {
         $licence = 'all';
     }
     if (isset($this->_customdata['subject'])) {
         $subject = $this->_customdata['subject'];
     } else {
         $subject = 'all';
     }
     if (isset($this->_customdata['audience'])) {
         $audience = $this->_customdata['audience'];
     } else {
         $audience = 'all';
     }
     if (isset($this->_customdata['language'])) {
         $language = $this->_customdata['language'];
     } else {
         $language = current_language();
     }
     if (isset($this->_customdata['educationallevel'])) {
         $educationallevel = $this->_customdata['educationallevel'];
     } else {
         $educationallevel = 'all';
     }
     if (isset($this->_customdata['downloadable'])) {
         $downloadable = $this->_customdata['downloadable'];
     } else {
         $downloadable = 0;
     }
     if (isset($this->_customdata['orderby'])) {
         $orderby = $this->_customdata['orderby'];
     } else {
         $orderby = 'newest';
     }
     if (isset($this->_customdata['huburl'])) {
         $huburl = $this->_customdata['huburl'];
     } else {
         $huburl = HUB_MOODLEORGHUBURL;
     }
     $mform->addElement('header', 'site', get_string('search', 'block_community'));
     //add the course id (of the context)
     $mform->addElement('hidden', 'courseid', $this->_customdata['courseid']);
     $mform->addElement('hidden', 'executesearch', 1);
     //retrieve the hub list on the hub directory by web service
     $function = 'hubdirectory_get_hubs';
     $params = array();
     $serverurl = HUB_HUBDIRECTORYURL . "/local/hubdirectory/webservice/webservices.php";
     require_once $CFG->dirroot . "/webservice/xmlrpc/lib.php";
     $xmlrpcclient = new webservice_xmlrpc_client($serverurl, 'publichubdirectory');
     try {
         $hubs = $xmlrpcclient->call($function, $params);
     } catch (Exception $e) {
         $hubs = array();
         $error = $OUTPUT->notification(get_string('errorhublisting', 'block_community', $e->getMessage()));
         $mform->addElement('static', 'errorhub', '', $error);
     }
     //display list of registered on hub
     $registrationmanager = new registration_manager();
     $registeredhubs = $registrationmanager->get_registered_on_hubs();
     //retrieve some additional hubs that we will add to
     //the hub list got from the hub directory
     $additionalhubs = array();
     foreach ($registeredhubs as $registeredhub) {
         $inthepubliclist = false;
         foreach ($hubs as $hub) {
             if ($hub['url'] == $registeredhub->huburl) {
                 $inthepubliclist = true;
                 $hub['registeredon'] = true;
             }
         }
         if (!$inthepubliclist) {
             $additionalhub = array();
             $additionalhub['name'] = $registeredhub->hubname;
             $additionalhub['url'] = $registeredhub->huburl;
             $additionalhubs[] = $additionalhub;
         }
     }
     if (!empty($additionalhubs)) {
         $hubs = array_merge($hubs, $additionalhubs);
     }
     if (!empty($hubs)) {
         //TODO: sort hubs by trusted/prioritize
         //Public hub list
         $options = array();
         $firsthub = false;
         foreach ($hubs as $hub) {
             if (array_key_exists('id', $hub)) {
//.........这里部分代码省略.........
开发者ID:vinoth4891,项目名称:clinique,代码行数:101,代码来源:forms.php

示例15: cron_run


//.........这里部分代码省略.........
        require_once $CFG->dirroot . '/lib/statslib.php';
        // check we're not before our runtime
        $timetocheck = stats_get_base_daily() + $CFG->statsruntimestarthour * 60 * 60 + $CFG->statsruntimestartminute * 60;
        if (time() > $timetocheck) {
            // process configured number of days as max (defaulting to 31)
            $maxdays = empty($CFG->statsruntimedays) ? 31 : abs($CFG->statsruntimedays);
            if (stats_cron_daily($maxdays)) {
                if (stats_cron_weekly()) {
                    if (stats_cron_monthly()) {
                        stats_clean_old();
                    }
                }
            }
            @set_time_limit(0);
        } else {
            mtrace('Next stats run after:' . userdate($timetocheck));
        }
    }
    // run gradebook import/export/report cron
    if ($gradeimports = get_plugin_list('gradeimport')) {
        foreach ($gradeimports as $gradeimport => $plugindir) {
            if (file_exists($plugindir . '/lib.php')) {
                require_once $plugindir . '/lib.php';
                $cron_function = 'grade_import_' . $gradeimport . '_cron';
                if (function_exists($cron_function)) {
                    mtrace("Processing gradebook import function {$cron_function} ...", '');
                    $cron_function();
                }
            }
        }
    }
    if ($gradeexports = get_plugin_list('gradeexport')) {
        foreach ($gradeexports as $gradeexport => $plugindir) {
            if (file_exists($plugindir . '/lib.php')) {
                require_once $plugindir . '/lib.php';
                $cron_function = 'grade_export_' . $gradeexport . '_cron';
                if (function_exists($cron_function)) {
                    mtrace("Processing gradebook export function {$cron_function} ...", '');
                    $cron_function();
                }
            }
        }
    }
    if ($gradereports = get_plugin_list('gradereport')) {
        foreach ($gradereports as $gradereport => $plugindir) {
            if (file_exists($plugindir . '/lib.php')) {
                require_once $plugindir . '/lib.php';
                $cron_function = 'grade_report_' . $gradereport . '_cron';
                if (function_exists($cron_function)) {
                    mtrace("Processing gradebook report function {$cron_function} ...", '');
                    $cron_function();
                }
            }
        }
    }
    // Run external blog cron if needed
    if ($CFG->useexternalblogs) {
        require_once $CFG->dirroot . '/blog/lib.php';
        mtrace("Fetching external blog entries...", '');
        $sql = "timefetched < ? OR timefetched = 0";
        $externalblogs = $DB->get_records_select('blog_external', $sql, array(mktime() - $CFG->externalblogcrontime));
        foreach ($externalblogs as $eb) {
            blog_sync_external_entries($eb);
        }
    }
    // Run blog associations cleanup
    if ($CFG->useblogassociations) {
        require_once $CFG->dirroot . '/blog/lib.php';
        // delete entries whose contextids no longer exists
        mtrace("Deleting blog associations linked to non-existent contexts...", '');
        $DB->delete_records_select('blog_association', 'contextid NOT IN (SELECT id FROM {context})');
    }
    //Run registration updated cron
    mtrace(get_string('siteupdatesstart', 'hub'));
    require_once $CFG->dirroot . '/admin/registration/lib.php';
    $registrationmanager = new registration_manager();
    $registrationmanager->cron();
    mtrace(get_string('siteupdatesend', 'hub'));
    // cleanup file trash
    $fs = get_file_storage();
    $fs->cron();
    //cleanup old session linked tokens
    //deletes the session linked tokens that are over a day old.
    mtrace("Deleting session linked tokens more than one day old...", '');
    $DB->delete_records_select('external_tokens', 'lastaccess < :onedayago AND tokentype = :tokentype', array('onedayago' => time() - DAYSECS, 'tokentype' => EXTERNAL_TOKEN_EMBEDDED));
    mtrace('done.');
    // run any customized cronjobs, if any
    if ($locals = get_plugin_list('local')) {
        mtrace('Processing customized cron scripts ...', '');
        foreach ($locals as $local => $localdir) {
            if (file_exists("{$localdir}/cron.php")) {
                include "{$localdir}/cron.php";
            }
        }
        mtrace('done.');
    }
    mtrace("Cron script completed correctly");
    $difftime = microtime_diff($starttime, microtime());
    mtrace("Execution took " . $difftime . " seconds");
}
开发者ID:vuchannguyen,项目名称:web,代码行数:101,代码来源:cronlib.php


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