From: pkiddie <pk...@us...> - 2005-07-18 10:07:28
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26321/scripts Modified Files: stackAuthor.php stackQuestion.php stackWin.php stackXML.php Log Message: Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackAuthor.php,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** stackAuthor.php 14 Jul 2005 07:27:03 -0000 1.26 --- stackAuthor.php 18 Jul 2005 10:07:18 -0000 1.27 *************** *** 8,12 **** */ - //****************************************************** //** Edit options --- 8,11 ---- *************** *** 61,64 **** --- 60,98 ---- } + //<PDK> Added new function for stackQuestion fields + /** + * Generates the portion of the HTML question edit form for editing metadata of with an array of fields + * + * Checks that specified field is of type meta and that an array of values is present. If so, draw a list + * box with all the fields. As these fields contain optional data - they default to 'unspecified' + * + * @param string $name The name of the field in the form + * @param string $opt The option key + * @param mixed $optval The currently set value + * @param int $sz The size of the answer boxes + * @return void + */ + //$qfield,$question[$qfield],$errors, qfield = questionLanguage + function stack_question_edit_metadata_form($name,$opt,$optval,$sz=8) { + global $stackQuestion; + + $fields = $stackQuestion[$opt]; + //Must be of type meta + if ('meta'==$fields['type']) { + if (is_array( $fields['values'])) { //Check that there is an array (list type) in the values tag + echo "\n<select name=\"$name\">\n"; + if ('default'==$optval){echo " <option value='default' selected>default</option>\n";} + else {echo " <option value='default'>default</option>\n";} + + foreach ($fields['values'] as $vals) { + if ($vals==$optval) {echo " <option value='$vals' selected>$vals</option>\n";} + else {echo " <option value='$vals'>$vals</option>\n";} + } + + echo " </select>\n"; + } + } + } + /** * Build the form to edit a list of STACK options. *************** *** 119,122 **** --- 153,157 ---- function stack_question_edit_form($question,&$errors,$PostTo = '') { global $_PHP_SELF; + //show_array($question); if (empty($PostTo)) { *************** *** 169,176 **** --- 204,216 ---- // Add all the metadata to the question. + // <PDK> Added hidden metadata here echo "\n<hr />\n <input type='hidden' name='questionID' value='".sf($question,'questionID')."' />\n <input type='hidden' name='questionGUID' value='".sf($question,'questionGUID')."' />\n <input type='hidden' name='questionDateLastEdited' value='$t' />\n + <input type='hidden' name='questionPublisher' value='".sf($question,'questionPublisher')."' />\n + <input type='hidden' name='questionType' value='".sf($question,'questionType')."' />\n + <input type='hidden' name='questionFormat' value='".sf($question,'questionFormat')."' />\n + <table cellboarder='0' cellpadding='2'> <tr> <td>".get_string('stackQuestion_questionName','stack','').":</td> *************** *** 180,185 **** <tr> <td>".get_string('stackQuestion_questionKeywords','stack','').":</td> <td><input type='input' name='questionKeywords' value='".sf($question,'questionKeywords')."' size='60' /></tr> </table> "; ! // HACK: the field type in the database does not // allow these to be edited yet. --- 220,226 ---- <tr> <td>".get_string('stackQuestion_questionKeywords','stack','').":</td> <td><input type='input' name='questionKeywords' value='".sf($question,'questionKeywords')."' size='60' /></tr> + </table> "; ! // HACK: the field type in the database does not // allow these to be edited yet. *************** *** 329,333 **** echo "</p>"; } ! $options_headings = array(get_string('stackOptions_edit_inmeth','stack'),'','','',get_string('stackOptions_edit_resppro','stack'),'','','','','',get_string('stackOptions_edit_out','stack'),''); $options_list = array('InsertStars','InformalSyntax','AllowInputTool','SyntaxHint','Forbid','Allow','MarkModMethod','FeedBackGenericCorrect','FeedBackGenericPCorrect','FeedBackGenericIncorrect','Display','ShowSol'); --- 370,459 ---- echo "</p>"; } ! ! //<PDK> Insert user definable metadata here ! /* echo "\n<hr />\n ! <table cellboarder='0' cellpadding='2'> ! <tr> <td>".get_string('stackQuestion_questionLanguage','stack','').":</td> ! <td><input type='input' name='questionLanguage' value='".sf($question,'questionLanguage')."' size='10' /></tr> ! <tr> <td>".get_string('stackQuestion_questionLearningContext','stack','').":</td> ! <td><input type='input' name='questionLearningContext' value='".sf($question,'questionLearningContext')."' size='20' /></tr> ! <tr> <td>".get_string('stackQuestion_questionDifficulty','stack','').":</td> ! <td><input type='input' name='questionDifficulty' value='".sf($question,'questionDifficulty')."' size='20' /></tr> ! <tr> <td>".get_string('stackQuestion_questionCompetency','stack','').":</td> ! <td><input type='input' name='questionCompetency' value='".sf($question,'questionCompetency')."' size='20' /></tr> ! <tr> <td>".get_string('stackQuestion_questionCompetencyLevel','stack','').":</td> ! <td><input type='input' name='questionCompetencyLevel' value='".sf($question,'questionCompetency')."' size='20' /></tr> ! <tr> <td>".get_string('stackQuestion_questionTimeAllocated','stack','').":</td> ! <td><input type='input' name='questionTimeAllocated' value='".sf($question,'questionTimeAllocated')."' size='20' /></tr> ! <tr> <td>".get_string('stackQuestion_questionExcerciseType','stack','').":</td> ! <td><input type='input' name='questionExcerciseType' value='".sf($question,'questionExcerciseType')."' size='20' /></tr> ! </table> "; */ ! ! include('stackXML.php'); ! stack_schema_write_metadata(""); ! ! echo "\n<hr />\n"; ! ! $qfield='questionLanguage'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! @stack_question_edit_metadata_form($qfield_name,$qfield,$errors); ! ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! ! $qfield='questionLearningContext'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! @stack_question_edit_metadata_form($qfield_name,$qfield,$errors); ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! ! ! $qfield='questionDifficulty'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! @stack_question_edit_metadata_form($qfield_name,$qfield,$errors); ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! $qfield='questionCompetency'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! @stack_question_edit_metadata_form($qfield_name,$qfield,$errors); ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! $qfield='questionCompetencyLevel'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! @stack_question_edit_metadata_form($qfield_name,$qfield,$errors); ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! $qfield='questionExcerciseType'; ! $qfield_name = "question[{$qfield}]"; ! echo "<br /><b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! @stack_question_edit_metadata_form($qfield_name,$qfield,$errors); ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! $qfield='questionTimeAllocated'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! echo "<input type='input' name='questionTimeAllocated' value='".sf($question,'questionTimeAllocated')."' size='20' />"; ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! $qfield='questionRights'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! echo "<input type='input' name='questionRights' value='".sf($question,'questionRights')."' size='20' />"; ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! echo "\n<hr />\n"; $options_headings = array(get_string('stackOptions_edit_inmeth','stack'),'','','',get_string('stackOptions_edit_resppro','stack'),'','','','','',get_string('stackOptions_edit_out','stack'),''); $options_list = array('InsertStars','InformalSyntax','AllowInputTool','SyntaxHint','Forbid','Allow','MarkModMethod','FeedBackGenericCorrect','FeedBackGenericPCorrect','FeedBackGenericIncorrect','Display','ShowSol'); Index: stackXML.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackXML.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** stackXML.php 20 Jun 2005 15:42:55 -0000 1.3 --- stackXML.php 18 Jul 2005 10:07:18 -0000 1.4 *************** *** 2,6 **** /** ! * XML import and export of STACK questions. * * @package scripts --- 2,6 ---- /** ! * Defines XML handling within STACK * * @package scripts *************** *** 8,11 **** --- 8,24 ---- */ + //<PDK> sqlToSchemaMapping array maps basic SQL data types used in STAKCK to their respective XML schema data types + $sqlToSchemaMapping['CHAR']='string'; + $sqlToSchemaMapping['VARCHAR']='string'; + $sqlToSchemaMapping['TEXT']='string'; + $sqlToSchemaMapping['TINYTEXT']='string'; + $sqlToSchemaMapping['INT']='int'; + $sqlToSchemaMapping['INT UNSIGNED']='int'; + $sqlToSchemaMapping['DECIMAL']='decimal'; + $sqlToSchemaMapping['DATE']='date'; + $sqlToSchemaMapping['TIME']='time'; + $sqlToSchemaMapping['DATETIME']='dateTime'; + $sqlToSchemaMapping['TIMESTAMP']='time'; + /** * Writes a single stackQuestion data structure to an XML string. *************** *** 218,220 **** --- 231,643 ---- } + //<PDK> + /** + * Writes an XML schema file of the current metadata tags used in STACK + * + * XML schema used within STACK to validate questions on import/export, and provide a definition of the metadata document + * + * @param string $directory The directory to store the XSD file (web server must have permissions) + * @return the XSD filename representing the schema + */ + function stack_schema_write_metadata($directory) + { + //take the stackQuestion and extract all the current metadata tags, putting them into a schema + //file extension .xsd represents schema + $schema_file_name='stack_metadata.xsd'; + //create file used for writing + $xml_file_handle = fopen($directory.$schema_file_name,"w"); + + if (!$xml_file_handle) + { + echo "File could not be opened for writing. Please contact the network administrator."; + } + + else + { + //Write the XML schema header - same for all XML schemas + $xml = '<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">'. + "\n". + '<xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/03/xml.xsd"/>'. + //Create root element 'metadata' + stack_schema_create_root("metadata"). + stack_schema_create_metadata(). + stack_schema_escape_root(). + stack_schema_create_enum_types(). + //End of schema + '</xs:schema>'; + + //write out xml string + fputs($xml_file_handle,$xml); + //close xml file + fclose($xml_file_handle); + } + + return $schema_file_name; + } + + /** + * Creates the root element of an XML schema definition + * IMPORTANT TO CALL FIRST BEFORE CREATION OF METADATA ELEMENTS + * + * @param string $rootElement The root element to create + * @return string root element as XML string + */ + function stack_schema_create_root($rootElement) + { + return "<xs:element name=".'"'.$rootElement.'">'. + '<xs:complexType>'. + '<xs:sequence>'; + } + + /** + * Terminates the root element of an XML schema definition + * + * @return string root element termination as an XML string + */ + function stack_schema_escape_root() + { + return '</xs:sequence>'. + '</xs:complexType>'. + "</xs:element>"; + } + + /** + * Writes the current stackQuestion metadata structure to an XML string + * + * Iterates through each of the fields within the stackQuestion array. If the type 'meta' is detected, (ignoring the internal SQL + * questionID and body), the relevant documentation is looked up and a schema element is written out, of the correct type + * + * Will not write an field out that is marked as 'meta' and does not have a 'metatag' value, but will raise an error. + * + * @param + * @return the XML string representing the entire metadata schema + */ + function stack_schema_create_metadata() + { + global $stackQuestion; //use definitive stackQuestion data structure + global $sqlToSchemaMapping; + + $xml = ""; + + //Do not export questionID - internal SQL variable + if (array_key_exists('questionID',$stackQuestion)) { + unset($stackQuestion['questionID']); + } + + //Do not export body - internal SQL variable. + if (array_key_exists('questionBody',$stackQuestion)) { + unset($stackQuestion['questionBody']); + } + + foreach($stackQuestion as $arrayKey=>$questionField) //Iterate through sub array of each array object + { + //Array item is metadata + if ($questionField['type']=='meta') { + + //Check that a metadata tag has been supplied and do not write out if tag has not been supplied + if (empty($questionField['metatag'])) + { + echo'No metadata tag for stackQuestion field: '.$arrayKey.'.<br> As a consequence it has not been written to the XML metadata schema'; + } + + else + { + //If metadata is not a selection from a list of specified types + if (empty($questionField['values'])) + { + //Create XML schema fragment + //Documentation available for column + if (!empty($questionField['doc'])) { + $xml.=stack_schema_write_element_document($questionField['metatag'],$questionField['mysql'],$questionField['doc']); + + } + + //Documentation not available for column + else { + //echo "Doucmentation not avilable!"; + $xml.=stack_schema_write_element($questionField['metatag'],$questionField['mysql']); + } + } + + //The values field is not empty + else + { + //Create XML schema fragment, and default possible enumeration simpleTypes to be the lower case + //of the current metadata tag + if (!empty($questionField['doc'])) { + $xml.=stack_schema_write_element_document_enum_type($questionField['metatag'],strtolower($questionField['metatag']),$questionField['doc']); + + } + + //Documentation not available for column + else { + $xml.=stack_schema_write_element_enum_type($questionField['metatag'],strtolower($questionField['metatag'])); + } + + //Furthermore, need to create + } + + + } + } + } + + return $xml; + } + + /** + * Writes a given field within stackQuestion as a schema element, with a representative XML schema datatype + * + * First ensure a 'datatype' has been declared otherwise default to a string. If a datatype has been declared then convert to upper case. + * Then seperate the first 'word' of the datatype, is this contains the important SQL datatype, and remove any array indicators from the + * datatype. + * + * Example: + * <xs:element name="Keyword" type="xs:string"/> + * + * @param string $elementName The name of the schema element + * @param string $elementType The datatype of the schema element to be represented + * @return string $xml the XML string representing the schema element + */ + function stack_schema_write_element($elementName, $elementType) + { + global $sqlToSchemaMapping; + + //Error checking code + //1. If there is no type associated with the element, then default to a string + if (empty($elementType)) + { + + //SQL type - text = XML schema type - string + $elementType='TEXT'; + } + + //2. Ensure element type is upper case to ensure comparison array (SQL->XML variable) will work. + else + { + $elementType = strtoupper($elementType); + } + + //3. Now we are only interested in the first word of the SQL datatype in order to convert to XML datatype, hence explode + //Make sensitive to white space + $elementDataType = explode(" ", $elementType); + + //4. But we also can have SQL datatypes which give array length - CHAR(22) for example - we are not interested in this + //Make sensitive to open bracket + $elementDataType = explode("(", $elementDataType[0]); + + echo $sqlToSchemaMapping[$elementDataType[0]]; + + return "<xs:element name=".'"'.$elementName.'"'.' type="xs:'.$sqlToSchemaMapping[$elementDataType[0]].'"/>'; + } + + /** + * Writes a given field within stackQuestion as a schema element, with a representative XML schema datatype, and documentation for that element + * + * First ensure a 'datatype' has been declared otherwise default to a string. If a datatype has been declared then convert to upper case. + * Then seperate the first 'word' of the datatype, is this contains the important SQL datatype, and remove any array indicators from the + * datatype. + * + * Example: + * <xs:element name="Keyword" type="xs:string"> + * <xs:annotation> + * <xs:documentation>Keywords, for searching over banks of questions. Note that any question with the keyword 'demo' will appear + * as a demo question for guest users and students to try and edit.</xs:documentation> + * </xs:annotation> + * </xs:element> + * + * @param string $elementName The name of the schema element + * @param string $elementType The datatype of the schema element to be represented + * @return string $xml the XML string representing the schema element + */ + function stack_schema_write_element_document($elementName, $elementType, $documentTag) + { + global $sqlToSchemaMapping; + + //Error checking code + //1. If there is no type associated with the element, then default to a string + if (empty($elementType)) + { + + //SQL type - text = XML schema type - string + $elementType='TEXT'; + } + + //2. Ensure element type is upper case to ensure comparison array (SQL->XML variable) will work. + else + { + $elementType = strtoupper($elementType); + } + + //3. Now we are only interested in the first word of the SQL datatype in order to convert to XML datatype, hence explode + //Make sensitive to white space + $elementDataType = explode(" ", $elementType); + + //4. But we also can have SQL datatypes which give array length - CHAR(22) for example - we are not interested in this + //Make sensitive to open bracket + $elementDataType = explode("(", $elementDataType[0]); + + $xml = "<xs:element name=".'"'.$elementName.'"'.' type="xs:'.$sqlToSchemaMapping[$elementDataType[0]].'">'; + + //Add documentation to element + $xml.= '<xs:annotation><xs:documentation>'. + $documentTag. + '</xs:documentation></xs:annotation>'. + '</xs:element>'; + + return $xml; + } + + /** + * Writes a field within stackQuestion of 'list' type as an element which references a list of enumerated types within a simpleType XML + * schema definition giving the possible values the field can take + * + * Example: + * <xs:element name="LearningContext" type="learningcontext"/> + * + * @param string $elementName The name of the schema element + * @param string $elementType The datatype of the possible enumerations + * @return string the XML string representing the schema element + */ + function stack_schema_write_element_enum_type($elementName, $elementType) + { + //Error checking code + //1. If there is no type associated with the element, return an empty string - this should not be possible + if (empty($elementType)) + { + return ""; + } + + else + { + return "<xs:element name=".'"'.$elementName.'"'.' type='.'"'.$elementType.'"'.'/>'; + } + } + + /** + * Writes a field within stackQuestion of 'list' type as an element which references a list of enumerated types within a simpleType XML + * schema definition giving the possible values the field can take, along with documentation for that field - taken from stackQuestion['field']['doc']. + * + * Example: + * <xs:element name="LearningContext" type="learningcontext"> + * <xs:annotation> + * <xs:documentation>Describes the educational context of the intended target audience of the resource. + * User defined list type</xs:documentation> + * </xs:annotation> + * </xs:element> + * + * @param string $elementName The name of the schema element + * @param string $elementType The datatype of the possible enumerations + * @return string $xml the XML string representing the schema element + */ + function stack_schema_write_element_document_enum_type($elementName, $elementType, $documentTag) + { + //Error checking code + //1. If there is no type associated with the element, then return an empty string - cannot continue! + if (empty($elementType)) + { + + return ""; + } + + //Otherwise elementType is given the lowercase of the metadata tag - correct XML schema construct. + else + { + + $xml = "<xs:element name=".'"'.$elementName.'"'.' type='.'"'.$elementType.'">'; + + //Add documentation to element + $xml.= '<xs:annotation><xs:documentation>'. + $documentTag. + '</xs:documentation></xs:annotation>'. + '</xs:element>'; + + return $xml; + } + } + + //This function like before iterates through each of the metadata values and if a list type has been detected write this out! + + /** + * Writes the current stackQuestion enumeration types to an XML string + * + * Iterates through each of the fields within the stackQuestion array. If the type 'meta' is detected, (ignoring the internal SQL + * questionID and body), and a list of values exist, an XML schema simpleType is created which encapsulates these. + * + * Will not write an field out that is marked as 'meta' and does not have a 'metatag' value, but will raise an error. + * + * @return string $xml the XML string representing the entire metadata schema + */ + function stack_schema_create_enum_types() + { + global $stackQuestion; + + $xml = ""; + + foreach($stackQuestion as $arrayKey=>$questionField) //Iterate through sub array of each array object + { + //Array item is metadata + if ($questionField['type']=='meta') { + + //check to see whether an enum type of values needs to be written out + if (!empty($questionField['values'])) + { + //Check that a metadata tag has been supplied and do not write out if tag has not been supplied + if (empty($questionField['metatag'])) + { + echo'No metadata tag for stackQuestion field: '.$arrayKey.'.<br> As a consequence this enum type has not been written to the XML metadata schema'; + } + + else + { + $xml.=stack_schema_create_simpletype($questionField['metatag'],$questionField['values']); + } + } + } + } + + return $xml; + } + + /** + * Creates the XML schema simple type containing a list of possible enumerations for the selected type + * + * Iterates through each of the fields within the stackQuestion array. If the type 'meta' is detected, (ignoring the internal SQL + * questionID and body), and a list of values exist, an XML schema simpleType is created which encapsulates these. + * Will not write an field out that is marked as 'meta' and does not have a 'metatag' value, but will raise an error. + * Example: + * <xs:simpleType name="language"> + * <xs:annotation> + * <xs:documentation>ISO 639 languages</xs:documentation> + * </xs:annotation> + * <xs:restriction base="xs:string"> + * <xs:length value="2" /> + * <xs:enumeration value="en" /> + * <xs:enumeration value="fr" /> + * <xs:enumeration value="nl" /> + * <xs:enumeration value="es" /> + * </xs:restriction> + * </xs:simpleType> + * @param string $simpleTypeName the name of the field - usually lower case derivative of 'metatag' + * @param array $possibleValues the possible enumerations of that field + * @return string $xml the XML string representing the entire simpleType + */ + function stack_schema_create_simpletype($simpleTypeName,$possibleValues) + { + //Begin element definition + $xml = "<xs:simpleType name=".'"'.$simpleTypeName.'"'.">"; + $xml.= '<xs:restriction base="xs:string">'; + + foreach ($possibleValues as $value) //Iterate through each of the possible values + { + $xml.= "<xs:enumeration value=".'"'.$value.'"'."/>"; //Add to XML enumeration + } + + //Terminate element definition + $xml.= "</xs:restriction></xs:simpleType>"; + + return $xml; + } + + ?> Index: stackWin.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackWin.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** stackWin.php 14 Jul 2005 08:46:53 -0000 1.5 --- stackWin.php 18 Jul 2005 10:07:18 -0000 1.6 *************** *** 92,97 **** if(is_resource($TeXProcess)) { - //echo $strin; - if (!fwrite($pipes[0], $stack_cas['initCommand'])) { echo "<br />Could not write to the CAS process!<br/ >\n"; --- 92,95 ---- *************** *** 134,138 **** //This is useful for debuggin. Removing the comments below will echo //exactly the CAS session ! //echo "<pre>".$ret."</pre>"; $ret = trim($ret); --- 132,136 ---- //This is useful for debuggin. Removing the comments below will echo //exactly the CAS session ! echo "<pre>".$ret."</pre>"; $ret = trim($ret); Index: stackQuestion.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuestion.php,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** stackQuestion.php 14 Jul 2005 16:18:19 -0000 1.24 --- stackQuestion.php 18 Jul 2005 10:07:18 -0000 1.25 *************** *** 208,211 **** --- 208,212 ---- $stackQuestion['questionGUID']['required']='system'; $stackQuestion['questionGUID']['mysql']='CHAR(22) UNIQUE KEY'; //GUID's are 32byte characters + $stackQuestion['questionGUID']['metatag']='Identifier'; // 'Name'; *************** *** 213,216 **** --- 214,218 ---- $stackQuestion['questionName']['required']='optional'; $stackQuestion['questionName']['mysql']='TINYTEXT'; + $stackQuestion['questionName']['metatag']='Title'; // 'Description'; *************** *** 218,221 **** --- 220,224 ---- $stackQuestion['questionDescription']['required']='optional'; $stackQuestion['questionDescription']['mysql']='TEXT'; + $stackQuestion['questionDescription']['metatag']='Description'; // 'Keywords'; *************** *** 223,226 **** --- 226,230 ---- $stackQuestion['questionKeywords']['required']='optional'; $stackQuestion['questionKeywords']['mysql']='TINYTEXT'; + $stackQuestion['questionKeywords']['metatag']='Keyword'; // 'Body'; *************** *** 233,236 **** --- 237,241 ---- $stackQuestion['questionUserLastEdited']['required']='system'; $stackQuestion['questionUserLastEdited']['mysql']='INT UNSIGNED'; + $stackQuestion['questionUserLastEdited']['metatag']='Creator'; // 'Last edited on'; *************** *** 238,241 **** --- 243,340 ---- $stackQuestion['questionDateLastEdited']['required']='system'; $stackQuestion['questionDateLastEdited']['mysql']='TIMESTAMP'; + $stackQuestion['questionDateLastEdited']['metatag']='Date'; + + //Tags to be added to SQL server + //Publisher + $stackQuestion['questionPublisher']['type']='meta'; + $stackQuestion['questionPublisher']['required']='system'; + $stackQuestion['questionPublisher']['mysql']='TINYTEXT'; + $stackQuestion['questionPublisher']['metatag']='Publisher'; + + //Type: Hidden from user + $stackQuestion['type']['type']='meta'; + $stackQuestion['type']['values']=array('question','quiz'); //Default to 'type' enumeration in XSD file + $stackQuestion['type']['required']='optional'; + $stackQuestion['type']['mysql']='TINYTEXT'; + $stackQuestion['type']['metatag']='Type'; + + //Format: Hidden from user, selected by script + $stackQuestion['questionFormat']['type']='meta'; + $stackQuestion['questionFormat']['values']=array('application','audio','image', + 'message','model','text','video', + 'multipart'); + $stackQuestion['questionFormat']['required']='optional'; + $stackQuestion['questionFormat']['mysql']='TINYTEXT'; + $stackQuestion['questionFormat']['metatag']='Format'; + + //Language: Defaulted to current system language, but user definable + $stackQuestion['questionLanguage']['type']='meta'; + $stackQuestion['questionLanguage']['values']=array('en','fr','nl','es','unspecified'); + $stackQuestion['questionLanguage']['required']='optional'; + $stackQuestion['questionLanguage']['mysql']='TINYTEXT'; + $stackQuestion['questionLanguage']['metatag']='Language'; + $stackQuestion['questionLanguage']['default']='unspecified'; + + //Rights + $stackQuestion['questionRights']['type']='meta'; + $stackQuestion['questionRights']['required']='optional'; + $stackQuestion['questionRights']['mysql']='TEXT'; + $stackQuestion['questionRights']['metatag']='Rights'; + $stackQuestion['questionRights']['default']='http://www.gnu.org/copyleft/gpl.html'; + + //Learning context: Defaulted to system context, but user definable + $stackQuestion['questionLearningContext']['type']='meta'; + $stackQuestion['questionLearningContext']['values']=array('Primary Education','Secondary Education','Higher Education', + 'University First Cycle','University Second Cycle','University Post Grade', + 'Technical School First Cycle','Technical School Second Cycle','Professional Formation', + 'Continuous Formation','Vocational Training','unspecified'); + $stackQuestion['questionLearningContext']['required']='optional'; + $stackQuestion['questionLearningContext']['mysql']='TINYTEXT'; + $stackQuestion['questionLearningContext']['metatag']='LearningContext'; + $stackQuestion['questionLearningContext']['default']='unspecified'; + + //Difficulty: Default to null - up to user to specify this + $stackQuestion['questionDifficulty']['type']='meta'; + $stackQuestion['questionDifficulty']['values']=array('Very Easy','Easy','Medium', + 'Difficult','Very Difficult','unspecified'); + $stackQuestion['questionDifficulty']['required']='optional'; + $stackQuestion['questionDifficulty']['mysql']='TINYTEXT'; + $stackQuestion['questionDifficulty']['metatag']='Difficulty'; + $stackQuestion['questionDifficulty']['default']='unspecified'; + + //Competency: Default to solve - then up to user + $stackQuestion['questionCompetency']['type']='meta'; + $stackQuestion['questionCompetency']['values']=array('think','argue','solve', + 'represent','language','communicate', + 'tools','unspecified'); + $stackQuestion['questionCompetency']['required']='optional'; + $stackQuestion['questionCompetency']['mysql']='TINYTEXT'; + $stackQuestion['questionCompetency']['metatag']='Competency'; + $stackQuestion['questionCompetency']['default']='unspecified'; + + //CompetencyLevel: Default to null - then up to user + $stackQuestion['questionCompetencyLevel']['type']='meta'; + $stackQuestion['questionCompetencyLevel']['values']=array('elementary','simpleConceptual','multiStep', + 'complex','unspecified'); + $stackQuestion['questionCompetencyLevel']['required']='optional'; + $stackQuestion['questionCompetencyLevel']['mysql']='TINYTEXT'; + $stackQuestion['questionCompetencyLevel']['metatag']='CompetencyLevel'; + $stackQuestion['questionCompetencyLevel']['default']='unspecified'; + + //Time to allocate: Default to null - then up to user + $stackQuestion['questionTimeAllocated']['type']='meta'; + $stackQuestion['questionTimeAllocated']['required']='optional'; + $stackQuestion['questionTimeAllocated']['mysql']='TIME'; + $stackQuestion['questionTimeAllocated']['metatag']='TypicalLearningTime'; + $stackQuestion['questionTimeAllocated']['default']='0'; + + //Type of question: Default to algebraicExpression as that is only type of question atm, but provides extensibility + $stackQuestion['questionExcerciseType']['type']='meta'; + $stackQuestion['questionExcerciseType']['values']=array('algebraicExpression','mcqSingleAnswer','mcqMultipleAnswer', + 'fillInBlank','unspecified'); + $stackQuestion['questionExcerciseType']['required']='optional'; + $stackQuestion['questionExcerciseType']['mysql']='TINYTEXT'; + $stackQuestion['questionExcerciseType']['metatag']='ExcerciseType'; + $stackQuestion['questionExcerciseType']['default']='unspecified'; |