本文整理汇总了PHP中Tasks::edit_task方法的典型用法代码示例。如果您正苦于以下问题:PHP Tasks::edit_task方法的具体用法?PHP Tasks::edit_task怎么用?PHP Tasks::edit_task使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tasks
的用法示例。
在下文中一共展示了Tasks::edit_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
$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();
$done = array();
foreach ($tasks as $key => $value) {
$value['id'] = $key;
switch ($value['state']) {
case 0: