本文整理汇总了PHP中enrol_sharing_course函数的典型用法代码示例。如果您正苦于以下问题:PHP enrol_sharing_course函数的具体用法?PHP enrol_sharing_course怎么用?PHP enrol_sharing_course使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了enrol_sharing_course函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: user_get_user_details
//.........这里部分代码省略.........
}
$user->url = clean_param($user->url, PARAM_URL);
$userdetails['url'] = $user->url;
}
if (in_array('icq', $userfields) && $user->icq && (!isset($hiddenfields['icqnumber']) or $isadmin)) {
$userdetails['icq'] = $user->icq;
}
if (in_array('skype', $userfields) && $user->skype && (!isset($hiddenfields['skypeid']) or $isadmin)) {
$userdetails['skype'] = $user->skype;
}
if (in_array('yahoo', $userfields) && $user->yahoo && (!isset($hiddenfields['yahooid']) or $isadmin)) {
$userdetails['yahoo'] = $user->yahoo;
}
if (in_array('aim', $userfields) && $user->aim && (!isset($hiddenfields['aimid']) or $isadmin)) {
$userdetails['aim'] = $user->aim;
}
if (in_array('msn', $userfields) && $user->msn && (!isset($hiddenfields['msnid']) or $isadmin)) {
$userdetails['msn'] = $user->msn;
}
if (in_array('firstaccess', $userfields) && (!isset($hiddenfields['firstaccess']) or $isadmin)) {
if ($user->firstaccess) {
$userdetails['firstaccess'] = $user->firstaccess;
} else {
$userdetails['firstaccess'] = 0;
}
}
if (in_array('lastaccess', $userfields) && (!isset($hiddenfields['lastaccess']) or $isadmin)) {
if ($user->lastaccess) {
$userdetails['lastaccess'] = $user->lastaccess;
} else {
$userdetails['lastaccess'] = 0;
}
}
if (in_array('email', $userfields) && ($isadmin or $currentuser or $canviewuseremail or in_array('email', $showuseridentityfields) or $user->maildisplay == 1 or $user->maildisplay == 2 and enrol_sharing_course($user, $USER))) {
$userdetails['email'] = $user->email;
}
if (in_array('interests', $userfields) && !empty($CFG->usetags)) {
require_once $CFG->dirroot . '/tag/lib.php';
if ($interests = tag_get_tags_csv('user', $user->id, TAG_RETURN_TEXT)) {
$userdetails['interests'] = $interests;
}
}
//Departement/Institution/Idnumber are not displayed on any profile, however you can get them from editing profile.
if ($isadmin or $currentuser or in_array('idnumber', $showuseridentityfields)) {
if (in_array('idnumber', $userfields) && $user->idnumber) {
$userdetails['idnumber'] = $user->idnumber;
}
}
if ($isadmin or $currentuser or in_array('institution', $showuseridentityfields)) {
if (in_array('institution', $userfields) && $user->institution) {
$userdetails['institution'] = $user->institution;
}
}
if ($isadmin or $currentuser or in_array('department', $showuseridentityfields)) {
if (in_array('department', $userfields) && isset($user->department)) {
//isset because it's ok to have department 0
$userdetails['department'] = $user->department;
}
}
if (in_array('roles', $userfields) && !empty($course)) {
// not a big secret
$roles = get_user_roles($context, $user->id, false);
$userdetails['roles'] = array();
foreach ($roles as $role) {
$userdetails['roles'][] = array('roleid' => $role->roleid, 'name' => $role->name, 'shortname' => $role->shortname, 'sortorder' => $role->sortorder);
}
示例2: print_row
if (isset($identityfields['phone1']) && $user->phone1) {
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.
示例3: print_row
if (has_capability('moodle/user:viewhiddendetails', $context)) {
if ($user->address) {
print_row(get_string("address").":", "$user->address");
}
if ($user->phone1) {
print_row(get_string("phone").":", "$user->phone1");
}
if ($user->phone2) {
print_row(get_string("phone2").":", "$user->phone2");
}
}
if ($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>");
}
示例4: core_myprofile_navigation
//.........这里部分代码省略.........
$url = new moodle_url('/user/preferences.php', array('userid' => $user->id));
$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) {
示例5: print_row
}
if (!isset($hiddenfields['city']) && $user->city) {
print_row(get_string('city') . ':', $user->city);
}
if (has_capability('moodle/user:viewhiddendetails', $context)) {
if ($user->address) {
print_row(get_string("address") . ":", "{$user->address}");
}
if ($user->phone1) {
print_row(get_string("phone") . ":", "{$user->phone1}");
}
if ($user->phone2) {
print_row(get_string("phone2") . ":", "{$user->phone2}");
}
}
if ($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'])) {
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>');
}
示例6: user_get_user_details
//.........这里部分代码省略.........
if (in_array('yahoo', $userfields) && $user->yahoo && (!isset($hiddenfields['yahooid']) or $isadmin)) {
$userdetails['yahoo'] = $user->yahoo;
}
if (in_array('aim', $userfields) && $user->aim && (!isset($hiddenfields['aimid']) or $isadmin)) {
$userdetails['aim'] = $user->aim;
}
if (in_array('msn', $userfields) && $user->msn && (!isset($hiddenfields['msnid']) or $isadmin)) {
$userdetails['msn'] = $user->msn;
}
if (in_array('suspended', $userfields) && (!isset($hiddenfields['suspended']) or $isadmin)) {
$userdetails['suspended'] = (bool)$user->suspended;
}
if (in_array('firstaccess', $userfields) && (!isset($hiddenfields['firstaccess']) or $isadmin)) {
if ($user->firstaccess) {
$userdetails['firstaccess'] = $user->firstaccess;
} else {
$userdetails['firstaccess'] = 0;
}
}
if (in_array('lastaccess', $userfields) && (!isset($hiddenfields['lastaccess']) or $isadmin)) {
if ($user->lastaccess) {
$userdetails['lastaccess'] = $user->lastaccess;
} else {
$userdetails['lastaccess'] = 0;
}
}
if (in_array('email', $userfields) && ($isadmin // The admin is allowed the users email.
or $currentuser // Of course the current user is as well.
or $canviewuseremail // This is a capability in course context, it will be false in usercontext.
or in_array('email', $showuseridentityfields)
or $user->maildisplay == 1
or ($user->maildisplay == 2 and enrol_sharing_course($user, $USER)))) {
$userdetails['email'] = $user->email;
}
if (in_array('interests', $userfields)) {
$interests = core_tag_tag::get_item_tags_array('core', 'user', $user->id, core_tag_tag::BOTH_STANDARD_AND_NOT, 0, false);
if ($interests) {
$userdetails['interests'] = join(', ', $interests);
}
}
// Departement/Institution/Idnumber are not displayed on any profile, however you can get them from editing profile.
if (in_array('idnumber', $userfields) && $user->idnumber) {
if (in_array('idnumber', $showuseridentityfields) or $currentuser or
has_capability('moodle/user:viewalldetails', $context)) {
$userdetails['idnumber'] = $user->idnumber;
}
}
if (in_array('institution', $userfields) && $user->institution) {
if (in_array('institution', $showuseridentityfields) or $currentuser or
has_capability('moodle/user:viewalldetails', $context)) {
$userdetails['institution'] = $user->institution;
}
}
// Isset because it's ok to have department 0.
if (in_array('department', $userfields) && isset($user->department)) {
if (in_array('department', $showuseridentityfields) or $currentuser or
has_capability('moodle/user:viewalldetails', $context)) {
$userdetails['department'] = $user->department;
}
}
if (in_array('roles', $userfields) && !empty($course)) {
示例7: get_course_participants_by_id
//.........这里部分代码省略.........
}
if (isset($user->description) && (!isset($hiddenfields['description']) or $isadmin)) {
if (empty($CFG->profilesforenrolledusersonly) || $currentuser) {
$user->description = file_rewrite_pluginfile_urls($user->description, 'pluginfile.php', $context->id, 'user', 'profile', null);
$userarray['description'] = $user->description;
$userarray['descriptionformat'] = $user->descriptionformat;
}
}
if ((! isset($hiddenfields['country']) or $isadmin) && $user->country) {
$userarray['country'] = $user->country;
}
if ((! isset($hiddenfields['city']) or $isadmin) && $user->city) {
$userarray['city'] = $user->city;
}
if (has_capability('moodle/course:viewhiddenuserfields', $context)) {
if ($user->address) {
$userarray['address'] = $user->address;
}
if ($user->phone1) {
$userarray['phone1'] = $user->phone1;
}
if ($user->phone2) {
$userarray['phone2'] = $user->phone2;
}
}
if ($currentuser
or $user->maildisplay == 1
or has_capability('moodle/course:useremail', $context)
or ($user->maildisplay == 2 and enrol_sharing_course($user, $USER))) {
$userarray['email'] = $user->email;;
}
if ($user->url && (!isset($hiddenfields['webpage']) or $isadmin)) {
$url = $user->url;
if (strpos($user->url, '://') === false) {
$url = 'http://'. $url;
}
$user->url = clean_param($user->url, PARAM_URL);
$userarray['url'] = $user->url;
}
if ($user->icq && (!isset($hiddenfields['icqnumber']) or $isadmin)) {
$userarray['icq'] = $user->icq;
}
if ($user->skype && (!isset($hiddenfields['skypeid']) or $isadmin)) {
$userarray['skype'] = $user->skype;
}
if ($user->yahoo && (!isset($hiddenfields['yahooid']) or $isadmin)) {
$userarray['yahoo'] = $user->yahoo;
}
if ($user->aim && (!isset($hiddenfields['aimid']) or $isadmin)) {
$userarray['aim'] = $user->aim;
}
if ($user->msn && (!isset($hiddenfields['msnid']) or $isadmin)) {
$userarray['msn'] = $user->msn;
}
if ((!isset($hiddenfields['firstaccess'])) or $isadmin) {
if ($user->firstaccess) {
$userarray['firstaccess'] = $user->firstaccess;