</label> <div class="controls"> <?php UserForm::region_select(osc_get_regions(), osc_user()); ?> </div> </div> <div class="form-group"> <label class="control-label" for="city"> <?php _e('College', OSCLASSWIZARDS_THEME_FOLDER); ?> </label> <div class="controls"> <?php UserForm::city_select(osc_get_cities(), osc_user()); ?> </div> </div> <div class="form-group"> <label class="control-label" for="city_area"> <?php _e('City area', OSCLASSWIZARDS_THEME_FOLDER); ?> </label> <div class="controls"> <?php UserForm::city_area_text(osc_user()); ?> </div> </div>
} ?> <div class="control-group"> <label class="control-label" for="city"><?php _e('City', 'bender'); ?> </label> <div class="controls"> <?php if (bender_default_location_show_as() == 'dropdown') { if (Params::getParam('action') != 'item_edit') { ItemForm::city_select(array(array('pk_i_id' => '', 's_name' => __("Select a city..."))), osc_item()); } else { // add new item ItemForm::city_select(osc_get_cities(osc_user_region_id()), osc_user()); } } else { ItemForm::city_text(osc_user()); } ?> </div> </div> <div class="control-group"> <label class="control-label" for="cityArea"><?php _e('City Area', 'bender'); ?> </label> <div class="controls"> <?php ItemForm::city_area_text(osc_user());
function item_city_box($city_txt, $city_select_txt) { $aCities = osc_get_cities(); $item = osc_item() != null ? osc_item() : array(); switch (count($aCities)) { case 0: // 0 regions ?> <div class="clearfix"> <label><?php echo $city_txt; ?> </label> <div class="input"> <input class="city_name" id="city_name" type="text" name="city" value="<?php echo get_city_name($item); ?> " /> </div> </div> <?php break; case 1: // only one region ?> <input class="city_id" id="city_id" type="hidden" name="cityId" value="<?php echo get_city_id($item); ?> " /> <?php break; default: // more than one region ?> <div class="clearfix"> <label><?php echo $city_txt; ?> </label> <div class="input"> <select class="city_id" id="city_id" name="cityId"> <option value=""><?php echo $city_select_txt; ?> </option> <?php foreach ($aCities as $city) { ?> <option value="<?php echo $city['pk_i_id']; ?> "><?php echo $city['s_name']; ?> </option> <?php } ?> </select> </div> </div> <?php break; } }
public static function city_select($cities = null, $item = null) { if (Session::newInstance()->_getForm('city') != '') { $cities = null; } else { if ($cities == null) { $cities = osc_get_cities(); } } if ($item == null) { $item = osc_item(); } if (count($cities) >= 1) { if (Session::newInstance()->_getForm('cityId') != "") { $item['fk_i_city_id'] = Session::newInstance()->_getForm('cityId'); if (Session::newInstance()->_getForm('regionId') != "") { $cities = City::newInstance()->findByRegion(Session::newInstance()->_getForm('regionId')); } } parent::generic_select('cityId', $cities, 'pk_i_id', 's_name', __('Select a city...'), isset($item['fk_i_city_id']) ? $item['fk_i_city_id'] : null); return true; } else { if (Session::newInstance()->_getForm('city') != "") { $item['s_city'] = Session::newInstance()->_getForm('city'); } parent::generic_input_text('city', isset($item['s_city']) ? $item['s_city'] : null); return true; } }
public static function city_select($cities = null, $item = null) { if (Session::newInstance()->_getForm('city') != '') { $cities = null; } else { if ($cities == null) { $cities = osc_get_cities(); } } if ($item == null) { $item = osc_item(); } if (count($cities) >= 1) { if (Session::newInstance()->_getForm('cityId') != "") { $item['fk_i_city_id'] = Session::newInstance()->_getForm('cityId'); if (Session::newInstance()->_getForm('regionId') != "") { $cities = City::newInstance()->listWhere("fk_i_region_id = %d", Session::newInstance()->_getForm('regionId')); } } parent::generic_select('cityId', $cities, 'pk_i_id', 's_name', __('Select a city...'), isset($item['fk_i_city_id']) ? $item['fk_i_city_id'] : null); return true; // } else if ( count($cities) == 1 ) { // if( Session::newInstance()->_getForm('cityId') != "" ) { // $item['fk_i_city_id'] = Session::newInstance()->_getForm('cityId'); // } // parent::generic_input_hidden('cityId', (isset($item['fk_i_city_id'])) ? $item['fk_i_city_id'] : $cities[0]['pk_i_id']) ; // echo '<span>' .$cities[0]['s_name'] . '</span>'; // return false ; } else { if (Session::newInstance()->_getForm('city') != "") { $item['s_city'] = Session::newInstance()->_getForm('city'); } parent::generic_input_text('city', isset($item['s_city']) ? $item['s_city'] : null); return true; } }
public static function city_select($cities = null, $item = null) { if ($cities == null) { $cities = osc_get_cities(); } if ($item == null) { $item = osc_item(); } if (count($cities) > 1) { parent::generic_select('cityId', $cities, 'pk_i_id', 's_name', __('Select a city...'), isset($item['fk_i_city_id']) ? $item['fk_i_city_id'] : null); return true; } else { if (count($cities) == 1) { parent::generic_input_hidden('cityId', isset($item['fk_i_city_id']) ? $item['fk_i_city_id'] : $cities[0]['pk_i_id']); echo '</span>' . $cities[0]['s_name'] . '</span>'; return false; } else { parent::generic_input_text('city', isset($item['s_city']) ? $item['s_city'] : null); return true; } } }