* @copyright Deakin University 2007,2008 * @package queXS * @subpackage admin * @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2 * * */ /** * Configuration file */ include("../config.inc.php"); /** * Database file */ include ("../db.inc.php"); /** * Authentication */ require ("auth-admin.php"); /** * XHTML functions */ include("../functions/functions.xhtml.php"); $css = array( "../include/bootstrap/css/bootstrap.min.css", "../include/bootstrap/css/bootstrap-theme.min.css", "../include/font-awesome/css/font-awesome.css", "../include/bootstrap-toggle/css/bootstrap-toggle.min.css", "../css/custom.css" ); $js_head = array( "../include/jquery/jquery.min.js", "../include/bootstrap/js/bootstrap.min.js", "../include/bootstrap-toggle/js/bootstrap-toggle.min.js", "../js/window.js" ); $js_foot = array( "../js/bootstrap-confirmation.js", "../js/custom.js" ); global $db; if (isset($_GET['sort_order']) && isset($_GET['sort'])) { $sort_order = $_GET['sort_order']; if ($_GET['sort'] == "up") $so = $sort_order -1; if ($_GET['sort'] == "down") $so = $sort_order +1; $sql = "UPDATE questionnaire_sample SET sort_order = IF(sort_order = $sort_order, $so, $sort_order) WHERE sort_order IN( $sort_order, $so)"; $db->Execute($sql); unset($_GET['sort']); unset($_GET['sort_order']); } /* auto-set continiuos sort_order values for existing questionnaire_samples if not set before or first-time run */ if ($db->GetOne("SELECT COUNT(sort_order) - COUNT(DISTINCT sort_order ) FROM questionnaire_sample") >0){ $db->Execute("SELECT @i := 0"); $db->Execute("UPDATE `questionnaire_sample` SET sort_order = @i:=@i+1 WHERE 1=1 ORDER BY sort_order ASC"); } $subtitle = T_("List and sort samples"); xhtml_head(T_("Sort questionnaire samples"),true,$css,$js_head,false,false,false,$subtitle);//array("../css/table.css"),array("../js/window.js") print " " . T_("Go back") . ""; print "