Example #1
0
 public static function getHtmlSelect($selected = 0, $name = 'car_brand')
 {
     $arValues = CarBrandTable::getList(array('select' => array('ID' => 'VALUE', 'NAME'), 'filter' => array('ACTIVE' => true), 'order' => array('SORT' => 'ASC', 'NAME' => 'ASC')));
     if ($selected > 0) {
         return SelectBox($name, $arValues, '-- Выбрать --', $selected);
     } else {
         return SelectBox($name, $arValues, '-- Выбрать --');
     }
 }
Example #2
0
 /**
  * Получает развернутые данные об автомобиле из других таблиц
  *
  * @param $arResult
  *
  * @return mixed
  */
 protected static function fetchCarData($arResult)
 {
     $myCarMap = MyCarTable::getMapArray();
     $carBodyMap = CarBodyTable::getMapArray();
     $carBrandMap = CarBrandTable::getMapArray();
     $carGearboxMap = CarGearboxTable::getMapArray();
     $carModelMap = CarModelTable::getMapArray();
     foreach ($arResult as $key => &$arCar) {
         foreach ($arCar as $field => &$value) {
             if (isset($myCarMap[$field])) {
                 $value = $myCarMap[$field]->fetchDataModification($value);
             } elseif (strstr($field, 'BRAND_')) {
                 switch ($field) {
                     case 'BRAND_ID':
                         $value = $carBrandMap['ID']->fetchDataModification($value);
                         $arCar['BRAND']['ID'] = $value;
                         break;
                     case 'BRAND_NAME':
                         $value = $carBrandMap['NAME']->fetchDataModification($value);
                         $arCar['BRAND']['NAME'] = $value;
                         break;
                     case 'BRAND_CODE':
                         $value = $carBrandMap['CODE']->fetchDataModification($value);
                         $arCar['BRAND']['CODE'] = $value;
                         break;
                 }
             } elseif (strstr($field, 'MODEL_')) {
                 switch ($field) {
                     case 'MODEL_ID':
                         $value = $carModelMap['ID']->fetchDataModification($value);
                         $arCar['MODEL']['ID'] = $value;
                         break;
                     case 'MODEL_NAME':
                         $value = $carModelMap['NAME']->fetchDataModification($value);
                         $arCar['MODEL']['NAME'] = $value;
                         break;
                     case 'MODEL_BRANDS_ID':
                         $value = $carModelMap['BRANDS_ID']->fetchDataModification($value);
                         $arCar['MODEL']['BRAND_ID'] = $value;
                         break;
                     case 'MODEL_CODE':
                         $value = $carModelMap['CODE']->fetchDataModification($value);
                         $arCar['MODEL']['CODE'] = $value;
                         break;
                 }
             } elseif (strstr($field, 'GEARBOX_')) {
                 switch ($field) {
                     case 'GEARBOX_ID':
                         $value = $carGearboxMap['ID']->fetchDataModification($value);
                         $arCar['GEARBOX']['ID'] = $value;
                         break;
                     case 'GEARBOX_NAME':
                         $value = $carGearboxMap['NAME']->fetchDataModification($value);
                         $arCar['GEARBOX']['NAME'] = $value;
                         break;
                     case 'GEARBOX_CODE':
                         $value = $carGearboxMap['CODE']->fetchDataModification($value);
                         $arCar['GEARBOX']['CODE'] = $value;
                         break;
                 }
             } elseif (strstr($field, 'BODY_')) {
                 switch ($field) {
                     case 'BODY_ID':
                         $value = $carBodyMap['ID']->fetchDataModification($value);
                         $arCar['BODY']['ID'] = $value;
                         break;
                     case 'BODY_NAME':
                         $value = $carBodyMap['NAME']->fetchDataModification($value);
                         $arCar['BODY']['NAME'] = $value;
                         break;
                     case 'BODY_CODE':
                         $value = $carBodyMap['CODE']->fetchDataModification($value);
                         $arCar['BODY']['CODE'] = $value;
                         break;
                 }
             }
         }
         unset($value);
     }
     unset($arCar);
     return $arResult;
 }