Ejemplo n.º 1
0
 public function update()
 {
     $ReturnResultVO = new ReturnResultVO();
     //iniciando o retorno padrao
     $returnResult = new HttpResult();
     $senha = DataHandler::getValueByArrayIndex($_POST, "password");
     $confirm_password = DataHandler::getValueByArrayIndex($_POST, "confirm_password");
     if (DataHandler::getValueByArrayIndex($this->arrayVariable, "id")) {
         $id = DataHandler::getValueByArrayIndex($this->arrayVariable, "id");
     }
     $VO = new UserDetailVO();
     $VO->setId($id, TRUE);
     if ($_POST) {
         if ($senha == NULL || $senha != $confirm_password) {
             $ReturnResultVO = new ReturnResultVO();
             $ReturnResultVO->success = FALSE;
             $ReturnResultVO->addMessage("confimação de senha incorreta");
         } else {
             $VO = new UserDetailVO($_POST);
             $VO->setId($id);
             $ReturnResultVO = $VO->commit(TRUE);
             if ($ReturnResultVO->success) {
                 Navigation::redirect("admin/user");
                 exit;
             }
         }
     }
     $arrayAddres = $VO->getAddress();
     $AdminHttpResult = new HttpAdminGenericResult();
     $ReturnResultVO->result = $VO;
     $ReturnResultVO->result->array_address = $arrayAddres;
     //e lá vai a VO vivinha da silva pro admin
     $AdminHttpResult->return_result_vo = $ReturnResultVO;
     $returnResult->setHttpContentResult($AdminHttpResult);
     //		Debug::print_r($returnResult);
     return $returnResult;
 }