show pictures of each course in the social network, so far only displays a list of files

skala
Juan Carlos Raña 15 years ago
parent 33678de470
commit b8190d0465
  1. 20
      main/inc/lib/usermanager.lib.php
  2. 2
      main/social/profile.php

@ -2063,9 +2063,10 @@ class UserManager
* Get the users files upload from his share_folder
* @param string User ID
* @param string course directory
* @param string resourcetype: images, all
* @return int User ID (or false if not found)
*/
public static function get_user_upload_files_by_course($user_id, $course) {
public static function get_user_upload_files_by_course($user_id, $course, $resourcetype='all') {
$return = '';
if (!empty($user_id) && !empty($course)) {
$user_id = intval($user_id);
@ -2086,7 +2087,22 @@ class UserManager
$return .= '<ul>';
}
foreach ($file_list as $file) {
$return .= '<li><a href="'.$web_path.urlencode($file).'" target="_blank">'.htmlentities($file).'</a>';
if($resourcetype=="all")
{
$return .= '<li><a href="'.$web_path.urlencode($file).'" target="_blank">'.htmlentities($file).'</a>';
}
elseif($resourcetype=="images")
{
//get extension
$ext = explode('.', $file);
if($ext[1]=='jpg' || $ext[1]=='jpeg'|| $ext[1]=='png' || $ext[1]=='gif' || $ext[1]=='bmp' || $ext[1]=='tif')
{
$return .= '<li style="display:inline;"><a href="'.$web_path.urlencode($file).'" target="_blank"><img src="'.$web_path.urlencode($file).'" width="80" height="60"></a>';
}
}
}
if (count($file_list) > 0) {
$return .= '</ul>';

@ -576,7 +576,7 @@ echo '<div id="social-content-right">';
$file_list = '';
if (is_array($course_list_code) && count($course_list_code)>0) {
foreach ($course_list_code as $course) {
$file_list.= UserManager::get_user_upload_files_by_course($user_id,$course['code']);
$file_list.= UserManager::get_user_upload_files_by_course($user_id,$course['code'],$resourcetype='images');
}
}

Loading…
Cancel
Save