/**
  * index method
  *
  * @return void
  */
 public function follow_expedient($idE = null)
 {
     App::uses('CakeTime', 'Utility');
     $confirmas = $this->Confirma->Expediente->find('all', array('conditions' => array('Expediente.user_id' => $idE)));
     if (isset($confirmas[0]['Expediente']['previsao_chegada']) && !empty($confirmas[0]['Expediente']['previsao_chegada'])) {
         if (CakeTime::isToday($confirmas[0]['Expediente']['previsao_chegada'])) {
             /* greet user with a happy birthday message
                  Enviar um email alertando sobre a data quase vencida.
                */
             $vence_hoje = 'Chega Hoje';
             if (isset($vence_hoje) && empty($vence_hoje)) {
                 $vence_hoje = '';
             }
             $this->set('vence_hoje', $vence_hoje);
         }
     }
     $this->set(compact('confirmas', 'idE'));
 }
 /**
  *    Days in theme
  *    @param int $theme_id
  */
 public function days($theme_id = null, $user_id = null)
 {
     if (!$theme_id) {
         return;
     }
     $options = array('recursive' => -1, 'conditions' => array('Day.theme_id' => $theme_id), 'order' => array('data ASC'));
     $rows = $this->Day->find('all', $options);
     foreach ($rows as $key => $row) {
         $row['Day']['isFuture'] = false;
         $row['Day']['isPast'] = false;
         $row['Day']['isToday'] = false;
         $row['Day']['comments'] = $this->Comment->find('count', array('conditions' => array('Comment.user_id' => !$this->isUser() ? $user_id : $this->getUserId(), 'Comment.day_id' => $row['Day']['id'])));
         if (CakeTime::isFuture($row['Day']['data'])) {
             $row['Day']['isFuture'] = true;
         }
         if (CakeTime::isPast($row['Day']['data'])) {
             $row['Day']['isPast'] = true;
         }
         if (CakeTime::isToday($row['Day']['data'])) {
             $row['Day']['isToday'] = true;
         }
         $data[] = $row['Day'];
     }
     $this->set($data);
     $this->set('_serialize', array_keys($data));
 }
Exemple #3
0
 /**
  * Returns true if given datetime string is today.
  *
  * @param int|string|DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object
  * @param string|DateTimeZone $timezone   User's timezone string or DateTimeZone object
  *
  * @return bool True if datetime string is today
  * @see  CakeTime::isToday()
  * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#testing-time
  */
 public function isToday($dateString, $timezone = NULL)
 {
     return $this->_engine->isToday($dateString, $timezone);
 }