本文整理汇总了PHP中registration_manager::get_registered_on_hubs方法的典型用法代码示例。如果您正苦于以下问题:PHP registration_manager::get_registered_on_hubs方法的具体用法?PHP registration_manager::get_registered_on_hubs怎么用?PHP registration_manager::get_registered_on_hubs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类registration_manager
的用法示例。
在下文中一共展示了registration_manager::get_registered_on_hubs方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: definition
public function definition()
{
global $CFG;
$mform =& $this->_form;
$share = $this->_customdata['share'];
$mform->addElement('header', 'site', get_string('selecthub', 'hub'));
$mform->addElement('static', 'info', '', get_string('selecthubinfo', 'hub') . html_writer::empty_tag('br'));
$registrationmanager = new registration_manager();
$registeredhubs = $registrationmanager->get_registered_on_hubs();
//Public hub list
$options = array();
foreach ($registeredhubs as $hub) {
$hubname = $hub->hubname;
$mform->addElement('hidden', clean_param($hub->huburl, PARAM_ALPHANUMEXT), $hubname);
if (empty($hubname)) {
$hubname = $hub->huburl;
}
$mform->addElement('radio', 'huburl', null, ' ' . $hubname, $hub->huburl);
if ($hub->huburl == HUB_MOODLEORGHUBURL) {
$mform->setDefault('huburl', $hub->huburl);
}
}
$mform->addElement('hidden', 'id', $this->_customdata['id']);
if ($share) {
$buttonlabel = get_string('shareonhub', 'hub');
$mform->addElement('hidden', 'share', true);
} else {
$buttonlabel = get_string('advertiseonhub', 'hub');
$mform->addElement('hidden', 'advertise', true);
}
$this->add_action_buttons(false, $buttonlabel);
}
示例2: 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)) {
//.........这里部分代码省略.........
示例3: time
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);
$timepublished = optional_param('timepublished', 0, PARAM_INT);
示例4: 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);
//.........这里部分代码省略.........