/** * get simple list of locations * * @version 1.0 * @since 1.0 * @author Daniel Noel-Davies * * @return array */ public static function getSimple() { $staffLocations = Client::request('staff/location'); $staffLocations = array_map(function ($location) { return $location['name']; }, $staffLocations); return $staffLocations; }
/** * Get a job by it's id * * @version 1.0 * @since 1.0 * @author Daniel Noel-Davies * * @param integer $jobId A id that corresponds to a job within Traffic Live * * @return Models\Jobs */ public static function getByFreeTag($freeTagId) { $jobs = Client::request('job', ['filter' => 'freeTags|IN|[' . $freeTagId . ']']); if (empty($jobs)) { return null; } return array_map(function ($job) { return new Job($job); }, $jobs); }
/** * Get time entries by a job id * * @version 1.0 * @since 1.0 * @author Daniel Noel-Davies * * @param integer $jobId A id that corresponds to a job within Traffic Live * * @return Models\Job */ public static function getByJobId($jobId, $startDate, $endDate) { // Attempt to fetch the jobs in this job and time stretch try { $entries = Client::request('timeentries', ['filter' => 'jobId|IN|[' . $jobId . ']', 'startDate' => $startDate, 'endDate' => $endDate]); return array_map(function ($entry) { return new TimeEntry($entry); }, TimeEntries::$entries); } catch (\Exception $e) { return false; } }
/** * Get a StaffEmployees by it's id * * @version 1.0 * @since 1.0 * @author Daniel Noel-Davies * * @param integer $StaffEmployeesId A id that corresponds to a StaffEmployees within Traffic Live * * @return Models\StaffEmployees */ public function getById($StaffEmployeeId) { $StaffEmployees = Client::request('staff/employee/' . $StaffEmployeesId); return new StaffEmployee($StaffEmployees); }
/** * Get a job by it's id * * @version 1.0 * @since 1.0 * @author Daniel Noel-Davies * * @param integer $jobId A id that corresponds to a job within Traffic Live * * @return Models\Job */ public static function getById($tagId) { $job = Client::request('tag/' . $tagId); return new Job($job); }
/** * Get a job by it's id * * @version 1.0 * @since 1.0 * @author Daniel Noel-Davies * * @param integer $jobId A id that corresponds to a job within Traffic Live * * @return Models\Job */ public static function getById($jobId) { $jobDetail = Client::request('jobdetail/' . $jobId); return new JobDetail($jobDetail); }
/** * Get a job by it's id * * @version 1.0 * @since 1.0 * @author Daniel Noel-Davies * * @param integer $jobId A id that corresponds to a job within Traffic Live * * @return Models\Job */ public function getById($jobId) { $job = Client::request('job/' . $jobId); return new Job($job); }