本文整理匯總了PHP中Tasks::add_task方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tasks::add_task方法的具體用法?PHP Tasks::add_task怎麽用?PHP Tasks::add_task使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Tasks
的用法示例。
在下文中一共展示了Tasks::add_task方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testEditTask
public function testEditTask()
{
$t = new Tasks();
$t->add_task('titre', 'description', 'toto');
$tasks = $t->get_tasks();
$t->edit_task(count($tasks) - 1, 'titre2', 'description2', 'toto2', 1);
$tasks = $t->get_tasks();
$this->assertEquals($tasks[count($tasks) - 1]['title'], 'titre2');
$this->assertEquals($tasks[count($tasks) - 1]['description'], 'description2');
$this->assertEquals($tasks[count($tasks) - 1]['user'], 'toto2');
$this->assertEquals($tasks[count($tasks) - 1]['state'], 1);
$t->remove_task(count($tasks) - 1);
}
示例2: Tasks
if (!isset($_SESSION)) {
session_start();
}
require_once '../../classes/tasks.php';
require_once '../../classes/authentification.php';
$tasks = new Tasks();
$auth = new Authentification();
$id_connected = $auth->is_connected();
if (!$id_connected['loggedIn']) {
return;
}
$params = json_decode(file_get_contents('php://input'), true);
switch ($params['action']) {
//--------------- ADD_TASKS --------------
case 'add_task':
$tasks->add_task($params['task']['title'], strip_tags($params['task']['description']), $params['task']['user'], $params['task']['state']);
break;
//--------------- EDIT_TASKS --------------
//--------------- EDIT_TASKS --------------
case 'edit_task':
$tasks->edit_task($params['id'], $params['task']['title'], strip_tags($params['task']['description']), $params['task']['user'], $params['task']['state']);
break;
//--------------- DELETE_TASK -----------------------------
//--------------- DELETE_TASK -----------------------------
case 'delete_task':
$tasks->remove_task($params['id']);
break;
}
$tasks = $tasks->get_tasks();
$todo = array();
$inprogress = array();