Esempio n. 1
0
 public function fetchAll()
 {
     $entries = array();
     $table = $this->getDbTable();
     $select = $table->select();
     $select->setIntegrityCheck(false);
     $select->from(array('pvs' => 'events'), array('id', 'operation_id', 'type_id', 'action_id', 'schedule', 'assigned_operator_id', 'comments'));
     $select->join(array('ete' => 'event_type'), 'pvs.type_id = ete.id', array('name as type_name'));
     $select->join(array('ean' => 'event_action'), 'pvs.action_id = ean.id', array('name as action_name'));
     $select->where('pvs.status = ?', true);
     $select->order('pvs.id ASC');
     $resultSet = $table->fetchAll($select);
     foreach ($resultSet as $row) {
         $entry = new Gyuser_Model_Events();
         $entry->setId($row->id);
         $entry->setOperation_id($row->operation_id);
         $entry->setType_id($row->type_id);
         $entry->setType_name($row->type_name);
         $entry->setAction_id($row->action_id);
         $entry->setAction_name($row->action_name);
         $entry->setSchedule(date("d/m/Y", strtotime($row->schedule)));
         $entry->setAssigned_operator_id($row->assigned_operator_id);
         $entry->setComments($row->comments);
         $entries[] = $entry;
     }
     return $entries;
 }
Esempio n. 2
0
 public function eventformajaxAction()
 {
     try {
         $request = $this->getRequest();
         if ($this->getRequest()->isPost()) {
             $mapper = new Gyuser_Model_EventsDataMapper();
             $Obj = new Gyuser_Model_Events();
             list($Day, $Month, $Year) = explode('/', $request->schedule);
             $stampeddate = mktime(12, 0, 0, $Month, $Day, $Year);
             $realDate = date("Y-m-d", $stampeddate);
             $Obj->setOperation_id($request->operation_id);
             $Obj->setType_id($request->type_id);
             $Obj->setAction_id($request->action_id);
             $Obj->setSchedule($realDate);
             $Obj->setAssigned_operator_id($request->assigned_operator_id);
             $Obj->setComments($request->comments);
             if ($request->id) {
                 $Obj->setId($request->id);
             }
             $this->_helper->layout->disableLayout();
             $this->_helper->viewRenderer->setNoRender();
             $id = $mapper->save($Obj);
             if ($id) {
                 echo $id;
             } else {
                 echo "f";
             }
         }
     } catch (Exception $e) {
     }
 }