[svn r18875] Minor- improve functions for the Social Tool see FS#3751

skala
Julio Montoya 17 years ago
parent 3f3c3640cc
commit 6d756a1de6
  1. 53
      main/forum/forumfunction.inc.php
  2. 25
      main/inc/lib/blog.lib.php
  3. 26
      main/inc/lib/usermanager.lib.php

@ -3792,32 +3792,35 @@ function get_thread_user_post($course_db, $thread_id, $user_id )
function get_all_post_from_user($user_id, $course_db)
{
$forums = get_forums();
$forums = get_forums();
foreach($forums as $forum) {
$threads = get_threads($forum['forum_id']);
echo '<div id="social-forum">';
echo Display::return_icon('forum.gif');
echo $forum['forum_title'];
echo '<br / >'; echo '<br / >';
foreach($threads as $thread) {
echo '<div id="social-thread">';
echo Display::return_icon('forumthread.gif');
echo $thread['thread_title'].' ';
/* echo '<br / >'; echo '<br / >';
echo '<strong>'.$thread['post_title'].'</strong>'; echo '<br / >';
echo cut($thread['post_text'], 150);
echo '<br / >';
*/
$post_list = get_thread_user_post_limit($course_db, $thread['thread_id'], $user_id, 1);
foreach($post_list as $posts) {
echo '<div id="social-post">';
echo '<strong>'.$posts['post_title'].'</strong>'; echo '<br / >';
echo cut($posts['post_text'], 150);
echo '</div>';
echo '<br / >';
}
echo '</div>';
$threads = get_threads($forum['forum_id']);
if (is_array($threads)) {
echo '<div id="social-forum">';
echo Display::return_icon('forum.gif');
echo $forum['forum_title'];
echo '<br / >'; echo '<br / >';
foreach($threads as $thread) {
$post_list = get_thread_user_post_limit($course_db, $thread['thread_id'], $user_id, 1);
if (is_array($post_list) && count($post_list)>0) {
echo '<div id="social-thread">';
echo Display::return_icon('forumthread.gif');
echo $thread['thread_title'].' ';
/* echo '<br / >'; echo '<br / >';
echo '<strong>'.$thread['post_title'].'</strong>'; echo '<br / >';
echo cut($thread['post_text'], 150);
echo '<br / >';
*/
foreach($post_list as $posts) {
echo '<div id="social-post">';
echo '<strong>'.$posts['post_title'].'</strong>'; echo '<br / >';
echo cut($posts['post_text'], 150);
echo '</div>';
echo '<br / >';
}
}
echo '</div>';
}
}
echo '</div>';
}

@ -2862,15 +2862,22 @@ function get_blog_post_from_user($course_db_name, $user_id) {
WHERE author_id = $user_id AND visibility = 1
ORDER BY post.date_creation DESC ";
$result = api_sql_query($sql, __FILE__, __LINE__);
$return_data = '';
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 />';
$return_data.= '<strong>'.$row['title'].'</strong>'; echo '<br>';
$return_data.= $row['full_text'];
$return_data.= '<br /><br />';
}
}
return $return_data;
}
/**
* Gets all the post comments from a given user id
* @param string db course name
* @param int user id
*/
function get_blog_comment_from_user($course_db_name, $user_id) {
$tbl_blogs = Database::get_course_table(TABLE_BLOGS,$course_db_name);
@ -2881,15 +2888,15 @@ function get_blog_comment_from_user($course_db_name, $user_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) {
$return_data = '';
if (Database::num_rows($result)!=0) {
while ($row=Database::fetch_array($result)) {
echo '<strong>'.$row['title'].'</strong>'; echo '<br>';
echo $row['comment'];
echo '<br />';
$return_data.= '<strong>'.$row['title'].'</strong>'; echo '<br>';
$return_data.= $row['comment'];
$return_data.= '<br />';
}
} else {
return false;
}
return $return_data;
}
?>

@ -1,4 +1,4 @@
<?php // $Id: usermanager.lib.php 18869 2009-03-09 15:13:00Z juliomontoya $
<?php // $Id: usermanager.lib.php 18875 2009-03-09 16:13:34Z juliomontoya $
/*
==============================================================================
Dokeos - elearning and course management software
@ -641,19 +641,17 @@ class UserManager
$production_dir = $production_path['dir'].$user_id.'/';
$del_image = api_get_path(WEB_CODE_PATH).'img/delete.gif';
$del_text = get_lang('Delete');
$production_list = '<ul id="productions">';
foreach ($productions as $file)
{
$production_list .= '<li><a href="'.$production_dir.urlencode($file).'" target="_blank">'.htmlentities($file).'</a>';
if ($showdelete)
{
$production_list .= '<input type="image" name="remove_production['.urlencode($file).']" src="'.$del_image.'" alt="'.$del_text.'" title="'.$del_text.' '.htmlentities($file).'" onclick="return confirmation(\''.htmlentities($file).'\');" /></li>';
}
}
$production_list .= '</ul>';
$production_list = '';
if (count($productions)>0) {
$production_list = '<ul id="productions">';
foreach ($productions as $file) {
$production_list .= '<li><a href="'.$production_dir.urlencode($file).'" target="_blank">'.htmlentities($file).'</a>';
if ($showdelete) {
$production_list .= '<input type="image" name="remove_production['.urlencode($file).']" src="'.$del_image.'" alt="'.$del_text.'" title="'.$del_text.' '.htmlentities($file).'" onclick="return confirmation(\''.htmlentities($file).'\');" /></li>';
}
}
$production_list .= '</ul>';
}
return $production_list;
}

Loading…
Cancel
Save