Ejemplo n.º 1
0
 public static function events($history, $subject = null)
 {
     $results = Queries::events($history, $subject);
     $now_pos = 0;
     foreach ($results as $index => $entry) {
         if ($entry->type === 'assignment' && strtotime($entry->date) < strtotime('now')) {
             $now_pos = $index + 1;
         } elseif (strtotime($entry->date) < strtotime('today')) {
             $now_pos = $index + 1;
         }
         if ($entry->type === 'assignment') {
             $entry->date = DateFormat::dateTimeTable($entry->date);
         } elseif ($entry->type === 'exam') {
             $entry->date = DateFormat::dateTable($entry->date);
         } elseif ($entry->type === 'planning') {
             $entry->date = DateFormat::dateTable($entry->date);
         }
     }
     $today = new stdClass();
     $today->todayRow = true;
     $today->id = 'today';
     $today->completion = false;
     $today->date = '<b>' . DateFormat::dateTimeTable() . '</b>';
     $today->type = '<b>-</b>';
     $today->subject_name = '</a><b>Today is a gift</b><a href="">';
     $today->task = '<b>Thats why it\'s called the present</b>';
     $today->state = '<b>-</b>';
     array_splice($results, $now_pos, 0, array($today));
     return $results;
 }