public function changeStatus($id)
 {
     $curStat = DB::table('todolist')->where('id', $id)->pluck('status');
     if ($curStat) {
         $curStat = 0;
     } else {
         $curStat = 1;
     }
     DB::table('todolist')->where('id', $id)->update(array('status' => $curStat));
     $records = ToDo::all();
     return View::make('/todo', array('records' => $records));
 }
Beispiel #2
0
<?php

define('INCLUDE_CHECK', true);
require "connect.php";
require "guions.class.php";
$id = (int) $_GET['id'];
$var_data = $_GET['data'];
$var_tipus = $_GET['tipus'];
try {
    switch ($_GET['action']) {
        case 'delete':
            ToDo::delete($id);
            break;
        case 'rearrange':
            ToDo::rearrange($_GET['positions'], $var_data);
            break;
        case 'edit':
            ToDo::edit($id, $_GET['text']);
            break;
        case 'new':
            ToDo::createNew($_GET['prova'], $var_data, $var_tipus);
            break;
    }
} catch (Exception $e) {
    //	echo $e->getMessage();
    die("0");
}
echo "1";
Beispiel #3
0
 /**
  * Executes addTodo action
  *
  */
 public function executeAjaxAddTodo()
 {
     $this->forward404Unless($this->getUser()->isAuthenticated());
     $todo = new ToDo();
     $todo->setName($this->getRequestParameter('name'));
     $todo->setDescription($this->getRequestParameter('description'));
     $todo->setOwnerId($this->getUser()->getId());
     $todo->setStatus(sfConfig::get('app_task_status_open'));
     if ($this->getRequestParameter('begin')) {
         list($d, $m, $y) = sfI18N::getDateForCulture($this->getRequestParameter('begin'), $this->getUser()->getCulture());
         $todo->setBegin("{$y}-{$m}-{$d}");
     }
     if ($this->getRequestParameter('finish')) {
         list($d, $m, $y) = sfI18N::getDateForCulture($this->getRequestParameter('finish'), $this->getUser()->getCulture());
         $todo->setFinish("{$y}-{$m}-{$d}");
     }
     $todo->save();
     $this->getUser()->getProfile()->addKarma(sfConfig::get('app_karma_complete_todo_points'));
 }
Beispiel #4
0
 public function addToDo(ToDo $l)
 {
     $this->collToDos[] = $l;
     $l->setsfGuardUser($this);
 }
Beispiel #5
0
 /**
  * Save {@link Todo}.
  * @param ToDo $todo {@link Todo} to be saved
  * @return Todo saved {@link Todo} instance
  */
 public function save(ToDo $todo)
 {
     if ($todo->getId() === null) {
         return $this->insert($todo);
     }
     return $this->update($todo);
 }
Beispiel #6
0
<?php

defined('__bbug') or die;
$list = new ToDo($this->db);
$list->todolists();
Beispiel #7
0
 function __construct($conn)
 {
     ToDo::$conn = $conn;
 }
Beispiel #8
0
<div class="main">
	<h2><i class="glyphicon glyphicon-circle-arrow-right"></i> ToDo App</h2>
	<div class="col-md-6">
		<form action="" method="post">
			<div class="input-group">
	      <input type="text" name="todo" class="form-control" placeholder="Type todo here">
	      <span class="inpu	t-group-btn">
	        <button class="btn btn-success" type="submit">Add</button>
	      </span>
	    </div>
	  </form>
	</div>

	<div class="col-md-6 todo">
		<ul>
		<?php 
// todo listing
foreach (ToDo::getItems() as $row) {
    echo '<li>' . $row['item'] . ' - ' . $row['date_time'] . '</li><a href = "?id=' . $row['tid'] . ' ">
				     <button>Delete</button></a>';
}
?>
		</ul>
	</div>

</div>


<?php 
include "inc/footer.php";
Beispiel #9
0
<?php

require "connect.php";
require "todo.class.php";
$id = (int) $_GET['id'];
try {
    switch ($_GET['action']) {
        case 'delete':
            ToDo::delete($id);
            break;
        case 'rearrange':
            ToDo::rearrange($_GET['positions']);
            break;
        case 'edit':
            ToDo::edit($id, $_GET['text']);
            break;
        case 'new':
            ToDo::createNew($_GET['text']);
            break;
    }
} catch (Exception $e) {
    //	echo $e->getMessage();
    die("0");
}
echo "1";
Beispiel #10
0
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
Route::get('/', function () {
    return View::make('hello');
});
Route::get('/about', function () {
    return View::make('about', array('users' => ['Sai Kiran', 'Siva Sagar', 'Madhu Sai']));
});
Route::get('/master', function () {
    return View::make('master');
});
Route::get('/login', function () {
    return View::make('login');
});
Route::get('/todo', function () {
    $records = Todo::all();
    return View::make('todo', array('records' => $records));
});
Route::post('/todo', function () {
    ToDo::create(['task' => Input::get('task'), 'status' => 0, 'deadline' => Input::get('deadline')]);
    return View::make('todo', array('records' => ToDo::all()));
});
Route::get('/changeStat/{id}', ['uses' => 'ToDoController@changeStatus']);
Route::get('/sn/login', function () {
    return View::make('social_network/login');
});