<?php
/*
	Copyright(c) 2010 Shift Tech Inc. All Rights Reserved.
 	http://www.shift-tech.jp/
*/

require_once("../../../../../app_path.php");
include_once(APP_PATH.'/AdminController.php');
$obj = new AdminController();
$obj->model =new Model();

switch($obj->model->getRequest("mode")) {
	case "add":
		break;
	case "sort":
		$pagec_code = explode(",",$obj->model->getRequest("pagec_code"));
		unset($_SESSION["form_container"]);
		$_SESSION["form_container"] = $pagec_code;

		$db	 = new DataBase();
		$db->query('BEGIN');
		foreach ($_SESSION["form_container"] as $key => $val) {
			$sql= "update mdl_extMdlFormGnrtr_tbl_part set prt_part_order = " . $key . " where prt_part_id =" . $val;
			if (!$db->query($sql)) {
				$db->query('ROLLBACK');
				break;
			}
		}
		$db->query('COMMIT');
		break;
	case "delete":
		break;
	default:
		break;
}
?>