/** * get a user's active time entry * * <code> * $api = new HarvestReports(); * * $result = $api->getUsersActiveTimer( 12345 ); * if( $result->isSuccess() ) { * $activeTimer = $result->data; * } * </code> * * @return Harvest_Result */ public function getUsersActiveTimer($user_id) { $result = $this->getUserEntries($user_id, Harvest_Range::today($this->_timeZone)); if ($result->isSuccess()) { $data = null; foreach ($result->data as $entry) { if ($entry->timer_started_at != null || $entry->timer_started_at != "") { $data = $entry; break; } } $result->data = $data; } return $result; }
/** * get all user expenses for given time range * * <code> * $range = new Harvest_Range( "20090712", "20090719" ); * $user_id = 11111; * * $api = new HarvestAPI(); * * $result = $api->getUserExpenses( $user_id, $range ); * if( $result->isSuccess() ) { * $expenses = $result->data; * } * </code> * * @param int $user_id User Identifier * @param Harvest_Range $range Time Range * @return Harvest_Result */ public function getUserExpenses($user_id, Harvest_Range $range) { $url = "people/" . $user_id . "/expenses?from=" . $range->from() . '&to=' . $range->to(); return $this->performGET($url, true); }