Beispiel #1
0
 private function generate_modify_page($level = '1', $parent = '0', $location_id = '')
 {
     if (trim($level) == '') {
         $level = wpl_request::getVar('level');
     }
     if (trim($parent) == '') {
         $parent = wpl_request::getVar('parent');
     }
     if (trim($location_id) == '') {
         $location_id = wpl_request::getVar('location_id');
     }
     $this->location_data = '';
     $this->level = $level;
     $this->parent = $parent;
     $this->location_id = $location_id;
     /** get location data for edit **/
     if (trim($location_id) != '') {
         $this->location_data = wpl_locations::get_location($location_id, $level);
     }
     parent::render($this->tpl_path, 'edit');
     exit;
 }
Beispiel #2
0
 private function location_save($table_name, $table_column, $value, $item_id)
 {
     $location_settings = wpl_global::get_settings('3');
     # location settings
     $location_level = str_replace('_id', '', $table_column);
     $location_level = substr($location_level, -1);
     if ($table_column == 'zip_id') {
         $location_level = 'zips';
     }
     $location_data = wpl_locations::get_location($value, $location_level);
     $location_name_column = $location_level != 'zips' ? 'location' . $location_level . '_name' : 'zip_name';
     /** update property location data **/
     if ($location_settings['location_method'] == 2 or $location_settings['location_method'] == 1 and in_array($location_level, array(1, 2))) {
         $res = wpl_db::update($table_name, array($table_column => $value, $location_name_column => $location_data->name), 'id', $item_id);
     } else {
         $res = wpl_db::update($table_name, array($location_name_column => $value), 'id', $item_id);
     }
     $res = (int) $res;
     $message = $res ? __('Saved.', WPL_TEXTDOMAIN) : __('Error Occured.', WPL_TEXTDOMAIN);
     $data = NULL;
     $response = array('success' => $res, 'message' => $message, 'data' => $data);
     echo json_encode($response);
     exit;
 }