Esempio n. 1
0
     foreach ($_POST['los'] as $id => $uid) {
         //$b .= "Sending to ".$uid."<br />";
         $sql = "INSERT into dropbox (file_id, file_owner, file_recipient, file_path, file_name, file_description)\n\t\t\t\t\t\tValues(" . $_POST['fid'] . "," . $myID . "," . $uid . ",'" . $file_path . "','" . $file_name . "','" . $file_description . "')";
         $result = $db->query($sql);
         //$b .= $sql."<br />";
     }
     //$main .=  make_box($t,$b);
 } elseif (isset($_POST['select_students'])) {
     /** display a list of students to send to **/
     $b = "<center><form enctype=\"multipart/form-data\" action=index.php?lev=" . $_SESSION[$_CONF['sess_name'] . '_lev'] . "&cat=" . $_SESSION[$_CONF['sess_name'] . '_cat'] . " method=\"post\">";
     $b .= "Now select the recipients.<br />";
     $result = get_students_for_teacher($myID);
     $values = array("first_name", "last_name");
     $key = "user_id";
     $los = make_array_from_mysql($result, $key, $values, " ");
     $b .= make_multi_select_list($los, "los");
     $b .= "\n\t\t\t\t<input type=hidden name=send />\n\t\t\t\t<input type=hidden name=fid value=" . $_POST['fid'] . " />\n\t\t\t\t<input type=submit name=deliver value=Send />\n\t\t\t\t</form></center>";
     $main .= make_box($t, $b);
 } else {
     $t = "Send File";
     $b = "<center><form action=index.php?lev=" . $_SESSION[$_CONF['sess_name'] . '_lev'] . "&cat=" . $_SESSION[$_CONF['sess_name'] . '_cat'] . " method=\"post\" name=\"dropBox_Send\" >";
     /**	Get a list of files in  MY save dir to select from **/
     $sql = "SELECT * from dropbox \n\t\t\t\tWHERE file_owner=" . $myID . " AND file_recipient=" . $myID;
     if ($result = $db->query($sql)) {
         $lof = array();
         while ($row = $result->fetch_assoc()) {
             $lof[$row['id']] = $row['file_name'];
         }
         /** make_selection_list($list,$selected=-1,$select_name,$form, $what, $change="off")**/
         $b .= "Select a file :";
         $b .= make_selection_list($lof, -1, "fid", "dropBox_Send", "file", "on");
Esempio n. 2
0
     $main .= "<br />" . make_box($t, $b);
 } elseif (isset($_POST['send'])) {
     /** generate the upload input... **/
     /**
     			if a teacher is here, then get the list of students to send to
     				get_students_for_teacher($tid)
     			if a student is here, then get the list of classes/teachers to send to
     				
     		**/
     if ($_SESSION[$_CONF['sess_name'] . '_isTeacher']) {
         $result = get_students_for_teacher($myID);
         $values = array("first_name", "last_name");
         $key = "user_id";
         $los = make_array_from_mysql($result, $key, $values, " ");
         $t = "Send a file";
         $b = "<form enctype=\"multipart/form-data\" action=index.php?lev=" . $_SESSION[$_CONF['sess_name'] . '_lev'] . "&cat=" . $_SESSION[$_CONF['sess_name'] . '_cat'] . " method=\"post\" onSubmit=\"return validateForm(this);\">\n\t\t\t<center>\n\t\t\t<table border=0 cellspacin=2 cellpadding=2>\n\t\t\t<tr>\n\t\t\t<td align=right>Please Select Recipients<br />\n\t\t\t\t<div style=\"font-size:2px; color:red;\">Control-Click to select multiple recipients.</div>\n\t\t\t</td>\n\t\t\t<td align=left>" . make_multi_select_list($los, 'recipients') . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t<td align=right>Please select the file to upload :</td>\n\t\t\t<td align=left><input name=\"upload_file\" type=\"file\"></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t<td align=right>Please provide a Title :</td>\n\t\t\t<td align=left><input name=\"title\" type=text size=20></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t<td align=right valign=top>Description :</td> \n\t\t\t<td align=left><textarea name=description rows=6 cols=30></textarea></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t<td colspan=2 align=center>\n\t\t\t<input type=\"submit\" name=\"upload\" value=\"Upload\">\n\t\t\t<input type=hidden name=upload-send />\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t</center>\n\t\t\t</FORM>";
     }
     if ($_SESSION[$_CONF['sess_name'] . '_isStudent']) {
         $lot = get_teachers_for_student($myID);
         $t = "Send a file";
         $b = "<form enctype=\"multipart/form-data\" action=index.php?lev=" . $_SESSION[$_CONF['sess_name'] . '_lev'] . "&cat=" . $_SESSION[$_CONF['sess_name'] . '_cat'] . " method=\"post\" onSubmit=\"return validateForm(this);\">\n\t\t\t<center>\n\t\t\t<table border=0 cellspacin=2 cellpadding=2>\n\t\t\t<tr>\n\t\t\t<td align=right>Please Select a Teacher</td>\n\t\t\t<td align=left>" . make_selection_list($lot, $tid, 'recipients', 'teachers', 'Teacher') . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t<td align=right>Please select the file to upload :</td>\n\t\t\t<td align=left><input name=\"upload_file\" type=\"file\"></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t<td align=right>Please provide a Title :</td>\n\t\t\t<td align=left><input name=\"title\" type=text size=20></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t<td align=right valign=top>Description :</td> \n\t\t\t<td align=left><textarea name=description rows=6 cols=30></textarea></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t<td colspan=2 align=center>\n\t\t\t<input type=\"submit\" name=\"upload\" value=\"Upload\">\n\t\t\t<input type=hidden name=upload-send />\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t</center>\n\t\t\t</FORM>";
     }
     $main .= "<br />" . make_box($t, $b);
 } elseif (isset($_POST['upload'])) {
     /**
     		place the recipient(s) ID's/usernames into an array and process the array so that 
     		if teacher hands out to several students, this will work same as 1 student
     		Trying to deal with a teacher handing out to several students or adding to his save 
     		and same for students...  
     		Now $recipients is an array of ID's that are to receive the file being uploaded...
     	**/