Ejemplo n.º 1
0
 /**
  * How to display the widget on the screen.
  */
 public function widget($args, $instance)
 {
     $this->widget_id = $this->number;
     if ($this->widget_id < 0) {
         $this->widget_id = abs($this->widget_id) + 1000;
     }
     $this->widget_uq_name = 'wpla' . $this->widget_id;
     $this->instance = $instance;
     $widget_id = $this->widget_id;
     $this->css_class = isset($instance['data']['css_class']) ? $instance['data']['css_class'] : '';
     /** render properties **/
     $query = self::query($instance);
     $model = new wpl_users();
     $profiles = $model->search($query);
     /** return if no property found **/
     if (!count($profiles)) {
         return;
     }
     $plisting_fields = $model->get_plisting_fields();
     $wpl_profiles = array();
     $render_params['wpltarget'] = isset($instance['wpltarget']) ? $instance['wpltarget'] : 0;
     $params = array();
     foreach ($profiles as $profile) {
         $wpl_profiles[$profile->id] = $model->full_render($profile->id, $plisting_fields, $profile, $render_params);
         $params['image_parentid'] = $profile->id;
         /** profile picture **/
         if (isset($wpl_profiles[$profile->id]['profile_picture']['url'])) {
             $params['image_name'] = isset($wpl_profiles[$profile->id]['profile_picture']['name']) ? $wpl_profiles[$profile->id]['profile_picture']['name'] : '';
             $profile_picture_path = isset($wpl_profiles[$profile->id]['profile_picture']['path']) ? $wpl_profiles[$profile->id]['profile_picture']['path'] : '';
             $wpl_profiles[$profile->id]['profile_picture']['url'] = wpl_images::create_profile_images($profile_picture_path, $instance['data']['image_width'], $instance['data']['image_height'], $params);
             $wpl_profiles[$profile->id]['profile_picture']['image_width'] = isset($instance['data']['image_width']) ? $instance['data']['image_width'] : '';
             $wpl_profiles[$profile->id]['profile_picture']['image_height'] = isset($instance['data']['image_height']) ? $instance['data']['image_height'] : '';
         }
         /** company logo **/
         if (isset($wpl_profiles[$profile->id]['company_logo']['url'])) {
             $params['image_name'] = isset($wpl_profiles[$profile->id]['company_logo']['name']) ? $wpl_profiles[$profile->id]['company_logo']['name'] : '';
             $company_logo_path = isset($wpl_profiles[$profile->id]['company_logo']['path']) ? $wpl_profiles[$profile->id]['company_logo']['path'] : '';
             $wpl_profiles[$profile->id]['company_logo']['url'] = wpl_images::create_profile_images($company_logo_path, $instance['data']['image_width'], $instance['data']['image_height'], $params);
         }
     }
     echo $args['before_widget'];
     $title = apply_filters('widget_title', $instance['title']);
     if (trim($title) != '') {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     $layout = 'widgets.agents.tmpl.' . $instance['layout'];
     $layout = _wpl_import($layout, true, true);
     if (!wpl_file::exists($layout)) {
         $layout = _wpl_import('widgets.agents.tmpl.default', true, true);
     } elseif (wpl_file::exists($layout)) {
         require $layout;
     } else {
         echo __('Widget Layout Not Found!', WPL_TEXTDOMAIN);
     }
     echo $args['after_widget'];
 }
Ejemplo n.º 2
0
    $user_id = $wpl_properties['current']['data']['user_id'];
}
$wpl_user = wpl_users::full_render($user_id, wpl_users::get_pshow_fields(), NULL, array(), true);
/** resizing profile image **/
$params = array();
$params['image_parentid'] = $user_id;
$params['image_name'] = isset($wpl_user['profile_picture']['name']) ? $wpl_user['profile_picture']['name'] : '';
$profile_path = isset($wpl_user['profile_picture']['path']) ? $wpl_user['profile_picture']['path'] : '';
$profile_image = wpl_images::create_profile_images($profile_path, $picture_width, $picture_height, $params);
/** resizing company logo **/
$params = array();
$params['image_parentid'] = $user_id;
$params['image_name'] = isset($wpl_user['company_logo']['name']) ? $wpl_user['company_logo']['name'] : '';
$logo_path = isset($wpl_user['company_logo']['path']) ? $wpl_user['company_logo']['path'] : '';
//$logo_image               = isset($wpl_user['company_logo']['url']) ? $wpl_user['company_logo']['url'] : '';
$logo_image = wpl_images::create_profile_images($logo_path, $picture_width, $picture_height, $params);
$agent_name = isset($wpl_user['materials']['first_name']['value']) ? $wpl_user['materials']['first_name']['value'] : '';
$agent_l_name = isset($wpl_user['materials']['last_name']['value']) ? $wpl_user['materials']['last_name']['value'] : '';
$company_name = isset($wpl_user['materials']['company_name']['value']) ? $wpl_user['materials']['company_name']['value'] : '';
?>
<div class="wpl_agent_info" id="wpl_agent_info<?php 
echo $user_id;
?>
" itemscope >
	
	<div class="wpl_agent_info_l">
		<div class="image_container">
			<div class="front <?php 
if ($logo_image) {
    echo 'has_logo';
}