From: Chris S. <san...@us...> - 2005-11-24 18:47:59
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27885 Modified Files: editsubject.php user.php Log Message: Add the concept of class list Index: editsubject.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/editsubject.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** editsubject.php 11 Oct 2005 17:35:38 -0000 1.3 --- editsubject.php 24 Nov 2005 18:47:46 -0000 1.4 *************** *** 52,55 **** --- 52,56 ---- require_once("{$stack_root}/html/helpform.php"); require_once("{$stack_root}/html/subjectjava.html"); + require_once("{$stack_root}/html/userenrole.html"); //////////////////////////////////////////////// Index: user.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/user.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** user.php 14 Oct 2005 15:42:27 -0000 1.13 --- user.php 24 Nov 2005 18:47:46 -0000 1.14 *************** *** 56,59 **** --- 56,76 ---- } + if ('enrole' == $action) { + if (array_key_exists('subjectID',$_POST)) { + $subjectID = $_POST['subjectID']; + if (array_key_exists('user_drop',$_POST)) { + $users = $_POST['user_drop']; + foreach($users as $userID => $drop) { + stack_db_subject_user_drop($userID,$subjectID); + } + } + if (array_key_exists('user_add',$_POST)) { + $users = $_POST['user_add']; + foreach($users as $userID => $drop) { + stack_db_subject_user_add($userID,$subjectID); + } + } + } + } ////////////////////////////////////////////////////////////// *************** *** 83,87 **** break; case 'review': - $subject_store = stack_db_subject_get(); $subject_store = stack_zone_subjects_order($subject_store); --- 100,103 ---- *************** *** 117,120 **** --- 133,195 ---- stack_marksheet(); break; + case 'enrole': + echo '<h1>'.get_string('menu_Enrole','stack','')."</h1>\n"; + $subject = stack_db_subject_get($subjectID,FALSE); + + echo "\n<table>\n"; + + $display_fields = array('subjectID','subjectName'); + foreach ($display_fields as $key) { + //Check that within current field there is no type tag, otherwise skip + $err = ''; + $keyname = 'stackSubject_'.$key; + echo "<tr><td><b>".get_string($keyname,'stack','')."</b></td>\n"; + echo "<td>{$subject[$key]}</td></tr>"; + } + echo "\n</table>\n"; + + + $stack_users = stack_user_listall(); + $users = array(); + foreach($stack_users as $user) { + $users[$user['id']] = $user['name']; + } + $subject_classlist = stack_db_subject_classlist($subjectID); + + echo "<form name='userenroleform' action='user.php' method='POST'> + <input type='hidden' name='subjectID' value='$subjectID' /> + <input type='hidden' name='action' value='enrole' /> + <input type='submit' name='submit' value='Submit' />"; + + echo '<h2>'.get_string('FE_user_enrolled','stack','')."</h2>\n"; + echo "<table>"; + $trcol = FALSE; + foreach($subject_classlist as $uID) { + $trcol = !$trcol; + $user = $users[$uID]; + unset($users[$uID]); + + if ($trcol) { echo "\n<tr bgcolor='#DDDDDD'>\n"; } else { echo "\n<tr bgcolor='#DDDDFF'>\n"; } + echo "<td><input type='checkbox' name='user_drop[$uID]' value='ticked' /></td>\n"; + echo "<td>$user</td>"; + } + echo "</table>"; + + echo '<h2>'.get_string('FE_user_not_enrolled','stack','')."</h2>\n"; + echo "<table>"; + $trcol = FALSE; + foreach($users as $uID => $user) { + $trcol = !$trcol; + + if ($trcol) { echo "\n<tr bgcolor='#DDDDDD'>\n"; } else { echo "\n<tr bgcolor='#DDDDFF'>\n"; } + echo "<td><input type='checkbox' name='user_add[$uID]' value='ticked' /></td>\n"; + echo "<td>$user</td>"; + } + echo "</table>"; + + echo "</form>"; + + + break; } |