| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <?php
- class Call {
- private $id = NULL;
- private $callDate = NULL;
- private $callerTelNr = NULL;
- private $labelID = NULL;
- private $notes = NULL;
- private $reminderID = NULL;
- public function __construct($id, $callDate, $callerTelNr, $labelID, $notes, $reminderID) {
- $this->id = $id;
- $this->callDate = $callDate;
- $this->callerTelNr = $callerTelNr;
- $this->labelID = $labelID;
- $this->notes = $notes;
- $this->reminderID = $reminderID;
- }
- public function getID() {
- return $this->id;
- }
- public function getCallDate() {
- return $this->callDate;
- }
- public function getCallerTelNr() {
- return $this->callerTelNr;
- }
- public function getLabelID() {
- return $this->labelID;
- }
- public function getNotes() {
- return $this->notes;
- }
- public function getReminderID() {
- return $this->reminderID;
- }
- /**
- * Add a Call to DB
- *
- * @param string $callDate DateTime of Call
- * @param string $callerTelNr Telephone number of caller
- * @param int $labelID ID of Label
- * @param string $callNotes Taken notes of Call // TODO: check the english of this description
- * @param int $reminderID ID of the Call-reminder, default: -1 // TODO: -1 auto-adds reminder
- *
- * @return void
- *
- */
- public static function addCall($callDate, $callerTelNr, $labelID, $callNotes, $reminderID = -1) { // if reminder == -1 auto create one ?
- global $db;
- $db->insertQuery("INSERT INTO `calls`(`call_date`, `caller_telnr`, `label_id`, `notes`, `reminder_id`) VALUES ('" . $callDate . "', '" . $callerTelNr . "', " . $labelID . ", '" . $callNotes . "', " . $reminderID . ");");
- }
- /**
- * Get Call-Array by Label-ID
- *
- * @param int $labelID ID of Call-Label
- *
- * @return Array(Call) Array with selected Calls
- *
- */
- public static function getCallsByLabelID($labelID) {
- global $db;
- $calls = $db->selectQuery("SELECT * FROM `calls` WHERE `label_id` = " . $labelID . ";");
- $return = array();
- foreach($calls as $call) {
- $return[] = new Call($call->id, $call->call_date, $call->caller_telnr, $call->label_id, $call->notes, $call->reminder_id);
- }
- return $return;
- }
- }
- ?>
|