function system_settings_form

7.x system.module system_settings_form()
6.x system.module system_settings_form()
4.x system.module system_settings_form()
5.x system.module system_settings_form()

This is the "system settings" form.

File

modules/system/system.module, line 2111

Code

function system_settings_form() {
  $form = array();
  $m = 0;

  $form ["mark" . $m++] = array(
    "value" => t("Use this form to alter the various system settings in FlightPath.
                  Before making changes, it is always good policy to first back up your database."),

  );

  $form ["mark" . $m++] = array(
    "value" => "<p><div style='font-size:0.8em;'>" . t("Your site requires a cron job in order to perform routine tasks.  This
                        is accomplished by having your server access the following URL every so often
                        (like once an hour):") . "<br>&nbsp; &nbsp; <i>" . $GLOBALS ["fp_system_settings"]["base_url"] . "/cron.php?t=" . $GLOBALS ["fp_system_settings"]["cron_security_token"] . "</i>
                        <br>" . t("Example linux cron command:") . "&nbsp; <i>wget -O - -q -t 1 http://ABOVE_URL</i></div></p>",
  );




  $form ["maintenance_mode"] = array(
    "label" => t("Set maintenance mode?"),
    "type" => "checkbox",
    "value" => variable_get("maintenance_mode", FALSE),
    "description" => t("If checked, a message will display on every page stating
                        that the system is currently undergoing routine maintenance."),
  );

  $form ["disable_login_except_admin"] = array(
    "type" => "select",
    "label" => t("Disable all new logins (except admin user)?"),
    "hide_please_select" => TRUE,
    "options" => array("no" => t("No"), "yes" => t("Yes")),
    "value" => variable_get('disable_login_except_admin', 'no'),
    "description" => t("If set to Yes, then when normal users attempt to log in, they will be
                        sent back to the login page, with a message displayed explaning that
                        logins are disabled.  Admin will still be able to log in.  This 
                        is useful when trying to perform maintenance on FlightPath.  If unsure
                        what to select, select 'No'."),
  );


  $form ["disable_student_logins"] = array(
    "type" => "select",
    "label" => t("Disable all new student logins?"),
    "hide_please_select" => TRUE,
    "options" => array("no" => t("No"), "yes" => t("Yes")),
    "value" => variable_get('disable_student_logins', 'no'),
    "description" => t("If set to Yes, then when student users (not specified in the whitelist below) attempt to log in, they will be
                        sent back to the login page, with a message displayed explaning that
                        student logins are disabled.  Admin and faculty/staff will still be able to log in.  
                        If unsure what to select, select 'No'."),
  );


  $form ["user_whitelist"] = array(
    "type" => "textarea",
    "label" => t("Only allow certain users to log in (allow list):"),
    "value" => variable_get('user_whitelist', ''),
    "description" => t("You may explicitly state which users are allowed to log in to FlightPath at this time.
                        Enter usernames, email addresses, or CWIDs, one per line.  Users who are not part of this \"allow list\"
                        will be returned to the login screen, with a message stating that the system is only allowing
                        certain users to log in at this time.   
                        <br>Note: the admin user
                        will always be able to log in.  To disable, simply erase the contents of
                        this box and save."),
  );



  $form ['mfa_enabled'] = array(
    'type' => 'select',
    'label' => t("Enable multi-factor authentication?"),
    'options' => array('no' => 'No (default)', 'yes' => 'Yes'),
    'hide_please_select' => TRUE,
    'value' => variable_get("mfa_enabled", "no"),
    'description' => t("If enabled, local users in FlightPath (like admin) will be emailed a validation code upon logging in, if and only if they have
                        an email address saved for their user account.  This will not affect users which use an alternate method of logging in, such
                        as SSO, LDAP, etc.  If unsure what to select, set this value to 'No'."),
  );



  $form ["system_name"] = array(
    "type" => "textfield",
    "label" => t("System Name:"),
    "value" => variable_get("system_name", "FlightPath"),
    "description" => t("This is the name of this software system.  Ex:  FlightPath.  This setting allows you to re-name this
                        system for you school.  You will also need to create new themes, and edit where the name FlightPath
                        is hard-coded in the template files.  This will only change the name FlightPath in user-facing pages, 
                        it will still appear in admin sections.  After changing this value, clear your cache, as several
                        menu items will need to be updated."),

  );


  $form ['system_timezone'] = array(
    'type' => 'select',
    'label' => t('System timezone:'),
    'options' => get_timezones(),
    'value' => variable_get('system_timezone', 'America/Chicago'),
  );


  $form ['system_default_student_load_tab'] = array(
    'type' => 'select',
    'label' => t('Default tab to view when loading a new student:'),
    'options' => array('profile' => t('Student Profile'), 'engagements' => t("Engagements"), 'degree' => t('Degree')),
    'value' => variable_get('system_default_student_load_tab', 'profile'),
    'hide_please_select' => TRUE,
    'description' => t("Unless overridden by the user's settings, this is the tab which
                        the user will see when pulling up a new student for advising.
                        <br>If unsure what to select, chose 'Student Profile'."),
  );


  // Can we support clean_urls?
  $bool_support_clean = system_check_clean_urls();
  $form ["support_clean_urls"] = array(
    "type" => "hidden",
    "value" => ($bool_support_clean) ? "yes" : "no",
  );

  if ($bool_support_clean) {
    // Give the option to change ONLY if we can support clean URLs
    $form ["clean_urls"] = array(
      "type" => "checkbox",
      "label" => t("Enable 'Clean URLs?'"),
      "value" => variable_get("clean_urls", FALSE),
      "description" => t("Your server supports 'clean URLs', which eliminates 'index.php?q=' from your URLs, making them
                          more readable.  It is recommended you leave this feature enabled.  For more information, see: http://getflightpath.com/node/5."),
    );
  }
  else {
    // Server does not support clean URLs.
    $form ["support_clean_markup"] = array(
      "value" => "<p><b>Clean URLs:</b> This server <u>does not support</u> clean URLs.  If you are using an Apache-compatible server,
                  make sure that your .htaccess file is properly configured.  For more information, see: http://getflightpath.com/node/5.</p>",

    );
  }


  $form ["theme"] = array(
    "type" => "radios",
    "label" => t("Theme:"),
    "options" => system_get_available_themes(),
    "value" => variable_get("theme", "themes/fp_clean"),
    "description" => t("Select the theme you wish to use.  Ex:  Classic (themes/fp_clean)"),
  );


  $form ['external_css'] = array(
    'type' => 'textfield',
    'label' => t("External/Additional CSS file(s):"),
    'value' => variable_get("external_css", ""),
    "description" => t("Enter the URL to one or more external or internal CSS files (separated by comma).  Be aware
                      that due to the ordering of when your CSS file is loaded, you may need to use the !important keyword on some styles.
                      <br>If using an external source, your URL should begin with https:// and may not contain any queries (ex: ?a=b). 
                      <br>If you are unsure what to enter here, leave it blank."),
  );


  $form ['logo_image_url'] = array(
    'type' => 'textfield',
    'label' => t("Logo image URL:"),
    'value' => variable_get("logo_image_url", ""),
    "description" => t("Enter the URL to a logo image.  This is normally the \"FlightPath\" banner image seen in the upper left corner of every page.
                       <br>The image should be in a horizontal layout. Images with a height of at least 70px work best, as that is the height
                            it will be resized to using CSS.                                                   
                      <br>If using an external source, your URL should begin with https:// and may not contain any queries (ex: ?a=b). 
                      <br>If you are unsure what to enter here, leave it blank to use the default logo."),
  );



  $form ['public_files_allowed_extensions'] = array(
    'type' => 'textfield',
    'label' => t('Allowed file extensions for public file uploads:'),
    'value' => variable_get("public_files_allowed_extensions", "css, txt, pdf, doc, docx, csv, xls, xlsx, ppt, pptx, rtf, odt, jpg, jpeg, png, gif, zip, 7z"),
    'description' => t('The Content module permits "public" (non-encrypted) files to be uploaded and stored on the web server.
                        Enter the entensions, separated by comma, that you wish to allow.  Do not enter periods before the extension.
                        If you are unsure what to enter, use the
                        following: 
                        <br>css, txt, pdf, doc, docx, csv, xls, xlsx, ppt, pptx, rtf, odt, jpg, jpeg, png, gif, zip, 7z'),
  );




  $form ["contact_email_address"] = array(
    "type" => "textfield",
    "label" => t("Contact email address:"),
    "value" => variable_get("contact_email_address", ""),
    "description" => t("Enter the email address to mail when a user accesses the
                        Contact FlightPath Production Team popup.  Leave blank to disable the link to the popup."),

  );


  $form ["notify_apply_draft_changes_email_address"] = array(
    "type" => "textfield",
    "label" => t("Notify apply draft changes email address:"),
    "value" => variable_get("notify_apply_draft_changes_email_address", ""),
    "description" => t("Enter 1 or more email addresses (separated by comma) to notify when
                draft changes are applied from the admin console.  
                Leave blank to disable."),
  );

  $form ["notify_mysql_error_email_address"] = array(
    "type" => "textfield",
    "label" => t("Notify MySQL error email address:"),
    "value" => variable_get("notify_mysql_error_email_address", ""),
    "description" => t("Enter 1 or more email addresses (separated by comma) to notify when
                a mysql error occurs.  
                Leave blank to disable."),
  );


  $form ["notify_php_error_email_address"] = array(
    "type" => "textfield",
    "label" => t("Notify PHP error email address:"),
    "value" => variable_get("notify_php_error_email_address", ""),
    "description" => t("Enter 1 or more email addresses (separated by comma) to notify when
                a PHP warning or error occurs.  Leave blank to disable.  Recommendation: disable
                on development, but enable on production."),
  );



  $form ["admin_transfer_passcode"] = array(
    "type" => "textfield",
    "label" => t("Admin Apply Draft password:"),
    "value" => variable_get("admin_transfer_passcode", "changeMe"),
    "description" => t("Enter a password which an admin user must enter
                        in order to apply draft changes to FlightPath.
                        This is an added security measure. Ex: p@ssWord569w"),
  );


  $options = array(
    "90" => t("90 days"),
    "180" => t("180 days"),
    "365" => t("1 year"),
    "548" => t("1.5 years"),
    "730" => t("2 years"),
    "912" => t("2.5 years"),
    "1095" => t("3 years"),
    "1460" => t("4 years"),
    "1825" => t("5 years"),
    "2190" => t("6 years"),
    "2555" => t("7 years"),
    "2920" => t("8 years"),
    "3285" => t("9 years"),
    "3650" => t("10 years"),
    "never" => t("Never - Do not trim log table"),
  );



  $form ["max_watchdog_age"] = array(
    "type" => "select",
    "label" => t("Max watchdog (log) entry age:"),
    "hide_please_select" => TRUE,
    "options" => $options,
    "value" => variable_get("max_watchdog_age", "1095"),
    "description" => t("Keep entries in the watchdog log tables until they are this old.
                        Entries older than this will be deleted at every cron run.
                        For example, if you only want to keep log entries for 1 year, then
                        set this to 1 year.
                        <b>Warning:</b> the Stats module uses data in this table to create
                        statistics and reports about use of FlightPath.  Once data is removed from the
                        watchdog table, it cannot be retrieved again.
                        <br>If you are unsure what to put here, select '3 years'."),
  );

  $form ['max_watchdog_debug_age'] = array(
    "type" => "select",
    "label" => t("Max watchdog (log) DEBUG entry age:"),
    "hide_please_select" => TRUE,
    "options" => array('7' => t('7 days'), '15' => t('15 days'), '30' => t('30 days'), '60' => t('60 days'), '90' => t('90 days'), '180' => t('180 days'), '365' => t('1 year'), 'never' => t("Never - do not remove debug entries from log table")),
    "value" => variable_get("max_watchdog_debug_age", "30"),
    "description" => t("This is similar to the setting above, but this sets how long to keep 'debug' messages in the watchdog (logs).
                        Debug events are generally useful for tracking down issues or problems, and are not used in any official reporting.  Removing them
                        helps reduce the size of the watchdog table.
                        <br>If unsure what to choose, select '1 year'."),
  );


  $form ["admin_degrees_default_allow_dynamic"] = array(
    "type" => "textfield",
    "size" => 5,
    "label" => t("Default 'Allow Dynamic' value for new degrees:"),
    "value" => variable_get("admin_degrees_default_allow_dynamic", "1"),
    "description" => t("When creating a new degree, this is the default value to set for 'Allow Dynamic'.  If set to 1 (the number one), it means
                        the degree is allowed to be dynamic, meaning it can be combined with other 'dynamic' degrees.  If it is set to 0 (zero), it
                        means the degree is not allowed to be combined with anything else.  If you are unsure what to enter here, type 1 (one)."),
  );


  $form ["degree_classifications_level_1"] = array(
    "label" => t("Degree Classifications - Level 1:"),
    "type" => "textarea",
    "rows" => 3,
    "value" => variable_get("degree_classifications_level_1", "MAJOR ~ Major"),
    "description" => t("Enter the 'level 1' (ie, top level) degree classifications, one per line, in the following format:
                          <br>&nbsp; &nbsp; MACHINE_NAME ~ Title
                          <br> Example:  MAJOR ~ Major
                          <br>These are degrees which might be combined with 
                               another degree, as in a double-major, or selected on their own for graduation.
                               For example, a degree in Computer Science, by itself would be
                               classified as a 'Major' by most universities.  If you are unsure what to enter,
                               use:  MAJOR ~ Major"),
  );

  $form ["degree_classifications_level_2"] = array(
    "label" => t("Degree Classifications - Level 2:"),
    "type" => "textarea",
    "rows" => 3,
    "value" => variable_get("degree_classifications_level_2", "MINOR ~ Minor"),
    "description" => t("Enter the 'level 2' degree classifications, one per line, in the following format:
                          <br>&nbsp; &nbsp; MACHINE_NAME ~ Title
                          <br> Example:  MINOR ~ Minor
                          <br>These are degrees which might be combined with another degree
                              but are not selected by themselves for graduation.  Most universities
                              would consider this type to be a 'Minor'.  For example, a student
                              might Major in Computer Science, with a Minor in Math.  In this instance,
                              Math would be classified by this level. If you are unsuare what to enter, use:
                              MINOR ~ Minor"),
  );


  $form ["degree_classifications_level_3"] = array(
    "label" => t("Degree Classifications - Level 3 (Add-on degrees, attached to other degrees):"),
    "type" => "textarea",
    "rows" => 3,
    "value" => variable_get("degree_classifications_level_3", "CONC ~ Concentration"),
    "description" => t("Enter the 'level 3' degree classifications, one per line, in the following format:
                          <br>&nbsp; &nbsp; MACHINE_NAME ~ Title
                          <br> Example:  CONC ~ Concentration
                          <br>These are degree plans which are only ever 'attached' to other degree plans as an add-on option
                          to the student.
                          For example, Computer Science might have an Option or Track or Concentration in 'Business'.
                          The Business concentration would ONLY be selectable if the student were already majoring in Computer Science,
                          therefor it would fall into this classification.
                          If unsure what to enter here, use: CONC ~ Concentration"),
  );


  $form ["enable_legacy_concentrations"] = array(
    "label" => t("Enable legacy concentrations?"),
    "type" => "checkbox",
    "value" => variable_get("enable_legacy_concentrations", FALSE),
    "description" => t("If checked, FlightPath will instruct users creating new degrees (and in other places) to
                        enter concentrations with a | (pipe) symbol.  This is how concentrations were handled in FlightPath 4x and
                        before-- as entirely separate degrees.  However, this can cause confusion if Dynamic Degrees
                        and/or Level-3 degrees are being utilized, as a concentration is a similar concept as a level-3 track, and some schools
                        may even name it as such.  If you are unsure what to do, leave this unchecked."),
  );



  $form ["allowed_student_ranks"] = array(
    "type" => "textfield",
    "label" => t("Allowed student ranks (CSV):"),
    "value" => variable_get("allowed_student_ranks", "FR, SO, JR, SR"),
    "description" => t("This is a list of which student ranks (aka Classifications) are allowed into FlightPath.
                It should be separated by commas.
                This also affects which students you may search for on the Advisees
                tab. Ex: FR, SO, JR, SR"),
  );

  $form ["rank_descriptions"] = array(
    "type" => "textarea",
    "label" => t("Rank descriptions:"),
    "rows" => 8,
    "value" => variable_get("rank_descriptions", "FR ~ Freshman\nSO ~ Sophomore\nJR ~ Junior\nSR ~ Senior\nPR ~ Professional\nGR ~ Graduate"),
    "description" => t("Enter the rank code (from above) and the description which should appear on screen, in the format:
                        RANK ~ DESC, one per line.
                        <br>Ex:
                        <br>&nbsp; FR ~ Freshman
                        <br>&nbsp; SO ~ Sophomore
                        <br>&nbsp; JR ~ Junior
                        <br>&nbsp; SR ~ Senior"),
  );


  $form ["not_allowed_student_message"] = array(
    "type" => "textarea",
    "label" => t("Not allowed student message:"),
    "value" => variable_get("not_allowed_student_message", ""),
    "description" => t("When a student is NOT allowed into FlightPath because of their
                rank, this message will be displayed."),
  );


  $form ['login_help_cid'] = array(
    'label' => t("Enter the 'Need Help Logging In?' Content ID number:"),
    'type' => 'textfield',
    'size' => 5,
    'value' => variable_get("login_help_cid", "0"),
    'description' => t("Enter the Content ID number of the web page you'd like the visitor to see if they click the 'Need Help Logging In?' link 
                        on the login page.  If you leave this blank, a generic message will be shown.  To customize, visit the Content sectiona and
                        create a new 'Page'.  Once you save, you will see the Content ID number at the end of the URL.  Ex:  flightpath_url/content/543 means
                        that 543 is the Content ID."),
  );


  $form ['logout_message'] = array(
    'label' => t("Log out message:"),
    'type' => 'textarea',
    'value' => variable_get("logout_message", "You have been logged out of FlightPath."),
    'description' => t("This message displays to the user when they have logged out of FlightPath.  If unsure what to enter, use the following:
                          <br>&nbsp; &nbsp; <i>You have been logged out of FlightPath.</i>
                          <br><b>Note:</b> You may use basic HTML in this field to add bold, italics, or links."),

  );

  $form ['recalculate_alert_badge_seconds'] = array(
    'label' => t('How often should we recalculate the alert "bell" count?'),
    'type' => 'select',
    'hide_please_select' => TRUE,
    'options' => array(1 => "1 second (recalculate on every page load)",
      15 => "15 seconds",
      30 => "30 seconds (default)",
      60 => "1 minute",
      300 => "5 minutes",
      600 => "10 minutes",
      1200 => "20 minutes",
    ),
    'value' => variable_get('recalculate_alert_badge_seconds', 30),
    'description' => t('The alert "bell" at the top-right of the screen will display a notification graphic if there is something important for the user to look at.
                        For example, a new email or text message sent by the student.  Please select how often we should check to see
                        if there is anything new.  The alert count will be automatically recalculated when new content is created or deleted.
                        <br>This process may cause delays in page loads. If you notice slow page loads, set this time higher.
                        <br>If unsure, set to <em>30 seconds</em>.'),
  );





  return $form;
}