本文整理汇总了PHP中CCompany::getUsers方法的典型用法代码示例。如果您正苦于以下问题:PHP CCompany::getUsers方法的具体用法?PHP CCompany::getUsers怎么用?PHP CCompany::getUsers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCompany
的用法示例。
在下文中一共展示了CCompany::getUsers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: die
<?php
/* $Id$ $URL$ */
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
}
##
## Companies: View User sub-table
##
global $AppUI, $company_id;
$userList = CCompany::getUsers($AppUI, $company_id);
if (count($userList) > 0) {
?>
<table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
<tr>
<th><?php
echo $AppUI->_('Username');
?>
</td>
<th><?php
echo $AppUI->_('Name');
?>
</td>
</tr>
<?php
$s = '';
foreach ($userList as $user) {
$s .= '<tr><td>';
$s .= '<a href="./index.php?m=admin&a=viewuser&user_id=' . $user['user_id'] . '">' . $user['user_username'] . '</a>';
$s .= '<td>' . $user['contact_first_name'] . ' ' . $user['contact_last_name'] . '</td>';
$s .= '</tr>';
示例2: testGetUsers
/**
* Tests loading list of Users for this company.
*/
public function testGetUsers()
{
global $AppUI;
$users = CCompany::getUsers($AppUI, 2);
/**
* getUsers returns both an associative array as well as a indexed array
* so we need to check both to make sure functionality depending on either does
* not break.
*/
$this->assertEquals(2, count($users));
$this->assertEquals(3, $users[3]['user_id']);
$this->assertEquals('contact_number_2', $users[3]['user_username']);
$this->assertEquals('Contact', $users[3]['contact_first_name']);
$this->assertEquals('Number 2', $users[3]['contact_last_name']);
$this->assertEquals(3, $users[3][0]);
$this->assertEquals('contact_number_2', $users[3][1]);
$this->assertEquals('Contact', $users[3][2]);
$this->assertEquals('Number 2', $users[3][3]);
$this->assertEquals(4, $users[4]['user_id']);
$this->assertEquals('contact_number_3', $users[4]['user_username']);
$this->assertEquals('Contact', $users[4]['contact_first_name']);
$this->assertEquals('Number 3', $users[4]['contact_last_name']);
$this->assertEquals(4, $users[4][0]);
$this->assertEquals('contact_number_3', $users[4][1]);
$this->assertEquals('Contact', $users[4][2]);
$this->assertEquals('Number 3', $users[4][3]);
}