PHP Classes

File: ToDoTest.php

Recommend this page to a friend!
  Classes of zinsou A.A.E.Mo´se   PHP TODO Tasks Manager   ToDoTest.php   Download  
File: ToDoTest.php
Role: Example script
Content type: text/plain
Description: example script
Class: PHP TODO Tasks Manager
Manage to do lists stored in CSV files
Author: By
Last change:
Date: 6 years ago
Size: 2,450 bytes


Class file image Download
/* create a TODO file*/
$x=new createToDo();//start your todo file; you can use your own one dimension array here to specify your heders
$x->setHeader();//add your headers
$x->add(0,["first","24-10-2018","","","","1"]);// add a thing to do
$x->add(1,["first2","24-10-2018","","","","1"]);// add a another thing to do
$x->change_pos(0,1);//change some todo position if necessary
$x->delete(0);//delete a todo by position if necessary
$x->makefile('todo.csv'); // make the todo file. Note that: this must always be the last statement .any statement before this won't be saved

/* manage a TODO file*/

$y=new manageToDo('todo.csv');// start you todo file manager
var_dump($y->get('todo','first')).'<br>';// get a value knowing header and row values
$y->check('first');//mark as done
echo $y->get('todo','first').'<br>';
$y->check('first');//mark as done
echo $y->get('todo','first').'<br>';;
// $y->delete('first');// delete a task
// $y->delete_checked();//delete all done tasks
$y->save();//save the modification
var_dump($z=$y->getHeader());//get the headers
var_dump($y->change_Header('todo','check'));//change a header value
$y->add(["first","24-10-2018","","","2","1"],true);/*add a task .
This become an edition instead of addition because
first already exists and ,the second parameter is true instead of false .
To avoid edition two option another name or pass false as second parameter

$y->add(["first3","24-10-2018","","","2","1"],true);//add a task
$y->add(["15","24-10-2018","","","2","1"],true);//add a task

$y->uncheck('15');//mark as undone
$y->uncheck('first3');//mark as undone

var_dump($y->add_Header('todo'));//add a new header
var_dump($y->add_Header('start'));var_dump($y->getHeader());//add a new header

echo $y->count_all().'<br>';

var_dump($y->get_checked());//get all done tasks;
var_dump($y->get_unchecked());//get all undone tasks;
$y->uncheck_checked();//make undone all done tasks;
$y->check_all();//mark all tasks as done

$y->edit('description','15','mama mia');// edit a task here we change the task 15's description

$y->save($z[0]);//always do this to be sure to save all your modifications and also to specify the first header in parameter to avoid primary id renaming.
// $y->delete_checked();