@ -106,7 +106,6 @@ function handle_plugins() {
$all_plugins = $plugin_obj->read_plugins_from_path();
$all_plugins = $plugin_obj->read_plugins_from_path();
$installed_plugins = $plugin_obj->get_installed_plugins();
$installed_plugins = $plugin_obj->get_installed_plugins();
//Plugins NOT installed
//Plugins NOT installed
echo Display::page_subheader(get_lang('Plugins'));
echo Display::page_subheader(get_lang('Plugins'));
echo '< form name = "plugins" method = "post" action = "'.api_get_self().'?category='.Security::remove_XSS($_GET['category']).'" > ';
echo '< form name = "plugins" method = "post" action = "'.api_get_self().'?category='.Security::remove_XSS($_GET['category']).'" > ';
@ -1008,6 +1007,19 @@ function select_gradebook_number_decimals() {
return array('0', '1', '2');
return array('0', '1', '2');
}
}
function select_gradebook_default_grade_model_id() {
$grade_model = new GradeModel();
$models = $grade_model->get_all();
$options = array();
$options[-1] = get_lang('None');
if (!empty($models)) {
foreach ($models as $model) {
$options[$model['id']] = $model['name'];
}
}
return $options;
}
/**
/**
* Updates the gradebook score custom values using the scoredisplay class of the
* Updates the gradebook score custom values using the scoredisplay class of the
* gradebook module
* gradebook module
@ -1040,23 +1052,11 @@ function generate_settings_form($settings, $settings_by_access_list) {
$form ->addElement('hidden', 'search_field', Security::remove_XSS($_GET['search_field']));
$form ->addElement('hidden', 'search_field', Security::remove_XSS($_GET['search_field']));
$default_values = array();
$default_values = array();
$count_settings = count($settings);
$i = 0;
foreach ($settings as $row) {
foreach ($settings as $row) {
if (in_array($row['variable'], array_keys($settings_to_avoid))) { continue; }
if (in_array($row['variable'], array_keys($settings_to_avoid))) { continue; }
$anchor_name = $row['variable'].(!empty($row['subkey']) ? '_'.$row['subkey'] : '');
$form->addElement('html',"\n< a name = \"$anchor_name\" > < / a > \n");
($count_settings % 10) < 5 ? $ b = $count_settings - 10 : $ b = $count_settings;
if ($i % 10 == 0 and $i < $b AND $i != 0) {
$form->addElement('html', '< div align = "right" > ');
$form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class="save"');
$form->addElement('html', '< / div > ');
}
$i++;
if ( $_configuration['multiple_access_urls']) {
if ( $_configuration['multiple_access_urls']) {
if (api_is_global_platform_admin()) {
if (api_is_global_platform_admin()) {
if ($row['access_url_locked'] == 0) {
if ($row['access_url_locked'] == 0) {
@ -1221,11 +1221,11 @@ function generate_settings_form($settings, $settings_by_access_list) {
case 'link':
case 'link':
$form->addElement('static', null, array(get_lang($row['title']), get_lang($row['comment'])), get_lang('CurrentValue').' : '.$row['selected_value'], $hideme);
$form->addElement('static', null, array(get_lang($row['title']), get_lang($row['comment'])), get_lang('CurrentValue').' : '.$row['selected_value'], $hideme);
break;
break;
case 'select':
/*
/*
* To populate its list of options, the select type dynamically calls a function that must be called select_ + the name of the variable being displayed.
* To populate the list of options, the select type dynamically calls a function that must be called select_ + the name of the variable being displayed.
* The functions being called must be added to the file settings.lib.php.
* The functions being called must be added to the file settings.lib.php.
*/
*/
case 'select':
$form->addElement('select', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), call_user_func('select_'.$row['variable']), $hideme);
$form->addElement('select', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), call_user_func('select_'.$row['variable']), $hideme);
$default_values[$row['variable']] = $row['selected_value'];
$default_values[$row['variable']] = $row['selected_value'];
break;
break;
@ -1233,7 +1233,8 @@ function generate_settings_form($settings, $settings_by_access_list) {
break;
break;
}
}
if ($row['variable'] == 'pdf_export_watermark_enable') {
switch ($row['variable']) {
case 'pdf_export_watermark_enable':
$url = PDF::get_watermark($course_code);
$url = PDF::get_watermark($course_code);
$form->addElement('file', 'pdf_export_watermark_path', get_lang('AddWaterMark'));
$form->addElement('file', 'pdf_export_watermark_path', get_lang('AddWaterMark'));
if ($url != false) {
if ($url != false) {
@ -1242,25 +1243,27 @@ function generate_settings_form($settings, $settings_by_access_list) {
}
}
$allowed_picture_types = array ('jpg', 'jpeg', 'png', 'gif');
$allowed_picture_types = array ('jpg', 'jpeg', 'png', 'gif');
$form->addRule('pdf_export_watermark_path', get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', 'filetype', $allowed_picture_types);
$form->addRule('pdf_export_watermark_path', get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', 'filetype', $allowed_picture_types);
}
break;
case 'timezone_value':
if ($row['variable'] == 'timezone_value') {
$timezone = $row['selected_value'];
$timezone = $row['selected_value'];
if (empty($timezone)) {
if (empty($timezone)) {
$timezone = _api_get_timezone();
$timezone = _api_get_timezone();
}
}
$form->addElement('html', sprintf(get_lang('LocalTimeUsingPortalTimezoneXIsY'), $timezone, api_get_local_time()));
$form->addElement('html', sprintf(get_lang('LocalTimeUsingPortalTimezoneXIsY'), $timezone, api_get_local_time()));
break;
}
}
}
} // end for
if (!empty($settings)) {
if (!empty($settings)) {
$form->addElement('html', '< div style = "text-align: right; clear: both;" > ');
$form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class="save"');
$form->addElement('html', '< / div > ');
$form->setDefaults($default_values);
$form->setDefaults($default_values);
}
}
return $form;
$form->addElement('html', '< div class = "bottom_actions" > ');
$form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class="save"');
$form->addElement('html', '< / div > ');
return $form;
}
}
/**
/**