Ejemplo n.º 1
0
 /**
  * This function will generate rendered data of user and save them into db
  * @author Howard R <*****@*****.**>
  * @static
  * @param int $user_id
  * @return string
  */
 public static function generate_rendered_data($user_id)
 {
     _wpl_import('libraries.render');
     /** get user data **/
     $user_data = (array) wpl_users::get_wpl_user($user_id);
     /** location text **/
     $location_text = wpl_users::generate_location_text($user_data);
     /** render data **/
     $find_files = array();
     $rendered_fields = self::render_profile($user_data, wpl_users::get_plisting_fields(), $find_files, true);
     $result = json_encode(array('rendered' => $rendered_fields['ids'], 'materials' => $rendered_fields['columns'], 'location_text' => $location_text));
     $column = 'rendered';
     if (wpl_global::check_multilingual_status()) {
         $column = wpl_addon_pro::get_column_lang_name($column, wpl_global::get_current_language(), false);
     }
     $query = "UPDATE `#__wpl_users` SET `{$column}`='" . wpl_db::escape($result) . "' WHERE `id`='{$user_id}'";
     /** update **/
     wpl_db::q($query, 'update');
     return $result;
 }