Example #1
0
 function view()
 {
     global $data;
     global $page_owner;
     global $CFG;
     /*$run_result = '';
             $usertype = user_type($page_owner);
     
             $icon = user_info('icon',$page_owner);
             $username = user_info('username',$page_owner);
             $icon_url = $CFG->wwwroot.'_icon/user/'.$icon.'/w/240';
     
             // $first_column_fields = array('biography','likes','dislikes');
             // $id_block_fields = array('gender','town','country','birth_date');
     
     
             // Cycle through all defined profile detail fields and display them
     
             $allvalues = get_records('profile_data','owner',$this->id);
             $first_column_fields = array();
             $second_column_fields = array();
             $firstcol = "";
             $secondcol = "";
             foreach($data['profile:details'] as $field) {
                 if (is_array($field)) {
                     $flabel = !empty($field[0]) ? $field[0] : '';
                     $fname  = !empty($field[1]) ? $field[1] : '';
                     $ftype  = !empty($field[2]) ? $field[2] : '';
                     $fblurb = !empty($field[3]) ? $field[3] : '';
                     $fusertype = !empty($field[4]) ? $field[4] : '';
                     $finvisible = false;
                     $frequired = false;
                     $fcat = __gettext("Main");
                 // Otherwise map things the new way!
                 } else {
                     $flabel = $field->name;
                     $fname = $field->internal_name;
                     $ftype = $field->field_type;
                     $fblurb = $field->description;
                     $fusertype = $field->user_type;
                     $finvisible = $field->invisible;
                     $frequired = $field->required;
                     if (!isset($field->col1)) {
                         $col1 = false;
                     } else {
                         $col1 = $field->col1;
                         $first_column_fields[] = $fname;
                     }
                     if (!isset($field->col2)) {
                         $col2 = false;
                     } else {
                         $col2 = $field->col2;
                         $second_column_fields[] = $fname;
                     }
                     if (!empty($field->category)) {
                         $fcat = $field->category;
                     } else {
                         $fcat = __gettext("Main");
                     }
                 }
                 if (empty($fusertype) || $usertype == $fusertype) {
                 // $field is an array, with the name
                 // of the field in $field[0]
                     if (in_array($fname,$first_column_fields)) {
                         $firstcol .= $this->field_display($field,$allvalues);
                     } else if (in_array($fname,$second_column_fields)) {
                         $secondcol .= $this->field_display($field,$allvalues);
                     }
                 }
             }*/
     // $other_fields = array_merge($first_column_fields,$second_column_fields);
     //$run_result .= '<div class="profile_main">'."\n";
     //$run_result .= '<div class="profile_primary">'."\n";
     // $run_result .= '<div class="profile_icon"><img src="'.$icon_url.'"></div>'."\n";
     //$run_result .= $firstcol;
     /*$run_result .= templates_draw(array(
                               'context' => 'databox1',
                               'name' => __gettext("Extended profile"),
                               'column1' => "<a href=\"{$CFG->wwwroot}profile/extended.php?profile_name={$username}\">" . __gettext("Click here to view extended profile") . "</a>"
                               )
       );*/
     //$run_result .= '</div>'."\n";
     //$run_result .= '<div class="profile_secondary">'."\n";
     //$run_result .= $secondcol;
     //$run_result .= "</div>\n";
     //$run_result .= '<div class="profile_main_bottom"></div>'."</div>\n";
     /*//Pruebas con el perfil extendido
     
     		$profile_name = optional_param('profile_name', '', PARAM_ALPHANUM);
     		if (!empty($profile_name)) {
         		$profile_id = user_info_username('ident', $profile_name);
     		}
     		if (empty($profile_id)) {
         		$profile_id = optional_param('profile_id', -1, PARAM_INT);
     		}
     		// and the page_owner naturally
     		$page_owner = $profile_id;
     
     		define("context", "profile");
     		//templates_page_setup();
     
     		// init library
     		$profile = new ElggProfile($profile_id);
     
     		$title = user_name($profile_id); //$profile->display_name();
     		$body  = $profile->view();
     
     		$run_result .= $body;*/
     // Draw the user's comment wall
     if (function_exists("commentwall_displayonprofile")) {
         $offset = optional_param('offset', 0);
         $limit = optional_param('limit', 3);
         $run_result .= commentwall_displayonprofile($page_owner, $limit, $offset);
     }
     $view = array();
     $view['body'] = $run_result;
     $run_result = '';
     $username = user_info('username', $this->id);
     $run_result .= '<div id="profile_widgets">' . "\n";
     $run_result .= widget_page_display($page_owner, 'profile', 0, 2);
     $run_result .= "</div>\n";
     $view['body'] .= $run_result;
     return $view;
 }
$run_result .= <<<END

        <h2>{$community_email_title}</h2>
        <p>
            {$community_email}
        </p>

END;
$run_result .= <<<END

        <h2>{$community_city_title}</h2>
        <p>
            {$community_city}
        </p>

END;
//Comment wall
if (function_exists("commentwall_displayonprofile")) {
    $offset = optional_param('offset', 0);
    $limit = optional_param('limit', 3);
    $run_result .= commentwall_displayonprofile($page_owner, $limit, $offset);
}
$view = array();
$view['body'] = $run_result;
$run_result = '';
//$username = user_info('username',$this->id);
$run_result .= '<div id="profile_widgets">' . "\n";
$run_result .= widget_page_display($page_owner, 'profile', 0, 2);
$run_result .= "</div>\n";
$view['body'] .= $run_result;
$run_result .= $view['body'];