| @@ 71-87 (lines=17) @@ | ||
| 68 | return $res; |
|
| 69 | } |
|
| 70 | ||
| 71 | public function deleteTimer($timerId = null) |
|
| 72 | { |
|
| 73 | $res = false; |
|
| 74 | ||
| 75 | if ($this->serviceApiCall->send('delete', 'delete/' . $timerId) === true) { |
|
| 76 | if ($this->serviceApiCall->last('success') === true) { |
|
| 77 | $this->setMessage('timer deleted'); |
|
| 78 | $res = true; |
|
| 79 | } else { |
|
| 80 | $this->setMessage('could not delete timer!'); |
|
| 81 | } |
|
| 82 | } else { |
|
| 83 | $this->setMessage($this->serviceApiCall->getMessage()); |
|
| 84 | } |
|
| 85 | ||
| 86 | return $res; |
|
| 87 | } |
|
| 88 | ||
| 89 | private function isTimerRunning($timerId) |
|
| 90 | { |
|
| @@ 89-104 (lines=16) @@ | ||
| 86 | return $res; |
|
| 87 | } |
|
| 88 | ||
| 89 | private function isTimerRunning($timerId) |
|
| 90 | { |
|
| 91 | $res = false; |
|
| 92 | ||
| 93 | if ($this->serviceApiCall->send('get', 'show/' . $timerId) === true) { |
|
| 94 | if ($this->serviceApiCall->last('success') === true) { |
|
| 95 | if (isset($this->serviceApiCall->getData()['timer_started_at']) === true) { |
|
| 96 | $res = true; |
|
| 97 | } |
|
| 98 | } |
|
| 99 | } else { |
|
| 100 | $this->setMessage($this->serviceApiCall->getMessage()); |
|
| 101 | } |
|
| 102 | ||
| 103 | return $res; |
|
| 104 | } |
|
| 105 | ||
| 106 | public function getLastMessage() |
|
| 107 | { |
|
| @@ 52-68 (lines=17) @@ | ||
| 49 | return $togglId; |
|
| 50 | } |
|
| 51 | ||
| 52 | public function stopTimer($timerId = null) |
|
| 53 | { |
|
| 54 | $res = false; |
|
| 55 | ||
| 56 | if ($this->serviceApiCall->send('put', 'time_entries/' . $timerId . '/stop') === true) { |
|
| 57 | if ($this->serviceApiCall->last('success') === true) { |
|
| 58 | $this->setMessage('timer stopped'); |
|
| 59 | $res = true; |
|
| 60 | } else { |
|
| 61 | $this->setMessage('could not stop timer!'); |
|
| 62 | } |
|
| 63 | } else { |
|
| 64 | $this->setMessage($this->serviceApiCall->getMessage()); |
|
| 65 | } |
|
| 66 | ||
| 67 | return $res; |
|
| 68 | } |
|
| 69 | ||
| 70 | public function deleteTimer($timerId = null) |
|
| 71 | { |
|
| @@ 70-86 (lines=17) @@ | ||
| 67 | return $res; |
|
| 68 | } |
|
| 69 | ||
| 70 | public function deleteTimer($timerId = null) |
|
| 71 | { |
|
| 72 | $res = false; |
|
| 73 | ||
| 74 | if ($this->serviceApiCall->send('delete', 'time_entries/' . $timerId) === true) { |
|
| 75 | if ($this->serviceApiCall->last('success') === true) { |
|
| 76 | $this->setMessage('timer deleted'); |
|
| 77 | $res = true; |
|
| 78 | } else { |
|
| 79 | $this->setMessage('could not delete timer!'); |
|
| 80 | } |
|
| 81 | } else { |
|
| 82 | $this->setMessage($this->serviceApiCall->getMessage()); |
|
| 83 | } |
|
| 84 | ||
| 85 | return $res; |
|
| 86 | } |
|
| 87 | ||
| 88 | public function getRecentTimers() |
|
| 89 | { |
|