Example #1
0
 /**
  * @param SimpleXMLElement $xml
  * @return Person
  * @throws InvalidGPXException
  */
 public static function fromXML(SimpleXMLElement $xml)
 {
     $person = new Person();
     if (!empty($xml->name)) {
         $person->setName((string) $xml->name[0]);
     }
     if (!empty($xml->email)) {
         $person->setEmail(Email::fromXML($xml->email[0]));
     }
     if (!empty($xml->link)) {
         $person->setLink(Link::fromXML($xml->link[0]));
     }
     return $person;
 }
 public function save_register()
 {
     $newPerson = new Person();
     $toRepository = new Administration();
     $newPerson->setTitle(Input::get('userTitle'));
     $newPerson->setName(Input::get('txtName'));
     $newPerson->setSurname(Input::get('txtSurName'));
     $newPerson->setPosition_ID(Input::get('userPosition'));
     $newPerson->setBirthday(Input::get('txtBirthday'));
     $newPerson->setNational_ID(Input::get('txtIdent'));
     $newPerson->setType_ID(Input::get('userType'));
     $newPerson->setDepartment_ID(Input::get('userDepart'));
     $newPerson->setDivision_ID(Input::get('userDivision'));
     $newPerson->setEmail(Input::get('txtEmail'));
     $newPerson->setTelphone(Input::get('txtTel'));
     $returnValue = $toRepository->addPerson($newPerson);
     if ($returnValue == 1) {
         return View::make('alert/person/alertRegister');
     } else {
         return View::make('alert/person/alertRegister2');
     }
 }
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "edit":
             $ImprovementsBuildingsDetails = new SoapObject(NCCBIZ . "ImprovementsBuildingsDetails.php", "urn:Object");
             if (!($xmlStr = $ImprovementsBuildingsDetails->getImprovementsBuildings($this->formArray["propertyID"]))) {
                 echo "xml failed";
             } else {
                 //echo $xmlStr;
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                     $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
                 } else {
                     $improvementsBuildings = new ImprovementsBuildings();
                     $improvementsBuildings->parseDomDocument($domDoc);
                     foreach ($improvementsBuildings as $key => $value) {
                         switch ($key) {
                             case "propertyAdministrator":
                                 if (is_a($value, Person)) {
                                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value->getBirthday());
                                     $this->formArray["personID"] = $value->getPersonID();
                                     $this->formArray["lastName"] = $value->getLastName();
                                     $this->formArray["firstName"] = $value->getFirstName();
                                     $this->formArray["middleName"] = $value->getMiddleName();
                                     $this->formArray["gender"] = $value->getGender();
                                     $this->formArray["birth_year"] = removePreZero($dateArr["year"]);
                                     $this->formArray["birth_month"] = removePreZero($dateArr["month"]);
                                     $this->formArray["birth_day"] = removePreZero($dateArr["day"]);
                                     $this->formArray["maritalStatus"] = $value->getMaritalStatus();
                                     $this->formArray["tin"] = $value->getTin();
                                     if (is_array($value->addressArray)) {
                                         $this->formArray["addressID"] = $value->addressArray[0]->getAddressID();
                                         $this->formArray["number"] = $value->addressArray[0]->getNumber();
                                         $this->formArray["street"] = $value->addressArray[0]->getStreet();
                                         $this->formArray["barangay"] = $value->addressArray[0]->getBarangay();
                                         $this->formArray["district"] = $value->addressArray[0]->getDistrict();
                                         $this->formArray["municipalityCity"] = $value->addressArray[0]->getMunicipalityCity();
                                         $this->formArray["province"] = $value->addressArray[0]->getProvince();
                                     }
                                     $this->formArray["telephone"] = $value->getTelephone();
                                     $this->formArray["mobileNumber"] = $value->getMobileNumber();
                                     $this->formArray["email"] = $value->getEmail();
                                 } else {
                                     $this->formArray[$key] = "";
                                 }
                                 break;
                             case "appraisedByDate":
                                 if (true) {
                                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                     $this->formArray["as_year"] = removePreZero($dateArr["year"]);
                                     $this->formArray["as_month"] = removePreZero($dateArr["month"]);
                                     $this->formArray["as_day"] = removePreZero($dateArr["day"]);
                                 } else {
                                     $this->formArray[$key] = "";
                                 }
                                 break;
                             case "recommendingApprovalDate":
                                 if (true) {
                                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                     $this->formArray["re_year"] = removePreZero($dateArr["year"]);
                                     $this->formArray["re_month"] = removePreZero($dateArr["month"]);
                                     $this->formArray["re_day"] = removePreZero($dateArr["day"]);
                                 } else {
                                     $this->formArray[$key] = "";
                                 }
                                 break;
                             case "approvedByDate":
                                 if (true) {
                                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                     $this->formArray["av_year"] = removePreZero($dateArr["year"]);
                                     $this->formArray["av_month"] = removePreZero($dateArr["month"]);
                                     $this->formArray["av_day"] = removePreZero($dateArr["day"]);
                                 } else {
                                     $this->formArray[$key] = "";
                                 }
                                 break;
                             case "dateConstructed":
                                 if (true) {
                                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                     $this->formArray["dc_year"] = removePreZero($dateArr["year"]);
                                     $this->formArray["dc_month"] = removePreZero($dateArr["month"]);
                                     $this->formArray["dc_day"] = removePreZero($dateArr["day"]);
                                 } else {
                                     $this->formArray[$key] = "";
                                 }
                                 break;
                             case "dateOccupied":
                                 if (true) {
                                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                     $this->formArray["do_year"] = removePreZero($dateArr["year"]);
                                     $this->formArray["do_month"] = removePreZero($dateArr["month"]);
                                     $this->formArray["do_day"] = removePreZero($dateArr["day"]);
                                 } else {
                                     $this->formArray[$key] = "";
                                 }
                                 break;
                             case "dateCompleted":
                                 if (true) {
                                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                     $this->formArray["dm_year"] = removePreZero($dateArr["year"]);
                                     $this->formArray["dm_month"] = removePreZero($dateArr["month"]);
                                     $this->formArray["dm_day"] = removePreZero($dateArr["day"]);
                                 } else {
                                     $this->formArray[$key] = "";
                                 }
                                 break;
                             default:
                                 $this->formArray[$key] = $value;
                         }
                     }
                 }
             }
             break;
         case "save":
             if ($this->formArray["verifiedByID"] != "" && $this->formArray["verifiedByID"] != "xx" && $this->formArray["propertyID"] != "") {
                 $this->saveVerified($this->formArray["afsID"], $this->formArray["verifiedByID"], $this->formArray["propertyID"]);
             }
             $ImprovementsBuildingsEncode = new SoapObject(NCCBIZ . "ImprovementsBuildingsEncode.php", "urn:Object");
             if ($this->formArray["propertyID"] != "") {
                 $ImprovementsBuildingsDetails = new SoapObject(NCCBIZ . "ImprovementsBuildingsDetails.php", "urn:Object");
                 if (!($xmlStr = $ImprovementsBuildingsDetails->getImprovementsBuildings($this->formArray["propertyID"]))) {
                     $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 {
                         $address = new Address();
                         $address->setAddressID($this->formArray["addressID"]);
                         $address->setNumber($this->formArray["number"]);
                         $address->setStreet($this->formArray["street"]);
                         $address->setBarangay($this->formArray["barangay"]);
                         $address->setDistrict($this->formArray["district"]);
                         $address->setMunicipalityCity($this->formArray["municipalityCity"]);
                         $address->setProvince($this->formArray["province"]);
                         $address->setDomDocument();
                         $propertyAdministrator = new Person();
                         $propertyAdministrator->setPersonID($this->formArray["personID"]);
                         $propertyAdministrator->setLastName($this->formArray["lastName"]);
                         $propertyAdministrator->setFirstName($this->formArray["firstName"]);
                         $propertyAdministrator->setMiddleName($this->formArray["middleName"]);
                         //$propertyAdministrator->setGender($this->formArray["gender"]);
                         //$propertyAdministrator->setBirthday($this->birthdate);
                         //$propertyAdministrator->setMaritalStatus($this->formArray["maritalStatus"]);
                         //$propertyAdministrator->setTin($this->formArray["tin"]);
                         $propertyAdministrator->setAddressArray($address);
                         $propertyAdministrator->setTelephone($this->formArray["telephone"]);
                         //$propertyAdministrator->setMobileNumber($this->formArray["mobileNumber"]);
                         $propertyAdministrator->setEmail($this->formArray["email"]);
                         $propertyAdministrator->setDomDocument();
                         $improvementsBuildings = new ImprovementsBuildings();
                         $improvementsBuildings->parseDomDocument($domDoc);
                         $improvementsBuildings->setPropertyID($this->formArray["propertyID"]);
                         $improvementsBuildings->setAfsID($this->formArray["afsID"]);
                         $improvementsBuildings->setArpNumber($this->formArray["arpNumber"]);
                         $improvementsBuildings->setPropertyIndexNumber($this->formArray["propertyIndexNumber"]);
                         $improvementsBuildings->setPropertyAdministrator($propertyAdministrator);
                         $improvementsBuildings->setVerifiedBy($this->formArray["verifiedByID"]);
                         $improvementsBuildings->setPlottingsBy($this->formArray["plottingsByID"]);
                         $improvementsBuildings->setNotedBy($this->formArray["notedByID"]);
                         $improvementsBuildings->setMarketValue($this->formArray["marketValue"]);
                         $improvementsBuildings->setKind($this->formArray["kind"]);
                         $improvementsBuildings->setActualUse($this->formArray["actualUse"]);
                         $improvementsBuildings->setAdjustedMarketValue($this->formArray["adjustedMarketValue"]);
                         $improvementsBuildings->setAssessmentLevel($this->formArray["assessmentLevel"]);
                         $improvementsBuildings->setAssessedValue($this->formArray["assessedValue"]);
                         $improvementsBuildings->setPreviousOwner($this->formArray["previousOwner"]);
                         $improvementsBuildings->setPreviousAssessedValue($this->formArray["previousAssessedValue"]);
                         $improvementsBuildings->setTaxability($this->formArray["taxability"]);
                         $improvementsBuildings->setEffectivity($this->formArray["effectivity"]);
                         $improvementsBuildings->setAppraisedBy($this->formArray["appraisedByID"]);
                         $improvementsBuildings->setAppraisedByDate($this->formArray["appraisedByDate"]);
                         $improvementsBuildings->setRecommendingApproval($this->formArray["recommendingApprovalID"]);
                         $improvementsBuildings->setRecommendingApprovalDate($this->formArray["recommendingApprovalDate"]);
                         $improvementsBuildings->setApprovedBy($this->formArray["approvedByID"]);
                         $improvementsBuildings->setApprovedByDate($this->formArray["approvedByDate"]);
                         $improvementsBuildings->setMemoranda($this->formArray["memoranda"]);
                         $improvementsBuildings->setPostingDate($this->formArray["postingDate"]);
                         $improvementsBuildings->setLandPin($this->formArray["landPin"]);
                         $improvementsBuildings->setFoundation($this->formArray["foundation"]);
                         $improvementsBuildings->setColumnsBldg($this->formArray["columnsBldg"]);
                         $improvementsBuildings->setBeams($this->formArray["beams"]);
                         $improvementsBuildings->setTrussFraming($this->formArray["trussFraming"]);
                         $improvementsBuildings->setRoof($this->formArray["roof"]);
                         $improvementsBuildings->setExteriorWalls($this->formArray["exteriorWalls"]);
                         $improvementsBuildings->setFlooring($this->formArray["flooring"]);
                         $improvementsBuildings->setDoors($this->formArray["doors"]);
                         $improvementsBuildings->setCeiling($this->formArray["ceiling"]);
                         $improvementsBuildings->setStructuralTypes($this->formArray["structuralTypes"]);
                         $improvementsBuildings->setBuildingClassification($this->formArray["buildingClassification"]);
                         $improvementsBuildings->setBuildingPermit($this->formArray["buildingPermit"]);
                         $improvementsBuildings->setBuildingAge($this->formArray["buildingAge"]);
                         $improvementsBuildings->setCctNumber($this->formArray["cctNumber"]);
                         $improvementsBuildings->setNumberOfStoreys($this->formArray["numberOfStoreys"]);
                         $improvementsBuildings->setWindows($this->formArray["windows"]);
                         $improvementsBuildings->setStairs($this->formArray["stairs"]);
                         $improvementsBuildings->setPartition($this->formArray["partition"]);
                         $improvementsBuildings->setWallFinish($this->formArray["wallFinish"]);
                         $improvementsBuildings->setElectrical($this->formArray["electrical"]);
                         $improvementsBuildings->setToiletAndBath($this->formArray["toiletAndBath"]);
                         $improvementsBuildings->setPlumbingSewer($this->formArray["plumbingSewer"]);
                         $improvementsBuildings->setFixtures($this->formArray["fixtures"]);
                         $improvementsBuildings->setDateConstructed($this->formArray["dateConstructed"]);
                         $improvementsBuildings->setDateOccupied($this->formArray["dateOccupied"]);
                         $improvementsBuildings->setDateCompleted($this->formArray["dateCompleted"]);
                         $improvementsBuildings->setAreaOfGroundFloor($this->formArray["areaOfGroundFloor"]);
                         $improvementsBuildings->setTotalBuildingArea($this->formArray["totalBuildingArea"]);
                         $improvementsBuildings->setUnitValue($this->formArray["unitValue"]);
                         $improvementsBuildings->setBuildingCoreAndAdditionalItems($this->formArray["buildingCoreAndAdditionalItems"]);
                         $improvementsBuildings->setAddItems($this->formArray["addItems"]);
                         $improvementsBuildings->setDepreciationRate($this->formArray["depreciationRate"]);
                         $improvementsBuildings->setAccumulatedDepreciation($this->formArray["accumulatedDepreciation"]);
                         $improvementsBuildings->setDepreciatedMarketValue($this->formArray["depreciatedMarketValue"]);
                         $improvementsBuildings->setCreatedBy($this->userID);
                         $improvementsBuildings->setModifiedBy($this->userID);
                         $improvementsBuildings->setDomDocument();
                         $doc = $improvementsBuildings->getDomDocument();
                         $xmlStr = $doc->dump_mem(true);
                         //echo $xmlStr;
                         $ret = $ImprovementsBuildingsEncode->updateImprovementsBuildings($xmlStr);
                         if (!($ret = $ImprovementsBuildingsEncode->updateImprovementsBuildings($xmlStr))) {
                             exit("error update" . $ret);
                         }
                     }
                 }
             } else {
                 $address = new Address();
                 //$address->setAddressID($this->formArray["addressID"]);
                 $address->setNumber($this->formArray["number"]);
                 $address->setStreet($this->formArray["street"]);
                 $address->setBarangay($this->formArray["barangay"]);
                 $address->setDistrict($this->formArray["district"]);
                 $address->setMunicipalityCity($this->formArray["municipalityCity"]);
                 $address->setProvince($this->formArray["province"]);
                 $address->setDomDocument();
                 $propertyAdministrator = new Person();
                 //$propertyAdministrator->setPersonID($this->formArray["personID"]);
                 $propertyAdministrator->setLastName($this->formArray["lastName"]);
                 $propertyAdministrator->setFirstName($this->formArray["firstName"]);
                 $propertyAdministrator->setMiddleName($this->formArray["middleName"]);
                 //$propertyAdministrator->setGender($this->formArray["gender"]);
                 //$propertyAdministrator->setBirthday($this->birthdate);
                 //$propertyAdministrator->setMaritalStatus($this->formArray["maritalStatus"]);
                 //$propertyAdministrator->setTin($this->formArray["tin"]);
                 $propertyAdministrator->setAddressArray($address);
                 $propertyAdministrator->setTelephone($this->formArray["telephone"]);
                 //$propertyAdministrator->setMobileNumber($this->formArray["mobileNumber"]);
                 $propertyAdministrator->setEmail($this->formArray["email"]);
                 $propertyAdministrator->setDomDocument();
                 $improvementsBuildings = new ImprovementsBuildings();
                 $improvementsBuildings->parseDomDocument($domDoc);
                 //$improvementsBuildings->setPropertyID($this->formArray["propertyID"]);
                 $improvementsBuildings->setAfsID($this->formArray["afsID"]);
                 $improvementsBuildings->setArpNumber($this->formArray["arpNumber"]);
                 $improvementsBuildings->setPropertyIndexNumber($this->formArray["propertyIndexNumber"]);
                 $improvementsBuildings->setPropertyAdministrator($propertyAdministrator);
                 $improvementsBuildings->setVerifiedBy($this->formArray["verifiedByID"]);
                 $improvementsBuildings->setPlottingsBy($this->formArray["plottingsByID"]);
                 $improvementsBuildings->setNotedBy($this->formArray["notedByID"]);
                 $improvementsBuildings->setMarketValue($this->formArray["marketValue"]);
                 $improvementsBuildings->setKind($this->formArray["kind"]);
                 $improvementsBuildings->setActualUse($this->formArray["actualUse"]);
                 $improvementsBuildings->setAdjustedMarketValue($this->formArray["adjustedMarketValue"]);
                 $improvementsBuildings->setAssessmentLevel($this->formArray["assessmentLevel"]);
                 $improvementsBuildings->setAssessedValue($this->formArray["assessedValue"]);
                 $improvementsBuildings->setPreviousOwner($this->formArray["previousOwner"]);
                 $improvementsBuildings->setPreviousAssessedValue($this->formArray["previousAssessedValue"]);
                 $improvementsBuildings->setTaxability($this->formArray["taxability"]);
                 $improvementsBuildings->setEffectivity($this->formArray["effectivity"]);
                 $improvementsBuildings->setAppraisedBy($this->formArray["appraisedByID"]);
                 $improvementsBuildings->setAppraisedByDate($this->formArray["appraisedByDate"]);
                 $improvementsBuildings->setRecommendingApproval($this->formArray["recommendingApprovalID"]);
                 $improvementsBuildings->setRecommendingApprovalDate($this->formArray["recommendingApprovalDate"]);
                 $improvementsBuildings->setApprovedBy($this->formArray["approvedByID"]);
                 $improvementsBuildings->setApprovedByDate($this->formArray["approvedByDate"]);
                 $improvementsBuildings->setMemoranda($this->formArray["memoranda"]);
                 $improvementsBuildings->setPostingDate($this->formArray["postingDate"]);
                 $improvementsBuildings->setLandPin($this->formArray["landPin"]);
                 $improvementsBuildings->setFoundation($this->formArray["foundation"]);
                 $improvementsBuildings->setColumnsBldg($this->formArray["columnsBldg"]);
                 $improvementsBuildings->setBeams($this->formArray["beams"]);
                 $improvementsBuildings->setTrussFraming($this->formArray["trussFraming"]);
                 $improvementsBuildings->setRoof($this->formArray["roof"]);
                 $improvementsBuildings->setExteriorWalls($this->formArray["exteriorWalls"]);
                 $improvementsBuildings->setFlooring($this->formArray["flooring"]);
                 $improvementsBuildings->setDoors($this->formArray["doors"]);
                 $improvementsBuildings->setCeiling($this->formArray["ceiling"]);
                 $improvementsBuildings->setStructuralTypes($this->formArray["structuralTypes"]);
                 $improvementsBuildings->setBuildingClassification($this->formArray["buildingClassification"]);
                 $improvementsBuildings->setBuildingPermit($this->formArray["buildingPermit"]);
                 $improvementsBuildings->setBuildingAge($this->formArray["buildingAge"]);
                 $improvementsBuildings->setCctNumber($this->formArray["cctNumber"]);
                 $improvementsBuildings->setNumberOfStoreys($this->formArray["numberOfStoreys"]);
                 $improvementsBuildings->setWindows($this->formArray["windows"]);
                 $improvementsBuildings->setStairs($this->formArray["stairs"]);
                 $improvementsBuildings->setPartition($this->formArray["partition"]);
                 $improvementsBuildings->setWallFinish($this->formArray["wallFinish"]);
                 $improvementsBuildings->setElectrical($this->formArray["electrical"]);
                 $improvementsBuildings->setToiletAndBath($this->formArray["toiletAndBath"]);
                 $improvementsBuildings->setPlumbingSewer($this->formArray["plumbingSewer"]);
                 $improvementsBuildings->setFixtures($this->formArray["fixtures"]);
                 $improvementsBuildings->setDateConstructed($this->formArray["dateConstructed"]);
                 $improvementsBuildings->setDateOccupied($this->formArray["dateOccupied"]);
                 $improvementsBuildings->setDateCompleted($this->formArray["dateCompleted"]);
                 $improvementsBuildings->setAreaOfGroundFloor($this->formArray["areaOfGroundFloor"]);
                 $improvementsBuildings->setTotalBuildingArea($this->formArray["totalBuildingArea"]);
                 $improvementsBuildings->setUnitValue($this->formArray["unitValue"]);
                 $improvementsBuildings->setBuildingCoreAndAdditionalItems($this->formArray["buildingCoreAndAdditionalItems"]);
                 $improvementsBuildings->setAddItems($this->formArray["addItems"]);
                 $improvementsBuildings->setDepreciationRate($this->formArray["depreciationRate"]);
                 $improvementsBuildings->setAccumulatedDepreciation($this->formArray["accumulatedDepreciation"]);
                 $improvementsBuildings->setDepreciatedMarketValue($this->formArray["depreciatedMarketValue"]);
                 $improvementsBuildings->setCreatedBy($this->userID);
                 $improvementsBuildings->setModifiedBy($this->userID);
                 $improvementsBuildings->setDomDocument();
                 $doc = $improvementsBuildings->getDomDocument();
                 $xmlStr = $doc->dump_mem(true);
                 //echo $xmlStr;
                 $xmlStr = $doc->dump_mem(true);
                 if (!($ret = $ImprovementsBuildingsEncode->saveImprovementsBuildings($xmlStr))) {
                     echo "ret=" . $ret;
                 }
             }
             $this->formArray["propertyID"] = $ret;
             header("location: ImprovementsBuildingsClose.php" . $this->sess->url("") . $this->sess->add_query(array("afsID" => $this->formArray["afsID"])));
             exit;
             break;
         case "cancel":
             header("location: ImprovementsBuildingsList.php");
             exit;
             break;
         default:
             if (!($firstPropertyID = $this->getFirstPropertyID())) {
                 $this->tpl->set_block("rptsTemplate", "odID", "odIDBlock");
                 $this->tpl->set_var("odIDBlock", "");
                 $this->tpl->set_block("rptsTemplate", "ACK", "ACKBlock");
                 $this->tpl->set_var("ACKBlock", "");
             } else {
                 $ImprovementsBuildingsDetails = new SoapObject(NCCBIZ . "ImprovementsBuildingsDetails.php", "urn:Object");
                 if (!($xmlStr = $ImprovementsBuildingsDetails->getImprovementsBuildings($firstPropertyID))) {
                     echo "xml failed";
                 } else {
                     //echo $xmlStr;
                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                         $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                         $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
                     } else {
                         $improvementsBuildings = new ImprovementsBuildings();
                         $improvementsBuildings->parseDomDocument($domDoc);
                         foreach ($improvementsBuildings as $key => $value) {
                             switch ($key) {
                                 case "propertyID":
                                     $this->formArray["propertyID"] = "";
                                     break;
                                 case "propertyAdministrator":
                                     if (is_a($value, Person)) {
                                         list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value->getBirthday());
                                         $this->formArray["personID"] = $value->getPersonID();
                                         $this->formArray["lastName"] = $value->getLastName();
                                         $this->formArray["firstName"] = $value->getFirstName();
                                         $this->formArray["middleName"] = $value->getMiddleName();
                                         $this->formArray["gender"] = $value->getGender();
                                         $this->formArray["birth_year"] = removePreZero($dateArr["year"]);
                                         $this->formArray["birth_month"] = removePreZero($dateArr["month"]);
                                         $this->formArray["birth_day"] = removePreZero($dateArr["day"]);
                                         $this->formArray["maritalStatus"] = $value->getMaritalStatus();
                                         $this->formArray["tin"] = $value->getTin();
                                         $this->formArray["addressID"] = $value->addressArray[0]->getAddressID();
                                         $this->formArray["number"] = $value->addressArray[0]->getNumber();
                                         $this->formArray["street"] = $value->addressArray[0]->getStreet();
                                         $this->formArray["barangay"] = $value->addressArray[0]->getBarangay();
                                         $this->formArray["district"] = $value->addressArray[0]->getDistrict();
                                         $this->formArray["municipalityCity"] = $value->addressArray[0]->getMunicipalityCity();
                                         $this->formArray["province"] = $value->addressArray[0]->getProvince();
                                         $this->formArray["telephone"] = $value->getTelephone();
                                         $this->formArray["mobileNumber"] = $value->getMobileNumber();
                                         $this->formArray["email"] = $value->getEmail();
                                     } else {
                                         $this->formArray[$key] = "";
                                     }
                                     break;
                                 case "appraisedByDate":
                                     if (true) {
                                         list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                         $this->formArray["as_year"] = removePreZero($dateArr["year"]);
                                         $this->formArray["as_month"] = removePreZero($dateArr["month"]);
                                         $this->formArray["as_day"] = removePreZero($dateArr["day"]);
                                     } else {
                                         $this->formArray[$key] = "";
                                     }
                                     break;
                                 case "recommendingApprovalDate":
                                     if (true) {
                                         list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                         $this->formArray["re_year"] = removePreZero($dateArr["year"]);
                                         $this->formArray["re_month"] = removePreZero($dateArr["month"]);
                                         $this->formArray["re_day"] = removePreZero($dateArr["day"]);
                                     } else {
                                         $this->formArray[$key] = "";
                                     }
                                     break;
                                 case "approvedByDate":
                                     if (true) {
                                         list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                         $this->formArray["av_year"] = removePreZero($dateArr["year"]);
                                         $this->formArray["av_month"] = removePreZero($dateArr["month"]);
                                         $this->formArray["av_day"] = removePreZero($dateArr["day"]);
                                     } else {
                                         $this->formArray[$key] = "";
                                     }
                                     break;
                                 case "dateConstructed":
                                     if (true) {
                                         list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                         $this->formArray["dc_year"] = removePreZero($dateArr["year"]);
                                         $this->formArray["dc_month"] = removePreZero($dateArr["month"]);
                                         $this->formArray["dc_day"] = removePreZero($dateArr["day"]);
                                     } else {
                                         $this->formArray[$key] = "";
                                     }
                                     break;
                                 case "dateOccupied":
                                     if (true) {
                                         list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                         $this->formArray["do_year"] = removePreZero($dateArr["year"]);
                                         $this->formArray["do_month"] = removePreZero($dateArr["month"]);
                                         $this->formArray["do_day"] = removePreZero($dateArr["day"]);
                                     } else {
                                         $this->formArray[$key] = "";
                                     }
                                     break;
                                 case "dateCompleted":
                                     if (true) {
                                         list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                         $this->formArray["dm_year"] = removePreZero($dateArr["year"]);
                                         $this->formArray["dm_month"] = removePreZero($dateArr["month"]);
                                         $this->formArray["dm_day"] = removePreZero($dateArr["day"]);
                                     } else {
                                         $this->formArray[$key] = "";
                                     }
                                     break;
                                 case "arpNumber":
                                 case "propertyIndexNumber":
                                 case "propertyAdministrator":
                                 case "personID":
                                 case "lastName":
                                 case "firstName":
                                 case "middleName":
                                 case "gender":
                                 case "birth_month":
                                 case "birth_day":
                                 case "birth_year":
                                 case "maritalStatus":
                                 case "tin":
                                 case "addressID":
                                 case "number":
                                 case "street":
                                 case "barangay":
                                 case "district":
                                 case "municipalityCity":
                                 case "province":
                                 case "telephone":
                                 case "mobileNumber":
                                 case "email":
                                 case "verifiedByID":
                                 case "verifiedBy":
                                 case "verifiedByName":
                                 case "plottingsByID":
                                 case "plottingsBy":
                                 case "plottingsByName":
                                 case "notedByID":
                                 case "notedBy":
                                 case "notedByName":
                                 case "marketValue":
                                 case "kind":
                                 case "actualUse":
                                 case "adjustedMarketValue":
                                 case "assessmentLevel":
                                 case "assessedValue":
                                 case "previousOwner":
                                 case "previousAssessedValue":
                                 case "taxability":
                                 case "effectivity":
                                 case "appraisedByID":
                                 case "appraisedBy":
                                 case "appraisedByName":
                                 case "appraisedByDate":
                                 case "recommendingApprovalID":
                                 case "recommendingApproval":
                                 case "recommendingApprovalName":
                                 case "recommendingApprovalDate":
                                 case "approvedByID":
                                 case "approvedBy":
                                 case "approvedByName":
                                 case "approvedByDate":
                                 case "memoranda":
                                 case "postingDate":
                                 case "landPin":
                                 case "foundation":
                                 case "columnsBldg":
                                 case "beams":
                                 case "trussFraming":
                                 case "roof":
                                 case "exteriorWalls":
                                 case "flooring":
                                 case "doors":
                                 case "ceiling":
                                 case "structuralTypes":
                                 case "buildingClassification":
                                 case "buildingPermit":
                                 case "buildingAge":
                                 case "cctNumber":
                                 case "numberOfStoreys":
                                 case "windows":
                                 case "stairs":
                                 case "partition":
                                 case "wallFinish":
                                 case "electrical":
                                 case "toiletAndBath":
                                 case "plumbingSewer":
                                 case "fixtures":
                                 case "dateConstructed":
                                 case "dateOccupied":
                                 case "dateCompleted":
                                 case "areaOfGroundFloor":
                                 case "totalBuildingArea":
                                 case "unitValue":
                                 case "buildingCoreAndAdditionalItems":
                                 case "addItems":
                                 case "depreciationRate":
                                 case "accumulatedDepreciation":
                                 case "depreciatedMarketValue":
                                 case "as_month":
                                 case "as_day":
                                 case "as_year":
                                 case "re_month":
                                 case "re_day":
                                 case "re_year":
                                 case "av_month":
                                 case "av_day":
                                 case "av_year":
                                 case "dc_month":
                                 case "dc_day":
                                 case "dc_year":
                                 case "do_month":
                                 case "do_day":
                                 case "do_year":
                                 case "dm_month":
                                 case "dm_day":
                                 case "dm_year":
                                     $this->formArray[$key] = $value;
                                     break;
                             }
                         }
                     }
                 }
             }
     }
     $this->setForm();
     $this->tpl->set_var("Session", $this->sess->url("") . $this->sess->add_query(array("odID" => $this->formArray["odID"], "ownerID" => $this->formArray["ownerID"])));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
Example #4
0
 public function executeConfirmStudent(sfWebRequest $request)
 {
     sfContext::getInstance()->set("user", new FakeUser());
     //tomo las intancias de las librerias.
     $i_identification_type = BaseCustomOptionsHolder::getInstance('IdentificationType');
     $i_sex_type = BaseCustomOptionsHolder::getInstance('SexType');
     $i_nationality = BaseCustomOptionsHolder::getInstance('Nationality');
     $s_lastname = $this->getRequestParameter('apellido');
     // Es obligatorio
     $s_firstname = $this->getRequestParameter('nombres');
     // Es obligatorio
     $s_identification_type = $i_identification_type->getIdentificationType($this->getRequestParameter('tipo_documento_id'));
     $s_identification_number = $this->getRequestParameter('nro_documento');
     $s_sex = $i_sex_type->getSexType($this->getRequestParameter('sexo'));
     //Es obligatorio
     $s_phone = $this->getRequestParameter('telefono_fijo');
     $s_birthdate = $this->getRequestParameter('fecha_nacimiento');
     $s_birth_city = $this->getRequestParameter('ciudad_nacimiento_id');
     $s_health_coverage_id = $this->getRequestParameter('obra_social_id');
     $s_origin_school_id = $request->getParameter('escuela_procedencia_numero');
     //domicilio
     $s_city = $this->getRequestParameter('domicilio_ciudad_id');
     $s_street = $this->getRequestParameter('domicilio_calle');
     $s_number = $this->getRequestParameter('domicilio_numero');
     $s_floor = $this->getRequestParameter('domicilio_piso');
     $s_flat = $this->getRequestParameter('domicilio_departamento');
     //Chequeo tutor (madre)
     $m_identification_type = $i_identification_type->getIdentificationType($this->getRequestParameter('madre_tipo_documento_id'));
     $m_identification_number = $this->getRequestParameter('madre_nro_documento');
     $m_firstname = $this->getRequestParameter('madre_nombres');
     $m_lastname = $this->getRequestParameter('madre_apellido');
     $m_occupation = $this->getRequestParameter('madre_actividad_id');
     $m_occupation_category = $this->getRequestParameter('madre_ocupacion_id');
     $m_study = $this->getRequestParameter('madre_estudios_id');
     $m_email = $this->getRequestParameter('madre_email');
     $m_phone = $this->getRequestParameter('madre_telefono_celular');
     $m_birthdate = $this->getRequestParameter('madre_fecha_nacimiento');
     $m_birth_city = $this->getRequestParameter('madre_ciudad_nacimiento_id');
     $m_nationality = $i_nationality->getNationality($this->getRequestParameter('madre_nacionalidad_id'));
     $m_is_alive = $this->getRequestParameter('madre_vive');
     //chequeo is_alive
     if ($m_is_alive == 'S') {
         $m_is_alive = true;
     } elseif ($m_is_alive == 'N') {
         $m_is_alive = false;
     }
     //domicilio
     $m_city = $this->getRequestParameter('madre_domicilio_ciudad_id');
     $m_street = $this->getRequestParameter('madre_domicilio_calle');
     $m_number = $this->getRequestParameter('madre_domicilio_numero');
     $m_floor = $this->getRequestParameter('madre_domicilio_piso');
     $m_flat = $this->getRequestParameter('madre_domicilio_departamento');
     //Chequeo tutor (padre)
     $p_identification_type = $i_identification_type->getIdentificationType($this->getRequestParameter('padre_tipo_documento_id'));
     $p_identification_number = $this->getRequestParameter('padre_nro_documento');
     $p_firstname = $this->getRequestParameter('padre_nombres');
     $p_lastname = $this->getRequestParameter('padre_apellido');
     $p_occupation = $this->getRequestParameter('padre_actividad_id');
     $p_occupation_category = $this->getRequestParameter('padre_ocupacion_id');
     $p_study = $this->getRequestParameter('padre_estudios_id');
     $p_email = $this->getRequestParameter('padre_email');
     $p_phone = $this->getRequestParameter('padre_telefono_celular');
     $p_birthdate = $this->getRequestParameter('padre_fecha_nacimiento');
     $p_birth_city = $this->getRequestParameter('padre_ciudad_nacimiento_id');
     $p_nationality = $i_nationality->getNationality($this->getRequestParameter('padre_nacionalidad_id'));
     $p_is_alive = $this->getRequestParameter('padre_vive');
     //chequeo is_alive
     if ($p_is_alive == 'S') {
         $p_is_alive = true;
     } elseif ($p_is_alive == 'N') {
         $p_is_alive = false;
     }
     //domicilio
     $p_city = $this->getRequestParameter('padre_domicilio_ciudad_id');
     $p_street = $this->getRequestParameter('padre_domicilio_calle');
     $p_number = $this->getRequestParameter('padre_domicilio_numero');
     $p_floor = $this->getRequestParameter('padre_domicilio_piso');
     $p_flat = $this->getRequestParameter('padre_domicilio_departamento');
     $data = array();
     //chequeo campos obligatorios
     if (is_null($s_identification_type) || is_null($s_identification_number) || is_null($s_lastname) || trim($s_lastname) == "" || is_null($s_firstname) || trim($s_firstname) == "" || is_null($s_sex)) {
         throw new Exception('Missing data');
     } else {
         $con = Propel::getConnection();
         try {
             //chequeo que el alumno no haya sido ingresado en un año anterior (por lista de espera)
             $student = StudentPeer::retrieveByDocumentTypeAndNumber($s_identification_type, $s_identification_number);
             $con->beginTransaction();
             if (is_null($student)) {
                 //el alumno no existe. Creo la persona y el alumno
                 $s_person = new Person();
                 $s_person->setLastname($s_lastname);
                 $s_person->setFirstname($s_firstname);
                 $s_person->setSex($s_sex);
                 $s_person->setIdentificationType($s_identification_type);
                 $s_person->setIdentificationNumber($s_identification_number);
                 $s_person->setPhone($s_phone);
                 $s_person->setBirthdate($s_birthdate);
                 $s_person->setIsActive(true);
                 $s_person->setBirthCity($s_birth_city);
                 $s_person->save(Propel::getConnection());
                 $student = new Student();
                 $student->setPerson($s_person);
                 $student->setGlobalFileNumber('888888');
                 //Nro de legajo??
                 $student->setOriginSchoolId($s_origin_school_id);
                 $student->setHealthCoverageId($s_health_coverage_id);
                 $student->save(Propel::getConnection());
                 /* Recupero department, state ,country*/
                 if (!is_null($s_birth_city)) {
                     $city = CityPeer::retrieveByPk($s_birth_city);
                     $student->getPerson()->setBirthCountry($city->getDepartment()->getState()->getCountry()->getId());
                     $student->getPerson()->setBirthState($city->getDepartment()->getState()->getId());
                     $student->getPerson()->setBirthDepartment($city->getDepartment()->getId());
                 }
                 //chequeo domicilio
                 if (!is_null($s_city) || !is_null($s_street) || !is_null($s_number) || !is_null($s_floor) || is_null($s_flat)) {
                     $a = new Address();
                     $a->setCityId($s_city);
                     $a->setStreet($s_street);
                     $a->setNumber($s_number);
                     $a->setFloor($s_floor);
                     $a->setFlat($s_flat);
                     $student->getPerson()->setAddress($a);
                     $student->getPerson()->save(Propel::getConnection());
                     $data['message'] = "El alumno ha sido confirmado.";
                 }
             } else {
                 //seteo isActive
                 $student->getPerson()->setIsActive(true);
                 $student->save(Propel::getConnection());
                 $data['message'] = "El alumno fue actualizado correctamente.";
             }
             //chequeo campos obligatorios
             if (!is_null($m_identification_type) && !is_null($m_identification_number) && !is_null($m_lastname) && trim($m_lastname) != "" && !is_null($m_firstname) && trim($m_firstname) != "") {
                 //busco si ya existe.
                 $m_tutor = TutorPeer::findByDocumentTypeAndNumber($m_identification_type, $m_identification_number);
                 if (is_null($m_tutor)) {
                     //el tutor no existe. Lo creo
                     $m_person = new Person();
                     $m_person->setLastname($m_lastname);
                     $m_person->setFirstname($m_firstname);
                     $m_person->setIdentificationType($m_identification_type);
                     $m_person->setIdentificationNumber($m_identification_number);
                     $m_person->setSex(SexType::FEMALE);
                     $m_person->setPhone($m_phone);
                     $m_person->setEmail($m_email);
                     $m_person->setBirthdate($m_birthdate);
                     $m_person->setIsActive(true);
                     $m_person->setBirthCity($m_birth_city);
                     $m_person->save(Propel::getConnection());
                     $m_tutor = new Tutor();
                     $m_tutor->setPerson($m_person);
                     $m_tutor->setOccupationId($m_occupation);
                     $m_tutor->setOccupationCategoryId($m_occupation_category);
                     $m_tutor->setStudyId($m_study);
                     //coincide con la tabla sga_tipos_est_cur
                     $m_tutor->setNationality($m_nationality);
                     $m_tutor->setIsAlive($m_is_alive);
                     $m_tutor->save(Propel::getConnection());
                     /* Recupero department, state ,country*/
                     if (!is_null($m_birth_city)) {
                         $m_city = CityPeer::retrieveByPk($m_birth_city);
                         $m_tutor->getPerson()->setBirthCountry($m_city->getDepartment()->getState()->getCountry()->getId());
                         $m_tutor->getPerson()->setBirthState($m_city->getDepartment()->getState()->getId());
                         $m_tutor->getPerson()->setBirthDepartment($m_city->getDepartment()->getId());
                     }
                     //chequeo domicilio
                     if (!is_null($m_city) || !is_null($m_street) || !is_null($m_number) || !is_null($m_floor) || is_null($m_flat)) {
                         $a = new Address();
                         $a->setCityId($m_birth_city);
                         $a->setStreet($m_street);
                         $a->setNumber($m_number);
                         $a->setFloor($m_floor);
                         $a->setFlat($m_flat);
                         $m_tutor->getPerson()->setAddress($a);
                         $m_tutor->getPerson()->save(Propel::getConnection());
                     }
                 } else {
                     $data['info'] = "El tutor con " . $i_identification_type->getStringFor($m_identification_type) . " " . $m_identification_number;
                 }
                 $st = StudentTutorPeer::retrieveByStudentAndTutor($student, $m_tutor);
                 if (is_null($st)) {
                     //datos de tutor(madre)
                     $student_tutor = new StudentTutor();
                     $student_tutor->setStudent($student);
                     $student_tutor->setTutor($m_tutor);
                     $student_tutor->save(Propel::getConnection());
                     $m_tutor->addStudentTutor($student_tutor);
                     $m_tutor->save(Propel::getConnection());
                 }
             }
             //chequeo campos obligatorios
             if (!is_null($p_identification_type) && !is_null($p_identification_number) && !is_null($p_lastname) && trim($p_lastname) != "" && !is_null($p_firstname) && trim($p_firstname) != "") {
                 //busco si ya existe.
                 $tutor = TutorPeer::findByDocumentTypeAndNumber($p_identification_type, $p_identification_number);
                 if (is_null($tutor)) {
                     //el tutor no existe. Lo creo
                     $p_person = new Person();
                     $p_person->setLastname($p_lastname);
                     $p_person->setFirstname($p_firstname);
                     $p_person->setIdentificationType($p_identification_type);
                     $p_person->setIdentificationNumber($p_identification_number);
                     $p_person->setSex(SexType::MALE);
                     $p_person->setPhone($p_phone);
                     $p_person->setEmail($p_email);
                     $p_person->setBirthdate($p_birthdate);
                     $p_person->setIsActive(true);
                     $p_person->setBirthCity($p_birth_city);
                     $p_person->save(Propel::getConnection());
                     $tutor = new Tutor();
                     $tutor->setPerson($p_person);
                     $tutor->setOccupationId($p_occupation);
                     $tutor->setOccupationCategoryId($p_occupation_category);
                     $tutor->setStudyId($p_study);
                     //coincide con la tabla sga_tipos_est_cur
                     $tutor->setNationality($p_nationality);
                     $tutor->save(Propel::getConnection());
                     /* Recupero department, state ,country*/
                     if (!is_null($p_birth_city)) {
                         $p_city = CityPeer::retrieveByPk($p_birth_city);
                         $tutor->getPerson()->setBirthCountry($p_city->getDepartment()->getState()->getCountry()->getId());
                         $tutor->getPerson()->setBirthState($p_city->getDepartment()->getState()->getId());
                         $tutor->getPerson()->setBirthDepartment($p_city->getDepartment()->getId());
                     }
                     //chequeo domicilio
                     if (!is_null($p_city) || !is_null($p_street) || !is_null($p_number) || !is_null($p_floor) || is_null($p_flat)) {
                         $a = new Address();
                         $a->setCityId($p_birth_city);
                         $a->setStreet($p_street);
                         $a->setNumber($p_number);
                         $a->setFloor($p_floor);
                         $a->setFlat($p_flat);
                         $tutor->getPerson()->setAddress($a);
                         $tutor->getPerson()->save(Propel::getConnection());
                     }
                     if (!is_null($data['info'])) {
                         $data['info'] = $data['info'] . " ya existe en el sistema. Por favor actualice los datos.";
                     }
                 } else {
                     if (!is_null($data['info'])) {
                         $data['info'] = "Los tutores con " . $i_identification_type->getStringFor($m_identification_type) . " " . $m_identification_number . " y " . $i_identification_type->getStringFor($p_identification_type) . " " . $p_identification_number . " ya existen en el sistema. Por favor actualice los datos.";
                     } else {
                         $data['info'] = "El tutor con " . $i_identification_type->getStringFor($p_identification_type) . " " . $p_identification_number . " ya existe en el sistema. Por favor actualice los datos.";
                     }
                 }
                 //datos de tutor(padre)
                 $st = StudentTutorPeer::retrieveByStudentAndTutor($student, $tutor);
                 if (is_null($st)) {
                     $student_tutor = new StudentTutor();
                     $student_tutor->setStudent($student);
                     $student_tutor->setTutor($tutor);
                     $student_tutor->save(Propel::getConnection());
                     $tutor->addStudentTutor($student_tutor);
                     $tutor->save(Propel::getConnection());
                 }
             }
             $con->commit();
         } catch (PropelException $e) {
             $con->rollBack();
             throw $e;
         }
     }
     $this->data = $data;
     $this->getResponse()->setHttpHeader('Content-type', 'application/json');
     $this->getResponse()->setContent(json_encode($data));
     $this->setLayout(false);
 }
Example #5
0
     $zip = array_key_exists("zip", $_REQUEST) ? $_REQUEST["zip"] : "";
     $country = array_key_exists("country", $_REQUEST) ? $_REQUEST["country"] : "";
     $url = array_key_exists("url", $_REQUEST) ? $_REQUEST["url"] : "";
     $biography = array_key_exists("biography", $_REQUEST) ? $_REQUEST["biography"] : "";
     $isPublic = array_key_exists("ispublic", $_REQUEST) ? $_REQUEST["ispublic"] : "";
     $newPerson = new Person();
     $newPerson->setUid($userId);
     $newPerson->setFirstName($firstname);
     $newPerson->setLastName($lastname);
     $newPerson->setTitle($title);
     $newPerson->setInstitution($institution);
     $newPerson->setCity($city);
     $newPerson->setState($state);
     $newPerson->setZip($zip);
     $newPerson->setCountry($country);
     $newPerson->setEmail($email);
     $newPerson->setUrl($url);
     $newPerson->setBiography($biography);
     $newPerson->setIsPublic($isPublic);
     if (!$pHandler->updateProfile($newPerson)) {
         $statusStr = "Profile update failed!";
     }
     $person = $pHandler->getPerson();
     if ($person->getIsTaxonomyEditor()) {
         $tabIndex = 3;
     } else {
         $tabIndex = 2;
     }
 } elseif ($action == "Change Password") {
     $newPwd = $_REQUEST["newpwd"];
     $updateStatus = false;
Example #6
0
 public static function getPersons()
 {
     $dados = Database::ReadAll("person", "*");
     if (!$dados) {
         return '';
     }
     foreach ($dados as $dado) {
         $person = new Person();
         $person->setId($dado['ID_PERSON']);
         $person->setName($dado['NAME_PERSON']);
         $person->setEmail($dado['EMAIL']);
         $person->setAge($dado['AGE']);
         $person->setSex($dado['SEX']);
         $person->setPhone($dado['PHONE']);
         $person->setOperator($dado['OPERATOR']);
         $person->setMaritalStatus($dado['MARITAL_STATUS']);
         $person->setChildren($dado['CHILDREN']);
         $religion = Religion::getReligion("WHERE id_religion = " . $dado['ID_RELIGION']);
         $person->setReligion($religion);
         $address = Address::getAddress("AND id_address = " . $dado['ID_ADDRESS']);
         $person->setAddress($address);
         $login = Login::getLogin($dado['ID_PERSON']);
         $person->setLogin($login);
         $persons[] = $person;
     }
     return $persons;
 }
Example #7
0
$address1->setNumber("unit 2415 Megaplaza Building");
$address1->setStreet("ADB Avenue corner Garnett Street");
$address1->setBarangay("Barangay San Antonio");
$address1->setDistrict("Ortigas Center");
$address1->setMunicipalityCity("Pasig City");
$address1->setProvince("Metro Manila");
$address1->setDomDocument();
$person = new Person();
//$person->setPersonID(126);
$person->setFirstName("Nelson Juan");
$person->setMiddleName("Miranda");
$person->setLastName(date("H:i:s"));
$person->setGender("male");
$person->setBirthday("1977/07/09");
$person->setMaritalStatus("single");
$person->setTin("1234567890");
$person->setTelephone("026584746");
$person->setMobileNumber("09175302791");
$person->setEmail("*****@*****.**");
$person->setAddressArray($address);
$person->setAddressArray($address1);
$person->setDomDocument();
$domDoc = $person->getDomDocument();
$xmlStr = $domDoc->dump_mem(true);
$obj = new PersonEncode();
//echo "hello<br>";
echo $xmlStr;
//echo $obj->updatePerson($xmlStr);
echo $obj->savePerson($xmlStr);
//echo  $obj->getPersonDetails(1);
//*/
Example #8
0
 public function register($postArr)
 {
     $status = false;
     $firstName = $postArr['firstname'];
     $lastName = $postArr['lastname'];
     if ($postArr['institution'] && !trim(strpos($postArr['institution'], ' ')) && preg_match('/[a-z]+[A-Z]+[a-z]+[A-Z]+/', $postArr['institution'])) {
         if ($postArr['title'] && !trim(strpos($postArr['title'], ' ')) && preg_match('/[a-z]+[A-Z]+[a-z]+[A-Z]+/', $postArr['title'])) {
             return false;
         }
     }
     $person = new Person();
     $person->setPassword($postArr['pwd']);
     $person->setUserName($this->userName);
     $person->setFirstName($firstName);
     $person->setLastName($lastName);
     $person->setTitle($postArr['title']);
     $person->setInstitution($postArr['institution']);
     $person->setCity($postArr['city']);
     $person->setState($postArr['state']);
     $person->setZip($postArr['zip']);
     $person->setCountry($postArr['country']);
     $person->setEmail($postArr['emailaddr']);
     $person->setUrl($postArr['url']);
     $person->setBiography($postArr['biography']);
     $person->setIsPublic(isset($postArr['ispublic']) ? 1 : 0);
     //Add to users table
     $fields = 'INSERT INTO users (';
     $values = 'VALUES (';
     $fields .= 'firstname ';
     $values .= '"' . $this->cleanInStr($person->getFirstName()) . '"';
     $fields .= ', lastname';
     $values .= ', "' . $this->cleanInStr($person->getLastName()) . '"';
     if ($person->getTitle()) {
         $fields .= ', title';
         $values .= ', "' . $this->cleanInStr($person->getTitle()) . '"';
     }
     if ($person->getInstitution()) {
         $fields .= ', institution';
         $values .= ', "' . $this->cleanInStr($person->getInstitution()) . '"';
     }
     if ($person->getDepartment()) {
         $fields .= ', department';
         $values .= ', "' . $this->cleanInStr($person->getDepartment()) . '"';
     }
     if ($person->getAddress()) {
         $fields .= ', address';
         $values .= ', "' . $this->cleanInStr($person->getAddress()) . '"';
     }
     if ($person->getCity()) {
         $fields .= ', city';
         $values .= ', "' . $this->cleanInStr($person->getCity()) . '"';
     }
     $fields .= ', state';
     $values .= ', "' . $this->cleanInStr($person->getState()) . '"';
     $fields .= ', country';
     $values .= ', "' . $this->cleanInStr($person->getCountry()) . '"';
     if ($person->getZip()) {
         $fields .= ', zip';
         $values .= ', "' . $this->cleanInStr($person->getZip()) . '"';
     }
     if ($person->getPhone()) {
         $fields .= ', phone';
         $values .= ', "' . $this->cleanInStr($person->getPhone()) . '"';
     }
     if ($person->getEmail()) {
         $fields .= ', email';
         $values .= ', "' . $this->cleanInStr($person->getEmail()) . '"';
     }
     if ($person->getUrl()) {
         $fields .= ', url';
         $values .= ', "' . $person->getUrl() . '"';
     }
     if ($person->getBiography()) {
         $fields .= ', biography';
         $values .= ', "' . $this->cleanInStr($person->getBiography()) . '"';
     }
     if ($person->getIsPublic()) {
         $fields .= ', ispublic';
         $values .= ', ' . $person->getIsPublic();
     }
     $sql = $fields . ') ' . $values . ')';
     //echo "SQL: ".$sql;
     $editCon = $this->getConnection('write');
     if ($editCon->query($sql)) {
         $person->setUid($editCon->insert_id);
         $this->uid = $person->getUid();
         //Add userlogin
         $sql = 'INSERT INTO userlogin (uid, username, password) ' . 'VALUES (' . $person->getUid() . ', "' . $this->cleanInStr($person->getUserName()) . '", PASSWORD("' . $this->cleanInStr($person->getPassword()) . '"))';
         if ($editCon->query($sql)) {
             $status = true;
             //authenicate
             $this->userName = $person->getUserName();
             $this->displayName = $person->getFirstName();
             $this->reset();
             $this->setCookies();
         } else {
             $this->errorStr = 'FAILED: Unable to create user.<div style="margin-left:55px;">Please contact system administrator for assistance.</div>';
         }
     }
     $editCon->close();
     return $status;
 }
Example #9
0
 public function executeStepSave(sfWebRequest $request)
 {
     $passenger_session_step5 = $this->getUser()->getAttribute('passangers_step5');
     if (!$passenger_session_step5) {
         return $this->forward('passanger', 'step5_4');
     }
     //save Person data
     $person = new Person();
     $person->setTitle($passenger_session_step5['title']);
     $person->setFirstName($passenger_session_step5['firstname']);
     $person->setLastName($passenger_session_step5['lastname']);
     $person->setAddress1($passenger_session_step5['address1']);
     $person->setAddress2($passenger_session_step5['address2']);
     $person->setCity($passenger_session_step5['city']);
     $person->setCounty($passenger_session_step5['county']);
     $person->setState($passenger_session_step5['state']);
     $person->setCountry($passenger_session_step5['country']);
     $person->setZipcode($passenger_session_step5['zipcode']);
     $person->setDayPhone($passenger_session_step5['day_phone']);
     $person->setDayComment($passenger_session_step5['day_comment']);
     $person->setEveningPhone($passenger_session_step5['eve_phone']);
     $person->setEveningComment($passenger_session_step5['eve_comment']);
     $person->setMobilePhone($passenger_session_step5['mobile_phone']);
     $person->setMobileComment($passenger_session_step5['mobile_comment']);
     $person->setPagerPhone($passenger_session_step5['pager_phone']);
     $person->setPagerComment($passenger_session_step5['pager_comment']);
     $person->setOtherPhone($passenger_session_step5['other_comment']);
     $person->setOtherComment($passenger_session_step5['other_comment']);
     $person->setFaxPhone1($passenger_session_step5['fax_phone1']);
     $person->setFaxComment1($passenger_session_step5['fax_comment1']);
     $person->setAutoFax($passenger_session_step5['auto_fax']);
     $person->setFaxPhone2($passenger_session_step5['fax_phone2']);
     $person->setFaxComment2($passenger_session_step5['fax_comment2']);
     $person->setEmail($passenger_session_step5['email']);
     $person->setEmailTextOnly($passenger_session_step5['textonly']);
     $person->setEmailBlocked($passenger_session_step5['emailblocked']);
     $person->setComment($passenger_session_step5['comment']);
     $person->setBlockMailings($passenger_session_step5['blockmailings']);
     $person->setNewsletter($passenger_session_step5['newsletter']);
     $person->setGender($passenger_session_step5['gender']);
     $person->setDeceased($passenger_session_step5['deceased']);
     $person->setDeceasedComment($passenger_session_step5['deceased_comment']);
     $person->setSecondaryEmail($passenger_session_step5['secemail']);
     $person->setDeceasedDate($passenger_session_step5['deceased_date']);
     $person->setMiddleName($passenger_session_step5['middlename']);
     $person->setSuffix($passenger_session_step5['suffix']);
     $person->setNickname($passenger_session_step5['nickname']);
     $person->setVeteran($passenger_session_step5['military']);
     $person->save();
     //save Passenger data
     $passenger = new Passenger();
     $passenger->setPersonId($person->getId());
     if ($passenger_session_step5['passenger_type_id'] == 0) {
         $passenger->setPassengerTypeId(null);
     } else {
         $passenger->setPassengerTypeId($passenger_session_step5['passenger_type_id']);
     }
     $passenger->setParent($passenger_session_step5['parent']);
     $passenger->setDateOfBirth($passenger_session_step5['date_of_birth']);
     $passenger->setWeight($passenger_session_step5['weight']);
     $passenger->setIllness($passenger_session_step5['illness']);
     $passenger->setPassengerIllnessCategoryId($passenger_session_step5['passenger_illness_category_id']);
     $passenger->setLanguageSpoken($passenger_session_step5['language_spoken']);
     $passenger->setBestContactMethod($passenger_session_step5['best_contact_method']);
     $passenger->setFinancial($passenger_session_step5['facility_name']);
     $passenger->setPublicConsiderations($passenger_session_step5['public_considerations']);
     $passenger->setPrivateConsiderations($passenger_session_step5['private_considerations']);
     $passenger->setGroundTransportationComment($passenger_session_step5['ground_transportation_comment']);
     $passenger->setTravelHistoryNotes($passenger_session_step5['travel_history_notes']);
     $passenger->setReleasingPhysician($passenger_session_step5['releasing_physician']);
     $passenger->setReleasingPhone($passenger_session_step5['releasing_phone']);
     $passenger->setReleasingFax1($passenger_session_step5['releasing_fax1']);
     $passenger->setReleasingFax1Comment($passenger_session_step5['releasing_fax1_comment']);
     $passenger->setReleasingEmail($passenger_session_step5['releasing_email']);
     $passenger->setNeedMedicalRelease($passenger_session_step5['need_medical_release']);
     $passenger->setMedicalReleaseRequested($passenger_session_step5['medical_release_requested']);
     $passenger->setMedicalReleaseReceived($passenger_session_step5['medical_release_received']);
     $passenger->setTreatingPhysician($passenger_session_step5['treating_physician']);
     $passenger->setTreatingPhone($passenger_session_step5['treating_phone']);
     $passenger->setTreatingFax1($passenger_session_step5['treating_fax1']);
     $passenger->setTreatingFax1Comment($passenger_session_step5['treating_fax1_comment']);
     $passenger->setTreatingEmail($passenger_session_step5['treating_email']);
     $passenger->setLanguageSpoken($passenger_session_step5['language_spoken']);
     $passenger->setLodgingPhone($passenger_session_step5['lodging_phone']);
     $passenger->setLodgingPhoneComment($passenger_session_step5['lodging_phone_comment']);
     $passenger->setFacilityName($passenger_session_step5['facility_name']);
     $passenger->setFacilityPhone($passenger_session_step5['facility_phone']);
     $passenger->setFacilityPhoneComment($passenger_session_step5['facility_phone_comment']);
     $passenger->setEmergencyContactName($passenger_session_step5['emergency_contact_name']);
     $passenger->setEmergencyContactPrimaryPhone($passenger_session_step5['emergency_contact_primary_phone']);
     $passenger->setEmergencyContactPrimaryComment($passenger_session_step5['emergency_contact_primary_comment']);
     $passenger->setEmergencyContactSecondaryPhone($passenger_session_step5['emergency_contact_secondary_phone']);
     $passenger->setEmergencyContactSecondaryComment($passenger_session_step5['emergency_contact_secondary_comment']);
     $passenger->save();
     $key = $passenger_session_step5['key'];
     $this->getUser()->setFlash('success', 'Passenger information has been successfully created!');
     $this->redirect('@passenger');
     //removing used session like passenger data
     unset($passenger_session_step5p[$key]);
     $this->getUser()->setAttribute('passanger_step5', $passenger_session_step5);
 }
/**
 * @copyright 2011 City of Bloomington, Indiana
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
 * @author Cliff Ingham <*****@*****.**>
 */
include '../../../configuration.inc';
include './migrationConfig.inc';
$pdo = new PDO(MIGRATION_DSN, MIGRATION_USER, MIGRATION_PASS);
$sql = "select distinct\r\n\t\tfirstname,lastname,email,phone,address,city,state,zip\t\t\r\n\t\tfrom contacts";
$result = $pdo->query($sql);
foreach ($result->fetchAll(PDO::FETCH_ASSOC) as $row) {
    $person = new Person();
    $person->setFirstname(ucwords(strtolower($row['firstname'])));
    $person->setPhone($row['phone']);
    $person->setLastname(ucwords(strtolower($row['lastname'])));
    $person->setEmail($row['email']);
    if ($row['address'] && strtolower($row['city']) == 'bloomington') {
        $row['address'] = preg_replace('/[^a-zA-Z0-9\\-\\&\\s\'\\/]/', '', $row['address']);
        $url = new URL(ADDRESS_SERVICE . '/addresses/parse.php');
        $url->format = 'xml';
        $url->address = $row['address'];
        $parsed = new SimpleXMLElement($url, null, true);
        if ($parsed->street_number && $parsed->street_name) {
            // Look up their address in Master Address
            $url = new URL(ADDRESS_SERVICE . '/home.php');
            $url->queryType = 'address';
            $url->format = 'xml';
            $url->query = $row['address'];
            echo $url->query . " ==> ";
            $xml = new SimpleXMLElement($url, null, true);
            if (count($xml) == 1) {
$c = new City();
$c->setName('San Francisco');
$c->save();
$s = new Student();
$s->setCity($c);
$s->setEmail('*****@*****.**');
$s->setName('Mateus Fornari');
$s->setNumber('123456');
var_dump($s->save());
$course = new Course();
$course->setDescription('PHP Programming');
$course->save();
$s->addCourses($course);
$p = new Person();
$p->setCity($c);
$p->setEmail('*****@*****.**');
$p->setName('Other Person');
$p->save();
$b = new Book();
$b->setAuthor($p);
$b->setTitle('PHP Book');
$b->save();
Hypersistence::commit();
//LOAD
$p = new Person();
$p->setId(1);
$p->load();
echo $p->getName() . "\n";
$books = $p->getBooks()->execute();
foreach ($books as $b) {
    echo $b->getTitle() . "\n";
Example #12
0
 $history->setActionDate($row['insp_date']);
 $history->setNotes("{$row['action_taken']}\n{$row['next_action']}");
 if ($row['username']) {
     try {
         $person = new Person($row['username']);
         $history->setEnteredByPerson($person);
         $history->setActionPerson($person);
     } catch (Exception $e) {
         $person = new Person();
         $person->setUsername($row['username']);
         $person->setAuthenticationMethod('LDAP');
         try {
             $ldap = new LDAPEntry($person->getUsername());
             $person->setFirstname($ldap->getFirstname());
             $person->setLastname($ldap->getLastname());
             $person->setEmail($ldap->getEmail());
             $person->save();
         } catch (Exception $e) {
             $person = new Person();
             $person->setFirstname(strtolower($row['username']));
             $person->save();
         }
         $history->setEnteredByPerson($person);
         $history->setActionPerson($person);
     }
 } elseif ($row['needed'] || $row['existing']) {
     $name = $row['needed'] ? $row['needed'] : $row['existing'];
     list($firstname, $lastname) = explode(' ', $name);
     $list = new PersonList(array('firstname' => ucwords(strtolower($firstname)), 'lastname' => ucwords(strtolower($lastname))));
     if (count($list)) {
         $list->next();
                $peopleInfoXML = file_get_contents($baseURL . $searchURL, false, $context) or die("The mospace server might failed\n");
                //echo $baseURL.$searchURL;
                $peopleInfoXMLObject = simplexml_load_string($peopleInfoXML, null, LIBXML_NOCDATA);
                if ($peopleInfoXMLObject['found'] == 0 || $peopleInfoXMLObject['found'] >= 49) {
                    continue;
                }
                //echo "<pre>";
                ///print_r($peopleInfoXMLObject->Person);
                //echo "</pre>";
                $personObject = new Person();
                $personObject->setLastName($parser->getLast());
                $personObject->setFirstName($parser->getFirst());
                //For test purpose only
                //echo $personObject->getLastName().", ".$personObject->getFirstName().";   ";
                $personObject->setDepartment($peopleInfoXMLObject->Person->Department);
                $personObject->setTitle($peopleInfoXMLObject->Person->Title);
                //$personObject->setImageURL("http://freelanceme.net/Images/default%20profile%20picture.png");
                if ($peopleInfoXMLObject->Person->Phone != null) {
                    $personObject->setPhone($peopleInfoXMLObject->Person->Phone);
                }
                $personObject->setEmail($peopleInfoXMLObject->Person->{'E-mail'});
                $personObject->insertToDatabase();
            }
            echo "\n";
            //For testing purpose only
            //if($i++ > 10){
            //break;
            //}
        }
    }
}
Example #14
0
 /**
  * missionRequests save all data into corresponding tables
  * CODE:mission_request_create
  */
 public function executeSave(sfWebRequest $request)
 {
     # security
     if (!$this->getUser()->hasCredential(array('Administrator', 'Staff', 'Coordinator'), false)) {
         $this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getReferer());
         $this->redirect('dashboard/index');
     }
     $miss_req_session = $this->getUser()->getAttribute('miss_req');
     if (!$miss_req_session) {
         return $this->forward('passenger', 'step3');
     }
     //set Requester Person
     $req_person = new Person();
     $req_person->setFirstName($miss_req_session->getReqFirstname());
     $req_person->setLastName($miss_req_session->getReqLastname());
     $req_person->setAddress1($miss_req_session->getReqAddress1());
     $req_person->setAddress2($miss_req_session->getReqAddress2());
     $req_person->setCity($miss_req_session->getReqCity());
     $req_person->setCounty($miss_req_session->getReqCounty());
     $req_person->setState($miss_req_session->getReqState());
     $req_person->setCountry($miss_req_session->getReqCountry());
     $req_person->setZipcode($miss_req_session->getReqZipcode());
     $req_person->setEmail($miss_req_session->getReqEmail());
     $req_person->setSecondaryEmail($miss_req_session->getReqSecondaryEmail());
     $req_person->setPagerEmail($miss_req_session->getReqPagerEmail());
     $req_person->setDayPhone($miss_req_session->getReqDayPhone());
     $req_person->setDayComment($miss_req_session->getReqDayComment());
     $req_person->setEveningPhone($miss_req_session->getReqEvePhone());
     $req_person->setEveningComment($miss_req_session->getReqEveComment());
     $req_person->setMobilePhone($miss_req_session->getReqMobilePhone());
     $req_person->setMobileComment($miss_req_session->getReqMobileComment());
     $req_person->setPagerPhone($miss_req_session->getReqPagerPhone());
     $req_person->setPagerComment($miss_req_session->getReqPagerComment());
     $req_person->setOtherPhone($miss_req_session->getReqOtherPhone());
     $req_person->setOtherComment($miss_req_session->getReqOtherComment());
     $req_person->save();
     //end of Requester Person
     // set Requester Agency
     $agency = AgencyPeer::getByNamePhone(trim($miss_req_session->getAgencyName()));
     if ($agency) {
         # nothing
     } else {
         $agency = new Agency();
         $agency->setName(trim($miss_req_session->getAgencyName()));
         $agency->save();
     }
     //set Requester
     $requester = new Requester();
     $requester->setPersonId($req_person->getId());
     $requester->setAgencyId($agency->getId());
     //$requester->setDischarge($miss_req_session->getReqDischarge());
     $requester->save();
     if (isset($miss_req_session->passenger_id)) {
         $passenger = PassengerPeer::retrieveByPK($miss_req_session->passenger_id);
         if (!$passenger instanceof Passenger) {
             $passenger = new Passenger();
         }
     } else {
         $passenger = new Passenger();
     }
     if ($passenger->isNew()) {
         $person = new Person();
     } else {
         $person = $passenger->getPerson();
     }
     //set Person to Passenger
     $person->setTitle($miss_req_session->getPassTitle());
     $person->setFirstName($miss_req_session->getPassFirstName());
     $person->setLastName($miss_req_session->getPassLastName());
     $person->setGender($miss_req_session->getPassGender());
     $person->setAddress1($miss_req_session->getPassAddress1());
     $person->setAddress2($miss_req_session->getPassAddress2());
     $person->setCity($miss_req_session->getPassCity());
     $person->setState($miss_req_session->getPassState());
     $person->setZipcode($miss_req_session->getPassZipcode());
     $person->setCountry($miss_req_session->getPassCountry());
     $person->setEmail($miss_req_session->getPassEmail());
     $person->setDayPhone($miss_req_session->getPassDayPhone());
     $person->setDayComment($miss_req_session->getPassDayComment());
     $person->setEveningPhone($miss_req_session->getPassEvePhone());
     $person->setEveningComment($miss_req_session->getPassEveComment());
     $person->setMobilePhone($miss_req_session->getPassMobilePhone());
     $person->setMobileComment($miss_req_session->getPassMobileComment());
     $person->setPagerPhone($miss_req_session->getPassPagerPhone());
     $person->setPagerComment($miss_req_session->getPassPagerComment());
     $person->setOtherPhone($miss_req_session->getPassOtherPhone());
     $person->setOtherComment($miss_req_session->getPassOtherComment());
     $person->save();
     //set Passenger
     $passenger->setPersonId($person->getId());
     $passenger->setPassengerTypeId($miss_req_session->getPassType());
     $passenger->setDateOfBirth($miss_req_session->getPassDateOfBirth());
     $passenger->setIllness($miss_req_session->getIllness());
     $passenger->setFinancial($miss_req_session->getFinancial());
     $passenger->setPublicConsiderations($miss_req_session->getPassPublicCons());
     $passenger->setPrivateConsiderations($miss_req_session->getPassPrivateCons());
     $passenger->setReleasingPhysician($miss_req_session->getReleasingPhysician());
     $passenger->setReleasingPhone($miss_req_session->getReleasePhone());
     $passenger->setReleasingFax1($miss_req_session->getReleaseFax());
     $passenger->setReleasingFax1Comment($miss_req_session->getReleaseFaxComment());
     $passenger->setLodgingName($miss_req_session->getLodgingName());
     $passenger->setLodgingPhone($miss_req_session->getLodgingPhone());
     $passenger->setLodgingPhoneComment($miss_req_session->getLodgingPhoneComment());
     $passenger->setFacilityName($miss_req_session->getFacilityName());
     $passenger->setFacilityPhone($miss_req_session->getFacilityPhone());
     $passenger->setFacilityPhoneComment($miss_req_session->getFacilityPhoneComment());
     $passenger->setReleasingEmail($miss_req_session->getReleaseEmail());
     $passenger->setTreatingPhysician($miss_req_session->getTreatingPhysician());
     $passenger->setTreatingPhone($miss_req_session->getTreatingPhone());
     $passenger->setTreatingFax1($miss_req_session->getTreatingFax());
     $passenger->setTreatingFax1Comment($miss_req_session->getTreatingFaxComment());
     $passenger->setTreatingEmail($miss_req_session->getTreatingEmail());
     $passenger->setLanguageSpoken($miss_req_session->getPassLanguage());
     $passenger->setBestContactMethod($miss_req_session->getBestContact());
     $passenger->setEmergencyContactName($miss_req_session->getEmergencyName());
     $passenger->setEmergencyContactPrimaryPhone($miss_req_session->getEmergencyPhone1());
     $passenger->setEmergencyContactPrimaryComment($miss_req_session->getEmergencyPhone1Comment());
     $passenger->setEmergencyContactSecondaryPhone($miss_req_session->getEmergencyPhone2());
     $passenger->setEmergencyContactSecondaryComment($miss_req_session->getEmergencyPhone2Comment());
     $passenger->setNeedMedicalRelease($miss_req_session->getPassMedical());
     $passenger->save();
     //set Companions
     if ($passenger && $miss_req_session->getCom1Name()) {
         $person = new Person();
         $names[] = split(" ", $miss_req_session->getCom1Name());
         //echo var_dump($names); die();
         $person->setFirstName($names[0][0]);
         $person->setLastName($names[0][1]);
         $person->setDayPhone($miss_req_session->getCom1Phone());
         $person->setDayComment($miss_req_session->getCom1Comment());
         $person->save();
         $companion = new Companion();
         $companion->setPassengerId($passenger->getId());
         $companion->setName($miss_req_session->getCom1Name());
         $companion->setRelationship($miss_req_session->getCom1Relationship());
         $companion->setDateOfBirth($miss_req_session->getCom1DateOfBirth());
         $companion->setWeight($miss_req_session->getCom1Weigth());
         $companion->setCompanionPhone($miss_req_session->getCom1Phone());
         $companion->setCompanionPhoneComment($miss_req_session->getCom1Comment());
         $companion->setPersonId($person->getId());
         $companion->save();
     }
     if ($passenger && $miss_req_session->getCom2Name()) {
         $person = new Person();
         $names[] = split(" ", $miss_req_session->getCom2Name());
         //echo var_dump($names); die();
         $person->setFirstName($names[0][0]);
         $person->setLastName($names[0][1]);
         $person->setDayPhone($miss_req_session->getCom2Phone());
         $person->setDayComment($miss_req_session->getCom2Comment());
         $person->save();
         $companion = new Companion();
         $companion->setPassengerId($passenger->getId());
         $companion->setName($miss_req_session->getCom2Name());
         $companion->setRelationship($miss_req_session->getCom2Relationship());
         $companion->setDateOfBirth($miss_req_session->getCom2DateOfBirth());
         $companion->setWeight($miss_req_session->getCom2Weigth());
         $companion->setCompanionPhone($miss_req_session->getCom2Phone());
         $companion->setCompanionPhoneComment($miss_req_session->getCom2Comment());
         $companion->setPersonId($person->getId());
         $companion->save();
     }
     if ($passenger && $miss_req_session->getCom3Name()) {
         $person = new Person();
         $names[] = split(" ", $miss_req_session->getCom3Name());
         //echo var_dump($names); die();
         $person->setFirstName($names[0][0]);
         $person->setLastName($names[0][1]);
         $person->setDayPhone($miss_req_session->getCom3Phone());
         $person->setDayComment($miss_req_session->getCom3Comment());
         $person->save();
         $companion = new Companion();
         $companion->setPassengerId($passenger->getId());
         $companion->setName($miss_req_session->getCom3Name());
         $companion->setRelationship($miss_req_session->getCom3Relationship());
         $companion->setDateOfBirth($miss_req_session->getCom3DateOfBirth());
         $companion->setWeight($miss_req_session->getCom3Weigth());
         $companion->setCompanionPhone($miss_req_session->getCom3Phone());
         $companion->setCompanionPhoneComment($miss_req_session->getCom3Comment());
         $companion->setPersonId($person->getId());
         $companion->save();
     }
     if ($passenger && $miss_req_session->getCom4Name()) {
         $person = new Person();
         $names[] = split(" ", $miss_req_session->getCom4Name());
         //echo var_dump($names); die();
         $person->setFirstName($names[0][0]);
         $person->setLastName($names[0][1]);
         $person->setDayPhone($miss_req_session->getCom4Phone());
         $person->setDayComment($miss_req_session->getCom4Comment());
         $person->save();
         $companion = new Companion();
         $companion->setPassengerId($passenger->getId());
         $companion->setName($miss_req_session->getCom4Name());
         $companion->setRelationship($miss_req_session->getCom4Relationship());
         $companion->setDateOfBirth($miss_req_session->getCom4DateOfBirth());
         $companion->setWeight($miss_req_session->getCom4Weigth());
         $companion->setCompanionPhone($miss_req_session->getCom4Phone());
         $companion->setCompanionPhoneComment($miss_req_session->getCom4Comment());
         $companion->setPersonId($person->getId());
         $companion->save();
     }
     if ($passenger && $miss_req_session->getCom5Name()) {
         $person = new Person();
         $names[] = split(" ", $miss_req_session->getCom5Name());
         //echo var_dump($names); die();
         $person->setFirstName($names[0][0]);
         $person->setLastName($names[0][1]);
         $person->setDayPhone($miss_req_session->getCom5Phone());
         $person->setDayComment($miss_req_session->getCom5Comment());
         $person->save();
         $companion = new Companion();
         $companion->setPassengerId($passenger->getId());
         $companion->setName($miss_req_session->getCom5Name());
         $companion->setRelationship($miss_req_session->getCom5Relationship());
         $companion->setDateOfBirth($miss_req_session->getCom5DateOfBirth());
         $companion->setWeight($miss_req_session->getCom5Weigth());
         $companion->setCompanionPhone($miss_req_session->getCom5Phone());
         $companion->setCompanionPhoneComment($miss_req_session->getCom5Comment());
         $companion->setPersonId($person->getId());
         $companion->save();
     }
     //set Itinerary
     $itinerary = ItineraryPeer::getByMissReqId($miss_req_session->getId());
     if (!$itinerary) {
         $new_itinerary = new Itinerary();
         $new_itinerary->setDateRequested(date('m/d/Y'));
         $new_itinerary->setMissionRequestId($miss_req_session->getId());
         $new_itinerary->setMissionTypeId($miss_req_session->getMissionRequestTypeId());
         $new_itinerary->setApointTime($miss_req_session->getApptDate());
         $new_itinerary->setPassengerId($passenger->getId());
         $new_itinerary->setRequesterId($requester->getId());
         $new_itinerary->setFacility($miss_req_session->getFacilityName());
         $new_itinerary->setLodging($miss_req_session->getLodgingName());
         $new_itinerary->setOrginCity($miss_req_session->getOrginCity());
         $new_itinerary->setOrginState($miss_req_session->getOrginState());
         $new_itinerary->setDestCity($miss_req_session->getDestCity());
         $new_itinerary->setDestState($miss_req_session->getDestState());
         $new_itinerary->setWaiverNeed(0);
         $new_itinerary->setNeedMedicalRelease($miss_req_session->getPassMedical());
         $new_itinerary->setComment($miss_req_session->getComment());
         $new_itinerary->setAgencyId($agency->getId());
         $new_itinerary->save();
     }
     //set default Mission to Mission table
     //get Passenger
     //$passenger = PassengerPeer::getByPersonId($person->getId());
     $misson = new Mission();
     $misson->setRequestId($miss_req_session->getId());
     $misson->setItineraryId($new_itinerary->getId());
     $misson->setMissionTypeId($miss_req_session->getMissionRequestTypeId());
     $misson->setDateRequested($miss_req_session->getRequesterDate());
     if ($passenger) {
         $misson->setPassengerId($passenger->getId());
     }
     if ($requester) {
         $misson->setRequesterId($requester->getId());
     }
     if ($agency) {
         $misson->setAgencyId($agency->getId());
     }
     // Farazi Mission 1 externa ID
     $c = new Criteria();
     $c->add(MissionPeer::EXTERNAL_ID, NULL, Criteria::ISNOTNULL);
     $c->addDescendingOrderByColumn(MissionPeer::ID);
     $external_mission = MissionPeer::doSelectOne($c);
     $external_id = $external_mission->getExternalId();
     $currentExternalId = $external_id + 1;
     $misson->setExternalId($currentExternalId);
     $misson->setApptDate($miss_req_session->getApptDate());
     $misson->setFlightTime($miss_req_session->getFlightTime());
     $misson->setMissionDate($miss_req_session->getMissionDate());
     $misson->setMissionCount(1);
     $misson->save();
     $missLeg = new MissionLeg();
     $missLeg->setMissionId($misson->getId());
     $missLeg->setLegNumber(1);
     if ($miss_req_session->getOrginState() && $miss_req_session->getOrginZipcode()) {
         //echo $miss_req_session->getOrginState().'-'.$miss_req_session->getOrginZipcode();die();
         $fromairport = AirportPeer::getAirportByStateAndZipcode($miss_req_session->getOrginState(), $miss_req_session->getOrginZipcode());
         if ($fromairport) {
             $missLeg->setFromAirportId($fromairport->getId());
         }
     }
     if ($miss_req_session->getDestState() && $miss_req_session->getDestZipcode()) {
         //echo $miss_req_session->getDestState().'--'.$miss_req_session->getDestZipcode();die();
         $toairport = AirportPeer::getAirportByStateAndZipcode($miss_req_session->getDestState(), $miss_req_session->getDestZipcode());
         if ($toairport) {
             $missLeg->setToAirportId($toairport->getId());
         }
     }
     //echo "oder";die();
     $missLeg->setPassOnBoard(0);
     $missLeg->setWebCoordinated(0);
     $missLeg->setTransportation('air_mission');
     $missLeg->save();
     //end set Mission
     $this->getUser()->setFlash('success', 'New mission has successfully created!');
     $miss_req_session->setProcessedDate(time());
     $miss_req_session->save();
     $this->getUser()->setAttribute('miss_req', null);
     //$this->redirect('miss_req');
     //$this->getUser()->setFlash('success',$success);
     //$request->getParameter('back')
     $this->redirect('/itinerary/detail/' . $new_itinerary->getId());
 }
 // Skip people who are already in the system
 if ($row['e_mail_address']) {
     $list = new PersonList(array('email' => $row['e_mail_address']));
     if (count($list)) {
         continue;
     }
 }
 $list = new PersonList(array('firstname' => $row['first_name'], 'lastname' => $row['last_name']));
 if (count($list)) {
     continue;
 }
 $person = new Person();
 $person->setFirstname(ucwords(strtolower($row['first_name'])));
 $person->setMiddlename(ucwords(strtolower($row['middle_initial'])));
 $person->setLastname(ucwords(strtolower($row['last_name'])));
 $person->setEmail(strtolower($row['e_mail_address']));
 $person->setPhone($row['home_phone'] ? $row['home_phone'] : $row['bus_phone']);
 if ($row['address']) {
     $row['address'] = preg_replace('/[^a-zA-Z0-9\\-\\&\\s\'\\/]/', '', $row['address']);
     $url = new URL(ADDRESS_SERVICE . '/addresses/parse.php');
     $url->format = 'xml';
     $url->address = $row['address'];
     $parsed = new SimpleXMLElement($url, null, true);
     if ($parsed->street_number && $parsed->street_name) {
         // Look up their address in Master Address
         $url = new URL(ADDRESS_SERVICE . '/home.php');
         $url->queryType = 'address';
         $url->format = 'xml';
         $url->query = $row['address'];
         echo $url->query . " ==> ";
         $xml = new SimpleXMLElement($url, null, true);
Example #16
0
$result = $pdo->query('select username,authenticationMethod,firstname,lastname from users u,people p where p.id=u.person_id');
foreach ($result->fetchAll(PDO::FETCH_ASSOC) as $row) {
    try {
        $person = new Person($row['username']);
    } catch (Exception $e) {
        // print_r($e);
        $person = new Person();
        $person->setUsername($row['username']);
        $person->setAuthenticationMethod($row['authenticationMethod']);
        $person->addRole('Staff');
        if ($row['authenticationMethod'] == 'LDAP') {
            try {
                $ldap = new LDAPEntry($person->getUsername());
                $person->setFirstname($ldap->getFirstname());
                $person->setLastname($ldap->getLastname());
                $person->setEmail($ldap->getEmail());
                // $person->setDepartment($ldap->getDepartment());
            } catch (Exception $e) {
                // print_r($e);
                $person->setEmail($row['username'] . '@bloomington.in.gov');
            }
        } else {
            $person->setFirstname($row['firstname']);
            $person->setLastname($row['lastname']);
        }
        try {
            $person->save();
        } catch (Exception $e) {
            print_r($e);
            print_r($person);
            exit;
Example #17
0
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "edit":
             $UserDetails = new SoapObject(NCCBIZ . "UserDetails.php", "urn:Object");
             if (!($xmlStr = $UserDetails->getUserDetails($this->formArray["userID"]))) {
                 $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                 $this->tpl->set_var("TableBlock", "User 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 {
                     $user = new User();
                     $user->parseDomDocument($domDoc);
                     $this->formArray["userID"] = $user->getUserID();
                     $this->formArray["userType"] = $user->getUserType();
                     $this->formArray["username"] = $user->getUsername();
                     $this->formArray["password"] = $user->getPassword();
                     $this->formArray["personID"] = $user->getPersonID();
                     $this->formArray["status"] = $user->getStatus();
                 }
             }
             $PersonDetails = new SoapObject(NCCBIZ . "PersonDetails.php", "urn:Object");
             if (!($xmlStr = $PersonDetails->getPersonDetails($this->formArray["personID"]))) {
                 $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                 $this->tpl->set_var("TableBlock", "Person 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 {
                     $person = new Person();
                     $person->parseDomDocument($domDoc);
                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $person->getBirthday());
                     $this->formArray["personID"] = $person->getPersonID();
                     $this->formArray["lastName"] = $person->getLastName();
                     $this->formArray["firstName"] = $person->getFirstName();
                     $this->formArray["middleName"] = $person->getMiddleName();
                     $this->formArray["gender"] = $person->getGender();
                     $this->formArray["birth_year"] = removePreZero($dateArr["year"]);
                     $this->formArray["birth_month"] = removePreZero($dateArr["month"]);
                     $this->formArray["birth_day"] = removePreZero($dateArr["day"]);
                     $this->formArray["maritalStatus"] = $person->getMaritalStatus();
                     $this->formArray["tin"] = $person->getTin();
                     $address = $person->addressArray[0];
                     if (is_a($address, Address)) {
                         $this->formArray["addressID"] = $address->getAddressID();
                         $this->formArray["number"] = $address->getNumber();
                         $this->formArray["street"] = $address->getStreet();
                         $this->formArray["barangay"] = $address->getBarangay();
                         $this->formArray["district"] = $address->getDistrict();
                         $this->formArray["municipalityCity"] = $address->getMunicipalitycity();
                         $this->formArray["province"] = $address->getProvince();
                     }
                     $this->formArray["telephone"] = $person->getTelephone();
                     $this->formArray["mobileNumber"] = $person->getMobileNumber();
                     $this->formArray["email"] = $person->getEmail();
                 }
             }
             $this->tpl->set_block("rptsTemplate", "NewUserPassword", "NewUserPasswordBlock");
             $this->tpl->set_var("NewUserPasswordBlock", "");
             $this->tpl->set_block("rptsTemplate", "OldUserPassword", "OldUserPasswordBlock");
             $this->tpl->set_var("oldNewUserRowspan", 5);
             //$this->tpl->set_var("oldNewUserRowspan", 3);
             $this->tpl->parse("OldUserPasswordBlock", "OldUserPassword", true);
             break;
         case "save":
             /*
             			    if($this->isOldPasswordCorrect()==false){
             			        $this->message = "Error. Cannot Save. Old password incorrect to create new password.";
             		    	    $this->tpl->set_var("message", $this->message);	
             		    	    $this->tpl->parse("MessageBlock", "Message", true);
             		    	    
                                 $this->tpl->set_block("rptsTemplate", "NewUserPassword", "NewUserPasswordBlock");
                                 $this->tpl->set_var("NewUserPasswordBlock", "");
             
                                 $this->tpl->set_block("rptsTemplate", "OldUserPassword", "OldUserPasswordBlock");
                                 $this->tpl->set_var("oldNewUserRowspan", 3);
                                 $this->tpl->parse("OldUserPasswordBlock", "OldUserPassword", true);		    	
             		    	    break;
             			    }
             */
             if ($this->formArray["newPassword"] != "" && $this->formArray["newPassword"] != "null") {
                 $this->formArray["password"] = md5($this->formArray["newPassword"]);
             }
             if ($this->usernameAlreadyExists() == true) {
                 $this->message = "Error. Cannot Save. Username already exists.";
                 $this->tpl->set_var("message", $this->message);
                 $this->tpl->parse("MessageBlock", "Message", true);
                 $this->tpl->set_block("rptsTemplate", "NewUserPassword", "NewUserPasswordBlock");
                 $this->tpl->set_block("rptsTemplate", "OldUserPassword", "OldUserPasswordBlock");
                 if ($this->formArray["personID"] != "") {
                     $this->tpl->set_var("NewUserPasswordBlock", "");
                     $this->tpl->set_var("oldNewUserRowspan", 3);
                     $this->tpl->parse("OldUserPasswordBlock", "OldUserPassword", true);
                 } else {
                     $this->tpl->set_var("oldNewUserRowspan", 2);
                     $this->tpl->parse("NewUserPasswordBlock", "NewUserPassword", true);
                     $this->tpl->set_var("OldUserPasswordBlock", "");
                 }
                 break;
             }
             $PersonEncode = new SoapObject(NCCBIZ . "PersonEncode.php", "urn:Object");
             if ($this->formArray["personID"] != "") {
                 $PersonDetails = new SoapObject(NCCBIZ . "PersonDetails.php", "urn:Object");
                 if (!($xmlStr = $PersonDetails->getPersonDetails($this->formArray["personID"]))) {
                     $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                     $this->tpl->set_var("TableBlock", "Person 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 {
                         $person = new Person();
                         $person->parseDomDocument($domDoc);
                         $address = $person->addressArray[0];
                         if (is_a($address, Address)) {
                             $address->setAddressID($this->formArray["addressID"]);
                             $address->setNumber($this->formArray["number"]);
                             $address->setStreet($this->formArray["street"]);
                             $address->setBarangay($this->formArray["barangay"]);
                             $address->setDistrict($this->formArray["district"]);
                             $address->setMunicipalityCity($this->formArray["municipalityCity"]);
                             $address->setProvince($this->formArray["province"]);
                             $address->setDomDocument();
                         }
                         $person->setPersonID($this->formArray["personID"]);
                         $person->setPersonType("adminUser");
                         $person->setLastName($this->formArray["lastName"]);
                         $person->setFirstName($this->formArray["firstName"]);
                         $person->setMiddleName($this->formArray["middleName"]);
                         $person->setGender($this->formArray["gender"]);
                         $person->setBirthday($this->birthdate);
                         $person->setMaritalStatus($this->formArray["maritalStatus"]);
                         $person->setTin($this->formArray["tin"]);
                         $person->setAddressArray($address);
                         $person->setTelephone($this->formArray["telephone"]);
                         $person->setMobileNumber($this->formArray["mobileNumber"]);
                         $person->setEmail($this->formArray["email"]);
                         $person->setDomDocument();
                         $doc = $person->getDomDocument();
                         //echo $doc->html_dump_mem();
                         $xmlStr = $doc->dump_mem(true);
                         if (!($ret = $PersonEncode->updatePerson($xmlStr))) {
                             exit("error update");
                         }
                     }
                 }
             } else {
                 $address = new Address();
                 $address->setNumber($this->formArray["number"]);
                 $address->setStreet($this->formArray["street"]);
                 $address->setBarangay($this->formArray["barangay"]);
                 $address->setDistrict($this->formArray["district"]);
                 $address->setMunicipalityCity($this->formArray["municipalityCity"]);
                 $address->setProvince($this->formArray["province"]);
                 $address->setDomDocument();
                 $person = new Person();
                 $person->setPersonID($this->formArray["personID"]);
                 $person->setPersonType("adminUser");
                 $person->setLastName($this->formArray["lastName"]);
                 $person->setFirstName($this->formArray["firstName"]);
                 $person->setMiddleName($this->formArray["middleName"]);
                 $person->setGender($this->formArray["gender"]);
                 $person->setBirthday($this->birthdate);
                 $person->setMaritalStatus($this->formArray["maritalStatus"]);
                 $person->setTin($this->formArray["tin"]);
                 $person->setAddressArray($address);
                 $person->setTelephone($this->formArray["telephone"]);
                 $person->setMobileNumber($this->formArray["mobileNumber"]);
                 $person->setEmail($this->formArray["email"]);
                 $person->setDomDocument();
                 $doc = $person->getDomDocument();
                 $xmlStr = $doc->dump_mem(true);
                 //echo $this->formArray["ownerID"].$xmlStr;
                 if (!($ret = $PersonEncode->savePerson($xmlStr, $this->formArray["ownerID"]))) {
                     exit("error save");
                 }
             }
             $this->formArray["personID"] = $ret;
             $UserEncode = new SoapObject(NCCBIZ . "UserEncode.php", "urn:Object");
             if ($this->formArray["userID"] != "") {
                 $UserDetails = new SoapObject(NCCBIZ . "UserDetails.php", "urn:Object");
                 if (!($xmlStr = $UserDetails->getUserDetails($this->formArray["userID"]))) {
                     exit("User 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 {
                         $user = new User();
                         $user->parseDomDocument($domDoc);
                         $user->setUserID($this->formArray["userID"]);
                         $user->setUserType($this->formArray["userType"]);
                         $user->setUsername($this->formArray["username"]);
                         $user->setPassword($this->formArray["password"]);
                         $user->setPersonID($this->formArray["personID"]);
                         $user->setStatus($this->formArray["status"]);
                         $user->setDomDocument();
                         $doc = $user->getDomDocument();
                         $xmlStr = $doc->dump_mem(true);
                         if (!($ret = $UserEncode->updateUser($xmlStr))) {
                             exit("error update");
                         }
                     }
                 }
             } else {
                 $user = new User();
                 //$user->setUserID($this->formArray["userID"]);
                 $user->setUserType($this->formArray["userType"]);
                 $user->setUsername($this->formArray["username"]);
                 $user->setPassword(md5($this->formArray["password"]));
                 $user->setPersonID($this->formArray["personID"]);
                 $user->setStatus($this->formArray["status"]);
                 $user->setDomDocument();
                 $doc = $user->getDomDocument();
                 $xmlStr = $doc->dump_mem(true);
                 if (!($ret = $UserEncode->saveUser($xmlStr))) {
                     exit("error save");
                 }
             }
             header("location: UserClose.php" . $this->sess->url(""));
             exit;
             break;
         case "cancel":
             header("location: UserClose.php" . $this->sess->url(""));
             exit;
             break;
         default:
             $this->tpl->set_block("rptsTemplate", "UserID", "UserIDBlock");
             $this->tpl->set_var("UserIDBlock", "");
             $this->tpl->set_block("rptsTemplate", "ACK", "ACKBlock");
             $this->tpl->set_var("ACKBlock", "");
             $this->tpl->set_block("rptsTemplate", "NewUserPassword", "NewUserPasswordBlock");
             $this->tpl->set_var("oldNewUserRowspan", 2);
             $this->tpl->parse("NewUserPasswordBlock", "NewUserPassword", true);
             $this->tpl->set_block("rptsTemplate", "OldUserPassword", "OldUserPasswordBlock");
             $this->tpl->set_var("OldUserPasswordBlock", "");
     }
     $this->setForm();
     if ($this->message == "") {
         $this->tpl->set_var("MessageBlock", "");
     }
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "edit":
             $PersonDetails = new SoapObject(NCCBIZ . "PersonDetails.php", "urn:Object");
             if (!($xmlStr = $PersonDetails->getPersonDetails($this->formArray["personID"]))) {
                 $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 {
                     $person = new Person();
                     $person->parseDomDocument($domDoc);
                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $person->getBirthday());
                     $this->formArray["personID"] = $person->getPersonID();
                     $this->formArray["lastName"] = $person->getLastName();
                     $this->formArray["firstName"] = $person->getFirstName();
                     $this->formArray["middleName"] = $person->getMiddleName();
                     $this->formArray["gender"] = $person->getGender();
                     $this->formArray["birth_year"] = removePreZero($dateArr["year"]);
                     $this->formArray["birth_month"] = removePreZero($dateArr["month"]);
                     $this->formArray["birth_day"] = removePreZero($dateArr["day"]);
                     $this->formArray["maritalStatus"] = $person->getMaritalStatus();
                     $this->formArray["tin"] = $person->getTin();
                     $address = $person->addressArray[0];
                     if (is_a($address, Address)) {
                         $this->formArray["addressID"] = $address->getAddressID();
                         $this->formArray["number"] = $address->getNumber();
                         $this->formArray["street"] = $address->getStreet();
                         $this->formArray["barangay"] = $address->getBarangay();
                         $this->formArray["district"] = $address->getDistrict();
                         $this->formArray["municipalityCity"] = $address->getMunicipalitycity();
                         $this->formArray["province"] = $address->getProvince();
                     }
                     $this->formArray["telephone"] = $person->getTelephone();
                     $this->formArray["mobileNumber"] = $person->getMobileNumber();
                     $this->formArray["email"] = $person->getEmail();
                 }
             }
             break;
         case "save":
             $PersonEncode = new SoapObject(NCCBIZ . "PersonEncode.php", "urn:Object");
             if ($this->formArray["personID"] != "") {
                 $PersonDetails = new SoapObject(NCCBIZ . "PersonDetails.php", "urn:Object");
                 if (!($xmlStr = $PersonDetails->getPersonDetails($this->formArray["personID"]))) {
                     $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 {
                         $person = new Person();
                         $person->parseDomDocument($domDoc);
                         $address = $person->addressArray[0];
                         if (is_a($address, Address)) {
                             $address->setAddressID($this->formArray["addressID"]);
                             $address->setNumber($this->formArray["number"]);
                             $address->setStreet($this->formArray["street"]);
                             $address->setBarangay($this->formArray["barangay"]);
                             $address->setDistrict($this->formArray["district"]);
                             $address->setMunicipalityCity($this->formArray["municipalityCity"]);
                             $address->setProvince($this->formArray["province"]);
                             $address->setDomDocument();
                         }
                         $person->setPersonID($this->formArray["personID"]);
                         $person->setLastName($this->formArray["lastName"]);
                         $person->setFirstName($this->formArray["firstName"]);
                         $person->setMiddleName($this->formArray["middleName"]);
                         $person->setGender($this->formArray["gender"]);
                         $person->setBirthday($this->birthdate);
                         $person->setMaritalStatus($this->formArray["maritalStatus"]);
                         $person->setTin($this->formArray["tin"]);
                         $person->setAddressArray($address);
                         $person->setTelephone($this->formArray["telephone"]);
                         $person->setMobileNumber($this->formArray["mobileNumber"]);
                         $person->setEmail($this->formArray["email"]);
                         $person->setDomDocument();
                         $doc = $person->getDomDocument();
                         $xmlStr = $doc->dump_mem(true);
                         if (!($ret = $PersonEncode->updatePerson($xmlStr))) {
                             exit("error update");
                         }
                     }
                 }
             } else {
                 $address = new Address();
                 $address->setNumber($this->formArray["number"]);
                 $address->setStreet($this->formArray["street"]);
                 $address->setBarangay($this->formArray["barangay"]);
                 $address->setDistrict($this->formArray["district"]);
                 $address->setMunicipalityCity($this->formArray["municipalityCity"]);
                 $address->setProvince($this->formArray["province"]);
                 $address->setDomDocument();
                 $person = new Person();
                 $person->setPersonID($this->formArray["personID"]);
                 $person->setLastName($this->formArray["lastName"]);
                 $person->setFirstName($this->formArray["firstName"]);
                 $person->setMiddleName($this->formArray["middleName"]);
                 $person->setGender($this->formArray["gender"]);
                 $person->setBirthday($this->birthdate);
                 $person->setMaritalStatus($this->formArray["maritalStatus"]);
                 $person->setTin($this->formArray["tin"]);
                 $person->setAddressArray($address);
                 $person->setTelephone($this->formArray["telephone"]);
                 $person->setMobileNumber($this->formArray["mobileNumber"]);
                 $person->setEmail($this->formArray["email"]);
                 $person->setDomDocument();
                 $doc = $person->getDomDocument();
                 $xmlStr = $doc->dump_mem(true);
                 //echo $this->formArray["ownerID"].$xmlStr;
                 if (!($ret = $PersonEncode->savePerson($xmlStr, $this->formArray["ownerID"]))) {
                     exit("error save");
                 }
             }
             $this->formArray["personID"] = $ret;
             header("location: ChangeOfOwnershipPropertyInfoClose.php" . $this->sess->url("") . $this->sess->add_query(array("odID" => $this->formArray["odID"], "personID" => $ret, "formAction" => "view")));
             exit;
             break;
         case "cancel":
             header("location: PersonList.php");
             exit;
             break;
         default:
             if ($this->formArray["locID"]) {
                 $ODDetails = new SoapObject(NCCBIZ . "ODDetails.php", "urn:Object");
                 if (!($xmlStr = $ODDetails->getLocation($this->formArray["locID"]))) {
                     exit("xml failed");
                 } else {
                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                     } else {
                         $loc = new LocationAddress();
                         $loc->parseDomDocument($domDoc);
                         foreach ($loc as $key => $value) {
                             $this->formArray[$key] = $value;
                         }
                     }
                 }
             }
             $this->tpl->set_block("rptsTemplate", "personID", "personIDBlock");
             $this->tpl->set_var("personIDBlock", "");
             $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");
 }
Example #19
0
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "edit":
             $PlantsTreesDetails = new SoapObject(NCCBIZ . "PlantsTreesDetails.php", "urn:Object");
             if (!($xmlStr = $PlantsTreesDetails->getPlantsTrees($this->formArray["propertyID"]))) {
                 echo "xml failed";
             } else {
                 //echo $xmlStr;
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                     $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
                 } else {
                     $plantsTrees = new PlantsTrees();
                     $plantsTrees->parseDomDocument($domDoc);
                     foreach ($plantsTrees as $key => $value) {
                         switch ($key) {
                             case "propertyAdministrator":
                                 if (is_a($value, Person)) {
                                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value->getBirthday());
                                     $this->formArray["personID"] = $value->getPersonID();
                                     $this->formArray["lastName"] = $value->getLastName();
                                     $this->formArray["firstName"] = $value->getFirstName();
                                     $this->formArray["middleName"] = $value->getMiddleName();
                                     $this->formArray["gender"] = $value->getGender();
                                     $this->formArray["birth_year"] = removePreZero($dateArr["year"]);
                                     $this->formArray["birth_month"] = removePreZero($dateArr["month"]);
                                     $this->formArray["birth_day"] = removePreZero($dateArr["day"]);
                                     $this->formArray["maritalStatus"] = $value->getMaritalStatus();
                                     $this->formArray["tin"] = $value->getTin();
                                     $this->formArray["addressID"] = $value->addressArray[0]->getAddressID();
                                     $this->formArray["number"] = $value->addressArray[0]->getNumber();
                                     $this->formArray["street"] = $value->addressArray[0]->getStreet();
                                     $this->formArray["barangay"] = $value->addressArray[0]->getBarangay();
                                     $this->formArray["district"] = $value->addressArray[0]->getDistrict();
                                     $this->formArray["municipalityCity"] = $value->addressArray[0]->getMunicipalityCity();
                                     $this->formArray["province"] = $value->addressArray[0]->getProvince();
                                     $this->formArray["telephone"] = $value->getTelephone();
                                     $this->formArray["mobileNumber"] = $value->getMobileNumber();
                                     $this->formArray["email"] = $value->getEmail();
                                 } else {
                                     $this->formArray[$key] = "";
                                 }
                                 break;
                             case "appraisedByDate":
                                 if (true) {
                                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                     $this->formArray["as_year"] = removePreZero($dateArr["year"]);
                                     $this->formArray["as_month"] = removePreZero($dateArr["month"]);
                                     $this->formArray["as_day"] = removePreZero($dateArr["day"]);
                                 } else {
                                     $this->formArray[$key] = "";
                                 }
                                 break;
                             case "recommendingApprovalDate":
                                 if (true) {
                                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                     $this->formArray["re_year"] = removePreZero($dateArr["year"]);
                                     $this->formArray["re_month"] = removePreZero($dateArr["month"]);
                                     $this->formArray["re_day"] = removePreZero($dateArr["day"]);
                                 } else {
                                     $this->formArray[$key] = "";
                                 }
                             case "approvedByDate":
                                 if (true) {
                                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                     $this->formArray["av_year"] = removePreZero($dateArr["year"]);
                                     $this->formArray["av_month"] = removePreZero($dateArr["month"]);
                                     $this->formArray["av_day"] = removePreZero($dateArr["day"]);
                                 } else {
                                     $this->formArray[$key] = "";
                                 }
                                 break;
                             case "dateAcquired":
                                 if (true) {
                                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                     $this->formArray["da_year"] = removePreZero($dateArr["year"]);
                                     $this->formArray["da_month"] = removePreZero($dateArr["month"]);
                                     $this->formArray["da_day"] = removePreZero($dateArr["day"]);
                                 } else {
                                     $this->formArray[$key] = "";
                                 }
                                 break;
                             case "dateOfInstallation":
                                 if (true) {
                                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                     $this->formArray["di_year"] = removePreZero($dateArr["year"]);
                                     $this->formArray["di_month"] = removePreZero($dateArr["month"]);
                                     $this->formArray["di_day"] = removePreZero($dateArr["day"]);
                                 } else {
                                     $this->formArray[$key] = "";
                                 }
                                 break;
                             case "dateOfOperation":
                                 if (true) {
                                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                     $this->formArray["do_year"] = removePreZero($dateArr["year"]);
                                     $this->formArray["do_month"] = removePreZero($dateArr["month"]);
                                     $this->formArray["do_day"] = removePreZero($dateArr["day"]);
                                 } else {
                                     $this->formArray[$key] = "";
                                 }
                                 break;
                             default:
                                 $this->formArray[$key] = $value;
                         }
                     }
                 }
             }
             break;
         case "save":
             if ($this->formArray["verifiedByID"] != "" && $this->formArray["verifiedByID"] != "xx" && $this->formArray["propertyID"] != "") {
                 $this->saveVerified($this->formArray["afsID"], $this->formArray["verifiedByID"], $this->formArray["propertyID"]);
             }
             $PlantsTreesEncode = new SoapObject(NCCBIZ . "PlantsTreesEncode.php", "urn:Object");
             if ($this->formArray["propertyID"] != "") {
                 $PlantsTreesDetails = new SoapObject(NCCBIZ . "PlantsTreesDetails.php", "urn:Object");
                 if (!($xmlStr = $PlantsTreesDetails->getPlantsTrees($this->formArray["propertyID"]))) {
                     $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 {
                         $address = new Address();
                         $address->setAddressID($this->formArray["addressID"]);
                         $address->setNumber($this->formArray["number"]);
                         $address->setStreet($this->formArray["street"]);
                         $address->setBarangay($this->formArray["barangay"]);
                         $address->setDistrict($this->formArray["district"]);
                         $address->setMunicipalityCity($this->formArray["municipalityCity"]);
                         $address->setProvince($this->formArray["province"]);
                         $address->setDomDocument();
                         $propertyAdministrator = new Person();
                         $propertyAdministrator->setPersonID($this->formArray["personID"]);
                         $propertyAdministrator->setLastName($this->formArray["lastName"]);
                         $propertyAdministrator->setFirstName($this->formArray["firstName"]);
                         $propertyAdministrator->setMiddleName($this->formArray["middleName"]);
                         //$propertyAdministrator->setGender($this->formArray["gender"]);
                         //$propertyAdministrator->setBirthday($this->birthdate);
                         //$propertyAdministrator->setMaritalStatus($this->formArray["maritalStatus"]);
                         //$propertyAdministrator->setTin($this->formArray["tin"]);
                         $propertyAdministrator->setAddressArray($address);
                         $propertyAdministrator->setTelephone($this->formArray["telephone"]);
                         //$propertyAdministrator->setMobileNumber($this->formArray["mobileNumber"]);
                         $propertyAdministrator->setEmail($this->formArray["email"]);
                         $propertyAdministrator->setDomDocument();
                         $plantsTrees = new PlantsTrees();
                         $plantsTrees->parseDomDocument($domDoc);
                         $plantsTrees->setPropertyID($this->formArray["propertyID"]);
                         $plantsTrees->setAfsID($this->formArray["afsID"]);
                         $plantsTrees->setArpNumber($this->formArray["arpNumber"]);
                         $plantsTrees->setPropertyIndexNumber($this->formArray["propertyIndexNumber"]);
                         $plantsTrees->setPropertyAdministrator($propertyAdministrator);
                         $plantsTrees->setVerifiedBy($this->formArray["verifiedByID"]);
                         $plantsTrees->setPlottingsBy($this->formArray["plottingsByID"]);
                         $plantsTrees->setNotedBy($this->formArray["notedByID"]);
                         $plantsTrees->setMarketValue($this->formArray["marketValue"]);
                         $plantsTrees->setKind($this->formArray["kind"]);
                         $plantsTrees->setActualUse($this->formArray["actualUse"]);
                         $plantsTrees->setAdjustedMarketValue($this->formArray["adjustedMarketValue"]);
                         $plantsTrees->setAssessmentLevel($this->formArray["assessmentLevel"]);
                         $plantsTrees->setAssessedValue($this->formArray["assessedValue"]);
                         $plantsTrees->setPreviousOwner($this->formArray["previousOwner"]);
                         $plantsTrees->setPreviousAssessedValue($this->formArray["previousAssessedValue"]);
                         $plantsTrees->setTaxability($this->formArray["taxability"]);
                         $plantsTrees->setEffectivity($this->formArray["effectivity"]);
                         $plantsTrees->setAppraisedBy($this->formArray["appraisedByID"]);
                         $plantsTrees->setAppraisedByDate($this->formArray["appraisedByDate"]);
                         $plantsTrees->setRecommendingApproval($this->formArray["recommendingApprovalID"]);
                         $plantsTrees->setRecommendingApprovalDate($this->formArray["recommendingApprovalDate"]);
                         $plantsTrees->setApprovedBy($this->formArray["approvedByID"]);
                         $plantsTrees->setApprovedByDate($this->formArray["approvedByDate"]);
                         $plantsTrees->setMemoranda($this->formArray["memoranda"]);
                         $plantsTrees->setPostingDate($this->formArray["postingDate"]);
                         $plantsTrees->setLandPin($this->formArray["landPin"]);
                         $plantsTrees->setSurveyNumber($this->formArray["surveyNumber"]);
                         $plantsTrees->setProductClass($this->formArray["productClass"]);
                         $plantsTrees->setAreaPlanted($this->formArray["areaPlanted"]);
                         $plantsTrees->setTotalNumber($this->formArray["totalNumber"]);
                         $plantsTrees->setNonFruitBearing($this->formArray["nonFruitBearing"]);
                         $plantsTrees->setFruitBearing($this->formArray["fruitBearing"]);
                         $plantsTrees->setAge($this->formArray["age"]);
                         $plantsTrees->setUnitPrice($this->formArray["unitPrice"]);
                         $plantsTrees->setAdjustmentFactor($this->formArray["adjustmentFactor"]);
                         $plantsTrees->setPercentAdjustment($this->formArray["percentAdjustment"]);
                         $plantsTrees->setValueAdjustment($this->formArray["valueAdjustment"]);
                         $plantsTrees->setCreatedBy($this->userID);
                         $plantsTrees->setModifiedBy($this->userID);
                         $plantsTrees->setDomDocument();
                         $doc = $plantsTrees->getDomDocument();
                         $xmlStr = $doc->dump_mem(true);
                         //echo $xmlStr;
                         if (!($ret = $PlantsTreesEncode->updatePlantsTrees($xmlStr))) {
                             exit("error update");
                         }
                     }
                 }
             } else {
                 $address = new Address();
                 //$address->setAddressID($this->formArray["addressID"]);
                 $address->setNumber($this->formArray["number"]);
                 $address->setStreet($this->formArray["street"]);
                 $address->setBarangay($this->formArray["barangay"]);
                 $address->setDistrict($this->formArray["district"]);
                 $address->setMunicipalityCity($this->formArray["municipalityCity"]);
                 $address->setProvince($this->formArray["province"]);
                 $address->setDomDocument();
                 $propertyAdministrator = new Person();
                 //$propertyAdministrator->setPersonID($this->formArray["personID"]);
                 $propertyAdministrator->setLastName($this->formArray["lastName"]);
                 $propertyAdministrator->setFirstName($this->formArray["firstName"]);
                 $propertyAdministrator->setMiddleName($this->formArray["middleName"]);
                 //$propertyAdministrator->setGender($this->formArray["gender"]);
                 //$propertyAdministrator->setBirthday($this->birthdate);
                 //$propertyAdministrator->setMaritalStatus($this->formArray["maritalStatus"]);
                 //$propertyAdministrator->setTin($this->formArray["tin"]);
                 $propertyAdministrator->setAddressArray($address);
                 $propertyAdministrator->setTelephone($this->formArray["telephone"]);
                 //$propertyAdministrator->setMobileNumber($this->formArray["mobileNumber"]);
                 $propertyAdministrator->setEmail($this->formArray["email"]);
                 $propertyAdministrator->setDomDocument();
                 $plantsTrees = new PlantsTrees();
                 $plantsTrees->parseDomDocument($domDoc);
                 //$plantsTrees->setPropertyID($this->formArray["propertyID"]);
                 $plantsTrees->setAfsID($this->formArray["afsID"]);
                 $plantsTrees->setArpNumber($this->formArray["arpNumber"]);
                 $plantsTrees->setPropertyIndexNumber($this->formArray["propertyIndexNumber"]);
                 $plantsTrees->setPropertyAdministrator($propertyAdministrator);
                 $plantsTrees->setVerifiedBy($this->formArray["verifiedByID"]);
                 $plantsTrees->setPlottingsBy($this->formArray["plottingsByID"]);
                 $plantsTrees->setNotedBy($this->formArray["notedByID"]);
                 $plantsTrees->setMarketValue($this->formArray["marketValue"]);
                 $plantsTrees->setKind($this->formArray["kind"]);
                 $plantsTrees->setActualUse($this->formArray["actualUse"]);
                 $plantsTrees->setAdjustedMarketValue($this->formArray["adjustedMarketValue"]);
                 $plantsTrees->setAssessmentLevel($this->formArray["assessmentLevel"]);
                 $plantsTrees->setAssessedValue($this->formArray["assessedValue"]);
                 $plantsTrees->setPreviousOwner($this->formArray["previousOwner"]);
                 $plantsTrees->setPreviousAssessedValue($this->formArray["previousAssessedValue"]);
                 $plantsTrees->setTaxability($this->formArray["taxability"]);
                 $plantsTrees->setEffectivity($this->formArray["effectivity"]);
                 $plantsTrees->setAppraisedBy($this->formArray["appraisedByID"]);
                 $plantsTrees->setAppraisedByDate($this->formArray["appraisedByDate"]);
                 $plantsTrees->setRecommendingApproval($this->formArray["recommendingApprovalID"]);
                 $plantsTrees->setRecommendingApprovalDate($this->formArray["recommendingApprovalDate"]);
                 $plantsTrees->setApprovedBy($this->formArray["approvedByID"]);
                 $plantsTrees->setApprovedByDate($this->formArray["approvedByDate"]);
                 $plantsTrees->setMemoranda($this->formArray["memoranda"]);
                 $plantsTrees->setPostingDate($this->formArray["postingDate"]);
                 $plantsTrees->setLandPin($this->formArray["landPin"]);
                 $plantsTrees->setSurveyNumber($this->formArray["surveyNumber"]);
                 $plantsTrees->setProductClass($this->formArray["productClass"]);
                 $plantsTrees->setAreaPlanted($this->formArray["areaPlanted"]);
                 $plantsTrees->setTotalNumber($this->formArray["totalNumber"]);
                 $plantsTrees->setNonFruitBearing($this->formArray["nonFruitBearing"]);
                 $plantsTrees->setFruitBearing($this->formArray["fruitBearing"]);
                 $plantsTrees->setAge($this->formArray["age"]);
                 $plantsTrees->setUnitPrice($this->formArray["unitPrice"]);
                 $plantsTrees->setAdjustmentFactor($this->formArray["adjustmentFactor"]);
                 $plantsTrees->setPercentAdjustment($this->formArray["percentAdjustment"]);
                 $plantsTrees->setValueAdjustment($this->formArray["valueAdjustment"]);
                 $plantsTrees->setCreatedBy($this->userID);
                 $plantsTrees->setModifiedBy($this->userID);
                 $plantsTrees->setDomDocument();
                 $doc = $plantsTrees->getDomDocument();
                 $xmlStr = $doc->dump_mem(true);
                 //exit($xmlStr);
                 if (!($ret = $PlantsTreesEncode->savePlantsTrees($xmlStr))) {
                     echo "ret=" . $ret;
                 }
             }
             $this->formArray["propertyID"] = $ret;
             header("location: PlantsTreesClose.php" . $this->sess->url("") . $this->sess->add_query(array("afsID" => $this->formArray["afsID"])));
             exit;
             break;
         case "cancel":
             header("location: PlantsTreesList.php");
             exit;
             break;
         default:
             if (!($firstPropertyID = $this->getFirstPropertyID())) {
                 $this->tpl->set_block("rptsTemplate", "odID", "odIDBlock");
                 $this->tpl->set_var("odIDBlock", "");
                 $this->tpl->set_block("rptsTemplate", "ACK", "ACKBlock");
                 $this->tpl->set_var("ACKBlock", "");
             } else {
                 $PlantsTreesDetails = new SoapObject(NCCBIZ . "PlantsTreesDetails.php", "urn:Object");
                 if (!($xmlStr = $PlantsTreesDetails->getPlantsTrees($firstPropertyID))) {
                     echo "xml failed";
                 } else {
                     //echo $xmlStr;
                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                         $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                         $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
                     } else {
                         $plantsTrees = new PlantsTrees();
                         $plantsTrees->parseDomDocument($domDoc);
                         foreach ($plantsTrees as $key => $value) {
                             switch ($key) {
                                 case "propertyID":
                                     $this->formArray["propertyID"] = "";
                                     break;
                                 case "propertyAdministrator":
                                     if (is_a($value, Person)) {
                                         list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value->getBirthday());
                                         $this->formArray["personID"] = $value->getPersonID();
                                         $this->formArray["lastName"] = $value->getLastName();
                                         $this->formArray["firstName"] = $value->getFirstName();
                                         $this->formArray["middleName"] = $value->getMiddleName();
                                         $this->formArray["gender"] = $value->getGender();
                                         $this->formArray["birth_year"] = removePreZero($dateArr["year"]);
                                         $this->formArray["birth_month"] = removePreZero($dateArr["month"]);
                                         $this->formArray["birth_day"] = removePreZero($dateArr["day"]);
                                         $this->formArray["maritalStatus"] = $value->getMaritalStatus();
                                         $this->formArray["tin"] = $value->getTin();
                                         $this->formArray["addressID"] = $value->addressArray[0]->getAddressID();
                                         $this->formArray["number"] = $value->addressArray[0]->getNumber();
                                         $this->formArray["street"] = $value->addressArray[0]->getStreet();
                                         $this->formArray["barangay"] = $value->addressArray[0]->getBarangay();
                                         $this->formArray["district"] = $value->addressArray[0]->getDistrict();
                                         $this->formArray["municipalityCity"] = $value->addressArray[0]->getMunicipalityCity();
                                         $this->formArray["province"] = $value->addressArray[0]->getProvince();
                                         $this->formArray["telephone"] = $value->getTelephone();
                                         $this->formArray["mobileNumber"] = $value->getMobileNumber();
                                         $this->formArray["email"] = $value->getEmail();
                                     } else {
                                         $this->formArray[$key] = "";
                                     }
                                     break;
                                 case "appraisedByDate":
                                     if (true) {
                                         list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                         $this->formArray["as_year"] = removePreZero($dateArr["year"]);
                                         $this->formArray["as_month"] = removePreZero($dateArr["month"]);
                                         $this->formArray["as_day"] = removePreZero($dateArr["day"]);
                                     } else {
                                         $this->formArray[$key] = "";
                                     }
                                     break;
                                 case "recommendingApprovalDate":
                                     if (true) {
                                         list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                         $this->formArray["re_year"] = removePreZero($dateArr["year"]);
                                         $this->formArray["re_month"] = removePreZero($dateArr["month"]);
                                         $this->formArray["re_day"] = removePreZero($dateArr["day"]);
                                     } else {
                                         $this->formArray[$key] = "";
                                     }
                                 case "approvedByDate":
                                     if (true) {
                                         list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                         $this->formArray["av_year"] = removePreZero($dateArr["year"]);
                                         $this->formArray["av_month"] = removePreZero($dateArr["month"]);
                                         $this->formArray["av_day"] = removePreZero($dateArr["day"]);
                                     } else {
                                         $this->formArray[$key] = "";
                                     }
                                     break;
                                 case "dateAcquired":
                                     if (true) {
                                         list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                         $this->formArray["da_year"] = removePreZero($dateArr["year"]);
                                         $this->formArray["da_month"] = removePreZero($dateArr["month"]);
                                         $this->formArray["da_day"] = removePreZero($dateArr["day"]);
                                     } else {
                                         $this->formArray[$key] = "";
                                     }
                                     break;
                                 case "dateOfInstallation":
                                     if (true) {
                                         list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                         $this->formArray["di_year"] = removePreZero($dateArr["year"]);
                                         $this->formArray["di_month"] = removePreZero($dateArr["month"]);
                                         $this->formArray["di_day"] = removePreZero($dateArr["day"]);
                                     } else {
                                         $this->formArray[$key] = "";
                                     }
                                     break;
                                 case "dateOfOperation":
                                     if (true) {
                                         list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                         $this->formArray["do_year"] = removePreZero($dateArr["year"]);
                                         $this->formArray["do_month"] = removePreZero($dateArr["month"]);
                                         $this->formArray["do_day"] = removePreZero($dateArr["day"]);
                                     } else {
                                         $this->formArray[$key] = "";
                                     }
                                     break;
                                 case "arpNumber":
                                 case "propertyIndexNumber":
                                 case "verifiedByID":
                                 case "verifiedBy":
                                 case "verifiedByName":
                                 case "plottingsByID":
                                 case "plottingsBy":
                                 case "plottingsByName":
                                 case "notedByID":
                                 case "notedBy":
                                 case "notedByName":
                                 case "marketValue":
                                 case "kind":
                                 case "actualUse":
                                 case "adjustedMarketValue":
                                 case "assessmentLevel":
                                 case "assessedValue":
                                 case "previousOwner":
                                 case "previousAssessedValue":
                                 case "taxability":
                                 case "effectivity":
                                 case "appraisedByID":
                                 case "appraisedBy":
                                 case "appraisedByName":
                                 case "appraisedByDate":
                                 case "recommendingApprovalID":
                                 case "recommendingApproval":
                                 case "recommendingApprovalName":
                                 case "recommendingApprovalDate":
                                 case "approvedByID":
                                 case "approvedBy":
                                 case "approvedByName":
                                 case "approvedByDate":
                                 case "memoranda":
                                 case "postingDate":
                                 case "landPin":
                                 case "surveyNumber":
                                 case "productClass":
                                 case "areaPlanted":
                                 case "totalNumber":
                                 case "nonFruitBearing":
                                 case "fruitBearing":
                                 case "age":
                                 case "unitPrice":
                                 case "adjustmentFactor":
                                 case "percentAdjustment":
                                 case "valueAdjustment":
                                 case "as_month":
                                 case "as_day":
                                 case "as_year":
                                 case "re_month":
                                 case "re_day":
                                 case "re_year":
                                 case "av_month":
                                 case "av_day":
                                 case "av_year":
                                     $this->formArray[$key] = $value;
                                     break;
                             }
                         }
                     }
                 }
             }
     }
     $this->setForm();
     $this->tpl->set_var("Session", $this->sess->url("") . $this->sess->add_query(array("odID" => $this->formArray["odID"], "ownerID" => $this->formArray["ownerID"])));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
Example #20
0
 public static function addCommit($sCommit, $sAuthor)
 {
     // Get author info seperated first
     // Bradley T. Hughes <*****@*****.**>
     $aAuthorBits = array();
     if (!preg_match("/(.+) \\<(.+)(?:@| at )([^. ]*)[ .]?.*\\>/", $sAuthor, $aAuthorBits)) {
         die("couldn't get author info for author " . $sAuthor . "\n");
     }
     // matches are:
     // string 0
     // real name 1
     // email (from bit) 2
     // email (domain bit, first word only to avoid TLD madness) 3
     //
     // first, try find the Organisation this Person belongs to
     $oOrganisation = self::findOrganisation($aAuthorBits[3]);
     if (!$oOrganisation) {
         // create one
         $oOrganisation = new Organisation();
         $oOrganisation->setName($aAuthorBits[3]);
         // add under both name and email thingy
         self::$aOrganisations[strtolower($aAuthorBits[3])] = $oOrganisation;
     }
     // let's try find a Person
     $oPerson = self::findPerson($aAuthorBits[1]);
     if (!$oPerson) {
         // try again
         $oPerson = self::findPerson($aAuthorBits[2]);
     }
     if (!$oPerson) {
         // Person record doesn't exist, let's create one
         $oPerson = new Person();
         $oPerson->setName($aAuthorBits[1]);
         $oPerson->setEmail($sAuthor);
         // add under both name and email thingy
         self::$aPersons[strtolower($aAuthorBits[1])] = $oPerson;
         self::$aPersons[strtolower($aAuthorBits[2])] = $oPerson;
     }
     // always set their organisation, as people may move from one org to
     // another and keep contributing.
     $oPerson->setOrganisation($oOrganisation);
     // simple bookkeeping first
     $oPerson->setCommitCount($oPerson->commitCount() + 1);
     $oPerson->organisation()->setCommitCount($oPerson->organisation()->commitCount() + 1);
     $oPerson->appendToCommitQueue($sCommit);
 }
Example #21
0
/**
 * createAdminPerson() Create a person-object based on the certificate
 * credentials passed via the client certificate.
 *
 * Ideally, this should be done via Confusa_Auth, however, since we do not have
 * a live Feide-session, but are basing the authetnication on an X.509
 * certificate, the case is a corner, thus we do it here.
 *
 * @return Person|NULL the decorated person or NULL if the creation failed.
 */
function createAdminPerson()
{
    global $log_error_code;
    /*
     * Try to find the certificate in the robot_certs-table. If we have a
     * match, we have a legit user and create a proxy-admin.
     *
     * If the query fails for some reason, we jumb out, returning null
     */
    $fingerprint = openssl_x509_fingerprint($_SERVER['SSL_CLIENT_CERT'], true);
    if (is_null($fingerprint)) {
        return null;
    }
    try {
        $cert_res = MDB2Wrapper::execute("SELECT * FROM robot_certs WHERE fingerprint = ?", array('text'), array(trim($fingerprint)));
    } catch (DBStatementException $dbse) {
        Logger::log_event(LOG_NOTICE, "[RI] ({$log_error_code}) (line: " . __LINE__ . ")Error with syntax for robot_certs-query.(" . $dbse->getMessage() . ")");
        return null;
    } catch (DBQueryException $dbqe) {
        Logger::log_event(LOG_NOTICE, "[RI] ({$log_error_code}) Error with params (line (" . __LINE__ . ") in robot_certs-query.(" . $dbqe->getMessage() . ")");
        return null;
    }
    switch (count($cert_res)) {
        case 0:
            Logger::log_event(LOG_NOTICE, "[RI] ({$log_error_code}): Unauthenticated client connected. Refusing to establish connection. " . $_SERVER['SSL_CLIENT_I_DN']);
            echo "[{$log_error_code}] You are not authorized to use this API. This incident has been logged.\n";
            return null;
        case 1:
            /*
             * We have to do the compare in a rather awkward way to ensure
             * that differences in spaces, newlines, tabs and whatnot are
             * removed.
             */
            openssl_x509_export(openssl_x509_read($_SERVER['SSL_CLIENT_CERT']), $stored_admin_dump);
            openssl_x509_export(openssl_x509_read($cert_res[0]['cert']), $stored_client_dump);
            if ($stored_admin_dump != $stored_client_dump) {
                Logger::log_event(LOG_NOTICE, "[RI] ({$log_error_code}) Got matching fingerprint ({$fingerprint}) " . "but actual certificates differ! Aborting");
                echo "[{$code}] There were issues with your certificate. Cannot continue using this cert.\n";
                echo "Please use another certificate for the time being.\n";
                echo "This event has been logged.\n";
                return null;
            }
            break;
        default:
            Logger::log_event(LOG_ALERT, "[RI] ({$log_error_code}) Several certs (" . count($cert_res) . ") in DB matching fingerprint ({$fingerprint}), cannot auth client.");
            return null;
    }
    /*
     * Get the details for the owner of the certificate, use this as a
     * basis for authenticating the person.
     *
     * It does not really matter which IdP-map we use, as long as we get one
     * that points to the correct NREN. This is probably not the 'correct'
     * way of using the idp_map, but atm, this is the only 'correct' way of
     * decorating the NREN-object.
     */
    try {
        /* get admin */
        $ares = MDB2Wrapper::execute("SELECT * FROM admins WHERE admin_id=?", array('text'), array($cert_res[0]['uploaded_by']));
        if (count($ares) != 1) {
            /* no admin found. This should not be possible, but be
             * safe and test nevertheless */
            return null;
        }
        /* get Subscriber */
        $sres = MDB2Wrapper::execute("SELECT * FROM subscribers WHERE subscriber_id=?", array('text'), array($cert_res[0]['subscriber_id']));
        if (count($sres) != 1) {
            /* No subscriber found */
            return null;
        }
        /* get NREN */
        $nres = MDB2Wrapper::execute("SELECT n.*,im.idp_url FROM nrens n LEFT JOIN idp_map im ON im.nren_id = n.nren_id WHERE n.nren_id=?", array('text'), array($sres[0]['nren_id']));
        if (count($nres) < 1) {
            /* No nrens found at all, which means that the
             * subscriber is bogus. Since this is a foreign-key
             * constraint, we've run into a corrupt db. Let's hope
             * this'll never happen :-) */
            Logger::log_event(LOG_EMERG, "Found subscriber (" . $sres[0]['subscriber_id'] . ":" . $sres[0]['name'] . ") without a corresponding NREN (" . $sres[0]['nren_id'] . "), you have a corrupt database");
        }
    } catch (DBStatementException $dbse) {
        $msg = "[{$log_error_code}] Problem executing query. Is the database-schema outdated?. ";
        Logger::log_event(LOG_INFO, $msg . " Server said: " . $dbse->getMessage());
        echo $msg . "<br />\nServer said: " . htmlentities($dbse->getMessage()) . "<br />\n";
        return null;
    } catch (DBQueryException $dbqe) {
        /* FIXME */
        $msg = "Could not find owner-details for certificate, probably issues with supplied data. ";
        $msg .= "Admin_id: " . htmlentities($cert_res[0]['uploaded_by']);
        Logger::log_event(LOG_INFO, $msg . " Server said: " . $dbqe->getMessage());
        echo $msg . "<br />\nServer said: " . htmlentities($dbqe->getMessage()) . "<br />\n";
        return null;
    }
    /*
     * Decorate person.
     */
    $person = new Person();
    if (isset($ares[0]['admin_name']) && $ares[0]['admin_name'] != "") {
        $person->setName($ares[0]['admin_name']);
    } else {
        $person->setName($ares[0]['admin']);
    }
    try {
        $person->setEPPN($ares[0]['admin']);
    } catch (CGE_CriticalAttributeException $cae) {
        echo "[{$log_error_code}] Problems with setting the unique identifier for robot-admin.<br />\n";
        echo "Check the data in admins (admin_id: " . htmlentities($cert_res[0]['uploaded_by']) . ")<br />\n";
        Logger::log_event(LOG_NOTICE, "[RI] ({$log_error_code}) Internal error? Suddenly provided admin-uid is not available.");
        return null;
    }
    $person->setAuth(true);
    $person->setNREN(new NREN($nres[0]['idp_url']));
    $person->setSubscriber(new Subscriber($sres[0]['name'], $person->getNREN()));
    $person->setName($ares[0]['admin_name']);
    $person->setEmail($ares[0]['admin_email']);
    /* Robot authenticated, we can return the person and live happily ever
     * after */
    Logger::log_event(LOG_NOTICE, "[RI]: Authenticated robot-client via cert {$fingerprint} belonging to " . $person->getEPPN());
    return $person;
}
Example #22
0
// Example of using __toString to format the output of a print statement.
<?php 
class Person
{
    protected $name;
    protected $email;
    public function setName($name)
    {
        $this->name = $name;
    }
    public function setEmail($email)
    {
        $this->email = $email;
    }
    public function __toString()
    {
        return "{$this->name} <{$this->email}>";
    }
}
// Example
$rasmus = new Person();
$rasmus->setName('Rasmus Lerdorf');
$rasmus->setEmail('*****@*****.**');
print $rasmus;