Пример #1
0
<?php

include_once $_SERVER["DOCUMENT_ROOT"] . "/msergeev_config.php";
MSergeev\Core\Lib\Loader::IncludePackage("icar");
use MSergeev\Core\Exception;
use MSergeev\Packages\Icar\Lib\CarModel;
$arParams = $arReturn = array();
$arReturn['status'] = 'ok';
$bStatus = true;
//Проверка переданных полей
if (true) {
    try {
        if (isset($_REQUEST['brand_id']) && intval($_REQUEST['brand_id']) > 0) {
            $arParams['BRAND_ID'] = intval($_REQUEST['brand_id']);
        } else {
            throw new Exception\ArgumentNullException('brand_id');
        }
    } catch (Exception\ArgumentNullException $e) {
        $e->showException();
        $arReturn['status'] = 'error';
        $bStatus = false;
    }
}
if ($bStatus) {
    $arReturn['select'] = CarModel::getHtmlSelect($arParams['BRAND_ID']);
}
header('Content-Type: application/json');
echo json_encode($arReturn);
Пример #2
0
			</tr>
			<tr>
				<td>Марка авто:</td>
				<td><?php 
    echo Lib\CarBrand::getHtmlSelect($arCar['CAR_BRANDS_ID']);
    ?>
</td>
				<td>&nbsp;</td>
			</tr>
			<?php 
    if ($arCar['CAR_BRANDS_ID'] > 0) {
        ?>
				<tr>
					<td>Выберите модель:</td>
					<td class="td_model"><?php 
        echo Lib\CarModel::getHtmlSelect($arCar['CAR_BRANDS_ID'], $arCar['CAR_MODEL_ID']);
        ?>
</td>
					<td>&nbsp;</td>
				</tr>
			<?php 
    } else {
        ?>
				<tr>
					<td>Добавьте модель:</td>
					<td class="td_model"><?php 
        echo InputType('text', 'car_model_text', '', '', FALSE, '', 'class="car_model_text"');
        ?>
</td>
					<td>&nbsp;</td>
				</tr>