session_start(); // Test for essential session variables and trigger an error if they do not exist. $session_id = session_id(); $str = "tA_set RepsTowardM_to_zero.php line 7. Must be in a session to record data to database "; if (!isset($session_id)) { // Trigger fatal error. trigger_error("{$str}", E_USER_ERROR); } $str = "tA_set RepsTowardM_to_zero.php line 12. Session must have a tA_S_ID to record data to database."; if (!isset($_SESSION["tA_S_ID"])) { // Trigger fatal error. trigger_error("Session must have a tA_S_ID to record data to database.", E_USER_ERROR); } $str = "tA_set RepsTowardM_to_zero.php line 17. Session must have a tG_AssignmentName to record data to database."; if (!isset($_SESSION["tG_AssignmentName"])) { // Trigger fatal error. trigger_error("{$str}", E_USER_ERROR); } $str = "tA_set RepsTowardM_to_zero.php line 22. Session must have a tA_StartRec to record data to database."; if (!isset($_SESSION["tA_StartRec"])) { // Trigger fatal error. trigger_error("{$str}", E_USER_ERROR); } //$log_file = fopen("/var/www/tutor/tA_set RepsTowardM_to_zero.php", "a"); //$string="\ntA_set RepsTowardM_to_zero.php"."\n"; //fwrite ( $log_file, $string); require "../classes/Assignment.class.php"; // Here we start to update the assignment. $a = new AssignmentsClass(); // Here we start to update the assignment. $y = $a->set_RepsTowardM_to_zero($_SESSION['tA_S_ID'], $_SESSION["tA_AssignmentsName"], $_SESSION["tA_id"]);
fwrite($log_file, $string); $tA_LastModifiedDateTime = time(); $value_array['tA_Post_date'] = $tA_LastModifiedDateTime + $post_date_time; $string = "\n" . __LINE__ . '$tA_LastModifiedDateTime = ' . $tA_LastModifiedDateTime; fwrite($log_file, $string); $v = var_export($value_array, TRUE); $string = "\n" . __LINE__ . '$value_array["tA_Post_date"] = ' . $v; fwrite($log_file, $string); $value_array["tA_RepsTowardM"] = $tA_RepsTowardM; // Set at lines 75-85 // $value_array['tA_ErrorsMade'] set at line 145 $value_array['tA_LastModifiedDateTime'] = $tA_LastModifiedDateTime; $v = var_export($value_array, TRUE); $string = __LINE__ . ' $value_array = ' . "{$v}\n\n"; fwrite($log_file, $string); $classInstance = new AssignmentsClass(); $returnedValue = $classInstance->updateFields($value_array, $where_array); $string = __LINE__ . ' $returnedValue = ' . $returnedValue . "\n\n"; fwrite($log_file, $string); $string = __LINE__ . ' gettype($returnedValue) = ' . gettype($returnedValue) . "\n\n"; fwrite($log_file, $string); // Returns count of rows affected. if ($returnedValue !== 1) { // Serious Error.. $string = "\n" . __LINE__ . " update_tA_TC.php failed to record data in tAssignments."; fwrite($log_file, $string); } /** * Clone and instert a lesson incremented by one in some lessons. * * Applies to Spelling or typing or some types of math with many parameters.
require "../../vendor/autoload.php"; date_default_timezone_set('UTC'); ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); if (session_status() === PHP_SESSION_NONE) { session_start(); } session_regenerate_id(TRUE); session_destroy(); session_start(); // Must get tA_id for the lesson to be tested. require_once "../test_lesson_include.php"; $_SESSION['tA_S_ID'] = "zxcvb"; $_SESSION['tA_StartRec'] = 1; $class_instance = new AssignmentsClass(); $class_instance->delRowsByStudentId($_SESSION['tA_S_ID']); $target_assignment_name = 'gA_clockwise_counterclockwise'; // $secondary_assignment_name = 'gA_left_right_blocks';. $lessons_to_ta = array(array('ga' => 'gA_left_right_blocks', 'tA_PostDateIncrement' => 0), array('ga' => 'gA_typing_lessons_cl', 'tA_PostDateIncrement' => 0), array('ga' => 'gA_spelling', 'tA_PostDateIncrement' => 0), array('ga' => 'gA_horizontal_vertical_diagonal', 'tA_PostDateIncrement' => 0), array('ga' => 'gA_one_digit_addition_vertical_clues', 'tA_PostDateIncrement' => 0), array('ga' => 'gA_clockwise_counterclockwise', 'tA_PostDateIncrement' => 2)); foreach ($lessons_to_ta as $v1) { $_SESSION['tG_AssignmentName'] = $v1["ga"]; $_SESSION['tA_PostDateIncrement'] = $v1['tA_PostDateIncrement']; $_SESSION['tA_Post_date'] = round(microtime(TRUE), 3, PHP_ROUND_HALF_EVEN) + $_SESSION['tA_PostDateIncrement']; $result = $class_instance->insertRecord($_SESSION); } $result = $class_instance->getSpecificStudentAssignmentFromDbAsArray($_SESSION['tA_S_ID'], $target_assignment_name, $_SESSION['tA_StartRec']); // Echo $_SESSION['tG_AssignmentName'];. $_SESSION['tA_id'] = $result['tA_id']; // Echo $_SESSION['tA_id']; // Load the lesson to test.
session_start(); // Test for essential session variables and trigger an error if they do not exist. $session_id = session_id(); $str = __LINE__ . " tA_set RepsTowardM_to_zero.php Must be in a session to record data to database "; if (!isset($session_id)) { // Trigger fatal error. trigger_error("{$str}", E_USER_ERROR); } $str = __LINE__ . " increment_tA_ErrorsMade.php Session must have a tA_S_ID to record data to database."; if (!isset($_SESSION["tA_S_ID"])) { // Trigger fatal error. trigger_error("Session must have a tA_S_ID to record data to database.", E_USER_ERROR); } $str = __LINE__ . " increment_tA_ErrorsMade.php Session must have a tG_AssignmentName to record data to database."; if (!isset($_SESSION["tG_AssignmentName"])) { // Trigger fatal error. trigger_error("{$str}", E_USER_ERROR); } $str = __LINE__ . " increment_tA_ErrorsMade.php Session must have a lesson_id to record data to database."; if (!isset($_SESSION["lesson_id"])) { // Trigger fatal error. trigger_error("{$str}", E_USER_ERROR); } //$log_file = fopen("/var/www/tutor/tA_set RepsTowardM_to_zero.php", "a"); //$string="\ntA_set RepsTowardM_to_zero.php"."\n"; //fwrite ( $log_file, $string); require "../classes/Assignment.class.php"; // Here we start to update the assignment. $a = new AssignmentsClass(); // Here we start to update the assignment. $y = $a->increment_tA_ErrorsMade($_SESSION['tA_S_ID'], $_SESSION["tA_AssignmentsName"], $_SESSION["lesson_id"]);
/** * Test cAssignmentGetNextLesson(). */ public function testcAssignmentGetNextLesson() { /* Tests cAssignment_get_next_lesson.php Does not show up on missing tests because cAssignments is not in assignments.class Function cAssignments_get_next_lesson is called from javascript. */ // Next reset myArray to origninal values. $this->resetMyArray(); // Add a new row to delete. $ac_class_instance = new AssignmentsClass(); $this->assertTrue(isset($ac_class_instance)); $ac_class_instance->delRowsByStudentId($this->myArray['tA_S_ID']); $temp_student_id = 'abcdefg'; $this->myArray['tA_S_ID'] = $temp_student_id; // Set to a different value. $ac_class_instance->delRowsByStudentId($temp_student_id); // Insure no previous lessons for this student. $result = $ac_class_instance->insertRecord($this->myArray); $this->assertTrue($result == 1); $_SESSION['tA_S_ID'] = $temp_student_id; $ac_class_instance->delRowsByStudentId('abcdefg'); }
// This file requires, as input, a student id. // Insure the student identifier is present. Error if not found. if (empty($_data['tA_S_ID']) === TRUE) { $msg = ' cAssignment_get_next_lesson.php Must have "tA_S_ID" in $_data.'; $msg = $msg . "\n" . __LINE__ . ' Missing $_data["tA_S_ID"] can not proceed'; trigger_error($msg, E_USER_ERROR); } // Now get the student information and set all session variables. $_data['tA_S_ID'] = filter_var($_data['tA_S_ID'], FILTER_UNSAFE_RAW); $string = "\n" . __LINE__ . ' $_data["tA_S_ID"] = ' . $_data['tA_S_ID']; fwrite($log_file, $string . "\n\n"); $_data['last_gA'] = NULL; // Prime session with the existing relevant data. $_SESSION = $_data; // Get next assignment to do from the login data. $next_lesson = new AssignmentsClass(); // Return a single lesson as a tAssignments row. $lesson = $next_lesson->getNextAssignmentToDo($_data['tA_S_ID'], $_data['tA_id']); $v = var_export($lesson, TRUE); $string = "\n" . __LINE__ . ' $lesson = ' . $v . "\n\n"; fwrite($log_file, $string . "\n"); if (is_null($lesson) == TRUE) { $msg = $msg . "\n" . __LINE__ . ' No lesson found.'; trigger_error($msg, E_USER_ERROR); } // From the assignment name retrieve the generic assignment and assign // its variables to the $_SESSION variable. $my_next_ga = new GenericAClass(); $the_ga = $my_next_ga->getRowFromDbAsArray($lesson['tG_AssignmentName']); // Pack all tGenericAssignment data into session varaiable. foreach ($the_ga as $key => $value) {