Minor - Format code, remove unused code.

1.10.x
Julio Montoya 10 years ago
parent 499096c404
commit 1dbfe5d8e9
  1. 46
      main/chat/chat_functions.lib.php
  2. 3
      main/chat/chat_hidden.php
  3. 21
      main/cron/document/index_all_docs.php
  4. 1264
      main/inc/lib/SequenceManager.php
  5. 7
      main/inc/lib/SequenceResourceManager.php
  6. 3
      main/inc/lib/events.lib.php
  7. 6
      main/inc/lib/fileManage.lib.php
  8. 1
      main/inc/lib/skill.lib.php
  9. 11
      main/inc/lib/skill.visualizer.lib.php
  10. 3
      main/social/group_view.php
  11. 2
      main/social/groups.php
  12. 35
      main/social/my_skills_report.php
  13. 3
      main/social/myfiles.php
  14. 36
      main/social/profile.php
  15. 11
      main/social/skills_ranking.php
  16. 8
      main/social/skills_tree.php
  17. 53
      main/upload/upload.document.php
  18. 6
      main/upload/upload.php
  19. 4
      main/upload/upload.scorm.php
  20. 5
      main/upload/upload_ppt.php
  21. 6
      main/upload/upload_word.php
  22. 129
      main/user/add_users_to_session.php
  23. 2
      main/user/class.php
  24. 32
      main/user/classes.php
  25. 70
      main/user/resume_session.php
  26. 9
      main/user/session_list.php
  27. 20
      main/user/subscribe_class.php
  28. 22
      main/user/subscribe_user.php
  29. 3
      main/user/user_import.php

@ -50,11 +50,11 @@ function exit_of_chat($user_id)
foreach ($list_course as $course) {
$response = user_connected_in_chat($user_id);
//if ($response === true) {
$sql = 'DELETE FROM '.$tbl_chat_connected.'
WHERE c_id = '.$course['real_id'].' AND user_id = '.$user_id;
Database::query($sql);
//}
$sql = 'DELETE FROM '.$tbl_chat_connected.'
WHERE c_id = '.$course['real_id'].' AND user_id = '.$user_id;
Database::query($sql);
}
}
@ -73,27 +73,27 @@ function disconnect_user_of_chat()
$cdate_s = date('s', $now);
$cd_count_time_seconds = $cdate_h*3600 + $cdate_m*60 + $cdate_s;
if (is_array($list_info_user_in_chat) && count($list_info_user_in_chat) > 0) {
foreach ($list_info_user_in_chat as $list_info_user) {
$date_db_date = date('Y-m-d', api_strtotime($list_info_user['last_connection'], 'UTC'));
$date_db_h = date('H', api_strtotime($list_info_user['last_connection'], 'UTC'));
$date_db_m = date('i', api_strtotime($list_info_user['last_connection'], 'UTC'));
$date_db_s = date('s', api_strtotime($list_info_user['last_connection'], 'UTC'));
if (is_array($list_info_user_in_chat) && count($list_info_user_in_chat) > 0) {
foreach ($list_info_user_in_chat as $list_info_user) {
$date_db_date = date('Y-m-d', api_strtotime($list_info_user['last_connection'], 'UTC'));
$date_db_h = date('H', api_strtotime($list_info_user['last_connection'], 'UTC'));
$date_db_m = date('i', api_strtotime($list_info_user['last_connection'], 'UTC'));
$date_db_s = date('s', api_strtotime($list_info_user['last_connection'], 'UTC'));
$date_count_time_seconds = $date_db_h * 3600 + $date_db_m * 60 + $date_db_s;
if ($cd_date == $date_db_date) {
if (($cd_count_time_seconds - $date_count_time_seconds) > 5) {
if ($cd_date == $date_db_date) {
if (($cd_count_time_seconds - $date_count_time_seconds) > 5) {
$tbl_chat_connected = Database::get_course_table(TABLE_CHAT_CONNECTED);
$sql = 'DELETE FROM '.$tbl_chat_connected.'
WHERE
c_id = '.$course_id.' AND
user_id = '.$list_info_user['user_id'].' AND
to_group_id = '.$groupId.'
$sql = 'DELETE FROM '.$tbl_chat_connected.'
WHERE
c_id = '.$course_id.' AND
user_id = '.$list_info_user['user_id'].' AND
to_group_id = '.$groupId.'
';
Database::query($sql);
}
}
}
}
Database::query($sql);
}
}
}
}
}
/**

@ -87,7 +87,8 @@ if (Database::num_rows($result) == 0) {
Database::query($sql);
}
} else {
$query = "UPDATE $tbl_chat_connected SET last_connection='".$current_time."'
$query = "UPDATE $tbl_chat_connected SET
last_connection='".$current_time."'
WHERE c_id = $course_id AND user_id='".$userId."' AND session_id='$session_id' AND to_group_id='$group_id'";
Database::query($query);
}

@ -13,7 +13,26 @@ if (empty($_GET['doc'])) {
echo "Received param ".$_GET['doc']."<br />\n";
}
$allowed_mime_types = DocumentManager::file_get_mime_type(true);
$allowed_extensions = array('doc', 'docx', 'ppt', 'pptx', 'pps', 'ppsx', 'xls', 'xlsx', 'odt', 'odp', 'ods', 'pdf', 'txt', 'rtf', 'msg', 'csv', 'html', 'htm');
$allowed_extensions = array(
'doc',
'docx',
'ppt',
'pptx',
'pps',
'ppsx',
'xls',
'xlsx',
'odt',
'odp',
'ods',
'pdf',
'txt',
'rtf',
'msg',
'csv',
'html',
'htm',
);
$courses_list = CourseManager::get_courses_list();
// Simulating empty specific fields (this is necessary for indexing)

File diff suppressed because it is too large Load Diff

@ -16,6 +16,7 @@ class SequenceResourceManager
* @param array $sequences The sequences
* @param int $type The type of sequence resource
* @param int $userId Optional. The user ID
*
* @return array
*/
public static function checkRequirementsForUser(array $sequences, $type, $userId = 0)
@ -35,6 +36,7 @@ class SequenceResourceManager
* Check if the ser has completed the requirements for the session sequences
* @param array $sequences The sequences
* @param int $userId Optional. The user ID
*
* @return array
*/
private static function checkSessionRequirementsForUser(array $sequences, $userId = 0)
@ -99,16 +101,15 @@ class SequenceResourceManager
/**
* Check if at least one sequence are completed
* @param array $sequences The sequences
* @param int $type The type of sequence resource
*
* @return boolean
*/
public static function checkSequenceAreCompleted(array $sequences)
{
foreach ($sequences as $secuence) {
foreach ($sequences as $sequence) {
$status = true;
foreach ($secuence['requirements'] as $item) {
foreach ($sequence['requirements'] as $item) {
$status = $status && $item['status'];
}

@ -800,7 +800,8 @@ class Event
Database::query($sql);
foreach ($users as $user) {
$sql = 'INSERT INTO '.Database::get_main_table(TABLE_EVENT_TYPE_REL_USER).' (user_id,event_type_name) VALUES('.intval($user).',"'.$event_name.'")';
$sql = 'INSERT INTO '.Database::get_main_table(TABLE_EVENT_TYPE_REL_USER).' (user_id,event_type_name)
VALUES('.intval($user).',"'.$event_name.'")';
Database::query($sql);
}
$language_id = api_get_language_id($event_message_language);

@ -468,10 +468,12 @@ class FileManager
// Determine which query to execute
if ($result['number_existing'] > 0) {
// Entry exists, update
$query = "UPDATE $glued_table SET path='$full_file_name',visibility='$default_visibility', filetype='$filetype' WHERE path='$full_file_name'";
$query = "UPDATE $glued_table SET path='$full_file_name',visibility='$default_visibility', filetype='$filetype'
WHERE path='$full_file_name'";
} else {
// No entry exists, create new one
$query = "INSERT INTO $glued_table (path,visibility,filetype) VALUES('$full_file_name','$default_visibility','$filetype')";
$query = "INSERT INTO $glued_table (path,visibility,filetype)
VALUES ('$full_file_name','$default_visibility','$filetype')";
}
Database::query($query);
}

@ -1372,6 +1372,7 @@ class Skill extends Model
/**
* Get the users list who achieved a skill
* @param int $skillId The skill id
*
* @return array The users list
*/
public function listUsersWhoAchieved($skillId)

@ -40,13 +40,7 @@ class SkillVisualizer
}
$this->html .= '<div id="block_'.$block_id.'" class = "open_block window '.$extra_class.' '.$class.'" style = "top:' . $position['y'] . 'px; left:' . $position['x'] . 'px;">';
/*$gradebook_string = '';
if (!empty($skill['gradebooks'])) {
foreach ($skill['gradebooks'] as $gradebook) {
//uncomment this to show the gradebook tags
$gradebook_string .= Display::span($gradebook['name'], array('class'=>'label_tag gradebook','style'=>'width:50px')).'<br />';
}
} */
$content = $skill['name'];
$content .= '<div class="btn-group">';
$content .= Display::url(get_lang('Edit'), '#', array('id'=>'edit_block_'.$block_id, 'class'=>'edit_block btn'));
@ -69,7 +63,8 @@ class SkillVisualizer
/**
* Adds a node using jplumb
*/
private function add_item($skill, $position) {
private function add_item($skill, $position)
{
$block_id = $skill['id'];
$end_point = 'readEndpoint';
$class = 'default_window';

@ -279,13 +279,10 @@ $tpl = new Template(null);
SocialManager::setSocialUserBlock($tpl, $user_id, 'groups', $group_id);
//Block Social Menu
$social_menu_block = SocialManager::show_social_menu('groups', $group_id);
$tpl->setHelp('Groups');
$tpl->assign('create_link', $create_thread_link);
$tpl->assign('is_group_member', $is_group_member);
$tpl->assign('group_info', $group_info);
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('social/group_view.tpl');

@ -20,7 +20,7 @@ $this_section = SECTION_SOCIAL;
$allowed_views = array('mygroups','newest','pop');
$content = null;
if (isset($_GET['view']) && in_array($_GET['view'],$allowed_views)) {
if (isset($_GET['view']) && in_array($_GET['view'], $allowed_views)) {
if ($_GET['view'] == 'mygroups') {
$interbreadcrumb[]= array ('url' =>'groups.php','name' => get_lang('Groups'));
$interbreadcrumb[]= array ('url' =>'#','name' => get_lang('MyGroups'));

@ -13,7 +13,7 @@ $isDRH = api_is_drh();
if (!$isStudent && !$isStudentBosss && !$isDRH) {
header('Location: ' . api_get_path(WEB_CODE_PATH) . 'social/skills_wheel.php');
die;
exit;
}
$userId = api_get_user_id();
@ -31,11 +31,11 @@ $tpl->assign('allowSkillsTool', api_get_setting('allow_skills_tool') == 'true');
$tpl->assign('allowDrhSkillsManagement', api_get_setting('allow_hr_skills_management') == 'true');
if ($isStudent) {
$sql = "SELECT s.name, sru.acquired_skill_at, c.title, c.directory "
. "FROM $skillTable s "
. "INNER JOIN $skillRelUserTable sru ON s.id = sru.skill_id "
. "INNER JOIN $courseTable c ON sru.course_id = c.id "
. "WHERE sru.user_id = $userId";
$sql = "SELECT s.name, sru.acquired_skill_at, c.title, c.directory
FROM $skillTable s
INNER JOIN $skillRelUserTable sru ON s.id = sru.skill_id
INNER JOIN $courseTable c ON sru.course_id = c.id
WHERE sru.user_id = $userId";
$result = Database::query($sql);
@ -78,11 +78,12 @@ if ($isStudent) {
}
if ($selectedStudent > 0) {
$sql = "SELECT s.name, sru.acquired_skill_at, c.title, c.directory "
. "FROM $skillTable s "
. "INNER JOIN $skillRelUserTable sru ON s.id = sru.skill_id "
. "INNER JOIN $courseTable c ON sru.course_id = c.id "
. "WHERE sru.user_id = $selectedStudent";
$sql = "SELECT s.name, sru.acquired_skill_at, c.title, c.directory
FROM $skillTable s
INNER JOIN $skillRelUserTable sru ON s.id = sru.skill_id
INNER JOIN $courseTable c ON sru.course_id = c.id
WHERE sru.user_id = $selectedStudent
";
$result = Database::query($sql);
@ -106,16 +107,13 @@ if ($isStudent) {
$courseImageThumb->resize(32, 32, 0);
$courseImageThumb->send_image($thumbSysPath);
}
$tableRow['courseImage'] = $thumbWebPath;
}
$tableRows[] = $tableRow;
}
}
$tplPath = 'skill/student_boss_report.tpl';
$tpl->assign('followedStudents', $followedStudents);
$tpl->assign('selectedStudent', $selectedStudent);
} else if ($isDRH) {
@ -141,28 +139,22 @@ if ($isStudent) {
switch ($action) {
case 'filterByCourse':
$course = api_get_course_info_by_id($selectedCourse);
$reportTitle = sprintf(get_lang('AchievedSkillInCourseX'), $course['name']);
$tableRows = $objSkill->listAchievedByCourse($selectedCourse);
break;
case 'filterBySkill':
$skill = $objSkill->get($selectedSkill);
$reportTitle = sprintf(get_lang('StudentsWhoAchievedTheSkillX'), $skill['name']);
$students = UserManager::getUsersFollowedByUser(
$userId, STUDENT, false, false, false, null, null, null, null, null, null, DRH
);
$coursesFilter = array();
foreach ($courses as $course) {
$coursesFilter[] = $course['id'];
}
$tableRows = $objSkill->listUsersWhoAchieved($selectedSkill, $coursesFilter);
break;
}
@ -190,13 +182,10 @@ if ($isStudent) {
$tplPath = 'skill/drh_report.tpl';
$tpl->assign('action', $action);
$tpl->assign('courses', $courses);
$tpl->assign('skills', $skills);
$tpl->assign('selectedCourse', $selectedCourse);
$tpl->assign('selectedSkill', $selectedSkill);
$tpl->assign('reportTitle', $reportTitle);
}

@ -4,6 +4,7 @@
* @author Juan Carlos Trabado herodoto@telefonica.net
* @package chamilo.social
*/
$cidReset = true;
require_once '../inc/global.inc.php';
@ -75,7 +76,6 @@ $(document).on("ready", function () {
</script>';
$show_message = null;
// Social Menu Block
$social_menu_block = SocialManager::show_social_menu('myfiles');
$actions = null;
@ -106,7 +106,6 @@ $editor = $tpl->fetch('default/'.$editor->getEditorStandAloneTemplate());
$tpl->assign('social_right_content', $editor);
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('actions', $actions);
$tpl->assign('message', $show_message);
$social_layout = $tpl->get_template('social/myfiles.tpl');
$tpl->display($social_layout);

@ -59,7 +59,7 @@ if (!empty($_POST['social_wall_new_msg_main']) || !empty($_FILES['picture']['tmp
header('Location: ' . $url);
exit;
} else if (!empty($_POST['social_wall_new_msg']) && !empty($_POST['messageId'])) {
} else if (!empty($_POST['social_wall_new_msg']) && !empty($_POST['messageId'])) {
$messageId = intval($_POST['messageId']);
$res = SocialManager::sendWallMessage(
api_get_user_id(),
@ -201,18 +201,22 @@ if (isset($_GET['shared'])) {
$my_link = '../social/profile.php';
$link_shared = '';
}
$interbreadcrumb[]= array ('url' =>'home.php','name' => get_lang('SocialNetwork') );
$interbreadcrumb[] = array(
'url' => 'home.php',
'name' => get_lang('SocialNetwork'),
);
if (isset($_GET['u']) && is_numeric($_GET['u']) && $_GET['u'] != api_get_user_id()) {
$info_user = api_get_user_info($_GET['u']);
$interbreadcrumb[]= array (
$interbreadcrumb[]= array(
'url' => '#',
'name' => api_get_person_name($info_user['firstName'], $info_user['lastName']));
'name' => $info_user['complete_name']
);
$nametool = '';
}
if (isset($_GET['u'])) {
$param_user='u='.Security::remove_XSS($_GET['u']);
}else {
$param_user = 'u='.Security::remove_XSS($_GET['u']);
} else {
$info_user = api_get_user_info(api_get_user_id());
$param_user = '';
}
@ -230,7 +234,7 @@ if (is_array($personal_course_list)) {
foreach ($personal_course_list as $my_course) {
if ($i<=10) {
$list[] = SocialManager::get_logged_user_course_html($my_course, $i);
$course_list_code[] = array('code'=> $my_course['code']);
$course_list_code[] = array('code' => $my_course['code']);
} else {
break;
}
@ -241,11 +245,19 @@ if (is_array($personal_course_list)) {
}
//Social Block Menu
$social_menu_block = SocialManager::show_social_menu('shared_profile', null, $user_id, $show_full_profile);
$social_menu_block = SocialManager::show_social_menu(
'shared_profile',
null,
$user_id,
$show_full_profile
);
//Setting some session info
$user_info = api_get_user_info($my_user_id);
$sessionList = SessionManager::getSessionsFollowedByUser($my_user_id, $user_info['status']);
$sessionList = SessionManager::getSessionsFollowedByUser(
$my_user_id,
$user_info['status']
);
// My friends
$friend_html = SocialManager::listMyFriendsBlock(
@ -296,7 +308,7 @@ if ($show_full_profile) {
continue;
}
// get display text, visibility and type from user_field table
$field_variable = str_replace('extra_','',$key);
$field_variable = str_replace('extra_', '', $key);
$extraFieldInfo = $extraField->get_handler_field_info_by_field_variable(
$field_variable
@ -471,7 +483,7 @@ if ($show_full_profile) {
// Courses without sessions
$my_course = '';
$i = 1;
foreach ($list as $key => $value) {
if ( empty($value[2]) ) { //if out of any session
$my_courses .= $value[1];
@ -488,7 +500,7 @@ if ($show_full_profile) {
//$social_session_block = $htmlSessionList;
$social_session_block = $sessionList;
}
// Block Social User Feeds
$user_feeds = SocialManager::get_user_feeds($user_id);

@ -45,7 +45,16 @@ $extra_params['height'] = 'auto';
//$extra_params['rowList'] = array(10, 20 ,30);
$jqgrid = Display::grid_js('skill_ranking', $url,$columns,$column_model,$extra_params, array(), null, true);
$jqgrid = Display::grid_js(
'skill_ranking',
$url,
$columns,
$column_model,
$extra_params,
array(),
null,
true
);
$content = Display::grid_html('skill_ranking');
$tpl = new Template(get_lang('Ranking'));

@ -21,12 +21,12 @@ $htmlHeadXtra[] = api_get_jqgrid_js();
$htmlHeadXtra[] = api_get_js('jquery.jsPlumb.all.js');
$htmlHeadXtra[] = api_get_js('skills.js');
$skill = new Skill();
$type = 'read'; //edit
$skill = new Skill();
$type = 'read'; //edit
$tree = $skill->get_skills_tree(api_get_user_id(), null, true);
$tree = $skill->get_skills_tree(api_get_user_id(), null, true);
$skill_visualizer = new SkillVisualizer($tree, $type);
$url = api_get_path(WEB_AJAX_PATH).'skill.ajax.php?1=1';
$url = api_get_path(WEB_AJAX_PATH).'skill.ajax.php?1=1';
$tpl = new Template(null, false, false);
$tpl->assign('url', $url);

@ -8,19 +8,6 @@
* @package chamilo.upload
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
/**
* Process the document and return to the document tool
*/
/*
Libraries
*/
//many useful functions in main_api.lib.php, by default included
if (!function_exists('api_get_path')) {
header('location: upload.php');
die;
}
$courseDir = $_course['path'] . "/document";
$sys_course_path = api_get_path(SYS_COURSE_PATH);
@ -59,7 +46,6 @@ api_display_tool_title($nameTools . $add_group_to_title);
/**
* Process
*/
//user has submitted a file
if (isset($_FILES['user_upload'])) {
$upload_ok = process_uploaded_file($_FILES['user_upload']);
@ -87,10 +73,10 @@ if (isset($_FILES['user_upload'])) {
if ($new_title) $ct .= ", title='$new_title'";
Database::query("UPDATE $table_document SET" . substr($ct, 1) ." WHERE id = '$docid'");
}
//check for missing images in html files
$missing_files = check_for_missing_files($base_work_dir.$_POST['curdirpath'].$new_path);
if ($missing_files) {
//show a form to upload the missing files
//check for missing images in html files
$missing_files = check_for_missing_files($base_work_dir.$_POST['curdirpath'].$new_path);
if ($missing_files) {
//show a form to upload the missing files
Display::display_normal_message(
build_missing_files_form(
$missing_files,
@ -98,17 +84,17 @@ if (isset($_FILES['user_upload'])) {
$_FILES['user_upload']['name']
)
);
}
}
}
}
}
//missing images are submitted
if (isset($_POST['submit_image'])) {
$number_of_uploaded_images = count($_FILES['img_file']['name']);
//if images are uploaded
if ($number_of_uploaded_images > 0) {
//we could also create a function for this, I'm not sure...
//create a directory for the missing files
$img_directory = str_replace('.','_',$_POST['related_file']."_files");
$number_of_uploaded_images = count($_FILES['img_file']['name']);
//if images are uploaded
if ($number_of_uploaded_images > 0) {
//we could also create a function for this, I'm not sure...
//create a directory for the missing files
$img_directory = str_replace('.','_',$_POST['related_file']."_files");
$folderData = create_unexisting_directory(
$_course,
$_user['user_id'],
@ -119,7 +105,7 @@ if (isset($_POST['submit_image'])) {
$img_directory
);
$missing_files_dir = $folderData['path'];
//put the uploaded files in the new directory and get the paths
//put the uploaded files in the new directory and get the paths
$paths_to_replace_in_file = move_uploaded_file_collection_into_directory(
$_course,
$_FILES['img_file'],
@ -130,15 +116,15 @@ if (isset($_POST['submit_image'])) {
$to_user_id,
$max_filled_space
);
//open the html file and replace the paths
//open the html file and replace the paths
replace_img_path_in_html_file(
$_POST['img_file_path'],
$paths_to_replace_in_file,
$base_work_dir . $_POST['related_file']
);
//update parent folders
item_property_update_on_folder($_course,$_POST['curdirpath'],$_user['user_id']);
}
//update parent folders
item_property_update_on_folder($_course,$_POST['curdirpath'],$_user['user_id']);
}
}
//they want to create a directory
if (isset($_POST['create_dir']) && $_POST['dirname']!='') {
@ -174,7 +160,9 @@ if (isset($_GET['createdir'])) {
Display::display_normal_message($new_folder_text);
} else { //give them a link to create a directory
?>
<p><a href="<?php echo api_get_self(); ?>?path=<?php echo $path; ?>&amp;createdir=1"><img src="../img/new_folder.gif" border="0" align="absmiddle" alt ="" />
<p>
<a href="<?php echo api_get_self(); ?>?path=<?php echo $path; ?>&amp;createdir=1">
<img src="../img/new_folder.gif" border="0" align="absmiddle" alt ="" />
<?php echo(get_lang('CreateDir'));?>
</a>
</p>
@ -184,7 +172,6 @@ if (isset($_GET['createdir'])) {
<div id="folderselector">
</div>
<!-- start upload form -->
<form action="<?php echo api_get_self(); ?>" method="POST" name="upload" enctype="multipart/form-data">
<!-- <input type="hidden" name="MAX_FILE_SIZE" value="5400"> -->

@ -6,11 +6,7 @@
* @package chamilo.upload
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
/**
* First, initialise the script
*/
// global settings initialisation
// also provides access to main api (inc/lib/main_api.lib.php)
require_once '../inc/global.inc.php';
// return to index if no tool is set

@ -7,9 +7,7 @@
* @package chamilo.upload
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
/**
* Process the SCORM package and return to the SCORM tool
*/
$cwdir = getcwd();
require_once '../newscorm/lp_upload.php';

@ -6,9 +6,7 @@
* @package chamilo.upload
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
/**
* First, initialise the script
*/
require_once '../inc/global.inc.php';
$htmlHeadXtra[] = '<script language="javascript" src="../inc/lib/javascript/upload.js" type="text/javascript"></script>';
@ -91,7 +89,6 @@ if (api_get_setting('search_enabled') == 'true') {
$form->addButtonUpload(get_lang('ConvertToLP'), 'convert');
$form->addElement('hidden', 'ppt2lp', 'true');
$form->add_real_progress_bar(md5(rand(0, 10000)), 'user_file', 1, true);
$defaults = array('take_slide_name'=>'checked="checked"','index_document'=>'checked="checked"');
$form->setDefaults($defaults);

@ -7,11 +7,7 @@
* @package chamilo.upload
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
/**
* First, initialise the script
*/
// global settings initialisation
// also provides access to main api (inc/lib/main_api.lib.php)
include '../inc/global.inc.php';
$form_style= '<style>

@ -3,15 +3,15 @@
/**
* @package chamilo.admin
*/
// resetting the course id
$cidReset = true;
// including some necessary files
require_once '../inc/global.inc.php';
require_once '../inc/lib/xajax/xajax.inc.php';
$xajax = new xajax();
$xajax -> registerFunction ('search_users');
$xajax = new xajax();
$xajax->registerFunction('search_users');
// setting the section (for the tabs)
$this_section = SECTION_PLATFORM_ADMIN;
@ -29,31 +29,33 @@ if (api_is_platform_admin()) {
$allowTutors = api_get_setting('allow_tutors_to_assign_students_to_session');
if($allowTutors == 'true') {
// Database Table Definitions
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
// setting the name of the tool
$tool_name = get_lang('SubscribeUsersToSession');
$add_type = 'unique';
if (isset($_REQUEST['add_type']) && $_REQUEST['add_type']!='') {
$add_type = Security::remove_XSS($_REQUEST['add_type']);
$add_type = Security::remove_XSS($_REQUEST['add_type']);
}
$page = isset($_GET['page']) ? Security::remove_XSS($_GET['page']) : null;
//checking for extra field with filter on
// Checking for extra field with filter on
$extra_field_list= UserManager::get_extra_fields();
$new_field_list = array();
if (is_array($extra_field_list)) {
foreach ($extra_field_list as $extra_field) {
//if is enabled to filter and is a "<select>" field type
if ($extra_field[8]==1 && $extra_field[2]==4 ) {
$new_field_list[] = array('name'=> $extra_field[3], 'variable'=>$extra_field[1], 'data'=> $extra_field[9]);
$new_field_list[] = array(
'name' => $extra_field[3],
'variable' => $extra_field[1],
'data' => $extra_field[9],
);
}
}
}
@ -103,14 +105,16 @@ if($allowTutors == 'true') {
switch ($type) {
case 'single':
// search users where username or firstname or lastname begins likes $needle
$sql = 'SELECT user.user_id, username, lastname, firstname FROM '.$tbl_user.' user
$sql = 'SELECT user.user_id, username, lastname, firstname
FROM '.$tbl_user.' user
WHERE (username LIKE "'.$needle.'%" OR firstname LIKE "'.$needle.'%"
OR lastname LIKE "'.$needle.'%") AND user.status<>6 AND user.status<>'.DRH.''.
$order_clause.
' LIMIT 11';
break;
case 'multiple':
$sql = 'SELECT user.user_id, username, lastname, firstname FROM '.$tbl_user.' user
$sql = 'SELECT user.user_id, username, lastname, firstname
FROM '.$tbl_user.' user
WHERE '.(api_sort_by_first_name() ? 'firstname' : 'lastname').'
LIKE "'.$needle.'%" AND
user.status<>'.DRH.' AND
@ -134,26 +138,34 @@ if($allowTutors == 'true') {
if ($access_url_id != -1) {
switch ($type) {
case 'single':
$sql = 'SELECT user.user_id, username, lastname, firstname FROM '.$tbl_user.' user
INNER JOIN '.$tbl_user_rel_access_url.' url_user ON (url_user.user_id=user.user_id)
WHERE access_url_id = '.$access_url_id.' AND (username LIKE "'.$needle.'%"
OR firstname LIKE "'.$needle.'%"
OR lastname LIKE "'.$needle.'%") AND user.status<>6 AND user.status<>'.DRH.' '.
$order_clause.
' LIMIT 11';
$sql = 'SELECT user.user_id, username, lastname, firstname
FROM '.$tbl_user.' user
INNER JOIN '.$tbl_user_rel_access_url.' url_user
ON (url_user.user_id=user.user_id)
WHERE
access_url_id = '.$access_url_id.' AND
(username LIKE "'.$needle.'%" OR firstname LIKE "'.$needle.'%" OR lastname LIKE "'.$needle.'%") AND
user.status<>6 AND
user.status<>'.DRH.' '.
$order_clause.
' LIMIT 11';
break;
case 'multiple':
$sql = 'SELECT user.user_id, username, lastname, firstname FROM '.$tbl_user.' user
INNER JOIN '.$tbl_user_rel_access_url.' url_user ON (url_user.user_id=user.user_id)
WHERE access_url_id = '.$access_url_id.' AND
$sql = 'SELECT user.user_id, username, lastname, firstname
FROM '.$tbl_user.' user
INNER JOIN '.$tbl_user_rel_access_url.' url_user
ON (url_user.user_id=user.user_id)
WHERE access_url_id = '.$access_url_id.' AND
'.(api_sort_by_first_name() ? 'firstname' : 'lastname').' LIKE "'.$needle.'%" AND user.status<>'.DRH.' AND user.status<>6 '.$cond_user_id.
$order_clause;
$order_clause;
break;
case 'any_session' :
$sql = 'SELECT DISTINCT user.user_id, username, lastname, firstname
FROM '.$tbl_user.' user LEFT OUTER JOIN '.$tbl_session_rel_user.' s
FROM '.$tbl_user.' user
LEFT OUTER JOIN '.$tbl_session_rel_user.' s
ON (s.user_id = user.user_id)
INNER JOIN '.$tbl_user_rel_access_url.' url_user ON (url_user.user_id=user.user_id)
INNER JOIN '.$tbl_user_rel_access_url.' url_user
ON (url_user.user_id=user.user_id)
WHERE
access_url_id = '.$access_url_id.' AND
s.user_id IS null AND
@ -243,7 +255,6 @@ if($allowTutors == 'true') {
</script>';
$form_sent = 0;
$errorMsg = $firstLetterUser = $firstLetterSession='';
$UserList = $SessionList = array();
@ -251,10 +262,10 @@ if($allowTutors == 'true') {
$noPHP_SELF = true;
if (isset($_POST['form_sent']) && $_POST['form_sent']) {
$form_sent = $_POST['form_sent'];
$firstLetterUser = $_POST['firstLetterUser'];
$firstLetterSession = $_POST['firstLetterSession'];
$UserList = $_POST['sessionUsersList'];
$form_sent = $_POST['form_sent'];
$firstLetterUser = $_POST['firstLetterUser'];
$firstLetterSession = $_POST['firstLetterSession'];
$UserList = $_POST['sessionUsersList'];
if (!is_array($UserList)) {
$UserList=array();
@ -280,7 +291,7 @@ if($allowTutors == 'true') {
$sql = "SELECT u.user_id, lastname, firstname, username, session_id
FROM $tbl_user u
INNER JOIN $tbl_session_rel_user
ON $tbl_session_rel_user.user_id = u.user_id AND $tbl_session_rel_user.relation_type<>".SESSION_RELATION_TYPE_RRHH."
ON $tbl_session_rel_user.user_id = u.user_id AND $tbl_session_rel_user.relation_type<>".SESSION_RELATION_TYPE_RRHH."
AND $tbl_session_rel_user.session_id = ".intval($id_session)."
WHERE u.status<>".DRH." AND u.status<>6 $order_clause";
@ -288,13 +299,13 @@ if($allowTutors == 'true') {
$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
$sql="SELECT u.user_id, lastname, firstname, username, session_id
FROM $tbl_user u
INNER JOIN $tbl_session_rel_user
ON $tbl_session_rel_user.user_id = u.user_id AND $tbl_session_rel_user.relation_type<>".SESSION_RELATION_TYPE_RRHH."
AND $tbl_session_rel_user.session_id = ".intval($id_session)."
INNER JOIN $tbl_user_rel_access_url url_user ON (url_user.user_id=u.user_id)
WHERE access_url_id = $access_url_id AND u.status<>".DRH." AND u.status<>6
$sql = "SELECT u.user_id, lastname, firstname, username, session_id
FROM $tbl_user u
INNER JOIN $tbl_session_rel_user
ON $tbl_session_rel_user.user_id = u.user_id AND $tbl_session_rel_user.relation_type<>".SESSION_RELATION_TYPE_RRHH."
AND $tbl_session_rel_user.session_id = ".intval($id_session)."
INNER JOIN $tbl_user_rel_access_url url_user ON (url_user.user_id=u.user_id)
WHERE access_url_id = $access_url_id AND u.status<>".DRH." AND u.status<>6
$order_clause";
}
}
@ -315,7 +326,10 @@ if($allowTutors == 'true') {
if (UserManager::is_extra_field_available($new_field['variable'])) {
if (isset($_POST[$varname]) && $_POST[$varname]!='0') {
$use_extra_fields = true;
$extra_field_result[]= UserManager::get_extra_user_data_by_value($new_field['variable'], $_POST[$varname]);
$extra_field_result[] = UserManager::get_extra_user_data_by_value(
$new_field['variable'],
$_POST[$varname]
);
}
}
}
@ -327,7 +341,10 @@ if($allowTutors == 'true') {
if (count($extra_field_result)>1) {
for($i=0;$i<count($extra_field_result)-1;$i++) {
if (is_array($extra_field_result[$i+1])) {
$final_result = array_intersect($extra_field_result[$i],$extra_field_result[$i+1]);
$final_result = array_intersect(
$extra_field_result[$i],
$extra_field_result[$i + 1]
);
}
}
} else {
@ -354,7 +371,7 @@ if($allowTutors == 'true') {
if ($use_extra_fields) {
$sql = "SELECT u.user_id, lastname, firstname, username, session_id
FROM $tbl_user u
FROM $tbl_user u
LEFT JOIN $tbl_session_rel_user
ON $tbl_session_rel_user.user_id = u.user_id AND
$tbl_session_rel_user.session_id = '$id_session' AND
@ -389,8 +406,8 @@ if($allowTutors == 'true') {
}
}
$result = Database::query($sql);
$users = Database::store_result($result,'ASSOC');
$result = Database::query($sql);
$users = Database::store_result($result,'ASSOC');
foreach ($users as $uid => $user) {
if ($user['session_id'] != $id_session) {
@ -555,9 +572,8 @@ if($allowTutors == 'true') {
<button class="btn btn-default" type="button" onclick="moveItem(document.getElementById('destination_users'), document.getElementById('origin_users'))" onclick="moveItem(document.getElementById('destination_users'), document.getElementById('origin_users'))">
<i class="fa fa-arrow-left"></i>
</button>
<?php
}
}
?>
</div>
<br />
@ -568,11 +584,9 @@ if($allowTutors == 'true') {
} else {
//@todo see that the call to "valide()" doesn't duplicate the onsubmit of the form (necessary to avoid delete on "enter" key pressed)
echo '<button class="save" type="button" value="" onclick="valide()" >'.get_lang('SubscribeUsersToSession').'</button>';
}
?>
</div>
<div class="span5">
<div class="multiple_select_header">
<b><?php echo get_lang('UserListInSession') ?> :</b>
@ -592,9 +606,7 @@ if($allowTutors == 'true') {
</form>
<script>
<!--
function moveItem(origin , destination)
{
function moveItem(origin , destination) {
for (var i = 0 ; i<origin.options.length ; i++) {
if (origin.options[i].selected) {
destination.options[destination.length] = new Option(origin.options[i].text,origin.options[i].value);
@ -604,12 +616,10 @@ if($allowTutors == 'true') {
}
destination.selectedIndex = -1;
sortOptions(destination.options);
}
function sortOptions(options)
{
newOptions = new Array();
for (i = 0 ; i<options.length ; i++)
newOptions[i] = options[i];
@ -618,7 +628,6 @@ if($allowTutors == 'true') {
options.length = 0;
for (i = 0 ; i < newOptions.length ; i++)
options[i] = newOptions[i];
}
function mysort(a, b)
@ -643,9 +652,7 @@ if($allowTutors == 'true') {
function loadUsersInSelect(select)
{
var xhr_object = null;
if(window.XMLHttpRequest) // Firefox
xhr_object = new XMLHttpRequest();
else if(window.ActiveXObject) // Internet Explorer
@ -655,16 +662,12 @@ if($allowTutors == 'true') {
//xhr_object.open("GET", "loadUsersInSelect.ajax.php?id_session=<?php echo $id_session ?>&letter="+select.options[select.selectedIndex].text, false);
xhr_object.open("POST", "loadUsersInSelect.ajax.php");
xhr_object.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
nosessionUsers = makepost(document.getElementById('origin_users'));
sessionUsers = makepost(document.getElementById('destination_users'));
nosessionClasses = makepost(document.getElementById('origin_classes'));
sessionClasses = makepost(document.getElementById('destination_classes'));
xhr_object.send("nosessionusers="+nosessionUsers+"&sessionusers="+sessionUsers+"&nosessionclasses="+nosessionClasses+"&sessionclasses="+sessionClasses);
xhr_object.onreadystatechange = function() {
if (xhr_object.readyState == 4) {
document.getElementById('content_source').innerHTML = result = xhr_object.responseText;
@ -675,14 +678,11 @@ if($allowTutors == 'true') {
function makepost(select)
{
var options = select.options;
var ret = "";
for (i = 0 ; i<options.length ; i++)
ret = ret + options[i].value +'::'+options[i].text+";;";
return ret;
}
-->
</script>
@ -690,5 +690,4 @@ if($allowTutors == 'true') {
} else {
api_not_allowed();
}
/* FOOTER */
Display::display_footer();

@ -37,9 +37,7 @@ $(document).ready( function() {
';
Display :: display_header($tool_name, "User");
$usergroup = new UserGroup();
if (api_is_allowed_to_edit()) {
echo '<div class="actions">';
if ($type == 'registered') {

@ -4,13 +4,9 @@
* @package chamilo.classes
* @author Julio Montoya <gugli100@gmail.com>
*/
/**
* Init
*/
$cidReset=true;
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'usergroup.lib.php';
$cidReset = true;
require_once '../inc/global.inc.php';
api_block_anonymous_users();
@ -21,25 +17,29 @@ if (isset($_GET['id'])) {
$interbreadcrumb[]= array ('url' =>'#','name' => get_lang('Groups'));
}
if (api_get_setting('show_groups_to_users') == 'false') {
}
Display :: display_header($tool_name, 'Classes');
$usergroup = new UserGroup();
$usergroup_list = $usergroup->get_usergroup_by_user(api_get_user_id());
if (!empty($usergroup_list)) {
echo Display::tag('h1',get_lang('MyClasses'));
foreach($usergroup_list as $group_id) {
if (isset($_GET['id']) && $_GET['id'] != $group_id) continue;
$data = $usergroup->get($group_id);
echo Display::tag('h2',$data['name']);
echo Display::tag('h1', get_lang('MyClasses'));
foreach ($usergroup_list as $group_id) {
if (isset($_GET['id']) && $_GET['id'] != $group_id) {
continue;
}
$data = $usergroup->get($group_id);
echo Display::tag('h2', $data['name']);
echo Display::div($data['description']);
}
} else {
if (api_is_platform_admin()) {
Display::display_normal_message(Display::url(get_lang('AddClasses') ,api_get_path(WEB_CODE_PATH).'admin/usergroups.php?action=add'), false);
Display::display_normal_message(
Display::url(
get_lang('AddClasses'),
api_get_path(WEB_CODE_PATH).'admin/usergroups.php?action=add'
),
false
);
}
}

@ -4,33 +4,29 @@
* @author Bart Mollet, Julio Montoya lot of fixes
* @package chamilo.admin
*/
/* INIT SECTION */
$cidReset = true;
require_once '../inc/global.inc.php';
// setting the section (for the tabs)
$this_section = SECTION_PLATFORM_ADMIN;
$id_session = (int)$_GET['id_session'];
SessionManager::protect_teacher_session_edit($id_session);
$tool_name = get_lang('SessionOverview');
$allowTutors = api_get_setting('allow_tutors_to_assign_students_to_session');
if($allowTutors == 'true') {
// Database Table Definitions
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_session_rel_class = Database::get_main_table(TABLE_MAIN_SESSION_CLASS);
$tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
$tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
$table_access_url_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_session_rel_class = Database::get_main_table(TABLE_MAIN_SESSION_CLASS);
$tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
$tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
$table_access_url_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$sql = 'SELECT
name,
@ -47,10 +43,12 @@ if($allowTutors == 'true') {
coach_access_end_date,
session_category_id,
visibility
FROM '.$tbl_session.' LEFT JOIN '.$tbl_user.' ON id_coach = user_id
FROM '.$tbl_session.'
LEFT JOIN '.$tbl_user.'
ON id_coach = user_id
WHERE '.$tbl_session.'.id='.$id_session;
$rs = Database::query($sql);
$rs = Database::query($sql);
$session = Database::store_result($rs);
$session = $session[0];
@ -109,7 +107,6 @@ if($allowTutors == 'true') {
if (!empty($_GET['user'])) {
$result = Database::query("DELETE FROM $tbl_session_rel_user WHERE relation_type<>".SESSION_RELATION_TYPE_RRHH." AND session_id ='$id_session' AND user_id=".intval($_GET['user']));
$nbr_affected_rows = Database::affected_rows($result);
Database::query("UPDATE $tbl_session SET nbr_users=nbr_users-$nbr_affected_rows WHERE id='$id_session'");
$result = Database::query("DELETE FROM $tbl_session_rel_course_rel_user WHERE session_id ='$id_session' AND user_id=".intval($_GET['user']));
@ -130,8 +127,6 @@ if($allowTutors == 'true') {
}
echo Display::page_header(Display::return_icon('session.png', get_lang('Session')).' '.$session['name']);
echo Display::page_subheader(get_lang('GeneralProperties').$url);
?>
@ -196,11 +191,9 @@ if($allowTutors == 'true') {
<?php if ($session['visibility']==1) echo get_lang('ReadOnly'); elseif($session['visibility']==2) echo get_lang('Visible');elseif($session['visibility']==3) echo api_ucfirst(get_lang('Invisible')) ?>
</td>
</tr>
<?php
$multiple_url_is_on = api_get_multiple_access_url();
if ($multiple_url_is_on) {
echo '<tr><td>';
echo 'URL';
@ -215,13 +208,9 @@ if($allowTutors == 'true') {
?>
</table>
<br />
<?php
echo Display::page_subheader(get_lang('CourseList').$url);
?>
<!--List of courses -->
<table class="data_table">
<tr>
@ -230,7 +219,7 @@ if($allowTutors == 'true') {
<th width="20%"><?php echo get_lang('UsersNumber'); ?></th>
</tr>
<?php
if ($session['nbr_courses'] == 0){
if ($session['nbr_courses'] == 0) {
echo '<tr>
<td colspan="4">'.get_lang('NoCoursesForThisSession').'</td>
</tr>';
@ -246,9 +235,13 @@ if($allowTutors == 'true') {
foreach ($courses as $course) {
//select the number of users
$sql = " SELECT count(*) FROM $tbl_session_rel_user sru, $tbl_session_rel_course_rel_user srcru
WHERE srcru.user_id = sru.user_id AND srcru.session_id = sru.session_id AND srcru.c_id = '".Database::escape_string($course['id'])."'
AND sru.relation_type<>".SESSION_RELATION_TYPE_RRHH." AND srcru.session_id = '".intval($id_session)."'";
$sql = "SELECT count(*) FROM $tbl_session_rel_user sru, $tbl_session_rel_course_rel_user srcru
WHERE
srcru.user_id = sru.user_id AND
srcru.session_id = sru.session_id AND
srcru.c_id = '".Database::escape_string($course['id'])."'AND
sru.relation_type<>".SESSION_RELATION_TYPE_RRHH." AND
srcru.session_id = '".intval($id_session)."'";
$rs = Database::query($sql);
$course['nbr_users'] = Database::result($rs,0,0);
@ -260,13 +253,17 @@ if($allowTutors == 'true') {
WHERE
session_rcru.user_id = user.user_id AND
session_rcru.session_id = '".intval($id_session)."' AND
session_rcru.c_id ='".Database::escape_string($course['id'])."' AND session_rcru.status=2";
session_rcru.c_id ='".Database::escape_string($course['id'])."' AND
session_rcru.status=2";
$rs = Database::query($sql);
$coachs = array();
if (Database::num_rows($rs) > 0) {
while($info_coach = Database::fetch_array($rs)) {
$coachs[] = api_get_person_name($info_coach['firstname'], $info_coach['lastname']).' ('.$info_coach['username'].')';
while ($info_coach = Database::fetch_array($rs)) {
$coachs[] = api_get_person_name(
$info_coach['firstname'],
$info_coach['lastname']
).' ('.$info_coach['username'].')';
}
} else {
$coach = get_lang('None');
@ -292,15 +289,11 @@ if($allowTutors == 'true') {
?>
</table>
<br />
<?php
echo Display::page_subheader(get_lang('UserList').$url);
?>
<!--List of users -->
<table class="data_table">
<tr>
<th>
@ -338,10 +331,11 @@ if($allowTutors == 'true') {
$result = Database::query($sql);
$users = Database::store_result($result);
$orig_param = '&origin=resume_session&id_session='.$id_session; // change breadcrumb in destination page
foreach ($users as $user){
foreach ($users as $user) {
$user_link = '';
if (!empty($user['user_id'])) {
$user_link = '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_information.php?user_id='.intval($user['user_id']).'">'.api_htmlentities(api_get_person_name($user['firstname'], $user['lastname']),ENT_QUOTES,$charset).' ('.$user['username'].')</a>';
$user_link = '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_information.php?user_id='.intval($user['user_id']).'">'.
api_htmlentities(api_get_person_name($user['firstname'], $user['lastname']),ENT_QUOTES,$charset).' ('.$user['username'].')</a>';
}
$link_to_add_user_in_url = '';

@ -4,9 +4,7 @@
* List sessions in an efficient and usable way
* @package chamilo.admin
*/
/**
* Code
*/
$cidReset = true;
require_once '../inc/global.inc.php';
@ -81,7 +79,6 @@ if($allowTutors == 'true') {
}';
?>
<script>
function setSearchSelect(columnName) {
$("#sessions").jqGrid('setColProp', columnName,
{
@ -96,14 +93,12 @@ if($allowTutors == 'true') {
});
}
$(function() {
<?php
echo Display::grid_js('sessions', $url,$columns,$column_model,$extra_params, array(), $action_links,true);
?>
setSearchSelect("status");
$("#sessions").jqGrid('navGrid','#sessions_pager', {edit:false,add:false,del:false},
{height:280,reloadAfterSubmit:false}, // edit options
{height:280,reloadAfterSubmit:false}, // add options
@ -128,8 +123,6 @@ if($allowTutors == 'true') {
}
},buttonicon:'ui-icon-document'})
*/
//Adding search options
var options = {
'stringResult': true,

@ -4,27 +4,20 @@
/**
* @package chamilo.user
*/
/**
* Code
*/
include ('../inc/global.inc.php');
$this_section = SECTION_COURSES;
if (!api_is_allowed_to_edit()) {
api_not_allowed();
exit;
}
/*
MAIN CODE
*/
$tool_name = get_lang("AddClassesToACourse");
//extra entries in breadcrumb
$interbreadcrumb[] = array("url" => "user.php", "name" => get_lang("ToolUser"));
$interbreadcrumb[] = array("url" => "class.php", "name" => get_lang("Classes"));
Display :: display_header($tool_name, "User");
echo Display::page_header($tool_name);
if (isset($_GET['register'])) {
@ -87,12 +80,11 @@ function get_class_data($from, $number_of_items, $column, $direction) {
$subscribed_classes[] = $obj->class_id;
}
$sql = "SELECT
c.id AS col0,
c.name AS col1,
COUNT(cu.user_id) AS col2,
c.id AS col3
FROM $class_table c
";
c.id AS col0,
c.name AS col1,
COUNT(cu.user_id) AS col2,
c.id AS col3
FROM $class_table c ";
$sql .= " LEFT JOIN $class_user_table cu ON cu.class_id = c.id";
$sql .= " WHERE 1 = 1";
if (isset($_GET['keyword'])) {

@ -104,7 +104,7 @@ if (isset($_POST['action'])) {
case 'subscribe':
if (is_array($_POST['user'])) {
foreach ($_POST['user'] as $index => $user_id) {
$user_id=intval($user_id);
$user_id = intval($user_id);
if ($type == COURSEMANAGER) {
if (!empty($current_session_id)) {
$is_suscribe[] = SessionManager::set_coach_to_course_session(
@ -139,16 +139,16 @@ if (isset($_POST['action'])) {
$list_register_user='';
for ($i=0; $i<$is_suscribe_counter;$i++) {
for ($j=0; $j<count($user_id_temp);$j++) {
if ($is_suscribe_user_id[$i]==$user_id_temp[$j]) {
if ($is_suscribe[$i]) {
$list_register_user.=" - ".$user_name_temp[$j].'<br/>';
$temp_unique_user=$user_name_temp[$j];
$counter++;
} else {
$list_not_register_user.=" - ".$user_name_temp[$j].'<br/>';
}
for ($i = 0; $i < $is_suscribe_counter; $i++) {
for ($j = 0; $j < count($user_id_temp); $j++) {
if ($is_suscribe_user_id[$i] == $user_id_temp[$j]) {
if ($is_suscribe[$i]) {
$list_register_user .= " - ".$user_name_temp[$j].'<br/>';
$temp_unique_user = $user_name_temp[$j];
$counter++;
} else {
$list_not_register_user .= " - ".$user_name_temp[$j].'<br/>';
}
}
}
}

@ -1,8 +1,7 @@
<?php
/* For licensing terms, see /license.txt */
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'import.lib.php';
require_once '../inc/global.inc.php';
$this_section = SECTION_COURSES;
// notice for unauthorized people.

Loading…
Cancel
Save