Пример #1
0
 public function addEventAction()
 {
     try {
         $eventData = array('imei' => $this->getRequest()->getParam('uID'), 'activity_id' => $this->getRequest()->getParam('act'), 'lat' => $this->getRequest()->getParam('lat'), 'long' => $this->getRequest()->getParam('long'), 'date' => $this->_applyDate($this->getRequest()->getParam('time')));
         $img_64 = $this->getRequest()->getParam('img');
         $uniqid = uniqid($eventData['imei'] . '-');
         $file_path = app::getConfig("dir/sd") . 'event' . DS . 'img' . DS . date('Y') . DS . date('m') . DS . date('d') . DS . $uniqid . '.jpg';
         $file_url = 'sd' . DS . 'event' . DS . 'img' . DS . date('Y') . DS . date('m') . DS . date('d') . DS . $uniqid . '.jpg';
         core_fs::createDirIfNotExists(dirname($file_path));
         $this->_saveRequestImage($file_path, $img_64);
         $eventData['image'] = $file_url;
         $event = new manage_model_event();
         $event->setData($eventData);
         $event->save();
         core_log::log($event->getData(), 'event/' . date('d-m-Y') . 'events.added.log');
         $this->_xhrOk();
     } catch (Exception $e) {
         $request = $_REQUEST;
         unset($request['img']);
         $request['img'] = $file_path;
         core_log::logException($e);
         core_log::log($request, 'event/' . date('d-m-Y') . 'events.request.log');
         core_log::log($e->getMessage(), 'event/' . date('d-m-Y') . 'events.error.log');
         $this->_xhrErr('err: see exception log');
     }
 }
Пример #2
0
 public function rndAction()
 {
     for ($i = 0; $i < 100; $i++) {
         $lt = rand(1, 10);
         $lng = rand(1, 10);
         $a = rand(1, 3);
         $u = rand(24, 27);
         $c = rand(1, 4);
         $e = new manage_model_event();
         $data = array('lat' => 49.26 + $lt / 10, 'long' => 27.69 + $lng / 10, 'user_id' => $u, 'activity_id' => $a, 'city_id' => $c, 'date' => strtotime(rand(1, 29) . '.' . rand(1, 7) . '.' . '2015'), 'marker_color' => '#efefef');
         $e->setData($data);
         core_debug::dump($e);
         $e->save();
     }
 }
Пример #3
0
 protected function _email2event($email)
 {
     $bodyData = $this->_pareseEmailBodyCsv($email['csv'], $email['csv_orig']);
     $eventData = array_merge(array('email_number' => $email['email_number'], 'image' => 'sd/' . $email['full_filename']), $bodyData);
     $event = new manage_model_event();
     $event->setData($eventData)->save();
     return $event;
 }