| Current Path : /home/emeraadmin/public_html/test/emeraltd_prod/Service/ |
| Current File : /home/emeraadmin/public_html/test/emeraltd_prod/Service/TaskFormService.php |
<?php
require_once __DIR__ . '/../Classes/Database.php';
require_once __DIR__ . '/../Classes/TaskForm.php';
class TaskFormService
{
private $db;
public function __construct()
{
$this->db = new Database();
}
public function insertTaskForm($taskForm)
{
$this->db->query('INSERT INTO form_submissions (subtask_id, school_name, date, time, main_areas, notes, client_name, staff_name, client_signature, staff_signature, completion_time, latitude, longitude) VALUES (:subtask_id, :school_name, :date, :time, :main_areas, :notes, :client_name, :staff_name, :client_signature, :staff_signature, :completion_time, :latitude, :longitude)');
$this->db->bind(':subtask_id', $taskForm->subtask_id);
$this->db->bind(':school_name', $taskForm->school_name);
$this->db->bind(':date', $taskForm->date);
$this->db->bind(':time', $taskForm->time);
$this->db->bind(':main_areas', $taskForm->main_areas);
$this->db->bind(':notes', $taskForm->notes);
$this->db->bind(':client_name', $taskForm->client_name);
$this->db->bind(':staff_name', $taskForm->staff_name);
$this->db->bind(':client_signature', $taskForm->client_signature);
$this->db->bind(':staff_signature', $taskForm->staff_signature);
$this->db->bind(':completion_time', $taskForm->completion_time);
$this->db->bind(':latitude', $taskForm->latitude);
$this->db->bind(':longitude', $taskForm->longitude);
if ($this->db->execute()) {
return true;
} else {
return false;
}
}
public function getTaskFormById($id)
{
$this->db->query('SELECT * FROM form_submissions WHERE id = :id');
$this->db->bind(':id', $id);
return $this->db->single();
}
}