Jump to content

Donovan

Members
  • Posts

    73
  • Joined

  • Last visited

    Never

Everything posted by Donovan

  1. Still need help with this. I'm spinning my wheels.
  2. I have an application that uses the phpBB template engine. I needed to write some error checking logic but this has raised a problem. If I catch an error the form is not sticky and refreshes to a blank form after displaying the error message. The page is where I add a new question for exams. I don't want them to add the questions if they forgot to identify a correct answer for a multiple choice question. The questions.tpl looks like this. <tr> <td width="100%"> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="borderline" align="center"> <tr> <td align="left" valign="top"> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="bodyline"> <tr> <td height="240" valign="top"> <!-- BEGIN question --> <form name="{question.FORM_NAME}" action="{question.ACTION}" method="post"> {question.FORM_HIDDEN} {question.CONTENTS} </form> <!-- END question --> </td> </tr> </table> </td> </tr> </table> </td> </tr> And the last part of my question.php where I add new questions looks like this where I check for the existence of an answer. elseif ( ($mode == 'addresp' ) &&( ( $userdata['user_level'] == ADMIN ) || ( in_array ($cid, $course['teaches'] ) )) ){ .... for ( $i=1; $i<$anscounter; $i++) { $question_values['points'] .= (empty($_POST["point$i"]) ? 0 $_POST["point$i"])) ."#"; } $question -> setValue($question_values); $sql = $question -> operation('addresp'); //Lets check if the question has at least one correct answer - SFD 6/9/2010 $point_array = explode("#",$question_values['points']); $answer_exists = false; // Set to default if(in_array("1",$point_array)) { $answer_exists = true; // The answer exists - so insert into database. $db->sql_query($sql); $message = ' Question has been Created'; $nav_path .= $question_values['qname']; $template->assign_block_vars('question',array('ACTION' => '', 'FORM_NAME' => 'questions', 'FORM_HIDDEN' => '', 'CONTENTS' => '<br><br><span class="catHead">'.$message.'</span> <a href="javascript:void(0);" class="action" onClick="window.close()">Close Window</a><br><br>' )); }else{ //This is where I need to make the form sticky and re-display. All the values that are on the form look like this... $question_values['qstem'] = (isset($_POST['ques_stem']) ? $_POST['ques_stem'] : '') ; $question_values['qname'] = (isset($_POST['ques_name']) ? $_POST['ques_name'] : '') ; $question_values['qch1'] = (isset($_POST['ques_ch1']) ? $_POST['ques_ch1'] : '') ; $question_values['qch2'] = (isset($_POST['ques_ch2']) ? $_POST['ques_ch2'] : '') ; $question_values['qch3'] = (isset($_POST['ques_ch3']) ? $_POST['ques_ch3'] : '') ; $question_values['qch4'] = (isset($_POST['ques_ch4']) ? $_POST['ques_ch4'] : '') ; $question_values['qch5'] = (isset($_POST['ques_ch5']) ? $_POST['ques_ch5'] : '') ; $question_values['qch6'] = (isset($_POST['ques_ch6']) ? $_POST['ques_ch6'] : '') ; $question_values['qch7'] = (isset($_POST['ques_ch7']) ? $_POST['ques_ch7'] : '') ; $question_values['qch8'] = (isset($_POST['ques_ch8']) ? $_POST['ques_ch8'] : '') ; $question_values['qch9'] = (isset($_POST['ques_ch9']) ? $_POST['ques_ch9'] : '') ; $question_values['media_name'] = (isset($_POST['media_name']) ? $_POST['media_name'] : '') ; $question_values['feedback'] = (isset($_POST['feedback']) ? $_POST['feedback'] : '') ; } I don't know what I need here when I need to redisplay this data. }else{ $message = 'Error in Updating Question. You must have at least one correct answer marked.'; $nav_path .= $question_values['qname']; $template->assign_block_vars('question',array('ACTION' => '', 'FORM_NAME' => 'questions', 'FORM_HIDDEN' => '', 'CONTENTS' => $question -> operation('add') )); } My operation('add') is not sticky and looks like this. if ( ($mode == 'add' ) &&( ( $userdata['user_level'] == ADMIN ) || ( in_array ($cid, $course['teaches'] ) )) ) { $question = new question(); $question -> setIDs($cid,$ca,$_POST['qtype'], $userdata['session_user_id']); $template->assign_block_vars('question',array('ACTION' => append_sid('questions.php?ARG1='.$cid.'&ARG2='.$ca), 'FORM_NAME' => 'questions', 'FORM_HIDDEN' => '', 'CONTENTS' => $question -> operation('add') )); } // eof add Any help is appreciated.
  3. I've also tried this but nothing happens. $handle = fopen ($Studentfile, 'r'); while (($data = fgetcsv($handle, 1000, ',', '"')) !== FALSE) { $sql = $db->sql_query("INSERT INTO atlas_tl_students_temp VALUES ('". implode("','", $data)."')"); } Nothing gets inserted.
  4. $fileName = basename($_FILES['file_source']['name']); move_uploaded_file($_FILES['file_source']['tmp_name'], $uploadFolder.$fileName); $Studentfile = "$uploadFolder/$fileName"; //die(); if (file_exists($Studentfile) == false) { die('It doesn\'t exist!'); } if (is_readable($Studentfile) == false) { die('It doesn\'t exist or we can\'t read it!'); } else { $upload = $db->sql_query("LOAD DATA LOCAL INFILE '".$Studentfile."' INTO TABLE ".$prefix."$table_name FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r'"); if (!$upload) {echo("<p>Error performing query: " . mysql_error() . "</p>");} } } I am getting and I've also gotten I've used this with and without LOCAL. My website is on a different server than my MySQL database. The powers that be says it cannot be moved onto the same server. Why can't I load this file into MySQL? If this wont work can somebody give me a jump start on a parse routine where I could do inserts one at a time on about 300 or 400 records?
  5. I have a peer evaluation that students fill out. The number of members in their group is somewhere between 5 to 7. When a user clicks on the course record for peer evaluation it pulls all the groups members for that user and displays them with a drop down box and textarea. The drop down is a eval score between 7 - 13. The textarea is for eval comments for feedback on how well each member participated and contributed to the groups success. The following code pulls all group members from the users group excluding themselves, then displays the form drop down boxes so that the user can select a score for each member, and leave a feedback comment. while($row = $db->sql_fetchrow($getgroupmembers)) { $SOMS_KEY = $row['SOMS_KEY']; $UID = $row['UID']; $Name_First = $row['Name_First']; $Name_Last = $row['Name_Last']; echo"<tr>" ."<td align='center'> $Name_First $Name_Last </td>" ."<td>" ."<select name='evalscore[{$UID}]'>" ."<option value='7' selected>7</option>" ."<option value='8'>8</option>" ."<option value='9'>9</option>" ."<option value='10'>10</option>" ."<option value='11'>11</option>" ."<option value='12'>12</option>" ."<option value='13'>13</option>" ."</select>" ."</td>" ."<td align='left'><textarea name ='evalcomment[{$UID}]' cols='100' colspan='1' rows='2'></textarea></td>" ."</tr>"; } $countgroupmembers = $db->sql_query("SELECT * FROM ".$prefix."_tl_group_students WHERE Group_ID = '$UserGroup'"); $grouptotal = $db->sql_numrows($countgroupmembers); if ($grouptotal == 7) { $Total_Points = 60; } elseif ($grouptotal == 6) { $Total_Points = 50; } elseif ($grouptotal == 5) { $Total_Points = 40; } echo "<tr><td align='left'> Total Points Must = $Total_Points</td>"; This gets sent to another function where I write the values and display some sort of confirmation. function TLInsertY1PeerEvals($authuser) { global $prefix, $db; include("header.php"); session_start(); if (isset($_SESSION['authuser'])) { $authuser = $_SESSION['authuser']; } foreach ($_POST['evalscore'] as $keyUID => $score) { //Refer to the evalcomment array using the evalscore index (which is $keyUID in this case) $Course_Number = $_POST['Course_Number']; $evalcomment = $_POST['evalcomment'][$keyUID]; $sql = "INSERT INTO ".$prefix."_tl_peereval (UID, evalscore, eval_comment, Course_Number, rater, datesubmit)". "VALUES ('$keyUID', '$score', '$evalcomment', '$Course_Number', '$authuser', NOW())"; $result = $db->sql_query($sql); if (!$result) {echo("<p>Error performing query: " . mysql_error() . "</p>");} } include("header.php"); OpenTable(); echo "<br>\n" ."<form action='".$_server['php_self']."' method='post'" ."<table border=\"0\">" ."<tr><td>Thank You for submitting your peer evaluation.</td></tr>" ."<tr><td><input type=\"hidden\" name=\"op\" value=\"TLStudentGrades\">\n" ."<input type=\"submit\" value=\"Continue\"></form></td></tr></table><br>\n\n"; CloseTable(); include("footer.php"); } I assume I need javascript but have found no javascript examples I can follow. The problem is the form is dynamic depending on number of group members. If I had a static form I could just SUM the form elements.... <select id="evalscore_1" name="evalscore_1" ... <select id="evalscore_2" name="evalscore_2" etc But my form is not static. It could have anywhere from 4 members per group up to 7 members per group. What I need is to SUM all my eval_scores for each of the group members then compare that to what the average (Total_Points) should be. Example: Tim = 11 Nick = 12 Bob = 8 Lauren = 10 Steve = 9 $SUM_Points = 50 Then validate that $Total_Points and $SUM_Points match as well as each comments has a value. What would be ideal is a visible javascript running total of each listbox onchange() event. If anybody can assist it would be greatly appreciated.
  6. How can this query: SELECT Course_ID, SOMS_KEY, UID, Academic_Year, AVG( TL_Avg ) AS Final_Grade FROM atlas_tl_session_grades sg JOIN atlas_tl_session s ON ( s.Session_ID = sg.Session_ID ) WHERE s.Course_ID = 'CL00000011' GROUP BY sg.SOMS_KEY gives me 104 records which is what I want. Yet this query inserts 312 records? $insertgrades = $db->sql_query("INSERT INTO ".$prefix."_tl_course_grades (Course_ID, SOMS_KEY, UID, Academic_Year, Final_Grade)". "SELECT Course_ID, SOMS_KEY, UID, Academic_Year, AVG(TL_Avg) AS FinalGrade FROM ".$prefix."_tl_session_grades sg JOIN ".$prefix."_tl_session s ON (s.Session_ID = sg.Session_ID) WHERE s.Course_ID = '$Course_ID' GROUP BY sg.SOMS_KEY"); if (!$insertgrades) { echo("<p>Error performing query: " . mysql_error() . "</p>"); exit(); }
  7. Made a breakthrough. This query run in phpMyadmin seems to give me what I want. SELECT Course_ID, SOMS_KEY, UID, Academic_Year, AVG( TL_Avg ) AS Final_Grade FROM atlas_tl_session_grades sg JOIN atlas_tl_session s ON ( s.Session_ID = sg.Session_ID ) WHERE s.Course_ID = 'CL00000011' GROUP BY sg.SOMS_KEY But I have syntax errors trying to come up with an INSERT INTO $insertgrades = $db->sql_query("INSERT INTO ".$prefix."_tl_course_grades (Course_ID, SOMS_KEY, UID, Academic_Year, Final_Grade)". "VALUES (SELECT Course_ID, SOMS_KEY, UID, Academic_Year, AVG(TL_Avg) AS FinalGrade FROM ".$prefix."_tl_session_grades sg JOIN ".$prefix."_tl_session s ON (s.Session_ID = sg.Session_ID) WHERE s.Course_ID = '$Course_ID' GROUP BY sg.SOMS_KEY)"); if (!$insertgrades) { echo("<p>Error performing query: " . mysql_error() . "</p>"); exit(); }
  8. The UID and SOMS_KEY are used to identify the students. UID stands for University ID, and SOMS_KEY is a School of Medicine Key used to identify them as a medical student. In my students table these appear once. Here is the relevant table structure of my database. Each course would have multiple sessions of "Team Learning" Students get into their groups and do exercises. They get 3 exams during the "TL" session, and IRAT, GRAT, and AppEx. I grade these then average them against weights decided on in the beginning of the academic year. (IRAT are 30% of grade, GRAT are 40% of grade and so on. Like this: $updatetlavg = $db->sql_query("UPDATE ".$prefix."_tl_session_grades sg JOIN ".$prefix."_tl_session s SET TL_Avg = (SELECT ((IRAT_Grade * $irat_wt) + (GRAT_Grade * $grat_wt) + (Appex_Grade * $appex_wt)) AS TLAVG) WHERE sg.Session_ID = s.Session_ID"); Then for each course when all TL sessions are complete I need to AVG all TL session grades AVG(TL_Avg) for each student and write this to the course_grades table. I want to thank you for helping me figure out my logic for this. It is most appreciated.
  9. Do you think it is better to INSERT INTO ... VALUES(a, b, c), instead of trying it with subqueries.
  10. Ok. I'll leave out the avg for the initial insert, but I still have multiple records in session_grades for one course where I need to insert only one record in the course_grade table for each student. I thought if I GROUP BY SOMS_KEY I could only pull one record for each SOMS_KEY but that doesn't work. $insertgrades = $db->sql_query("INSERT INTO ".$prefix."_tl_course_grades (Course_ID, SOMS_KEY, UID, Academic_Year) SELECT DISTINCT s.Course_ID, g.SOMS_KEY, g.UID, g.Academic_Year FROM ".$prefix."_tl_session_grades g JOIN ".$prefix."_tl_session s ON (g.Session_ID = s.Session_ID) JOIN ".$prefix."_tl_courses c ON (s.Course_ID = c.Course_ID) WHERE c.Course_ID = '$Course_ID' GROUP BY SOMS_KEY"); I need to pull one record per student that exist in session_grades for sessions that exist in the Course I am trying to process. once i get this working i van go back and run my UPDATE and SET the Final_Grade
  11. Why write the course grade anywhere else but the course_grades table? How do I write a single grade to course_grades based off of three (or more) records from session_grades?
  12. Let me explain: Here is what my session_grades looks like I have three different Session_ID's all for the same student (SOMS_KEY). Each session grade has been averaged and written to TL_Avg based on a weighted value. (IRAT * .03) + GRAT *.03) + (Appex * .04) or something similar. I now want to get the average of all three TL_Avg and write that to the course_grades table. This is happening but I am writing the same record three different times. I have to join the table back like so: INSERT INTO course_grades (Course_ID, SOMS_KEY, UID, Academic_Year, Final_Grade) SELECT s.Course_ID, g.SOMS_KEY, g.UID, g.Academic_Year, AVG(TL_Avg) AS Final_Grade FROM _session_grades g JOIN session s ON (g.Session_ID = s.Session_ID) JOIN courses c ON (s.Course_ID = c.Course_ID) WHERE c.Course_ID = '$Course_ID' to make sure I am processing the correct grades for the Course I have chosen.
  13. I have a query where I'm trying to insert course grades. A course can have several "sessions" where students participate in "Team Learning". During the all day course they take 3 exams. The whole course may be 3-4 weeks long where they may have 3 or 4 or more "Team Learning" sessions (or TL sessions for short). So I have a courses table with Course_ID. I have a session table with Session_ID and Course_ID I have a session_grades table with Session_ID and a SOMS_KEY (SOMS_KEY for each student), and a TL_Avg for each grade for that session. My query looks like this: $insertgrades = $db->sql_query("INSERT INTO ".$prefix."_tl_course_grades (Course_ID, SOMS_KEY, UID, Academic_Year, Final_Grade) SELECT s.Course_ID, g.SOMS_KEY, g.UID, g.Academic_Year, AVG(TL_Avg) AS Final_Grade FROM ".$prefix."_tl_session_grades g JOIN ".$prefix."_tl_session s ON (g.Session_ID = s.Session_ID) JOIN ".$prefix."_tl_courses c ON (s.Course_ID = c.Course_ID) WHERE c.Course_ID = '$Course_ID' GROUP BY g.SOMS_KEY"); if (!$insertgrades) { echo("<p>Error performing query: " . mysql_error() . "</p>"); exit(); } For this example my course had 3 TL sessions. I need to get the AVG (TL_Avg) for all my sessions per course and insert it into the course_grades table. This is happening but it is happening 3 times, where I just need it to be inserted once. If I need to limit the number of inserts would a simple left join work? if so where should I put that?
  14. I'm not following you. Your reply is to vague. Do you mean something like this? $updateGrade = $db->sql_query("UPDATE ".$prefix."_tl_session_grades SET IRAT_Grade = (SELECT ((IRAT_Raw / $IratQuestions) * 100) AS IRATGrade), SET GRAT_Grade = (SELECT ((GRAT_Raw / $GratQuestions) * 100) AS GRATGrade), SET AppEx_Grade = (SELECT ((Appex_Raw / $AppExQuestions) * 100) AS AppexGrade) WHERE Session_ID = '$Session_ID'"); if (!$updateGrade) { echo("<p>Error performing query: " . mysql_error() . "</p>"); exit(); }
  15. Also I think I can have multple SET commands in one query. True? $updateGrade = $db->sql_query("UPDATE ".$prefix."_tl_session_grades sg JOIN ".$prefix."_tl_session s SET IRAT_Grade = (SELECT ((IRAT_Raw / $NumQuestions) * 100) AS IRATGrade) SET GRAT_Grade = (SELECT ((GRAT_Raw / $NumQuestions) * 100) AS GRATGrade) SET AppEx_Grade = (SELECT ((Appex_Raw / $NumQuestions) * 100) AS AppexGrade) WHERE sg.Session_ID = s.Session_ID"); if (!$updateGrade) { echo("<p>Error performing query: " . mysql_error() . "</p>"); exit(); }
  16. Somebody help me with this query. I have a raw score from a test. I get the number of questions for this test and then try to update the grade. This gets the number of questions that were on the test. $getnumquestions = $db->sql_query("SELECT num_quest_irat FROM ".$prefix."_tl_session WHERE Session_ID = '$Session_ID'"); while($info = $db->sql_fetchrow($getnumquestions)) { $NumQuestions = $info['num_quest_irat']; } The next code is trying to update the table and set a value for IRAT_Grade. $updateIRAT_Grade = $db->sql_query("UPDATE ".$prefix."_tl_session_grades sg JOIN ".$prefix."_tl_session s SET IRAT_Grade = (SELECT ((IRAT_Raw / $NumQuestions) * 100) AS IRATGrade) WHERE sg.Session_ID = s.Session_ID"); if (!$updateIRAT_Grade) { echo("<p>Error performing query: " . mysql_error() . "</p>"); exit(); } Currently I am getting an error:
  17. I am working on a grading app for the university I work for. So far this is what I have: After gathering the grade info I insert to a table $insertgrades = $db->sql_query("INSERT INTO ".$prefix."_tl_course_grades (Course_ID, SOMS_KEY, UID, Academic_Year, Irat_Avg, Grat_Avg, Appex_Avg) SELECT s.Course_ID, g.SOMS_KEY, g.UID, g.Academic_Year, AVG(IRAT_Grade) AS Irat_Avg, AVG(GRAT_Grade) AS Grat_Avg, AVG(Appex_Grade) AS Appex_Avg FROM ".$prefix."_tl_session_grades g JOIN ".$prefix."_tl_session s ON (g.Session_ID = s.Session_ID) JOIN ".$prefix."_tl_courses c ON (s.Course_ID = c.Course_ID) WHERE c.Course_ID = '$Course_ID' GROUP BY g.SOMS_KEY"); if (!$insertgrades) { echo("<p>Error performing query: " . mysql_error() . "</p>"); exit(); } I then compute another average of Appex and Grat and write that to GRAT_AppEx_Avg. I don't know if this is correct but it appears to be working. $updategroupavg = $db->sql_query("UPDATE ".$prefix."_tl_course_grades SET GRAT_AppEx_Avg = (SELECT AVG(Grat_Avg + Appex_Avg)/2 AS GRAT_AppEx_Avg)"); if (!$updategroupavg) { echo("<p>Error performing query: " . mysql_error() . "</p>"); exit(); } I then select the "weights" to assign for each part of the grade. Some parts are weighted more than others. 20%, 40% etc. $getweightinfo = $db->sql_query("SELECT * FROM ".$prefix."_tl_class_weights cw JOIN ".$prefix."_tl_weights w ON cw.weight_id = w.weight_id WHERE Class_Year = '$Course_Year'"); if (!$getweightinfo) { echo("<p>Error performing query: " . mysql_error() . "</p>"); exit(); } while($info = $db->sql_fetchrow($getweightinfo)) { $irat_wt = $info[irat_wt]; $grat_wt = $info[grat_wt]; $appex_wt = $info[appex_wt]; } Then I am trying to compute the Final grade and here is where I need some help. $processfinalgrade = $db->sql_query("SELECT * FROM ".$prefix."_tl_course_grades WHERE Course_ID = '$Course_ID'"); if (!$processfinalgrade) { echo("<p>Error performing query: " . mysql_error() . "</p>"); exit(); } while($row = $db->sql_fetchrow($processfinalgrade)) { $IRAT_Avg = $row[iRAT_Avg]; $GRAT_Avg = $row[GRAT_Avg]; $Appex_Avg = $row[Appex_Avg]; $Grade = (($IRAT_Avg * $irat_wt) + ($GRAT_Avg * $grat_wt) + ($Appex_Avg * $appex_wt)); } Update the table $updatefinalgrade = $db->sql_query("UPDATE ".$prefix."_tl_course_grades SET Final_Grade = '$Grade' WHERE Course_ID ='$Course_ID'"); which is not writing the correct Final grade. I get a repeating 67%. Any help is appreciated.
  18. Here is code seems to be working. $insertgrades = $db->sql_query("INSERT INTO ".$prefix."_tl_course_grades (Course_ID, SOMS_KEY, UID, Academic_Year, Irat_Avg, Grat_Avg, Appex_Avg) SELECT s.Course_ID, g.SOMS_KEY, g.UID, g.Academic_Year, AVG(IRAT_Grade) AS Irat_Avg, AVG(GRAT_Grade) AS Grat_Avg, AVG(Appex_Grade) AS Appex_Avg FROM ".$prefix."_tl_session_grades g JOIN ".$prefix."_tl_session s ON (g.Session_ID = s.Session_ID) JOIN ".$prefix."_tl_courses c ON (s.Course_ID = c.Course_ID) WHERE c.Course_ID = '$Course_ID' GROUP BY g.UID");
  19. I am computing AVG on different field then want to insert into a table. Here is my relevant code: if ($status == 0) { OpenTable(); echo"<tr><td>TL session(s) for this course are not complete.</td></tr>"; CloseTable(); die(); } else { $insertgrades = $db->sql_query("INSERT INTO ".$prefix."_tl_course_grade (SELECT SOMS_KEY, UID, AVG(IRAT_Grade) AS Irat_Avg, AVG(GRAT_Grade) AS Grat_Avg, AVG(Appex_Grade) AS Appex_Avg FROM ".$prefix."_tl_session_grades g JOIN ".$prefix."_tl_session s ON (g.Session_ID = s.Session_ID) JOIN ".$prefix."_tl_courses c ON (s.Course_ID = c.Course_ID) WHERE c.Course_ID = '$Course_ID')"); } header("Location: ".$admin_file.".php?op=TLViewCourseGrades&Course_ID='$Course_ID'"); Unsure how to proceed.
  20. I don't understand what you mean. That function I posted handles the entire peer eval page. The TLInsertPeerEvals function will handle all the inserts to the database.
  21. I have a program I am working on that allows students to submit "Peer Evaluations" for their team members for a college course. They could have anywhere from 5 to 7 members per team which is pulled from a MySQL database. The minimum score is 7 while the max is 13. I have code that figures out what the sum should be but I would like a running total taken from the listboxes. The running total should show up in $SUM_Points. If anybody can help me figure this out i would appreciate it. Here is my code. function peerEvals() { global $stop, $prefix, $db, $authuser; include("header.php"); OpenTable(); $Course_ID = $_GET['Course_ID']; $getcoursename = $db->sql_query("SELECT Course_Name FROM ".$prefix."_tl_courses WHERE Course_ID = '$Course_ID'"); if (!$getcoursename) { echo("<p>Error performing query: " . mysql_error() . "</p>"); exit(); } while($info = $db->sql_fetchrow($getcoursename)) { $Course_Name = $info[Course_Name]; } echo"<table width=\"100%\" border=\"0\" cellpadding=\"3\">" ." <tr><td align=\"center\">Team Based Learning - Peer Evaluation</td></tr>" ." <tr><td align=\"center\">Course: $Course_Name</td></tr>" . "</table>"; echo"<table width=\"100%\" border=\"0\" cellpadding=\"3\">" ." <tr><td><b>Assigning Fair Peer Evaluation Scores<b></td></tr>" ."<tr><td><p>Assign an Average of 10 points to your other members of your team (ie NOT including yourself.) You should assign a total of 40 points for a five-member team or 50 points for a six-member team. The minimum possible score for a team member is 7 and the maximum possible score is 13. Assign scores to reflect how you feel about the extent to which the other member contributed to your learning and/or your teams performance. This is an opportunity to reward the members of your teamn who actually worked hard on your behalf. </p></td>"; echo"<tr><td><b>Providing Helpful Feedback Comments<b></td></tr>" ."<tr><td><p>In addition to assigning peer evaluations scores, you must provide writtten peer feedback to EACH member of your team. When giving feedback, keep in mind the seven characteristcs of Helpful Feedback:</td></tr>"; echo"<tr><td>" ."<OL>" ."<LI>Descriptive, not evaluative, and is "owned" by the sender." ."<LI>Specific, not general." ."<LI>Honest and sincere." ."<LI>Expressed in terms relevent to the self-perceived needs of the receiver." ."<LI>Timely and in context." ."<LI>Desired by the receiver, not imposed on him or her." ."<LI>Usable, concerned with behavior over which the receiver has control." ."</OL>" ."<b></td></tr>"; echo"</table>"; CloseTable(); $findusergroup = $db->sql_query("SELECT Group_ID FROM ".$prefix."_tl_group_students WHERE LDAP_USER = '$authuser'"); while($info = $db->sql_fetchrow($findusergroup)) { $UserGroup = $info[Group_ID]; } OpenTable(); echo" <form id=\"form1\" name=\"form1\" method=\"post\" action=\"\">" . " <table width='100%' border='1' cellpadding='3'>" . " <tr><td colspan='3' align='center'>Group: $UserGroup</td><tr>" . " <tr>" . " <td>Team Member</td>" . " <td>Score</td>" . " <td>Helpful Feedback</td>" . " </tr>"; $getgroupmembers = $db->sql_query("SELECT s.Name_First, s.Name_Last, s.SOMS_KEY, s.UID, gs.LDAP_USER FROM ".$prefix."_tl_group_students gs LEFT JOIN ".$prefix."_tl_students s ON s.SOMS_KEY = gs.SOMS_KEY WHERE gs.Group_ID = '$UserGroup' AND gs.LDAP_USER != '$authuser'"); while($row = $db->sql_fetchrow($getgroupmembers)) { $SOMS_KEY = $row['SOMS_KEY']; $UID = $row['UID']; $Name_First = $row['Name_First']; $Name_Last = $row['Name_Last']; echo"<tr>" ."<td align='center'> $Name_First $Name_Last </td>" ."<td>" ."<select name='evalscore'>" ."<option value='7' selected>7</option>" ."<option value='8'>8</option>" ."<option value='9'>9</option>" ."<option value='10'>10</option>" ."<option value='11'>11</option>" ."<option value='12'>12</option>" ."<option value='13'>13</option>" ."</select>" ."</td>" ."<td align='left'><textarea name ='evalcomment' cols='100' colspan='1' rows='2'></textarea></td>" ."</tr>"; } $countgroupmembers = $db->sql_query("SELECT * FROM ".$prefix."_tl_group_students WHERE gs.Group_ID = '$UserGroup'"); $grouptotal = $db->sql_numrows($countgroupmembers); if ($grouptotal = 7) { $Total_Points = 60; } elseif ($grouptotal = 6) { $Total_Points = 50; } elseif ($grouptotal = 5) { $Total_Points = 40; } echo "<tr><td align='left'> Total Points Must = $Total_Points</td>"; echo "<td align='left'>$SUM_Points</td></tr>"; echo "<input type='hidden' name='SOMS_KEY' value='$SOMS_KEY'>\n"; echo "<input type='hidden' name='UID' value='$UID'>\n"; echo "<input type='hidden' name='Course_ID' value='$Course_ID'>\n"; echo "<tr><td colspan=\"3\" align=\"center\"><input type=\"Submit\" name=\"TLInsertPeerEvals\" value=\"Submit\"></td></tr>"; echo"</table>"; echo"</form>"; CloseTable(); include("footer.php"); }
  22. Here is the view source: <td width='15%'>DISEASES OF BLOOD VESSELS & HEART</td> <td align="center"><input type="checkbox" name="status[46]" value="1" > <td align='center'><nobr>[ <a href='admin.php?op=TLSessionEdit&Session_ID=46&Course_ID=CL00000011'>Edit</a> | <a href='admin.php?op=TLSessionRemove&Session_ID=46'>Delete</a> ]</nobr></td><td align='center'> <a href='admin.php?op=TLViewIratGrades&Session_ID=46'><img src='modules/Team_Learning/images/irat.gif' height='16' width='16' border='0' alt='IRAT' title='IRAT'></a> <a href='admin.php?op=TLViewGratGrades&Session_ID=46'><img src='modules/Team_Learning/images/grat.gif' height='16' width='16' border='0' alt='GRAT' title='GRAT'></a> <a href='admin.php?op=TLViewAppExGrades&Session_ID=46'><img src='modules/Team_Learning/images/appex.gif' height='16' width='16' border='0' alt='AppEx' title='AppEx'></a> </td> <td align='center'> <a href='admin.php?op=TLSessionIratGrades&Session_ID=46'><img src='modules/Team_Learning/images/irat.gif' height='16' width='16' border='0' alt='IRAT' title='IRAT'></a> <a href='admin.php?op=TLSessionGratGrades&Session_ID=46'><img src='modules/Team_Learning/images/grat.gif' height='16' width='16' border='0' alt='GRAT' title='GRAT'></a> <a href='admin.php?op=TLSessionAppExGrades&Session_ID=46'><img src='modules/Team_Learning/images/appex.gif' height='16' width='16' border='0' alt='AppEx' title='AppEx'></a> </td> </tr> <tr><td width='10%'><img src='modules/Team_Learning/images/options.png'> Cardio TL#2</td> <td width='10%'>2008-01-17</td> <td width='15%'>Pharmacology</td> <td align="center"><input type="checkbox" name="status[47]" value="1" > <td align='center'><nobr>[ <a href='admin.php?op=TLSessionEdit&Session_ID=47&Course_ID=CL00000011'>Edit</a> | <a href='admin.php?op=TLSessionRemove&Session_ID=47'>Delete</a> ]</nobr></td><td align='center'> <a href='admin.php?op=TLViewIratGrades&Session_ID=47'><img src='modules/Team_Learning/images/irat.gif' height='16' width='16' border='0' alt='IRAT' title='IRAT'></a> <a href='admin.php?op=TLViewGratGrades&Session_ID=47'><img src='modules/Team_Learning/images/grat.gif' height='16' width='16' border='0' alt='GRAT' title='GRAT'></a> <a href='admin.php?op=TLViewAppExGrades&Session_ID=47'><img src='modules/Team_Learning/images/appex.gif' height='16' width='16' border='0' alt='AppEx' title='AppEx'></a> </td> <td align='center'> <a href='admin.php?op=TLSessionIratGrades&Session_ID=47'><img src='modules/Team_Learning/images/irat.gif' height='16' width='16' border='0' alt='IRAT' title='IRAT'></a> <a href='admin.php?op=TLSessionGratGrades&Session_ID=47'><img src='modules/Team_Learning/images/grat.gif' height='16' width='16' border='0' alt='GRAT' title='GRAT'></a> <a href='admin.php?op=TLSessionAppExGrades&Session_ID=47'><img src='modules/Team_Learning/images/appex.gif' height='16' width='16' border='0' alt='AppEx' title='AppEx'></a> </td> </tr> <tr><td width='10%'><img src='modules/Team_Learning/images/options.png'> Cardio TL#3</td> <td width='10%'>2008-01-24</td> <td width='15%'>ECKOCARDIOGRAM</td> <td align="center"><input type="checkbox" name="status[48]" value="1" > <td align='center'><nobr>[ <a href='admin.php?op=TLSessionEdit&Session_ID=48&Course_ID=CL00000011'>Edit</a> | <a href='admin.php?op=TLSessionRemove&Session_ID=48'>Delete</a> ]</nobr></td><td align='center'> <a href='admin.php?op=TLViewIratGrades&Session_ID=48'><img src='modules/Team_Learning/images/irat.gif' height='16' width='16' border='0' alt='IRAT' title='IRAT'></a> <a href='admin.php?op=TLViewGratGrades&Session_ID=48'><img src='modules/Team_Learning/images/grat.gif' height='16' width='16' border='0' alt='GRAT' title='GRAT'></a> <a href='admin.php?op=TLViewAppExGrades&Session_ID=48'><img src='modules/Team_Learning/images/appex.gif' height='16' width='16' border='0' alt='AppEx' title='AppEx'></a> </td> <td align='center'> <a href='admin.php?op=TLSessionIratGrades&Session_ID=48'><img src='modules/Team_Learning/images/irat.gif' height='16' width='16' border='0' alt='IRAT' title='IRAT'></a> <a href='admin.php?op=TLSessionGratGrades&Session_ID=48'><img src='modules/Team_Learning/images/grat.gif' height='16' width='16' border='0' alt='GRAT' title='GRAT'></a> <a href='admin.php?op=TLSessionAppExGrades&Session_ID=48'><img src='modules/Team_Learning/images/appex.gif' height='16' width='16' border='0' alt='AppEx' title='AppEx'></a> </td> You can see the value for status from these three lines <td align="center"><input type="checkbox" name="status[46]" value="1" > <td align="center"><input type="checkbox" name="status[47]" value="1" > <td align="center"><input type="checkbox" name="status[48]" value="1" > It is still writing the last record out of the three even though I clicked the first or second checkbox. I am unsure what you mean here:
  23. I have a form with several records displayed in each row. There are only one input field per record. It is a simple checkbox to update the status of each record. The form submits to itself. echo "<form action='".$_server['php_self']."' method='post'>"; My checkbox is here: <td align="center">Complete: <input type="checkbox" name="status[{Session_ID}]" value="1" <?php if($status == "1"){echo " CHECKED";}?>> There are two values that I would need from this. The Session_ID for this record and the value of status (the checkbox). I click Update here: echo "<td colspan=\"7\" align=\"center\"><input type=\"Submit\" name=\"Update\" value=\"Update\"></td>"; ..and then check for the value of _POST when the page refreshes. if(isset($_POST["Update"]) && ""!=$_POST["Update"]) { foreach($_POST['status'] as $Key => $value) { $setstatus = $db->sql_query("UPDATE ".$prefix."_tl_session SET status ='$value' WHERE Session_ID = '$Key'"); //die('<br />$setstatus = '.$setstatus.'<br />'); if (!$setstatus) { echo("<p>Error performing query: " . mysql_error() . "</p>"); exit(); } } } It's not working yet and can anyone tell me where I went wrong? I was getting the interpreted value of $setstatus here die('<br />$setstatus = '.$setstatus.'<br />'); and it was giving me $setstatus = 1 The page I have has three records on it and I try to update the second one, but it looks like the last one is getting updated and getting set to 1.
  24. I have a process where I need to upload a csv file to import to a MySQL database. The webserver and db are not on the same server. I think the problem is that the db cannot see the temp file that gets uploaded to /private/var/ webserver so it fails to import using $sql = "LOAD DATA INFILE I was going to try and physically upload the file to a uploadcache directory on the webserver, such as $fileName = basename($_FILES['file_source']['name']); move_uploaded_file($_FILES['file_source']['tmp_name'], $uploadFolder.$fileName); then define a path such as $uploadServer = $_SERVER["HTTP_HOST"]; $uploadFolder = $_SERVER['DOCUMENT_ROOT'] . "/atlas/modules/$modname/uploadcache/"; then try $sql = "LOAD DATA INFILE '".$uploadServer."".$uploadFolder."".$fileName."' but I don't think I have the concatenation correct. is this possible? Since it is only about 100 records I was also thinking of doing it like this. $uploadServer = $_SERVER["HTTP_HOST"]; $uploadFolder = $_SERVER['DOCUMENT_ROOT'] . "/atlas/modules/$modname/uploadcache/"; $csvFile = $uploadServer.$uploadFolder.$fileName; $csv = file_get_contents($csvFile); $breaker = "\n"; $fields = array('ReportNumber', 'Student_ID', 'Name_Last', 'Name_First', 'Total_RS', 'Total_Percent', 'Percentile', 'Subtest_RS', 'Subtest_Percent'); $lines = explode($breaker, $csv); $sql = "INSERT INTO `$table_name` ('" . implode(", '", $fields) . "') VALUES "; $db->sql_query($sql); if (!$sql) {echo("<p>Error performing query: " . mysql_error() . "</p>");} $i=0; foreach($lines as $line) { if($i>0 && ($i%100 == 0)) { $query = substr($query, 0, -1); // Get rid of trailing comma $query .= "; INSERT INTO `$table_name` ('" . implode("', '", $fields) . "') VALUES "; } $values = explode(',', $line); $query .= " ('" . implode("', '", $values) . "'),"; } $result = $db->sql_query($query); if (!$result) {echo("<p>Error performing query: " . mysql_error() . "</p>");} if(mysql_affected_rows() != count($lines)) die('MySQL Insert failed to insert all entries.'); else header("Location: ".$admin_file.".php?op=TLScantronIratInsert&Session_ID=$Session_ID"); } ?> But am having a hard time understanding this code with arrays. Specifically why he has two INSERT INTO statements.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.