There is only one model in this project, tasks_model.php
, that contains functions that are specific to searching and writing tasks to the database.
This is our one and only model for this project. Let's briefly go over each function in it to give us a general idea of what it does, and then we will go into more detail in the code.
There are five main functions in this model, which are as follows:
get_tasks()
: This serves two functions: firstly, to display all tasks—for example, when a user first visits the site and when a user enters a new task in the form.change_task_status()
: This changes thetasks.task_status
value in the database from eithertodo
ordone
. A task that is set todone
appears struck through in the list, whereas tasks that are set totodo
are not struck through and are displayed normally; this way, a user can easily work out what is done and not done.save_task()
: This saves a task to the database when a user submits the form from point 3 (the Create item...