本文整理汇总了PHP中user_has_role函数的典型用法代码示例。如果您正苦于以下问题:PHP user_has_role函数的具体用法?PHP user_has_role怎么用?PHP user_has_role使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了user_has_role函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: user_area_sat_access
function user_area_sat_access($area_id, $sattelite_id, $user)
{
$area_access = FALSE;
$sat_access = FALSE;
if (user_has_role('Webmaster National', $user)) {
return TRUE;
}
if (!empty($user->field_area['und'])) {
foreach ($user->field_area['und'] as $value) {
if ($value['tid'] == $area_id) {
$area_access = TRUE;
break;
}
}
}
if (!empty($user->field_satellite['und'])) {
foreach ($user->field_satellite['und'] as $value) {
if ($value['tid'] == $sattelite_id) {
$sat_access = TRUE;
break;
}
}
}
if ($area_access || $sat_access) {
return TRUE;
} else {
return FALSE;
}
}
开发者ID:singhneeraj,项目名称:fr-store,代码行数:29,代码来源:user-api.php
示例2: basukebu_preprocess_page
/**
* @file
* The primary PHP file for this theme.
*/
function basukebu_preprocess_page(&$variables)
{
$js_path = drupal_get_path('theme', 'basukebu') . '/js/';
if (user_has_role(IS_AUTH_USER)) {
drupal_add_js($js_path . 'basukebu.sticky_header.js');
}
}
开发者ID:sutekicut,项目名称:BASUKEBU,代码行数:11,代码来源:template.php
示例3: threadall
function threadall($lang)
{
global $system_languages, $with_toolbar;
if (!user_has_role('writer')) {
return run('error/unauthorized', $lang);
}
$slang = false;
if (isset($_GET['slang'])) {
$slang = $_GET['slang'];
} else {
$slang = $lang;
}
if (!in_array($slang, $system_languages)) {
return run('error/notfound', $lang);
}
$site_title = translate('title', $lang);
$site_abstract = translate('description', $lang);
$site_cloud = translate('keywords', $lang);
head('title', translate('threadall:title', $slang));
head('description', false);
head('keywords', false);
head('robots', 'noindex, nofollow');
$edit = user_has_role('writer') ? url('threadedit', $_SESSION['user']['locale']) . '?' . 'clang=' . $lang : false;
$banner = build('banner', $lang, $with_toolbar ? false : compact('edit'));
$scroll = true;
$toolbar = $with_toolbar ? build('toolbar', $lang, compact('edit', 'scroll')) : false;
$threadlist = build('threadlist', $lang, false, false, $slang);
$content = view('threadall', $slang, compact('site_title', 'site_abstract', 'site_cloud', 'threadlist'));
$output = layout('viewing', compact('toolbar', 'banner', 'content'));
return $output;
}
开发者ID:RazorMarx,项目名称:izend,代码行数:31,代码来源:threadall.php
示例4: adminuser
function adminuser($lang, $arglist = false)
{
if (!user_has_role('administrator')) {
return run('error/unauthorized', $lang);
}
$user_id = false;
if (is_array($arglist)) {
if (isset($arglist[0])) {
$user_id = $arglist[0];
}
}
if (!$user_id) {
return run('error/notfound', $lang);
}
$user_id = user_id($user_id);
if (!$user_id) {
return run('error/notfound', $lang);
}
$useredit = build('useredit', $lang, $user_id);
if ($useredit === false) {
return redirect('admin', $lang);
}
head('title', translate('admin:title', $lang));
head('description', false);
head('keywords', false);
head('robots', 'noindex, nofollow');
$admin = true;
$banner = build('banner', $lang, compact('admin'));
$content = view('adminuser', $lang, compact('useredit'));
$output = layout('standard', compact('banner', 'content'));
return $output;
}
开发者ID:RazorMarx,项目名称:izend,代码行数:32,代码来源:adminuser.php
示例5: threadsummary
function threadsummary($lang, $thread)
{
global $system_languages, $with_toolbar;
if (!user_has_role('writer')) {
return run('error/unauthorized', $lang);
}
$slang = false;
if (isset($_GET['slang'])) {
$slang = $_GET['slang'];
} else {
$slang = $lang;
}
if (!in_array($slang, $system_languages)) {
return run('error/notfound', $lang);
}
$thread_id = thread_id($thread);
if (!$thread_id) {
return run('error/notfound', $lang);
}
$r = thread_get($lang, $thread_id);
if (!$r) {
return run('error/notfound', $lang);
}
extract($r);
/* thread_name thread_title thread_type thread_abstract thread_cloud thread_image thread_visits thread_nosearch thread_nocloud thread_nocomment thread_nomorecomment thread_novote thread_nomorevote thread_created thread_modified */
$thread_search = !$thread_nosearch;
$thread_tag = !$thread_nocloud;
$thread_comment = !$thread_nocomment;
$thread_morecomment = !$thread_nomorecomment;
$thread_vote = !$thread_novote;
$thread_morevote = !$thread_nomorevote;
$thread_contents = array();
$r = thread_get_contents($lang, $thread_id, false);
if ($r) {
$thread_url = url('thread', $lang) . '/' . $thread_id;
foreach ($r as $c) {
extract($c);
/* node_id node_name node_title node_number node_ignored */
$node_url = $thread_url . '/' . $node_id . '?' . 'slang=' . $slang;
$thread_contents[] = compact('node_id', 'node_title', 'node_url', 'node_ignored');
}
}
$headline_text = translate('threadall:title', $slang);
$headline_url = url('thread', $lang) . '?' . 'slang=' . $slang;
$headline = compact('headline_text', 'headline_url');
$title = view('headline', false, $headline);
$sidebar = view('sidebar', false, compact('title'));
head('title', $thread_title ? $thread_title : $thread_id);
head('description', $thread_abstract);
head('keywords', $thread_cloud);
head('robots', 'noindex, nofollow');
$edit = user_has_role('writer') ? url('threadedit', $_SESSION['user']['locale']) . '/' . $thread_id . '?' . 'clang=' . $lang : false;
$banner = build('banner', $lang, $with_toolbar ? compact('headline') : compact('headline', 'edit'));
$scroll = true;
$toolbar = $with_toolbar ? build('toolbar', $lang, compact('edit', 'scroll')) : false;
$content = view('threadsummary', $slang, compact('thread_id', 'thread_title', 'thread_abstract', 'thread_cloud', 'thread_image', 'thread_visits', 'thread_search', 'thread_tag', 'thread_comment', 'thread_morecomment', 'thread_vote', 'thread_morevote', 'thread_ilike', 'thread_tweet', 'thread_plusone', 'thread_linkedin', 'thread_pinit', 'thread_created', 'thread_modified', 'thread_contents'));
$output = layout('viewing', compact('toolbar', 'banner', 'content', 'sidebar'));
return $output;
}
开发者ID:RazorMarx,项目名称:izend,代码行数:59,代码来源:threadsummary.php
示例6: skip_stage_conditions
public function skip_stage_conditions($assignment_id, $next_stage_to_check)
{
$ci = get_instance();
$is_technician = user_has_role($ci->session->userdata('user_id'), 'Technician');
if (!$is_technician) {
return false;
}
return $next_stage_to_check->senior_technician_only && !$this->is_senior_technician($this->current_param);
}
开发者ID:nicolasconnault,项目名称:streamliner,代码行数:9,代码来源:Miniant_Workflow_manager.php
示例7: suggest
function suggest($lang, $arglist = false)
{
global $search_all, $rss_thread;
$cloud = false;
if (is_array($arglist)) {
if (isset($arglist[0])) {
$cloud = $arglist[0];
}
}
$cloud_id = false;
if ($cloud) {
$cloud_id = cloud_id($cloud);
if (!$cloud_id) {
header('HTTP/1.1 404 Not Found');
return false;
}
if ($cloud_id == $rss_thread) {
if (!user_has_role('administrator')) {
header('HTTP/1.1 401 Unauthorized');
return false;
}
}
$r = thread_get($lang, $cloud_id);
if (!$r) {
header('HTTP/1.1 404 Not Found');
return false;
}
extract($r);
/* thread_type thread_nosearch */
if ($thread_type == 'thread' or $thread_nosearch) {
header('HTTP/1.1 404 Not Found');
return false;
}
} else {
if ($search_all !== true) {
header('HTTP/1.1 404 Not Found');
return false;
}
}
$term = isset($arglist['term']) ? $arglist['term'] : false;
if (!$term) {
header('HTTP/1.1 400 Bad Request');
return false;
}
$r = cloud_suggest($lang, $cloud_id, $term);
if (!$r) {
header('HTTP/1.1 404 Not Found');
return false;
}
$taglist = array();
foreach ($r as $tag) {
$taglist[] = $tag['tag_name'];
}
return json_encode($taglist);
}
开发者ID:RazorMarx,项目名称:izend,代码行数:55,代码来源:suggest.php
示例8: editnode
function editnode($lang, $arglist = false)
{
global $supported_languages, $supported_contents, $with_toolbar;
if (!user_has_role('writer')) {
return run('error/unauthorized', $lang);
}
$node = false;
if (is_array($arglist)) {
if (isset($arglist[0])) {
$node = $arglist[0];
}
}
if (!$node) {
return run('error/notfound', $lang);
}
$node_id = node_id($node);
if (!$node_id) {
return run('error/notfound', $lang);
}
$clang = false;
foreach ($supported_languages as $slang) {
if (isset($_POST[$slang])) {
$clang = $slang;
break;
}
}
if (!$clang) {
if (isset($_POST['clang'])) {
$clang = $_POST['clang'];
} else {
if (isset($_GET['clang'])) {
$clang = $_GET['clang'];
} else {
$clang = $lang;
}
}
if (!in_array($clang, $supported_languages)) {
return run('error/notfound', $lang);
}
}
$node_editor = build('nodeeditor', $lang, $clang, $node_id, $supported_contents);
head('title', $node_id);
head('description', false);
head('keywords', false);
head('robots', 'noindex, nofollow');
$view = url('node', $clang) . '/' . $node_id . '?' . 'slang=' . $lang;
$banner = build('banner', $lang, $with_toolbar ? false : compact('view'));
$scroll = true;
$toolbar = $with_toolbar ? build('toolbar', $lang, compact('view', 'scroll')) : false;
$content = view('editing/editnode', $lang, compact('node_editor'));
$output = layout('editing', compact('toolbar', 'banner', 'content'));
return $output;
}
开发者ID:RazorMarx,项目名称:izend,代码行数:53,代码来源:editnode.php
示例9: foldersummary
function foldersummary($lang, $folder)
{
global $with_toolbar;
$folder_id = thread_id($folder);
if (!$folder_id) {
return run('error/notfound', $lang);
}
$r = thread_get($lang, $folder_id);
if (!$r) {
return run('error/notfound', $lang);
}
extract($r);
/* thread_type thread_name thread_title thread_abstract thread_cloud */
if ($thread_type != 'folder') {
return run('error/notfound', $lang);
}
$folder_name = $thread_name;
$folder_title = $thread_title;
$folder_abstract = $thread_abstract;
$folder_cloud = $thread_cloud;
if ($folder_title) {
head('title', $folder_title);
}
if ($folder_abstract) {
head('description', $folder_abstract);
}
if ($folder_cloud) {
head('keywords', $folder_cloud);
}
$folder_contents = array();
$r = thread_get_contents($lang, $folder_id);
if ($r) {
$folder_url = url('folder', $lang) . '/' . $folder_name;
foreach ($r as $c) {
extract($c);
/* node_name node_title */
if (!$node_title) {
continue;
}
$page_title = $node_title;
$page_url = $folder_url . '/' . $node_name;
$folder_contents[] = compact('page_title', 'page_url');
}
}
$content = view('foldersummary', false, compact('folder_id', 'folder_title', 'folder_contents'));
$edit = user_has_role('writer') ? url('folderedit', $_SESSION['user']['locale']) . '/' . $folder_id . '?' . 'clang=' . $lang : false;
$validate = url('folder', $lang) . '/' . $folder_name;
$banner = build('banner', $lang, $with_toolbar ? false : compact('edit', 'validate'));
$toolbar = $with_toolbar ? build('toolbar', $lang, compact('edit', 'validate')) : false;
$output = layout('standard', compact('toolbar', 'banner', 'content'));
return $output;
}
开发者ID:RazorMarx,项目名称:izend,代码行数:52,代码来源:foldersummary.php
示例10: bookall
function bookall($lang)
{
global $with_toolbar;
head('title', translate('bookall:title', $lang));
$edit = user_has_role('writer') ? url('bookedit', $_SESSION['user']['locale']) . '?' . 'clang=' . $lang : false;
$validate = url('book', $lang);
$banner = build('banner', $lang, $with_toolbar ? false : compact('edit', 'validate'));
$toolbar = $with_toolbar ? build('toolbar', $lang, compact('edit', 'validate')) : false;
$booklist = build('threadlist', $lang, 'book');
$content = view('bookall', $lang, compact('booklist'));
$output = layout('standard', compact('toolbar', 'banner', 'content'));
return $output;
}
开发者ID:RazorMarx,项目名称:izend,代码行数:13,代码来源:bookall.php
示例11: node
function node($lang, $arglist = false)
{
global $system_languages, $with_toolbar;
if (!user_has_role('writer')) {
return run('error/unauthorized', $lang);
}
$slang = false;
if (isset($_GET['slang'])) {
$slang = $_GET['slang'];
} else {
$slang = $lang;
}
if (!in_array($slang, $system_languages)) {
return run('error/notfound', $lang);
}
$node = false;
if (is_array($arglist)) {
if (isset($arglist[0])) {
$node = $arglist[0];
}
}
if (!$node) {
return run('error/notfound', $lang);
}
$node_id = node_id($node);
if (!$node_id) {
return run('error/notfound', $lang);
}
$r = node_get($lang, $node_id);
if (!$r) {
return run('error/notfound', $lang);
}
extract($r);
/* node_number node_ignored node_name node_title node_abstract node_cloud node_image node_visits node_nocomment node_nomorecomment node_ilike node_tweet node_plusone node_linkedin node_pinit */
$node_comment = !$node_nocomment;
$node_morecomment = !$node_nomorecomment;
$node_vote = !$node_novote;
$node_morevote = !$node_nomorevote;
head('title', $node_id);
head('description', $node_abstract);
head('keywords', $node_cloud);
head('robots', 'noindex, nofollow');
$edit = user_has_role('writer') ? url('editnode', $_SESSION['user']['locale']) . '/' . $node_id . '?' . 'clang=' . $lang : false;
$banner = build('banner', $lang, $with_toolbar ? compact('headline') : compact('headline', 'edit'));
$scroll = true;
$toolbar = $with_toolbar ? build('toolbar', $lang, compact('edit', 'scroll')) : false;
$node_contents = build('nodecontent', $lang, $node_id);
$content = view('node', $slang, compact('node_id', 'node_name', 'node_title', 'node_abstract', 'node_cloud', 'node_image', 'node_created', 'node_modified', 'node_comment', 'node_morecomment', 'node_vote', 'node_morevote', 'node_ilike', 'node_tweet', 'node_plusone', 'node_linkedin', 'node_pinit', 'node_contents'));
$output = layout('standard', compact('toolbar', 'banner', 'content'));
return $output;
}
开发者ID:RazorMarx,项目名称:izend,代码行数:51,代码来源:node.php
示例12: index
public function index($assignment_id)
{
$this->load->model('miniant/diagnostic_tree_model');
require_capability('servicequotes:writesqs');
$technician_id = parent::get_technician_id($assignment_id);
$is_technician = user_has_role($this->session->userdata('user_id'), 'Technician');
$this->assignment = $this->assignment_model->get($assignment_id);
if (empty($this->assignment)) {
add_message('This job is no longer on record.', 'warning');
redirect(base_url());
}
$order = (object) $this->order_model->get_values($this->assignment->order_id);
$order_type = $this->order_model->get_type_string($order->order_type_id);
parent::update_time($order->id);
$this->load->library('Miniant_Workflow_manager', array(), 'workflow_manager');
$this->workflow_manager->initialise(array('workflow' => $order_type, 'stage' => 'required_parts', 'param' => $this->assignment->id, 'module' => 'miniant'));
if ($technician_id == $order->senior_technician_id) {
$units = $this->assignment_model->get_units($assignment_id);
} else {
$units = $this->assignment_model->get_units($assignment_id, $technician_id);
}
$diagnostic_estimate_tree = $this->diagnostic_tree_model->get_estimate_tree($assignment_id);
$estimated_time = $this->diagnostic_tree_model->get_estimate_time($diagnostic_estimate_tree);
// We no longer ask the technician to estimate the labour, it is done entirely by the system based on diagnostic rules
$this->diagnostic_model->edit($this->assignment->diagnostic_id, array('estimated_time' => $estimated_time));
// Create SQ if none for this job/unit yet
$sq = $this->servicequote_model->get(array('order_id' => $order->id, 'diagnostic_id' => $this->assignment->diagnostic_id), true);
if (empty($sq->id)) {
$sq_id = $this->servicequote_model->create_from_diagnostic($this->assignment->diagnostic_id);
} else {
$sq_id = $sq->id;
}
// Replace required_parts (loaded from step_parts table) with actual parts (from parts table)
foreach ($units as $key => $unit) {
$units[$key]->assignment = (object) $this->assignment_model->get_values($units[$key]->assignment_id);
$units[$key]->diagnostic = (object) $this->diagnostic_model->get_values($units[$key]->assignment->diagnostic_id);
// Only provide the SQ ID if this stage has been completed
if ($this->assignment_model->has_statuses($units[$key]->assignment_id, array('REQUIRED PARTS RECORDED'))) {
$units[$key]->required_parts = $this->diagnostic_model->get_required_parts($units[$key]->assignment->diagnostic_id, $sq_id);
} else {
$units[$key]->required_parts = $this->diagnostic_model->get_required_parts($units[$key]->assignment->diagnostic_id);
}
foreach ($units[$key]->required_parts as $part_key => $part) {
form_element::$default_data["part_model_number[{$part->id}]"] = $part->part_number;
}
}
$parts_title_options = array('title' => '', 'help' => 'Record the parts required this SQ', 'icons' => array());
$info_title_options = array('title' => 'Unit info', 'help' => 'Information', 'icons' => array());
$this->load_stage_view(array('units' => $units, 'parts_title_options' => $parts_title_options, 'info_title_options' => $info_title_options, 'diagnostic_id' => $this->assignment->diagnostic_id, 'is_technician' => $is_technician, 'sq_id' => $sq_id));
}
开发者ID:nicolasconnault,项目名称:streamliner,代码行数:50,代码来源:Required_parts.php
示例13: process
public function process()
{
$assignment_id = $this->input->post('assignment_id');
$order_id = $this->input->post('order_id');
$assignment = $this->assignment_model->get($assignment_id);
$order = $this->order_model->get($order_id);
$order_type = $this->order_model->get_type_string($order->order_type_id);
$this->load->library('Miniant_Workflow_manager', array(), 'workflow_manager');
$this->workflow_manager->initialise(array('workflow' => $order_type, 'stage' => 'office_notes', 'param' => $assignment_id, 'module' => 'miniant'));
if (user_has_role($this->session->userdata('user_id'), 'Technician')) {
trigger_event('office_notes_sighted', 'order', $order_id, false, 'miniant');
}
redirect($this->workflow_manager->get_next_url());
}
开发者ID:nicolasconnault,项目名称:streamliner,代码行数:14,代码来源:Office_notes.php
示例14: footer
function footer($lang, $components = false)
{
$languages = false;
$contact_page = $newsletter_page = $user_page = $nobody_page = $account_page = $admin_page = false;
$is_identified = user_is_identified();
$is_admin = user_has_role('administrator');
$nobody_page = $is_identified ? url('nobody', $lang) : false;
if ($components) {
foreach ($components as $v => $param) {
switch ($v) {
case 'languages':
if ($param) {
$languages = build('languages', $lang, $param);
}
break;
case 'contact':
if ($param) {
$contact_page = url('contact', $lang);
}
break;
case 'newsletter':
if ($param) {
$newsletter_page = url('newslettersubscribe', $lang);
}
break;
case 'account':
if ($param) {
if ($is_identified) {
if (!$is_admin) {
$account_page = url('account', $lang);
}
} else {
$user_page = url('user', $lang);
}
}
break;
case 'admin':
if ($param) {
$admin_page = $is_admin ? url('admin', $lang) : false;
}
break;
default:
break;
}
}
}
$output = view('footer', $lang, compact('languages', 'contact_page', 'newsletter_page', 'user_page', 'nobody_page', 'account_page', 'admin_page'));
return $output;
}
开发者ID:RazorMarx,项目名称:izend,代码行数:49,代码来源:footer.php
示例15: toolbar
function toolbar($lang, $components = false)
{
$scroll = $nobody_page = $edit_page = $view_page = $validate_page = $admin_page = false;
$is_identified = user_is_identified();
$is_admin = user_has_role('administrator');
$is_writer = user_has_role('writer');
if ($components) {
foreach ($components as $v => $param) {
switch ($v) {
case 'scroll':
$scroll = $param ? true : false;
break;
case 'edit':
if ($param) {
if ($is_writer) {
$edit_page = $param;
}
}
break;
case 'view':
if ($param) {
if ($is_writer) {
$view_page = $param;
}
}
break;
case 'validate':
if ($param) {
if ($is_writer) {
$validate_page = $param;
}
}
break;
case 'admin':
if ($param) {
if ($is_admin) {
$admin_page = url('admin', $lang);
}
}
break;
default:
break;
}
}
}
$output = view('toolbar', $lang, compact('scroll', 'nobody_page', 'edit_page', 'view_page', 'validate_page', 'admin_page'));
return $output;
}
开发者ID:RazorMarx,项目名称:izend,代码行数:48,代码来源:toolbar.php
示例16: index
public function index($assignment_id)
{
$this->assignment = $this->assignment_model->get_values($assignment_id);
if (empty($this->assignment)) {
add_message('This job is no longer on record.', 'warning');
redirect(base_url());
}
$order = (object) $this->order_model->get_values($this->assignment->order_id);
$order_type = $this->order_model->get_type_string($order->order_type_id);
$this->load->library('Miniant_Workflow_manager', array(), 'workflow_manager');
$this->workflow_manager->initialise(array('workflow' => $order_type, 'stage' => 'assignment_details', 'param' => $assignment_id, 'module' => 'miniant'));
$next_page_url = $this->workflow_manager->get_next_url();
parent::update_time($order->id);
$technician_id = parent::get_technician_id($assignment_id);
$order_technician = $this->order_technician_model->get(array('order_id' => $order->id, 'technician_id' => $technician_id), true);
$is_technician = user_has_role($this->session->userdata('user_id'), 'Technician');
$order_technician_id = @$order_technician->id;
$units = $this->get_units($assignment_id, $technician_id, $order->senior_technician_id);
$notes = $this->message_model->get_with_author_names(array('document_type' => 'order', 'document_id' => $order->id));
$equipment_type = null;
$equipment_types = array();
foreach ($units as $key => $unit) {
$units[$key]->notes = $this->message_model->get_with_author_names(array('document_type' => 'assignment', 'document_id' => $assignment_id));
if (is_null($equipment_type)) {
$equipment_type = $this->unit_model->get_type_string($unit->unit_type_id);
}
if (!in_array($unit->unit_type_id, $equipment_types)) {
$equipment_types[] = $unit->unit_type_id;
}
}
if (count($equipment_types) > 1) {
$equipment_type = 'Mixed';
}
$this->load->library('Dialog');
$this->dialog->initialise(array('min_interval_between_answers' => 300));
if ($is_technician) {
$this->dialog->add_question(array('id' => 'ready_to_travel', 'shown' => !$this->order_technician_model->has_statuses($order_technician_id, array('STARTED TRAVEL')), 'text' => 'Are you ready to travel to the job?', 'answers' => array(array('text' => 'Yes', 'ids_to_show' => array('ready_to_start'), 'triggers' => array(array('system' => 'order_technician', 'document_id' => $order_technician_id, 'event_name' => 'leaving', 'module' => 'miniant'))))));
$this->dialog->add_question(array('id' => 'continue', 'shown' => $this->order_technician_model->has_statuses($order_technician_id, array('STARTED')), 'text' => 'This job is currently in progress', 'answers' => array(array('text' => 'Continue this job', 'url' => $next_page_url))));
$question_text = $order_type == 'Installation' ? 'Are you ready to start the installation?' : 'Are you ready to start the diagnostic?';
$this->dialog->add_question(array('id' => 'ready_to_start', 'shown' => !$this->order_technician_model->has_statuses($order_technician_id, array('STARTED')) && $this->order_technician_model->has_statuses($order_technician_id, array('STARTED TRAVEL')), 'text' => $question_text, 'answers' => array(array('text' => 'Yes', 'triggers' => array(array('system' => 'order_technician', 'document_id' => $order_technician_id, 'event_name' => 'start', 'module' => 'miniant'), array('system' => 'order', 'document_id' => $order->id, 'event_name' => 'start', 'module' => 'miniant')), 'url' => $next_page_url, 'short_interval_js' => '$("#did_you_forget").show();return false;'))));
$this->dialog->add_question(array('id' => 'did_you_forget', 'shown' => false, 'text' => 'Did you forget to click the "Are you ready to travel" button before you left?', 'answers' => array(array('text' => 'Yes', 'undo' => false, 'ids_to_show' => array('time_estimate')), array('text' => 'No', 'triggers' => array(array('system' => 'order_technician', 'document_id' => $order_technician_id, 'event_name' => 'start', 'module' => 'miniant'), array('system' => 'order', 'document_id' => $order->id, 'event_name' => 'start', 'module' => 'miniant')), 'url' => $next_page_url))));
$this->dialog->add_question(array('id' => 'time_estimate', 'shown' => false, 'text' => 'Estimate how long it took you to travel', 'answers' => array(array('text' => 'Travel time', 'type' => 'dropdown', 'options' => array(0 => '-- Select One --', 900 => '15 minutes', 1800 => '30 minutes', 2700 => '45 minutes', 3600 => '1 hour', 4500 => '1 hour 15 minutes', 5400 => '1 hour 30 minutes', 6300 => '1 hour 45 minutes', 7200 => '2 hours', 8100 => '2 hours 15 minutes', 9000 => '2 hours 30 minutes', 9900 => '2 hours 45 minutes', 10800 => '3 hours', 11700 => '3 hours 15 minutes', 12600 => '3 hours 30 minutes', 13500 => '3 hours 45 minutes', 14400 => '4 hours', 15300 => '4 hours 15 minutes', 16200 => '4 hours 30 minutes', 17100 => '4 hours 45 minutes', 18000 => '5 hours'), 'ajax_callback' => 'miniant/stages/assignment_details/add_travel_time/' . $assignment_id, 'ajax_position' => 'end', 'ajax_data' => array('assignment_id' => $assignment_id), 'triggers' => array(array('system' => 'order_technician', 'document_id' => $order_technician_id, 'event_name' => 'start', 'module' => 'miniant')), 'url' => $next_page_url))));
} else {
$this->dialog->add_question(array('id' => 'review', 'shown' => true, 'text' => ' ', 'answers' => array(array('text' => 'Review this job', 'url' => $next_page_url))));
}
$this->load_stage_view(array('units' => $units, 'notes' => $notes, 'dialog' => $this->dialog->output(), 'equipment_type' => $equipment_type));
}
开发者ID:nicolasconnault,项目名称:streamliner,代码行数:47,代码来源:Assignment_details.php
示例17: threadedit
function threadedit($lang, $arglist = false)
{
global $supported_languages;
if (!user_has_role('writer')) {
return run('error/unauthorized', $lang);
}
$thread = $node = false;
if (is_array($arglist)) {
if (isset($arglist[0])) {
$thread = $arglist[0];
}
if (isset($arglist[1])) {
$node = $arglist[1];
}
}
$clang = false;
foreach ($supported_languages as $slang) {
if (isset($_POST[$slang])) {
$clang = $slang;
break;
}
}
if (!$clang) {
if (isset($_POST['clang'])) {
$clang = $_POST['clang'];
} else {
if (isset($_GET['clang'])) {
$clang = $_GET['clang'];
} else {
$clang = $lang;
}
}
if (!in_array($clang, $supported_languages)) {
return run('error/notfound', $lang);
}
}
if (!$thread) {
require_once 'actions/threadeditall.php';
return threadeditall($lang, $clang);
}
if (!$node) {
require_once 'actions/threadeditsummary.php';
return threadeditsummary($lang, $clang, $thread);
}
require_once 'actions/threadeditnode.php';
return threadeditnode($lang, $clang, $thread, $node);
}
开发者ID:RazorMarx,项目名称:izend,代码行数:47,代码来源:threadedit.php
示例18: getListeUser
/**
* (non-PHPdoc)
* @see AbstractCallback::getListeUser()
*
* Fonction pour récupérer Le référent (et Directeur si différent)
* de l’ADEFIM rattachée
*
*/
public function getListeUser() {
$users = array();
$id_entreprises = $this->param->id_entreprises;
db_set_active(@DB_EXTRANET);
$query = db_select('user_entreprise', 'ue');
$query->join('lien_user_entreprise_ref_esclave_entreprise', 'luee', 'luee.id_user_entreprise = ue.id');
$query->join('drupal_user', 'du', 'ue.id_drupal_user = du.id');
$query->fields('du', array('id_user_drupal'));
$query->condition('luee.est_actif' , 1, '=');
//filtre par entreprise
$query->condition('luee.id_ref_esclave_entreprise', $id_entreprises, 'IN');
$results = $query->execute()->fetchAll();
db_set_active();
foreach ($results as $result) {
//chercher si l'utilisateur existe dans drupal
$user = user_load($result->id_user_drupal);
if ($user != false) {
// Vérifier si l'utilisateur est ADMIN ENTREPISE (role 5)
// @todo RESPONSABLE ENTREPISE
if (user_has_role(5,$user)) {
$users[] = $user->uid;
}
}
}
// Supprimer les doublons si plusieurs entreprises
$users = array_unique($users);
return $users;
}
开发者ID:HamzaBendidane,项目名称:prel,代码行数:49,代码来源:AdminResponsableEtp.php
示例19: validateInvitedFreelancers
function validateInvitedFreelancers($form, $form_state)
{
if (!isset($form['field_freelancers_to_invite'])) {
form_set_error('field_freelancers_to_invite', 'Please enter at least one Creative Pro to invite');
}
//debugLong($form_state['values']['field_freelancers_to_invite'], '_validate_freelancers_to_invite');
$freelancers_to_invite = explode(',', $form_state['values']['field_freelancers_to_invite']);
//debugLong($freelancers_to_invite, '_validate_freelancers_to_invite_exploded');
if (empty($freelancers_to_invite[0])) {
form_set_error('field_freelancers_to_invite', 'Enter at least one Creative Pro');
}
$invalid = array();
$notApproved = array();
foreach ($freelancers_to_invite as $name) {
$f = user_load_by_name(trim($name));
if ($f == false) {
array_push($invalid, $name);
} else {
if (!user_has_role(8, $f)) {
array_push($notApproved, $name);
}
}
}
if (!empty($invalid)) {
$invalidInStr = implode(', ', $invalid);
$errorMessage = 'Not creative pros: ' . $invalidInStr;
}
if (!empty($notApproved)) {
$notApprovedInStr = implode(', ', $notApproved);
if (isset($errorMessage)) {
$errorMessage .= "<br>Freelancers not yet approved by Tap: " . $notApprovedInStr;
} else {
$errorMessage = "Freelancers not yet approved by Tap: " . $notApprovedInStr;
}
}
if (!empty($errorMessage)) {
form_set_error('field_freelancers_to_invite', $errorMessage);
}
$trimmed = array_map('trim', $freelancers_to_invite);
$form_state['values']['field_freelancers_to_invite'] = implode(',', $trimmed);
}
开发者ID:JohnRafols,项目名称:tapWebsite,代码行数:41,代码来源:jobHelperFunctions.php
示例20: index
public function index($assignment_id)
{
$this->assignment = $this->assignment_model->get_values($assignment_id);
if (empty($this->assignment)) {
add_message('This job is no longer on record.', 'warning');
redirect(base_url());
}
$order = (object) $this->order_model->get_values($this->assignment->order_id);
$order_type = $this->order_model->get_type_string($order->order_type_id);
$this->load->library('Miniant_Workflow_manager', array(), 'workflow_manager');
$this->workflow_manager->initialise(array('workflow' => $order_type, 'stage' => 'unit_serial', 'param' => $assignment_id, 'module' => 'miniant'));
$technician_id = parent::get_technician_id($assignment_id);
$is_technician = user_has_role($this->session->userdata('user_id'), 'Technician');
parent::update_time($order->id);
$order_technician = $this->order_technician_model->get(array('order_id' => $order->id, 'technician_id' => $technician_id), true);
if ($is_technician) {
trigger_event('start', 'order_technician', $order_technician->id, false, 'miniant');
}
$next_page_url = $this->workflow_manager->get_next_url();
$order_technician = $this->order_technician_model->get(array('order_id' => $order->id, 'technician_id' => $technician_id), true);
$units = $this->get_units($assignment_id, $technician_id, $order->senior_technician_id);
$this->load_stage_view(array('units' => $units));
}
开发者ID:nicolasconnault,项目名称:streamliner,代码行数:23,代码来源:Unit_serial.php
注:本文中的user_has_role函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论