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


PHP Sentry::group_exists方法代码示例

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


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

示例1: get_search_items

 public function get_search_items($group_id = false)
 {
     // Override group_id if its a search
     $group_id = \Input::get('user_group', $group_id);
     if ($group_id && \Sentry::group_exists((int) $group_id)) {
         // Get only group users
         \View::set_global('group', \Sentry::group((int) $group_id));
         $items = \Sentry::group((int) $group_id)->users();
     } else {
         $items = \Sentry::user()->all('admin');
     }
     // Reset to empty array if there are no result found by query
     if (is_null($items)) {
         $items = array();
     }
     // Get user objects
     if (!empty($items)) {
         foreach ($items as $key => $item) {
             $items[$key] = \Sentry::user((int) $item['id']);
         }
         // Get search filters
         foreach (\Input::get() as $key => $value) {
             if (!empty($value) || $value == '0') {
                 switch ($key) {
                     case 'title':
                         foreach ($items as $number => $item) {
                             if (empty($item['metadata'])) {
                                 unset($items[$number]);
                                 continue;
                             }
                             $full_name = $item->get('metadata.first_name') . ' ' . $item->get('metadata.last_name');
                             if (stripos($full_name, $value) === false) {
                                 unset($items[$number]);
                             }
                         }
                         break;
                     case 'email':
                         foreach ($items as $number => $item) {
                             if (stripos($item->email, $value) === false) {
                                 unset($items[$number]);
                             }
                         }
                         break;
                     case 'country':
                         if ($value && $value !== 'false') {
                             foreach ($items as $number => $item) {
                                 if (empty($item['metadata'])) {
                                     unset($items[$number]);
                                     continue;
                                 }
                                 if (stripos($item->get('metadata.country'), $value) === false) {
                                     unset($items[$number]);
                                 }
                             }
                         }
                         break;
                     case 'postcode_from':
                         foreach ($items as $number => $item) {
                             if (empty($item['metadata'])) {
                                 unset($items[$number]);
                                 continue;
                             }
                             if ($item->get('metadata.postcode') < $value) {
                                 unset($items[$number]);
                             }
                         }
                         break;
                     case 'postcode_to':
                         foreach ($items as $number => $item) {
                             if (empty($item['metadata'])) {
                                 unset($items[$number]);
                                 continue;
                             }
                             if ($item->get('metadata.postcode') > $value) {
                                 unset($items[$number]);
                             }
                         }
                         break;
                 }
             }
         }
     }
     // Reset to empty array if there are no result found by query
     if (is_null($items)) {
         $items = array();
     }
     // Initiate pagination
     $pagination = \Hybrid\Pagination::make(array('total_items' => count($items), 'per_page' => \Input::get('per_page', 10), 'uri_segment' => null));
     // Remove unwanted items, and show only required ones
     $items = array_slice($items, $pagination->offset, $pagination->per_page);
     return array('items' => $items, 'pagination' => $pagination);
 }
开发者ID:EdgeCommerce,项目名称:edgecommerce,代码行数:92,代码来源:user.php

示例2: get_search_customers

 public function get_search_customers($group_id = false)
 {
     // Override group_id if its a search
     $group_id = \Input::get('user_group', $group_id);
     $activated = \Input::get('activated', false);
     if (\Input::get()) {
         if ($group_id && \Sentry::group_exists((int) $group_id)) {
             // Get only group users
             \View::set_global('group', \Sentry::group((int) $group_id));
             $items = \Sentry::group((int) $group_id)->users();
         } else {
             // Get all users and remove admin users from array
             $items = \Sentry::user()->all('front');
         }
     }
     // Reset to empty array if there are no result found by query
     if (empty($items)) {
         $items = array();
     }
     // Get user objects
     if (!empty($items)) {
         foreach ($items as $key => $item) {
             $items[$key] = \Sentry::user((int) $item['id']);
         }
         // Get search filters
         foreach (\Input::get() as $key => $value) {
             if (!empty($value) || $value == '0') {
                 switch ($key) {
                     case 'title':
                         foreach ($items as $number => $item) {
                             if (empty($item['metadata'])) {
                                 unset($items[$number]);
                                 continue;
                             }
                             $full_name = $item->get('metadata.first_name') . ' ' . $item->get('metadata.last_name');
                             $customer_id = $item->get('metadata.user_id');
                             if (stripos($full_name, $value) === false && stripos($customer_id, $value) === false) {
                                 unset($items[$number]);
                             }
                         }
                         break;
                     case 'email':
                         foreach ($items as $number => $item) {
                             if (stripos($item->email, $value) === false) {
                                 unset($items[$number]);
                             }
                         }
                         break;
                     case 'country':
                         if ($value && $value !== 'false') {
                             foreach ($items as $number => $item) {
                                 if (empty($item['metadata'])) {
                                     unset($items[$number]);
                                     continue;
                                 }
                                 if (stripos($item->get('metadata.country'), $value) === false) {
                                     unset($items[$number]);
                                 }
                             }
                         }
                         break;
                     case 'postcode_from':
                         foreach ($items as $number => $item) {
                             if (empty($item['metadata'])) {
                                 unset($items[$number]);
                                 continue;
                             }
                             if ($item->get('metadata.postcode') < $value) {
                                 unset($items[$number]);
                             }
                         }
                         break;
                     case 'postcode_to':
                         foreach ($items as $number => $item) {
                             if (empty($item['metadata'])) {
                                 unset($items[$number]);
                                 continue;
                             }
                             if ($item->get('metadata.postcode') > $value) {
                                 unset($items[$number]);
                             }
                         }
                         break;
                     case 'activated':
                         if ($value !== 'false') {
                             foreach ($items as $number => $item) {
                                 if ($item->activated != $value) {
                                     unset($items[$number]);
                                 }
                             }
                         }
                         break;
                 }
             }
         }
     }
     // Reset to empty array if there are no result found by query
     if (empty($items)) {
         $items = array();
     }
//.........这里部分代码省略.........
开发者ID:EdgeCommerce,项目名称:edgecommerce,代码行数:101,代码来源:reports.php


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