Example #1
0
 public function Update()
 {
     global $obj, $model, $param1;
     include_once 'Model/category.php';
     $model = new Category();
     $model->Id = $param1;
     if (isset($_POST['btnSubmit'])) {
         foreach ($_POST as $key => $value) {
             try {
                 $model->{$key} = $value;
             } catch (Exception $ex) {
             }
         }
         if ($model->Update()) {
             print '<span class="success">Category Updated</span>';
         } else {
             print '<span class="error">' . $model->Error . '</span>';
         }
     } else {
         $model->SelectById();
     }
     include_once 'View/Category/update.php';
 }
include "../inc/classes/Technology.php";
include "../inc/classes/Helpers.php";
if (isset($_REQUEST['mode']) && $_REQUEST['mode'] == 'sort') {
    $objCategory = new Category();
    $objCategory->SortValues(substr($_REQUEST['action'], 1), substr($_REQUEST['action'], 0, 1));
    unset($objCategory);
} elseif (isset($_REQUEST['dragsort'])) {
    // handle drag sort ajax request:
    $objCategory = new Category($_REQUEST['id']);
    $new_sort_order = $_REQUEST['idx'] * 10 + 5;
    if ($new_sort_order > $objCategory->SortOrder) {
        $new_sort_order += 10;
        // increasing sort order so must add another 10
    }
    $objCategory->SortOrder = $new_sort_order;
    $objCategory->Update();
    echo "success";
    exit;
    // just exit since this is an ajax request
}
include "includes/pagetemplate.php";
function PageContent()
{
    ?>
    
        <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
        <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
        <script type="text/javascript">
            $(document).ready(function() {
                // fix to preserve width of cells
                var fixHelper = function(e, ui) {
Example #3
0
<?php

require_once '../../models/Category.php';
if (isset($_POST['id'])) {
    $row = $_POST;
    $response = Category::Update($row);
    if ($response === true) {
        header("Location: index.php");
    }
} else {
    $row = Category::Get($_REQUEST['id']);
}
?>


<!DOCTYPE html>
<html lang="en">
	<?php 
include '../../inc/head.php';
?>
	<body>
		<div>
			<?php 
include '../../inc/nav.php';
?>

			<div id="content">
				
				<?php 
if (isset($response)) {
    ?>