function getSelector() { $query = $this->getQuery(); $result = "<!--prjMilestoneSelector2-->" . "\n\t<select name='" . $this->selectorName . "' " . ($this->submitOnChange ? " onchange='submit()' " : "") . ">\n" . getOptionListGrouped($this->dbConn, $query, $this->prjm_id) . "\n\t</select>\n" . "\n<!--/prjMilestoneSelector2-->\n"; // echo $query; return $result; }
/** * Get a class by cluster, faculty, name and class_id * @param $dboon db connector * @param $selector_name, name and id of html select * @parem $current_selection the selected class */ function hoofdgrpSelector($dbConn, $selector_name, $current_selection) { global $peer_id; $query = "select trim(hoofdgrp) as value, " . " trim(faculty_short)||'.'||hoofdgrp||' count '||hs.grp_size as name,\n" . " trim(faculty_short)||'-'||trim(course_short) as namegrp, \n" . " case when (faculty_id,course)=(select faculty_id,opl from student where snummer={$peer_id}) then 0\n" . " when (faculty_id)=(select faculty_id from student where snummer={$peer_id}) then 1\n" . " else 2 end as my_faculty \n" . " from hoofdgrp_s h natural join hoofdgrp_size hs natural join faculty\n" . " order by my_faculty,namegrp, name"; $result = "<select name='{$selector_name}' id='{$selector_name}' >\n" . getOptionListGrouped($dbConn, $query, $current_selection) . "</select>\n"; return $result; }
/** * Get the computed selector. * @return string the html select. * */ function getSelector() { $where = ''; if (count($this->queryConstriant) > 0) { $where = "\n where \n" . join("\n and ", $this->queryConstriant); } $query = $this->queryHead . "\n from\n " . $this->queryFrom . ' ' . $where . ' ' . " order by " . $this->querySort; $result = "<select name='{$this->selectorName}' id='{$this->selectorName}'" . ($this->autoSubmit ? " onchange='submit()'" : "") . ">\n" . getOptionListGrouped($this->dbConn, $query, $this->currentSelection) . "</select>\n"; return $result; }
$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 { $input_num_criteria = "{$critcount}"; $input_submit_button = ''; } $project_selector = $prjSel->getSelector(); $sql = "select bc.criterium_id as bc,pc.criterium_id as ac,pc.criterium_id as uc,nl_short,nl,de_short,de,en_short,en\n" . " from base_criteria bc natural left join (select prjm_id,criterium_id from prjm_criterium \n" . " where prjm_id={$prjm_id}) pc order by bc"; $resultSet = $dbConn->Execute($sql); if ($resultSet === false) { $dbConn->log("cannot get date with {$sql}, reason: " . $dbConn->ErrorMsg() . "<br/>\n"); } $rainbow = new RainBow(STARTCOLOR, COLORINCREMENT_RED, COLORINCREMENT_GREEN, COLORINCREMENT_BLUE); $table = "<table style='border-collapse:collapse' border='1'>\n<tr valign='top' >\n <th>C</th>\n <th>S</th>\n <th>U</th>\n <th colspan='2'>NL</th>\n <th colspan='2'>DE</th>\n <th colspan='2'>EN</th>\n </tr>";
/** * expand the item into an <input...> or <select>...</select> */ function expand() { global $validator; global $_SESSION; //global $page; global $login_snummer; $cssClass = $validator->validationClass($this->name); $result = ''; $onChange = ''; $alignText = ' style="text-align:left;"'; $textSize = $this->item_length; $validClass = " class='{$cssClass}' "; switch (substr($this->data_type, 0, 1)) { case 'N': $textSize = $this->data_precision; $alignText = ' style="text-align:right;" '; break; default: case 'C': break; } $readText = hasCap($this->capability) ? '' : ' readonly="readonly"'; $sizeText = $textSize > 0 ? ' size="' . $textSize . '"' : ''; switch ($this->edit_type) { case 'A': $maxCols = 80; $cols = $textSize; $rows = 1; if ($textSize > $maxCols) { $cols = $maxCols; $rows = floor(($textSize + $maxCols) / $maxCols); } // HACK // $rows=12;$cols=72; $result .= '<textarea id="' . $this->name . '" name="' . $this->name . '" cols="' . $cols . '" rows="' . $rows . '">' . $this->value . '</textarea>'; break; // informational, value only, no vardef. // informational, value only, no vardef. case 'b': $checkedTrue = isset($this->value) && $this->value == 't' ? 'selected' : ''; $checkedFalse = isset($this->value) && $this->value == 'f' ? 'selected' : ''; /* $result .= "<input type='checkbox' {$checked} name='{$this->name}'" */ /* . " value='{$this->placeholder}' " */ /* . "style='vertical-align:middle;'><span style='font-weight:bold'>" */ /* .niceName($this->name) */ /* ."</span></input>\n"; */ $result .= "<label style='font-weigth:bold' for='{$this->name}'>{$this->name}</label><select name='{$this->name}' id='{$this->name}'>\n\t<option value=''></option>\n" . "\t<option " . $checkedFalse . " value='false'>False</options>\n" . "\t<option " . $checkedTrue . " value='true'>True</options>\n" . "</select>\n"; break; case 'I': $result .= '<div class="informational"' . $alignText . $validClass . '>' . $this->value . '</div> ' . "\n"; break; /* hidden only */ /* hidden only */ case 'H': $result .= '<input type="hidden" id="' . $this->name . '" name="' . $this->name . '" value ="' . $this->value . '"/>' . "\n"; break; /* Visible, not editable */ /* Visible, not editable */ case 'Q': $result .= '<input type="hidden" id="' . $this->name . '" name="' . $this->name . '" value ="' . $this->value . '"/>' . '<span class="sequence"> ' . $this->value . '</span>' . "\n"; break; case 'V': $result .= '<input type="hidden" id="' . $this->name . '" name="' . $this->name . '" value ="' . $this->value . '"/><span class="visible"' . $alignText . '>' . $this->value . '</span>' . "\n"; break; case 'P': // Image. wrap without border and alt text if (isset($this->value)) { $pict = 'fotos/' . $this->value; $result .= '<img src=\'' . $pict . '\' alt=\'' . $this->value . '\' border=\'0\' />'; } else { $result = ''; } break; case 'C': // Creator-owner // Creator-owner case 'G': if (!empty($this->selectQuery)) { $result .= '<select id="' . $this->name . '" name="' . $this->name . '" ' . "{$onChange}" . ' onkeypress="selectKeyPress();" onkeydown="selectKeyDown();" onblur="clr();" ' . 'onfocus="clr();">' . "\n"; extract($_SESSION); $q = $this->selectQuery; eval("\$q=\"{$q}\";"); $result .= getOptionListGrouped($this->dbConn, $q, $this->value, 'value', isset($this->optionPreloadList) ? $this->optionPreloadList : array('name' => ' ', 'value' => '')); $result .= "\n" . '</select>' . "\n"; } else { $result .= '<input' . $alignText . $sizeText . $readText . $validClass . ' type="text" id="' . $this->name . '" name="' . $this->name . '" value="' . $this->value . '"/>' . "\n"; } break; case 'M': $onChange = 'onChange="submit();"'; case 'S': if (!empty($this->selectQuery)) { $result .= '<select id="' . $this->name . '" name="' . $this->name . '" ' . "{$onChange}" . ' onkeypress="selectKeyPress();" onkeydown="selectKeyDown();" onblur="clr();" ' . 'onfocus="clr();">' . "\n"; extract($_SESSION); $q = $this->selectQuery; //echo "<pre style='color:blue'> {$_SESSION['prjm_id']}:{$q}</pre>"; eval("\$q=\"{$q}\";"); //echo "<pre style='color:green'>{$q}</pre>"; $result .= getOptionList($this->dbConn, $q, $this->value, isset($this->optionPreloadList) ? $this->optionPreloadList : array('name' => ' ', 'value' => '')); $result .= "\n" . '</select>' . "\n"; } else { $result .= '<input' . $alignText . $sizeText . $readText . $validClass . ' type="text" id="' . $this->name . '" name="' . $this->name . '" value="' . $this->value . '"/>' . "\n"; } break; case 'D': $result = "<!-- datepicker --><input type='text' placeholder='yyyy-mm-dd' style='text-align:left;' size='10' name='" . $this->name . "' id='" . $this->name . "' value='" . $this->value . "'/>\n"; $this->page->addScriptResource('js/jquery-1.7.1.min.js')->addScriptResource('js/jquery-ui-1.8.17.custom.min.js')->addFileContentsOnce('templates/simpledatepicker.html')->addJqueryFragment("\$('#" . $this->name . "').datepicker(dpoptions);"); break; case 't': $result = "<input type='time' placeholder='HH:MM' style='text-align:left;' size='8' name='" . $this->name . "' id='" . $this->name . "' value='" . $this->value . "'/>\n"; break; case 'e': $result = "<input type='email' placeholder='" . $this->placeholder . "' style='text-align:left;' size='64' name='" . $this->name . "' id='" . $this->name . "' value='" . $this->value . "'/>\n"; break; case 'd': $result = "<input type='number' placeholder='" . $this->placeholder . "' pattern='\\d+' style='text-align:right;' size='10' name='" . $this->name . "' id='" . $this->name . "' value='" . $this->value . "'/>\n"; break; case 'p': // use peer_id of person logged in, unless it is a tutor. if (hasCap(CAP_TUTOR)) { $result = "<input type='number' placeholder='2123456' pattern='\\d{7}' size='7' " . "name='" . $this->name . "' id='" . $this->name . "' value='" . $this->value . "'/>\n"; } else { $result = $login_snummer; } break; // intentional fallthrough // intentional fallthrough case 'X': /* data is editable (for search) but discarded on insert */ $result = $this->value; break; case 'U': /* mutator is editable (for search) but discared on insert */ /* mutator is editable (for search) but discared on insert */ case 'T': default: $result .= '<input' . $alignText . $sizeText . $readText . $validClass . ' type="text" id="' . $this->name . '" name="' . $this->name . '" value="' . $this->value . '" placeholder="' . $this->placeholder . '"/>' . "\n"; break; case 'C': $result .= '<input type=\'checkbox\' name=\'' . $this->name . '\' value=\'t\' ' . ($this->value == 't' ? 'checked' : '') . '/> ' . "\n"; break; case 'Z': // to print out data in supp fields $result .= '<b>' . $this->value . '</b>'; break; } // var_dump($this); echo "<br>"; return $result; }
$memberset = '\'' . implode("','", $_POST['members']) . '\''; $sql = "begin work;\n" . "delete from assessment where prjtg_id in (select prjtg_id from prj_tutor where prjm_id = {$prjm_id}) \n" . " and judge in ({$memberset});\n" . "delete from assessment where prjtg_id in (select prjtg_id from prj_tutor where prjm_id = {$prjm_id}) \n" . " and contestant in ({$memberset});\n" . "delete from prj_grp where prjtg_id in (select prjtg_id from prj_tutor where prjm_id = {$prjm_id})\n" . " and snummer in ({$memberset});\n" . "commit"; // echo "<pre>$sql</pre>"; $resultSet = $dbConn->Execute($sql); if ($resultSet === false) { print 'error deleting reason: ' . $dbConn->ErrorMsg() . '<br> with' . $sql . '<br>'; $dbConn->Execute('rollback'); } } $sql = "select lower(rtrim(afko)) as afko,year,lower(btrim(course_short)) as course from project natural join prj_milestone natural join fontys_course where prjm_id={$prjm_id}"; $resultSet = $dbConn->Execute($sql); extract($resultSet->fields); } $studentListQuery = "SELECT apt.grp_num||': '||achternaam||', '||roepnaam||' '||" . "coalesce(voorvoegsel,'')||';'||coalesce(cl.sclass,'null-class')::text AS name,\n" . "st.snummer as value,'cohort='||cohort as title,\n" . "apt.grp_num||', '||tutor||coalesce(':'||grp_name,'')||' '\n" . "||(case when apt.prj_tutor_open=true then 'open' else 'closed' end) as namegrp,\n" . " apt.grp_num,nationaliteit\n" . " from (select prjtg_id,prjm_id,grp_num,prj_tutor_open,tutor_id,grp_name from prj_tutor where prjm_id={$prjm_id}) apt\n" . " join prj_grp pg using(prjtg_id) join student st using (snummer)\n" . " join student_class cl using(class_id) \n" . " join tutor t on(userid=tutor_id)" . " left join grp_alias using(prjtg_id)" . " WHERE apt.prjm_id={$prjm_id}\n" . " order by grp_num,achternaam,roepnaam"; $dbConn->log($studentListQuery); $studentList = getOptionListGrouped($dbConn, $studentListQuery, $grp_num, 'grp_num'); $isAdmin = hasCap(CAP_SYSTEM) ? 'true' : 'false'; $sql = "select tutor,tutor_id from prj_tutor join tutor on(prj_tutor.tutor_id=tutor.userid)" . " where prjm_id={$prjm_id} and grp_num='{$grp_num}'"; $resultSet = $dbConn->Execute($sql); if ($resultSet === false) { print 'error selecting: ' . $dbConn->ErrorMsg() . '<br> with ' . $sql . ' <br/>'; } if (!$resultSet->EOF) { $tutor = $resultSet->fields['tutor']; } $sql = "select grp_num||' '||coalesce(grp_name,'g'||grp_num)||': '||achternaam||', '||roepnaam||' '" . "||coalesce(voorvoegsel,'')||' ('||faculty.faculty_short||':'" . "||tutor.tutor||';'||tutor.userid||')' as name,\n" . " grp_num as value" . " from prj_tutor join tutor on(tutor.userid=prj_tutor.tutor_id)\n" . " join student on (userid=snummer)\n" . " join faculty on (faculty.faculty_id=tutor.faculty_id)\n" . " natural left join grp_alias \n " . " where prjm_id={$prjm_id} order by grp_num"; //$dbConn->log($sql); $grpList = getOptionList($dbConn, $sql, $grp_num); // test to see if the tables are already filled with data $sql = "select count(*) as rowcount from assessment a join prj_tutor pt on (a.prjtg_id=pt.prjtg_id) where pt.prjm_id={$prjm_id} and grade != 0"; $resultSet = $dbConn->Execute($sql);
function getSelector() { $result = "\t<select name='" . $this->selectorName . "' " . ($this->submitOnChange ? "onchange='submit()'" : "") . ">\n" . getOptionListGrouped($this->dbConn, $this->getQuery(), $this->selectedElement) . "\n\t</select>\n"; return $result; }
$spreadSheetWidget = $spreadSheetWriter->getWidget(); $sqlhead = "select distinct '<a href=''student_admin.php?snummer='||snummer||'''target=''_blank''>'||snummer||'</a>' as snummer,\n" . "'<img src='''||photo||''' style=''height:24px;width:auto;''/>' as foto,\n" . "achternaam||rtrim(coalesce(', '||voorvoegsel,'')::text) as achternaam ,roepnaam, \n" . "pcn,cohort,t.tutor as slb,gebdat as birth_date,rtrim(email1) as email1,\n" . "studieplan_short as studieplan,faculty_short as facul,sclass,hoofdgrp,\n" . "straat,huisnr,plaats,phone_gsm,phone_home\n" . " from \n"; $sql2 = $sqlhead . ' student_email s natural join portrait ' . $sqltail; //$dbConn->log($sql2); $scripts = '<script type="text/javascript" src="js/jquery.js"></script> <script src="js/jquery.tablesorter.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#myTable").tablesorter({widgets: [\'zebra\']}); }); </script> <link rel=\'stylesheet\' type=\'text/css\' href=\'' . SITEROOT . '/style/tablesorterstyle.css\'/> '; $sql_slb = "select mine,namegrp,name,userid as value from tutor_selector({$peer_id}) \n" . "order by mine,namegrp,name"; $slbList = "<select name='slb'>\n" . getOptionListGrouped($dbConn, $sql_slb, $slb) . "\n</select>"; pagehead2('list students by a slb', $scripts); $page_opening = "student list for slb "; $nav = new Navigation($tutor_navtable, basename($PHP_SELF), $page_opening); $nav->setInterestMap($tabInterestCount); echo $nav->show(); ?> <div id='navmain' style='padding:1em;'> <fieldset><legend>Select students by slb (study coach)</legend> <p>Choose the slb for to see then pupils.</p> <p>If you want to retrieve it (named <?php echo $filename; ?> ) as a <strong>spread sheet</strong>, select the spreadsheet option below.</p> <form method="get" name="project" action="<?php
$achternaam = "<input type='text' name='achternaam' value='{$achternaam}' size='20'/>"; $roepnaam = "<input type='text' name='roepnaam' value='{$roepnaam}' size='20'/>"; $voorvoegsel = "<input type='text' name='voorvoegsel' value=\"{$voorvoegsel}\" size='10'/>"; $voorletters = "<input type='text' name='voorletters' value='{$voorletters}' size='8'/>"; $straat = "<input type='text' name='straat' value='{$straat}' size='20'/>"; $huisnr = "<input type='text' name='huisnr' value='{$huisnr}' size='5' />"; $plaats = "<input type='text' name='plaats' value='{$plaats}' size='20' />"; $pcode = "<input type='text' name='pcode' value='{$pcode}' size='8'/>"; $pcn = "<input type='text' name='pcn' value='{$pcn}' size='6'/>"; $cohort = "<input type='text' name='pcn' value='{$cohort}' size='4'/>"; $class_id = "<select name='class_id'>" . getOptionListGrouped($dbConn, "select distinct rtrim(faculty_short)||':'||rtrim(sclass) as name,\n" . "c.class_id as value,sclass,faculty_short as namegrp\n" . " from student_class c join class_size cs on(c.class_id=cs.class_id) " . "join faculty f on(c.faculty_id=f.faculty_id) \n" . "order by namegrp,name,value", $class_id) . "</select>"; $faculteit = "<select name='faculty_id'>\n" . getOptionList($dbConn, "select distinct faculty_id||': '||rtrim(faculty.full_name) as name,faculty_id as value\n" . " from faculty \n" . "order by name,value ", $faculty_id) . "</select>"; $course_description = "<select name='opl'>" . getOptionListGrouped($dbConn, "select distinct rtrim(course_description) as name,\n" . "course as value,\n" . "i.faculty_short as namegrp\n" . " from fontys_course " . "join faculty i using(faculty_id) \n" . "order by namegrp,name,value ", $opl) . "</select>"; $nationaliteit = "<select name='nationaliteit'>" . getOptionList($dbConn, "select name,value from nationality", $nationaliteit) . "</select>"; //$hoofdgrp="<input type='text' name='hoofdgrp' value='$hoofdgrp' size='6' />"; $hoofdgrp = "<select name='hoofdgrp'>" . getOptionListGrouped($dbConn, "select distinct rtrim(hoofdgrp) as name,\n" . "rtrim(hoofdgrp) as value,f.faculty_short as namegrp\n" . " from student s left join \n" . "student_class c on (hoofdgrp=sclass) " . "join faculty f on(c.faculty_id=f.faculty_id) \n" . "order by namegrp,name,value ", $hoofdgrp) . "</select>"; $email1f = "<input type='text' name='email1' value='{$email1}' size='50' />"; $lang = "<select name='lang'>" . getOptionList($dbConn, "select language as name,lang_code as value from uilang", $lang) . "</select>"; } if (isset($tweede_opl)) { $tweede_opl = "<tr><th align='left'>Tweede opl</th><td>" . $tweede_opl . "</td></tr>\n"; } else { $tweede_opl = ''; } ob_start(); ?> <div style='padding:1em'> <fieldset><legend>These email addresses will be used for notifications</legend> <form name='email' method='post' action='<?php echo $PHP_SELF; ?>
} //echo "<pre>$sql</pre>\n"; $_SESSION['prj_id'] = $prj_id; extract(getTutorOwnerData($dbConn, $prj_id)); $isTutorOwner = $tutor == $tutor_code; $page = new PageContainer(); $page->setTitle('Peer assessment, define project'); $nav = new Navigation($tutor_navtable, basename($PHP_SELF), $page_opening); $form1 = new HtmlContainer("<div>"); $input_module_code = "<input type='text' size='10' maxlength='10' class='" . $validator->validationClass('afko') . "' name='afko' value='{$afko}' title='Progress module code'/>"; $input_year = "<input type=text size='4' maxlength='4' align='right' name='year' class='" . $validator->validationClass('year') . "' value='{$year}' title='starting year of scollastic year' />"; $input_description = "<input type='text' size='30' maxlength='30' name='project_description' class='" . $validator->validationClass('project_description') . "' value='{$description}' title='module description in 30 characters'/>\n"; $input_valid_until = "<input type='text' maxlength='10' size='8' class='" . $validator->validationClass('valid_until') . "' " . "name='valid_until' id='embeddedPicker' value='{$valid_until}' title='Project entry to be used until. Date in yyyy-mm-dd format' style='text-align:right'/>\n"; $input_comment = "<textarea class='" . $validator->validationClass('comment') . "' name='comment' cols='72' rows='5'>{$comment}</textarea>\n"; $input_update_button = $isTutorOwner ? "<input type='submit' name='bsubmit'\n" . "value='Update' title='Use this to update project data for project_id={$prj_id}' />" : ''; $input_course = "<select name='course' title='set base course'>\n" . getOptionListGrouped($dbConn, "select trim(course_short)||':'||trim(course_description)||'('||course||')' as name,\n" . " course as value,\n" . " faculty_short as namegrp\n" . " from fontys_course fc natural join faculty f\n" . " order by namegrp,name", $course); $project_selector = getprojectSelector($dbConn, $peer_id, $prj_id); $sql = "select count(prj_id) as active_project_set from activity_project where prj_id={$prj_id}"; $resultSet = $dbConn->Execute($sql); if ($resultSet === false) { die("<br>Cannot activity_project data with <pre>{$sql}</pre> " . $dbConn->ErrorMsg() . "<br>"); } $activity_project_checked = $resultSet->fields['active_project_set'] ? 'checked' : ''; $input_activity_project = "<input type='checkbox' name='activity_project' value='set' {$activity_project_checked}/>"; $templatefile = 'templates/defproject.html'; $template_text = file_get_contents($templatefile, true); if ($template_text === false) { $form1Form->addText("<strong>cannot read template file {$templatefile}</strong>"); } else { eval("\$text = \"{$template_text}\";"); $form1->addText($text);
$resultSet = $dbConn->Execute($sql); if ($resultSet === false) { die("<br>Cannot update student with " . $sql . " reason " . $dbConn->ErrorMsg() . "<br>"); } } $class_sql = "select distinct student_class.sclass||'#'||class_id||' (#'||coalesce(student_count,0)||')' as name,\n" . "class_id as value, \n" . " trim(faculty_short)||'.'||trim(coalesce(cluster_name,'')) as namegrp, \n" . " faculty_short,\n" . " case when class_cluster=(select class_cluster from student join student_class using(class_id) where snummer={$peer_id}) then 0 else 1 end as myclass " . " from student_class " . " natural left join class_cluster\n" . " left join faculty using(faculty_id) \n" . " left join class_size using(class_id) \n" . "order by myclass,namegrp,name"; $pp = array(); $classSelectorClass = new ClassSelectorClass($dbConn, $oldclass_id); $pp['oldClassOptionsList'] = $classSelectorClass->setSelectorName('oldclass_id')->addConstraint('sort1 < 10 and student_count <>0')->setAutoSubmit(true)->getSelector(); $page_opening = "Get and set Student Study coach (SLB) by class."; $page = new PageContainer(); $page->setTitle("Set/check SLB"); $nav = new Navigation($tutor_navtable, basename($PHP_SELF), $page_opening); $nav->setInterestMap($tabInterestCount); $sql_slb = "select achternaam||','||roepnaam||' ['||tutor||']' as name,\n" . " snummer as value,faculty_short||'-'||course_short as namegrp \n" . " from tutor_join_student tjs left join faculty using(faculty_id)\n" . " left join fontys_course fc on (tjs.opl=fc.course)\n" . " order by namegrp,faculty,achternaam,roepnaam "; $pp['slbList'] = getOptionListGrouped($dbConn, $sql_slb, $slb); $css = '<link rel=\'stylesheet\' type=\'text/css\' href=\'' . SITEROOT . '/style/tablesorterstyle.css\'/>'; $page->addScriptResource('js/jquery.js'); $page->addScriptResource('js/jquery.tablesorter.js'); $page->addHeadText($css); $page->addJqueryFragment('$("#myTable").tablesorter({widgets: [\'zebra\'],headers: {0:{sorter:false}}});'); //echo "<pre>\n";print_r($_REQUEST); echo"</pre>\n"; $page->addBodyComponent($nav); $sql = "SELECT '<input type=''checkbox'' name=''studenten[]'' value='''||st.snummer||'''/>' as chk," . "'<a href=''student_admin.php?snummer='||snummer||'''>'||st.snummer||'</a>' as snummer," . "'<img src='''||photo||''' style=''height:24px;width:auto;''/>' as foto,\n" . "achternaam||', '||roepnaam||coalesce(' '||voorvoegsel,'') as naam,pcn," . "t.tutor as slb," . "sclass as klas," . " hoofdgrp," . " cohort,course_short sprogr,studieplan_short as splan,lang,sex,gebdat," . " land,plaats,pcode\n" . " from student st \n" . "join student_class cl using(class_id)\n" . "natural left join studieplan \n" . "left join fontys_course fc on(st.opl=fc.course)\n" . "left join tutor t on (st.slb=t.userid)\n" . "natural left join portrait \n" . "where class_id='{$oldclass_id}' " . "order by hoofdgrp,st.opl,sclass asc,achternaam,roepnaam"; //simpletable($dbConn,$sql,"<table id='myTable' class='tablesorter' summary='your requested data'" // ." style='empty-cells:show;border-collapse:collapse' border='1'>"); $tableFormatter = new SimpleTableFormatter($dbConn, $sql, $page); $tableFormatter->setCheckName('studenten[]'); $tableFormatter->setCheckColumn(0); $tableFormatter->setTabledef("<table id='myTable' class='tablesorter' summary='your requested data'" . " style='empty-cells:show;border-collapse:collapse' border='1'>"); $pp['cTable'] = $tableFormatter;
$nav->setInterestMap($tabInterestCount); $sqltut = "select prjtg_id,t.tutor,pt.tutor_id,pt.grp_num, " . "gs.size as scount, rtrim(grp_name) as grp_name\n" . " from prj_tutor pt \n" . " join tutor t on (t.userid=pt.tutor_id)\n" . " left join grp_size gs using(prjtg_id)\n" . "where prjm_id={$prjm_id} \n" . "order by grp_num asc"; //echo "<pre>$sqltut</pre>"; $resultSet = $dbConn->Execute($sqltut); if ($resultSet === false) { echo "<br>Cannot get groups with \"" . $sqltut . '", cause ' . $dbConn->ErrorMsg() . "<br>"; stacktrace(1); die; } $rowCounter = 1; $rows = ''; while (!$resultSet->EOF) { extract($resultSet->fields); $rowClass = $rowCounter % 2 === 0 ? 'even' : 'odd'; if ($isTutorOwner) { $tutorList = "\t\t<select name='tutor_id[]'>\n" . getOptionListGrouped($dbConn, "select achternaam||', '||roepnaam||' '||coalesce(voorvoegsel,'')" . "||' ('||tutor||')'||t.userid as name,\n" . " t.userid as value,\n" . " f.faculty_short||'-'||team as namegrp" . " from tutor t join student s on (userid=snummer)\n" . " join faculty f on (t.faculty_id=f.faculty_id)\n" . " order by namegrp,achternaam,roepnaam", $tutor_id) . "\t\t</select>\n"; } else { $sql = "select achternaam||', '||roepnaam||' '||coalesce(voorvoegsel,'')||' ('||tutor||')' as name\n" . " from tutor join student on (userid=snummer)\n" . "where tutor='{$tutor}'"; $resultSet2 = $dbConn->doOrDie($sql); $tutorList = $resultSet2->fields['name']; } $rows .= "\t<tr class='{$rowClass}'>" . "<td rowspan='1'>{$grp_num} <input type='hidden' name='prjtg_id[]' value='{$prjtg_id}'/></td>\n" . "<td rowspan='1'>\n" . "\t\t\t" . $tutorList . "</td>\n" . "<td align='right' rowspan='1'>{$scount}</td>\n" . "<td rowspan='1'>{$prjtg_id}</td>\n" . "<td rowspan='1'><input type='text' name='grp_name[]' value='{$grp_name}' title='short name' size='9' maxlength='15'/></td>" . "\n\t</tr>\n"; $resultSet->moveNext(); $rowCounter++; } if ($isTutorOwner) { $rows .= "<tr><td> </td>\n" . "<td>" . " <input type='hidden' name='grp_count' value='<?= {$grp_count} ?>'/>" . " <input type='hidden' name='prjm_id' value='<?= {$prjm_id} ?>'/>" . " <input type='submit' name='btutor' value='Apply'/>" . "</td><td colspan='3' align='right'><input type='reset' name='reset' value='Reset form'/></td>\n" . "</tr>"; } $thead = " <thead><tr><th>G</th><th>Tutor</th><th align='right'>no</th><th>prjtg</th><th>group name</th></tr></thead>"; echo $nav->show(); ?>
function getSelector() { $asubmit = $this->auto_submit ? 'onchange=\'submit()\'' : ''; $result = "\t<select name='{$this->selector_name}' {$asubmit}>\n" . ($this->groupedSelector ? getOptionListGrouped($this->dbConn, $this->getQuery(), $this->selected) : getOptionList($this->dbConn, $this->getQuery(), $this->selected)) . "\n\t</select>\n"; return $result; }
if ($resultSet === false) { die("<br>Cannot update project groups with " . $sql . " reason " . $dbConn->ErrorMsg() . "<br>"); } } else { if (isset($_POST['delete']) && isset($_POST['studenten'])) { $memberset = '\'' . implode("','", $_POST['studenten']) . '\''; $sql = "BEGIN work;\n" . "DELETE FROM assessment where prjtg_id={$oldprjtg_id} \n" . " AND (judge IN ({$memberset}) OR contestant IN ({$memberset}));\n" . "delete from prj_grp where prjtg_id={$oldprjtg_id} \n" . " AND snummer IN ({$memberset});\n" . "update prj_milestone set prj_milestone_open=false where prjm_id={$prjm_id};\n" . "COMMIT"; $resultSet = $dbConn->Execute($sql); if ($resultSet === false) { die("<br>Cannot delete project groups with " . $sql . " reason " . $dbConn->ErrorMsg() . "<br>"); } } } $grp_sql = "select afko||'.'||year||':'||'g'||to_char(pt.grp_num,'FM09')||': '||coalesce(grp_name,'')||' '||" . "tutor||' ('||pt.prjtg_id||') count='||coalesce(size,'0') as name,\n" . "pt.prjtg_id as value, afko||'.'||year as namegrp\n" . "from project p join prj_milestone pm on(p.prj_id=pm.prj_id) \n" . "join prj_tutor pt on(pt.prjm_id=pm.prjm_id) \n" . " join tutor t on (t.userid=pt.tutor_id)\n" . "left join prjtg_size gs on(gs.prjtg_id=pt.prjtg_id) \n" . "left join grp_alias ga on (pt.prjtg_id=ga.prjtg_id) where pt.prjm_id ={$prjm_id} order by pt.grp_num"; $pp['oldGroupOptionsList'] = getOptionListGrouped($dbConn, $grp_sql, $oldprjtg_id); $pp['newGroupOptionList'] = getOptionListGrouped($dbConn, $grp_sql, $newprjtg_id); $page = new PageContainer(); $page_opening = "Move students between project groups."; $page->setTitle($page_opening); $nav = new Navigation($tutor_navtable, basename($PHP_SELF), $page_opening); $nav->setInterestMap($tabInterestCount); $page->addBodyComponent($nav); $css = '<link rel=\'stylesheet\' type=\'text/css\' href=\'' . SITEROOT . '/style/tablesorterstyle.css\'/>'; $page->addScriptResource('js/jquery.js'); $page->addScriptResource('js/jquery.tablesorter.js'); $page->addHeadText($css); $page->addJqueryFragment('$("#myTable").tablesorter({widgets: [\'zebra\'],headers: {0:{sorter:false}}}); var table = $("#myTable"); table.bind("sortEnd",function() { var i = 0; table.find("tr:gt(0)").each(function(){
$_SESSION['oldclass_id'] = $oldclass_id = $_REQUEST['oldclass_id']; } if (isset($_POST['newhoofdgrp'])) { //$newhoofdgrp= preg_replace('/\W+/g','',$_POST['newhoofdgrp']); $_SESSION['newhoofdgrp'] = $newhoofdgrp = $_POST['newhoofdgrp']; } if (isset($_POST['sethoofdgrp']) && isset($newhoofdgrp) && isset($_POST['studenten'])) { $memberset = '\'' . implode("','", $_POST['studenten']) . '\''; $sql = "update student set hoofdgrp='{$newhoofdgrp}' " . "where snummer in ({$memberset})"; $resultSet = $dbConn->Execute($sql); if ($resultSet === false) { die("<br>Cannot update student with " . $sql . " reason " . $dbConn->ErrorMsg() . "<br>"); } } $class_sql_old = "select distinct student_class.sclass||'#'||class_id||' (#'||coalesce(student_count,0)||')' as name,\n" . "class_id as value, " . " rtrim(faculty_short) as namegrp,faculty_short\n" . " from student_class " . "join faculty using(faculty_id) \n" . " join class_size using(class_id) \n" . "order by namegrp,name"; $oldClassOptionsList = getOptionListGrouped($dbConn, $class_sql_old, $oldclass_id); $page_opening = "Move students between student_class."; $nav = new Navigation($tutor_navtable, basename($PHP_SELF), $page_opening); $nav->setInterestMap($tabInterestCount); //echo "<pre>\n";print_r($_REQUEST); echo"</pre>\n"; $nav->show(); ?> <div id='navmain' style='padding:1em;'> <p>Normaly this pages is used once or twice a year to assign students to new student_class. The other case would be when you move a student out of a class when he or she leaves school.</p> <fieldset><legend>Choose students</legend> <form method="post" name="participants" action="<?php echo $PHP_SELF; ?> "> <table class='layout' style='border-width:0;'>