<?php //Object Back $objTrad = new bTraduction(); // Arrays $arrData = array(); $arrErrors = array(); //POST if (!empty($_POST)) { $action = ""; $return = false; $arrData = $_POST; $arrData['traduction_id'] = $_POST['content_id']; $id = $arrData['traduction_id']; if (empty($arrErrors)) { try { if (empty($arrData['traduction_id'])) { //add $objTrad->add($arrData); $action = "create"; $return = false; } else { //update $objTrad->update($arrData); $action = "update"; } header('Location: view.php?module=' . $module . '&id=' . $id . '&action=' . $action); exit; } catch (Exception $e) { $arrErrors[] = $e->getMessage(); }
<?php /**************************************************************************/ // AJAX Delete // PARAMS $_GET : LINK in LIST /**************************************************************************/ require_once $_SERVER['DOCUMENT_ROOT'] . '/include/config.php'; $return = 'false'; $message = ''; if (!empty($_GET['id'])) { $obj = new bTraduction(); $contentID = $_GET['id']; $arrContent = $obj->getOne(array("traduction_id" => $_GET['id'])); if (!empty($arrContent)) { $obj->delete(array("traduction_id" => $_GET['id'])); $message = "Traduction deleted"; $return = 'true'; } else { $message = 'Content already deleted.'; } } else { $message = 'Error deleting, please try again.'; } echo $return . "|" . $message;
<?php //Object Back $objTrad = new bTraduction(); // Arrays $arrData = array(); // VIEW : Get Data if (!empty($_GET['id'])) { $arrTraduction = $objTrad->getOne(array("traduction_id" => $_GET['id'])); $arrTraductionContenu = $objTrad->getText(array("traduction_id" => $_GET['id'])); $arrData['traduction'] = $arrTraduction; $arrData['traduction_text'] = $arrTraductionContenu; } else { //return to list header('Location: list.php?module=' . $module); exit; } /*********************************************************************************/ //Page List $objPage = new Page(); $arrPage = $objPage->get(); //Language List $objLang = new Language(); $arrLanguage = $objLang->get(); ?> <!-- Headers --> <?php include SITE_DIR . '/back/include/header.php'; ?>