summaryrefslogtreecommitdiff
path: root/sqlbox
diff options
context:
space:
mode:
Diffstat (limited to 'sqlbox')
-rw-r--r--sqlbox/settings.php14
-rw-r--r--sqlbox/version.php2
-rw-r--r--sqlbox/view.php9
3 files changed, 23 insertions, 2 deletions
diff --git a/sqlbox/settings.php b/sqlbox/settings.php
new file mode 100644
index 0000000..d69bc88
--- /dev/null
+++ b/sqlbox/settings.php
@@ -0,0 +1,14 @@
+<?php
+
+defined('MOODLE_INTERNAL') || die();
+
+if ($ADMIN->fulltree) {
+ require_once(dirname(__FILE__).'/lib.php');
+
+ $settings->add(new admin_setting_configtext('sqlbox_hostname', 'Hostname', 'Host to connect to', 'localhost'));
+ $settings->add(new admin_setting_configtext('sqlbox_database', 'Database', 'Database for SQLBox', 'sqlbox'));
+ $settings->add(new admin_setting_configtext('sqlbox_user', 'User', 'User name for Database', 'sqlbox'));
+ $settings->add(new admin_setting_configtext('sqlbox_password', 'Password', 'Password for the User', 'sqlbox_pw'));
+}
+
+?>
diff --git a/sqlbox/version.php b/sqlbox/version.php
index 5c4d1b6..1222e09 100644
--- a/sqlbox/version.php
+++ b/sqlbox/version.php
@@ -30,7 +30,7 @@
defined('MOODLE_INTERNAL') || die();
-$module->version = 2013012404; // The current module version (Date: YYYYMMDDXX)
+$module->version = 2013012500; // The current module version (Date: YYYYMMDDXX)
$module->requires = 2010031900; // Requires this Moodle version
$module->cron = 0; // Period for cron to check this module (secs)
$module->component = 'mod_sqlbox'; // To check on upgrade, that module sits in correct place
diff --git a/sqlbox/view.php b/sqlbox/view.php
index 9efe93b..f79b8dc 100644
--- a/sqlbox/view.php
+++ b/sqlbox/view.php
@@ -87,7 +87,14 @@ $correct = true;
if (isset($data->sqlbox_query)) {
echo $OUTPUT->heading('SQL Query: '.$data->sqlbox_query);
- $db = pg_connect("host=localhost dbname=sqlbox user=sqlbox password=foobar");
+
+ $con = sprintf("host=%s dbname=%s user=%s password=%s",
+ $CFG->sqlbox_hostname ? $CFG->sqlbox_hostname : "localhost",
+ $CFG->sqlbox_database ? $CFG->sqlbox_database : "sqlbox",
+ $CFG->sqlbox_user ? $CFG->sqlbox_user : "sqlbox",
+ $CFG->sqlbox_password ? $CFG->sqlbox_password : "sqlbox_pw" );
+
+ $db = pg_connect($con);
if (!$db)
error("Failed to connect to sqlbox db");