<?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>';
/** * 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]); }