$prjSel = new PrjMilestoneSelector2($dbConn, $peer_id, $prjm_id); extract($prjSel->getSelectedData()); $_SESSION['prj_id'] = $prj_id; $_SESSION['prjm_id'] = $prjm_id; $_SESSION['milestone'] = $milestone; if (isset($_POST['criterium_id']) && isset($_POST['setcrit'])) { $critset = implode(",", $_POST['criterium_id']); $sql = "begin work;\n" . "delete from prjm_criterium where prjm_id={$prjm_id} and criterium_id not in ({$critset});\n" . "insert into prjm_criterium select {$prjm_id},criterium_id from base_criteria \n" . " where criterium_id in ({$critset}) and ({$prjm_id},criterium_id) not in (select prjm_id,criterium_id from prjm_criterium);\n" . "commit\n"; $resultSet = $dbConn->Execute($sql); if ($resultSet === false) { $dbConn->log("cannot insert appplied criteria with <pre>{$sql}</pre>, reason: " . $dbConn->ErrorMsg() . "<br/>\n"); $dbConn->Execute("rollback;"); } } $prj_id = isset($_SESSION['prj_id']) ? $_SESSION['prj_id'] : -1; extract(getTutorOwnerData($dbConn, $prj_id)); $_SESSION['prj_id'] = $prj_id; $isTutorOwner = $tutor == $tutor_code; $page = new PageContainer(); $page->setTitle('Peer assessment, define project'); $page_opening = "Define the number of criteria for the project."; $nav = new Navigation($tutor_navtable, basename($PHP_SELF), $page_opening); $nav->setInterestMap($tabInterestCount); $page->addBodyComponent($nav); $form1 = new HtmlContainer("<fieldset id='form1'><legend><b>Project milestone and number of criteria.</b></legend>"); $form1Form = new HtmlContainer("<form id='project' method='post' name='project' action='{$PHP_SELF}'>"); $input_prj_selector = "<select name='prj_id' onchange='submit()'>\n" . getOptionListGrouped($dbConn, "select afko||': '||description||' ('||year||')' as name" . ", year as namegrp,prj_id as value from project order by year desc,afko", $prj_id) . "\n</select>\n"; if ($isTutorOwner) { $input_num_criteria = "<input class='" . $validator->validationClass('critcount') . "' type='text' align='right' size='1' maxlength='2' name='critcount' value='{$critcount}'/>"; $input_submit_button = "<input type='submit' name='setcrit' value='Set Criteria'/>"; } else {
$resultSet = $dbConn->Execute($sql); if ($resultSet === false) { echo "<br>Cannot set project values with<pre>" . $sql . "</pre> reason " . $dbConn->ErrorMsg() . "<br>"; $dbConn->Execute("rollback"); stacktrace(1); die; } else { $dbConn->Execute("commit"); } } } // insert into session $_SESSION['class_ids'] = $class_ids; } $prj_id = isset($_SESSION['prj_id']) ? $_SESSION['prj_id'] : -1; extract(getTutorOwnerData($dbConn, $prj_id), EXTR_PREFIX_ALL, 'ot'); $_SESSION['prj_id'] = $prj_id = $ot_prj_id; $isTutorOwner = $ot_tutor == $tutor_code; if ($isTutorOwner) { $submit_button = '<button name=\'bsubmit\' value=\'submit\'>Submit</button>'; } else { $submit_button = ''; } $resultSet = $dbConn->execute("select count(*) as participants from prj_grp join prj_tutor using(prjtg_id) where prjm_id={$prjm_id}"); extract($resultSet->fields); // generating output $page = new PageContainer(); $page->setTitle('Select participating student_class'); $page_opening = "Select the student_class of the participating students"; $nav = new Navigation($tutor_navtable, basename($PHP_SELF), $page_opening); $page->addBodyComponent($nav);