[svn r18869] Adding the social/profile.php page see FS#3751

skala
Julio Montoya 17 years ago
parent f489f0f4de
commit ff3269f8d6
  1. 45
      main/inc/lib/blog.lib.php
  2. 30
      main/inc/lib/usermanager.lib.php

@ -2845,8 +2845,51 @@ function delete_all_blog_attachment($blog_id,$post_id=null,$comment_id=null)
}
}
$sql = 'DELETE FROM '. $blog_table_attachment.' WHERE blog_id ="'.$blog_id.'" '.$where;
api_sql_query($sql, __FILE__, __LINE__);
api_sql_query($sql, __FILE__, __LINE__);
}
/**
* Gets all the post from a given user id
* @param string db course name
* @param int user id
*/
function get_blog_post_from_user($course_db_name, $user_id) {
$tbl_blogs = Database::get_course_table(TABLE_BLOGS,$course_db_name);
$tbl_blog_post = Database::get_course_table(TABLE_BLOGS_POSTS,$course_db_name);
$sql = "SELECT DISTINCT blog.blog_id, post_id, title, full_text, post.date_creation
FROM $tbl_blogs blog INNER JOIN $tbl_blog_post post
ON (blog.blog_id = post.blog_id)
WHERE author_id = $user_id AND visibility = 1
ORDER BY post.date_creation DESC ";
$result = api_sql_query($sql, __FILE__, __LINE__);
if (Database::num_rows($result)!=0) {
while ($row=Database::fetch_array($result)) {
echo '<strong>'.$row['title'].'</strong>'; echo '<br>';
echo $row['full_text'];
echo '<br /><br />';
}
}
}
function get_blog_comment_from_user($course_db_name, $user_id) {
$tbl_blogs = Database::get_course_table(TABLE_BLOGS,$course_db_name);
$tbl_blog_comment = Database::get_course_table(TABLE_BLOGS_COMMENTS,$course_db_name);
$sql = "SELECT DISTINCT blog.blog_id, comment_id, title, comment, comment.date_creation
FROM $tbl_blogs blog INNER JOIN $tbl_blog_comment comment
ON (blog.blog_id = comment.blog_id)
WHERE author_id = $user_id AND visibility = 1
ORDER BY blog_name";
$result = api_sql_query($sql, __FILE__, __LINE__);
if (Database::num_rows($result)>0) {
while ($row=Database::fetch_array($result)) {
echo '<strong>'.$row['title'].'</strong>'; echo '<br>';
echo $row['comment'];
echo '<br />';
}
} else {
return false;
}
}
?>

@ -1,4 +1,4 @@
<?php // $Id: usermanager.lib.php 18783 2009-03-03 18:10:15Z cvargas1 $
<?php // $Id: usermanager.lib.php 18869 2009-03-09 15:13:00Z juliomontoya $
/*
==============================================================================
Dokeos - elearning and course management software
@ -1588,6 +1588,34 @@ class UserManager
$row = Database::fetch_array($res);
return $row['user_id'];
}
/**
* Get the users files upload from his share_folder
* @param string Username
* @return int User ID (or false if not found)
*/
function get_user_upload_files_by_course($user_id, $course, $column=2)
{
$path = api_get_path(SYS_COURSE_PATH).$course.'/document/shared_folder/sf_user_'.$user_id.'/';
$web_path = api_get_path(WEB_COURSE_PATH).$course.'/document/shared_folder/sf_user_'.$user_id.'/';
$file_list= array();
$return = '';
if (is_dir($path)) {
$handle = opendir($path);
while ($file = readdir($handle)) {
if ($file == '.' || $file == '..' || $file == '.htaccess' || is_dir($path.$file))
continue; // skip current/parent directory and .htaccess
$file_list[] = $file;
}
$return = $course;
$return .= '<ul>';
foreach ($file_list as $file) {
$return .= '<li><a href="'.$web_path.urlencode($file).'" target="_blank">'.htmlentities($file).'</a>';
}
$return .= '</ul>';
}
return $return;
}
/**
* Gets the API key (or keys) and return them into an array
* @param int Optional user id (defaults to the result of api_get_user_id())

Loading…
Cancel
Save