| @@ -138,9 +138,9 @@ | ||
| 138 | 138 | * @access protected |
| 139 | 139 | */ |
| 140 | 140 | protected function render() { |
| 141 | 141 | parent::render(); |
| 142 | - global $wdk_listing_id; | |
| 142 | + global $wdk_listing_id, $Winter_MVC_wdk_membership; | |
| 143 | 143 | |
| 144 | 144 | $this->data['id_element'] = $this->get_id(); |
| 145 | 145 | $this->data['settings'] = $this->get_settings(); |
| 146 | 146 | |
| @@ -156,9 +156,9 @@ | ||
| 156 | 156 | // Get user data by user id |
| 157 | 157 | $this->data['userdata'] = get_userdata($this->data['user_id']); |
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | - | |
| 160 | + | |
| 161 | 161 | $this->WMVC->model('listingusers_m'); |
| 162 | 162 | |
| 163 | 163 | if(Plugin::$instance->editor->is_edit_mode()) { |
| 164 | 164 | $this->WMVC->db->limit(3); |
| @@ -168,16 +168,33 @@ | ||
| 168 | 168 | if($this->data['settings']['alternative_agents_disabled'] !='yes') { |
| 169 | 169 | $this->data['listing_alt_agents'] = $this->WMVC->listingusers_m->get($wdk_listing_id); |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | + $this->data['listing_agency'] = false; | |
| 173 | + if($this->data['settings']['listing_agency_disabled'] !='yes') { | |
| 174 | + if(function_exists('run_wdk_membership') && file_exists(WDK_MEMBERSHIP_PATH.'application/models/Agency_agent_m.php')) { | |
| 175 | + if(!empty($Winter_MVC_wdk_membership) && wmvc_show_data('user_id_editor', $listing, '',TRUE, TRUE)) { | |
| 176 | + $Winter_MVC_wdk_membership->model('agency_agent_m'); | |
| 177 | + $agent_id = wmvc_show_data('user_id_editor', $listing, '',TRUE, TRUE); | |
| 178 | + $agent_agency = $Winter_MVC_wdk_membership->agency_agent_m->get_by(array('agent_id' => $agent_id, 'status' => 'CONFIRMED'), TRUE); | |
| 179 | + if($agent_agency) { | |
| 180 | + $user = wdk_get_user_data( wmvc_show_data('agency_id', $agent_agency, 0)); | |
| 181 | + if($user){ | |
| 182 | + $this->data['listing_agency'] = $user; | |
| 183 | + } | |
| 184 | + } | |
| 185 | + } | |
| 186 | + } | |
| 187 | + } | |
| 188 | + | |
| 172 | 189 | $this->data['is_edit_mode']= false; |
| 173 | 190 | if(Plugin::$instance->editor->is_edit_mode()) { |
| 174 | 191 | $this->data['is_edit_mode']= true; |
| 192 | + $this->view('wdk-listing-agent-demo', $this->data, true); | |
| 175 | 193 | } else { |
| 176 | - | |
| 194 | + $this->view('wdk-listing-agent', $this->data, true); | |
| 177 | 195 | } |
| 178 | 196 | |
| 179 | - echo $this->view('wdk-listing-agent', $this->data); | |
| 180 | 197 | } |
| 181 | 198 | |
| 182 | 199 | |
| 183 | 200 | private function generate_controls_conf() { |
| @@ -204,8 +221,20 @@ | ||
| 204 | 221 | ] |
| 205 | 222 | ); |
| 206 | 223 | |
| 207 | 224 | $this->add_control ( |
| 225 | + 'listing_agency_disabled', | |
| 226 | + [ | |
| 227 | + 'label' => __( 'Hide Agency', 'wpdirectorykit' ), | |
| 228 | + 'type' => Controls_Manager::SWITCHER, | |
| 229 | + 'label_on' => __( 'Hide', 'wpdirectorykit' ), | |
| 230 | + 'label_off' => __( 'Show', 'wpdirectorykit' ), | |
| 231 | + 'return_value' => 'yes', | |
| 232 | + 'default' => '', | |
| 233 | + ] | |
| 234 | + ); | |
| 235 | + | |
| 236 | + $this->add_control ( | |
| 208 | 237 | 'user_editor_disabled', |
| 209 | 238 | [ |
| 210 | 239 | 'label' => __( 'Hide Agent Editor', 'wpdirectorykit' ), |
| 211 | 240 | 'type' => Controls_Manager::SWITCHER, |
| @@ -334,9 +363,9 @@ | ||
| 334 | 363 | 'min' => 0, |
| 335 | 364 | 'max' => 100, |
| 336 | 365 | ], |
| 337 | 366 | ], |
| 338 | - 'size_units' => [ 'px', 'vw' ], | |
| 367 | + 'size_units' => [ 'px','em', 'vw', '%', 'custom' ], | |
| 339 | 368 | 'default' => [ |
| 340 | 369 | 'size' => 90, |
| 341 | 370 | 'unit' => 'px', |
| 342 | 371 | ], |
| @@ -376,9 +405,9 @@ | ||
| 376 | 405 | 'min' => 0, |
| 377 | 406 | 'max' => 100, |
| 378 | 407 | ], |
| 379 | 408 | ], |
| 380 | - 'size_units' => [ 'px', 'vw' ], | |
| 409 | + 'size_units' => [ 'px','em', 'vw', '%', 'custom' ], | |
| 381 | 410 | 'selectors' => [ |
| 382 | 411 | '{{WRAPPER}} .wdk-element .wdk-listing-agent .agent-thumbnail img' => 'max-height: {{SIZE}}{{UNIT}};', |
| 383 | 412 | ], |
| 384 | 413 | 'conditions' => [ |
| @@ -412,9 +441,9 @@ | ||
| 412 | 441 | 'min' => 0, |
| 413 | 442 | 'max' => 100, |
| 414 | 443 | ], |
| 415 | 444 | ], |
| 416 | - 'size_units' => [ 'px', 'vw' ], | |
| 445 | + 'size_units' => [ 'px','em', 'vw', '%', 'custom' ], | |
| 417 | 446 | 'default' => [ |
| 418 | 447 | 'size' => 250, |
| 419 | 448 | 'unit' => 'px', |
| 420 | 449 | ], |
| @@ -447,17 +476,19 @@ | ||
| 447 | 476 | 'description' => __('Bio', 'wpdirectorykit'), |
| 448 | 477 | 'wdk_facebook' => __('Facebook', 'wpdirectorykit'), |
| 449 | 478 | 'wdk_youtube' => __('Youtube', 'wpdirectorykit'), |
| 450 | 479 | 'wdk_address' => __('Address', 'wpdirectorykit'), |
| 480 | + 'wdk_country' => __('Country', 'wpdirectorykit'), | |
| 451 | 481 | 'wdk_city' => __('City', 'wpdirectorykit'), |
| 452 | 482 | 'wdk_position_title' => __('Position Title', 'wpdirectorykit'), |
| 453 | 483 | 'wdk_linkedin' => __('Linkedin', 'wpdirectorykit'), |
| 454 | 484 | 'wdk_twitter' => __('Twitter', 'wpdirectorykit'), |
| 455 | 485 | 'wdk_telegram' => __('Telegram', 'wpdirectorykit'), |
| 456 | - 'wdk_whatsapp' => __('What`s App', 'wpdirectorykit'), | |
| 486 | + 'wdk_whatsapp' => __('WhatsApp', 'wpdirectorykit'), | |
| 457 | 487 | 'wdk_viber' => __('Viber', 'wpdirectorykit'), |
| 458 | 488 | 'wdk_iban' => __('IBAN', 'wpdirectorykit'), |
| 459 | 489 | 'wdk_company_name' => __('Company name', 'wpdirectorykit'), |
| 490 | + 'agency_name' => __('Agency Name', 'wpdirectorykit'), | |
| 460 | 491 | ); |
| 461 | 492 | |
| 462 | 493 | $repeater = new Repeater(); |
| 463 | 494 | $repeater->start_controls_tabs( 'meta_fields' ); |