Adding more static declarations in functions

skala
Julio Montoya 12 years ago
parent fbe46f04ba
commit 0c4358f9f4
  1. 15
      main/admin/settings.lib.php
  2. 4
      main/admin/settings.php
  3. 1
      main/inc/lib/display.lib.php
  4. 2
      main/inc/lib/pdf.lib.php

@ -1056,9 +1056,9 @@ function update_gradebook_score_display_custom_values($values) {
$scoredisplay->update_custom_score_display_settings($final);
}
function generate_settings_form($settings, $settings_by_access_list) {
$table_settings_current = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
function generate_settings_form($settings, $settings_by_access_list) {
global $_configuration, $settings_to_avoid, $convert_byte_to_mega_list;
$table_settings_current = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
$form = new FormValidator('settings', 'post', 'settings.php?category='.Security::remove_XSS($_GET['category']));
@ -1076,7 +1076,7 @@ function generate_settings_form($settings, $settings_by_access_list) {
$default_values = array();
$i = 0;
foreach ($settings as $row) {
foreach ($settings as $row) {
if (in_array($row['variable'], array_keys($settings_to_avoid))) { continue; }
if ( $_configuration['multiple_access_urls']) {
@ -1265,15 +1265,18 @@ function generate_settings_form($settings, $settings_by_access_list) {
}
switch ($row['variable']) {
case 'pdf_export_watermark_enable':
$url = PDF::get_watermark($course_code);
case 'pdf_export_watermark_enable':
$url = PDF::get_watermark(null);
$form->addElement('file', 'pdf_export_watermark_path', get_lang('AddWaterMark'));
if ($url != false) {
$delete_url = '<a href="?delete_watermark">'.Display::return_icon('delete.png',get_lang('DelImage')).'</a>';
$form->addElement('html', '<a href="'.$url.'">'.$url.' '.$delete_url.'</a>');
}
$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':
$timezone = $row['selected_value'];

@ -58,7 +58,6 @@ if (isset($_POST['style'])) {
Display::$preview_style = $_POST['style'];
}
// Database table definitions.
$table_settings_current = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
@ -131,6 +130,7 @@ function get_settings($category = null) {
return $settings;
}
// Build the form.
if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', 'stylesheets', 'Search'))) {
$my_category = isset($_GET['category']) ? $_GET['category'] : null;
@ -507,4 +507,4 @@ if (!empty($_GET['category'])) {
}
/* FOOTER */
Display :: display_footer();
Display :: display_footer();

@ -1464,6 +1464,7 @@ class Display {
}
public static function actions($items) {
$html = null;
if (!empty($items)) {
$html = '<div class="new_actions"><ul class="nav nav-pills">';
foreach ($items as $value) {

@ -299,7 +299,7 @@ class PDF {
* @param string course code (optional)
* @param mixed web path of the watermark image, false if there is nothing to return
*/
public function get_watermark($course_code = null) {
public static function get_watermark($course_code = null) {
$web_path = false;
if (!empty($course_code) && api_get_setting('pdf_export_watermark_by_course') == 'true') {
$course_info = api_get_course_info($course_code);

Loading…
Cancel
Save