* * 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() . ' - Edit Job'); $act = Tools::Param('act'); if ("Edit Job" === $act) { $jobModel = new JobModel(); $jobModel->populateFromForm(); if (!$jobModel->validateForUpdate()) { $view = new JobFormView('Edit Job', $jobModel); $body = "<h2>Invalid data</h2>\n" . $view->getForm(); } else { $jobController = new JobController(); $newId = $jobController->update($jobModel); if ($newId > 0) { $body = "Edited job # " . $newId . "<br />\n"; } } } else { $jobController = new JobController(); $jobModel = $jobController->get(Tools::param('id')); $view = new JobFormView('Edit Job', $jobModel); $body = $view->getForm(); } $webPage->setBody($body); $webPage->displayPage();