当前位置: 首页>>代码示例>>PHP>>正文


PHP user_has_role函数代码示例

本文整理汇总了PHP中user_has_role函数的典型用法代码示例。如果您正苦于以下问题:PHP user_has_role函数的具体用法?PHP user_has_role怎么用?PHP user_has_role使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了user_has_role函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的user_has_role函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。