本文整理汇总了PHP中get_logged_user函数的典型用法代码示例。如果您正苦于以下问题:PHP get_logged_user函数的具体用法?PHP get_logged_user怎么用?PHP get_logged_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_logged_user函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:33,代码来源:on_before_object_insert.php
示例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;
}
开发者ID:caina,项目名称:pando,代码行数:29,代码来源:pando_helper.php
示例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>';
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:71,代码来源:function.select_company.php
示例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));
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:17,代码来源:function.user_card.php
示例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));
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:21,代码来源:function.company_card.php
示例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);
}
开发者ID:caina,项目名称:pando,代码行数:13,代码来源:form_creator.php
示例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>';
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:64,代码来源:function.select_project_group.php
示例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>';
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:63,代码来源:function.select_document_category.php
示例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;
}
开发者ID:caina,项目名称:pando,代码行数:48,代码来源:gallery.php
示例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");
}
开发者ID:caina,项目名称:pando,代码行数:16,代码来源:company.php
示例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);
}
开发者ID:caina,项目名称:pando,代码行数:21,代码来源:user_model.php
示例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)));
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:36,代码来源:function.user_time.php
示例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);
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:51,代码来源:function.select_role.php
示例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);
}
开发者ID:caina,项目名称:pando,代码行数:24,代码来源:single_upload.php
示例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']);
//.........这里部分代码省略.........
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:101,代码来源:function.page_object.php
示例16: create_new_ad_action
function create_new_ad_action()
{
$this->load->model("user_model");
$id = @$this->input->post('ad_id', TRUE);
set_message("Anuncio criado com sucesso");
$this->ad_model->post_to_values($this->input->post("ad"));
if (!$this->ad_model->valid) {
die("validar");
}
if ($id) {
set_message("Anuncio editado com sucesso");
// verifica antes se o id eh do usuario mesmo
$this->ad_model->get($id);
if ($this->ad_model->is_mine()) {
$this->ad_model->post_to_values($this->input->post("ad"));
$this->ad_model->update($id);
}
} else {
$this->ad_model->object->user_id = unserialize(get_logged_user())->user_id;
$this->ad_model->create_new($this->ad_model->object);
}
// inserir subcategorias
// veiculo
$this->ad_vehicle_model->post_to_values(@$this->input->post("vehicle"));
if (!empty($this->ad_vehicle_model->object)) {
if ($this->ad_vehicle_model->is_valid()) {
$this->ad_vehicle_model->create_or_update($this->ad_model->object->vehicle_id);
$this->ad_model->set_vehicle_id($this->ad_vehicle_model->object->id);
} else {
// voltar pra tela como erro
die("temos um problema ");
}
}
$this->user_model->update_user($this->input->post("user"));
// updatear imagens
$this->ad_image_model->set_ad_images($this->input->post('image'), $this->ad_model->object->id);
redirect(site_url("lib_generic/method/anuncios/ad/home_page"));
}
开发者ID:caina,项目名称:pando,代码行数:38,代码来源:ad.php
示例17: order_details
function order_details($id)
{
$this->page_title = "Order Details | General Tech Services LLC -" . STATIC_TITLE;
if ($id) {
$orderInfo = $this->user_model->getOrder(get_logged_user('id'), $id);
$this->render_page(strtolower(__CLASS__) . '/order_details', $orderInfo);
}
}
开发者ID:jkmorayur,项目名称:gtech,代码行数:8,代码来源:user.php
示例18: init_locale
/**
* Initialize locale settings based on logged in user
*
* @param void
* @return null
*/
function init_locale()
{
// Used when application is initialized from command line (we don't have
// all the classes available)
if (!class_exists('ConfigOptions') || !class_exists('UserConfigOptions')) {
return true;
}
// if
$logged_user =& get_logged_user();
$language_id = null;
if (instance_of($logged_user, 'User')) {
if (LOCALIZATION_ENABLED) {
$language_id = UserConfigOptions::getValue('language', $logged_user);
}
// if
$format_date = UserConfigOptions::getValue('format_date', $logged_user);
$format_time = UserConfigOptions::getValue('format_time', $logged_user);
} else {
if (LOCALIZATION_ENABLED) {
$language_id = ConfigOptions::getValue('language');
}
// if
$format_date = ConfigOptions::getValue('format_date');
$format_time = ConfigOptions::getValue('format_time');
}
// if
$language = new Language();
// Now load languages
if (LOCALIZATION_ENABLED && $language_id) {
$language = Languages::findById($language_id);
if (instance_of($language, 'Language')) {
$current_locale = $language->getLocale();
$GLOBALS['current_locale'] = $current_locale;
$GLOBALS['current_locale_translations'] = array();
if ($current_locale != BUILT_IN_LOCALE) {
setlocale(LC_ALL, $current_locale);
// Set locale
// workaround for tr, ku, az locales according to http://bugs.php.net/bug.php?id=18556
$current_locale_country = explode('.', $current_locale);
$current_locale_country = strtolower($current_locale_country[0]);
if (in_array($current_locale_country, array('tr_tr', 'ku', 'az_az'))) {
setlocale(LC_CTYPE, BUILT_IN_LOCALE);
}
// if
$GLOBALS['current_locale_translations'][$current_locale] = array();
$language->loadTranslations($current_locale);
}
// if
}
// if
}
// if
$this->smarty->assign('current_language', $language);
define('USER_FORMAT_DATETIME', "{$format_date} {$format_time}");
define('USER_FORMAT_DATE', $format_date);
define('USER_FORMAT_TIME', $format_time);
return true;
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:64,代码来源:ActiveCollab.class.php
示例19: setStatus
/**
* Change invoice status
*
* @param integer $status
* @param User $by
* @param DateValue $on
* @return null
*/
function setStatus($status, $by = null, $on = null)
{
$on = instance_of($on, 'DateValue') ? $on : new DateValue();
$by = instance_of($by, 'User') ? $by : get_logged_user();
switch ($status) {
// Mark invoice as draft
case INVOICE_STATUS_DRAFT:
parent::setStatus($status);
$this->setIssuedOn(null);
$this->setIssuedById(null);
$this->setIssuedByName(null);
$this->setIssuedByEmail(null);
$this->setClosedOn(null);
$this->setClosedById(null);
$this->setClosedByName(null);
$this->setClosedByEmail(null);
break;
// Mark invoice as issued
// Mark invoice as issued
case INVOICE_STATUS_ISSUED:
parent::setStatus($status);
if ($on) {
$this->setIssuedOn($on);
}
// if
if ($by) {
$this->setIssuedById($by->getId());
$this->setIssuedByName($by->getName());
$this->setIssuedByEmail($by->getEmail());
}
// if
$this->setClosedOn(null);
$this->setClosedById(null);
$this->setClosedByName(null);
$this->setClosedByEmail(null);
$this->setTimeRecordsStatus(BILLABLE_STATUS_PENDING_PAYMENT);
break;
// Mark invoice as billed
// Mark invoice as billed
case INVOICE_STATUS_BILLED:
parent::setStatus(INVOICE_STATUS_BILLED);
$this->setClosedOn($on);
$this->setClosedById($by->getId());
$this->setClosedByName($by->getName());
$this->setClosedByEmail($by->getEmail());
$this->setTimeRecordsStatus(BILLABLE_STATUS_BILLED);
break;
// Mark invoice as canceled
// Mark invoice as canceled
case INVOICE_STATUS_CANCELED:
parent::setStatus(INVOICE_STATUS_CANCELED);
$this->setClosedOn($on);
$this->setClosedById($by->getId());
$this->setClosedByName($by->getName());
$this->setClosedByEmail($by->getEmail());
InvoicePayments::deleteByInvoice($this);
$this->setTimeRecordsStatus(BILLABLE_STATUS_BILLABLE);
$this->releaseTimeRecords();
break;
default:
return new InvalidParamError('status', $status, '$status is not valid invoice status', true);
}
// switch
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:72,代码来源:Invoice.class.php
示例20: set_ad_images
function set_ad_images($images, $ad)
{
foreach ($images as $image) {
$this->get_db()->update('ad_image', array("ad_id" => $ad), array("image_name" => $image, "user_id" => unserialize(get_logged_user())->user_id));
}
}
开发者ID:caina,项目名称:pando,代码行数:6,代码来源:ad_image_model.php
注:本文中的get_logged_user函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论