public function __construct(HighriseAPI $highrise) { parent::__construct($highrise); $this->_note_type = "email"; $this->_note_url = "/emails"; }
public function getNotes() { $this->notes = array(); $xml = $this->getURL("/people/" . $this->id . "/notes.xml"); $xml_obj = simplexml_load_string($xml); if ($this->debug == true) { } print_r($xml_obj); if (isset($xml_obj->note) && count($xml_obj->note) > 0) { foreach ($xml_obj->note as $xml_note) { $note = new HighriseNote($this->highrise); $note->loadFromXMLObject($xml_note); $this->addNote($note); } } return $this->notes; }
if (count($argv) != 3) { die("Usage: php notes.test.php [account-name] [access-token]\n"); } $hr = new HighriseAPI(); $hr->debug = false; $hr->setAccount($argv[1]); $hr->setToken($argv[2]); $people = $hr->findPeopleBySearchTerm("Person Test"); $person = $people[0]; $notes = $person->getNotes(); foreach ($notes as $note) { print_r($note); print $note->toXML(); } // Create new note $new_note = new HighriseNote($hr); $new_note->setSubjectType("Party"); $new_note->setSubjectId($person->getId()); $new_note->setBody("Test"); $new_note->save(); print "New note ID: " . $new_note->getId() . " Created at: " . $new_note->getCreatedAt() . "\n"; print "Updating note..."; $new_note->setBody("Testi"); $new_note->save(); $find_new_note = $hr->findNoteByID($new_note->id); if ($find_new_note->getBody() != $new_note->getBody()) { throw new Exception("Retrieving a note by ID failed"); } $notes = $person->getNotes(); foreach ($notes as $note) { if ($note->body == "Testi") {
public function get_note($id) { $xml = $this->make_request('notes/' . $id); $this->check_for_errors('Note'); $xml_object = simplexml_load_string($xml); $note = new HighriseNote($this); $note->load_from_xml_object($xml_object); return $note; }
public function get_notes() { $this->notes = array(); $xml = $this->make_request($this->url_base . '/' . $this->id . '/notes'); $xml_object = simplexml_load_string($xml); if ($this->debug) { print_r($xml_object); } if (isset($xml_object->note) && count($xml_object->note) > 0) { foreach ($xml_object->note as $_note) { $note = new HighriseNote($this->highrise); $note->load_from_xml_object($_note); $note->set_subject_id($this->id); $note->set_subject_id('Party'); $this->notes[$note->id] = $note; } } return $this->notes; }