From 7acf1af340b9d11b72bca70731ed6dbcd7c95132 Mon Sep 17 00:00:00 2001 From: M Date: Sun, 22 Nov 2015 02:45:31 -0500 Subject: + Adding model for sysconf mvc --- app/model/sysconf.mod.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 app/model/sysconf.mod.php (limited to 'app/model') diff --git a/app/model/sysconf.mod.php b/app/model/sysconf.mod.php new file mode 100644 index 0000000..11b8f4f --- /dev/null +++ b/app/model/sysconf.mod.php @@ -0,0 +1,15 @@ + -- cgit v1.2.3 From 2710f0de8d8d900a0997fd72f315c8a6f07329cf Mon Sep 17 00:00:00 2001 From: M Date: Sun, 22 Nov 2015 03:04:06 -0500 Subject: * Derp, default is a reserved word, calling the function 'deflt' instead * Removed explicit call to parent constructor in model class, since that function is not explicitly defined --- app/model/sysconf.mod.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/model') diff --git a/app/model/sysconf.mod.php b/app/model/sysconf.mod.php index 11b8f4f..cc29294 100644 --- a/app/model/sysconf.mod.php +++ b/app/model/sysconf.mod.php @@ -7,7 +7,7 @@ class SysconfModel extends Model /* * Default action */ - function default() + function deflt() { } } -- cgit v1.2.3 From b1f4cf9b23acbcb80f937ef7f0b9f18fdb167f5a Mon Sep 17 00:00:00 2001 From: M Date: Sun, 22 Nov 2015 12:40:37 -0500 Subject: + Start of Master MVC ( will define generic layout of pages but will not define logic for header ui. since this depends on an established database ). + Added Master model ! As far as I am planning right now, the only MVC that will inherit Master directly will be sysconf since it cannot rely on an existing database connection. --- app/model/master.mod.php | 9 +++++++++ app/model/sysconf.mod.php | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 app/model/master.mod.php (limited to 'app/model') diff --git a/app/model/master.mod.php b/app/model/master.mod.php new file mode 100644 index 0000000..2570a8b --- /dev/null +++ b/app/model/master.mod.php @@ -0,0 +1,9 @@ + diff --git a/app/model/sysconf.mod.php b/app/model/sysconf.mod.php index cc29294..754d1a6 100644 --- a/app/model/sysconf.mod.php +++ b/app/model/sysconf.mod.php @@ -1,8 +1,8 @@ Date: Sun, 6 Dec 2015 02:16:46 -0500 Subject: * Implemented the "save" action for MVC sysconf --- app/model/sysconf.mod.php | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'app/model') diff --git a/app/model/sysconf.mod.php b/app/model/sysconf.mod.php index 754d1a6..d86f589 100644 --- a/app/model/sysconf.mod.php +++ b/app/model/sysconf.mod.php @@ -1,15 +1,58 @@ field_text("dbAddress"); + $form->field_text("dbName"); + $form->field_text("dbUser"); + $form->field_text("dbPass", null, false); + $form->field_enum("settSSL", array("force", "neither", "forbid")); + + if (!$form->populate($input)) + { + $this->logFormErrors($form); + return; + } + + $f = fopen($this->CONF_FILE, "w"); + + if (!$f) + { + $this->logError("Can not create configuration file"); + return; + } + + fwrite($f, "dbAddress . "';\n"); + fwrite($f, "\$_SCROTT['dbName'] = '" . $form->dbName . "';\n"); + fwrite($f, "\$_SCROTT['dbUser'] = '" . $form->dbUser . "';\n"); + fwrite($f, "\$_SCROTT['dbPass'] = '" . $form->dbPass . "';\n"); + fwrite($f, "\$_SCROTT['settSSL'] = '" . $form->settSSL . "';\n"); + fwrite($f, "?>\n"); + + fclose($f); + $this->redirectTo($this->ar()); + } } ?> -- cgit v1.2.3 From b7dfa1cbde0eb56a3251e48692e5757559bf604a Mon Sep 17 00:00:00 2001 From: M Date: Sun, 6 Dec 2015 03:27:39 -0500 Subject: + Adding a TODO note for later --- app/model/sysconf.mod.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app/model') diff --git a/app/model/sysconf.mod.php b/app/model/sysconf.mod.php index d86f589..30ebd58 100644 --- a/app/model/sysconf.mod.php +++ b/app/model/sysconf.mod.php @@ -32,6 +32,8 @@ class SysconfModel extends MasterModel return; } + /* TODO -- test database connection before proceeding */ + $f = fopen($this->CONF_FILE, "w"); if (!$f) -- cgit v1.2.3 From f1c8aca230a0fc982f98f3dfc9b630b82dbb7dc4 Mon Sep 17 00:00:00 2001 From: M Date: Sun, 6 Dec 2015 17:38:02 -0500 Subject: + Added functions to Master model for getting merged strings for all error/warning/or notice messages --- app/model/master.mod.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'app/model') diff --git a/app/model/master.mod.php b/app/model/master.mod.php index 2570a8b..1ce9b9a 100644 --- a/app/model/master.mod.php +++ b/app/model/master.mod.php @@ -4,6 +4,38 @@ require_once "class/model.class.php"; class MasterModel extends Model { + /* + * Get string of all logged error messages + */ + function getErrorStr() + { + if (!$this->isError()) + return ""; + + return implode("
", $this->errorlist); + } + + /* + * Get string of all logged warning messages + */ + function getWarningStr() + { + if (!$this->isWarning()) + return ""; + + return implode("
", $this->warninglist); + } + + /* + * Get string of all logged notice messages + */ + function getNoticeStr() + { + if (!$this->isNotice()) + return ""; + + return implode("
", $this->noticelist); + } } ?> -- cgit v1.2.3 From 5f8d24d62e1474958685fee21e7e442aa3ce9d9c Mon Sep 17 00:00:00 2001 From: M Date: Sun, 6 Dec 2015 20:11:28 -0500 Subject: Revert "+ Added functions to Master model for getting merged strings for all error/warning/or notice messages" - Rm'ing functions I just added. I decided to go about this in a different way This reverts commit f1c8aca230a0fc982f98f3dfc9b630b82dbb7dc4. --- app/model/master.mod.php | 32 -------------------------------- 1 file changed, 32 deletions(-) (limited to 'app/model') diff --git a/app/model/master.mod.php b/app/model/master.mod.php index 1ce9b9a..2570a8b 100644 --- a/app/model/master.mod.php +++ b/app/model/master.mod.php @@ -4,38 +4,6 @@ require_once "class/model.class.php"; class MasterModel extends Model { - /* - * Get string of all logged error messages - */ - function getErrorStr() - { - if (!$this->isError()) - return ""; - - return implode("
", $this->errorlist); - } - - /* - * Get string of all logged warning messages - */ - function getWarningStr() - { - if (!$this->isWarning()) - return ""; - - return implode("
", $this->warninglist); - } - - /* - * Get string of all logged notice messages - */ - function getNoticeStr() - { - if (!$this->isNotice()) - return ""; - - return implode("
", $this->noticelist); - } } ?> -- cgit v1.2.3 From f83a90323bb359f995e7359a917eb9470a5e40e0 Mon Sep 17 00:00:00 2001 From: M Date: Sun, 6 Dec 2015 20:51:30 -0500 Subject: + Implemented the "noticeModal" -- an object in the master MVC topp view for displaying error / warning / and notice messages + Added two helper functions to Master MVC model for retruning values to the noticeModal --- app/model/master.mod.php | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'app/model') diff --git a/app/model/master.mod.php b/app/model/master.mod.php index 2570a8b..aebcaaa 100644 --- a/app/model/master.mod.php +++ b/app/model/master.mod.php @@ -4,6 +4,39 @@ require_once "class/model.class.php"; class MasterModel extends Model { + /* + * Get the appropriate alert class to use when showing the notice modal + */ + function getNoticeModalAlertClass() + { + if ($this->isError()) + return "alert-danger"; + + if ($this->isWarning()) + return "alert-warning"; + + if ($this->isNotice()) + return "alert-info"; + + return ""; + } + + /* + * Get the appropriate glyphicon to use when showing the notice modal + */ + function getNoticeModalGlyphicon() + { + if ($this->isError()) + return "glyphicon glyphicon-remove-sign"; + + if ($this->isWarning()) + return "glyphicon glyphicon-exclamation-sign"; + + if ($this->isNotice()) + return "glyphicon glyphicon-info-sign"; + + return ""; + } } ?> -- cgit v1.2.3