Ejemplo n.º 1
0
 public function commit()
 {
     //iniciando o retorno padrao
     $HttpReturnResult = new HttpResult();
     $CategoryVO = new CategoryVO();
     if ($_POST["category_id"] == NULL) {
         $_POST["category_id"] = 0;
     }
     $_POST["active"] = 1;
     $CategoryVO->setFetchArray($_POST);
     $ResultValidate = $CategoryVO->validate();
     $resultPage = new DefaultPage();
     //Debug::print_r($ResultValidate); exit();
     if ($ResultValidate->success) {
         $ReturnResult = $CategoryVO->commit();
         //Debug::print_r($ReturnResult);exit();
         if ($ReturnResult->success) {
             Navigation::redirect("admin/category/select");
         } else {
             $resultPage->returnResult = $ReturnResult;
         }
     } else {
         $resultPage->returnResult = $ResultValidate;
     }
     $HttpReturnResult->setHttpContentResult($resultPage);
     return $HttpReturnResult;
 }
Ejemplo n.º 2
0
 public function commit()
 {
     //iniciando o retorno padrao
     $HttpReturnResult = new HttpResult();
     $CategoryVO = new CategoryVO();
     if (!isset($_POST["category_id"]) || $_POST["category_id"] == NULL) {
         $_POST["category_id"] = 2;
     }
     $_POST["active"] = 1;
     $CategoryVO->setFetchArray($_POST);
     $id = DataHandler::forceInt(DataHandler::getValueByArrayIndex($this->arrayVariable, "id"));
     if ($id > 0) {
         $CategoryVO->setId($id);
     }
     $ResultValidate = $CategoryVO->validate();
     $resultPage = new DefaultPage();
     //Debug::print_r($ResultValidate); exit();
     if ($ResultValidate->success) {
         $ReturnResult = $CategoryVO->commit();
         //Debug::print_r($ReturnResult);exit();
         if ($ReturnResult->success) {
             Navigation::redirect("backend/category/show");
         } else {
             $resultPage->returnResult = $ReturnResult;
         }
     } else {
         $resultPage->returnResult = $ResultValidate;
     }
     $HttpReturnResult->setHttpContentResult($resultPage);
     return $HttpReturnResult;
 }