Example #1
0
 public function getEndDatetimeUtc()
 {
     $datetime = $this->endDay . ' ' . $this->endTime;
     if ($this->timezone && $this->endTime && $this->endDay) {
         return $this->endDatetimeUtc = \Eva\Date\Date::getBefore($this->timezone * 3600, $datetime, 'Y-m-d H:i:s');
     }
     return $this->endDatetimeUtc = $datetime;
 }
 public function offlineAction()
 {
     $this->changeViewModel('json');
     $itemModel = Api::_()->getModel('User\\Model\\User');
     $config = Api::_()->getConfig();
     $onlineToOfflineTime = $config['user']['online_to_offline_time'];
     $onlineToOfflineTime = \Eva\Date\Date::getBefore($onlineToOfflineTime, null, 'Y-m-d H:i:s');
     $dataClass = $itemModel->getItem()->getDataClass();
     $dataClass->where(function ($where) use($onlineToOfflineTime) {
         $where->lessThan('lastFreshTime', $onlineToOfflineTime);
         return $where;
     })->save(array('onlineStatus' => 'offline'));
     return new JsonModel();
 }