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


PHP module_security::can_user方法代码示例

本文整理汇总了PHP中module_security::can_user方法的典型用法代码示例。如果您正苦于以下问题:PHP module_security::can_user方法的具体用法?PHP module_security::can_user怎么用?PHP module_security::can_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在module_security的用法示例。


在下文中一共展示了module_security::can_user方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _l

    echo _l($link['name']);
    ?>
				</a>
			</li>
		<?php 
}
unset($menu_holder);
unset($menu_type);
unset($current_link);
unset($menu_allow_nesting);
?>
        <?php 
if (isset($show_quick_search) && $show_quick_search) {
    ?>
        <?php 
    if (module_security::getcred() && module_security::can_user(module_security::get_loggedin_id(), 'Show Quick Search') && $display_mode != 'mobile') {
        if (module_config::c('global_search_focus', 1) == 1) {
            module_form::set_default_field('ajax_search_text');
        }
        ?>
            <li>
                <div id="quick_search_box">
                    <div id="quick_search_placeholder"><div><?php 
        _e('Quick Search:');
        ?>
</div></div>
                    <input type="text" name="quick_search" id="ajax_search_text" size="10" value="">
                    <div id="ajax_search_result"></div>
                </div>
            </li>
         <?php 
开发者ID:sgh1986915,项目名称:php-crm,代码行数:31,代码来源:design_menu.php

示例2: save_file_comments

 function save_file_comments($file_id)
 {
     if (isset($_REQUEST['new_comment_text']) && strlen($_REQUEST['new_comment_text'])) {
         $file_data = $this->get_file($file_id);
         $item_data = array("file_id" => $file_id, "create_user_id" => module_security::get_loggedin_id(), "comment" => $_REQUEST['new_comment_text']);
         update_insert("file_comment_id", "new", "file_comment", $item_data);
         $file_data['comment'] = $_REQUEST['new_comment_text'];
         // do we schedule an alert for this file upload?
         if (module_security::can_user(module_security::get_loggedin_id(), _FILE_COMMENT_ALERT_STRING)) {
             // the current user is one who receives file alerts.
             // so for now we don't schedule this alert.
             // hmm - this might not work with a team environment, we'll send alerts no matter what :)
         }
         $alert_users = module_user::get_users_by_permission(array('category' => _LABEL_USER_SPECIFIC, 'name' => _FILE_COMMENT_ALERT_STRING, 'module' => 'config', 'view' => 1));
         if (count($file_data['staff_ids'])) {
             foreach ($alert_users as $user_id => $alert_user) {
                 if (!in_array($user_id, $file_data['staff_ids'])) {
                     // this user has permissions to receive alerts, but they're not assigned.
                     unset($alert_users[$user_id]);
                 }
             }
         } else {
             if (isset($alert_users[1])) {
                 unset($alert_users[1]);
                 // skip admin for now until we can control that option
             }
         }
         // dont set a notification to ourselves.
         if (isset($alert_users[module_security::get_loggedin_id()])) {
             unset($alert_users[module_security::get_loggedin_id()]);
         }
         $file_data['customer_name'] = '';
         $file_data['customer_link'] = '';
         if (isset($file_data['customer_id']) && $file_data['customer_id']) {
             $customer_data = module_customer::get_customer($file_data['customer_id']);
             $file_data['customer_name'] = $customer_data['customer_name'];
             $file_data['customer_link'] = module_customer::link_open($file_data['customer_id']);
         }
         $file_data['file_link'] = self::link_open($file_id);
         foreach ($alert_users as $alert_user) {
             if (isset($alert_user['customer_id']) && $alert_user['customer_id'] > 0) {
                 // only send this user an alert of the file is from this customer account.
                 if (!isset($file_data['customer_id']) || $file_data['customer_id'] != $alert_user['customer_id']) {
                     continue;
                     // skip this user
                 }
             }
             $notification_data = array('email_id' => 0, 'view_time' => 0, 'notification_type' => _FILE_NOTIFICATION_TYPE_COMMENTED, 'file_id' => $file_id, 'user_id' => $alert_user['user_id']);
             $template = module_template::get_template_by_key('file_comment_alert_email');
             $template->assign_values($file_data);
             $html = $template->render('html');
             // send an email to this user.
             $email = module_email::new_email();
             $email->file_id = $file_id;
             $email->replace_values = $file_data;
             $email->set_to('user', $alert_user['user_id']);
             $email->set_from('user', module_security::get_loggedin_id());
             $email->set_subject($template->description);
             // do we send images inline?
             $email->set_html($html);
             if ($email->send()) {
                 // it worked successfully!!
                 // sweet.
                 $notification_data['email_id'] = $email->email_id;
             } else {
                 /// log err?
                 set_error('Failed to send notification email to user id ' . $alert_users['user_id']);
             }
             update_insert('file_notification_id', 'new', 'file_notification', $notification_data);
         }
     }
 }
开发者ID:sgh1986915,项目名称:php-crm,代码行数:72,代码来源:file.php

示例3: htmlspecialchars

$template->assign_values(array('user_name' => htmlspecialchars($_SESSION['_user_name']), 'system_name' => htmlspecialchars(module_config::s('admin_system_name'))));
$widget_sort_json = @json_decode(module_config::c('dash_widgets_sort_' . module_security::get_loggedin_id()), true);
if (!is_array($widget_sort_json)) {
    $widget_sort_json = array();
}
$widget_sort_order = array();
$widget_sort_page_order = 1;
foreach ($widget_sort_json as $id => $vals) {
    $bits = explode('|', $vals);
    if (count($bits) == 3) {
        $widget_sort_order[$bits[2]] = array('column' => $bits[0], 'column_number' => $bits[1], 'page_order' => $widget_sort_page_order++);
    }
}
$widget_sort_id = 1;
// then display the alerts list.
if (module_config::c('dashboard_new_layout', 1) && class_exists('module_dashboard', false) && module_security::can_user(module_security::get_loggedin_id(), 'Show Dashboard Alerts')) {
    ob_start();
    module_dashboard::output_dashboard_alerts(module_config::c('dashboard_alerts_ajax', 1));
    array_unshift($home_widgets, array('columns' => isset($widget_sort_order[$widget_sort_id]['column']) ? $widget_sort_order[$widget_sort_id]['column'] : 1, 'column_number' => isset($widget_sort_order[$widget_sort_id]['column_number']) ? $widget_sort_order[$widget_sort_id]['column_number'] : false, 'page_order' => isset($widget_sort_order[$widget_sort_id]['page_order']) ? $widget_sort_order[$widget_sort_id]['page_order'] : false, 'sort_id' => $widget_sort_id++, 'title' => _l('Alerts'), 'content' => ob_get_clean()));
}
array_unshift($home_widgets, array('columns' => isset($widget_sort_order[$widget_sort_id]['column']) ? $widget_sort_order[$widget_sort_id]['column'] : 1, 'column_number' => isset($widget_sort_order[$widget_sort_id]['column_number']) ? $widget_sort_order[$widget_sort_id]['column_number'] : false, 'page_order' => isset($widget_sort_order[$widget_sort_id]['page_order']) ? $widget_sort_order[$widget_sort_id]['page_order'] : false, 'sort_id' => $widget_sort_id++, 'title' => _l('Home Page'), 'content' => _DEMO_MODE ? strip_tags($template->replace_content()) : $template->replace_content()));
// now grab the widgets from the various modules and add those in:
$widget_columns_counter = array();
foreach ($home_widgets as $module_widgets) {
    if (isset($module_widgets['id']) || isset($module_widgets['sort_id'])) {
        $module_widgets = array($module_widgets);
    }
    foreach ($module_widgets as $module_widget) {
        if (isset($widget_sort_order[$widget_sort_id]['column'])) {
            $module_widget['columns'] = $widget_sort_order[$widget_sort_id]['column'];
        }
开发者ID:sgh1986915,项目名称:php-crm,代码行数:31,代码来源:home.php

示例4: isset

                        <?php 
            }
            ?>

            </div>
        </div>

         <!-- header.head -->
        <header class="head">
            <div class="search-bar hidden-xs">
                <a data-original-title="Show/Hide Menu" data-placement="bottom" data-tooltip="tooltip" class="accordion-toggle btn btn-primary btn-sm visible-xs" data-toggle="collapse" href="#menu" id="menu-toggle">
                    <i class="fa fa-resize-full"></i>
                </a>

                <?php 
            if (module_security::getcred() && module_security::can_user(module_security::get_loggedin_id(), 'Show Quick Search')) {
                if (module_config::c('global_search_focus', 1) == 1) {
                    module_form::set_default_field('ajax_search_text');
                }
                ?>

                    <form class="main-search" action="<?php 
                echo _BASE_HREF;
                ?>
?p=search_results" method="post">
                        <div class="input-group">

                            <input type="text" class="input-small form-control" name="quicksearch" value="<?php 
                echo isset($_REQUEST['quicksearch']) ? htmlspecialchars($_REQUEST['quicksearch']) : '';
                ?>
" placeholder="<?php 
开发者ID:sgh1986915,项目名称:php-crm,代码行数:31,代码来源:design_header.php

示例5: handle_hook


//.........这里部分代码省略.........
                     if (!class_exists('module_website', false) || !module_website::is_plugin_enabled()) {
                         unset($columns['website']);
                     }
                     if (!module_customer::can_i('view', 'Customers')) {
                         unset($columns['customer']);
                     }
                     module_dashboard::register_group($key, array('columns' => $columns));
                 }
                 if ($cached_alerts = module_cache::get('job', $cache_key . $key)) {
                     $alerts = array_merge($alerts, $cached_alerts);
                 } else {
                     module_debug::log(array('title' => 'Job Home Alerts: ', 'data' => " starting: " . $key));
                     $this_alerts = array();
                     $sql = "SELECT p.job_id,p.name, t.date_updated, t.date_created, COUNT(t.task_id) AS approval_count FROM `" . _DB_PREFIX . "job` p ";
                     $sql .= " LEFT JOIN `" . _DB_PREFIX . "task` t ON p.job_id = t.job_id";
                     $sql .= " WHERE t.approval_required = 2";
                     $sql .= " GROUP BY p.job_id ";
                     $res = qa($sql);
                     foreach ($res as $r) {
                         $job = self::get_job($r['job_id']);
                         if (!$job || $job['job_id'] != $r['job_id']) {
                             continue;
                         }
                         $alert_res = process_alert($r['date_updated'] && $r['date_updated'] != '0000-00-00' ? $r['date_updated'] : $r['date_created'], $key);
                         if ($alert_res) {
                             $alert_res['link'] = $this->link_open($r['job_id'], false, $r);
                             $alert_res['name'] = $r['name'];
                             // new dashboard alert layout here:
                             $alert_res['time'] = strtotime($r['date_updated'] && $r['date_updated'] != '0000-00-00' ? $r['date_updated'] : $r['date_created']);
                             $alert_res['group'] = $key;
                             $alert_res['job'] = $this->link_open($job['job_id'], true, $job);
                             $alert_res['customer'] = $job['customer_id'] ? module_customer::link_open($job['customer_id'], true) : _l('N/A');
                             $alert_res['website'] = $job['website_id'] ? module_website::link_open($job['website_id'], true) : _l('N/A');
                             $alert_res['assigned_staff'] = $job['user_id'] ? module_user::link_open($job['user_id'], true) : _l('N/A');
                             //$alert_res['progress'] = ($job['total_percent_complete'] * 100).'%';
                             $alert_res['task_count'] = $r['approval_count'];
                             $alert_res['date'] = print_date($alert_res['time']);
                             $alert_res['days'] = $alert_res['warning'] ? '<span class="important">' . $alert_res['days'] . '</span>' : $alert_res['days'];
                             $this_alerts[] = $alert_res;
                         }
                     }
                     module_cache::put('job', $cache_key . $key, $this_alerts, $cache_timeout);
                     $alerts = array_merge($alerts, $this_alerts);
                 }
             }
             if (module_security::can_user(module_security::get_loggedin_id(), 'Show Dashboard Todo List')) {
                 $key = _l('Job Todo');
                 if (class_exists('module_dashboard', false)) {
                     $columns = array('job' => _l('Job Title'), 'customer' => _l('Customer Name'), 'progress' => _l('Task Progress'), 'task' => _l('Task Description'), 'assigned_staff' => _l('Staff'), 'date' => _l('Due Date'), 'days' => _l('Day Count'));
                     if (!module_customer::can_i('view', 'Customers')) {
                         unset($columns['customer']);
                     }
                     module_dashboard::register_group($key, array('columns' => $columns));
                 }
                 if ($cached_alerts = module_cache::get('job', $cache_key . $key)) {
                     $alerts = array_merge($alerts, $cached_alerts);
                 } else {
                     module_debug::log(array('title' => 'Job Home Alerts: ', 'data' => " starting: " . $key));
                     $this_alerts = array();
                     $todo_list = self::get_tasks_todo();
                     $x = 0;
                     foreach ($todo_list as $todo_item) {
                         if ($todo_item['hours_completed'] > 0) {
                             if ($todo_item['hours'] > 0) {
                                 $percentage = round($todo_item['hours_completed'] / $todo_item['hours'], 2);
                                 $percentage = min(1, $percentage);
                             } else {
                                 $percentage = 1;
                             }
                         } else {
                             $percentage = 0;
                         }
                         $job_data = module_job::get_job($todo_item['job_id'], false);
                         $alert_res = process_alert($todo_item['date_due'], 'temp');
                         if ($alert_res) {
                             $alert_res['link'] = $this->link_open($todo_item['job_id'], false, $job_data);
                             $alert_res['name'] = $percentage * 100 . '% ' . $todo_item['description'];
                             $alert_res['item'] = $job_data['name'];
                             // new dashboard alert layout here:
                             $alert_res['time'] = strtotime($alert_res['date']);
                             $alert_res['group'] = $key;
                             $alert_res['job'] = $this->link_open($todo_item['job_id'], true, $job_data);
                             $alert_res['customer'] = $job_data['customer_id'] ? module_customer::link_open($job_data['customer_id'], true) : _l('N/A');
                             $alert_res['assigned_staff'] = $todo_item['user_id'] ? module_user::link_open($todo_item['user_id'], true) : _l('N/A');
                             $alert_res['progress'] = $percentage * 100 . '%';
                             $alert_res['task'] = htmlspecialchars($todo_item['description']);
                             $alert_res['date'] = $alert_res['warning'] ? '<span class="important">' . print_date($alert_res['date']) . '</span>' : print_date($alert_res['date']);
                             $alert_res['days'] = $alert_res['warning'] ? '<span class="important">' . $alert_res['days'] . '</span>' : $alert_res['days'];
                             $this_alerts[] = $alert_res;
                         }
                     }
                     module_cache::put('job', $cache_key . $key, $this_alerts, $cache_timeout);
                     $alerts = array_merge($alerts, $this_alerts);
                 }
             }
             return $alerts;
             break;
     }
     return false;
 }
开发者ID:sgh1986915,项目名称:php-crm,代码行数:101,代码来源:job.php

示例6:

                <?php 
        }
        ?>

                </tbody>
            </table>
                </div>
                <?php 
    }
    ?>

        </td>
        <td valign="top">

            <?php 
    if (class_exists('module_job', false) && module_security::can_user(module_security::get_loggedin_id(), 'Show Dashboard Todo List')) {
        ?>


            <?php 
        print_heading(array('title' => 'Todo List', 'type' => 'h3'));
        ?>

                <div class="content_box_wheader">

             <table class="tableclass tableclass_rows tableclass_full">
                <tbody>
                <?php 
        $todo_list = module_job::get_tasks_todo();
        $x = 0;
        if (!count($todo_list)) {
开发者ID:sgh1986915,项目名称:php-crm,代码行数:31,代码来源:home.php

示例7: foreach

<?php

/** 
 * Copyright: dtbaker 2012
 * Licence: Please check CodeCanyon.net for licence details. 
 * More licence clarification available here:  http://codecanyon.net/wiki/support/legal-terms/licensing-terms/ 
 * Deploy: 9809 f200f46c2a19bb98d112f2d32a8de0c4
 * Envato: 4ffca17e-861e-4921-86c3-8931978c40ca, 0a3014a3-2b8f-460b-8850-d6025aa845f8
 * Package Date: 2015-11-25 03:08:08 
 * IP Address: 67.79.165.254
 */
if (class_exists('module_customer', false) && module_security::can_user(module_security::get_loggedin_id(), 'Show Dashboard Widgets')) {
    $customer_types = module_customer::get_customer_types();
    foreach ($customer_types as $customer_type) {
        // if(!empty($customer_type['type_name_plural']) && $customer_type['customer_type_id']) { // dtbaker
        if (!empty($customer_type['type_name_plural'])) {
            // dtbaker
            if (module_customer::can_i('view', $customer_type['type_name_plural'])) {
                // find out how many open customers are left..
                $customers = module_customer::get_customers(array('customer_type_id' => $customer_type['customer_type_id']), true);
                ob_start();
                // icons from http://ionicons.com/
                ?>

				<div class="small-box bg-yellow">
					<div class="inner">
						<h3>
							<?php 
                echo mysql_num_rows($customers);
                ?>
						</h3>
开发者ID:sgh1986915,项目名称:php-crm,代码行数:31,代码来源:widget_leads.php

示例8: process

    public function process()
    {
        if ("ajax_dashboard_tabs" == $_REQUEST['_process']) {
            header("Content-type: text/javascript");
            if (module_security::is_logged_in() && module_security::can_user(module_security::get_loggedin_id(), 'Show Dashboard Alerts')) {
                $items_to_hide = json_decode(module_config::c('_dashboard_item_hide' . module_security::get_loggedin_id(), '{}'), true);
                if (!is_array($items_to_hide)) {
                    $items_to_hide = array();
                }
                //$results = handle_hook("home_alerts");
                global $plugins;
                $tabid = 1;
                // Implicitly flush the buffer(s)
                @ini_set('implicit_flush', true);
                @ob_implicit_flush(true);
                ?>

	            var tabs = $('#dashboard_tabs'); //.tabs();
	            var ul = tabs.find( "ul" );
	            <?php 
                if (is_array($plugins)) {
                    foreach ($plugins as $plugin_name => $plugin) {
                        if (is_callable(array($plugin, 'handle_hook'))) {
                            $argv = array('home_alerts');
                            $this_return = call_user_func_array(array(&$plugin, 'handle_hook'), $argv);
                            if ($this_return !== false && $this_return !== null && is_array($this_return) && count($this_return)) {
                                // we found some home dashboard alerts! yew! print these out for our ajax display and exit, waiting for the next one.
                                uasort($this_return, 'sort_ajax_alert');
                                $dashboard_alerts = array();
                                foreach ($this_return as $alert) {
                                    $group_key = isset($alert['group']) ? $alert['group'] : $alert['item'];
                                    if (!isset($dashboard_alerts[$group_key])) {
                                        $dashboard_alerts[$group_key] = array();
                                    }
                                    $dashboard_alerts[$group_key][] = $alert;
                                }
                                if (!isset($_REQUEST['show_hidden'])) {
                                    foreach ($dashboard_alerts as $key => $val) {
                                        // see if any of these "$val" alert entries are marked as hidden
                                        foreach ($val as $k => $v) {
                                            $hide_key = md5($v['link'] . $v['item'] . (isset($v['name']) ? $v['name'] : ''));
                                            $dashboard_alerts[$key][$k]['hide_key'] = $val[$k]['hide_key'] = $hide_key;
                                            if (in_array($hide_key, $items_to_hide)) {
                                                unset($val[$k]);
                                                unset($dashboard_alerts[$key][$k]);
                                            }
                                        }
                                    }
                                }
                                //print_r($dashboard_alerts);
                                foreach ($dashboard_alerts as $key => $alerts) {
                                    if (!count($alerts)) {
                                        continue;
                                    }
                                    $tabid++;
                                    ?>

	                                $( "<li><a href='#newtab<?php 
                                    echo $tabid;
                                    ?>
'><?php 
                                    echo $key;
                                    ?>
 (<?php 
                                    echo count($alerts);
                                    ?>
)</a></li>" ).appendTo( ul );
	                                <?php 
                                    ob_start();
                                    if (isset(module_dashboard::$group_settings[$key])) {
                                        ?>

	                                <table class="tableclass tableclass_rows tableclass_full" id="alert_table_<?php 
                                        echo strtolower(str_replace(' ', '', $key));
                                        ?>
">
	                                    <thead>
		                                    <tr>
		                                        <?php 
                                        foreach (module_dashboard::$group_settings[$key]['columns'] as $column_key => $column_title) {
                                            ?>

		                                        <th class="alert_column_<?php 
                                            echo $column_key;
                                            ?>
"><?php 
                                            echo $column_title;
                                            ?>
</th>
		                                        <?php 
                                        }
                                        ?>

		                                        <th width="10" class="alert_column_delete"></th>
		                                    </tr>
	                                    </thead>
	                                    <tbody>
	                                        <?php 
                                        if (count($alerts)) {
                                            $y = 0;
//.........这里部分代码省略.........
开发者ID:sgh1986915,项目名称:php-crm,代码行数:101,代码来源:dashboard.php

示例9: get_staff_members

 public static function get_staff_members()
 {
     if (is_array(self::$_staff_members_cache)) {
         return self::$_staff_members_cache;
     }
     // todo: a different kinda perimssion outlines staff members maybe?
     if (module_config::c('staff_by_flag', 0)) {
         $label = 'Staff Member';
         // seed security permission:
         module_security::can_user(module_security::get_loggedin_id(), $label);
         // find any that exist.
         $staff = self::get_users_by_permission(array('category' => _LABEL_USER_SPECIFIC, 'name' => 'Staff Member', 'module' => 'config', 'view' => 1, 'description' => 'checkbox'));
     } else {
         $staff = self::get_users_by_permission(array('category' => 'Job', 'name' => 'Job Tasks', 'module' => 'job', 'edit' => 1));
     }
     foreach ($staff as $staff_id => $s) {
         if (isset($s['is_staff']) && $s['is_staff'] == 0) {
             // user has staff option manually disabled override the role settings.
             unset($staff[$staff_id]);
         }
     }
     // add any staff members that have the new is_staff flag set
     $staff_users = self::get_users(array('is_staff' => 1));
     if (!is_array($staff_users)) {
         $staff_users = array();
     }
     $staff_contacts = self::get_contacts(array('is_staff' => 1));
     if (!is_array($staff_contacts)) {
         $staff_contacts = array();
     }
     $staff = $staff + $staff_users + $staff_contacts;
     if (module_config::c('staff_remove_admin', 0) && isset($staff[module_config::c('staff_remove_admin', 0)])) {
         unset($staff[module_config::c('staff_remove_admin', 0)]);
     }
     self::$_staff_members_cache = $staff;
     return self::$_staff_members_cache;
 }
开发者ID:sgh1986915,项目名称:php-crm,代码行数:37,代码来源:user.php


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