Beispiel #1
0
 /**
  * Load all a user's todos, deleting any for issues that have been reassigned.
  */
 public static function load_user_todos($user_id = 0)
 {
     $return = array();
     if (!$user_id) {
         $user_id = Auth::user()->id;
     }
     $todos = Todo::where('user_id', '=', $user_id)->order_by('updated_at', 'DESC')->get();
     foreach ($todos as $todo) {
         Todo::load_todo_extras($todo);
         // Close the todo if the issue has been closed.
         if ($todo->issue_status == 0 && $todo->status > 0) {
             $todo->status = 0;
             Todo::update_todo($todo->issue_id, 0);
         }
         // Remove the todo if the issue has been reassigned.
         if ($todo->attributes['assigned_to'] == $user_id) {
             $return[$todo->attributes['id']] = $todo->attributes;
         } else {
             Todo::remove_todo($todo->issue_id);
         }
     }
     return $return;
 }
Beispiel #2
0
 public function post_update_todo()
 {
     $result = Todo::update_todo(Input::get('issue_id'), Input::get('new_status'));
     return json_encode($result);
 }