本文整理汇总了PHP中obfuscate_mailto函数的典型用法代码示例。如果您正苦于以下问题:PHP obfuscate_mailto函数的具体用法?PHP obfuscate_mailto怎么用?PHP obfuscate_mailto使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了obfuscate_mailto函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: scheduler_get_user_fields
/**
* Get a list of fields to be displayed in lists of users, etc.
*
* The input of the function is a user record;
* possibly null, in this case the function should return only the field titles.
*
* The function returns an array of objects that describe user data fields.
* Each of these objects has the following properties:
* $field->title : Displayable title of the field
* $field->value : Value of the field for this user (not set if $user is null)
*
* @param stdClass $user the user record; may be null
* @return array an array of field objects
*/
function scheduler_get_user_fields($user)
{
$fields = array();
$emailfield = new stdClass();
$fields[] = $emailfield;
$emailfield->title = get_string('email');
if ($user) {
$emailfield->value = obfuscate_mailto($user->email);
}
/*
* As an example: Uncomment the following lines in order to display the user's city and country.
*/
/*
$cityfield = new stdClass();
$cityfield->title = get_string('city');
$fields[] = $cityfield;
$countryfield = new stdClass();
$countryfield->title = get_string('country');
$fields[] = $countryfield;
if ($user) {
$cityfield->value = $user->city;
if ($user->country) {
$countryfield->value = get_string($user->country, 'countries');
}
else {
$countryfield->value = '';
}
}
*/
return $fields;
}
示例2: print_row
print_row(get_string("phone") . ":", "{$user->phone1}");
}
if (isset($identityfields['phone2']) && $user->phone2) {
print_row(get_string("phone2") . ":", "{$user->phone2}");
}
if (isset($identityfields['institution']) && $user->institution) {
print_row(get_string("institution") . ":", "{$user->institution}");
}
if (isset($identityfields['department']) && $user->department) {
print_row(get_string("department") . ":", "{$user->department}");
}
if (isset($identityfields['idnumber']) && $user->idnumber) {
print_row(get_string("idnumber") . ":", "{$user->idnumber}");
}
if (isset($identityfields['email']) and ($currentuser or $user->maildisplay == 1 or has_capability('moodle/course:useremail', $context) or $user->maildisplay == 2 and enrol_sharing_course($user, $USER))) {
print_row(get_string("email") . ":", obfuscate_mailto($user->email, ''));
}
if ($user->url && !isset($hiddenfields['webpage'])) {
$url = $user->url;
if (strpos($user->url, '://') === false) {
$url = 'http://' . $url;
}
print_row(get_string("webpage") . ":", '<a href="' . s($url) . '">' . s($user->url) . '</a>');
}
if ($user->icq && !isset($hiddenfields['icqnumber'])) {
print_row(get_string('icqnumber') . ':', "<a href=\"http://web.icq.com/wwp?uin=" . urlencode($user->icq) . "\">" . s($user->icq) . " <img src=\"http://web.icq.com/whitepages/online?icq=" . urlencode($user->icq) . "&img=5\" alt=\"\" /></a>");
}
if ($user->skype && !isset($hiddenfields['skypeid'])) {
if (strpos($CFG->httpswwwroot, 'https:') === 0) {
// Bad luck, skype devs are lazy to set up SSL on their servers - see MDL-37233.
$statusicon = '';
示例3: array
}
$options = array('overflowdiv' => true);
echo format_text($user->description, $user->descriptionformat, $options);
}
}
echo '</div>';
// Print all the little details in a list
echo html_writer::start_tag('dl', array('class' => 'list'));
// Show email if any of the following conditions match.
// 1. User is viewing his own profile.
// 2. Has allowed everyone to see email
// 3. User has allowed course members to can see email and current user is in same course
// 4. Has either course:viewhiddenuserfields or site:viewuseridentity capability.
if ($currentuser or $user->maildisplay == 1 or $user->maildisplay == 2 && is_enrolled($coursecontext, $USER) or has_capability('moodle/course:viewhiddenuserfields', $coursecontext) or has_capability('moodle/site:viewuseridentity', $coursecontext)) {
echo html_writer::tag('dt', get_string('email'));
echo html_writer::tag('dd', obfuscate_mailto($user->email, ''));
}
// Show last time this user accessed this course
if (!isset($hiddenfields['lastaccess'])) {
if ($lastaccess = $DB->get_record('user_lastaccess', array('userid' => $user->id, 'courseid' => $course->id))) {
$datestring = userdate($lastaccess->timeaccess) . " (" . format_time(time() - $lastaccess->timeaccess) . ")";
} else {
$datestring = get_string("never");
}
echo html_writer::tag('dt', get_string('lastcourseaccess'));
echo html_writer::tag('dd', $datestring);
}
// Show roles in this course
if ($rolestring = get_user_roles_in_course($id, $course->id)) {
echo html_writer::tag('dt', get_string('roles'));
echo html_writer::tag('dd', $rolestring);
示例4: render_external_badge
protected function render_external_badge(external_badge $ibadge)
{
$issued = $ibadge->issued;
$assertion = $issued->assertion;
$issuer = $assertion->badge->issuer;
$userinfo = $ibadge->recipient;
$table = new html_table();
$imagetable = new html_table();
$imagetable->attributes = array('class' => 'clearfix badgeissuedimage');
$imagetable->data[] = array(html_writer::empty_tag('img', array('src' => $issued->imageUrl, 'width' => '100px')));
$datatable = new html_table();
$datatable->attributes = array('class' => 'badgeissuedinfo');
$datatable->colclasses = array('bfield', 'bvalue');
// Recipient information.
$datatable->data[] = array($this->output->heading(get_string('recipientdetails', 'badges'), 3), '');
// Technically, we should alway have a user at this point, but added an extra check just in case.
if ($userinfo) {
$notify = '';
if (!$ibadge->valid) {
$notify = $this->output->notification(get_string('recipientvalidationproblem', 'badges'), 'notifynotice');
}
$datatable->data[] = array(get_string('name'), fullname($userinfo) . $notify);
} else {
$notify = $this->output->notification(get_string('recipientidentificationproblem', 'badges'), 'notifynotice');
$datatable->data[] = array(get_string('name'), $notify);
}
$datatable->data[] = array($this->output->heading(get_string('issuerdetails', 'badges'), 3), '');
$datatable->data[] = array(get_string('issuername', 'badges'), s($issuer->name));
$datatable->data[] = array(get_string('issuerurl', 'badges'), html_writer::tag('a', s($issuer->origin), array('href' => $issuer->origin)));
if (isset($issuer->contact)) {
$datatable->data[] = array(get_string('contact', 'badges'), obfuscate_mailto($issuer->contact));
}
$datatable->data[] = array($this->output->heading(get_string('badgedetails', 'badges'), 3), '');
$datatable->data[] = array(get_string('name'), s($assertion->badge->name));
$datatable->data[] = array(get_string('description', 'badges'), s($assertion->badge->description));
$datatable->data[] = array(get_string('bcriteria', 'badges'), html_writer::tag('a', s($assertion->badge->criteria), array('href' => $assertion->badge->criteria)));
$datatable->data[] = array($this->output->heading(get_string('issuancedetails', 'badges'), 3), '');
if (isset($assertion->issued_on)) {
$issuedate = !strtotime($assertion->issued_on) ? s($assertion->issued_on) : strtotime($assertion->issued_on);
$datatable->data[] = array(get_string('dateawarded', 'badges'), userdate($issuedate));
}
if (isset($assertion->expires)) {
$today_date = date('Y-m-d');
$today = strtotime($today_date);
$expiration = !strtotime($assertion->expires) ? s($assertion->expires) : strtotime($assertion->expires);
if ($expiration < $today) {
$cell = new html_table_cell(userdate($expiration) . get_string('warnexpired', 'badges'));
$cell->attributes = array('class' => 'notifyproblem warning');
$datatable->data[] = array(get_string('expirydate', 'badges'), $cell);
$image = html_writer::start_tag('div', array('class' => 'badge'));
$image .= html_writer::empty_tag('img', array('src' => $issued->imageUrl));
$image .= html_writer::start_tag('span', array('class' => 'expired')) . $this->output->pix_icon('i/expired', get_string('expireddate', 'badges', userdate($expiration)), 'moodle', array('class' => 'expireimage')) . html_writer::end_tag('span');
$image .= html_writer::end_tag('div');
$imagetable->data[0] = array($image);
} else {
$datatable->data[] = array(get_string('expirydate', 'badges'), userdate($expiration));
}
}
if (isset($assertion->evidence)) {
$datatable->data[] = array(get_string('evidence', 'badges'), html_writer::tag('a', s($assertion->evidence), array('href' => $assertion->evidence)));
}
$table->attributes = array('class' => 'generalbox boxaligncenter issuedbadgebox');
$table->data[] = array(html_writer::table($imagetable), html_writer::table($datatable));
$htmlbadge = html_writer::table($table);
return $htmlbadge;
}
示例5: render_external_badge
protected function render_external_badge(external_badge $ibadge)
{
$issued = $ibadge->issued;
$assertion = $issued->assertion;
$issuer = $assertion->badge->issuer;
$userinfo = $ibadge->recipient;
$table = new html_table();
$today = strtotime(date('Y-m-d'));
$output = '';
$output .= html_writer::start_tag('div', array('id' => 'badge'));
$output .= html_writer::start_tag('div', array('id' => 'badge-image'));
$output .= html_writer::empty_tag('img', array('src' => $issued->imageUrl));
if (isset($assertion->expires)) {
$expiration = !strtotime($assertion->expires) ? s($assertion->expires) : strtotime($assertion->expires);
if ($expiration < $today) {
$output .= $this->output->pix_icon('i/expired', get_string('expireddate', 'badges', userdate($expiration)), 'moodle', array('class' => 'expireimage'));
}
}
$output .= html_writer::end_tag('div');
$output .= html_writer::start_tag('div', array('id' => 'badge-details'));
// Recipient information.
$output .= $this->output->heading(get_string('recipientdetails', 'badges'), 3);
$dl = array();
// Technically, we should alway have a user at this point, but added an extra check just in case.
if ($userinfo) {
if (!$ibadge->valid) {
$notify = $this->output->notification(get_string('recipientvalidationproblem', 'badges'), 'notifynotice');
$dl[get_string('name')] = fullname($userinfo) . $notify;
} else {
$dl[get_string('name')] = fullname($userinfo);
}
} else {
$notify = $this->output->notification(get_string('recipientidentificationproblem', 'badges'), 'notifynotice');
$dl[get_string('name')] = $notify;
}
$output .= $this->definition_list($dl);
$output .= $this->output->heading(get_string('issuerdetails', 'badges'), 3);
$dl = array();
$dl[get_string('issuername', 'badges')] = s($issuer->name);
$dl[get_string('issuerurl', 'badges')] = html_writer::tag('a', $issuer->origin, array('href' => $issuer->origin));
if (isset($issuer->contact)) {
$dl[get_string('contact', 'badges')] = obfuscate_mailto($issuer->contact);
}
$output .= $this->definition_list($dl);
$output .= $this->output->heading(get_string('badgedetails', 'badges'), 3);
$dl = array();
$dl[get_string('name')] = s($assertion->badge->name);
$dl[get_string('description', 'badges')] = s($assertion->badge->description);
$dl[get_string('bcriteria', 'badges')] = html_writer::tag('a', s($assertion->badge->criteria), array('href' => $assertion->badge->criteria));
$output .= $this->definition_list($dl);
$output .= $this->output->heading(get_string('issuancedetails', 'badges'), 3);
$dl = array();
if (isset($assertion->issued_on)) {
$issuedate = !strtotime($assertion->issued_on) ? s($assertion->issued_on) : strtotime($assertion->issued_on);
$dl[get_string('dateawarded', 'badges')] = userdate($issuedate);
}
if (isset($assertion->expires)) {
if ($expiration < $today) {
$dl[get_string('expirydate', 'badges')] = userdate($expiration) . get_string('warnexpired', 'badges');
} else {
$dl[get_string('expirydate', 'badges')] = userdate($expiration);
}
}
if (isset($assertion->evidence)) {
$dl[get_string('evidence', 'badges')] = html_writer::tag('a', s($assertion->evidence), array('href' => $assertion->evidence));
}
$output .= $this->definition_list($dl);
$output .= html_writer::end_tag('div');
return $output;
}
示例6: core_myprofile_navigation
//.........这里部分代码省略.........
$title = $iscurrentuser ? get_string('mypreferences') : get_string('userspreferences', 'moodle', fullname($user));
$node = new core_user\output\myprofile\node('administration', 'preferences', $title, null, $url);
$tree->add_node($node);
}
// Login as ...
if (!$user->deleted && !$iscurrentuser && !\core\session\manager::is_loggedinas() && has_capability('moodle/user:loginas', $context) && !is_siteadmin($user->id)) {
$url = new moodle_url('/course/loginas.php', array('id' => $courseid, 'user' => $user->id, 'sesskey' => sesskey()));
$node = new core_user\output\myprofile\node('administration', 'loginas', get_string('loginas'), null, $url);
$tree->add_node($node);
}
// Contact details.
if (has_capability('moodle/user:viewhiddendetails', $usercontext)) {
$hiddenfields = array();
} else {
$hiddenfields = array_flip(explode(',', $CFG->hiddenuserfields));
}
if (has_capability('moodle/site:viewuseridentity', $context)) {
$identityfields = array_flip(explode(',', $CFG->showuseridentity));
} else {
$identityfields = array();
}
if (is_mnet_remote_user($user)) {
$sql = "SELECT h.id, h.name, h.wwwroot,\n a.name as application, a.display_name\n FROM {mnet_host} h, {mnet_application} a\n WHERE h.id = ? AND h.applicationid = a.id";
$remotehost = $DB->get_record_sql($sql, array($user->mnethostid));
$remoteuser = new stdclass();
$remoteuser->remotetype = $remotehost->display_name;
$hostinfo = new stdclass();
$hostinfo->remotename = $remotehost->name;
$hostinfo->remoteurl = $remotehost->wwwroot;
$node = new core_user\output\myprofile\node('contact', 'mnet', get_string('remoteuser', 'mnet', $remoteuser), null, null, get_string('remoteuserinfo', 'mnet', $hostinfo), null, 'remoteuserinfo');
$tree->add_node($node);
}
if (isset($identityfields['email']) and ($iscurrentuser or $user->maildisplay == 1 or has_capability('moodle/course:useremail', $usercontext) or $user->maildisplay == 2 and enrol_sharing_course($user, $USER))) {
$node = new core_user\output\myprofile\node('contact', 'email', get_string('email'), null, null, obfuscate_mailto($user->email, ''));
$tree->add_node($node);
}
if (!isset($hiddenfields['country']) && $user->country) {
$node = new core_user\output\myprofile\node('contact', 'country', get_string('country'), null, null, get_string($user->country, 'countries'));
$tree->add_node($node);
}
if (!isset($hiddenfields['city']) && $user->city) {
$node = new core_user\output\myprofile\node('contact', 'city', get_string('city'), null, null, $user->city);
$tree->add_node($node);
}
if (isset($identityfields['address']) && $user->address) {
$node = new core_user\output\myprofile\node('contact', 'address', get_string('address'), null, null, $user->address);
$tree->add_node($node);
}
if (isset($identityfields['phone1']) && $user->phone1) {
$node = new core_user\output\myprofile\node('contact', 'phone1', get_string('phone'), null, null, $user->phone1);
$tree->add_node($node);
}
if (isset($identityfields['phone2']) && $user->phone2) {
$node = new core_user\output\myprofile\node('contact', 'phone2', get_string('phone2'), null, null, $user->phone2);
$tree->add_node($node);
}
if (isset($identityfields['institution']) && $user->institution) {
$node = new core_user\output\myprofile\node('contact', 'institution', get_string('institution'), null, null, $user->institution);
$tree->add_node($node);
}
if (isset($identityfields['department']) && $user->department) {
$node = new core_user\output\myprofile\node('contact', 'department', get_string('department'), null, null, $user->institution);
$tree->add_node($node);
}
if (isset($identityfields['idnumber']) && $user->idnumber) {
$node = new core_user\output\myprofile\node('contact', 'idnumber', get_string('idnumber'), null, null, $user->institution);
示例7: alter_mailto
function alter_mailto($matches)
{
return obfuscate_mailto($matches[2], $matches[4]);
}
示例8: get_string
$switchpix = 'email.gif';
}
$emailswitch = " <a title=\"{$switchclick}\" " . "href=\"view.php?id={$user->id}&course={$course->id}&{$switchparam}=1\">" . "<img src=\"{$CFG->pixpath}/t/{$switchpix}\" alt=\"{$switchclick}\" /></a>";
} else {
if ($currentuser) {
/// Can only re-enable an email this way
if ($user->emailstop) {
// Include link that tells how to re-enable their email
$switchparam = 'enable';
$switchtitle = get_string('emaildisable');
$switchclick = get_string('emailenableclick');
$emailswitch = " (<a title=\"{$switchclick}\" " . "href=\"view.php?id={$user->id}&course={$course->id}&enable=1\">{$switchtitle}</a>)";
}
}
}
print_row(get_string("email") . ":", obfuscate_mailto($user->email, '', $user->emailstop) . "{$emailswitch}");
}
if ($user->url && !isset($hiddenfields['webpage'])) {
$url = $user->url;
if (strpos($user->url, '://') === false) {
$url = 'http://' . $url;
}
print_row(get_string("webpage") . ":", "<a href=\"{$url}\">{$user->url}</a>");
}
if ($user->icq && !isset($hiddenfields['icqnumber'])) {
print_row(get_string('icqnumber') . ':', "<a href=\"http://web.icq.com/wwp?uin={$user->icq}\">{$user->icq} <img src=\"http://web.icq.com/whitepages/online?icq={$user->icq}&img=5\" alt=\"\" /></a>");
}
if ($user->skype && !isset($hiddenfields['skypeid'])) {
print_row(get_string('skypeid') . ':', '<a href="callto:' . urlencode($user->skype) . '">' . s($user->skype) . ' <img src="http://mystatus.skype.com/smallicon/' . urlencode($user->skype) . '" alt="' . get_string('status') . '" ' . ' /></a>');
}
if ($user->yahoo && !isset($hiddenfields['yahooid'])) {
示例9: get_content
/**
* block contents
*
* @return object
*/
public function get_content()
{
global $CFG, $USER, $DB, $OUTPUT, $PAGE;
if ($this->content !== NULL) {
return $this->content;
}
if (!isloggedin() or isguestuser()) {
return '';
// Never useful unless you are logged in as real users
}
$this->content = new stdClass();
$this->content->text = '';
$this->content->footer = '';
$course = $this->page->course;
if (!isset($this->config->display_picture) || $this->config->display_picture == 1) {
$this->content->text .= '<div class="myprofileitem picture">';
$this->content->text .= $OUTPUT->user_picture($USER, array('courseid' => $course->id, 'size' => '100', 'class' => 'profilepicture'));
// The new class makes CSS easier
$this->content->text .= '</div>';
}
$this->content->text .= '<div class="myprofileitem fullname">' . fullname($USER) . '</div>';
if (!isset($this->config->display_country) || $this->config->display_country == 1) {
$countries = get_string_manager()->get_list_of_countries();
if (isset($countries[$USER->country])) {
$this->content->text .= '<div class="myprofileitem country">';
$this->content->text .= get_string('country') . ': ' . $countries[$USER->country];
$this->content->text .= '</div>';
}
}
if (!isset($this->config->display_city) || $this->config->display_city == 1) {
$this->content->text .= '<div class="myprofileitem city">';
$this->content->text .= get_string('city') . ': ' . format_string($USER->city);
$this->content->text .= '</div>';
}
if (!isset($this->config->display_email) || $this->config->display_email == 1) {
$this->content->text .= '<div class="myprofileitem email">';
$this->content->text .= obfuscate_mailto($USER->email, '');
$this->content->text .= '</div>';
}
if (!empty($this->config->display_icq) && !empty($USER->icq)) {
$this->content->text .= '<div class="myprofileitem icq">';
$this->content->text .= 'ICQ: ' . s($USER->icq);
$this->content->text .= '</div>';
}
if (!empty($this->config->display_skype) && !empty($USER->skype)) {
$this->content->text .= '<div class="myprofileitem skype">';
$this->content->text .= 'Skype: ' . s($USER->skype);
$this->content->text .= '</div>';
}
if (!empty($this->config->display_yahoo) && !empty($USER->yahoo)) {
$this->content->text .= '<div class="myprofileitem yahoo">';
$this->content->text .= 'Yahoo: ' . s($USER->yahoo);
$this->content->text .= '</div>';
}
if (!empty($this->config->display_aim) && !empty($USER->aim)) {
$this->content->text .= '<div class="myprofileitem aim">';
$this->content->text .= 'AIM: ' . s($USER->aim);
$this->content->text .= '</div>';
}
if (!empty($this->config->display_msn) && !empty($USER->msn)) {
$this->content->text .= '<div class="myprofileitem msn">';
$this->content->text .= 'MSN: ' . s($USER->msn);
$this->content->text .= '</div>';
}
if (!empty($this->config->display_phone1) && !empty($USER->phone1)) {
$this->content->text .= '<div class="myprofileitem phone1">';
$this->content->text .= get_string('phone') . ': ' . s($USER->phone1);
$this->content->text .= '</div>';
}
if (!empty($this->config->display_phone2) && !empty($USER->phone2)) {
$this->content->text .= '<div class="myprofileitem phone2">';
$this->content->text .= get_string('phone') . ': ' . s($USER->phone2);
$this->content->text .= '</div>';
}
if (!empty($this->config->display_institution) && !empty($USER->institution)) {
$this->content->text .= '<div class="myprofileitem institution">';
$this->content->text .= format_string($USER->institution);
$this->content->text .= '</div>';
}
if (!empty($this->config->display_address) && !empty($USER->address)) {
$this->content->text .= '<div class="myprofileitem address">';
$this->content->text .= format_string($USER->address);
$this->content->text .= '</div>';
}
if (!empty($this->config->display_firstaccess) && !empty($USER->firstaccess)) {
$this->content->text .= '<div class="myprofileitem firstaccess">';
$this->content->text .= get_string('firstaccess') . ': ' . userdate($USER->firstaccess);
$this->content->text .= '</div>';
}
if (!empty($this->config->display_lastaccess) && !empty($USER->lastaccess)) {
$this->content->text .= '<div class="myprofileitem lastaccess">';
$this->content->text .= get_string('lastaccess') . ': ' . userdate($USER->lastaccess);
$this->content->text .= '</div>';
}
if (!empty($this->config->display_currentlogin) && !empty($USER->currentlogin)) {
//.........这里部分代码省略.........
示例10: view_dates
//.........这里部分代码省略.........
}
$table[] = '</tr>';
$time = 0;
foreach ($slots as $slottime) {
$t = $time + 1;
$table[] = "<tr><th class=\"number\"><span class=\"time\">{$slottime}</span></th>";
$dag = 0;
$scanedit = ($slotlimits[$time] == 0 or $slotlimits[$time] > $slotcount[$time]) ? $can_edit : 0;
foreach ($days as $day) {
$canedit = $scanedit;
$class = 'normal';
if ($day != '') {
$canedit = ($daylimits[$dag] == 0 or $daylimits[$dag] > $daycount[$dag]) ? $canedit : 0;
if ($tp[$dag][$time] == '') {
$class = 'free';
$tp[$dag][$time] = $canedit ? $baselink . '&rday=' . $dag . '&rslot=' . $time . '">' . get_string('free', 'bookings') . '</a>' : get_string('free', 'bookings');
}
if (isset($reservation[$dag][$time])) {
$tp[$dag][$time] = '';
foreach ($reservation[$dag][$time] as $myres) {
$class = 'reserved';
$linktext = 'Reserved ' . $myres->value;
if ($myres->userid == $UID) {
$linktext = 'M';
} else {
if (sizeof($reservation[$dag][$time] > 1)) {
$linktext = isteacherinanycourse($myres->userid) ? 'T' : 'S';
}
}
// admin can override any, teacher can override student
if ($myres->userid == $UID or isadmin() or isteacherinanycourse($USER->id) and !isteacherinanycourse($myres->userid)) {
$tp[$dag][$time] .= $can_edit ? $baselink . '&delete=1&resid=' . $myres->id . '&uid=' . $myres->userid . '"
title="' . $myres->value . '" >' . $linktext . '</a> ' : $linktext . $myres->value;
} else {
$tp[$dag][$time] .= '<span title="' . $myres->value . '">' . $linktext . ' </span>';
}
}
if (isset($multiple) and $multiple > sizeof($reservation[$dag][$time])) {
/// $tp[$dag][$time] .= ' ' .$reservation[$dag][$time]->count . ' ';
$tp[$dag][$time] .= $canedit ? $baselink . '&rday=' . $dag . '&rslot=' . $time . '">' . get_string('free', 'bookings') . '</a>' : get_string('free', 'bookings');
}
}
$table[] = "<td width=\"{$widthprcent}%\" class=\"{$class}\" >" . $tp[$dag][$time] . " </td>\n";
}
$dag++;
}
if ($privilege > 0) {
$table[] = "<td>" . $slotcount[$time] . " </td>\n";
}
$table[] = "</tr>\n";
$idx++;
$time += 1;
}
if ($privilege > 0) {
$table[] = "<tr><td></td>" . $lastrow . "<td>{$total}</td></tr>";
}
$table[] = "</table>\n";
$html .= implode("", $table);
$html .= '<input type="hidden" name="itemid" value="' . $itemid . '">';
$html .= '<input type="hidden" name="jday" value="' . $jday . '">';
$html .= '</div>';
// end div=all
print $html;
if ($privilege > 0) {
unset($table);
$table->head = array(' ', get_string('name'));
$table->align = array('center', 'left');
$table->wrap = array('nowrap', 'nowrap');
$table->width = '100%';
$table->size = array(10, '*');
$table->head[] = get_string('email');
$table->align[] = 'center';
$table->wrap[] = 'nowrap';
$table->size[] = '*';
$table->head[] = get_string('reservation', 'bookings');
$table->align[] = 'center';
$table->wrap[] = 'nowrap';
$table->size[] = '*';
$table->head[] = get_string('choice', 'bookings');
$table->align[] = 'center';
$table->wrap[] = 'nowrap';
$table->size[] = '*';
// $books = get_records('calendar', 'bookingid', $this->bookings->id);
if ($books = get_records_sql("SELECT r.*, u.firstname, u.lastname, u.picture, u.email\n FROM {$CFG->prefix}bookings_calendar r,\n {$CFG->prefix}user u\n WHERE r.bookingid = '{$this->bookings->id}' \n AND r.userid = u.id ORDER BY r.day,r.slot")) {
foreach ($books as $request) {
$row = array();
$row[] = print_user_picture($request->userid, $course->id, $request->picture, 0, true);
$row[] = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $request->userid . '&course=' . $course->id . '">' . $request->lastname . ' ' . $request->firstname . '</a>';
$row[] = obfuscate_mailto($request->email);
$row[] = $days[$request->day];
$row[] = $slots[$request->slot];
$table->data[] = $row;
}
print "<p>";
print_table($table);
}
}
print "</form>";
return;
}
示例11: render_issued_badge
/**
* Render an issued badge.
*
* No functional changes, but this override is required due to incorrect use
* of the self:: scope (as opposed to static:: or $this->) in core.
*
* @param \issued_badge $issuedbadge
*
* @return string
*/
protected function render_issued_badge(issued_badge $issuedbadge)
{
global $CFG, $DB, $SITE, $USER;
$badge = new badge($issuedbadge->badgeid);
$now = time();
$table = new html_table();
$table->id = 'issued-badge-table';
$imagetable = new html_table();
$imagetable->attributes = array('class' => 'clearfix badgeissuedimage');
$imagetable->data[] = array(html_writer::empty_tag('img', array('src' => $issuedbadge->badgeclass['image'])));
if ($USER->id == $issuedbadge->recipient->id && !empty($CFG->enablebadges)) {
$imagetable->data[] = array($this->output->single_button(new moodle_url('/badges/badge.php', array('hash' => $issuedbadge->issued['uid'], 'bake' => true)), get_string('download'), 'POST'));
$expiration = isset($issuedbadge->issued['expires']) ? $issuedbadge->issued['expires'] : $now + 86400;
if (!empty($CFG->badges_allowexternalbackpack) && $expiration > $now && badges_user_has_backpack($USER->id)) {
$assertion = new moodle_url('/badges/assertion.php', array('b' => $issuedbadge->issued['uid']));
$action = new component_action('click', 'addtobackpack', array('assertion' => $assertion->out(false)));
$attributes = array('type' => 'button', 'id' => 'addbutton', 'value' => get_string('addtobackpack', 'badges'));
$tobackpack = html_writer::tag('input', '', $attributes);
$this->output->add_action_handler($action, 'addbutton');
$imagetable->data[] = array($tobackpack);
}
}
$datatable = new html_table();
$datatable->attributes = array('class' => 'badgeissuedinfo');
$datatable->colclasses = array('bfield', 'bvalue');
// Recipient information.
$datatable->data[] = array($this->output->heading(get_string('recipientdetails', 'badges'), 3), '');
if ($issuedbadge->recipient->deleted) {
$strdata = new stdClass();
$strdata->user = fullname($issuedbadge->recipient);
$strdata->site = format_string($SITE->fullname, true, array('context' => context_system::instance()));
$datatable->data[] = array(get_string('name'), get_string('error:userdeleted', 'badges', $strdata));
} else {
$datatable->data[] = array(get_string('name'), fullname($issuedbadge->recipient));
}
$datatable->data[] = array($this->output->heading(get_string('issuerdetails', 'badges'), 3), '');
$datatable->data[] = array(get_string('issuername', 'badges'), $badge->issuername);
if (isset($badge->issuercontact) && !empty($badge->issuercontact)) {
$datatable->data[] = array(get_string('contact', 'badges'), obfuscate_mailto($badge->issuercontact));
}
$datatable->data[] = array($this->output->heading(get_string('badgedetails', 'badges'), 3), '');
$datatable->data[] = array(get_string('name'), $badge->name);
$datatable->data[] = array(get_string('description', 'badges'), $badge->description);
if ($badge->type == BADGE_TYPE_COURSE && isset($badge->courseid)) {
$coursename = $DB->get_field('course', 'fullname', array('id' => $badge->courseid));
$datatable->data[] = array(get_string('course'), $coursename);
}
$datatable->data[] = array(get_string('bcriteria', 'badges'), $this->print_badge_criteria($badge));
$datatable->data[] = array($this->output->heading(get_string('issuancedetails', 'badges'), 3), '');
$datatable->data[] = array(get_string('dateawarded', 'badges'), userdate($issuedbadge->issued['issuedOn']));
if (isset($issuedbadge->issued['expires'])) {
if ($issuedbadge->issued['expires'] < $now) {
$cell = new html_table_cell(userdate($issuedbadge->issued['expires']) . get_string('warnexpired', 'badges'));
$cell->attributes = array('class' => 'notifyproblem warning');
$datatable->data[] = array(get_string('expirydate', 'badges'), $cell);
$image = html_writer::start_tag('div', array('class' => 'badge'));
$image .= html_writer::empty_tag('img', array('src' => $issuedbadge->badgeclass['image']));
$image .= $this->output->pix_icon('i/expired', get_string('expireddate', 'badges', userdate($issuedbadge->issued['expires'])), 'moodle', array('class' => 'expireimage'));
$image .= html_writer::end_tag('div');
$imagetable->data[0] = array($image);
} else {
$datatable->data[] = array(get_string('expirydate', 'badges'), userdate($issuedbadge->issued['expires']));
}
}
// Print evidence.
$agg = $badge->get_aggregation_methods();
$evidence = $badge->get_criteria_completions($issuedbadge->recipient->id);
$eids = array_map(create_function('$o', 'return $o->critid;'), $evidence);
unset($badge->criteria[BADGE_CRITERIA_TYPE_OVERALL]);
$items = array();
foreach ($badge->criteria as $type => $criteria) {
if (in_array($criteria->id, $eids)) {
$items[] = $this->print_badge_criteria_single($badge, $agg, $type, $criteria);
}
}
$datatable->data[] = array(get_string('evidence', 'badges'), get_string('completioninfo', 'badges') . html_writer::alist($items, array(), 'ul'));
$table->attributes = array('class' => 'generalbox boxaligncenter issuedbadgebox');
$table->data[] = array(html_writer::table($imagetable), html_writer::table($datatable));
$htmlbadge = html_writer::table($table);
return $htmlbadge;
}
示例12: filter_emailprotect_alter_mailto
function filter_emailprotect_alter_mailto($matches)
{
return obfuscate_mailto($matches[2], $matches[4]);
}
示例13: build_facstu_list_table
function build_facstu_list_table($interview, $cm, $course)
{
global $DB, $OUTPUT;
$strstudent = get_string('student', 'interview');
$strphoto = get_string('photo', 'interview');
$stremail = get_string('email', 'interview');
// collects the students in the course
$students = get_course_students($course->id, $sort = "u.lastname", $dir = "ASC");
// If there are no students, will notify
if (!$students) {
$OUTPUT->notify(get_string('noexistingstudents'));
// If there are students, creates a table with the users
// that have not picked a horary string
} else {
// Defines the headings and alignments in the table of students
$stu_list_table = new html_table();
$stu_list_table->head = array($strphoto, $strstudent, $stremail);
$stu_list_table->align = array('CENTER', 'CENTER', 'CENTER');
$stu_list_table->data = array();
// Begins the link to send mail to all the
// students that have not picked a string
$mailto = '<a href="mailto:';
// Para cada uno de los estudiantes
// For each of the students
foreach ($students as $student) {
$row = array();
// If a relationship that complies with the restrictions does not exist
if (!$DB->record_exists('interview_slots', array('student' => $student->id, 'interviewid' => $interview->id))) {
// Shows the user image
$picture = $OUTPUT->user_picture($student);
$row["picture"] = $picture;
// Shows the full name in link format
$name = "<a href=\"../../user/view.php?id={$student->id}&course={$interview->course}\">" . fullname($student) . "</a>";
$row["name"] = $name;
// Creates a link to the mailto list for the user
$email = obfuscate_mailto($student->email);
$row["email"] = $email;
// Inserts the data in the table
$stu_list_table->data[] = array($picture, $name, $email);
//, $actions);
}
}
}
return $stu_list_table;
}
示例14: notify
notify($nostudentstr);
} else {
$mtable->head = array('', $strname, $stremail, $strseen, $straction);
$mtable->align = array('CENTER', 'LEFT', 'LEFT', 'CENTER', 'CENTER');
$mtable->width = array('', '', '', '', '');
$mtable->data = array();
// In $mailto the mailing list for reminder emails is built up
$mailto = '<a href="mailto:';
$date = usergetdate(time());
foreach ($students as $student) {
if (!scheduler_has_slot($student->id, $scheduler, true, $scheduler->schedulermode == 'onetime')) {
$picture = print_user_picture($student->id, $course->id, $student->picture, false, true);
$name = "<a href=\"../../user/view.php?id={$student->id}&course={$scheduler->course}\">";
$name .= fullname($student);
$name .= '</a>';
$email = obfuscate_mailto($student->email);
if (scheduler_has_slot($student->id, $scheduler, true, false) == 0) {
// student has never scheduled
$mailto .= $student->email . ', ';
}
$checkbox = "<a href=\"view.php?what=schedule&id={$cm->id}&studentid={$student->id}&page={$page}&seen=1\">";
$checkbox .= '<img src="pix/unticked.gif" border="0" />';
$checkbox .= '</a>';
$actions = '<span style="font-size: x-small;">';
$actions .= "<a href=\"view.php?what=schedule&id={$cm->id}&studentid={$student->id}&page={$page}\">";
$actions .= get_string('schedule', 'scheduler');
$actions .= '</a></span>';
$mtable->data[] = array($picture, $name, $email, $checkbox, $actions);
}
}
// dont print if allowed to book multiple appointments
示例15: get_content
/**
* block contents
*
* @return object
*/
public function get_content()
{
global $CFG, $USER, $DB, $OUTPUT, $PAGE;
if ($this->content !== NULL) {
return $this->content;
}
if (!isloggedin()) {
return '';
// Never useful unless you are logged in
}
$this->content = new stdClass();
$this->content->text = '';
$this->content->footer = '';
$course = $this->page->course;
if ($PAGE->context->contextlevel == CONTEXT_USER) {
$user = $DB->get_record('user', array('id' => $PAGE->context->instanceid));
} else {
$user = $USER;
}
if ($course->id == SITEID) {
$coursecontext = get_context_instance(CONTEXT_SYSTEM);
} else {
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
// Course context
// Make sure they can view the course
if (!is_viewing($coursecontext)) {
return '';
}
}
// TODO: clean up the following even more
if (!isset($this->config->display_picture) || $this->config->display_picture == 1) {
$this->content->text .= '<div class="myprofileitem picture">';
$this->content->text .= $OUTPUT->user_picture($user, array('courseid' => $course->id, 'size' => '100', 'class' => 'profilepicture'));
// The new class makes CSS easier
$this->content->text .= '</div>';
}
$this->content->text .= '<div class="myprofileitem fullname">' . fullname($user) . '</div>';
if (!isset($this->config->display_country) || $this->config->display_country == 1) {
$countries = get_string_manager()->get_list_of_countries();
if (isset($countries[$user->country])) {
$this->content->text .= '<div class="myprofileitem country">';
$this->content->text .= get_string('country') . ': ' . $countries[$user->country];
$this->content->text .= '</div>';
}
}
if (!isset($this->config->display_city) || $this->config->display_city == 1) {
$this->content->text .= '<div class="myprofileitem city">';
$this->content->text .= get_string('city') . ': ' . $user->city;
$this->content->text .= '</div>';
}
if (!isset($this->config->display_email) || $this->config->display_email == 1) {
$this->content->text .= '<div class="myprofileitem email">';
$this->content->text .= obfuscate_mailto($user->email, '');
$this->content->text .= '</div>';
}
if (!empty($this->config->display_icq) && !empty($user->icq)) {
$this->content->text .= '<div class="myprofileitem icq">';
$this->content->text .= 'ICQ: ' . $user->icq;
$this->content->text .= '</div>';
}
if (!empty($this->config->display_skype) && !empty($user->skype)) {
$this->content->text .= '<div class="myprofileitem skype">';
$this->content->text .= 'Skype: ' . $user->skype;
$this->content->text .= '</div>';
}
if (!empty($this->config->display_yahoo) && !empty($user->yahoo)) {
$this->content->text .= '<div class="myprofileitem yahoo">';
$this->content->text .= 'Yahoo: ' . $user->yahoo;
$this->content->text .= '</div>';
}
if (!empty($this->config->display_aim) && !empty($user->aim)) {
$this->content->text .= '<div class="myprofileitem aim">';
$this->content->text .= 'AIM: ' . $user->aim;
$this->content->text .= '</div>';
}
if (!empty($this->config->display_msn) && !empty($user->msn)) {
$this->content->text .= '<div class="myprofileitem msn">';
$this->content->text .= 'MSN: ' . $user->msn;
$this->content->text .= '</div>';
}
if (!empty($this->config->display_phone1) && !empty($user->phone1)) {
$this->content->text .= '<div class="myprofileitem phone1">';
$this->content->text .= get_string('phone') . ': ' . $user->phone1;
$this->content->text .= '</div>';
}
if (!empty($this->config->display_phone2) && !empty($user->phone2)) {
$this->content->text .= '<div class="myprofileitem phone2">';
$this->content->text .= get_string('phone') . ': ' . $user->phone2;
$this->content->text .= '</div>';
}
if (!empty($this->config->display_institution) && !empty($user->institution)) {
$this->content->text .= '<div class="myprofileitem institution">';
$this->content->text .= $user->institution;
$this->content->text .= '</div>';
}
//.........这里部分代码省略.........