root / branches / 2.1.x / actions / CompleteTodo.php @ 1111

View | Annotate | Download (765 Bytes)

1
<?php
2
3
/*
4
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
5
* @license http://creativecommons.org/licenses/BSD/ BSD License
6
* @author Keyboard Monkeys Ltd.
7
* @since Sciret 1.2
8
* @package Sciret
9
* @packager Keyboard Monkeys
10
*/
11
12
require 'actions/Action.php';
13
14
class CompleteTodo extends Action {
15
16
    function dispatch() {
17
        $todo = new Kb_Model_Todo($_POST['todoId']);
18
        $jsonObj = new StdClass();
19
        if ($todo->getUserId() != $this->user->id) {
20
            $jsonObj->message = $this->user->lang('Cannot complete other people\'s todo\'s');
21
            exit;
22
        } else {
23
            $todo->setStatus(TODO_STATUS_COMPLETED);
24
            $todo->save();
25
        }
26
27
        echo Zend_Json::encode($jsonObj);
28
    }
29
}
30
31
?>
32