/** * Here we get some data that cannot be cached for a long time * @return boolean */ protected function obtainNonCachedData() { // types $types = LocationHelper::getTypeList(); $selectedTypes = array_flip(Search\Finder::getIndexedTypes()); $this->dbResult['TYPES'] = array(); foreach ($types as $id => $name) { $this->dbResult['TYPES'][$id] = array('NAME' => $name, 'SELECTED' => isset($selectedTypes[$id])); } // langs $langs = TypeHelper::getLanguageList(); $selectedLangs = array_flip(Search\Finder::getIndexedLanguages()); $this->dbResult['LANGS'] = array(); foreach ($langs as $id => $name) { $this->dbResult['LANGS'][$id] = array('NAME' => $name, 'SELECTED' => isset($selectedLangs[$id])); } return true; }
echo Loc::getMessage('SALE_LOCATION_L_FROM_AND_TO'); ?> )<?endif?>:</td> <td> <?if($code == 'TYPE_ID'):?> <select name="find_<?php echo $code; ?> "> <option value="">(<?php echo Loc::getMessage('SALE_LOCATION_L_ANY'); ?> )</option> <?foreach(Helper::getTypeList() as $tId => $tName):?> <option value="<?php echo intval($tId); ?> "<?php echo $tId == $GLOBALS['find_' . $code] ? ' selected' : ''; ?> ><?php echo htmlspecialcharsbx($tName); ?> </option> <?endforeach?> </select> <?elseif($code == 'PARENT_ID'):?>
/** * Here we get some data that can be cached for a long time. * @param mixed[] $cachedData Buffer for keeping data that will be put to a cache later * @return void */ protected function obtainCachedData(&$cachedData) { $cachedData['TYPES'] = Helper::getTypeList(); $cachedData['EXTERNAL_SERVICES'] = Helper::getExternalServicesList(); }
<?php echo $id; ?> <input type="hidden" name="element[ID]" value="<?php echo $id; ?> " /> <?php } elseif ($code == 'TYPE_ID') { ?> <select name="element[TYPE_ID]"> <?php foreach (Helper::getTypeList() as $tId => $type) { ?> <option value="<?php echo $tId; ?> "<?php echo $tId == $value ? ' selected' : ''; ?> ><?php echo htmlspecialcharsbx($type); ?> </option> <?php } ?> </select>
/** * Here we get some data that can be cached for a long time. * @param mixed[] $cachedData Buffer for keeping data that will be put to a cache later * @return void */ protected function obtainCachedData(&$cachedData) { $cachedData['TYPES'] = Helper::getTypeList(); }