New Fill In Word
'; echo 'New Fill In Phrase
'; echo 'New f In Word
'; echo 'New Type In Phrase
'; echo 'New Arrange
'; echo 'New Word Scatter
'; echo 'New Picture Scatter
'; echo 'New Space Out
'; echo 'New Listen
'; echo 'New Phrase Scatter
'; */ $questiontype = $_GET['question_type']; $modulid = $_GET['moduleID']; //function select_all($fields, $tables, $conditions = null, $order = null $words = $db->select_all( array( 'content_items.id' => 'wordID', 'content_items.value' => 'word' ), array( 'content_items', 'content_groups' => array('content_groups.id' => 'content_items.group_id'), 'content_types' => array('content_types.id' => 'content_groups.content_type_id') ), array( 'content_groups.content_type_id' => $db->select('id', 'content_types', array('type_name' => 'word')), 'content_items.primary_locale_id' => $_SESSION['secondary_locale'] ) ); //die($questiontype); switch ($questiontype){ case 'fillin': case 'fillIn' : fillin($questionID, $words, $modulid); break; case 'typeIn' : typeIn($questionID, $words, $modulid); break; case 'arrange' : arrange($questionID, $words, $modulid); break; case 'scatterword' : scatterword($questionID, $words, $modulid); break; case 'scatterpicture' : scatterpicture($questionID, $words, $modulid); break; case 'spaceout': case 'spaceOut' : spaceout($questionID, $words, $modulid); break; case 'listen' : listen($questionID, $words, $modulid); break; case 'scatterphrase': case 'scatterPhrase': scatterphrase($questionID, $words, $modulid); break; default : echo 'Invalid Question Type: '.$questiontype.''; break; } } function save($questionID) { /* echo 'New Fill In Word
'; echo 'New Fill In Phrase
'; echo 'New Type In Word
'; echo 'New Type In Phrase
'; echo 'New Arrange
'; echo 'New Word Scatter
'; echo 'New Picture Scatter
'; echo 'New Space Out
'; echo 'New Listen
'; echo 'New Phrase Scatter
'; */ echo '
';
print_r($_GET);
echo '
'; $questiontype = $_GET['question_type']; switch ($questiontype){ case 'fillin': case 'fillIn' : savefillin($questionID); break; case 'typeIn' : savetypeIn($questionID); break; case 'arrange' : savearrange($questionID); break; case 'scatterword' : savescatterword($questionID); break; case 'scatterpicture' : savescatterpicture($questionID); break; case 'spaceout': case 'spaceOut' : savespaceout($questionID); break; case 'listen' : savelisten($questionID); break; case 'scatterphrase': case 'scatterPhrase' : savescatterphrase($questionID); break; default : echo 'broke'; break; } } function delete($questionID){ global $db; $table = 'module_elements'; //$conditions = array('id' => $_GET['questionID']); //$conditions['module_id'] = $quizID; $db->delete($table, array( 'module_id' => $_REQUEST['moduleID'], 'id' => $questionID ) ); header('location:'.THIS_PAGE.'?doThis=list&moduleID='.$_REQUEST['moduleID']); } function listQuestions($zipID) { //default action - lists the questions associated with this quiz //$zipID = 405; //debugging global $db; //$db->echo = true; $games = $db->select_all(array( 'game_type.type_name' => 'type', 'word_element.id' => 'wordID', 'module_group.sequence' => 'dir', 'answer_element.value' => 'correctAnswer', 'clue_element.value' => 'clueData', 'prompt_element.value' => 'prePop', 'audio.location' => 'audioFile', 'word_audio.location' => 'wordAudioFile', 'module_elements.id' => 'KE_value', ), array( 'module_elements', 'module_group' => array('on' => 'content_groups', 'module_group.id' => 'module_elements.content_group_id'), 'game_type' => array('on' => 'content_types', 'game_type.id' => 'module_group.content_type_id'), 'word_element' => array('on' => 'content_items', 'word_element.id' => 'module_elements.content_item_id'), 'word_audio' => array('on' => 'media_assets', 'word_audio.content_group_id' => 'word_element.group_id'), 'clue_rel' => array( 'on' => 'content_group_relationships', 'clue_rel.primary_group_id' => 'module_group.id', 'clue_rel.relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'transzip clue')), ), 'clue_group' => array('on' => 'content_groups', 'clue_group.id' => 'clue_rel.secondary_group_id'), 'clue_element' => array( 'on' => 'content_items', 'clue_element.group_id' => 'clue_group.id', 'clue_element.primary_locale_id' => 'module_elements.primary_locale_id', 'clue_element.secondary_locale_id' => 'module_elements.secondary_locale_id', 'clue_element.weave_level' => 'module_elements.weave_level', ), 'prompt_rel' => array( 'on' => 'content_group_relationships', 'prompt_rel.primary_group_id' => 'module_group.id', 'prompt_rel.relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'transzip prompt')), ), 'prompt_group' => array('on' => 'content_groups', 'prompt_group.id' => 'prompt_rel.secondary_group_id'), 'prompt_element' => array( 'on' => 'content_items', 'prompt_element.group_id' => 'prompt_group.id', 'prompt_element.primary_locale_id' => 'module_elements.primary_locale_id', 'prompt_element.secondary_locale_id' => 'module_elements.secondary_locale_id', 'prompt_element.weave_level' => 'module_elements.weave_level', ), 'answer_rel' => array( 'on' => 'content_group_relationships', 'answer_rel.primary_group_id' => 'module_group.id', 'answer_rel.relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'correct answer')), ), 'answer_group' => array('on' => 'content_groups', 'answer_group.id' => 'answer_rel.secondary_group_id'), 'answer_element' => array( 'on' => 'content_items', 'answer_element.group_id' => 'answer_group.id', 'answer_element.primary_locale_id' => 'module_elements.primary_locale_id', 'answer_element.secondary_locale_id' => 'module_elements.secondary_locale_id', 'answer_element.weave_level' => 'module_elements.weave_level', ), 'audio' => array('on' => 'media_assets', 'audio.content_group_id' => 'answer_group.id') ), array( 'module_elements.module_id' => $zipID, ), 'module_elements.sequence'); echo '
';
	print_r($games);
	echo '
'; HEAD_Includes(); echo '

Questions for Translate Zip '.$zipID.'

'; echo ''; $fanfold = true; /* echo '
';
		print_r($questions);
		echo '
'; */ //function count($fields, $tables, $conditions = null, $allow_deleted = false) { foreach($games AS $question) { if($fanfold){ $rowStyle="fanfold2"; $fanfold = !$fanfold; } else{ $fanfold=!$fanfold; $rowStyle="fanfold1"; } //function select($fields, $tables, $conditions = null, $allow_deleted = false, $group = null) { /* echo '
';
				print_r(get_answers($question));
				echo '
'; */ /* die(); */ switch ($question['type']) { case 'fillIn': $quest = $question['clueData']; $ans = $db->select( array( 'content_items.value' ), array( 'module_elements', 'content_items' => array('content_items.id' => 'module_elements.content_item_id') ), array( 'module_elements.module_id' => $zipID, 'content_items.id' => $question['wordID'] ) ); if (empty($ans['value'])) { $ans = $question['correctAnswer']; } else { $ans = implode(" ", $ans); } break; case 'arrange': $quest = $question['clueData']; $ans = $db->select( array( 'content_items.value' ), array( 'module_elements', 'content_items' => array('content_items.id' => 'module_elements.content_item_id') ), array( 'module_elements.module_id' => $zipID, 'content_items.id' => $question['wordID'] ) ); $ans = implode(" ", $ans); break; case 'typeIn': $quest = $question['clueData']; $ans = $db->select( array( 'content_items.value' ), array( 'module_elements', 'content_items' => array('content_items.id' => 'module_elements.content_item_id') ), array( 'module_elements.module_id' => $zipID, 'content_items.id' => $question['wordID'] ) ); if (empty($ans['value'])) { $ans = $question['correctAnswer']; } else { $ans = implode(" ", $ans); } break; case 'spaceOut': $quest = $question['clueData']; $ans = $question['correctAnswer']; break; case 'scatterWords': $quest = 'No Clue'; $qex = explode(",", $question['prePop']); $ans = array(); for ($i = 0; $i < count($qex); $i++) { $ans[$i] = $db->select( array( 'content_items.value' ), array( 'module_elements', 'content_items' => array('content_items.id' => 'module_elements.content_item_id') ), array( 'module_elements.module_id' => $zipID, 'content_items.id' => $qex[$i] ) ); } $ans = implode(", ", $ans[0]); break; case 'scatterPhrase': $index = $db->select( 'answer.value', array( 'module_elements', 'content_group_relationships' => array('content_group_relationships.primary_group_id' => 'module_elements.content_group_id', 'content_group_relationships.relationship_type_id' => $db->select('id', 'relationship_types', array('relationship_types.type_name' => 'correct answer')) ), 'answer' => array('on' => 'content_items', 'answer.group_id' => 'content_group_relationships.secondary_group_id') ), array( 'module_elements.id' => $question['KE_value'] ) ); $quest = $question['clueData']; $qex = explode(":::", $question['prePop']); $prompt = implode(", ", $qex); $ans = $qex[$index]; break; default: die('Broken'); break; } if (isset($prompt)){ $preprompt = $prompt; } elseif (!empty($question['prePop'])){ $preprompt = $question['prePop']; } else { $preprompt = 'none'; } echo '
';
				print_r($preprompt);
				echo '
'; echo ' '; } echo '
';
		echo '
'; echo '
id Type PrePop Clue(if one exsists) Answer(s)  
'.$question['KE_value'].' '.$question['type'].' '.$preprompt.' '.(!empty($quest)?$quest:'none').' '.$ans.'
'; /* echo '
';
	print_r($zipID);
	echo '
'; TypeIn word TypeIn Phrase FillIn Word Arrange Scatter words Scatter Pictures FillIn Phrase Space Out Listen Scatter Phrase */ echo 'New Fill In
'; echo 'New Type In
'; echo 'New Arrange(Not Working)
'; echo 'New Picture Scatter(Not Working)
'; echo 'New Space Out
'; echo 'New Listen(Not Working)
'; echo 'New Phrase Scatter(Not Working)
'; HTML_Footer(); } function get_questions($moduleID = null, $questionID = null) { global $db; //$db->echo = true; $conditions = array('content_types.type_name'=>array('typeIn', 'fillIn', 'arrange', 'spaceOut', 'listen', 'scatterWords', 'scatterPictures', 'scatterPhrase')); if ($moduleID != null) $conditions['module_elements.module_id'] = $moduleID; if ($questionID != null) $conditions['module_elements.id'] = $questionID; $questions = $db->select_all( array( 'content_groups.id' => 'groupID', 'module_elements.id' =>'element_id', 'module_elements.sequence', 'module_elements.module_id', 'content_items.value'=>'question', 'content_types.type_name'=>'question_type' ), array( 'module_elements', 'content_groups' => array('content_groups.id'=>'module_elements.content_group_id'), 'content_types' => array('content_types.id'=>'content_groups.content_type_id'), 'content_items' => array('content_items.group_id'=>'content_groups.id') ), $conditions ); foreach($questions as $question) { $questionData = get_answers($question); } return $questionData; } function get_answers($question) { global $db; //$db->echo = true; $answerData = array(); switch($question['question_type']) { case 'multiple-choice question' : //$db->echo=true; $question['answers'] = $db->select_all( array(//fields 'answerGroup.id', 'answerGroup.sequence', 'content_items.value'=>'answer', 'relationship_types.type_name'=>'value' ), array(//tables 'content_groups', 'content_group_relationships' => array('content_group_relationships.primary_group_id'=>'content_groups.id'), 'answerGroup' => array('on'=>'content_groups','answerGroup.id'=>'content_group_relationships.secondary_group_id'), 'content_items' => array('content_items.group_id'=>'answerGroup.id'), 'content_types' => array('content_types.id'=>'answerGroup.content_type_id'), 'relationship_types' => array('relationship_types.id'=>'content_group_relationships.relationship_type_id') ), array(//conditions 'content_group_relationships.primary_group_id'=>$question['groupID'], 'content_types.type_name'=>"question answer", 'content_items.primary_locale_id' => $_SESSION['primary_locale'], 'content_items.secondary_locale_id' => $_SESSION['secondary_locale'] ), //order array('sequence','id') ); //die(print_r($question)); break; case 'true/false question' : //return the options True/false, with correct status //$db->echo=true; $answerData = $db->select( //$fields 'property_options.value', array(//$tables 'content_group_properties', 'property_options' => array('property_options.id' => 'content_group_properties.property_id') ), array(//$conditions = null 'content_group_properties.item_id' => $question['groupID'] ) );//select only the correct response $question['answers'] = array(0=>array('value' => $answerData)); break; case 'short-answer question' : //select and return only the correct response // default : //echo '
DEFAULT was selected in get_answers
'; $question['answers'] = $db->select_all( array(//$fields 'answerGroup.id' => 'answerGroup_id', 'answerGroup.sequence', //'questionGroup.id' => 'questionGroup_id', //'questionItem.value' => 'question', 'content_items.value' => 'answer', 'relationship_types.type_name' => 'value' ), array(//$tables 'questionGroup' => 'content_groups', 'content_group_relationships' => array('content_group_relationships.primary_group_id' => 'questionGroup.id'), 'answerGroup' => array('on'=>'content_groups','answerGroup.id'=>'content_group_relationships.secondary_group_id'), 'content_items' => array('content_items.group_id'=>'answerGroup.id'), 'content_types' => array('content_types.id'=>'answerGroup.content_type_id'), 'relationship_types' => array('relationship_types.id'=>'content_group_relationships.relationship_type_id') ), array(//$conditions = null 'content_group_relationships.primary_group_id'=>$question['groupID'], 'content_types.type_name'=>"question answer", 'content_items.primary_locale_id' => $_SESSION['primary_locale'], 'content_items.secondary_locale_id' => $_SESSION['secondary_locale'] ) ); break; default: $question['answers'] = 'undefined'; break; } return $question; } function fillin($questionID, $wordlist, $modulid){ global $db; //die('I will now end so that I dont create to many things'); echo '
';
	print_r($questionID);
	echo '
'; $db->echo=true; //Todo: finish ME $questiondata = $db->select( array( 'answer_item.value' => 'answer', 'clue_item.value' => 'clue', 'prepop_item.value' => 'prepop', 'word_item.value' => 'word', 'module_group.sequence' => 'dir' ), array( 'module_elements', 'word_item' => array('on' => 'content_items', 'word_item.id' => 'module_elements.content_item_id'), 'module_group' => array('on' => 'content_groups', 'module_group.id' => 'module_elements.content_group_id'), 'answer_relation' => array('on' => 'content_group_relationships', 'answer_relation.primary_group_id' => 'module_group.id', 'answer_relation.relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'correct answer'))), 'answer_group' => array('on' => 'content_groups', 'answer_group.id' => 'answer_relation.secondary_group_id'), 'answer_item' => array('on' => 'content_items', 'answer_item.group_id' => 'answer_group.id'), 'clue_relation' => array('on' => 'content_group_relationships', 'clue_relation.primary_group_id' => 'module_group.id', 'clue_relation.relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'transzip clue'))), 'clue_group' => array('on' => 'content_groups', 'clue_group.id' => 'clue_relation.secondary_group_id'), 'clue_item' => array('on' => 'content_items', 'clue_item.group_id' => 'clue_group.id'), 'prepop_relation' => array('on' => 'content_group_relationships', 'prepop_relation.primary_group_id' => 'module_group.id', 'prepop_relation.relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'transzip prompt'))), 'prepop_group' => array('on' => 'content_groups', 'prepop_group.id' => 'prepop_relation.secondary_group_id'), 'prepop_item' => array('on' => 'content_items', 'prepop_item.group_id' => 'prepop_group.id'), ), array( 'module_elements.id' => $questionID ) ); echo '
';
	print_r($questiondata);
	echo '
'; echo '

Fill Word

'; echo '
'; echo' '.$_SESSION['primary_locale_name'].' to '.$_SESSION['secondary_locale_name'].'
'.$_SESSION['secondary_locale_name'].' to '.$_SESSION['primary_locale_name'].'

Instructions: Write your Clue in the box below and the answer in the field labeled Answer. The student will be asked to fill in a word.

'; echo '

Prompt:

'; echo '

Clue:

'; echo '

Answer:



'; } function savefillin($questionID){ global $db; echo 'I am Now on Fillword with the following to work with

'; echo 'POST = '; echo '
';
	print_r($_POST);
	echo '
'; echo '
'; echo 'GET = '; echo '
';
	print_r($_GET);
	echo '
'; echo '
'; echo 'QuestionID = '; echo '
';
	print_r($questionID);
	echo '
'; echo '
'; $db->echo=true; if ($questionID == 'new'){ //A fill in word first needs a Group $element_group_id = $db->insert('content_groups', array( 'content_type_id' => $db->select('id', 'content_types', array('type_name' => 'fillIn')), 'sequence' => $_POST['dir'] ) ); //Lets create a module element! WOO $element_id = $db->insert('module_elements', array( 'module_id' => $_POST['module_id'], 'content_group_id' => $element_group_id, 'primary_locale_id' => $_SESSION['primary_locale'], 'secondary_locale_id' => $_SESSION['secondary_locale'] ) ); //Fillin Phrase Elements //CorrectAnswer -> content_group_relationship -> Content_Group -> Content_items //clueData -> content_group_relationship -> content_group -> content_items //prePop -> content_group_relationships -> content_group -> content_items //correctAnswer //answer_group $answer_group = $db->insert('content_groups', array( 'content_type_id' => $db->select('id', 'content_types', array('type_name' => 'question answer')) ) ); //answer_item $answer_item = $db->insert( 'content_items', array( 'group_id' => $answer_group, 'primary_locale_id' => $_SESSION['primary_locale'], 'secondary_locale_id' => $_SESSION['secondary_locale'], 'value' => $_POST['answer'] ) ); //answer_relation $answer_relation = $db->insert('content_group_relationships', array( 'primary_group_id' => $element_group_id, 'secondary_group_id' => $answer_group, 'relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'correct answer')) ) ); //clueData //clue_group $clue_group = $db->insert('content_groups', array( 'content_type_id' => $db->select('id', 'content_types', array('type_name' => 'clue')) ) ); //clue_item $clue_item = $db->insert( 'content_items', array( 'group_id' => $clue_group, 'primary_locale_id' => $_SESSION['primary_locale'], 'secondary_locale_id' => $_SESSION['secondary_locale'], 'value' => $_POST['question'] ) ); //clue_relation $clue_relation = $db->insert('content_group_relationships', array( 'primary_group_id' => $element_group_id, 'secondary_group_id' => $clue_group, 'relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'transzip clue')) ) ); //prePop //prePop_group $prePop_group = $db->insert('content_groups', array( 'content_type_id' => $db->select('id', 'content_types', array('type_name' => 'prompt')) ) ); //prePop_item $prePop_item = $db->insert( 'content_items', array( 'group_id' => $prePop_group, 'primary_locale_id' => $_SESSION['primary_locale'], 'secondary_locale_id' => $_SESSION['secondary_locale'], 'value' => $_POST['prepop'] ) ); //clue_relation $prePop_relation = $db->insert('content_group_relationships', array( 'primary_group_id' => $element_group_id, 'secondary_group_id' => $prePop_group, 'relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'transzip prompt')) ) ); } else { //TODO SELECT SOMETHIAGN $element_group_id = $db->select('content_groups.id', array( 'module_elements', 'content_groups' => array('content_groups.id' => 'module_elements.content_group_id') ), array( 'module_elements.id' => $questionID ) ); $db->update( array( 'content_groups' ), array( 'content_groups.sequence' => $_POST['dir'] ), array( 'content_groups.id' => $element_group_id ) ); $answer_id = $db->select( 'content_items.id', array( 'module_elements', 'content_groups' => array('content_groups.id' => 'module_elements.content_group_id'), 'content_group_relationships' => array('content_group_relationships.primary_group_id' => 'content_groups.id', 'content_group_relationships.relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'correct answer'))), 'answer_groups' => array('on' => 'content_groups', 'answer_groups.id' => 'content_group_relationships.secondary_group_id'), 'content_items' => array('content_items.group_id' => 'answer_groups.id') ), array( 'module_elements.id' => $questionID ) ); if (!$answer_id){ $answer_group = $db->insert('content_groups', array( 'content_type_id' => $db->select('id', 'content_types', array('type_name' => 'question answer')) ) ); //answer_item $answer_item = $db->insert( 'content_items', array( 'group_id' => $answer_group, 'primary_locale_id' => $_SESSION['primary_locale'], 'secondary_locale_id' => $_SESSION['secondary_locale'], 'value' => $_POST['answer'] ) ); //answer_relation $answer_relation = $db->insert('content_group_relationships', array( 'primary_group_id' => $element_group_id, 'secondary_group_id' => $answer_group, 'relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'correct answer')) ) ); } else { $answer_item = $db->save( array( 'content_items' ), array( 'value' => $_POST['answer'] ), array( 'id' => $answer_id ) ); } $clue_id = $db->select( 'content_items.id', array( 'module_elements', 'content_groups' => array('content_groups.id' => 'module_elements.content_group_id'), 'content_group_relationships' => array('content_group_relationships.primary_group_id' => 'content_groups.id', 'content_group_relationships.relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'transzip clue'))), 'answer_groups' => array('on' => 'content_groups', 'answer_groups.id' => 'content_group_relationships.secondary_group_id'), 'content_items' => array('content_items.group_id' => 'answer_groups.id') ), array( 'module_elements.id' => $questionID ) ); if (!$clue_id) { //clueData //clue_group $clue_group = $db->insert('content_groups', array( 'content_type_id' => $db->select('id', 'content_types', array('type_name' => 'clue')) ) ); //clue_item $clue_item = $db->insert( 'content_items', array( 'group_id' => $clue_group, 'primary_locale_id' => $_SESSION['primary_locale'], 'secondary_locale_id' => $_SESSION['secondary_locale'], 'value' => $_POST['question'] ) ); //clue_relation $clue_relation = $db->insert('content_group_relationships', array( 'primary_group_id' => $element_group_id, 'secondary_group_id' => $clue_group, 'relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'transzip clue')) ) ); } else { //clue_item $clue_item = $db->save( 'content_items', array( 'value' => $_POST['question'] ), array( 'id' => $clue_id ) ); } //prePop //prePop_group $prepop_id = $db->select( 'content_items.id', array( 'module_elements', 'content_groups' => array('content_groups.id' => 'module_elements.content_group_id'), 'content_group_relationships' => array('content_group_relationships.primary_group_id' => 'content_groups.id', 'content_group_relationships.relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'transzip prompt'))), 'answer_groups' => array('on' => 'content_groups', 'answer_groups.id' => 'content_group_relationships.secondary_group_id'), 'content_items' => array('content_items.group_id' => 'answer_groups.id') ), array( 'module_elements.id' => $questionID ) ); if (!$prepop_id) { //prePop_group $prePop_group = $db->insert('content_groups', array( 'content_type_id' => $db->select('id', 'content_types', array('type_name' => 'prompt')) ) ); //prePop_item $prePop_item = $db->insert( 'content_items', array( 'group_id' => $prePop_group, 'primary_locale_id' => $_SESSION['primary_locale'], 'secondary_locale_id' => $_SESSION['secondary_locale'], 'value' => $_POST['prepop'] ) ); //clue_relation $prePop_relation = $db->insert('content_group_relationships', array( 'primary_group_id' => $element_group_id, 'secondary_group_id' => $prePop_group, 'relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'transzip prompt')) ) ); } else{ //prePop_item $prePop_item = $db->save( 'content_items', array( 'value' => $_POST['prepop'] ), array( 'id' => $prepop_id ) ); } //function update($table, $updates, $conditions) { $db->update('module_elements', array( 'content_item_id' => NULL ), array( 'id' => $questionID ) ); } } function typeIn($questionID, $wordlist, $modulid){ global $db; //die('I will now end so that I dont create to many things'); echo '
';
	print_r($questionID);
	echo '
'; $db->echo=true; //Todo: finish ME $questiondata = $db->select( array( 'answer_item.value' => 'answer', 'clue_item.value' => 'clue', 'word_item.value' => 'word', 'module_group.sequence' => 'dir' ), array( 'module_elements', 'word_item' => array('on' => 'content_items', 'word_item.id' => 'module_elements.content_item_id'), 'module_group' => array('on' => 'content_groups', 'module_group.id' => 'module_elements.content_group_id'), 'answer_relation' => array('on' => 'content_group_relationships', 'answer_relation.primary_group_id' => 'module_group.id', 'answer_relation.relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'correct answer'))), 'answer_group' => array('on' => 'content_groups', 'answer_group.id' => 'answer_relation.secondary_group_id'), 'answer_item' => array('on' => 'content_items', 'answer_item.group_id' => 'answer_group.id'), 'clue_relation' => array('on' => 'content_group_relationships', 'clue_relation.primary_group_id' => 'module_group.id', 'clue_relation.relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'transzip clue'))), 'clue_group' => array('on' => 'content_groups', 'clue_group.id' => 'clue_relation.secondary_group_id'), 'clue_item' => array('on' => 'content_items', 'clue_item.group_id' => 'clue_group.id') ), array( 'module_elements.id' => $questionID ) ); echo '
';
	print_r($questiondata);
	echo '
'; echo '

Type Word

'; echo '
'; echo' '.$_SESSION['primary_locale_name'].' to '.$_SESSION['secondary_locale_name'].'
'.$_SESSION['secondary_locale_name'].' to '.$_SESSION['primary_locale_name'].'

Instructions: Write your Clue in the box below and the answer in the field labeled Answer. The student will be asked to fill in a word.

'; echo '

Clue:

'; echo '

Answer:



'; } function savetypeIn($questionID){ global $db; echo 'I am Now on typeIn with the following to work with

'; echo 'POST = '; echo '
';
	print_r($_POST);
	echo '
'; echo '
'; echo 'GET = '; echo '
';
	print_r($_GET);
	echo '
'; echo '
'; echo 'QuestionID = '; echo '
';
	print_r($questionID);
	echo '
'; echo '
'; $db->echo=true; if ($questionID == 'new'){ //A fill in word first needs a Group $element_group_id = $db->insert('content_groups', array( 'content_type_id' => $db->select('id', 'content_types', array('type_name' => 'typeIn')), 'sequence' => $_POST['dir'] ) ); //Lets create a module element! WOO $element_id = $db->insert('module_elements', array( 'module_id' => $_POST['module_id'], 'content_group_id' => $element_group_id, 'primary_locale_id' => $_SESSION['primary_locale'], 'secondary_locale_id' => $_SESSION['secondary_locale'] ) ); //Fillin Phrase Elements //CorrectAnswer -> content_group_relationship -> Content_Group -> Content_items //clueData -> content_group_relationship -> content_group -> content_items //prePop -> content_group_relationships -> content_group -> content_items //correctAnswer //answer_group $answer_group = $db->insert('content_groups', array( 'content_type_id' => $db->select('id', 'content_types', array('type_name' => 'question answer')) ) ); //answer_item $answer_item = $db->insert( 'content_items', array( 'group_id' => $answer_group, 'primary_locale_id' => $_SESSION['primary_locale'], 'secondary_locale_id' => $_SESSION['secondary_locale'], 'value' => $_POST['answer'] ) ); //answer_relation $answer_relation = $db->insert('content_group_relationships', array( 'primary_group_id' => $element_group_id, 'secondary_group_id' => $answer_group, 'relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'correct answer')) ) ); //clueData //clue_group $clue_group = $db->insert('content_groups', array( 'content_type_id' => $db->select('id', 'content_types', array('type_name' => 'clue')) ) ); //clue_item $clue_item = $db->insert( 'content_items', array( 'group_id' => $clue_group, 'primary_locale_id' => $_SESSION['primary_locale'], 'secondary_locale_id' => $_SESSION['secondary_locale'], 'value' => $_POST['question'] ) ); //clue_relation $clue_relation = $db->insert('content_group_relationships', array( 'primary_group_id' => $element_group_id, 'secondary_group_id' => $clue_group, 'relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'transzip clue')) ) ); } else { //TODO SELECT SOMETHIAGN $element_group_id = $db->select('content_groups.id', array( 'module_elements', 'content_groups' => array('content_groups.id' => 'module_elements.content_group_id') ), array( 'module_elements.id' => $questionID ) ); $db->update( array( 'content_groups' ), array( 'content_groups.sequence' => $_POST['dir'] ), array( 'content_groups.id' => $element_group_id ) ); $answer_id = $db->select( 'content_items.id', array( 'module_elements', 'content_groups' => array('content_groups.id' => 'module_elements.content_group_id'), 'content_group_relationships' => array('content_group_relationships.primary_group_id' => 'content_groups.id', 'content_group_relationships.relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'correct answer'))), 'answer_groups' => array('on' => 'content_groups', 'answer_groups.id' => 'content_group_relationships.secondary_group_id'), 'content_items' => array('content_items.group_id' => 'answer_groups.id') ), array( 'module_elements.id' => $questionID ) ); if (!$answer_id){ $answer_group = $db->insert('content_groups', array( 'content_type_id' => $db->select('id', 'content_types', array('type_name' => 'question answer')) ) ); //answer_item $answer_item = $db->insert( 'content_items', array( 'group_id' => $answer_group, 'primary_locale_id' => $_SESSION['primary_locale'], 'secondary_locale_id' => $_SESSION['secondary_locale'], 'value' => $_POST['answer'] ) ); //answer_relation $answer_relation = $db->insert('content_group_relationships', array( 'primary_group_id' => $element_group_id, 'secondary_group_id' => $answer_group, 'relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'correct answer')) ) ); } else { $answer_item = $db->save('content_items', array( 'value' => $_POST['answer'] ), array( 'id' => $answer_id ) ); } $clue_id = $db->select( 'content_items.id', array( 'module_elements', 'content_groups' => array('content_groups.id' => 'module_elements.content_group_id'), 'content_group_relationships' => array('content_group_relationships.primary_group_id' => 'content_groups.id', 'content_group_relationships.relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'transzip clue'))), 'answer_groups' => array('on' => 'content_groups', 'answer_groups.id' => 'content_group_relationships.secondary_group_id'), 'content_items' => array('content_items.group_id' => 'answer_groups.id') ), array( 'module_elements.id' => $questionID ) ); if (!$clue_id){ $clue_group = $db->insert('content_groups', array( 'content_type_id' => $db->select('id', 'content_types', array('type_name' => 'clue')) ) ); //clue_item $clue_item = $db->insert( 'content_items', array( 'group_id' => $clue_group, 'primary_locale_id' => $_SESSION['primary_locale'], 'secondary_locale_id' => $_SESSION['secondary_locale'], 'value' => $_POST['question'] ) ); //clue_relation $clue_relation = $db->insert('content_group_relationships', array( 'primary_group_id' => $element_group_id, 'secondary_group_id' => $clue_group, 'relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'transzip clue')) ) ); } else { //clue_item $clue_item = $db->save( 'content_items', array( 'value' => $_POST['question'] ), array( 'id' => $clue_id ) ); } //function update($table, $updates, $conditions) { $db->update('module_elements', array( 'content_item_id' => NULL ), array( 'id' => $questionID ) ); } } function spaceout($questionID, $words, $modulid){ global $db; //die('I will now end so that I dont create to many things'); echo '
';
	print_r($questionID);
	echo '
'; $db->echo=true; //Todo: finish ME $questiondata = $db->select( array( 'answer_item.value' => 'answer', 'clue_item.value' => 'clue', 'word_item.value' => 'word', 'module_group.sequence' => 'dir', 'prepop_item.value' => 'prepop' ), array( 'module_elements', 'word_item' => array('on' => 'content_items', 'word_item.id' => 'module_elements.content_item_id'), 'module_group' => array('on' => 'content_groups', 'module_group.id' => 'module_elements.content_group_id'), 'answer_relation' => array('on' => 'content_group_relationships', 'answer_relation.primary_group_id' => 'module_group.id', 'answer_relation.relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'correct answer'))), 'answer_group' => array('on' => 'content_groups', 'answer_group.id' => 'answer_relation.secondary_group_id'), 'answer_item' => array('on' => 'content_items', 'answer_item.group_id' => 'answer_group.id'), 'clue_relation' => array('on' => 'content_group_relationships', 'clue_relation.primary_group_id' => 'module_group.id', 'clue_relation.relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'transzip clue'))), 'clue_group' => array('on' => 'content_groups', 'clue_group.id' => 'clue_relation.secondary_group_id'), 'clue_item' => array('on' => 'content_items', 'clue_item.group_id' => 'clue_group.id'), 'prepop_relation' => array('on' => 'content_group_relationships', 'prepop_relation.primary_group_id' => 'module_group.id', 'prepop_relation.relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'transzip prompt'))), 'prepop_group' => array('on' => 'content_groups', 'prepop_group.id' => 'prepop_relation.secondary_group_id'), 'prepop_item' => array('on' => 'content_items', 'prepop_item.group_id' => 'prepop_group.id') ), array( 'module_elements.id' => $questionID ) ); echo '
';
	print_r($questiondata);
	echo '
'; echo '

Space Out

'; echo '
'; echo' '.$_SESSION['primary_locale_name'].' to '.$_SESSION['secondary_locale_name'].'
'.$_SESSION['secondary_locale_name'].' to '.$_SESSION['primary_locale_name'].'

Instructions: Write your Clue in the box below and the answer in the field labeled Answer. The student will be asked to fill in a word.

'; echo '

Prompt:

'; echo '

Clue:

'; echo '

Answer:



'; } function savespaceout($questionID){ global $db; echo 'I am Now on Fillword with the following to work with

'; echo 'POST = '; echo '
';
	print_r($_POST);
	echo '
'; echo '
'; echo 'GET = '; echo '
';
	print_r($_GET);
	echo '
'; echo '
'; echo 'QuestionID = '; echo '
';
	print_r($questionID);
	echo '
'; echo '
'; $db->echo=true; if ($questionID == 'new'){ //A fill in word first needs a Group $element_group_id = $db->insert('content_groups', array( 'content_type_id' => $db->select('id', 'content_types', array('type_name' => 'spaceOut')), 'sequence' => $_POST['dir'] ) ); //Lets create a module element! WOO $element_id = $db->insert('module_elements', array( 'module_id' => $_POST['module_id'], 'content_group_id' => $element_group_id, 'primary_locale_id' => $_SESSION['primary_locale'], 'secondary_locale_id' => $_SESSION['secondary_locale'] ) ); //Fillin Phrase Elements //CorrectAnswer -> content_group_relationship -> Content_Group -> Content_items //clueData -> content_group_relationship -> content_group -> content_items //prePop -> content_group_relationships -> content_group -> content_items //correctAnswer //answer_group $answer_group = $db->insert('content_groups', array( 'content_type_id' => $db->select('id', 'content_types', array('type_name' => 'question answer')) ) ); //answer_item $answer_item = $db->insert( 'content_items', array( 'group_id' => $answer_group, 'primary_locale_id' => $_SESSION['primary_locale'], 'secondary_locale_id' => $_SESSION['secondary_locale'], 'value' => $_POST['answer'] ) ); //answer_relation $answer_relation = $db->insert('content_group_relationships', array( 'primary_group_id' => $element_group_id, 'secondary_group_id' => $answer_group, 'relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'correct answer')) ) ); //clueData //clue_group $clue_group = $db->insert('content_groups', array( 'content_type_id' => $db->select('id', 'content_types', array('type_name' => 'clue')) ) ); //clue_item $clue_item = $db->insert( 'content_items', array( 'group_id' => $clue_group, 'primary_locale_id' => $_SESSION['primary_locale'], 'secondary_locale_id' => $_SESSION['secondary_locale'], 'value' => $_POST['question'] ) ); //clue_relation $clue_relation = $db->insert('content_group_relationships', array( 'primary_group_id' => $element_group_id, 'secondary_group_id' => $clue_group, 'relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'transzip clue')) ) ); //prePop //prePop_group $prePop_group = $db->insert('content_groups', array( 'content_type_id' => $db->select('id', 'content_types', array('type_name' => 'prompt')) ) ); //prePop_item $prePop_item = $db->insert( 'content_items', array( 'group_id' => $prePop_group, 'primary_locale_id' => $_SESSION['primary_locale'], 'secondary_locale_id' => $_SESSION['secondary_locale'], 'value' => $_POST['prepop'] ) ); //clue_relation $prePop_relation = $db->insert('content_group_relationships', array( 'primary_group_id' => $element_group_id, 'secondary_group_id' => $prePop_group, 'relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'transzip prompt')) ) ); } else { //TODO SELECT SOMETHIAGN $element_group_id = $db->select('content_groups.id', array( 'module_elements', 'content_groups' => array('content_groups.id' => 'module_elements.content_group_id') ), array( 'module_elements.id' => $questionID ) ); $db->update( array( 'content_groups' ), array( 'content_groups.sequence' => $_POST['dir'] ), array( 'content_groups.id' => $element_group_id ) ); $answer_id = $db->select( 'content_items.id', array( 'module_elements', 'content_groups' => array('content_groups.id' => 'module_elements.content_group_id'), 'content_group_relationships' => array('content_group_relationships.primary_group_id' => 'content_groups.id', 'content_group_relationships.relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'correct answer'))), 'answer_groups' => array('on' => 'content_groups', 'answer_groups.id' => 'content_group_relationships.secondary_group_id'), 'content_items' => array('content_items.group_id' => 'answer_groups.id') ), array( 'module_elements.id' => $questionID ) ); $answer_item = $db->save( array( 'content_items' ), array( 'value' => $_POST['answer'] ), array( 'id' => $answer_id ) ); $clue_id = $db->select( 'content_items.id', array( 'module_elements', 'content_groups' => array('content_groups.id' => 'module_elements.content_group_id'), 'content_group_relationships' => array('content_group_relationships.primary_group_id' => 'content_groups.id', 'content_group_relationships.relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'transzip clue'))), 'answer_groups' => array('on' => 'content_groups', 'answer_groups.id' => 'content_group_relationships.secondary_group_id'), 'content_items' => array('content_items.group_id' => 'answer_groups.id') ), array( 'module_elements.id' => $questionID ) ); //clue_item $clue_item = $db->save( 'content_items', array( 'value' => $_POST['question'] ), array( 'id' => $clue_id ) ); //prePp //prePop_group $prepop_id = $db->select( 'content_items.id', array( 'module_elements', 'content_groups' => array('content_groups.id' => 'module_elements.content_group_id'), 'content_group_relationships' => array('content_group_relationships.primary_group_id' => 'content_groups.id', 'content_group_relationships.relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'transzip prompt'))), 'answer_groups' => array('on' => 'content_groups', 'answer_groups.id' => 'content_group_relationships.secondary_group_id'), 'content_items' => array('content_items.group_id' => 'answer_groups.id') ), array( 'module_elements.id' => $questionID ) ); //prePop_item $prePop_item = $db->save( 'content_items', array( 'value' => $_POST['prepop'] ), array( 'id' => $prepop_id ) ); //function update($table, $updates, $conditions) { $db->update('module_elements', array( 'content_item_id' => NULL ), array( 'id' => $questionID ) ); } } function scatterphrase($questionID, $words, $modulid){ global $db; //die('I will now end so that I dont create to many things'); echo '
';
	print_r($questionID);
	echo '
'; $db->echo=true; //Todo: finish ME $questiondata = $db->select( array( 'clue_item.value' => 'clue', 'word_item.value' => 'word', 'module_group.sequence' => 'dir', 'prepop_item.value' => 'prepop' ), array( 'module_elements', 'word_item' => array('on' => 'content_items', 'word_item.id' => 'module_elements.content_item_id'), 'module_group' => array('on' => 'content_groups', 'module_group.id' => 'module_elements.content_group_id'), 'clue_relation' => array('on' => 'content_group_relationships', 'clue_relation.primary_group_id' => 'module_group.id', 'clue_relation.relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'transzip clue'))), 'clue_group' => array('on' => 'content_groups', 'clue_group.id' => 'clue_relation.secondary_group_id'), 'clue_item' => array('on' => 'content_items', 'clue_item.group_id' => 'clue_group.id'), 'prepop_relation' => array('on' => 'content_group_relationships', 'prepop_relation.primary_group_id' => 'module_group.id', 'prepop_relation.relationship_type_id' => $db->select('id', 'relationship_types', array('type_name' => 'transzip prompt'))), 'prepop_group' => array('on' => 'content_groups', 'prepop_group.id' => 'prepop_relation.secondary_group_id'), 'prepop_item' => array('on' => 'content_items', 'prepop_item.group_id' => 'prepop_group.id') ), array( 'module_elements.id' => $questionID ) ); $answers = $db->select_all( array( 'answer.id', 'relationship_types.type_name' => 'con' ), array( 'module_elements', 'content_group_relationships' => array('content_group_relationships.primary_group_id' => 'module_elements.content_group_id'), 'relationship_types' => array('relationship_types.id' => 'content_group_relationships.relationship_type_id'), 'content_groups' => array('content_groups.id' => 'content_group_relationships.secondary_group_id', 'content_groups.content_type_id' => $db->select('id', 'content_types', array('content_types.type_name' => 'question answer'))), 'answer' => array('on' => 'content_items', 'answer.group_id' => 'content_groups.id') ), array( '' ) ); echo '
';
	print_r($questiondata);
	echo '
'; echo '

Space Out

'; echo '
'; echo' '.$_SESSION['primary_locale_name'].' to '.$_SESSION['secondary_locale_name'].'
'.$_SESSION['secondary_locale_name'].' to '.$_SESSION['primary_locale_name'].'

Instructions: Write your Clue in the box below and the answer in the field labeled Answer. The student will be asked to fill in a word.

'; echo '

Prompt:

'; echo '

Clue:

'; echo '

Answer:



'; } function savescatterphrase($questionID){ } ?>