/**
  * Adds a contact to the group
  * @param MoodletxtAddressbookRecipient $contact Contact to add
  * @version 2012092501
  * @since 2011102601
  */
 public function addContact(MoodletxtAddressbookRecipient $contact)
 {
     if (!is_array($this->contacts)) {
         $this->contacts = array();
     }
     $this->contacts[$contact->getContactId()] = $contact;
 }
 /**
  * Build JSON response structure for an updated contact
  * @param MoodletxtAddressbookRecipient $contact Updated contact
  * @return string Constructed JSON
  * @version 2012090501
  * @since 2012090501
  */
 private function buildResponse(MoodletxtAddressbookRecipient $contact)
 {
     // Copy template down
     $response = $this->responseTemplate;
     $contactArray = array('contactId' => $contact->getContactId(), 'firstName' => $contact->getFirstName(), 'lastName' => $contact->getLastName(), 'company' => $contact->getCompanyName(), 'phoneNo' => $contact->getRecipientNumber()->getPhoneNumber());
     array_push($response['contacts'], $contactArray);
     return json_encode($response);
 }
Ejemplo n.º 3
0
 /**
  * Converts a higher-level contact object into a standard
  * object class for writing to the database
  * @param MoodletxtAddressbookRecipient $contact Full-fat data object
  * @return object Object ready for DB
  * @version 2012091301
  * @since 2012090501
  */
 private function convertContactBeanToStandardClass(MoodletxtAddressbookRecipient $contact)
 {
     $dbObj = new object();
     $dbObj->addressbook = $contact->getAddressbookId();
     $dbObj->firstname = $contact->getFirstName();
     $dbObj->lastname = $contact->getLastName();
     $dbObj->company = $contact->getCompanyName();
     $dbObj->phoneno = $contact->getRecipientNumber()->getPhoneNumber();
     if ($contact->getContactId() > 0) {
         $dbObj->id = $contact->getContactId();
     }
     return $dbObj;
 }
Ejemplo n.º 4
0
 /**
  * Adds a single contact to this addressbook
  * @param MoodletxtAddressbookRecipient $contact Contact to add
  * @version 2012080701
  * @since 2012080701
  */
 public function addContact(MoodletxtAddressbookRecipient $contact)
 {
     $this->contacts[$contact->getContactId()] = $contact;
 }