Example #1
0
 public static function city_select($cities = null, $item = null)
 {
     if (Session::newInstance()->_getForm('city') != '') {
         $cities = null;
     } else {
         if ($cities == null) {
             $cities = array();
         }
     }
     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;
     }
 }
Example #2
0
 public static function user_select($users)
 {
     Form::generic_select('userId', $users, 'pk_i_id', 's_name', __('All'), NULL);
 }
Example #3
0
 public static function type_select($admin = null)
 {
     $options = array(array('i_value' => '0', 's_text' => __('Administrator')), array('i_value' => '1', 's_text' => __('Moderator')));
     parent::generic_select('b_moderator', $options, 'i_value', 's_text', null, isset($admin['b_moderator']) ? $admin['b_moderator'] : null);
 }
Example #4
0
 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;
     }
 }
Example #5
0
 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;
         }
     }
 }
Example #6
0
 public static function is_company_select($user = null)
 {
     $options = array(array('i_value' => '0', 's_text' => __('User')), array('i_value' => '1', 's_text' => __('Company')));
     parent::generic_select('b_company', $options, 'i_value', 's_text', null, isset($user['b_company']) ? $user['b_company'] : null);
     return true;
 }