public function updateAddress() { $returnResult = new HttpResult(); $retornoDaPaginaHTML = new HttpAdminGenericResult(); $ReturnResultVO = new ReturnResultVO(); $retornoDaPaginaHTML->return_result_vo = $ReturnResultVO; if (DataHandler::getValueByArrayIndex($this->arrayVariable, "address_id") != NULL && DataHandler::getValueByArrayIndex($this->arrayVariable, "user_id") != NULL) { $user_id = DataHandler::getValueByArrayIndex($this->arrayVariable, "user_id"); $address_id = DataHandler::getValueByArrayIndex($this->arrayVariable, "address_id"); $AddressVO = new AddressVO($_POST); $UserDetailVO = new UserDetailVO(); // print_r($AddressVO);exit(); if ($_POST) { $AddressVO->setId($address_id); $ReturnResultVO = $AddressVO->commit(TRUE); if ($ReturnResultVO->success) { // Debug::print_r($ReturnResultVO); if (DataHandler::getValueByArrayIndex($_POST, "principal") == '1') { $UserDetailVO->setId($user_id, TRUE); $UserDetailVO->setAddressId($address_id); // Debug::print_r($UserDetailVO); $ReturnResultVO = $UserDetailVO->commit(); // Debug::print_r($ReturnResultVO); } } if ($ReturnResultVO->success) { Navigation::redirect("admin/user/update/id." . $user_id); exit; } } else { $AddressVO->setId($address_id, TRUE); $UserDetailVO->setId($user_id, TRUE); } $retornoDaPaginaHTML->return_result_vo = $ReturnResultVO; $retornoDaPaginaHTML->user_id = $user_id; $retornoDaPaginaHTML->user_address_vo = $AddressVO; $retornoDaPaginaHTML->user_detail_vo = $UserDetailVO; } else { Navigation::redirect("admin/user"); exit; } //iniciando o retorno padrao em http result $returnResult->setHttpContentResult($retornoDaPaginaHTML); return $returnResult; }
public function getAddress($force = false) { if (self::$UserAddressDAO == NULL) { self::$UserAddressDAO = new UserAddressDAO(); } if ($this->array_address_std == NULL || $force) { //busca produtos por ordem de mais barato $array_address = self::$UserAddressDAO->selectByUserId(DbInterface::RETURN_STD_OBJECT, $this->id); if ($array_address->success) { //print_r($array_address->result); foreach ($array_address->result as $array_address_std_obj) { $this->array_address_std[] = $array_address_std_obj; } } } return $this->array_address_std; }
public function confirm() { $ReturnResult = new ReturnResultVO(); $id = DataHandler::getValueByArrayIndex($this->arrayVariable, "id"); $UserDetail = new UserDetailVO(); $ResultUser = $UserDetail->setId($id, TRUE); if ($ResultUser->success) { if ($UserDetail->getEmail() == DataHandler::getValueByArrayIndex($this->arrayVariable, "mail")) { $token = DataHandler::getValueByArrayIndex($this->arrayVariable, "token"); if ($token == $this->getTokenFromUser($id, $UserDetail->getEmail())) { $UserDetail->setActive(1); $ReturnResult = $UserDetail->commit(); } else { $ReturnResult->addMessage("token incorreto"); } } else { $ReturnResult->addMessage("email não confere com usuario"); } } else { $ReturnResult->addMessage("usuario não encontrado"); } $returnResult = new HttpResult(); $retornoDaPaginaHTML = new HttpAdminGenericResult(); $retornoDaPaginaHTML->result = $ReturnResult; $returnResult->setHttpContentResult($retornoDaPaginaHTML); return $returnResult; }