[svn r14370] Added user image option in forum (see FS#337)

skala
Yannick Warnier 18 years ago
parent 777e15dbda
commit 65449a94a1
  1. 41
      main/forum/forumfunction.inc.php
  2. 5
      main/forum/viewthread_flat.inc.php
  3. 1
      main/forum/viewthread_nested.inc.php
  4. 1
      main/forum/viewthread_threaded.inc.php
  5. 3
      main/inc/lib/add_course.lib.inc.php
  6. 4
      main/install/migrate-db-1.8.4-1.8.5-pre.sql

@ -69,8 +69,9 @@
**************************************************************************
*/
include(api_get_path(INCLUDE_PATH).'/lib/mail.lib.inc.php');
include(api_get_path(INCLUDE_PATH).'/conf/mail.conf.php');
require_once(api_get_path(INCLUDE_PATH).'/lib/mail.lib.inc.php');
require_once(api_get_path(INCLUDE_PATH).'/conf/mail.conf.php');
require_once(api_get_path(INCLUDE_PATH).'/lib/usermanager.lib.php');
/**
* This function handles all the forum and forumcategories actions. This is a wrapper for the
@ -1943,7 +1944,7 @@ function display_user_link($user_id, $name)
{
if ($user_id<>0)
{
return "<a href=\"../user/userInfo.php?uInfo=".$user_id."\">".$name."</a>";
return '<a href="../user/userInfo.php?uInfo='.$user_id.'">'.$name.'</a>';
}
else
{
@ -1951,6 +1952,40 @@ function display_user_link($user_id, $name)
}
}
/**
* This function displays the user image from the profile, with a link to the user's details.
* @param int User's database ID
* @param str User's name
* @return string An HTML with the anchor and the image of the user
* @author Julio Montoya <julio.montoya@dokeos.com>
*/
function display_user_image($user_id,$name)
{
$link='<a href="../user/userInfo.php?uInfo='.$user_id.'">';
$attrb=array();
if ($user_id<>0)
{
$image_path = UserManager::get_user_picture_path_by_id($user_id,'web');
$image_repository = $image_path['dir'];
$existing_image = $image_path['file'];
if (is_array($image_path) && $existing_image!='') {
return $link.'<img src="'.$image_repository.$existing_image.'" alt="'.$name.'" title="'.$name.'" /></a>';
}
else
return $link.'<img src="'.api_get_path(WEB_CODE_PATH)."img/unknown.jpg".'" alt="'.$name.'" title="'.$name.'" /></a>';
}
else
{
return $link.'<img src="'.api_get_path(WEB_CODE_PATH)."img/unknown.jpg".'" alt="'.$name.'" title="'.$name.'" /></a>';
}
}
/**
* The thread view counter gets increased every time someone looks at the thread
*

@ -86,6 +86,11 @@ foreach ($rows as $row)
}
if($origin!='learnpath')
{
if (api_get_course_setting('allow_user_image_forum')) {
echo '<br />'.display_user_image($row['user_id'],$name).'<br />';
}
echo display_user_link($row['user_id'], $name).'<br />';
}
else

@ -89,6 +89,7 @@ foreach ($rows as $post)
{
$name=$post['firstname'].' '.$post['lastname'];
}
if (api_get_course_setting('allow_user_image_forum')) {echo '<br />'.display_user_image($post['user_id']).'<br />'; }
echo display_user_link($post['user_id'], $name).'<br />';
echo $post['post_date'].'<br /><br />';
// The user who posted it can edit his thread only if the course admin allowed this in the properties of the forum

@ -100,6 +100,7 @@ else
{
$name=$rows[$display_post_id]['firstname'].' '.$rows[$display_post_id]['lastname'];
}
if (api_get_course_setting('allow_user_image_forum')) {echo '<br />'.display_user_image($rows[$display_post_id]['user_id']).'<br />'; }
echo display_user_link($rows[$display_post_id]['user_id'], $name).'<br />';
echo $rows[$display_post_id]['post_date'].'<br /><br />';
// The user who posted it can edit his thread only if the course admin allowed this in the properties of the forum

@ -766,7 +766,7 @@ function update_Db_course($courseDbName)
doc_state tinyint unsigned NOT NULL default 1,
calendar_state tinyint unsigned NOT NULL default 1,
work_state tinyint unsigned NOT NULL default 1,
announcements_state tinyint unsigned NOT NULL default 1,
announcements_state tinyint unsigned databaseNOT NULL default 1,
max_student smallint unsigned NOT NULL default 8,
self_reg_allowed tinyint unsigned NOT NULL default 0,
self_unreg_allowed tinyint unsigned NOT NULL default 0,
@ -1701,6 +1701,7 @@ function fill_Db_course($courseDbName, $courseRepository, $language,$default_doc
api_sql_query("INSERT INTO `".$TABLESETTING . "`(variable,value,category) VALUES ('allow_user_edit_agenda',0,'agenda')");
api_sql_query("INSERT INTO `".$TABLESETTING . "`(variable,value,category) VALUES ('allow_user_edit_announcement',0,'announcement')");
api_sql_query("INSERT INTO `".$TABLESETTING . "`(variable,value,category) VALUES ('email_alert_manager_on_new_quiz',0,'quiz')");
api_sql_query("INSERT INTO `".$TABLESETTING . "`(variable,value,category) VALUES ('allow_user_image_forum',1,'forum')");
/*
-----------------------------------------------------------
Course homepage tools for platform admin only

@ -30,6 +30,7 @@ INSERT INTO settings_current (variable, subkey, type, category, selected_value,
INSERT INTO settings_options (variable, value, display_text) VALUES ('openid_authentication', 'true', 'Yes');
INSERT INTO settings_options (variable, value, display_text) VALUES ('openid_authentication', 'false', 'No');
INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext) VALUES ('profile','openid','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'OpenIDURL');
CREATE TABLE templates (id int NOT NULL auto_increment, title varchar(100) NOT NULL, description varchar(250) NOT NULL, course_code varchar(40) NOT NULL, user_id int NOT NULL, ref_doc int NOT NULL, PRIMARY KEY (id));
ALTER TABLE user ADD openid varchar(255) DEFAULT NULL;
ALTER TABLE user ADD INDEX (openid(50));
@ -77,4 +78,5 @@ ALTER TABLE dropbox_post ADD session_id SMALLINT UNSIGNED NOT NULL ;
ALTER TABLE dropbox_post ADD INDEX ( session_id ) ;
ALTER TABLE dropbox_file ADD session_id SMALLINT UNSIGNED NOT NULL ;
ALTER TABLE dropbox_file ADD INDEX ( session_id ) ;
ALTER TABLE item_property ADD INDEX (tool,ref);
ALTER TABLE item_property ADD INDEX (tool,ref);
INSERT INTO course_setting(variable,value,category) VALUES ('allow_user_image_forum',1,'forum');
Loading…
Cancel
Save