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


PHP Users::get_all方法代码示例

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


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

示例1: get_form

 public function get_form()
 {
     $users = Users::get_all();
     $users = Utils::array_map_field($users, 'username', 'id');
     $form = new FormUI('sudo');
     $form->append(new FormControlSelect('userlist', 'null:null', 'Become User:', $users));
     $form->userlist->value = User::identify()->id;
     $form->append(new FormControlSubmit('submit', 'Submit'));
     $form->set_option('form_action', URL::get('sudo'));
     $form->onsubmit = 'return dosudo.setuser();';
     return $form;
 }
开发者ID:ringmaster,项目名称:sudo,代码行数:12,代码来源:sudo.plugin.php

示例2: action_form_publish_proposal

 public function action_form_publish_proposal($form, $post)
 {
     $users = Users::get_all();
     $client_options = array();
     foreach ($users as $user) {
         if ($user->client) {
             $client_options[$user->id] = $user->client->title . ' : ' . $user->displayname;
         }
     }
     $form->insert('content', new FormControlSelect('client_contact', $post, 'Client Contact', $client_options, 'admincontrol_select'));
     $group = UserGroups::get(array('id' => Options::get('staff__group'), 'fetch_fn' => 'get_row'));
     $user_options = array();
     foreach ($group->users as $user) {
         $user_options[$user->id] = $user->displayname;
     }
     $form->insert('content', new FormControlSelect('staff', $post, 'Staff', $user_options, 'admincontrol_select'));
 }
开发者ID:ringmaster,项目名称:proposal,代码行数:17,代码来源:proposal.plugin.php

示例3: get_group

 /**
  * Handles GET requests for a group's page.
  */
 public function get_group()
 {
     $group = UserGroup::get_by_id($this->handler_vars['id']);
     if (null == $group) {
         Utils::redirect(URL::get('admin', 'page=groups'));
     } else {
         $tokens = ACL::all_tokens('id');
         $access_names = ACL::$access_names;
         $access_names[] = 'deny';
         // attach access bitmasks to the tokens
         foreach ($tokens as $token) {
             $token->access = ACL::get_group_token_access($group->id, $token->id);
         }
         // separate tokens into groups
         $grouped_tokens = array();
         foreach ($tokens as $token) {
             $grouped_tokens[$token->token_group][$token->token_type ? 'crud' : 'bool'][] = $token;
         }
         $group = UserGroup::get_by_id($this->handler_vars['id']);
         $potentials = array();
         $users = Users::get_all();
         $users[] = User::anonymous();
         $members = $group->members;
         $jsusers = array();
         foreach ($users as $user) {
             $jsuser = new StdClass();
             $jsuser->id = $user->id;
             $jsuser->username = $user->username;
             $jsuser->member = in_array($user->id, $members);
             $jsusers[$user->id] = $jsuser;
         }
         $this->theme->potentials = $potentials;
         $this->theme->users = $users;
         $this->theme->members = $members;
         $js = '$(function(){groupManage.init(' . json_encode($jsusers) . ');});';
         Stack::add('admin_header_javascript', $js, 'groupmanage', 'admin');
         $this->theme->access_names = $access_names;
         $this->theme->grouped_tokens = $grouped_tokens;
         $this->theme->groups = UserGroups::get_all();
         $this->theme->group = $group;
         $this->theme->id = $group->id;
         $this->theme->wsse = Utils::WSSE();
         $this->display('group');
     }
 }
开发者ID:ringmaster,项目名称:system,代码行数:48,代码来源:admingroupshandler.php

示例4: cache_invalidate

 /**
  * Invalidates (expires) the cache entries for the give list of URLs.
  *
  * @param array $urls An array of urls to clear
  */
 public function cache_invalidate(array $urls)
 {
     // account for annonymous user (id=0)
     $user_ids = array_map(create_function('$a', 'return $a->id;'), Users::get_all()->getArrayCopy());
     array_push($user_ids, "0");
     // expire the urls for each user id
     foreach ($user_ids as $user_id) {
         foreach ($urls as $url) {
             $request_id = self::get_request_id($user_id, $url);
             if (Cache::has(array(self::GROUP_NAME, $request_id))) {
                 Cache::expire(array(self::GROUP_NAME, $request_id));
                 EventLog::log('Clearing request ID: ' . $request_id, 'info', 'plugin', 'StaticCache');
             }
         }
     }
 }
开发者ID:habari-extras,项目名称:staticcache,代码行数:21,代码来源:staticcache.plugin.php

示例5: die

<?php

namespace Habari;

if (!defined('HABARI_PATH')) {
    die('No direct access');
}
?>
<ul>
	<?php 
foreach (Users::get_all() as $user) {
    if ($user->username == $currentuser->username) {
        $url = Url::get('own_user_profile');
    } else {
        $url = Url::get('user_profile', array('user' => $user->username));
    }
    ?>

	<li class="item">
		<div>
			<span class="checkbox"><span><input type="checkbox" class="checkbox select_user" value="<?php 
    echo $user->id;
    ?>
"></span></span>
			<span class="user"><a href="<?php 
    echo $url;
    ?>
" title="<?php 
    printf(_t('Open %s\'s user page'), $user->displayname);
    ?>
"><?php 
开发者ID:habari,项目名称:system,代码行数:31,代码来源:users_items.php

示例6: save_mainmenu

 public function save_mainmenu($form)
 {
     $base_url = Site::get_url('habari', true);
     $start_url = $form->mainmenus->value;
     /* Strip out the base URL from the requested URL */
     /* but only if the base URL isn't / */
     if ('/' != $base_url) {
         $start_url = str_replace($base_url, '', $start_url);
     }
     /* Trim off any leading or trailing slashes */
     $start_url = trim($start_url, '/');
     /* Remove the querystring from the URL */
     if (strpos($start_url, '?') !== FALSE) {
         list($start_url, $query_string) = explode('?', $start_url);
     }
     /* Allow plugins to rewrite the stub before it's passed through the rules */
     $start_url = Plugins::filter('rewrite_request', $start_url);
     $stub = $start_url;
     /* Grab the URL filtering rules from DB */
     $matched_rule = URL::parse($stub);
     if ($matched_rule === FALSE) {
         print 'error, cant find rule';
         // error!!!!
     }
     /* Return $_GET values to their proper place */
     $args = array();
     if (!empty($query_string)) {
         parse_str($query_string, $args);
     }
     $rule = $matched_rule->name;
     $args = array_merge($matched_rule->named_arg_values, $args);
     if (User::identify()->can('super_user') && $form->affect_all->value == true) {
         foreach (Users::get_all() as $user) {
             $user->info->admindetour_real = array('rule' => $rule, 'args' => $args);
             $user->update();
         }
     } else {
         User::identify()->info->admindetour_real = array('rule' => $rule, 'args' => $args);
     }
     $_POST[$form->mainmenus->field] = URL::get($rule, $args);
     $form->save();
 }
开发者ID:habari-extras,项目名称:admindetour,代码行数:42,代码来源:admindetour.plugin.php

示例7: Users

<?php

if (isset($_SESSION['user'])) {
    $usr = new Users();
    $usr = $usr->get($_SESSION['user']);
    if (!$usr) {
        header('HTTP/1.0 302 Found');
        header("Location: index.php?map=login&page=index");
        exit;
    }
}
$users = new Users();
$leden = $users->get_all();
?>

<div class="page-header">
    <h3>
        <i class="fa fa-fw fa-users"></i> Leden <small>Overzicht</small>
    </h3>
</div>

<div class="row">
    <div class="col-md-12">
        <div class="box box-primary">
            <div class="box-body">
                <table class="table table-striped">
                    <thead>
                    <tr>
                        <th>Naam</th>
                        <th>Band</th>
                        <th>Fan</th>
开发者ID:MHakvoort,项目名称:origin,代码行数:31,代码来源:index.php

示例8: fetch_users

 /**
  * Assign values needed to display the users listing
  *
  */
 private function fetch_users($params = null)
 {
     // prepare the WSSE tokens
     $this->theme->wsse = Utils::WSSE();
     // Get author list
     $author_list = Users::get_all();
     $authors[0] = _t('nobody');
     foreach ($author_list as $author) {
         $authors[$author->id] = $author->displayname;
     }
     $this->theme->authors = $authors;
 }
开发者ID:wwxgitcat,项目名称:habari,代码行数:16,代码来源:adminusershandler.php

示例9: filter_fireeagle_refresh

 /**
  * filter: fireeagle_refresh
  *
  * @access public
  * @param boolean $result
  * @return boolean
  */
 public function filter_fireeagle_refresh($result)
 {
     $users = Users::get_all();
     foreach ($users as $user) {
         $location = $this->update((int) $user->id);
         if (!$location) {
             continue;
         }
     }
     $result = true;
     return $result;
 }
开发者ID:habari-extras,项目名称:fireeagle,代码行数:19,代码来源:fireeagle.plugin.php

示例10: upgrade_db_post_3030

 private function upgrade_db_post_3030()
 {
     // Create the admin group
     $group = UserGroup::create(array('name' => 'admin'));
     if (!$group) {
         return false;
     }
     // Add the default tokens
     ACL::create_default_tokens();
     // Give admin group access to the super_user token
     $group->grant('super_user');
     // Until now, all users were admins, restore that
     $all_users = Users::get_all();
     foreach ($all_users as $user) {
         $group->add($user);
     }
     // Create the anonymous group
     $this->create_anonymous_group();
 }
开发者ID:habari,项目名称:system,代码行数:19,代码来源:installhandler.php

示例11: populate_users_get

 /**
  * Get users created by this module.
  * @param integer $num number of users to get, or all if not specified.
  * @return array users found.
  */
 private function populate_users_get($num = null)
 {
     // get all tokens
     $allusers = Users::get_all();
     // internal loop to get only our users.
     $users = array();
     $count = 0;
     foreach ($allusers as $id => $user) {
         if (strpos($user->username, 'opulate_')) {
             $users[] = $user;
             if (isset($num) && $num == ++$count) {
                 break;
             }
         }
     }
     return $users;
 }
开发者ID:habari-extras,项目名称:populate,代码行数:22,代码来源:populate.plugin.php

示例12: rebuild_permissions

 /**
  * Reset premissions to their default state
  */
 public static function rebuild_permissions($user = null)
 {
     // Clear out all permission-related values
     DB::query('DELETE FROM {tokens}');
     DB::query('DELETE FROM {group_token_permissions}');
     //DB::query( 'DELETE FROM {groups}' );
     DB::query('DELETE FROM {post_tokens}');
     DB::query('DELETE FROM {user_token_permissions}');
     //DB::query('DELETE FROM {users_groups}');
     // Create initial groups if they don't already exist
     $admin_group = UserGroup::get_by_name(_t('admin'));
     if (!$admin_group instanceof UserGroup) {
         $admin_group = UserGroup::create(array('name' => _t('admin')));
     }
     $anonymous_group = UserGroup::get_by_name(_t('anonymous'));
     if (!$anonymous_group instanceof UserGroup) {
         $anonymous_group = UserGroup::create(array('name' => _t('anonymous')));
     }
     // Add all users or the passed user to the admin group
     if (empty($user)) {
         $users = Users::get_all();
         $ids = array();
         foreach ($users as $user) {
             $ids[] = $user->id;
         }
         $admin_group->add($ids);
     } else {
         $admin_group->add($user);
     }
     // create default permissions
     self::create_default_tokens();
     // Make the admin group all superusers
     $admin_group->grant('super_user');
     // Add entry and page read access to the anonymous group
     $anonymous_group->grant('post_entry', 'read');
     $anonymous_group->grant('post_page', 'read');
     $anonymous_group->grant('comment');
     $anonymous_group->deny('post_unpublished');
     // Add the anonymous user to the anonymous group
     $anonymous_group->add(0);
     // Create the default authenticated group
     $authenticated_group = UserGroup::get_by_name(_t('authenticated'));
     if (!$authenticated_group instanceof UserGroup) {
         $authenticated_group = UserGroup::create(array('name' => _t('authenticated')));
     }
     $authenticated_group->grant('post_entry', 'read');
     $authenticated_group->grant('post_page', 'read');
     $authenticated_group->grant('comment');
 }
开发者ID:wwxgitcat,项目名称:habari,代码行数:52,代码来源:acl.php

示例13: get_group

 /**
  * Handles GET requests for a group's page.
  */
 public function get_group()
 {
     $group = UserGroup::get_by_id(Controller::get_var('id'));
     if (null == $group) {
         Utils::redirect(URL::get('display_groups', 'page=groups'));
     } else {
         $tokens = ACL::all_tokens('id');
         $tokens = Plugins::filter('token_list_display', $tokens);
         array_walk($tokens, function (&$value, $key) {
             $value->description = Plugins::filter('token_description_display', $value->name);
             $value->token_group = Plugins::filter('token_group_display', $value->token_group);
         });
         $access_names = ACL::access_names();
         $access_names[] = 'deny';
         $access_display = array();
         foreach ($access_names as $name) {
             $access_display[$name] = Plugins::filter('permission_display', $name);
         }
         $bool_access_display['allow'] = Plugins::filter('permission_display', 'allow');
         $bool_access_display['deny'] = Plugins::filter('permission_display', 'deny');
         // attach access bitmasks to the tokens
         foreach ($tokens as $token) {
             $token->access = ACL::get_group_token_access($group->id, $token->id);
         }
         // separate tokens into groups
         $grouped_tokens = array();
         foreach ($tokens as $token) {
             $grouped_tokens[$token->token_group][$token->token_type ? 'crud' : 'bool'][] = $token;
         }
         $potentials = array();
         $users = Users::get_all();
         $users[] = User::anonymous();
         $members = $group->members;
         $jsusers = array();
         foreach ($users as $user) {
             $jsuser = new \StdClass();
             $jsuser->id = $user->id;
             $jsuser->username = $user->username;
             $jsuser->member = in_array($user->id, $members);
             $jsusers[$user->id] = $jsuser;
         }
         $this->theme->potentials = $potentials;
         $this->theme->users = $users;
         $this->theme->members = $members;
         $js = '$(function(){groupManage.init(' . json_encode($jsusers) . ');});';
         Stack::add('admin_header_javascript', $js, 'groupmanage', 'admin-js');
         $this->theme->access_names = $access_names;
         $this->theme->grouped_tokens = $grouped_tokens;
         $this->theme->access_display = $access_display;
         $this->theme->bool_access_display = $bool_access_display;
         $this->theme->groups = UserGroups::get_all();
         $this->theme->group = $group;
         $this->theme->id = $group->id;
         $this->theme->wsse = Utils::WSSE();
         $this->display('group');
     }
 }
开发者ID:habari,项目名称:system,代码行数:60,代码来源:admingroupshandler.php

示例14: stage2


//.........这里部分代码省略.........
        }
        $num_imported_comments = $s9ydb->get_value("SELECT COUNT(*) FROM `{$db_prefix}comments`" . $comment_where);
        /* 
         * Users are important during import.  We want to show the importer that
         * we have identified X number of posting users (authors) and give the importer
         * the ability to choose which authors they wish to import.  During this
         * step, let's try to map an incoming (imported) author to an existing Habari
         * user...
         */
        $user_sql = <<<ENDOFSQL
SELECT e.authorid, e.author, a.realname, a.username, a.email,COUNT(*) as num_posts 
FROM `{$db_prefix}entries` e 
INNER JOIN `{$db_prefix}authors` a 
ON e.authorid = a.authorid 
GROUP BY e.authorid, e.author
ENDOFSQL;
        $imported_users = $s9ydb->get_results($user_sql);
        $num_imported_users = count($imported_users);
        /* Grab the categories from s9y to use as tags in Habari */
        $num_imported_tags = 0;
        if ($category_import == 1) {
            $num_imported_tags = $s9ydb->get_value("SELECT COUNT(*) FROM `{$db_prefix}category`");
        }
        $output = <<<WP_IMPORT_STAGE2
\t\t\t<h3>To be imported</h3>
\t\t\t<p>
\t\t\tWe have identified information that will be imported into Habari.  Please review
\t\t\tthe information below and continue with the import.
\t\t\t</p>
\t\t\t<div><strong>Found authors to be imported:</strong>&nbsp;{$num_imported_users}
WP_IMPORT_STAGE2;
        if ($num_imported_users > 0) {
            $output .= <<<WP_IMPORT_STAGE2
\t\t\t\t<div style="margin-left: 20px; padding 10px;">
\t\t\t\t<p>Check which users (and their posts) you wish to import</p>
\t\t\t\t<table>
\t\t\t\t<tr><th>Import?</th><th>Author Name</th><th>Email</th><th>Num Posts</th><th>Match in Habari?</th></tr>
WP_IMPORT_STAGE2;
            foreach ($imported_users as $user) {
                $output .= "<tr><td><input type='checkbox' name='import_user[{$user->authorid}]' value='1' checked='true' /></td>" . "<td>{$user->realname}</td><td>{$user->email}</td><td>{$user->num_posts}</td><td>&nbsp;";
                $user_table_name = DB::table('users');
                $match_sql = <<<ENDOFSQL
SELECT id, username, email
FROM {$user_table_name}
WHERE email = ? OR username = ?
ENDOFSQL;
                $match_params = array($user->email, $user->username);
                $habari_matched_users = DB::get_results($match_sql, $match_params, 'User');
                if (count($habari_matched_users) > 0) {
                    $output .= "<strong>Match found for habari user:</strong>&nbsp;";
                    $matched_user = $habari_matched_users[0];
                    /* Just take the first match... */
                    $output .= $matched_user->username . "<input type=\"hidden\" name=\"merge_user_matched[{$user->authorid}]\" value=\"{$matched_user->id}\" />";
                } else {
                    /* No matches.  Allow importer to select a merged user account */
                    $all_habari_users = Users::get_all();
                    if (isset($all_habari_user_select)) {
                        $output .= $all_habari_user_select;
                    } else {
                        $all_habari_user_select = "<select name='merge_user[{$user->authorid}]'>";
                        $all_habari_user_select .= "<option value='__new_user' selected='true'>Create a new user</option>";
                        foreach ($all_habari_users as $habari_user) {
                            $all_habari_user_select .= "<option value='{$habari_user->id}'>Merge with {$habari_user->username}</option>";
                        }
                        $output .= $all_habari_user_select;
                    }
                }
                $output .= "</td></tr>";
            }
            $output .= "</table></div>";
        } else {
            /* No authors found to import.  Display nothing to import and stop process */
            $output .= "</div>";
            return $output;
        }
        $output .= <<<WP_IMPORT_STAGE2
\t\t\t</div>
\t\t\t<div><strong>Found Blog Posts to be imported:</strong>&nbsp;{$num_imported_posts}</div>
\t\t\t<div><strong>Comments to be imported:</strong>&nbsp;{$num_imported_comments}</div>
WP_IMPORT_STAGE2;
        if ($category_import == 1) {
            $output .= <<<WP_IMPORT_STAGE2
\t\t\t<div><strong>Tags to be imported:</strong>&nbsp;{$num_imported_tags}</div>
WP_IMPORT_STAGE2;
        }
        if ($rewrites_import == 1) {
            $output .= <<<WP_IMPORT_STAGE2
\t\t\t<div><strong>Porting Rewrites.</strong></div>
WP_IMPORT_STAGE2;
        }
        foreach ($inputs as $key => $value) {
            $output .= "<input type='hidden' name='{$key}' value='" . htmlentities($value) . "' />";
        }
        $output .= <<<WP_IMPORT_STAGE2
\t\t\t<input type="hidden" name="stage" id="stage" value="2">
\t\t\t<p class="submit">
\t\t\t<input type="submit" name="import" value="Continue Import >>" /></p>
WP_IMPORT_STAGE2;
        return $output;
    }
开发者ID:habari-extras,项目名称:s9yimport,代码行数:101,代码来源:s9yimport.plugin.php

示例15: get_users

 /**
  * Handles GET requests of the users page.
  */
 public function get_users()
 {
     // Get author list
     $author_list = Users::get_all();
     $authors[0] = _t('nobody');
     foreach ($author_list as $author) {
         $authors[$author->id] = $author->displayname;
     }
     $this->theme->authors = $authors;
     $this->theme->currentuser = User::identify();
     $this->theme->add_user_form = FormUI::build('add_user', 'add_user')->get();
     $this->theme->delete_users_form = FormUI::build('delete_users', 'delete_users')->get();
     $this->theme->display('users');
 }
开发者ID:habari,项目名称:system,代码行数:17,代码来源:adminusershandler.php


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