Example #1
0
 public function affWebViewApiAction()
 {
     $vals = array('beacon_ref' => $_GET['beacon_key']);
     $estimote = Model\Estimote::find($vals);
     $content = $estimote->getContent();
     return array('content' => $content);
 }
Example #2
0
 public function modifAction($params)
 {
     $estimote = Model\Estimote::find($params['id']);
     $form = new Form\ModifEstimote($_POST, array('db' => $this->db));
     if ($this->method == 'POST' && $form->isValid()) {
         $estimote->setValues($form->getValues());
         $estimote['user_id'] = $this->session->getUser()->getPk();
         $estimote->save();
         $this->redirect('backoffice');
     }
     return array('form' => $form, 'estimote' => $estimote);
 }
Example #3
0
 public function averageTimeAction()
 {
     $vals = array('id' => $_GET['id']);
     $estimote = Model\Estimote::find($vals);
     $esti_ref = $estimote->getRef();
     $averageTimeSpent = $this->db->query("SELECT AVG(time) as average, date_pass FROM esti_time WHERE beacon_ref = '{$esti_ref}' GROUP BY date_pass");
     $averageTimeSpent = $averageTimeSpent->fetchAll();
     $return2 = "";
     foreach ($averageTimeSpent as $row2) {
         $day = explode('-', $row2["date_pass"]);
         $new_js_date = "new Date(" . $day[0] . "," . $day[1] . "," . $day[2] . "),";
         $return2 .= "[{$new_js_date}" . $row2['average'] . ", '#0080FF'],";
     }
     return array('return2' => $return2);
 }