70 lines
2.4 KiB
PHP
70 lines
2.4 KiB
PHP
<?php
|
|
// class Todo
|
|
// {
|
|
// private $todo_id;
|
|
// private $user_id;
|
|
// private $task;
|
|
// private $description;
|
|
// private $priority;
|
|
// private $due_date;
|
|
// private $category;
|
|
// private $status;
|
|
// private $created_at;
|
|
// private $update_at;
|
|
// private $completed_at;
|
|
// private $is_recurring;
|
|
// private $recurrence_rule;
|
|
// private $reminder_at;
|
|
//
|
|
// function __construct(
|
|
// $todo_id,
|
|
// $user_id,
|
|
// $task,
|
|
// $description,
|
|
// $priority,
|
|
// $due_date,
|
|
// $category,
|
|
// $status,
|
|
// $created_at,
|
|
// $update_at,
|
|
// $completed_at,
|
|
// $is_recurring,
|
|
// $recurrence_rule,
|
|
// $reminder_at,
|
|
// ) {
|
|
// $this->todo_id = $todo_id;
|
|
// $this->user_id = $user_id;
|
|
// $this->task = $task;
|
|
// $this->description = $description;
|
|
// $this->priority = $priority;
|
|
// $this->due_date = $due_date;
|
|
// $this->category = $category;
|
|
// $this->status = $status;
|
|
// $this->created_at = $created_at;
|
|
// $this->update_at = $update_at;
|
|
// $this->completed_at = $completed_at;
|
|
// $this->is_recurring = $is_recurring;
|
|
// $this->recurrence_rule = $recurrence_rule;
|
|
// $this->reminder_at = $reminder_at;
|
|
// }
|
|
// }
|
|
|
|
function change_status($todo_id, $status)
|
|
{
|
|
exec_stmt('UPDATE todos SET status = ? WHERE todo_id = ?', 'si', $status, $todo_id);
|
|
}
|
|
|
|
function create_todo($todo)
|
|
{
|
|
exec_stmt('INSERT INTO todos (title, description, priority, due_date, category, status) VALUES (?,?,?,?,?,?)', 'ssssss', $todo['title'], $todo['description'], $todo['priority'], $todo['due_date'], $todo['category'], 'open');
|
|
}
|
|
function update_todo($todo_id, $todo)
|
|
{
|
|
exec_stmt('UPDATE todos SET title = ? WHERE todo_id = ?', 'si', $todo['title'], $todo_id);
|
|
exec_stmt('UPDATE todos SET description = ? WHERE todo_id = ?', 'si', $todo['description'], $todo_id);
|
|
exec_stmt('UPDATE todos SET priority = ? WHERE todo_id = ?', 'si', $todo['priority'], $todo_id);
|
|
exec_stmt('UPDATE todos SET due_date = ? WHERE todo_id = ?', 'si', $todo['due_date'], $todo_id);
|
|
exec_stmt('UPDATE todos SET category = ? WHERE todo_id = ?', 'si', $todo['category'], $todo_id);
|
|
exec_stmt('UPDATE todos SET status = ? WHERE todo_id = ?', 'si', $todo['status'], $todo_id);
|
|
}
|