本文整理汇总了PHP中user_type函数的典型用法代码示例。如果您正苦于以下问题:PHP user_type函数的具体用法?PHP user_type怎么用?PHP user_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了user_type函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: messages_pagesetup
function messages_pagesetup()
{
// register links --
global $profile_id, $PAGE, $CFG, $metatags, $function, $USER;
$pgowner = $profile_id;
require_once $CFG->dirroot . "mod/messages/lib/messages_config.php";
require_once $CFG->dirroot . "mod/messages/default_template.php";
if (isloggedin() && user_info("user_type", $_SESSION['userid']) != "external") {
// Add the JavaScript functions
// Lose the trailing slash
$url = substr($CFG->wwwroot, 0, -1);
$metatags .= "<script language=\"javascript\" type=\"text/javascript\" src=\"{$url}/mod/messages/messages.js\"></script>";
$metatags .= "<link rel=\"stylesheet\" href=\"" . $CFG->wwwroot . "mod/messages/css.css\" type=\"text/css\" media=\"screen\" />";
$messages = count_records_select('messages', 'to_id=' . $USER->ident . " AND status='unread'");
if (defined("context") && context == "messages" && $pgowner == $_SESSION['userid']) {
$PAGE->menu[] = array('name' => 'messages', 'html' => '<li><a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/" class="selected">' . __gettext("Messages") . " ({$messages})" . '</a></li>');
} else {
$PAGE->menu[] = array('name' => 'messages', 'html' => '<li><a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/">' . __gettext("Messages") . " ({$messages})" . '</a></li>');
}
if (profile_permissions_check("profile") && defined("context") && context == "messages") {
if (user_type($pgowner) == "person") {
$PAGE->menu_sub[] = array('name' => 'messages:list', 'html' => '<a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/">' . __gettext("View Messages") . '</a>');
$PAGE->menu_sub[] = array('name' => 'messages:compose', 'html' => '<a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/compose">' . __gettext("Compose") . '</a>');
$PAGE->menu_sub[] = array('name' => 'messages:sent', 'html' => '<a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/sent">' . __gettext("Sent Messages") . '</a>');
}
}
}
}
示例2: friend_pagesetup
function friend_pagesetup()
{
// register links --
global $profile_id;
global $PAGE;
global $CFG;
global $metatags;
require_once dirname(__FILE__) . "/default_template.php";
require_once dirname(__FILE__) . "/lib/friends_config.php";
$metatags .= "<link rel=\"stylesheet\" href=\"" . $CFG->wwwroot . "mod/friend/css.css\" type=\"text/css\" media=\"screen\" />";
$page_owner = $profile_id;
if (isloggedin()) {
if (defined("context") && context == "network" && $page_owner == $_SESSION['userid']) {
$PAGE->menu[] = array('name' => 'friends', 'html' => "<li><a href=\"{$CFG->wwwroot}{$_SESSION['username']}/friends/\" class=\"selected\" >" . __gettext("Contacts") . '</a></li>');
} else {
$PAGE->menu[] = array('name' => 'friends', 'html' => "<li><a href=\"{$CFG->wwwroot}{$_SESSION['username']}/friends/\" >" . __gettext("Contacts") . '</a></li>');
}
}
if (defined("context") && context == "network") {
if (user_type($page_owner) == "person" || user_type($page_owner) == "external") {
$friends_username = user_info('username', $page_owner);
$PAGE->menu_sub[] = array('name' => 'friend', 'html' => a_href("{$CFG->wwwroot}{$friends_username}/friends/", __gettext("My friends")));
/*$PAGE->menu_sub[] = array( 'name' => 'friend:of',
'html' => a_href( "{$CFG->wwwroot}{$friends_username}/friendsof/",
__gettext("Friend of")));*/
if (isloggedin() && $page_owner == $_SESSION['userid']) {
$PAGE->menu_sub[] = array('name' => 'friend:requests', 'html' => a_href("{$CFG->wwwroot}{$friends_username}/friends/requests", __gettext("Friendship requests")));
}
if (FRIENDS_FOAF) {
$PAGE->menu_sub[] = array('name' => 'friend:foaf', 'html' => a_href("{$CFG->wwwroot}{$friends_username}/foaf/", __gettext("FOAF")));
}
}
}
}
示例3: profile_pagesetup
function profile_pagesetup()
{
// register links --
global $profile_id;
global $PAGE;
global $CFG;
// don't clobber $page_owner, use a
// local $pgowner instead for clarity
$pgowner = $profile_id;
if (isloggedin()) {
if (defined("context") && context == "profile" && $pgowner == $_SESSION['userid']) {
$PAGE->menu[] = array('name' => 'profile', 'html' => '<li><a href="' . $CFG->wwwroot . $_SESSION['username'] . '/profile/" class="selected">' . __gettext("Profile") . '</a></li>');
} else {
$PAGE->menu[] = array('name' => 'profile', 'html' => '<li><a href="' . $CFG->wwwroot . $_SESSION['username'] . '/profile/">' . __gettext("Profile") . '</a></li>');
}
if (profile_permissions_check("profile") && defined("context") && context == "profile") {
if (user_type($pgowner) == "person") {
$PAGE->menu_sub[] = array('name' => 'profile:edit', 'html' => '<a href="' . $CFG->wwwroot . 'profile/edit.php?profile_id=' . $pgowner . '">' . __gettext("Edit this profile") . '</a>');
$PAGE->menu_sub[] = array('name' => 'profile:picedit', 'html' => '<a href="' . $CFG->wwwroot . '_icons/?context=profile&profile_id=' . $pgowner . '">' . __gettext("Change site picture") . '</a>');
if (!empty($CFG->uses_YUI)) {
$PAGE->menu_sub[] = array('name' => 'profile:widget:manage', 'html' => '<a href="' . $CFG->wwwroot . 'mod/widget/manage_widgets.php">' . __gettext("Manage widgets") . '</a>');
}
/*else {
$PAGE->menu_sub[] = array (
'name' => 'profile:widget:add',
'html' => '<a href="' . $CFG->wwwroot . 'mod/profile/add.php?owner=' . $pgowner . '">' . __gettext("Add widget") . '</a>');
}*/
}
}
}
$PAGE->search_menu[] = array('name' => __gettext("People"), 'user_type' => 'person');
}
示例4: store
/**
* Display the specified resource.
*
* @param Request $request
*
* @return Response
*/
public function store(MessageUserRequest $request)
{
try {
$mails = $request->get('mails');
$attributes = $request->all();
$attributes['user_id'] = user_id('web');
$attributes['user_type'] = user_type();
$attributes['name'] = user()->name;
$attributes['from'] = user()->email;
$attributes['to'] = implode(",", $mails);
$attributes['status'] = $request->get('status');
$message = $this->repository->create($attributes);
if ($request->get('status') == 'Sent') {
foreach ($mails as $mail) {
$attributes['status'] = "Inbox";
$message1 = $this->repository->create($attributes);
}
}
$sent_count = $this->repository->msgCount('Sent');
$inbox_count = $this->repository->msgCount('Inbox');
return response()->json(['message' => trans('messages.success.updated', ['Module' => trans('message::message.name')]), 'code' => 204, 'redirect' => trans_url('/user/message/message/' . $message->getRouteKey()), 'sent_count' => $sent_count, 'inbox_count' => $inbox_count], 201);
} catch (Exception $e) {
return response()->json(['message' => $e->getMessage(), 'code' => 400], 400);
}
}
示例5: community_pagesetup
function community_pagesetup()
{
// register links --
global $profile_id;
global $PAGE;
global $CFG;
global $USER;
require_once dirname(__FILE__) . "/default_template.php";
require_once dirname(__FILE__) . "/lib/communities_config.php";
$page_owner = $profile_id;
$usertype = user_type($page_owner);
$username = user_info('username', $page_owner);
if (isloggedin()) {
if (COMMUNITY_CONTEXT != "network") {
if (defined("context") && context == COMMUNITY_CONTEXT) {
$PAGE->menu[] = array('name' => 'community', 'html' => "<li><a href=\"{$CFG->wwwroot}{$_SESSION['username']}/communities\" class=\"selected\" >" . __gettext("Communities") . '</a></li>');
} else {
$PAGE->menu[] = array('name' => 'community', 'html' => "<li><a href=\"{$CFG->wwwroot}{$_SESSION['username']}/communities\" >" . __gettext("Communities") . '</a></li>');
}
}
}
if ($usertype == "community") {
/*$PAGE->menu_sub[] = array( 'name' => 'profile:edit',
'html' => '<a href="'.$CFG->wwwroot.'profile/edit.php?profile_id='.$page_owner.'">'
. __gettext("Edit community profile") . '</a>');*/
$PAGE->menu_sub[] = array('name' => 'community:pic', 'html' => a_href("{$CFG->wwwroot}_icons/?context=profile&profile_id={$page_owner}", __gettext("Community site picture")));
$PAGE->menu_sub[] = array('name' => 'community:edit', 'html' => a_href("{$CFG->wwwroot}_userdetails/?context=profile&profile_id={$page_owner}", __gettext("Edit community details")));
/*$PAGE->menu_sub[] = array( 'name' => 'profile:view',
'html' => a_href("{$CFG->wwwroot}{$username}/profile",
__gettext("Return to community profile")));*/
$PAGE->menu_sub[] = array('name' => 'community:adminmembers', 'html' => a_href("{$CFG->wwwroot}{$username}/community/members", __gettext("Edit members")));
$PAGE->menu_sub[] = array('name' => 'community:requests', 'html' => a_href("{$CFG->wwwroot}{$username}/community/requests", __gettext("View membership requests")));
$PAGE->menu_sub[] = array('name' => 'community:invite', 'html' => a_href("{$CFG->wwwroot}{$username}/community/invite", __gettext("Invite people")));
$PAGE->menu_sub[] = array('name' => 'community:invite', 'html' => a_href("{$CFG->wwwroot}{$USER->username}/communities", __gettext("Back to communities")));
} else {
if ($usertype == "person") {
if (defined("context") && context == COMMUNITY_CONTEXT) {
if (COMMUNITY_COMPACT_VIEW) {
$PAGE->menu_sub[] = array('name' => 'community', 'html' => a_href("{$CFG->wwwroot}{$username}/communities", __gettext("My Communities")));
if (logged_on && $page_owner == $_SESSION['userid'] && ($CFG->community_create_flag == "" || user_flag_get($CFG->community_create_flag, $USER->ident))) {
$PAGE->menu_sub[] = array('name' => 'community:owned', 'html' => a_href("{$CFG->wwwroot}{$username}/communities/new", __gettext("New Community")));
}
} else {
if ($CFG->community_create_flag == "" || user_flag_get($CFG->community_create_flag, $USER->ident)) {
$PAGE->menu_sub[] = array('name' => 'community:owned', 'html' => a_href("{$CFG->wwwroot}{$username}/communities/create", __gettext("Create a Community")));
$PAGE->menu_sub[] = array('name' => 'community', 'html' => a_href("{$CFG->wwwroot}{$username}/communities", __gettext("My Communities")));
if ($CFG->community_create_flag == "" || user_flag_get($CFG->community_create_flag, $USER->ident)) {
$PAGE->menu_sub[] = array('name' => 'community:owned', 'html' => a_href("{$CFG->wwwroot}{$username}/communities/owned", __gettext("Owned Communities")));
}
}
}
}
}
}
$PAGE->search_menu[] = array('name' => __gettext("Communities"), 'user_type' => 'community');
// Add membership requests to the personal network page
if (defined("context") && context == "community" && isloggedin() && $page_owner == $_SESSION['userid']) {
$PAGE->menu_sub[] = array('name' => 'membership:invites', 'html' => a_href("{$CFG->wwwroot}{$username}/communities/invitations", __gettext("Community invitations")));
}
}
示例6: icon_html
/**
* Returns the HTML to display a user's icon, with event hooks allowing for interception.
* Internally passes around a "user_icon" "display" event, with an object
* containing the elements 'html', 'icon' (being the icon ID), 'size', 'owner' and 'url'.
*
* @uses $CFG
* @param integer $icon_id The unique ID of the user we want to display the icon for.
* @param integer $size The size of the icon we want to display (max: 100).
* @param boolean $urlonly If true, returns the URL of the icon rather than the full HTML.
* @return string Returns the icon HTML, or the default icon if something went wrong (eg the user didn't exist).
*/
function icon_html($icon_id, $size = 100, $urlonly = false)
{
global $CFG;
global $profile_id;
$extra = "";
$user_icon = new stdClass();
$user_icon->size = $size;
if ($size < 100) {
$extra = "/h/{$size}/w/{$size}";
}
$profile_icon = user_info("icon", $profile_id);
$user_type = user_type($profile_id);
$user_icon->icon = $icon_id;
if ($user_icon->icon != -1 && $user_icon->icon != $profile_icon) {
$user_icon->url = "{$CFG->wwwroot}_icon/user/{$user_icon->icon}{$extra}";
$user_icon->html = "<img src=\"{$user_icon->url}\" border=\"0\" alt=\"user icon\" />";
if ($urlonly) {
return $user_icon->url;
} else {
return $user_icon->html;
}
}
if ($urlonly) {
return -1;
} else {
$extensionContext = trim(optional_param('extension', 'weblog'));
if (array_key_exists($extensionContext, $CFG->weblog_extensions) && array_key_exists('icon', $CFG->weblog_extensions[$extensionContext])) {
$icon = $CFG->weblog_extensions[$extensionContext]['icon'];
return "<img src=\"{$icon}\" border=\"0\" alt=\"default user icon\" width=\"{$size}\" heigh=\"{$size}\"/>";
} else {
return "<img src=\"{$CFG->wwwroot}_icon/user/{$profile_icon}{$extra}\" border=\"0\" alt=\"default user icon\" />";
}
}
}
示例7: classSectionManagement
public function classSectionManagement()
{
if (user_type() == 3 || user_type() == 5) {
$this->loadPage("section/class_section_management", "section/class_section_management_script", false);
} else {
header("Location: " . base_url());
}
}
示例8: gradingsystem
public function gradingsystem()
{
if (user_type() == 6) {
$this->loadPage("subject/grading_system", "subject/grading_system_script", false);
} else {
header("Location: " . base_url());
}
}
示例9: roomManagement
public function roomManagement()
{
if (user_type() == 3) {
$this->loadPage("room/room_management", "room/room_management_script", false);
} else {
header("Location: " . base_url());
}
}
示例10: assessmentItemReport
public function assessmentItemReport()
{
if (user_type() == 5 || user_type() == 3) {
$this->loadPage("report/finance/assessment_item_report", "report/finance/assessment_item_report_script", false);
} else {
header("Location: " . base_url());
}
}
示例11: accountStatement
public function accountStatement()
{
if (user_type() == 5) {
$this->loadPage("teller/account_statement", "teller/account_statement_script", false);
} else {
header("Location: " . base_url());
}
}
示例12: accountAdjustmentFee
public function accountAdjustmentFee()
{
if (user_type() == 3 || user_type() == 6 || user_type() == 5) {
$this->loadPage("registrar/account_adjustment_fee", "registrar/account_adjustment_fee_script", false);
} else {
header("Location: " . base_url());
}
}
示例13: facultyManagement
public function facultyManagement()
{
if (user_type() == 3) {
$this->loadPage("employee/faculty_management", "employee/faculty_management_script", false);
} else {
header("Location: " . base_url());
}
}
示例14: clubManagement
public function clubManagement()
{
if (user_type() == 3 || user_type() == 5) {
$this->loadPage("club/club_management", "club/club_management_script", false);
} else {
header("Location: " . base_url());
}
}
示例15: studentYearlyDeductible
public function studentYearlyDeductible()
{
if (user_type() == 3 || user_type() == 5) {
$this->loadPage("finance/student_yearly_deductible", "finance/student_yearly_deductible_script", false);
} else {
header("Location: " . base_url());
}
}