This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteCond %{SERVER_PORT} 80 | |
#Removes access to the system folder by users. | |
#Additionally this will allow you to create a System.php controller, | |
#previously this would not have been possible. | |
#'system' can be replaced if you have renamed your system folder. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function day_tasks($day) | |
{ | |
$sql = "SELECT * FROM tasks_list WHERE due = '" . $day . "'"; | |
$q = $this->db->query($sql); | |
if($q->num_rows() > 0) | |
{ | |
foreach($q->result() as $row) | |
{ | |
$data[] = $row; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function show() | |
{ | |
$year = $this->uri->segment(3); | |
$month = $this->uri->segment(4); | |
$day = $this->uri->segment(5); | |
$date = $year . '-' . $month . '-' . $day; | |
$data['day'] = date('d/m/Y', strtotime($date)); | |
$data['tasks'] = $this->tasks_model->day_tasks($date); | |
$this->load->view('show', $data); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Tasks_Model extends CI_Model | |
{ | |
public function __construct() | |
{ | |
parent:: __construct(); | |
} | |
public function get_tasks($month) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function index() | |
{ | |
$month = (!$this->uri->segment(4)) ? date('m') : $this->uri->segment(4); | |
$tasks = $this->tasks_model->get_tasks($month); | |
if($tasks == 0) | |
{ | |
$data['cal'] = $this->calendar->generate($this->uri->segment(3), $this->uri->segment(4)); | |
} | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Welcome extends CI_Controller | |
{ | |
public function __construct() | |
{ | |
parent:: __construct(); | |
$this->load->model('tasks_model'); | |
$prefs = array ( | |
'show_next_prev' => TRUE, | |
'next_prev_url' => 'http://tasks.dev/welcome/index' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE `tasks_list` ( | |
`id` int(11) unsigned NOT NULL AUTO_INCREMENT, | |
`title` varchar(200) DEFAULT NULL, | |
`body` text, | |
`due` date DEFAULT NULL, | |
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | |
`completed` tinyint(1) NOT NULL DEFAULT '0', | |
PRIMARY KEY (`id`) | |
) ENGINE=InnoDB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require './main' | |
run Sinatra::Application |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require './main' | |
run Sinatra::Application |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source :rubygems | |
gem 'sinatra' | |
gem 'rdiscount' | |
gem 'data_mapper' | |
gem 'dm-migrations' | |
gem 'pony' | |
gem 'dm-postgres-adapter', :group => :production | |
gem 'dm-sqlite-adapter', :group => :development | |
group :production do | |
gem 'pg', '0.14.1' |