[svn r17543] has added the option to enable and disable, and has improved the function api_get_course_setting in main_api.lib see 734

skala
Carlos Vargas 17 years ago
parent 26107d9906
commit 651464435c
  1. 7
      main/auth/courses.php
  2. 13
      main/course_info/infocours.php
  3. 1
      main/inc/lib/add_course.lib.inc.php
  4. 10
      main/inc/lib/main_api.lib.php
  5. 1
      main/install/migrate-db-1.6.x-1.8.0-pre.sql

@ -1,4 +1,4 @@
<?php // $Id: courses.php 17482 2008-12-29 23:16:42Z cvargas1 $ <?php // $Id: courses.php 17543 2009-01-06 00:57:54Z cvargas1 $
/* /*
============================================================================== ==============================================================================
Dokeos - elearning and course management software Dokeos - elearning and course management software
@ -270,7 +270,10 @@ function subscribe_user($course_code)
{ {
if (CourseManager::add_user_to_course($_user['user_id'], $course_code)) if (CourseManager::add_user_to_course($_user['user_id'], $course_code))
{ {
CourseManager::email_to_tutor($_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);
}
return get_lang('EnrollToCourseSuccessful'); return get_lang('EnrollToCourseSuccessful');
} }

@ -1,4 +1,4 @@
<?php // $Id: infocours.php 17084 2008-12-06 16:44:47Z herodoto $ <?php // $Id: infocours.php 17543 2009-01-06 00:57:54Z cvargas1 $
/* /*
============================================================================== ==============================================================================
@ -185,6 +185,11 @@ $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('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('html',$linebreak);
$form->addElement('radio', 'email_alert_manager_on_new_doc', get_lang('WorkEmailAlert'), get_lang('WorkEmailAlertActivate'), 1); $form->addElement('radio', 'email_alert_manager_on_new_doc', get_lang('WorkEmailAlert'), get_lang('WorkEmailAlertActivate'), 1);
$form->addElement('radio', 'email_alert_manager_on_new_doc', null, get_lang('WorkEmailAlertDeactivate'), 0); $form->addElement('radio', 'email_alert_manager_on_new_doc', null, get_lang('WorkEmailAlertDeactivate'), 0);
$form -> addElement('html',$linebreak); $form -> addElement('html',$linebreak);
@ -259,6 +264,8 @@ $values['visibility'] = $_course['visibility'];
$values['subscribe'] = $course_access_settings['subscribe']; $values['subscribe'] = $course_access_settings['subscribe'];
$values['unsubscribe'] = $course_access_settings['unsubscribe']; $values['unsubscribe'] = $course_access_settings['unsubscribe'];
$values['course_registration_password'] = $all_course_information['registration_code']; $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');
// get send_mail_setting (work)from table // get send_mail_setting (work)from table
$values['email_alert_manager_on_new_doc'] = api_get_course_setting('email_alert_manager_on_new_doc'); $values['email_alert_manager_on_new_doc'] = api_get_course_setting('email_alert_manager_on_new_doc');
// get send_mail_setting (dropbox) from table // get send_mail_setting (dropbox) from table
@ -305,6 +312,10 @@ if ($form->validate() && is_settings_editable())
//update course_settings table - this assumes those records exist, otherwise triggers an error //update course_settings table - this assumes those records exist, otherwise triggers an error
$table_course_setting = Database::get_course_table(TABLE_COURSE_SETTING); $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' ";
api_sql_query($sql,__FILE__,__LINE__);
}
if($update_values['email_alert_manager_on_new_doc'] != $values['email_alert_manager_on_new_doc']){ if($update_values['email_alert_manager_on_new_doc'] != $values['email_alert_manager_on_new_doc']){
$sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['email_alert_manager_on_new_doc']." WHERE variable = 'email_alert_manager_on_new_doc' "; $sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['email_alert_manager_on_new_doc']." WHERE variable = 'email_alert_manager_on_new_doc' ";
api_sql_query($sql,__FILE__,__LINE__); api_sql_query($sql,__FILE__,__LINE__);

@ -2018,6 +2018,7 @@ function fill_Db_course($courseDbName, $courseRepository, $language,$default_doc
course_setting table (courseinfo tool) course_setting table (courseinfo tool)
----------------------------------------------------------- -----------------------------------------------------------
*/ */
api_sql_query("INSERT INTO `".$TABLESETTING . "`(variable,value,category) VALUES ('email_alert_tutor_on_new_user_in_course',0,'auth')", __FILE__, __LINE__);
api_sql_query("INSERT INTO `".$TABLESETTING . "`(variable,value,category) VALUES ('email_alert_manager_on_new_doc',0,'work')", __FILE__, __LINE__); api_sql_query("INSERT INTO `".$TABLESETTING . "`(variable,value,category) VALUES ('email_alert_manager_on_new_doc',0,'work')", __FILE__, __LINE__);
api_sql_query("INSERT INTO `".$TABLESETTING . "`(variable,value,category) VALUES ('email_alert_on_new_doc_dropbox',0,'dropbox')", __FILE__, __LINE__); api_sql_query("INSERT INTO `".$TABLESETTING . "`(variable,value,category) VALUES ('email_alert_on_new_doc_dropbox',0,'dropbox')", __FILE__, __LINE__);
api_sql_query("INSERT INTO `".$TABLESETTING . "`(variable,value,category) VALUES ('allow_user_edit_agenda',0,'agenda')", __FILE__, __LINE__); api_sql_query("INSERT INTO `".$TABLESETTING . "`(variable,value,category) VALUES ('allow_user_edit_agenda',0,'agenda')", __FILE__, __LINE__);

@ -483,10 +483,16 @@ function api_get_course_path($course_code=null) {
/** /**
* Gets a course setting from the current course_setting table. Try always using integer values. * Gets a course setting from the current course_setting table. Try always using integer values.
* @param string The name of the setting we want from the table * @param string The name of the setting we want from the table
* @param string Optional: course code
* @return mixed The value of that setting in that table. Return -1 if not found. * @return mixed The value of that setting in that table. Return -1 if not found.
*/ */
function api_get_course_setting($setting_name) { function api_get_course_setting($setting_name, $course_code = null) {
$table = Database::get_course_table(TABLE_COURSE_SETTING); if (!empty($course_code)) {
$c = api_get_course_info($course_code);
$table = Database::get_course_table(TABLE_COURSE_SETTING,$c['dbName']);
} else {
$table = Database::get_course_table(TABLE_COURSE_SETTING);
}
$setting_name = mysql_real_escape_string($setting_name); $setting_name = mysql_real_escape_string($setting_name);
$sql = "SELECT * FROM $table WHERE variable = '$setting_name'"; $sql = "SELECT * FROM $table WHERE variable = '$setting_name'";
$res = api_sql_query($sql,__FILE__,__LINE__); $res = api_sql_query($sql,__FILE__,__LINE__);

@ -309,6 +309,7 @@ UPDATE tool SET link = 'newscorm/lp_controller.php' WHERE link = 'scorm/scormdoc
INSERT INTO tool(name,link,image,visibility,admin,address,added_tool,target,category) VALUES ('blog_management','blog/blog_admin.php','blog_admin.gif',0,'1','squaregrey.gif',0,'_self','admin'); INSERT INTO tool(name,link,image,visibility,admin,address,added_tool,target,category) VALUES ('blog_management','blog/blog_admin.php','blog_admin.gif',0,'1','squaregrey.gif',0,'_self','admin');
INSERT INTO tool(name,link,image,visibility,admin,address,added_tool,target,category) VALUES ('survey','survey/survey_list.php','survey.gif',0,'1','',0,'_self','admin'); INSERT INTO tool(name,link,image,visibility,admin,address,added_tool,target,category) VALUES ('survey','survey/survey_list.php','survey.gif',0,'1','',0,'_self','admin');
INSERT INTO tool(name,link,image,visibility,admin,address,added_tool,target,category) VALUES ('course_maintenance','course_info/maintenance.php','backup.gif',0,'1','',0,'_self', 'admin'); INSERT INTO tool(name,link,image,visibility,admin,address,added_tool,target,category) VALUES ('course_maintenance','course_info/maintenance.php','backup.gif',0,'1','',0,'_self', 'admin');
INSERT INTO course_setting(variable,value,category) VALUES ('email_alert_tutor_on_new_user_in_course',0,'auth');
INSERT INTO course_setting(variable,value,category) VALUES ('email_alert_manager_on_new_doc',0,'work'); INSERT INTO course_setting(variable,value,category) VALUES ('email_alert_manager_on_new_doc',0,'work');
INSERT INTO course_setting(variable,value,category) VALUES ('email_alert_on_new_doc_dropbox',0,'dropbox'); INSERT INTO course_setting(variable,value,category) VALUES ('email_alert_on_new_doc_dropbox',0,'dropbox');
INSERT INTO course_setting(variable,value,category) VALUES ('allow_user_edit_agenda',0,'agenda'); INSERT INTO course_setting(variable,value,category) VALUES ('allow_user_edit_agenda',0,'agenda');

Loading…
Cancel
Save