Created
September 3, 2013 21:08
-
-
Save andyhawthorne/6429622 to your computer and use it in GitHub Desktop.
This file contains 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) | |
{ | |
$sql = "SELECT DAY(due) As day, due, title FROM tasks_list WHERE MONTH(due) = " . $month; | |
$q = $this->db->query($sql); | |
$num = $q->num_rows(); | |
if($num > 0) | |
{ | |
foreach($q->result() as $row) | |
{ | |
$data[] = $row; | |
} | |
foreach($data as $d) | |
{ | |
$out[$d->day] = (int)$d->day; | |
$out[$d->day] = "http://tasks.dev/welcome/show/" . date('Y/m/d', strtotime($d->due)); | |
} | |
return $out; | |
} | |
else | |
{ | |
return 0; | |
} | |
} | |
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; | |
} | |
return $data; | |
} | |
else | |
{ | |
return 0; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment