Partial changes to complete Feature #564

skala
Julio Montoya 15 years ago
parent 25a65810ea
commit ed1a3460fa
  1. 19
      main/admin/user_list.php
  2. 44
      main/inc/lib/sessionmanager.lib.php
  3. 3
      main/install/dokeos_main.sql
  4. 1
      main/install/migrate-db-1.8.6.2-1.8.7-pre.sql
  5. 8
      main/social/profile.php
  6. 4
      main/social/profile_friends_and_groups.inc.php

@ -501,12 +501,19 @@ function modify_filter($user_id,$url_params,$row)
$result .= Display::return_icon('delete_na.gif', get_lang('Delete'));
}
}
if ($is_admin) {
$result .= Display::return_icon('admin_star.png', get_lang('IsAdministrator'),array('width'=> 22, 'heigth'=> 22));
} else {
$result .= Display::return_icon('admin_star_na.png', get_lang('IsNotAdministrator'));
}
if ($is_admin) {
$result .= Display::return_icon('admin_star.png', get_lang('IsAdministrator'),array('width'=> 22, 'heigth'=> 22));
} else {
$result .= Display::return_icon('admin_star_na.png', get_lang('IsNotAdministrator'));
}
if ($row['7'] == $statusname[DRH]) {
$result .= '<a href="dashboard_add_users_to_user.php?user='.$user_id.'">'.Display::return_icon('addd.gif', get_lang('Add')).'</a>&nbsp;&nbsp;';
$result .= '<a href="dashboard_add_courses_to_user.php?user='.$user_id.'">'.Display::return_icon('addd.gif', get_lang('Add')).'</a>&nbsp;&nbsp;';
$result .= '<a href="dashboard_add_users_to_sessions.php?user='.$user_id.'">'.Display::return_icon('addd.gif', get_lang('Add')).'</a>&nbsp;&nbsp;';
}
return $result;
}

@ -8,7 +8,7 @@
* @package dokeos.library
==============================================================================
*/
require_once('display.lib.php');
require_once 'display.lib.php';
class SessionManager {
private function __construct() {
@ -438,6 +438,48 @@ class SessionManager {
$update_sql = "UPDATE $tbl_session SET nbr_users= $nbr_users WHERE id='$id_session' ";
Database::query($update_sql,__FILE__,__LINE__);
}
/**
* Subscribes sessions to user (Dashboard feature)
* @param integer Session ID
* @param array List of user IDs
* @param bool Whether to unsubscribe existing users (true, default) or not (false)
* @return void Nothing, or false on error
**/
public static function suscribe_sessions_to_user($user_id,$session_list, $relation_stype) {
if ($user_id!= strval(intval($user_id))) return false;
foreach($session_list as $session_id){
if ($session_id!= strval(intval($session_id))) return false;
}
$tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$sql = "SELECT id_session FROM $tbl_session_rel_user WHERE id_user =$user_id AND relation_type = 1 ";
$result = Database::query($sql,__FILE__,__LINE__);
$existing_sessions = array();
while($row = Database::fetch_array($result)){
$existing_sessions[] = $row['id_session'];
}
//Deleting existing session_rel_user
foreach ($existing_sessions as $existing_session) {
$sql = "DELETE FROM $tbl_session_rel_user WHERE id_session=$existing_session AND id_user=$user_id AND relation_type = 1 ";
Database::query($sql,__FILE__,__LINE__);
}
foreach ($session_list as $session_id) {
// for each session
$enreg_user = Database::escape_string($enreg_user);
$insert_sql = "INSERT IGNORE INTO $tbl_session_rel_user(id_session,id_user,relation_type) VALUES('$session_id','$user_id','1')";
Database::query($insert_sql,__FILE__,__LINE__);
}
}
/** Subscribes courses to the given session and optionally (default) unsubscribes previous users
* @author Carlos Vargas <carlos.vargas@dokeos.com>,from existing code
* @param int Session ID

@ -325,6 +325,7 @@ CREATE TABLE course_rel_user (
tutor_id int unsigned NOT NULL default '0',
sort int default NULL,
user_course_cat int default '0',
relation_type int default 0,
PRIMARY KEY (course_code,user_id)
);
ALTER TABLE course_rel_user ADD INDEX (user_id);
@ -498,7 +499,7 @@ DROP TABLE IF EXISTS session_rel_user;
CREATE TABLE session_rel_user (
id_session mediumint unsigned NOT NULL default '0',
id_user mediumint unsigned NOT NULL default '0',
relation_type int default 0 ,
relation_type int default 0,
PRIMARY KEY (id_session,id_user)
);

@ -15,6 +15,7 @@
ALTER TABLE user_friend RENAME TO user_rel_user;
ALTER TABLE session_rel_user ADD COLUMN relation_type int NOT NULL default 0;
ALTER TABLE course_rel_user ADD COLUMN relation_type int NOT NULL default 0;
INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url, access_url_changeable) VALUES ('course_create_active_tools','notebook','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Notebook',1,0);
INSERT INTO course_module (name, link, image, `row`, `column`, position) VALUES ('notebook','notebook/index.php','notebook.gif',2,1,'basic');

@ -33,12 +33,12 @@ if (isset($_GET['u'])) {
} else {
//checking the relationship between me and my friend
$my_status= SocialManager::get_relation_between_contacts(api_get_user_id(), $user_id);
if (in_array($my_status, array(SOCIALPARENT, SOCIALFRIEND, SOCIALGOODFRIEND))) {
if (in_array($my_status, array(USER_RELATION_TYPE_PARENT, USER_RELATION_TYPE_FRIEND, USER_RELATION_TYPE_GOODFRIEND))) {
$show_full_profile = true;
}
//checking the relationship between my friend and me
$my_friend_status = SocialManager::get_relation_between_contacts($user_id, api_get_user_id());
if (in_array($my_friend_status, array(SOCIALPARENT, SOCIALFRIEND, SOCIALGOODFRIEND))) {
if (in_array($my_friend_status, array(USER_RELATION_TYPE_PARENT, USER_RELATION_TYPE_FRIEND, USER_RELATION_TYPE_GOODFRIEND))) {
$show_full_profile = true;
} else {
// im probably not a good friend
@ -374,8 +374,8 @@ echo '<div id="social-content-right">';
$list_path_friends= $list_path_normal_friends = $list_path_parents = array();
//SOCIALGOODFRIEND , SOCIALFRIEND, SOCIALPARENT
$friends = SocialManager::get_friends($user_id, SOCIALFRIEND);
//SOCIALGOODFRIEND , USER_RELATION_TYPE_FRIEND, USER_RELATION_TYPE_PARENT
$friends = SocialManager::get_friends($user_id, USER_RELATION_TYPE_FRIEND);
$friend_html = '';

@ -16,8 +16,8 @@ if (isset($_GET['view']) && in_array($_GET['view'], $views)) {
if ($_GET['view']=='friends') {
echo '<div style="margin-top:20px;">';
$list_path_friends= $list_path_normal_friends = $list_path_parents = array();
//SOCIALGOODFRIEND , SOCIALFRIEND, SOCIALPARENT
$friends = SocialManager::get_friends($user_id, SOCIALFRIEND);
//SOCIALGOODFRIEND , USER_RELATION_TYPE_FRIEND, SOCIALPARENT
$friends = SocialManager::get_friends($user_id, USER_RELATION_TYPE_FRIEND);
$number_friends = count($friends);
$friend_html = '';
$friend_html .= '<div><h3>'.get_lang('SocialFriend').'</h3></div>';

Loading…
Cancel
Save