function removeContactGroup($group) { //global the variables global $contactForm; //if the user confirms the delete then delete the id if (isset($_POST['deleteYes'])) { //if the id is valid delete if (is_numeric($_GET['contactID']) && is_numeric($_GET['contactTypeID'])) { $contact = new Person($_GET['contactID']); $contactType = new PersonType($_GET['contactTypeID']); if ($group->remove_contact($_GET['contactID'], $_GET['contactTypeID'])) { $status = "success"; $_SESSION['action'] = "Removed from " . $contactType->get_name() . ": " . $contact->get_first_name() . " " . $contact->get_last_name(); echo "<meta http-equiv=\"REFRESH\" content=\"0;url=" . $_SERVER['PHP_SELF'] . "?action=showGroup&groupID=" . $_GET['groupID'] . "&delete={$status}\">"; } else { $link = $_SERVER['PHP_SELF'] . "?action=showGroup&groupID=" . $_GET['groupID']; $contactForm->error("Warning: Failed to remove customer. Reason: " . $group->get_error(), $link); } } } else { if (isset($_POST['deleteNo'])) { echo "<meta http-equiv=\"REFRESH\" content=\"0;url=" . $_SERVER['PHP_SELF'] . "?action=showGroup&groupID=" . $_GET['groupID'] . "\">"; } else { $contactForm->prompt("Are you sure you want to delete?"); } } }
function remove_contact($contact_id, $contact_type_id) { // First check if this is a valid contactid $contact = new Person($contact_id); if (!$contact->get_contact_id()) { $this->error = "Invalid contact id, could not find contact information"; return false; } // check if this is a valid contact type $contact_type = new PersonType($contact_type_id); if (!$contact_type->get_contact_type_id()) { $this->error = "Invalid contact type id, could not find contact type"; return false; } if (!is_numeric($this->group_id)) { $this->error = "Invalid group id"; return false; } $query = "delete from groups_contacts WHERE \n\t\t\t\tgroup_id = '{$this->group_id}' AND\n\t\t\t\tcontact_id = '{$contact_id}' AND\n\t\t\t\tcontact_type = '{$contact_type_id}'"; // execute the query $result = mysql_query($query); if (!$result) { $this->error = mysql_error() . " ---query: {$query}"; return false; } return true; }
public function dtgPerson_PersonTypeId_Render(Person $objPerson) { if (!is_null($objPerson->PersonTypeId)) { return PersonType::ToString($objPerson->PersonTypeId); } else { return null; } }
?> <br/> Project Name: <?php _p($objProject->Name); ?> <br/> Project Status: <?php _p(ProjectStatusType::ToString($objProject->ProjectStatusTypeId)); ?> <h2>List the employees and their options.</h2> <?php // Load all the people and expand the type array associated with the person table $objClauses[] = QQ::ExpandAsArray(QQN::Person()->PersonType); $objPeople = Person::LoadAll($objClauses); foreach ($objPeople as $objPerson) { _p($objPerson->FirstName . ' ' . $objPerson->LastName . ': '); $intTypeArray = $objPerson->_PersonTypeArray; $strTypeArray = array(); foreach ($intTypeArray as $intType) { $strTypeArray[] = PersonType::ToString($intType); } _p(implode(', ', $strTypeArray)); _p('<br/>', false); } ?> </div> <?php require '../includes/footer.inc.php';