function testGetAgency() { TestEnv::startTransaction(); $id = Admin_DA::addAgency(array('name' => 'foo', 'contact' => 'bar', 'username' => 'user', 'email' => '*****@*****.**')); $ret = Admin_DA::getAgency($id); // should look like this /* Array ( [agency_id] => 1 [name] => my agency [contact] => foo bar [email] => foo@example.com [username] => Ronald [password] => Reagan [permissions] => 33 [language] => chinese ) */ $this->assertTrue(is_array($ret)); $this->assertTrue(count($ret)); $this->assertTrue(array_key_exists('agency_id', $ret)); $this->assertTrue(array_key_exists('name', $ret)); $this->assertTrue(array_key_exists('contact', $ret)); $this->assertTrue(array_key_exists('email', $ret)); TestEnv::rollbackTransaction(); }
function MAX_displayChannels($channels, $aParams) { $entityString = _getEntityString($aParams); echo "<table border='0' width='100%' cellpadding='0' cellspacing='0'>"; echo "<tr height='25'><td height='25'><b> {$GLOBALS['strName']}</a></b></td>"; echo "<td height='25'><b>{$GLOBALS['strID']}</a></td>"; echo "<td height='25'> </td>"; echo "</tr>"; echo "<tr height='1'><td colspan='3' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td></tr>"; if (empty($channels)) { echo "<tr height='25' bgcolor='#F6F6F6'><td height='25' colspan='3'>"; echo " {$GLOBALS['strNoChannels']}</td></tr>"; echo "<td colspan='3' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td></tr>"; } else { $i = 0; foreach ($channels as $channelId => $channel) { if ($i > 0) { echo "<td colspan='3' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td>"; } echo "<tr height='25' " . ($i % 2 == 0 ? "bgcolor='#F6F6F6'" : "") . ">"; echo "<td height='25'> "; echo "<img src='" . OX::assetPath() . "/images/icon-channel.gif' align='absmiddle'> "; // set channel ownership info for display if ($GLOBALS['pageName'] != 'affiliate-channels.php') { if (!empty($channel['publisher_id'])) { $ownerTypeStr = 'Publisher: '; $publisher = Admin_DA::getPublisher($channel['publisher_id']); $ownerNameStr = '[id' . $channel['publisher_id'] . '] ' . $publisher['name']; } else { if (!empty($channel['agency_id']) && empty($channel['publisher_id']) && !OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) { $ownerTypeStr = 'Agency: '; $agency = Admin_DA::getAgency($channel['agency_id']); $ownerNameStr = '[id' . $channel['agency_id'] . '] ' . $agency['name']; } else { $ownerTypeStr = ''; $ownerNameStr = ''; } } } $ownerStr = !empty($ownerTypeStr) ? '  <i>' . $ownerTypeStr . '</i>' . htmlspecialchars($ownerNameStr) : ''; echo "<a href='channel-edit.php?{$entityString}channelid={$channel['channel_id']}'>" . htmlspecialchars($channel['name'] . $ownerStr) . "</a>"; echo " "; echo "</td>"; echo "<td height='25'>{$channel['channel_id']}</td>"; echo "<td> </td></tr>"; // Description echo "<tr height='25' " . ($i % 2 == 0 ? "bgcolor='#F6F6F6'" : "") . ">"; echo "<td> </td>"; echo "<td height='25' colspan='3'>" . htmlspecialchars(stripslashes($channel['description'])) . "</td>"; echo "</tr>"; echo "<tr height='1'>"; echo "<td " . ($i % 2 == 0 ? "bgcolor='#F6F6F6'" : "") . "><img src='" . OX::assetPath() . "/images/spacer.gif' width='1' height='1'></td>"; echo "<td colspan='3' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break-l.gif' height='1' width='100%'></td>"; echo "</tr>"; echo "<tr height='25' " . ($i % 2 == 0 ? "bgcolor='#F6F6F6'" : "") . ">"; // Empty echo "<td> </td>"; // Buttons echo "<td height='25' colspan='3'>"; echo "<img src='" . OX::assetPath() . "/images/icon-acl.gif' border='0' align='absmiddle' alt='{$GLOBALS['strIncludedBanners']}'> <a href='channel-acl.php?{$entityString}channelid={$channel['channel_id']}'>{$GLOBALS['strEditChannelLimitations']}</a> "; echo "<img src='" . OX::assetPath() . "/images/icon-recycle.gif' border='0' align='absmiddle' alt='{$GLOBALS['strDelete']}'> <a href='channel-delete.php?token=" . urlencode(phpAds_SessionGetToken()) . "&{$entityString}channelid={$channel['channel_id']}&returnurl=" . (empty($aParams['affiliateid']) ? 'channel-index.php' : 'affiliate-channels.php') . "'" . phpAds_DelConfirm($GLOBALS['strConfirmDeleteChannel']) . ">{$GLOBALS['strDelete']}</a> "; echo "</td></tr>"; $i++; } if (!empty($channels)) { echo "<tr height='1'><td colspan='4' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td></tr>"; } } echo "</table>"; }