function get_returns($sid, $hash, $pass) { if (!authorize_WS($pass)) { return false; } $session = TestSession::from_property(array("id" => $sid, "hash" => $hash), false); if ($session == null) { return false; } $return = TestSessionReturn::from_property(array("TestSession_id" => $sid)); $result = array(); foreach ($return as $ret) { $result[$ret->name] = $ret->value; } return json_encode($result); }
function get_returns($sid, $hash, $pass, $wid) { if (!authorize_WS($pass)) { return -1; } $workspace = UserWorkspace::from_mysql_id($wid); if ($workspace != null) { mysql_select_db($workspace->db_name); } $session = TestSession::from_property(array("id" => $sid, "hash" => $hash), false); if ($session == null) { return false; } $return = TestSessionReturn::from_property(array("TestSession_id" => $sid)); $result = array(); foreach ($return as $ret) { $result[$ret->name] = $ret->value; } return json_encode($result); }
public static function authorized_session($wid, $id, $hash) { $session = TestSession::from_property(array("id" => $id, "UserWorkspace_id" => $wid, "hash" => $hash), false); if ($session == null) { return null; } switch ($session->status) { case TestSession::TEST_SESSION_STATUS_ERROR: return null; case TestSession::TEST_SESSION_STATUS_TAMPERED: return null; case TestSession::TEST_SESSION_STATUS_COMPLETED: return null; } return $session; }
public function delete_sessions() { $sessions = TestSession::from_property(array("Test_id" => $this->id)); foreach ($sessions as $session) { $session->remove(); } }
<?php /* Concerto Platform - Online Adaptive Testing Platform Copyright (C) 2011-2012, The Psychometrics Centre, Cambridge University This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License, and not any of the later versions. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ if (!isset($ini)) { require_once '../Ini.php'; $ini = new Ini(); } TestSession::change_db($_POST['wid']); $session = TestSession::from_property(array("id" => $_POST['sid'], "hash" => $_POST['hash']), false); if ($session != null) { $session->log_error($_POST['message'], TestSessionLog::TEST_SESSION_LOG_TYPE_JS); }