function displayData()
 {
     $cityTemp = CityManager::getSingleCity('id', $this->church->getIdCity());
     if ($cityTemp === NULL) {
         $cityTemp = new City();
     }
     $stateTemp = CityManager::getSingleState('id', $cityTemp->getIdState());
     $cityString = "*************************";
     if ($stateTemp === NULL) {
         $stateTemp = new State();
     } else {
         $cityString = $cityTemp->getName() . ", " . $stateTemp->getShortName();
     }
     $this->SetFont('Arial', 'B', 10);
     $cellSizeY = 5;
     for ($i = 0; $i < 3; $i++) {
         //Get the data necesary of create the document
         $this->SetXY($x + 100, $i * 60 + $y + 40 - $cellSizeY);
         $this->Cell(80, $cellSizeY, iconv('utf-8', 'cp1252', $this->church->getName()), 0, 0, 'C');
         $this->SetXY($x + 100, $i * 60 + $y + 47 - $cellSizeY);
         $this->Cell(80, $cellSizeY, iconv('utf-8', 'cp1252', $this->church->getAddress()), 0, 0, 'C');
         $this->SetXY($x + 100, $i * 60 + $y + 54 - $cellSizeY);
         $this->Cell(80, $cellSizeY, iconv('utf-8', 'cp1252', 'CP. ' . $this->church->getPostalCode()), 0, 0, 'C');
         $this->SetXY($x + 100, $i * 60 + $y + 61 - $cellSizeY);
         $this->Cell(80, $cellSizeY, iconv('utf-8', 'cp1252', $cityString), 0, 0, 'C');
     }
 }
Example #2
0
 public function actionCityForFlightOrHotel($query, $return = false)
 {
     $cities = CityManager::getCitiesWithAirportsAndHotels($query);
     if ($return) {
         return $cities;
     } else {
         $this->send($cities);
     }
 }
Example #3
0
 public function setCityName($value)
 {
     $items = CityManager::getCities($value);
     if (isset($items[0])) {
         $this->cityModel = City::model()->findByPk($items[0]['id']);
     } else {
         throw new CException('Cannot define city by city name:' . $value);
     }
 }
Example #4
0
 /**
  * @param string city
  * @param string checkIn d.m.Y date
  * @param int duration # of nights inside hotel
  * @param array $rooms
  *  [Х][adt] - amount of adults inside room,
  *  [Х][chd] - amount of childs inside room,
  *  [Х][chdAge] - age of child inside room,
  *  [Х][cots] - cots inside room (0 or 1),
  */
 public function actionDefault($city, $checkIn, $duration, array $rooms, $format = 'json')
 {
     $hotelSearchParams = new HotelSearchParams();
     $hotelSearchParams->checkIn = date('Y-m-d', strtotime($checkIn));
     $possibleCities = CityManager::getCitiesWithHotels($city);
     if (!empty($possibleCities)) {
         $hotelSearchParams->city = City::model()->findByPk($possibleCities[0]['id']);
     } else {
         $city = CityManager::getCities($city);
         if (!empty($city)) {
             $hotelSearchParams->city = City::model()->findByPk($city[0]['id']);
         }
     }
     $hotelSearchParams->duration = $duration;
     foreach ($rooms as $i => $room) {
         if ($room['chd'] == 1) {
             $hotelSearchParams->addRoom($room['adt'], $room['cots'], $room['chdAge']);
         } elseif ($room['chd'] == 0) {
             $hotelSearchParams->addRoom($room['adt'], $room['cots'], false);
         } else {
             $this->sendError(200, 'Only 0 or 1 child at one hotel room accepted');
             Yii::app()->end();
         }
     }
     if (empty($possibleCities)) {
         $this->results = array('hotels' => array(), 'hotelsDetails' => array());
     } else {
         $this->results = HotelManager::sendRequestToHotelProvider($hotelSearchParams);
         if (!$this->results) {
             $this->results = array();
         }
     }
     $cacheId = md5(serialize($hotelSearchParams));
     $this->results['cacheId'] = $cacheId;
     $this->results['searchParams'] = $hotelSearchParams->getJsonObject();
     if ($format == 'json') {
         $this->sendJson($this->results);
     } elseif ($format == 'xml') {
         $this->sendXml($this->results, 'hotelSearchResults');
     } else {
         $this->sendError(400, 'Incorrect response format');
         Yii::app()->end();
     }
 }
}
$string = str_replace("|VicarOptions|", $vicarString, $string);
//Create a String of options of Deans
$deanString = "";
$deans = ChurchManager::getAllDeans();
foreach ($deans as $singleDean) {
    if ($church->getIdDean() === $singleDean->getId()) {
        $deanString = $deanString . "<option selected> " . $singleDean->getName() . "</option>\n";
    } else {
        $deanString = $deanString . "<option> " . $singleDean->getName() . "</option>\n";
    }
}
$string = str_replace("|DeanOptions|", $deanString, $string);
//Create a String of options of Cities
$citiesString = "";
$cities = CityManager::getAllCities();
foreach ($cities as $singleCity) {
    if ($church->getIdCity() === $singleCity->getId()) {
        $citiesString = $citiesString . "<option selected> " . $singleCity->getName() . "</option>\n";
    } else {
        $citiesString = $citiesString . "<option> " . $singleCity->getName() . "</option>\n";
    }
}
$string = str_replace("|CityOptions|", $citiesString, $string);
$saveButton = '<button type="button" class="btn btn-success" onclick=\'validateData("churchInsertion.php", "update", "' . $idChurch . '")\'>
                      <img src="../icons/save.png" width="50px"><br>
                      <strong>^Save^</strong>
                   </button>';
$cancelButton = '<button type="button" class="btn btn-success" onclick=\'href("churchMenu.php")\'>
                        <img src="../icons/delete.png" width="50px"><br>
                        <strong>^Cancel^</strong>
if ($_GET["status"] === 'insert' && ChurchManager::getSingleChurch('name', $_GET["nameChuch"]) !== NULL) {
    echo "KO";
} else {
    $status = $_GET["status"];
    $church = new Church();
    $church->setId(0);
    $church->setName($_GET["nameChuch"]);
    $church->setType($_GET["typeChurch"]);
    $church->setCode($_GET["codeChurch"]);
    $church->setAddress($_GET["addressChurch"]);
    $church->setColony($_GET["colonyChurch"]);
    $church->setPostalCode($_GET["postalCodeChurch"]);
    $church->setPhoneNumber($_GET["phoneNumberChurch"]);
    $church->setIdVicar(ChurchManager::getSingleVicar('name', $_GET["vicar"])->getId());
    $church->setIdDean(ChurchManager::getSingleDean('name', $_GET["dean"])->getId());
    $church->setIdCity(CityManager::getSingleCity('name', $_GET["city"])->getId());
    $niches = $_GET["niche"];
    if ($niches == 'true') {
        $niche = new Niche();
        $niche->setMaxCol($_GET["maxCol"]);
        $niche->setMaxRow($_GET["maxRow"]);
        $niche->setSize($_GET["size"]);
        $nicheT = ChurchManager::getSingleNiche('maxCol', $niche->getMaxCol(), 'maxRow', $niche->getMaxRow(), 'size', $niche->getSize());
        if ($nicheT === NULL) {
            ChurchManager::addNiche($niche);
            $nicheT = ChurchManager::getSingleNiche('maxCol', $niche->getMaxCol(), 'maxRow', $niche->getMaxRow(), 'size', $niche->getSize());
            $church->setIdNiche($nicheT->getId());
        } else {
            $church->setIdNiche($nicheT->getId());
        }
    } else {
 private function addMoreInfo($cities)
 {
     foreach ($cities as $i => $one) {
         $city = City::getCityByPk($one['id']);
         $cities[$i]['code'] = $city->code;
         $cities[$i]['name'] = $city->localRu;
         $cities[$i]['nameGen'] = $city->caseGen;
         $cities[$i]['nameAcc'] = $city->caseAcc;
         $cities[$i]['country'] = $city->country->localRu;
         $cities[$i]['label'] = CityManager::parseTemplate(CityManager::templateForLabelAutocomplete(), $city);
     }
     return $cities;
 }
//Create a String of options of Last Church
$churchString = "";
$churchs = ChurchManager::getAllChurchs('name');
foreach ($churchs as $singleChurch) {
    if ($singleChurch->getId() === $churchId) {
        $churchString = $churchString . "<option selected> " . $singleChurch->getName() . "</option>\n";
    } else {
        $churchString = $churchString . "<option> " . $singleChurch->getName() . "</option>\n";
    }
}
$string = str_replace("|ChurchOption|", $churchString, $string);
//Create a String of options of Civil Registries
$civilString = "";
$civilRegis = BaptismManager::getAllOfficeCivilRegistries();
foreach ($civilRegis as $single) {
    $city = CityManager::getSingleCity('id', $single->getIdCity())->getName();
    if ($office->getId() === $single->getId()) {
        $civilString = $civilString . "<option selected> No. " . $single->getNumber() . ", {$city}.</option>\n";
    } else {
        $civilString = $civilString . "<option> No. " . $single->getNumber() . ", {$city}.</option>\n";
    }
}
$string = str_replace("|CivilRegistryOption|", $civilString, $string);
if ($baptism->getLegitimate() !== 'Y') {
    $string = str_replace("|isLegitimate|", "selected", $string);
} else {
    $string = str_replace("|isLegitimate|", "", $string);
}
if ($owner->getGender() === 'F') {
    $string = str_replace("|isFemale|", "selected", $string);
} else {
                     <th style="text-align: center;">^City^</th>
                     <th style="text-align: center;">^Options^</th>
                 </tr>
                </thead>';
 $table = $table . $header;
 $table = $table . '<tbody>';
 $i = 0;
 foreach ($churchRegistries as $singleChurch) {
     if ($i === 10) {
         continue;
     }
     $vicar = ChurchManager::getSingleVicar('id', $singleChurch->getIdVicar());
     $nameVicar = $vicar->getName();
     $dean = ChurchManager::getSingleDean('id', $singleChurch->getIdDean());
     $nameDean = $dean->getName();
     $city = CityManager::getSingleCity('id', $singleChurch->getIdCity());
     $nameCity = $city->getName();
     if ($_SESSION["user_type"] == 'A') {
         $options = '<td data-title="^Options^" class="center-btn" style="text-align: center">
                         <button type="button" class="btn btn-success btn-inside" onclick="href(\'churchLook.php?id=' . $singleChurch->getID() . '\')">
                             <img src="../icons/eye.png" class="img-inside" height="30px">
                         </button>
                         <button type="button" class="btn btn-success btn-inside" onclick="href(\'churchChange.php?id=' . $singleChurch->getID() . '\')">
                             <img src="../icons/refresh.png" class="img-inside" height="30px">
                         </button>
                         <button type="button" class="btn btn-success btn-inside" onclick="deleteObject(\'church\', \'' . $singleChurch->getID() . '\')">
                             <img src="../icons/delete.png" class="img-inside" height="30px">
                         </button>
                         <button type="button" class="btn btn-success btn-inside" onclick="href(\'churchRectorRelationMenu.php?id=' . $singleChurch->getID() . '\')">
                             <img src="../icons/rector.png" class="img-inside" height="30px">
                         </button>
if (!isset($_POST) || $_POST["idChild"] === NULL) {
    echo "KO";
    die;
}
$church = ChurchManager::getSingleChurch('name', $_POST["celebrationChurch"]);
$child = new Person();
if ($_POST["idChild"] !== '0') {
    $child = PersonManager::getSinglePerson('id', $_POST["idChild"]);
}
$child->setId($_POST["idChild"]);
$child->setNames($_POST["nameChild"]);
$child->setLastname1($_POST["lastname1Child"]);
$child->setLastname2($_POST["lastname2Child"]);
$child->setAddress($_POST["addressChild"]);
$child->setPhoneNumber($_POST["phoneChild"]);
$child->setIdCityAddress(CityManager::getSingleCity('name', $_POST["cityChild"])->getId());
$proof = new ProofTalks();
$proof->setId($_POST["idProof"]);
$proof->setIdChurch($church->getId());
$typeProof = "B";
if ($_POST["type"] === '1') {
    $typeProof = "E";
} else {
    if ($_POST["type"] === '2') {
        $typeProof = "C";
    } else {
        if ($_POST["type"] === '3') {
            $typeProof = "X";
        }
    }
}
<?php

require_once __DIR__ . "/../../../Backend/SessionManager.php";
require_once __DIR__ . "/../../../Backend/CityManager.php";
if (!isset($_GET) || $_GET["nameCity"] === NULL) {
    echo "KO";
    die;
}
$city = new City(0, $_GET["nameCity"], CityManager::getSingleState('name', $_GET["state"])->getId());
if (CityManager::addCity($city)) {
    echo "OK";
} else {
    echo "KO";
}
<?php

require_once __DIR__ . "/../../../Backend/SessionManager.php";
require_once __DIR__ . "/../../../Backend/CityManager.php";
if (!isset($_GET) || $_GET["nameState"] === NULL) {
    echo "KO";
    die;
}
$state = new State();
$state->setName($_GET["nameState"]);
$state->setShortName($_GET["shortState"]);
$state->setCountry($_GET["country"]);
if (CityManager::addState($state)) {
    echo "OK";
} else {
    echo "KO";
}
require_once __DIR__ . "/../../Backend/SessionManager.php";
require_once __DIR__ . "/../../Backend/CityManager.php";
require_once __DIR__ . "/../../Backend/LanguageSupport.php";
SessionManager::validateUserInPage('cityInsertion.php');
//Get File Contest
$string = file_get_contents("template/CityInsertion.html");
//Remplace the nav
$string = str_replace("|NavBar|", SessionManager::getNavBar(), $string);
//Create a Button State
$saveButton = '<button type="button" class="btn btn-success" onclick=\'validateData("cityInsertion.php", "' . SessionManager::getLastPage() . '")\'>
                      <img src="../icons/save.png" width="50px"><br>
                      <strong>^Save^</strong>
                   </button>';
$cancelButton = '<button type="button" class="btn btn-success" onclick=\'href("' . SessionManager::getLastPage() . '")\'>
                        <img src="../icons/delete.png" width="50px"><br>
                        <strong>^Cancel^</strong>
                    </button>';
$returnButton = '';
$string = str_replace("|SaveButton|", $saveButton, $string);
$string = str_replace("|CancelButton|", $cancelButton, $string);
$string = str_replace("|ReturnButton|", $returnButton, $string);
//The select for States
$stateString = "";
$states = CityManager::getAllStates();
foreach ($states as $singleState) {
    $stateString = $stateString . "<option> " . $singleState->getName() . "</option>\n";
}
$string = str_replace("|StateOption|", $stateString, $string);
//Display the page
$string = LanguageSupport::HTMLEvalLanguage($string);
echo $string;
    $bookRegistry->setPage($_POST["pageBookRegistry"]);
    $bookRegistry->setNumber($_POST["numBookRegistry"]);
    $bookRegistry->setReverse($reverse);
    BaptismManager::addBaptismRegistry($bookRegistry);
    $bookRegistry = BaptismManager::getSingleBaptismRegistry('book', $_POST["bookBookRegistry"], 'page', $_POST["pageBookRegistry"], 'number', $_POST["numBookRegistry"], 'reverse', substr($reverse, 0, 1));
}
$baptism->setIdBookRegistry(1);
if ($bookRegistry !== NULL) {
    $baptism->setIdBookRegistry($bookRegistry->getId());
}
//Get The Civil Registry Data
$officeTemp = $_POST["officeCivilRegistry"];
$posComa = strpos($officeTemp, ',');
$numberOffice = substr($officeTemp, 4, $posComa - 4);
$cityOfficeName = substr($officeTemp, $posComa + 2, -1);
$cityId = CityManager::getSingleCity('name', $cityOfficeName)->getId();
$office = BaptismManager::getSingleOfficeCivilRegistry('number', $numberOffice, 'idCity', $cityId);
$civilRegistry = BaptismManager::getSingleCivilRegistry('book', $_POST["bookCivilRegistry"], 'page', $_POST["pageCivilRegistry"], 'number', $_POST["numCivilRegistry"], 'idOfficineCivilRegistry', $office->getId());
if ($civilRegistry === NULL) {
    $civilRegistry = new civilRegistry();
    $civilRegistry->setBook($_POST["bookCivilRegistry"]);
    $civilRegistry->setPage($_POST["pageCivilRegistry"]);
    $civilRegistry->setNumber($_POST["numCivilRegistry"]);
    $civilRegistry->setIdOffice($office->getId());
    BaptismManager::addCivilRegistry($civilRegistry);
    $civilRegistry = BaptismManager::getSingleCivilRegistry('book', $_POST["bookCivilRegistry"], 'page', $_POST["pageCivilRegistry"], 'number', $_POST["numCivilRegistry"], 'idOfficineCivilRegistry', $office->getId());
}
$baptism->setIdCivilRegistry(1);
if ($civilRegistry !== NULL) {
    $baptism->setIdCivilRegistry($civilRegistry->getId());
}
<?php

require_once __DIR__ . "/../../../Backend/SessionManager.php";
require_once __DIR__ . "/../../../Backend/CityManager.php";
require_once __DIR__ . "/../../../Backend/BaptismManager.php";
if (!isset($_GET) || $_GET["cityName"] === NULL) {
    echo "KO";
    die;
}
$city = CityManager::getSingleCity('name', $_GET["cityName"]);
$number = $_GET["numberCivil"];
$office = new OfficeCivilRegistry(0, $number, $city->getId());
if (BaptismManager::addOfficeCivilRegistry($office)) {
    echo "OK";
} else {
    echo "KO";
}