* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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 Search'); $act = Tools::Param('act'); if ("Delete Search" === $act) { $searchModel = new SearchModel(); $searchModel->populateFromForm(); if (!$searchModel->validateForDelete()) { $searchView = new SearchFormView('Delete Search', $searchModel); $body = "<h2>Invalid data</h2>\n" . $searchView->getForm(); } else { $searchController = new SearchController(); $searchController->delete($searchModel); $body = "Deleted search # " . $searchModel->getId() . "<br />\n"; } } else { $searchController = new SearchController(); $searchModel = $searchController->get(Tools::param('id')); $searchView = new SearchFormView('Delete Search', $searchModel); $body = $searchView->getForm(); } $webPage->setBody($body);
* 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() . "Searches - Add Search"); $body = ''; $act = Tools::Param('act'); if ("Add Search" === $act) { $model = new SearchModel(); $model->populateFromForm(); if (!$model->validateForAdd()) { $view = new SearchFormView('Add Search', $model); $body = "<h2>Invalid data</h2>\n" . $view->getForm(); } else { $searchController = new SearchController(); $newId = $searchController->add($model); if ($newId > 0) { $body = "Added search # " . $newId . "<br />\n"; } } } else { $body = ""; $view = new SearchFormView("Add Search", null); $body = $view->getForm(); }