* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * */ require_once "Libs/autoload.php"; $config = new Config(); $webPage = new PJSWebPage($config->getTitle() . ' - Delete Note'); $act = Tools::Param('act'); if ("Delete Note" === $act) { $noteModel = new NoteModel(); $noteModel->populateFromForm(); if (!$noteModel->validateForDelete()) { $noteView = new NoteFormView('Delete Note', $noteModel); $body = "<h2>Invalid data</h2>\n" . $noteView->getForm(); } else { $noteController = new NoteController(); $noteController->delete($noteModel); $body = "Deleted note # " . $noteModel->getId() . "<br />\n"; } } else { $noteController = new NoteController(); $noteModel = $noteController->get(Tools::param('id')); $noteView = new NoteFormView('Delete Note', $noteModel); $body = $noteView->getForm(); } $webPage->setBody($body); $webPage->displayPage();
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * */ require_once "Libs/autoload.php"; $config = new Config(); $webPage = new PJSWebPage($config->getTitle() . "Notes - Add Note"); $body = ''; $act = Tools::Param('act'); if ("Add Note" === $act) { $model = new NoteModel(); $model->populateFromForm(); if (!$model->validateForAdd()) { $view = new NoteFormView('Add Note', $model); $body = "<h2>Invalid data</h2>\n" . $view->getForm(); } else { $noteController = new NoteController(); $newId = $noteController->add($model); if ($newId > 0) { $body = "Added note # " . $newId . "<br />\n"; } } } else { $body = ""; $noteModel = new NoteModel(); $noteModel->setAppliesToTable(Tools::param('appliesToTable')); $noteModel->setAppliesToId(Tools::param('appliesToId')); $view = new NoteFormView("Add Note", $noteModel); $body = $view->getForm(); } $webPage->setBody($body); $webPage->displayPage();