Пример #1
0
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "edit":
             $PropAssessKindsDetails = new SoapObject(NCCBIZ . "PropAssessKindsDetails.php", "urn:Object");
             if (!($xmlStr = $PropAssessKindsDetails->getPropAssessKindsDetails($this->formArray["propAssessKindsID"]))) {
                 $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                 $this->tpl->set_var("TableBlock", "record not found");
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                     $this->tpl->set_var("TableBlock", "error xmlDoc");
                 } else {
                     $propAssessKinds = new PropAssessKinds();
                     $propAssessKinds->parseDomDocument($domDoc);
                     $this->formArray["propAssessKindsID"] = $propAssessKinds->getPropAssessKindsID();
                     $this->formArray["code"] = $propAssessKinds->getCode();
                     $this->formArray["description"] = $propAssessKinds->getDescription();
                     $this->formArray["value"] = $propAssessKinds->getValue();
                     $this->formArray["status"] = $propAssessKinds->getStatus();
                 }
             }
             break;
         case "save":
             $PropAssessKindsEncode = new SoapObject(NCCBIZ . "PropAssessKindsEncode.php", "urn:Object");
             if ($this->formArray["propAssessKindsID"] != "") {
                 $PropAssessKindsDetails = new SoapObject(NCCBIZ . "PropAssessKindsDetails.php", "urn:Object");
                 if (!($xmlStr = $PropAssessKindsDetails->getPropAssessKindsDetails($this->formArray["propAssessKindsID"]))) {
                     exit("record not found");
                 } else {
                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                         $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                         $this->tpl->set_var("TableBlock", "error xmlDoc");
                     } else {
                         $propAssessKinds = new PropAssessKinds();
                         $propAssessKinds->parseDomDocument($domDoc);
                         $propAssessKinds->setPropAssessKindsID($this->formArray["propAssessKindsID"]);
                         $propAssessKinds->setCode($this->formArray["code"]);
                         $propAssessKinds->setDescription($this->formArray["description"]);
                         $propAssessKinds->setValue($this->formArray["value"]);
                         $propAssessKinds->setStatus($this->formArray["status"]);
                         $propAssessKinds->setDomDocument();
                         $doc = $propAssessKinds->getDomDocument();
                         $xmlStr = $doc->dump_mem(true);
                         if (!($ret = $PropAssessKindsEncode->updatePropAssessKinds($xmlStr))) {
                             exit("error update");
                         }
                     }
                 }
             } else {
                 $propAssessKinds = new PropAssessKinds();
                 $propAssessKinds->setPropAssessKindsID($this->formArray["propAssessKindsID"]);
                 $propAssessKinds->setCode($this->formArray["code"]);
                 $propAssessKinds->setDescription($this->formArray["description"]);
                 $propAssessKinds->setValue($this->formArray["value"]);
                 $propAssessKinds->setStatus($this->formArray["status"]);
                 $propAssessKinds->setDomDocument();
                 $doc = $propAssessKinds->getDomDocument();
                 $xmlStr = $doc->dump_mem(true);
                 if (!($ret = $PropAssessKindsEncode->savePropAssessKinds($xmlStr))) {
                     exit("error save");
                 }
             }
             $this->formArray["propAssessKindsID"] = $ret;
             header("location: PropAssessKindsEncode.php");
             exit;
             break;
         case "cancel":
             header("location: PropAssessKindsList.php");
             exit;
             break;
         default:
             $this->tpl->set_block("rptsTemplate", "PropAssessKindsID", "PropAssessKindsIDBlock");
             $this->tpl->set_var("PropAssessKindsIDBlock", "");
             $this->tpl->set_block("rptsTemplate", "ACK", "ACKBlock");
             $this->tpl->set_var("ACKBlock", "");
     }
     $this->setForm();
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }