本文整理汇总了PHP中user_type函数的典型用法代码示例。如果您正苦于以下问题:PHP user_type函数的具体用法?PHP user_type怎么用?PHP user_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了user_type函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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>');
}
}
}
}
开发者ID:BackupTheBerlios,项目名称:tulipan-svn,代码行数:28,代码来源:lib.php
示例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")));
}
}
}
}
开发者ID:BackupTheBerlios,项目名称:tulipan-svn,代码行数:34,代码来源:lib.php
示例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');
}
开发者ID:BackupTheBerlios,项目名称:tulipan-svn,代码行数:32,代码来源:lib.php
示例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);
}
}
开发者ID:lavalite,项目名称:message,代码行数:32,代码来源:MessageUserController.php
示例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")));
}
}
开发者ID:BackupTheBerlios,项目名称:tulipan-svn,代码行数:60,代码来源:lib.php
示例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\" />";
}
}
}
开发者ID:BackupTheBerlios,项目名称:tulipan-svn,代码行数:45,代码来源:lib.php
示例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());
}
}
开发者ID:baldonharris,项目名称:fantaztic,代码行数:8,代码来源:c_section.php
示例8: gradingsystem
public function gradingsystem()
{
if (user_type() == 6) {
$this->loadPage("subject/grading_system", "subject/grading_system_script", false);
} else {
header("Location: " . base_url());
}
}
开发者ID:baldonharris,项目名称:fantaztic,代码行数:8,代码来源:c_subject.php
示例9: roomManagement
public function roomManagement()
{
if (user_type() == 3) {
$this->loadPage("room/room_management", "room/room_management_script", false);
} else {
header("Location: " . base_url());
}
}
开发者ID:baldonharris,项目名称:fantaztic,代码行数:8,代码来源:c_room.php
示例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());
}
}
开发者ID:baldonharris,项目名称:fantaztic,代码行数:8,代码来源:c_finance.php
示例11: accountStatement
public function accountStatement()
{
if (user_type() == 5) {
$this->loadPage("teller/account_statement", "teller/account_statement_script", false);
} else {
header("Location: " . base_url());
}
}
开发者ID:baldonharris,项目名称:fantaztic,代码行数:8,代码来源:c_teller.php
示例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());
}
}
开发者ID:baldonharris,项目名称:fantaztic,代码行数:8,代码来源:c_registrar.php
示例13: facultyManagement
public function facultyManagement()
{
if (user_type() == 3) {
$this->loadPage("employee/faculty_management", "employee/faculty_management_script", false);
} else {
header("Location: " . base_url());
}
}
开发者ID:baldonharris,项目名称:fantaztic,代码行数:8,代码来源:c_employee.php
示例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());
}
}
开发者ID:baldonharris,项目名称:fantaztic,代码行数:8,代码来源:c_club.php
示例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());
}
}
开发者ID:baldonharris,项目名称:fantaztic,代码行数:8,代码来源:c_finance.php
示例16: index
function index()
{
$script = array("waste_map_script");
if (user_type() * 1 === 3) {
$script[] = "waste_map_lgu_script";
} else {
$script[] = "waste_map_normal_user_script";
}
$this->loadPage("waste_map", $script, array());
}
开发者ID:johnenrickplenos,项目名称:wasteline,代码行数:10,代码来源:Waste_map.php
示例17: Weblog
/**
* Weblog class constructor
*
* <p>Will set all weblog properties, if the provided weblog id exist
* (which effectively will be a user id, regardless if one is dealing
* with a person or a community - for Elgg both are users).</p>
*
* @param int $user_id The user id.
* @param int $blog_id The weblog id.
*/
function Weblog($user_id, $blog_id)
{
$this->community = false;
// dealing with community or not
// username/id conversions
if (is_numeric($user_id)) {
$this->user_id = $user_id;
} elseif (is_string($user_id)) {
$this->user_id = user_info_username('ident', $user_id);
}
if (is_numeric($blog_id)) {
$this->ident = $blog_id;
} elseif (is_string($blog_id)) {
$this->ident = user_info_username('ident', $blog_id);
}
// Are we dealing with a person or a community?
if (user_type($this->ident) == "person") {
if ($result = get_record('users', 'ident', $this->user_id)) {
$this->user_name = $result->name;
$this->user_username = $result->username;
}
$posts = get_records_select('weblog_posts', "owner = ? AND weblog = ?", array($this->user_id, $this->user_id), 'posted DESC');
$this->blog_name = $this->user_name;
$this->blog_username = $this->user_username;
$this->owner = $this->user_id;
} else {
// It's a community
$this->community = true;
// Get the owner
$this->owner = user_info('owner', $this->ident);
// Inject an SQL restriction if the user is not owner
$sql_insert = "";
if ($this->owner != $this->user_id) {
$sql_insert = " and owner = {$this->user_id} ";
}
if ($result = get_record('users', 'ident', $this->ident)) {
$this->blog_name = $result->name;
$this->blog_username = $result->username;
}
$posts = get_records_select('weblog_posts', "weblog = {$this->ident} {$sql_insert}", null, 'posted DESC');
$user = run('users:instance', array('user_id' => $this->user_id));
$this->user_name = $user->getName();
$this->user_username = $user->getUserName();
}
$this->posts = array();
if (is_array($posts) && sizeof($posts) > 0) {
foreach ($posts as $post) {
$this->posts[] = $post->ident;
}
} else {
}
}
开发者ID:BackupTheBerlios,项目名称:tulipan-svn,代码行数:62,代码来源:class_weblog.php
示例18: store
/**
* Create new portfolio.
*
* @param Request $request
*
* @return json
*/
public function store(PortfolioAdminApiRequest $request)
{
try {
$attributes = $request->all();
$attributes['user_id'] = user_id('admin.api');
$attributes['user_type'] = user_type();
$portfolio = $this->repository->create($attributes);
$portfolio = $portfolio->presenter();
$portfolio['code'] = 2004;
return response()->json($portfolio)->setStatusCode(201, 'STORE_SUCCESS');
} catch (Exception $e) {
return response()->json(['message' => $e->getMessage(), 'code' => 4004])->setStatusCode(400, 'STORE_ERROR');
}
}
开发者ID:litecms,项目名称:portfolio,代码行数:21,代码来源:PortfolioAdminApiController.php
示例19: createAccount
public function createAccount()
{
$this->accessNumber = 1;
//registration
$valid = true;
if (!$valid) {
$this->responseError(5, "Captcha Required");
}
if ($this->checkACL() && ($this->input->post("account_type_ID") == 1 && user_type() == 1 || $this->input->post("account_type_ID") == 3 && user_type() == 1 || $this->input->post("account_type_ID") == 2 && $this->input->post("status") == 3 && $this->validReCaptcha())) {
$this->form_validation->set_rules('username', 'Username', 'required|is_unique[account.username]');
$this->form_validation->set_rules('password', 'Password', 'required|min_length[6]');
$this->form_validation->set_rules('account_type_ID', 'Account Type', 'required');
$this->form_validation->set_rules('first_name', 'First Name', 'required');
$this->form_validation->set_rules('middle_name', 'Middle Name', 'required');
$this->form_validation->set_rules('last_name', 'Last Name', 'required');
$this->form_validation->set_rules('email_address', 'Email Address', 'required|valid_email|is_unique[account_contact_information.detail]');
if ($this->form_validation->run()) {
$result = $this->m_account->createAccount($this->input->post("username"), $this->input->post("password"), $this->input->post("account_type_ID"), $this->input->post("status"));
if ($result) {
$this->load->model("m_account_basic_information");
$this->m_account_basic_information->createAccountBasicInformation($result, $this->input->post("first_name"), $this->input->post("middle_name"), $this->input->post("last_name"));
$this->load->model("M_account_contact_information");
$this->M_account_contact_information->createAccountContactInformation($result, 1, $this->input->post("email_address"));
//Send Email Confirmation
if ($this->input->post("account_type_ID") == 2) {
$this->load->library('email');
$this->email->from('[email protected]', 'John Enrick');
$this->email->to($this->input->post("email_address"));
$this->email->subject('Wasteline Registration Verification');
$this->email->message("Good day " . $this->input->post('username') . "! Thank you for registering in Wasteline.\nTo verify you accout, please click the following link: " . base_url("porta/accountVerification/" . ("" + $result . ("" + time()))));
$this->email->send();
}
$this->actionLog($result);
$this->responseData($result);
} else {
$this->responseError(3, "Failed to create");
}
} else {
if (count($this->form_validation->error_array())) {
$this->responseError(102, $this->form_validation->error_array());
} else {
$this->responseError(100, "Required Fields are empty");
}
}
} else {
$this->responseError(1, "Not Authorized");
}
$this->outputResponse();
}
开发者ID:khef22,项目名称:wasteline,代码行数:49,代码来源:c_account.php
示例20: deleteGeneralLedger
public function deleteGeneralLedger()
{
$response = $this->generateResponse();
if (!$this->checkACL(user_type(), API_Controller::STUDENT_MANAGEMENT)) {
// if not admin
$response["error"][] = array("status" => 1, "message" => "Not Authorized");
} else {
$result = $this->m_general_ledger->deleteGeneralLedger($this->input->post("ID"));
if ($result) {
$response["data"] = $result;
} else {
$response["error"][] = array("status" => 1, "message" => "Failed to delete");
}
}
echo json_encode($response);
}
开发者ID:baldonharris,项目名称:fantaztic,代码行数:16,代码来源:c_general_ledger.php
注:本文中的user_type函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论