public function fetchAll()
 {
     $table = $this->getDbTable();
     $select = $table->select();
     $select->from($table, array('id', 'name'));
     $select->where('status = ?', true);
     $select->order('name ASC');
     $resultSet = $table->fetchAll($select);
     $entries = array();
     foreach ($resultSet as $row) {
         $entry = new Gyuser_Model_PriorOperations();
         $entry->setId($row->id);
         $entry->setName($row->name);
         $entries[] = $entry;
     }
     return $entries;
 }
Пример #2
0
 public function userpriorformajaxAction()
 {
     try {
         $request = $this->getRequest();
         if ($this->getRequest()->isPost()) {
             $mapper = new Gyuser_Model_PriorOperationsDataMapper();
             $Obj = new Gyuser_Model_PriorOperations();
             if ($request->date) {
                 list($Day, $Month, $Year) = explode('/', $request->date);
                 $stampeddate = mktime(12, 0, 0, $Month, $Day, $Year);
                 $next_check_date = date("Y-m-d", $stampeddate);
             } else {
                 $next_check_date = null;
             }
             $Obj->setDate($next_check_date);
             $Obj->setIs_operation_completed($request->is_operation_completed);
             $Obj->setCave_name($request->cave_name);
             $Obj->setAmount($request->amount);
             $Obj->setNext_check_date($request->next_check_date);
             $Obj->setPending_checks($request->pending_checks);
             $Obj->setIs_last_operation($request->is_last_operation);
             if ($request->next_check_date) {
                 list($Day, $Month, $Year) = explode('/', $request->next_check_date);
                 $stampeddate = mktime(12, 0, 0, $Month, $Day, $Year);
                 $next_check_date = date("Y-m-d", $stampeddate);
             } else {
                 $next_check_date = null;
             }
             $Obj->setNext_check_date($next_check_date);
             $Obj->setClient_id($request->client_id);
             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) {
         echo $e;
     }
 }