本文整理汇总了PHP中registration_manager::get_site_privacy_string方法的典型用法代码示例。如果您正苦于以下问题:PHP registration_manager::get_site_privacy_string方法的具体用法?PHP registration_manager::get_site_privacy_string怎么用?PHP registration_manager::get_site_privacy_string使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类registration_manager
的用法示例。
在下文中一共展示了registration_manager::get_site_privacy_string方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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('-' => '-'));
//.........这里部分代码省略.........
示例2: site_list
/**
* Display a list of sites
* If $withwriteaccess = true, we display visible field,
* trust/prioritise button, and timecreated/modified information.
* @param array $sites
* @param boolean $withwriteaccess
* @return string
*/
public function site_list($sites, $withwriteaccess = false, $displaysecret = false)
{
global $CFG;
$renderedhtml = '';
$brtag = html_writer::empty_tag('br');
$table = new html_table();
if ($withwriteaccess) {
$table->head = array('', get_string('sitename', 'local_hub'), get_string('sitedesc', 'local_hub'), get_string('sitelang', 'local_hub'), get_string('siteadmin', 'local_hub'), get_string('operation', 'local_hub'), '');
$table->align = array('center', 'left', 'left', 'center', 'center', 'center', 'center', 'center');
$table->size = array('1%', '25%', '40%', '5%', '5%');
} else {
$table->head = array('', get_string('sitename', 'local_hub'), get_string('sitedesc', 'local_hub'), get_string('sitelang', 'local_hub'));
$table->align = array('center', 'left', 'left', 'center');
$table->size = array('10%', '25%', '60%', '5%');
}
if (empty($sites)) {
if (isset($sites)) {
$renderedhtml .= get_string('nosite', 'local_hub');
}
} else {
$table->width = '100%';
$table->data = array();
$table->attributes['class'] = 'sitedirectory';
// iterate through sites and add to the display table
foreach ($sites as $site) {
//create site name with link
$siteurl = new moodle_url($site->url);
$siteatag = html_writer::tag('a', $site->name, array('href' => $siteurl));
$sitenamespan = html_writer::span($siteatag);
$siteurlspan = html_writer::span($siteurl, 'additionaldesc');
$sitenamehtml = $sitenamespan . '<br>' . $siteurlspan;
//create image tag
if (!empty($site->imageurl)) {
$imageurl = new moodle_url($site->imageurl);
$imagehtml = html_writer::empty_tag('img', array('src' => $imageurl, 'alt' => $site->name));
} else {
$imagehtml = '';
}
//create description to display
$deschtml = $site->description;
//the description
/// courses and sites number display under the description, in smaller
$deschtml .= $brtag;
$site->participantnumberavg = number_format($site->participantnumberaverage, 2);
$site->modulenumberavg = number_format($site->modulenumberaverage, 2);
$additionaldesc = get_string('additionaldesc', 'local_hub', $site);
$deschtml .= html_writer::tag('span', $additionaldesc, array('class' => 'additionaldesc'));
/// time registered and time modified only display for administrator
if ($withwriteaccess) {
$admindisplayedinfo = new stdClass();
$admindisplayedinfo->timeregistered = userdate($site->timeregistered);
if (!empty($site->timemodified)) {
$admindisplayedinfo->timemodified = userdate($site->timemodified);
} else {
$admindisplayedinfo->timemodified = '-';
}
$registrationmanager = new registration_manager();
$admindisplayedinfo->privacy = $registrationmanager->get_site_privacy_string($site->privacy);
$admindisplayedinfo->contactable = $site->contactable ? get_string('yes') : get_string('no');
$admindisplayedinfo->emailalert = $site->emailalert ? get_string('yes') : get_string('no');
$additionaladmindesc = $brtag;
$additionaladmindesc .= get_string('additionaladmindesc', 'local_hub', $admindisplayedinfo);
$deschtml .= html_writer::tag('span', $additionaladmindesc, array('class' => 'additionaladmindesc'));
if ($displaysecret) {
$markstolen = new moodle_url('/local/hub/admin/stolensecret.php', array('stolen' => $site->id, 'sesskey' => sesskey()));
$deschtml .= html_writer::tag('span', get_string('secretvalue', 'local_hub', $site->secret) . ' ' . html_writer::tag('a', get_string('markstolen', 'local_hub'), array('href' => $markstolen, 'class' => 'markstolen')), array('class' => 'sitesecret'));
}
}
//retrieve language string
//construct languages array
if (!empty($site->language)) {
$languages = get_string_manager()->get_list_of_languages();
$langcode = str_replace('_utf8', '', $site->language);
$language = isset($languages[$langcode]) ? $languages[$langcode] : '';
} else {
$language = '';
}
//retrieve country string
if (!empty($site->countrycode)) {
$country = get_string_manager()->get_list_of_countries();
$language .= ' (' . $country[$site->countrycode] . ')';
}
if ($withwriteaccess) {
//create site administrator name with email link
$adminnamehtml = html_writer::tag('a', $site->contactname, array('href' => 'mailto:' . $site->contactemail));
//create trust button
if ($site->trusted) {
$trustmsg = get_string('untrustme', 'local_hub');
$trust = false;
} else {
$trustmsg = get_string('trustme', 'local_hub');
$trust = true;
//.........这里部分代码省略.........