From: Chris S. <san...@us...> - 2005-07-25 14:11:35
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27037/scripts Modified Files: stackAuthor.php stackDatabase.php stackUser.php Log Message: Index: stackDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** stackDatabase.php 18 Jul 2005 12:09:12 -0000 1.33 --- stackDatabase.php 25 Jul 2005 14:11:25 -0000 1.34 *************** *** 1211,1214 **** --- 1211,1219 ---- } } + + if (array_key_exists('options',$user)) { + $user['options'] = base64_unserialize($user['options']); + } + return $user; } *************** *** 1237,1240 **** --- 1242,1249 ---- } + if (array_key_exists('options',$user)) { + $user['options'] = base64_unserialize($user['options']); + } + return $user; } *************** *** 1255,1258 **** --- 1264,1272 ---- $qu = ''; $quv = ''; + + if (array_key_exists('options',$user)) { + $user['options'] = base64_serialize($user['options']); + } + foreach ($stackUser as $key => $fields) { if (array_key_exists($key,$user)) { *************** *** 1293,1296 **** --- 1307,1315 ---- $qu = ''; + + if (array_key_exists('options',$user)) { + $user['options'] = base64_serialize($user['options']); + } + foreach ($stackUser as $key => $fields) { if (array_key_exists($key,$user)) { Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackAuthor.php,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** stackAuthor.php 18 Jul 2005 10:44:17 -0000 1.28 --- stackAuthor.php 25 Jul 2005 14:11:25 -0000 1.29 *************** *** 80,87 **** //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) { --- 80,87 ---- //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) { *************** *** 91,95 **** echo " </select>\n"; ! } } } --- 91,95 ---- echo " </select>\n"; ! } } } *************** *** 102,115 **** * @param array $options Their current values * @param string $fieldname The name of the field in the form * @return void */ ! function stack_options_edit_form($options_headings,$options_list,$options,$fieldname) { global $stackOptions; ! echo "<table cellpadding='4'><tr> ! <td> <b>".get_string('stackQuestion_questionOptions','stack')."</b> </td> ! <td> <b>".get_string('stackOptions_edit_value','stack')."</b> </td> ! <td> <b>".get_string('stackOptions_edit_default','stack')."</b> </td></tr>"; ! foreach( $options_list as $k => $opt) { $descript = stack_question_edit_dispoptionfield($opt); --- 102,118 ---- * @param array $options Their current values * @param string $fieldname The name of the field in the form + * @param boolean $fragment Is this a fragment, or a complete table? * @return void */ ! function stack_options_edit_form($options_headings,$options_list,$options,$fieldname,$fragment=TRUE) { global $stackOptions; ! if ($fragment) { ! echo "<table cellpadding='4'><tr> ! <td> <b>".get_string('stackQuestion_questionOptions','stack')."</b> </td> ! <td> <b>".get_string('stackOptions_edit_value','stack')."</b> </td> ! <td> <b>".get_string('stackOptions_edit_default','stack')."</b> </td></tr>"; ! } ! foreach( $options_list as $k => $opt) { $descript = stack_question_edit_dispoptionfield($opt); *************** *** 118,122 **** echo "\n<tr>\n"; if ('' != $category) { ! echo " <td> <strong>$category</strong> </td>\n</tr>\n</tr>\n"; } --- 121,125 ---- echo "\n<tr>\n"; if ('' != $category) { ! echo " <td> <strong>$category</strong> </td>\n</tr>\n</tr>\n"; } *************** *** 135,139 **** } ! echo "\n</table>\n\n\n"; } --- 138,144 ---- } ! if ($fragment) { ! echo "\n</table>\n\n\n"; ! } } *************** *** 209,216 **** <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> --- 214,221 ---- <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> *************** *** 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. --- 225,231 ---- <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. *************** *** 377,442 **** echo "\n<hr />\n"; ! ! //<PDK> Insert user definable metadata here ! $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"; --- 382,447 ---- echo "\n<hr />\n"; ! ! //<PDK> Insert user definable metadata here ! $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"; Index: stackUser.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackUser.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** stackUser.php 8 Jul 2005 16:56:23 -0000 1.11 --- stackUser.php 25 Jul 2005 14:11:25 -0000 1.12 *************** *** 25,28 **** --- 25,29 ---- $stackUser['firstaccess'] = ''; $stackUser['lastaccess'] = ''; + $stackUser['options'] = array(); /** *************** *** 135,145 **** } /** ! * Update the information of a particular user. * * @param array $errors The array to hold any errors * @return array $user The user's information. */ ! function stack_user_updateinfo(&$errors) { $user = ''; --- 136,147 ---- } + /** ! * Get the information about the current user from the $_POST. * * @param array $errors The array to hold any errors * @return array $user The user's information. */ ! function stack_user_info_ascertain(&$errors) { $user = ''; *************** *** 174,178 **** } - /** * Validates the information supplied by a user --- 176,179 ---- *************** *** 218,221 **** --- 219,255 ---- } + + /** + * Displays the update user info form. + * @param array $user The array containing the information about the user. + * @param array $errors The usual errors array. + * @param boolean $admin Is this being used by the admin user to edit a student's login details? + * @return void + */ + function stack_user_update_info($user, $errors,$admin=FALSE) { + global $stack_root,$stack_web_url; + include_once($stack_root.'/scripts/stackAuthor.php'); + include_once($stack_root.'/html/helpform.php'); + + echo '<h1>Update user information</h1>'; + echo "<form action=\"\" method=\"post\" name=\"register\" id=\"register\">"; + echo '<p>To update your information, please complete the following form.<p>'; + echo '<table><tr><td>Username </td><td><input type="hidden" name="user[username]" size="25" value="'.stack_s($user['username']).'" alt="User name" />'.stack_s($user['username']).'</td><td></td></tr>'; + stack_user_edit_form($user,$errors,$admin); + + // The code below allows the user['options'] to be set. This is currently unused. + // // Add options to the user form. + // $options_headings = array(''); + // $options_list = array('Language'); + // $fieldname = 'user[options]'; + // + // stack_options_edit_form($options_headings,$options_list,$user['options'],$fieldname,FALSE); + + echo '</table>'; + + echo '<input type="hidden" name="action" value="userupdate" /><input type="submit" value="Update" /></form>'; + } + + /** * Build the form to edit a STACK user. |