예제 #1
0
 public function run()
 {
     $list = new TaskList();
     $list->name = 'My first list';
     $list->user_id = 1;
     $list->save();
 }
 public function handleStartTaskListCommand(Commands\StartTaskListCommand $command)
 {
     $taskList = TaskList::start(TaskListId::generate());
     foreach ($command->tasks as $task) {
         $taskList->add(TaskId::generate(), $task);
     }
     $this->taskListRepository->save($taskList);
 }
예제 #3
0
 public static function getAllOutstandingCount($user_id)
 {
     $count = 0;
     foreach (TaskList::get($where = array('user_id' => $user_id)) as $tasklist) {
         $count += count(Task::get($where = array('list_id' => $tasklist->getId(), 'complete' => '0')));
     }
     return $count;
 }
예제 #4
0
  <body>
	
	<?php 
navbar();
?>
	
    <div class="container" role="main">
	    
    <h1 align="center" class="home-greeting-text"> <?php 
echo date('l jS M Y');
?>
</h1>
    
    <p class="lead">You have <?php 
echo TaskList::getAllOutstandingCount(Authentication::get_user());
?>
 tasks outstanding.</p>
    
    <h2>Your Timetable</h2>
	<?php 
print_timetable_by_week(Authentication::get_user(), $week_block);
?>
	    
	</div>
	
	
	<?php 
foot();
?>
  </body>
예제 #5
0
        $task = $list->tasks()->find($id);
        if (!$task) {
            App::abort(404);
        }
        return Response::json($task->toArray());
    })->where('list_id', '\\d+')->where('id', '\\d+');
    // Update task
    Route::put('lists/{list_id}/tasks/{id}', function ($list_id, $id) {
        $list = TaskList::findByOwnerAndId(Auth::user(), $list_id);
        $task = $list->tasks()->find($id);
        if (!$task) {
            App::abort(404);
        }
        $task->fill(Input::get());
        $task->validate();
        if (!$task->save()) {
            App::abort(500, 'Task was not updated');
        }
        return Response::json($task->toArray());
    })->where('list_id', '\\d+')->where('id', '\\d+');
    // Delete task
    Route::delete('lists/{list_id}/tasks/{id}', function ($list_id, $id) {
        $list = TaskList::findByOwnerAndId(Auth::user(), $list_id);
        $task = $list->tasks()->find($id);
        if (!$task) {
            App::abort(404);
        }
        $task->delete();
        return Response::make(null, 204);
    })->where('list_id', '\\d+')->where('id', '\\d+');
});
예제 #6
0
     } else {
         echo json_encode(array('status' => 'error', 'reason' => 'Task description not supplied.'));
     }
 } else {
     if ($_POST['action'] == "new_list") {
         if (isset($_POST['name'])) {
             if (empty(trim($_POST['name']))) {
                 echo json_encode(array('status' => 'validation', 'reason' => 'Your task list name is empty!'));
                 die;
             }
             /*if (strlen($_POST['name']) > 32)
             		{
             			echo json_encode(array('status'=>'validation', 'reason' => 'Your task list name is too long!'));
             			die();
             		}*/
             $tasklist = new TaskList();
             $tasklist->setUserId(Authentication::getUserObject()->getId());
             $tasklist->setName($_POST['name']);
             $tasklist->setIcon($_POST['icon']);
             $tasklist->save();
             echo json_encode(array('status' => 'success', 'tasklist-id' => $tasklist->getId()));
         } else {
             echo json_encode(array('status' => 'error', 'reason' => 'List name not supplied.'));
         }
     } else {
         if ($_POST['action'] == "delete_list") {
             if (isset($_POST['id'])) {
                 $list = TaskList::get($where = array('id' => $_POST['id']))[0];
                 foreach (Task::get($where = array('list_id' => $list->getId())) as $task) {
                     $task->delete();
                 }
예제 #7
0
파일: ui.php 프로젝트: ryunoneil/a2-comp4
function navbar($active = 0)
{
    ?>
        
        <nav class="navbar navbar-default navbar-fixed-top">
		<div class="container">
		     <div class="navbar-header">
              <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#dk-nav-collapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
              </button>
              <span class="navbar-brand" href="#">Planner</span>
            </div>

			<div class="collapse navbar-collapse menu-text" id="dk-nav-collapse">
				
				<ul class="nav navbar-nav">
					<li <?php 
    if ($active == 0) {
        ?>
class="active"<?php 
    }
    ?>
><a href="<?php 
    if ($active == 0) {
        ?>
#<?php 
    } else {
        ?>
index.php<?php 
    }
    ?>
"><span class="glyphicon glyphicon-home" aria-hidden="true"></span>&nbsp;Home <!--<span class="sr-only">(current)</span>--></a></li>
					<li <?php 
    if ($active == 1) {
        ?>
class="active"<?php 
    }
    ?>
><a href="<?php 
    if ($active == 1) {
        ?>
#<?php 
    } else {
        ?>
timetable.php<?php 
    }
    ?>
"><span class="fa fa-table" aria-hidden="true"></span>&nbsp;Timetable</a></li>
					<li <?php 
    if ($active == 2) {
        ?>
class="active"<?php 
    }
    ?>
><a href="<?php 
    if ($active == 2) {
        ?>
#<?php 
    } else {
        ?>
tasks.php<?php 
    }
    ?>
"><span class="fa fa-check" aria-hidden="true"></span>&nbsp;Tasks <span class="badge"><?php 
    echo TaskList::getAllOutstandingCount(Authentication::get_user());
    ?>
</span></a></li>
					<li <?php 
    if ($active == 4) {
        ?>
class="active"<?php 
    }
    ?>
><a href="<?php 
    if ($active == 4) {
        ?>
#<?php 
    } else {
        ?>
calendar.php<?php 
    }
    ?>
"><span class="glyphicon glyphicon-calendar" aria-hidden="true"></span>&nbsp;Calendar</a></li>
					<li <?php 
    if ($active == 3) {
        ?>
class="active"<?php 
    }
    ?>
><a href="<?php 
    if ($active == 3) {
        ?>
#<?php 
    } else {
        ?>
profile.php<?php 
    }
    ?>
"><span class="glyphicon glyphicon-user" aria-hidden="true"></span>&nbsp;You</a></li>
				</ul>
				
				<ul class="nav navbar-nav navbar-right">
					<li><a href="/<?php 
    echo APP_LOGOUT_LOC;
    ?>
"><i class="fa fa-sign-out"></i>&nbsp;Log out <?php 
    echo Authentication::getUserObject()->getUsername();
    ?>
</a></li>
				</ul>
			</div>
		</div>
	</nav>    
    
        
        <?php 
}