echo $AppUI->_('Name'); ?> </th> <th><?php echo $AppUI->_('e-mail'); ?> </th> <th><?php echo $AppUI->_('Department'); ?> </th> </tr> <?php foreach ($rows as $row) { $contact = new CContact(); $contact->bind($row); $dept_detail = $contact->getDepartmentDetails(); $s .= '<tr><td>'; $s .= '<a href="?m=contacts&a=view&contact_id=' . dPformSafe($row['contact_id']) . '">' . htmlspecialchars($row['contact_last_name'] . ', ' . $row['contact_first_name']) . '</a>'; $s .= '<td><a href="mailto:' . dPformSafe($row['contact_email'], DP_FORM_URI) . '">' . htmlspecialchars($row['contact_email']) . '</a></td>'; $s .= '<td>' . htmlspecialchars($dept_detail['dept_name']) . '</td>'; $s .= '</tr>'; } } $s .= '<tr><td colspan="3" align="right" valign="top" style="background-color:#ffffff">'; $s .= '<input type="button" class=button value="' . $AppUI->_('new contact') . '" onclick="javascript:window.location=\'./index.php?m=contacts&a=addedit&company_id=' . dPformSafe($company_id) . '&company_name=' . dPformSafe($obj->company_name) . '\'">'; $s .= '</td></tr>'; echo $s; ?> </table>
$canDelete = false; } $canEdit = $perms->checkModuleItem($m, "edit", $contact_id); if (!$row->load($contact_id) && $contact_id > 0) { $AppUI->setMsg('Contact'); $AppUI->setMsg("invalidID", UI_MSG_ERROR, true); $AppUI->redirect(); } else { if ($row->contact_private && $row->contact_owner != $AppUI->user_id && $row->contact_owner && $contact_id != 0) { // check only owner can edit $AppUI->redirect("m=public&a=access_denied"); } } // Get the contact details for company and department $company_detail = $row->getCompanyDetails(); $dept_detail = $row->getDepartmentDetails(); // setup the title block $ttl = "View Contact"; $titleBlock = new CTitleBlock($ttl, 'monkeychat-48.png', $m, "{$m}.{$a}"); $titleBlock->addCrumb("?m=contacts", "contacts list"); if ($canEdit && $contact_id) { $titleBlock->addCrumb("?m=contacts&a=addedit&contact_id={$contact_id}", 'edit'); } $titleBlock->addCell('<input type="submit" class="button" value="' . $AppUI->_('new project') . '" />', '', '<form action="?m=projects&a=addedit&company_id=' . $row->contact_company . '&contact_id=' . $contact_id . '" method="post">', '</form>'); if ($canDelete && $contact_id) { $titleBlock->addCrumbDelete('delete contact', $canDelete, $msg); } $titleBlock->show(); ?> <form name="changecontact" action="?m=contacts" method="post"> <input type="hidden" name="dosql" value="do_contact_aed" />
public function testGetDepartmentDetails() { $contact = new CContact(); $results = $contact->getDepartmentDetails(); $this->AssertEquals(2, count($results)); $this->assertEquals(0, $results['dept_id']); $this->assertEquals('', $results['dept_name']); $contact->contact_department = 1; $results = $contact->getDepartmentDetails(); $this->AssertEquals(2, count($results)); $this->assertEquals(1, $results['dept_id']); $this->assertEquals('Department 1', $results['dept_name']); }