<?php

session_start();
header("Cache-control: private");
//IE 6 Fix
include "includes/config.php";
include "includes/checklogin.php";
include "../inc/classes/Testimonial.php";
include "../inc/classes/Helpers.php";
if (isset($_REQUEST['mode']) && $_REQUEST['mode'] == 'sort') {
    $objTestimonial = new Testimonial();
    $objTestimonial->SortValues(substr($_REQUEST['action'], 1), substr($_REQUEST['action'], 0, 1));
    unset($objTestimonial);
} elseif (isset($_REQUEST['dragsort'])) {
    // handle drag sort ajax request:
    $objTestimonial = new Testimonial($_REQUEST['id']);
    $new_sort_order = $_REQUEST['idx'] * 10 + 5;
    if ($new_sort_order > $objTestimonial->SortOrder) {
        $new_sort_order += 10;
        // increasing sort order so must add another 10
    }
    $objTestimonial->SortOrder = $new_sort_order;
    $objTestimonial->Update();
    echo "success";
    exit;
    // just exit since this is an ajax request
}
include "includes/pagetemplate.php";
function PageContent()
{
    ?>