[svn r17548] minor change tutor for teacher and add option only teacher or tutors also see FS#734

skala
Carlos Vargas 16 years ago
parent ddcbf0261b
commit 9fc06c12db
  1. 15
      main/auth/courses.php
  2. 13
      main/course_info/infocours.php
  3. 2
      main/inc/lib/add_course.lib.inc.php
  4. 13
      main/inc/lib/course.lib.php
  5. 3
      main/install/migrate-db-1.8.5-1.8.6-pre.sql

@ -1,4 +1,4 @@
<?php // $Id: courses.php 17543 2009-01-06 00:57:54Z cvargas1 $
<?php // $Id: courses.php 17548 2009-01-06 16:12:51Z cvargas1 $
/*
==============================================================================
Dokeos - elearning and course management software
@ -36,7 +36,10 @@
==============================================================================
*/
// name of the language file that needs to be included
$language_file = 'courses';
$language_file = array (
'courses',
'registration'
);
//delete the globals["_cid"] we don't need it here
$cidReset = true; // Flag forcing the 'current course' reset
@ -270,9 +273,11 @@ function subscribe_user($course_code)
{
if (CourseManager::add_user_to_course($_user['user_id'], $course_code))
{
$send = api_get_course_setting('email_alert_tutor_on_new_user_in_course',$course_code);
if ($send > 0) {
CourseManager::email_to_tutor($_user['user_id'],$course_code);
$send = api_get_course_setting('email_alert_to_teacher_on_new_user_in_course',$course_code);
if ($send == 1) {
CourseManager::email_to_tutor($_user['user_id'],$course_code,$send_to_tutor_also=false);
} else if ($send == 2){
CourseManager::email_to_tutor($_user['user_id'],$course_code,$send_to_tutor_also=true);
}
return get_lang('EnrollToCourseSuccessful');

@ -1,4 +1,4 @@
<?php // $Id: infocours.php 17543 2009-01-06 00:57:54Z cvargas1 $
<?php // $Id: infocours.php 17548 2009-01-06 16:12:51Z cvargas1 $
/*
==============================================================================
@ -186,8 +186,9 @@ $form->add_textfield('course_registration_password', get_lang('CourseRegistratio
$form->addElement('html','<div class="sectiontitle" style="margin-top: 40px;">'.get_lang('EmailNotifications').'</div>');
$form->addElement('radio', 'email_alert_tutor_on_new_user_in_course', get_lang('NewUserEmailAlert'), get_lang('NewUserEmailAlertActivate'), 1);
$form->addElement('radio', 'email_alert_tutor_on_new_user_in_course', null, get_lang('NewUserEmailAlertDeactivate'), 0);
$form->addElement('radio', 'email_alert_to_teacher_on_new_user_in_course', get_lang('NewUserEmailAlert'), get_lang('NewUserEmailAlertEnable'), 1);
$form->addElement('radio', 'email_alert_to_teacher_on_new_user_in_course', null,get_lang('NewUserEmailAlertToTeacharAndTutor'),2);
$form->addElement('radio', 'email_alert_to_teacher_on_new_user_in_course', null, get_lang('NewUserEmailAlertDisable'), 0);
$form -> addElement('html',$linebreak);
$form->addElement('radio', 'email_alert_manager_on_new_doc', get_lang('WorkEmailAlert'), get_lang('WorkEmailAlertActivate'), 1);
@ -265,7 +266,7 @@ $values['subscribe'] = $course_access_settings['subscribe'];
$values['unsubscribe'] = $course_access_settings['unsubscribe'];
$values['course_registration_password'] = $all_course_information['registration_code'];
// get send_mail_setting (auth)from table
$values['email_alert_tutor_on_new_user_in_course'] = api_get_course_setting('email_alert_tutor_on_new_user_in_course');
$values['email_alert_to_teacher_on_new_user_in_course'] = api_get_course_setting('email_alert_to_teacher_on_new_user_in_course');
// get send_mail_setting (work)from table
$values['email_alert_manager_on_new_doc'] = api_get_course_setting('email_alert_manager_on_new_doc');
// get send_mail_setting (dropbox) from table
@ -312,8 +313,8 @@ if ($form->validate() && is_settings_editable())
//update course_settings table - this assumes those records exist, otherwise triggers an error
$table_course_setting = Database::get_course_table(TABLE_COURSE_SETTING);
if($update_values['email_alert_tutor_on_new_user_in_course'] != $values['email_alert_tutor_on_new_user_in_course']){
$sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['email_alert_tutor_on_new_user_in_course']." WHERE variable = 'email_alert_tutor_on_new_user_in_course' ";
if($update_values['email_alert_to_teacher_on_new_user_in_course'] != $values['email_alert_to_teacher_on_new_user_in_course']){
$sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['email_alert_to_teacher_on_new_user_in_course']." WHERE variable = 'email_alert_to_teacher_on_new_user_in_course' ";
api_sql_query($sql,__FILE__,__LINE__);
}
if($update_values['email_alert_manager_on_new_doc'] != $values['email_alert_manager_on_new_doc']){

@ -2008,7 +2008,7 @@ function fill_Db_course($courseDbName, $courseRepository, $language,$default_doc
api_sql_query("INSERT INTO `".$TABLESETTING . "`(variable,value,category) VALUES ('course_theme','','theme')", __FILE__, __LINE__);
api_sql_query("INSERT INTO `".$TABLESETTING . "`(variable,value,category) VALUES ('allow_learning_path_theme','1','theme')", __FILE__, __LINE__);
api_sql_query("INSERT INTO `".$TABLESETTING . "`(variable,value,category) VALUES ('allow_open_chat_window',0,'chat')", __FILE__, __LINE__);
api_sql_query("INSERT INTO `".$TABLESETTING . "`(variable,value,category) VALUES ('email_alert_tutor_on_new_user_in_course',0,'registration')", __FILE__, __LINE__);
api_sql_query("INSERT INTO `".$TABLESETTING . "`(variable,value,category) VALUES ('email_alert_to_teacher_on_new_user_in_course',0,'registration')", __FILE__, __LINE__);
/*
-----------------------------------------------------------
Course homepage tools for platform admin only

@ -1830,9 +1830,10 @@ class CourseManager
* @author Carlos Vargas <carlos.vargas@dokeos.com>, Dokeos Latino
* @param int $user_id the id of the user
* @param string $course_code the course code
* @param string $send_to_tutor_also
* @return string we return the message that is displayed when the action is succesfull
*/
function email_to_tutor($user_id,$course_code) {
function email_to_tutor($user_id,$course_code,$send_to_tutor_also=false) {
$TABLECOURS=Database::get_main_table(TABLE_MAIN_COURSE);
$TABLE_USER= Database::get_main_table(TABLE_MAIN_USER);
@ -1842,10 +1843,16 @@ class CourseManager
$student = Database::fetch_array($result_me);
$information = CourseManager::get_course_information($course_code);
$name_course=$information['title'];
$sql="SELECT * FROM ".$TABLECOURSUSER." WHERE course_code='".$course_code."' AND tutor_id=1";
$sql="SELECT * FROM ".$TABLECOURSUSER." WHERE course_code='".$course_code."'";
if($send_to_tutor_also=true){
$sql.=" AND tutor_id=1";
} else {
$sql.=" AND status=1";
}
$result = api_sql_query($sql,__FILE__,__LINE__);
while ($row = Database::fetch_array($result)) {
$sql_tutor="SELECT * FROM ".$TABLE_USER." WHERE user_id='".$row['user_id']."'";
$sql_tutor="SELECT * FROM ".$TABLE_USER." WHERE user_id='".$row['user_id']."'";
$result_tutor=api_sql_query($sql_tutor,__FILE__,__LINE__);
$tutor=Database::fetch_array($result_tutor);
$emailto = $tutor['email'];

@ -143,4 +143,5 @@ CREATE TABLE calendar_event_attachment ( id int NOT NULL auto_increment, path va
ALTER TABLE glossary ADD display_order int;
CREATE TABLE calendar_event_attachment ( id int NOT NULL auto_increment, path varchar(255) NOT NULL, comment text, size int NOT NULL default 0, agenda_id int NOT NULL, filename varchar(255) NOT NULL, PRIMARY KEY (id) );
CREATE TABLE notebook (notebook_id int unsigned NOT NULL auto_increment,user_id int unsigned NOT NULL,course varchar(40) not null,session_id int NOT NULL default 0,title varchar(255) NOT NULL,description text NOT NULL,creation_date datetime NOT NULL default '0000-00-00 00:00:00',update_date datetime NOT NULL default '0000-00-00 00:00:00',PRIMARY KEY (notebook_id));
INSERT INTO course_setting(variable,value,category) VALUES ('allow_open_chat_window',0,'chat');
INSERT INTO course_setting(variable,value,category) VALUES ('allow_open_chat_window',0,'chat');
INSERT INTO course_setting(variable,value,category) VALUES ('email_alert_to_teacher_on_new_user_in_course',0,'registration');
Loading…
Cancel
Save