本文整理汇总了PHP中get_logged_user函数的典型用法代码示例。如果您正苦于以下问题:PHP get_logged_user函数的具体用法?PHP get_logged_user怎么用?PHP get_logged_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_logged_user函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: system_handle_on_before_object_insert
/**
* Set created_ properties for a given object if not set
*
* @param DataObject $object
* @return null
*/
function system_handle_on_before_object_insert($object)
{
if ($object->fieldExists('created_on')) {
if (!isset($object->values['created_on'])) {
$object->setCreatedOn(new DateTimeValue());
}
// if
}
// if
$user =& get_logged_user();
if (!instance_of($user, 'User')) {
return;
}
// if
if ($object->fieldExists('created_by_id') && !isset($object->values['created_by_id'])) {
$object->setCreatedById($user->getId());
}
// if
if ($object->fieldExists('created_by_name') && !isset($object->values['created_by_name'])) {
$object->setCreatedByName($user->getDisplayName());
}
// if
if ($object->fieldExists('created_by_email') && !isset($object->values['created_by_email'])) {
$object->setCreatedByEmail($user->getEmail());
}
// if
}
示例2: send_image_to_client
function send_image_to_client($image_name, $file_alloweds = false)
{
// $model->screen_model->get_db();
$ci =& get_instance();
$session_user = unserialize(get_logged_user());
// dump($session_user);
// dump($_FILES[$image_name]);
$file_name = md5(date("d_m_Y_H_m_s_u")) . "_" . str_replace(" ", "_", stripAccents($_FILES[$image_name]['name']));
// $file_name = md5(date("Ymds"));
$filename = $_FILES[$image_name]['tmp_name'];
$handle = fopen($filename, "r");
$data = fread($handle, filesize($filename));
$POST_DATA = array('file' => base64_encode($data), 'name' => $file_name);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $session_user->upload_path . "upload.php");
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $POST_DATA);
curl_setopt($curl, CURLOPT_HEADER, true);
$response = curl_exec($curl);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
if ($httpCode != 200) {
set_message("Erro ao publicar foto: <br/>" . $response, 2);
}
// dump($response);
return $file_name;
}
示例3: smarty_function_select_company
/**
* Render select company box
*
* Parameters:
*
* - value - Value of selected company
* - optional - Is value of this field optional or not
* - exclude - Array of company ID-s that will be excluded
* - can_create_new - Should this select box offer option to create a new
* company from within the list
*
* @param array $params
* @param Smarty $smarty
* @return string
*/
function smarty_function_select_company($params, &$smarty)
{
static $ids = array();
$companies = Companies::getIdNameMap(array_var($params, 'companies'));
$value = array_var($params, 'value', null, true);
$id = array_var($params, 'id', null, true);
if (empty($id)) {
$counter = 1;
do {
$id = "select_company_dropdown_{$counter}";
$counter++;
} while (in_array($id, $ids));
}
// if
$ids[] = $id;
$params['id'] = $id;
$optional = array_var($params, 'optional', false, true);
$exclude = array_var($params, 'exclude', array(), true);
if (!is_array($exclude)) {
$exclude = array();
}
// if
$can_create_new = array_var($params, 'can_create_new', true, true);
if ($optional) {
$options = array(option_tag(lang('-- None --'), ''), option_tag('', ''));
} else {
$options = array();
}
// if
foreach ($companies as $company_id => $company_name) {
if (in_array($company_id, $exclude)) {
continue;
}
// if
$option_attributes = array('class' => 'object_option');
if ($value == $company_id) {
$option_attributes['selected'] = true;
}
// if
$options[] = option_tag($company_name, $company_id, $option_attributes);
}
// if
if ($can_create_new) {
$logged_user = get_logged_user();
if (instance_of($logged_user, 'User') && Company::canAdd($logged_user)) {
$params['add_object_url'] = assemble_url('people_companies_quick_add');
$params['object_name'] = 'company';
$params['add_object_message'] = lang('Please insert new company name');
$options[] = option_tag('', '');
$options[] = option_tag(lang('New Company...'), '', array('class' => 'new_object_option'));
}
// if
}
// if
return select_box($options, $params) . '<script type="text/javascript">$("#' . $id . '").new_object_from_select();</script>';
}
示例4: smarty_function_user_card
/**
* Show user card
*
* @param array $params
* @param Smarty $smarty
* @return string
*/
function smarty_function_user_card($params, &$smarty)
{
$user = array_var($params, 'user');
if (!instance_of($user, 'User')) {
return new InvalidParamError('user', $user, '$user is expected to be an instance of User class', true);
}
// if
$smarty->assign(array('_card_user' => $user, '_card_options' => $user->getOptions(get_logged_user())));
return $smarty->fetch(get_template_path('_card', 'users', SYSTEM_MODULE));
}
示例5: smarty_function_company_card
/**
* Render company card
*
* Parameters:
*
* - company - company instance
*
* @param array $params
* @param Smarty $smarty
* @return string
*/
function smarty_function_company_card($params, &$smarty)
{
$company = array_var($params, 'company');
if (!instance_of($company, 'Company')) {
return new InvalidParamError('company', $company, '$company is expected to be an valid Company instance', true);
}
// if
$smarty->assign(array('_card_company' => $company, '_card_options' => $company->getOptions(get_logged_user())));
return $smarty->fetch(get_template_path('_card', 'companies', SYSTEM_MODULE));
}
示例6: __construct
function __construct()
{
$this->ci =& get_instance();
$session_user = get_logged_user();
if (empty($session_user)) {
redirect('login/logout');
}
$this->ci->load->helper("html");
$this->ci->load->helper("form_helper");
$this->ci->load->library('table');
$this->ci->load->model("screen_model");
$this->user_obj = unserialize($session_user);
}
示例7: smarty_function_select_project_group
/**
* Select project group helper
*
* Params:
*
* - value - ID of selected group
* - optional - boolean
* - can_create_new - Should this select box offer option to create a new
* company from within the list
*
* @param array $params
* @param Smarty $smarty
* @return string
*/
function smarty_function_select_project_group($params, &$smarty)
{
static $ids = array();
$optional = array_var($params, 'optional', true, true);
$value = array_var($params, 'value', null, true);
$can_create_new = array_var($params, 'can_create_new', true, true);
$id = array_var($params, 'id', null, true);
if (empty($id)) {
$counter = 1;
do {
$id = "select_project_group_dropdown_{$counter}";
$counter++;
} while (in_array($id, $ids));
}
// if
$ids[] = $id;
$params['id'] = $id;
$groups = ProjectGroups::findAll($smarty->get_template_vars('logged_user'), true);
if ($optional) {
$options = array(option_tag(lang('-- None --'), ''), option_tag('', ''));
} else {
$options = array();
}
// if
if (is_foreachable($groups)) {
foreach ($groups as $group) {
$option_attributes = array('class' => 'object_option');
if ($value == $group->getId()) {
$option_attributes['selected'] = true;
}
// if
$options[] = option_tag($group->getName(), $group->getId(), $option_attributes);
}
// foreach
}
// if
if ($can_create_new) {
$params['add_object_url'] = assemble_url('project_groups_quick_add');
$params['object_name'] = 'project_group';
$params['add_object_message'] = lang('Please insert new project group name');
$logged_user = get_logged_user();
if (instance_of($logged_user, 'User') && ProjectGroup::canAdd($logged_user)) {
$options[] = option_tag('', '');
$options[] = option_tag(lang('New Project Group...'), '', array('class' => 'new_object_option'));
}
// if
}
// if
return select_box($options, $params) . '<script type="text/javascript">$("#' . $id . '").new_object_from_select();</script>';
}
示例8: smarty_function_select_document_category
/**
* Render select Document Category helper
*
* Params:
*
* - Standard select box attributes
* - value - ID of selected role
* - optional - Wether value is optional or not
* - can_create_new - Can the user create new category or not, default is true
*
* @param array $params
* @param Smarty $smarty
* @return string
*/
function smarty_function_select_document_category($params, &$smarty)
{
static $ids = array();
$user = array_var($params, 'user', null, true);
if (!instance_of($user, 'User')) {
return new InvalidParamError('user', $user, '$user is expected to be a valid User object', true);
}
// if
$value = array_var($params, 'value', null, true);
$can_create_new = array_var($params, 'can_create_new', true, true);
$id = array_var($params, 'id', null, true);
if (empty($id)) {
$counter = 1;
do {
$id = "select_document_category_dropdown_{$counter}";
$counter++;
} while (in_array($id, $ids));
}
// if
$ids[] = $id;
$params['id'] = $id;
$options = array();
$categories = DocumentCategories::findAll($user);
if (is_foreachable($categories)) {
foreach ($categories as $category) {
$option_attributes = array('class' => 'object_option');
if ($value == $category->getId()) {
$option_attributes['selected'] = true;
}
// if
$options[] = option_tag($category->getName(), $category->getId(), $option_attributes);
}
// foreach
}
// if
if ($can_create_new) {
$params['add_object_url'] = assemble_url('document_categories_quick_add');
$params['object_name'] = 'document_category';
$params['add_object_message'] = lang('Please insert new document category name');
$logged_user = get_logged_user();
if (instance_of($logged_user, 'User') && DocumentCategory::canAdd($logged_user)) {
$options[] = option_tag('', '');
$options[] = option_tag(lang('New Category...'), '', array('class' => 'new_object_option'));
}
// if
}
// if
return select_box($options, $params) . '<script type="text/javascript">$("#' . $id . '").new_object_from_select();</script>';
}
示例9: generate
public function generate()
{
$this->ci->add_asset("assets/cube/css/libs/dropzone_base.css", "css");
$this->ci->add_asset("assets/cube/js/dropzone.min.js");
$this->ci->add_asset("assets/js/modules/gallery.js");
$url = site_url("screen/component_execute_ajax/" . $this->config["to_table"] . "/gallery");
$session_user = unserialize(get_logged_user());
$image_path = $session_user->upload_path;
$action_url = site_url("screen/galery_image_upload");
$result = <<<EOT
\t\t</div>
\t\t</div>
\t\t\t<input type="hidden" id="ajax_url" value="{$url}" />
\t\t\t<input type="hidden" id="image_path" value="{$image_path}" />
\t\t\t\t<div class="main-box">
\t\t\t\t\t<header class="main-box-header">
\t\t\t\t\t\t<h2>GALERIA DE IMAGENS</h2>
\t\t\t\t\t\t<p>
\t\t\t\t\t\t<i class="fa fa-info-circle"></i> Clique na caixa cinza, ou arraste imagens para cadastrar imagens para a galeria
\t\t\t\t\t\t</p>
\t\t\t\t\t</header>
\t\t\t\t\t<div class="main-box-body">
\t\t\t\t\t\t<div id="dropzone">
\t\t\t\t\t\t\t<form id="demo_upload" class="dropzone2 dz-clickable" action="{$action_url}">
\t\t\t\t\t\t\t\t<div class="dz-default dz-message">
\t\t\t\t\t\t\t\t\t<span>Arraste imagens aqui</span>
\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t</form>
\t\t\t\t\t\t</div>
\t\t\t\t\t</div>
\t\t\t\t</div>
\t\t\t\t<div class="main-box">
\t\t\t\t\t<header class="main-box-header">
\t\t\t\t\t\t<h2><i class="fa fa-camera"></i> Imagens cadastradas, clique nelas pare deletar</h2>
\t\t\t\t\t</header>
\t\t\t\t\t
\t\t\t\t\t<div class="main-box-body">
\t\t\t\t\t\t<div id="gallery-photos-wrapper">
\t\t\t\t\t\t\t<ul id="gallery-photos" class="clearfix gallery-photos gallery-photos-hover">
\t\t\t\t\t\t\t\t
\t\t\t\t\t\t\t</ul>
\t\t\t\t\t\t</div>
EOT;
return $result;
}
示例10: change_selected_company
function change_selected_company($company_id = false)
{
if ($this->data["logged_user"]->developer == 1) {
$database_company = $this->company_model->get($company_id);
$session_user = unserialize(get_logged_user());
$session_user->company_id = $company_id;
//$this->input->post("company_id");
$session_user->profile_id = $database_company->profile_id;
$session_user->upload_path = $database_company->upload_path;
// dump($session_user);
$_SESSION["user"] = serialize($session_user);
$_SESSION["logged_user"] = serialize($session_user);
$this->session->set_userdata('user', serialize($session_user));
}
redirect("dashboard");
}
示例11: get
function get($id = false)
{
$this->object = unserialize(get_logged_user());
if (!$id) {
$id = $this->object->user_id;
}
$this->db->select("users.*, users.level, roles.title as role, roles.id as role_id, roles.title as role");
$this->db->from("users");
$this->db->join("company", "company.id = users.company_id");
$this->db->join('user_roles', 'users.id = user_roles.user_id', 'left');
$this->db->join('roles', 'user_roles.role_id = roles.id', 'left');
$user = (array) $this->db->where("users.id", $id)->get()->row();
$this->db->select("user_information.*, state.id as state_id, state.letter as state_letter");
$this->db->from('user_information');
$this->db->join('zone', 'zone.id = user_information.zone_id', 'left');
$this->db->join('state', 'state.id = zone.id_state', 'left');
$this->db->where('user_id', $user["id"]);
$address = (array) $this->db->get()->row();
// dump($address);
return (object) array_merge($user, $address);
}
示例12: smarty_function_user_time
/**
* Show users local time based on his or hers local settings
*
* Parameters:
*
* - user - User, if NULL logged user will be used
* - datetime - Datetime value that need to be displayed. If NULL request time
* will be used
*
* @param array $params
* @param Smarty $smarty
* @return string
*/
function smarty_function_user_time($params, &$smarty)
{
$user = array_var($params, 'user');
if (!instance_of($user, 'User')) {
$user = get_logged_user();
}
// if
if (!instance_of($user, 'User')) {
return lang('Unknown time');
}
// if
$value = array_var($params, 'datetime');
if (!instance_of($value, 'DateValue')) {
$value = $smarty->get_template_vars('request_time');
}
// if
if (!instance_of($value, 'DateValue')) {
return lang('Unknown time');
}
// if
require_once SMARTY_PATH . '/plugins/modifier.time.php';
return clean(smarty_modifier_time($value, get_user_gmt_offset($user)));
}
示例13: smarty_function_select_role
/**
* Render select role helper
*
* Params:
*
* - value - ID of selected role
* - optional - Wether value is optional or not
* - active_user - Set if we are changing role of existing user so we can
* handle situations when administrator role is displayed or changed
*
* @param array $params
* @param Smarty $smarty
* @return string
*/
function smarty_function_select_role($params, &$smarty)
{
$value = array_var($params, 'value', null, true);
$optional = array_var($params, 'optional', false, true);
$active_user = array_var($params, 'active_user', false, true);
$logged_user = get_logged_user();
if (!instance_of($logged_user, 'User')) {
return new InvalidParamError('logged_user', $logged_user, '$logged_user is expected to be an instance of user class');
}
// if
if ($optional) {
$options = array(option_tag(lang('-- None --'), ''), option_tag('', ''));
} else {
$options = array();
}
// if
$roles = Roles::findSystemRoles();
if (is_foreachable($roles)) {
foreach ($roles as $role) {
$show_role = true;
$disabled = false;
if ($role->getPermissionValue('admin_access') && !$logged_user->isAdministrator() && !$active_user->isAdministrator()) {
$show_role = false;
// don't show administration role to non-admins and for non-admins
}
// if
if ($show_role) {
$option_attributes = $value == $role->getId() ? array('selected' => true, 'disabled' => $disabled) : null;
$options[] = option_tag($role->getName(), $role->getId(), $option_attributes);
}
// if
}
// foreach
}
// if
return select_box($options, $params);
}
示例14: show
public function show($options = array(), $data)
{
$this->set_options((array) $data["options"]);
$this->get_options();
if (trim($data['value']) == "") {
return img("http://www.placehold.it/" . $this->max_list_size . "x" . $this->max_list_size . "/EFEFEF/AAAAAA");
}
// $image = "";
// $value = explode(".",$data["value"]);
// $ext = end($value);
// $i=0;
// foreach ($value as $val) {
// if($i == (count($value)-1)){
// $image .= "_thumb.".$val;
// }else{
// $image .= "{$val}";
// }
// $i++;
// }
$session_user = unserialize(get_logged_user());
// dump($session_user);
$options = array("src" => $session_user->upload_path . $data["value"], "width" => $this->max_list_size . "px", "height" => $this->max_list_size . "px");
return img($options);
}
示例15: smarty_function_page_object
/**
* Set page properties with following object
*
* Parameters:
*
* - object - Application object instance
*
* @param array $params
* @param Smarty $smarty
* @return null
*/
function smarty_function_page_object($params, &$smarty)
{
static $private_roles = false;
$object = array_var($params, 'object');
if (!instance_of($object, 'ApplicationObject')) {
return new InvalidParamError('object', $object, '$object is expected to be an instance of ApplicationObject class', true);
}
// if
require_once SMARTY_DIR . '/plugins/modifier.datetime.php';
$wireframe =& Wireframe::instance();
$logged_user =& get_logged_user();
$construction =& PageConstruction::instance();
if ($construction->page_title == '') {
$construction->setPageTitle($object->getName());
}
// if
if (instance_of($object, 'ProjectObject') && $wireframe->details == '') {
$in = $object->getParent();
$created_on = $object->getCreatedOn();
$created_by = $object->getCreatedBy();
if (instance_of($created_by, 'User') && instance_of($in, 'ApplicationObject') && instance_of($created_on, 'DateValue')) {
//BOF:mod 20120913
/*
//EOF:mod 20120913
$wireframe->details = lang('By <a href=":by_url">:by_name</a> in <a href=":in_url">:in_name</a> on <span>:on</span>', array(
//BOF:mod 20120913
*/
$wireframe->details = lang('Created on <span>:on</span>', array('by_url' => $created_by->getViewUrl(), 'by_name' => $created_by->getDisplayName(), 'in_url' => $in->getViewUrl(), 'in_name' => $in->getName(), 'on' => smarty_modifier_datetime($created_on)));
} elseif (instance_of($created_by, 'User') && instance_of($created_on, 'DateValue')) {
//BOF:mod 20120913
/*
//EOF:mod 20120913
$wireframe->details = lang('By <a href=":by_url">:by_name</a> on <span>:on</span>', array(
//BOF:mod 20120913
*/
$wireframe->details = lang('Created on <span>:on</span>', array('by_url' => $created_by->getViewUrl(), 'by_name' => $created_by->getDisplayName(), 'on' => smarty_modifier_datetime($created_on)));
} elseif (instance_of($created_by, 'User')) {
//BOF:mod 20120913
/*
//EOF:mod 20120913
$wireframe->details = lang('By <a href=":by_url">:by_name</a>', array(
//BOF:mod 20120913
*/
$wireframe->details = lang('Created on <span>:on</span>', array('by_url' => $created_by->getViewUrl(), 'by_name' => $created_by->getDisplayName(), 'on' => smarty_modifier_datetime($created_on)));
} elseif (instance_of($created_by, 'AnonymousUser') && instance_of($created_on, 'DateValue')) {
//BOF:mod 20120913
/*
//EOF:mod 20120913
$wireframe->details = lang('By <a href=":by_url">:by_name</a> on <span>:on</span>', array(
//BOF:mod 20120913
*/
$wireframe->details = lang('Created on <span>:on</span>', array('by_url' => 'mailto:' . $created_by->getEmail(), 'by_name' => $created_by->getName(), 'on' => smarty_modifier_datetime($created_on)));
} elseif (instance_of($created_by, 'AnonymousUser')) {
//BOF:mod 20120913
/*
//EOF:mod 20120913
$wireframe->details = lang('By <a href=":by_url">:by_name</a>', array(
//BOF:mod 20120913
*/
$wireframe->details = lang('Created on <span>:on</span>', array('by_url' => 'mailto:' . $created_by->getEmail(), 'by_name' => $created_by->getName(), 'on' => smarty_modifier_datetime($created_on)));
}
// if
}
// if
$smarty->assign('page_object', $object);
// Need to do a case sensitive + case insensitive search to have PHP4 covered
$class_methods = get_class_methods($object);
if (in_array('getOptions', $class_methods) || in_array('getoptions', $class_methods)) {
$options = $object->getOptions($logged_user);
if (instance_of($options, 'NamedList') && $options->count()) {
$wireframe->addPageAction(lang('Options'), '#', $options->data, array('id' => 'project_object_options'), 1000);
}
// if
if (instance_of($object, 'ProjectObject')) {
if ($object->getState() > STATE_DELETED) {
if ($object->getVisibility() <= VISIBILITY_PRIVATE) {
//Ticket ID #362 - modify Private button (SA) 14March2012 BOF
$users_table = TABLE_PREFIX . 'users';
$assignments_table = TABLE_PREFIX . 'assignments';
$subscription_table = TABLE_PREFIX . 'subscriptions';
// $rows = db_execute_all("SELECT $assignments_table.is_owner AS is_assignment_owner, $users_table.id AS user_id, $users_table.company_id, $users_table.first_name, $users_table.last_name, $users_table.email FROM $users_table, $assignments_table WHERE $users_table.id = $assignments_table.user_id AND $assignments_table.object_id = ? ORDER BY $assignments_table.is_owner DESC", $object->getId());
$rows = db_execute_all("SELECT {$assignments_table}.is_owner AS is_assignment_owner, {$users_table}.id AS user_id, {$users_table}.company_id, {$users_table}.first_name, {$users_table}.last_name, {$users_table}.email FROM {$users_table}, {$assignments_table} WHERE {$users_table}.id = {$assignments_table}.user_id AND {$assignments_table}.object_id = " . $object->getId() . " UNION SELECT '0' AS is_assignment_owner, {$users_table}.id AS user_id, {$users_table}.company_id, {$users_table}.first_name, {$users_table}.last_name, {$users_table}.email FROM {$users_table}, {$subscription_table} WHERE {$users_table}.id = {$subscription_table}.user_id AND {$subscription_table}.parent_id = " . $object->getId());
if (is_foreachable($rows)) {
$owner = null;
$other_assignees = array();
$users_dropdown_for_tickets = '';
foreach ($rows as $row) {
if (empty($row['first_name']) && empty($row['last_name'])) {
$user_link = clean($row['email']);
//.........这里部分代码省略.........