Пример #1
0
 public function populateRecentPurchasesAndReviews($p_id, $u_id)
 {
     $recent_purchases = array();
     $d_arr = MpFeedbackItem::whereRaw('feedback_item_id = ? AND feedback_user_id != ? AND item_type = ?', array($p_id, $u_id, 'product'))->get(array('feedback_comment', 'feedback_status', 'feedback_user_id', DB::raw('DATE_FORMAT(date_added, "%b %d, %Y") AS date_added')));
     $inc = 0;
     foreach ($d_arr as $data) {
         $posted_user_details = CUtil::getUserDetails($data['feedback_user_id']);
         $recent_purchases[$inc]['posted_by'] = $posted_user_details['display_name'];
         $recent_purchases[$inc]['date_added'] = $data['date_added'] != '' ? $data['date_added'] : '-';
         $recent_purchases[$inc]['profile_url'] = $posted_user_details['profile_url'];
         $recent_purchases[$inc]['icon'] = CUtil::getUserPersonalImage($data['feedback_user_id']);
         $recent_purchases[$inc]['feedback_comment'] = $data['feedback_comment'];
         $recent_purchases[$inc]['show_more_notes'] = 0;
         $recent_purchases[$inc]['feedback_comment_full'] = CUtil::makeClickableLinks(nl2br($data['feedback_comment']));
         if (strlen($data['feedback_comment']) > 250) {
             $recent_purchases[$inc]['feedback_comment'] = CUtil::wordWrap($data['feedback_comment'], 250);
             $recent_purchases[$inc]['show_more_notes'] = 1;
         }
         $recent_purchases[$inc]['feedback_status'] = $data['feedback_status'];
         $inc++;
     }
     return $recent_purchases;
 }