Session category are now filtered by access_url_id (Multiple URLs) see BT#1220

skala
Julio Montoya 14 years ago
parent 67ef62a48f
commit 0855bd9ceb
  1. 15
      main/admin/add_many_session_to_category.php
  2. 14
      main/admin/session_add.php
  3. 31
      main/admin/session_category_add.php
  4. 20
      main/admin/session_category_edit.php
  5. 14
      main/admin/session_category_list.php
  6. 17
      main/admin/session_edit.php
  7. 25
      main/inc/lib/sessionmanager.lib.php
  8. 3
      main/install/db_main.sql
  9. 9
      main/install/migrate-db-1.8.7-1.8.8-pre.sql

@ -91,9 +91,6 @@ $formSent=0;
$errorMsg = $firstLetterCourse = $firstLetterSession='';
$CourseList=$SessionList=array();
$courses=$sessions=array();
$noPHP_SELF=true;
$Categoryid = intval($_POST['CategorySessionId']);
if ($_POST['formSent']) {
@ -131,7 +128,6 @@ Display::display_header($tool_name);
echo '<div class="row"><div class="form_header">'.$tool_name.' </div></div><br />';
// *******************
$where ='';
$rows_category_session = array();
if((isset($_POST['CategorySessionId']) && $_POST['formSent'] == 0) || isset($_GET['id_category']) ) {
@ -142,9 +138,7 @@ if((isset($_POST['CategorySessionId']) && $_POST['formSent'] == 0) || isset($_GE
$rows_category_session = Database::store_result($result);
}
$sql = "SELECT id, name FROM $tbl_session_category ORDER BY name";
$result=Database::query($sql);
$rows_session_category = Database::store_result($result);
$rows_session_category = SessionManager::get_all_session_category();
$sql = "SELECT id, name FROM $tbl_session $where ORDER BY name";
$result=Database::query($sql);
@ -298,8 +292,5 @@ function valide(){
</script>
<?php
/*
FOOTER
*/
Display::display_footer();
?>
/* FOOTER */
Display::display_footer();

@ -204,7 +204,6 @@ if (intval($count_users)<50) {
WHERE access_url_id = '.$access_url_id.' AND status=1'.$order_clause;
}
}
$result=Database::query($sql);
$Coaches=Database::store_result($result);
?>
@ -214,7 +213,6 @@ if (intval($count_users)<50) {
<option value="<?php echo $enreg['username']; ?>" <?php if($sent && $enreg['user_id'] == $id_coach) echo 'selected="selected"'; ?>><?php echo api_get_person_name($enreg['firstname'], $enreg['lastname']).' ('.$enreg['username'].')'; ?></option>
<?php endforeach; ?>
</select>
<?php
echo Display::return_icon('synthese_view.gif',get_lang('ActivityCoach'));
} else {
@ -222,18 +220,10 @@ if (intval($count_users)<50) {
<input type="text" name="coach_username" id="coach_username" onkeyup="xajax_search_coachs(document.getElementById('coach_username').value)" /><div id="ajax_list_coachs"></div>
<?php
}
?>
$Categories = SessionManager::get_all_session_category();
?>
</td>
</tr>
<?php
$id_session_category = '';
$tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
$sql = 'SELECT id, name FROM '.$tbl_session_category.' ORDER BY name ASC';
$result = Database::query($sql);
$Categories = Database::store_result($result);
?>
<tr>
<td width="40%"><?php echo get_lang('SessionCategory') ?></td>
<td width="60%">

@ -1,29 +1,8 @@
<?php
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2009 Dokeos SPRL
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium, info@dokeos.com
==============================================================================
*/
/* For licensing terms, see /license.txt */
/**
==============================================================================
* @package dokeos.admin
* @package chamilo.admin
* @todo use formvalidator for the form
==============================================================================
*/
// name of the language file that needs to be included
@ -32,11 +11,11 @@ $language_file='admin';
$cidReset=true;
// including the global Dokeos file
require_once('../inc/global.inc.php');
require_once '../inc/global.inc.php';
// including additional libraries
require_once(api_get_path(LIBRARY_PATH).'sessionmanager.lib.php');
require_once('../inc/lib/xajax/xajax.inc.php');
require_once api_get_path(LIBRARY_PATH).'sessionmanager.lib.php';
require_once '../inc/lib/xajax/xajax.inc.php';
$xajax = new xajax();
$xajax -> registerFunction ('search_coachs');

@ -1,23 +1,5 @@
<?php
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2009 Dokeos SPRL
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium, info@dokeos.com
==============================================================================
*/
/* For licensing terms, see /license.txt */
// name of the language file that needs to be included
$language_file ='admin';

@ -66,10 +66,14 @@ if (isset ($_GET['search']) && $_GET['search'] == 'advanced') {
$from = $page * $limit;
//if user is crfp admin only list its sessions
if(!api_is_platform_admin()) {
$where .= (empty($_REQUEST['keyword']) ? " " : " WHERE name LIKE '%".Database::escape_string(trim($_REQUEST['keyword']))."%'");
$where .= (empty($_REQUEST['keyword']) ? "" : " WHERE name LIKE '%".Database::escape_string(trim($_REQUEST['keyword']))."%'");
} else {
$where .= (empty($_REQUEST['keyword']) ? "" : " WHERE name LIKE '%".Database::escape_string(trim($_REQUEST['keyword']))."%'");
}
else {
$where .= (empty($_REQUEST['keyword']) ? " " : " WHERE name LIKE '%".Database::escape_string(trim($_REQUEST['keyword']))."%'");
if (empty($where)) {
$where = " WHERE access_url_id = ".api_get_current_access_url_id()." ";
} else {
$where .= " AND access_url_id = ".api_get_current_access_url_id()." ";
}
$query = "SELECT sc.*, (select count(id) FROM $tbl_session WHERE session_category_id = sc.id) as nbr_session
@ -78,8 +82,7 @@ if (isset ($_GET['search']) && $_GET['search'] == 'advanced') {
ORDER BY $sort $order
LIMIT $from,".($limit+1);
$query_rows = "SELECT count(*) as total_rows
FROM $tbl_session_category sc $where ";
$query_rows = "SELECT count(*) as total_rows FROM $tbl_session_category sc $where ";
$order = ($order == 'ASC')? 'DESC': 'ASC';
$result_rows = Database::query($query_rows);
@ -87,6 +90,7 @@ if (isset ($_GET['search']) && $_GET['search'] == 'advanced') {
$num = $recorset['total_rows'];
$result = Database::query($query);
$Sessions = Database::store_result($result);
$nbr_results = sizeof($Sessions);
$tool_name = get_lang('ListSessionCategory');
Display::display_header($tool_name);

@ -107,8 +107,7 @@ if (!empty($return)) {
<div class="row"><div class="form_header"><?php echo $tool_name; ?></div></div>
<table border="0" cellpadding="5" cellspacing="0" width="650">
<table border="0" cellpadding="5" cellspacing="0" width="650">
<tr>
<td width="30%"><?php echo get_lang('SessionName') ?>&nbsp;&nbsp;</td>
<td width="70%"><input type="text" name="name" size="50" maxlength="50" value="<?php if($formSent) echo api_htmlentities($name,ENT_QUOTES,$charset); else echo api_htmlentities($infos['name'],ENT_QUOTES,$charset); ?>"></td>
@ -117,7 +116,6 @@ if (!empty($return)) {
<td width="30%"><?php echo get_lang('CoachName') ?>&nbsp;&nbsp;</td>
<td width="70%"><select name="id_coach" style="width:250px;">
<option value="">----- <?php echo get_lang('Choose') ?> -----</option>
<?php
foreach($Coaches as $enreg) {
?>
@ -125,16 +123,10 @@ foreach($Coaches as $enreg) {
<?php
}
unset($Coaches);
$Categories = SessionManager::get_all_session_category();
?>
</select></td>
</tr>
<?php
$tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
//$access_url_id = api_get_current_access_url_id();
$sql = 'SELECT id, name FROM '.$tbl_session_category.' ORDER BY name ASC';
$result = Database::query($sql);
$Categories = Database::store_result($result);
?>
<tr>
<td width="30%"><?php echo get_lang('SessionCategory') ?></td>
<td width="70%">
@ -146,8 +138,6 @@ unset($Coaches);
</select>
</td>
</tr>
<tr>
<td>
&nbsp;
@ -395,5 +385,4 @@ function disable_starttime(select) {
</script>
<?php
Display::display_footer();
?>
Display::display_footer();

@ -891,8 +891,9 @@ class SessionManager {
$msg=get_lang('StartDateShouldBeBeforeEndDate');
return $msg;
}
$sql = "INSERT INTO $tbl_session_category(name, date_start, date_end)
VALUES('".Database::escape_string($name)."','$date_start','$date_end')";
$access_url_id = api_get_current_access_url_id();
$sql = "INSERT INTO $tbl_session_category (name, date_start, date_end, access_url_id)
VALUES('".Database::escape_string($name)."','$date_start','$date_end', '$access_url_id')";
Database::query($sql);
$id_session=Database::insert_id();
// add event to system log
@ -900,7 +901,6 @@ class SessionManager {
$user_id = api_get_user_id();
event_system(LOG_SESSION_CATEGORY_CREATE, LOG_SESSION_CATEGORY_ID, $id_session, $time, $user_id);
return $id_session;
}
/**
@ -1062,6 +1062,7 @@ class SessionManager {
}
return $return_array;
}
/**
* Get the session category information by id
* @param string session category ID
@ -1079,6 +1080,24 @@ class SessionManager {
return false;
}
}
/**
* Get all session categories (filter by access_url_id)
* @return mixed false if the session category does not exist, array if the session category exists
*/
public static function get_all_session_category() {
$id = intval($id);
$tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
$id = api_get_current_access_url_id();
$sql = 'SELECT * FROM '.$tbl_session_category.' WHERE access_url_id ="'.$id.'" ORDER BY name ASC';
$result = Database::query($sql);
if (Database::num_rows($result) > 0 ){
$data = Database::store_result($result,'ASSOC');
return $data;
} else {
return false;
}
}
/**
* Assign a coach to course in session with status = 2

@ -820,7 +820,7 @@ VALUES
('show_groups_to_users',NULL,'radio','Platform','true','ShowGroupsToUsersTitle','ShowGroupsToUsersComment',NULL,NULL, 0),
('accessibility_font_resize',NULL,'radio','Platform','false','EnableAccessibilityFontResizeTitle','EnableAccessibilityFontResizeComment',NULL,NULL, 1),
('hide_courses_in_sessions',NULL,'radio', 'Platform','false','HideCoursesInSessionsTitle', 'HideCoursesInSessionsComment','platform',NULL, 1),
('chamilo_database_version',NULL,'textfield',NULL, '1.8.8.13860','DokeosDatabaseVersion','', NULL, NULL, 0);
('chamilo_database_version',NULL,'textfield',NULL, '1.8.8.13997','DokeosDatabaseVersion','', NULL, NULL, 0);
UNLOCK TABLES;
/*!40000 ALTER TABLE settings_current ENABLE KEYS */;
@ -2429,6 +2429,7 @@ CREATE TABLE session_category (
name varchar(100) default NULL,
date_start date default NULL,
date_end date default NULL,
access_url_id INT NOT NULL default 1,
PRIMARY KEY (id)
);

@ -88,9 +88,6 @@ INSERT INTO settings_current (variable, subkey, type, category, selected_value,
INSERT INTO settings_options (variable, value, display_text) VALUES ('hide_courses_in_sessions','true','Yes');
INSERT INTO settings_options (variable, value, display_text) VALUES ('hide_courses_in_sessions','false','No');
INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('pdf_export_watermark_text', NULL,'textfield', 'Platform', '', 'PDFExportWatermarkTextTitle','PDFExportWatermarkTextComment','platform',NULL, 1);
ALTER TABLE personal_agenda ADD PRIMARY KEY (id);
@ -159,7 +156,7 @@ INSERT INTO settings_options (variable, value, display_text) VALUES ('show_group
INSERT INTO language (original_name, english_name, isocode, dokeos_folder, available) VALUES ('&#2361;&#2367;&#2344;&#2381;&#2342;&#2368;', 'hindi', 'hi', 'hindi', 0);
ALTER TABLE session ADD promotion_id INT NOT NULL;
ALTER TABLE session ADD COLUMN promotion_id INT NOT NULL;
CREATE TABLE career (id INT NOT NULL AUTO_INCREMENT, name VARCHAR(255) NOT NULL, description TEXT NOT NULL, status INT NOT NULL default '0', created_at datetime NOT NULL DEFAULT '0000-00-00 00:00:00', updated_at datetime NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (id));
CREATE TABLE promotion (id INT NOT NULL AUTO_INCREMENT, name VARCHAR(255) NOT NULL, description TEXT NOT NULL, status INT NOT NULL default '0', career_id INT NOT NULL, created_at datetime NOT NULL DEFAULT '0000-00-00 00:00:00', updated_at datetime NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY(id));
@ -178,7 +175,9 @@ CREATE TABLE notification (id BIGINT PRIMARY KEY NOT NULL AUTO_INCREMENT,dest_us
ALTER TABLE notification ADD index mail_notify_sent_index (sent_at);
ALTER TABLE notification ADD index mail_notify_freq_index (sent_at, send_freq, created_at);
UPDATE settings_current SET selected_value = '1.8.8.13860' WHERE variable = 'chamilo_database_version';
ALTER TABLE session_category ADD COLUMN access_url_id INT NOT NULL default 1;
UPDATE settings_current SET selected_value = '1.8.8.13997' WHERE variable = 'chamilo_database_version';
-- xxSTATSxx
ALTER TABLE track_e_exercices ADD COLUMN orig_lp_item_view_id INT NOT NULL DEFAULT 0;

Loading…
Cancel
Save