Adding allow_public_certificates settings in platform and course settings see #3630

skala
Julio Montoya 13 years ago
parent 1cb74976aa
commit 39c9981261
  1. 22
      main/course_info/infocours.php
  2. 2
      main/inc/lib/add_course.lib.inc.php
  3. 20
      main/inc/lib/certificate.lib.php
  4. 7
      main/install/db_main.sql
  5. 9
      main/install/migrate-db-1.8.8-1.9.0-pre.sql

@ -317,8 +317,6 @@ if (is_settings_editable()) {
$disabled_output = "disabled";
$form->freeze();
}
$form->addElement('html', '</div></div>');
// THEMATIC ADVANCE SETTINGS
@ -336,6 +334,19 @@ $form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class=
$form->addElement('html', '</div></div>');
// Certificate settings
$form->addElement('html', '<div><h3>'.Display::return_icon('certificate.png', Security::remove_XSS(get_lang('Certificates')),'',ICON_SIZE_SMALL).' '.Security::remove_XSS(get_lang('Certificates')).'</h3><div>');
$group = array();
$group[]=$form->createElement('radio', 'allow_public_certificates', get_lang('AllowPublicCertificates'), get_lang('Yes'), 1);
$group[]=$form->createElement('radio', 'allow_public_certificates', null, get_lang('No'), 0);
$form->addGroup($group, '', array(get_lang("AllowPublicCertificates")), '');
$form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class="save"');
$form->addElement('html', '</div></div>');
// BBB SETTINGS
if ($video_conference_enabled) {
@ -365,9 +376,6 @@ if ($video_conference_enabled) {
$form->addElement('html', '</div></div>');
}
// Get all the course information
$all_course_information = CourseManager::get_course_information($_course['sysCode']);
@ -418,6 +426,8 @@ $values['email_alert_students_on_new_homework'] = api_get_course_setting('em
$values['enable_lp_auto_launch'] = api_get_course_setting('enable_lp_auto_launch');
$values['pdf_export_watermark_text'] = api_get_course_setting('pdf_export_watermark_text');
$values['allow_public_certificates'] = api_get_course_setting('allow_public_certificates');
if ($video_conference_enabled) {
@ -482,7 +492,7 @@ if ($form->validate() && is_settings_editable()) {
subscribe = '".$update_values['subscribe']."',
unsubscribe = '".$update_values['unsubscribe']."',
legal = '".$update_values['legal']."',
activate_legal = '".$update_values['activate_legal']."',
activate_legal = '".$update_values['activate_legal']."',
registration_code = '".$update_values['course_registration_password']."'
WHERE code = '".$course_code."'";
Database::query($sql);

@ -2320,6 +2320,8 @@ function fill_db_course($course_id, $course_repository, $language, $default_docu
Database::query("INSERT INTO $TABLESETTING (c_id, variable,value,category) VALUES ($course_id, 'email_alert_students_on_new_homework',0,'work')");
Database::query("INSERT INTO $TABLESETTING (c_id, variable,value,category) VALUES ($course_id, 'enable_lp_auto_launch',0,'learning_path')");
Database::query("INSERT INTO $TABLESETTING (c_id, variable,value,category) VALUES ($course_id, 'pdf_export_watermark_text','','learning_path')");
Database::query("INSERT INTO $TABLESETTING (c_id, variable,value,category) VALUES ($course_id, 'allow_public_certificates','','certificates')");
/* Course homepage tools for platform admin only */

@ -1,7 +1,5 @@
<?php
require_once api_get_path(LIBRARY_PATH).'skill.lib.php';
/**
* @package chamilo.library
*/
@ -302,6 +300,24 @@ class Certificate extends Model {
* Shows the student's certificate (HTML file)
*/
public function show() {
if (api_is_anonymous()) {
if (api_get_setting('allow_public_certificates') != 'true') {
return false;
}
if (isset($this->certificate_data) && isset($this->certificate_data['cat_id'])) {
$gradebook = new Gradebook();
$gradebook_info = $gradebook->get($this->certificate_data['cat_id']);
if (!empty($gradebook_info['course_code'])) {
$allow_public_certificates = api_get_course_setting('allow_public_certificates', $gradebook_info['course_code']);
if ($allow_public_certificates == 0) {
return false;
}
} else {
return false;
}
}
}
//Read file or preview file
if (!empty($this->certificate_data['path_certificate'])) {
$user_certificate = $this->certification_user_path.basename($this->certificate_data['path_certificate']);

@ -863,7 +863,8 @@ VALUES
('gradebook_default_grade_model_id', NULL, 'select', 'Gradebook', '', 'GradebookDefaultGradeModelTitle', 'GradebookDefaultGradeModelComment', NULL, NULL, 1),
('allow_session_admins_to_see_all_sessions', NULL, 'radio', 'Session', 'false', 'AllowSessionAdminsToSeeAllSessionsTitle', 'AllowSessionAdminsToSeeAllSessionsComment', NULL, NULL, 1),
('allow_skills_tool', NULL, 'radio', 'Platform', 'false', 'AllowSkillsToolTitle', 'AllowSkillsToolComment', NULL, NULL, 1),
('chamilo_database_version',NULL,'textfield',NULL, '1.9.0.18037','DatabaseVersion','', NULL, NULL, 0);
('allow_public_certificates', NULL, 'radio', 'Course', 'false', 'AllowPublicCertificatesTitle', 'AllowPublicCertificatesComment', NULL, NULL, 1),
('chamilo_database_version',NULL,'textfield',NULL, '1.9.0.18042','DatabaseVersion','', NULL, NULL, 0);
/*
('show_tabs', 'custom_tab_1', 'checkbox', 'Platform', 'true', 'ShowTabsTitle', 'ShowTabsComment', NULL, 'TabsCustom1', 1),
@ -1209,7 +1210,9 @@ VALUES
('allow_session_admins_to_see_all_sessions', 'true', 'Yes'),
('allow_session_admins_to_see_all_sessions', 'false', 'No'),
('allow_skills_tool', 'true', 'Yes'),
('allow_skills_tool', 'false', 'No');
('allow_skills_tool', 'false', 'No'),
('allow_public_certificates', 'true', 'Yes'),
('allow_public_certificates', 'false', 'No');
UNLOCK TABLES;
/*

@ -165,6 +165,11 @@ INSERT INTO settings_current (variable, subkey, type, category, selected_value,
INSERT INTO settings_options (variable, value, display_text) VALUES ('enable_wami_record', 'true', 'Yes');
INSERT INTO settings_options (variable, value, display_text) VALUES ('enable_wami_record', 'false', 'No');
INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('allow_public_certificates', NULL, 'radio', 'Course', 'false', 'AllowPublicCertificatesTitle', 'AllowPublicCertificatesComment', NULL, NULL, 1);
INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_public_certificates', 'true', 'Yes');
INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_public_certificates', 'false', 'No');
INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('gradebook_default_weight', NULL, 'textfield', 'Gradebook', '100', 'GradebookDefaultWeightTitle', 'GradebookDefaultWeightComment', NULL, NULL, 1);
INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('gradebook_default_grade_model_id', NULL, 'select', 'Gradebook', '', 'GradebookDefaultGradeModelTitle', 'GradebookDefaultGradeModelComment', NULL, NULL, 1);
@ -228,7 +233,7 @@ ALTER TABLE course MODIFY COLUMN disk_quota bigint unsigned DEFAULT NULL;
ALTER TABLE user MODIFY COLUMN username VARCHAR(100) NOT NULL;
-- Do not move this query
UPDATE settings_current SET selected_value = '1.9.0.18037' WHERE variable = 'chamilo_database_version';
UPDATE settings_current SET selected_value = '1.9.0.18042' WHERE variable = 'chamilo_database_version';
-- xxSTATSxx
ALTER TABLE track_e_exercices ADD COLUMN questions_to_check TEXT NOT NULL DEFAULT '';
@ -257,4 +262,4 @@ ALTER TABLE quiz ADD COLUMN text_when_finished TEXT DEFAULT NULL;
ALTER TABLE quiz ADD COLUMN display_category_name INT NOT NULL DEFAULT 1;
ALTER TABLE quiz ADD COLUMN pass_percentage INT DEFAULT NULL;
INSERT INTO course_setting(variable,value,category) VALUES ('allow_public_certificates', 0, 'certificates');
Loading…
Cancel
Save