Ejemplo n.º 1
0
/**
 * return a div with widget and table.
 */
function score_by_category($event, $category, $tweight)
{
    global $dbConn;
    global $catMap;
    global $spreadSheetWriter;
    $tabHead = "<div style='margin:1em;font-size:10pt'><table border='1' style='border-collapse:collapse'>\n<thead><tr><th>Task</th>";
    $weightsRow = "\n<tr><th>Weight</th>";
    $tab = '<table>';
    $weights = array();
    $sql = "select question,max_points as weight from assessment_questions where event='{$event}' and category='{$category}' order by question";
    $resultSet = $dbConn->Execute($sql);
    if ($resultSet === null) {
        die("query '{$sql}' failed with " . $dbConn->ErrorMsg() . "\n");
    }
    $weightSum = 0;
    for (; !$resultSet->EOF; $resultSet->moveNext()) {
        $tabHead .= "<th>{$resultSet->fields['question']}</th>";
        $weightsRow .= "<td align='right'>{$resultSet->fields['weight']}</td>";
        $weightSum += $resultSet->fields['weight'];
        $weights[] = $resultSet->fields['weight'];
    }
    $tabHead .= "<th>WeightSum</th>";
    $weightsRow .= "<td align='right'>{$weightSum}</td>";
    $tabHead .= "</tr></thead>\n{$weightsRow}</tr>\n</table>\n</div>";
    $sqln = "select * from assessment_column_names('{$event}','{$category}')";
    $resultSetn = $dbConn->Execute($sqln);
    $ctcolumns = $resultSetn->fields['assessment_column_names'];
    $sql = "select assessment_score_query3('{$event}','{$category}') as query";
    $resultSet = $dbConn->Execute($sql);
    if ($resultSet === null) {
        die("query '{$sql}' failed with " . $dbConn->ErrorMsg() . "\n");
    }
    //  echo "{$query}<br/>";
    $query = "select s.snummer,s.achternaam,s.roepnaam,s.voorvoegsel,trim(email1) as email,\n" . "s.cohort,{$ctcolumns},round(fs.weighted_sum/{$tweight},1) as final \n" . " from {$resultSet->fields['query']}\n" . " join student s using(snummer) \n" . " join assessment_final_score3 fs using(stick_event_repo_id) where category='{$category}' order by s.achternaam,s.roepnaam";
    //  echo $query;
    //  exit(0);
    $resultSet = $dbConn->Execute($query);
    if ($resultSet === null) {
        die("query '{$query}' failed with " . $dbConn->ErrorMsg() . "\n");
    }
    $res = "<table border=1 style='border-collapse:collapse'>\n";
    $firstWeightColumn = 8;
    $weightSumColumn = $firstWeightColumn + count($weights);
    while (!$resultSet->EOF) {
        $res .= '<tr><td>' . join('</td><td>', $resultSet->fields) . "</td></tr>\n";
        $resultSet->moveNext();
    }
    $res .= "\n</table>";
    //$query="select * from assessment_results where event='$event'";
    $tab = $tabHead . simpleTableString($dbConn, $query, "<table id='myTable-{$category}' name='myTable-{$category}' " . "class='tablesorter' summary='simple table' style='empty-cells:show;border-collapse:collapse' border='1'>");
    $resultSet = $dbConn->Execute($query);
    $spreadSheetWriter[$category] = new SpreadSheetWriter($dbConn, $query);
    $fileName = "{$event}-{$catMap[$category]}";
    $spreadSheetWriter[$category]->setTitle("Result for " . $event . " part {$catMap[$category]}")->setName('spreadsheetwriter_' . $category)->setLinkUrl("https://osirix.fontysvenlo.org")->setWeights($weights)->setFirstWeightsColumn($firstWeightColumn)->setWeightSumsColumn($weightSumColumn)->setFilename($fileName)->setAutoZebra(true);
    // when the previous method returns, render the page.
    $spreadSheetWidget[$category] = $spreadSheetWriter[$category]->getWidget();
    return "<form id='form{$category}' action='results.php' method='get' >\n" . "<input type='hidden' name='category' value='{$category}'/>{$spreadSheetWidget[$category]}</form>\n" . "{$tab}\n";
}
Ejemplo n.º 2
0
    // try to insert this snummer into max prj_grp
    $sql = "insert into project_scribe (prj_id,scribe) values({$prj_id},{$newsnummer})\n";
    $dbConn->Execute($sql);
    $dbConn->log($sql);
    //    $dbConn->log($dbConn->ErrorMsg());
}
if (isset($_REQUEST['bdelete']) && $newsnummer != 0) {
    // try to insert this snummer into max prj_grp
    $sql = "delete from project_scribe where scribe={$newsnummer} and prj_id={$prj_id}\n";
    $dbConn->Execute($sql);
    $dbConn->log($sql);
    //    $dbConn->log($dbConn->ErrorMsg());
}
$page = new PageContainer();
$page_opening = "Add project scribe" . "<span style='font-size:8pt;'>prj_id {$prj_id} milestone {$milestone} prjm_id {$prjm_id}</span>";
$page->setTitle('Add a project scribe');
$nav = new Navigation($tutor_navtable, basename($PHP_SELF), $page_opening);
$page->addBodyComponent($nav);
$templatefile = 'templates/addscribe.html';
$template_text = file_get_contents($templatefile, true);
$studentPicker->setPresentQuery("select scribe as snummer from project_scribe where prj_id={$prj_id}");
$student_picker_text = $studentPicker->getPicker();
$scribeQuery = "select snummer,achternaam,roepnaam,voorvoegsel from student\n" . "where snummer in (select scribe from project_scribe where prj_id={$prj_id}) order by achternaam,roepnaam";
$scribeTable = simpleTableString($dbConn, $scribeQuery, "<table summary='students found' border='1' style='border-collapse:collapse'>");
if ($template_text === false) {
    $page->addBodyComponent(new Component("<strong>cannot read template file {$templatefile}</strong>"));
} else {
    eval("\$text = \"{$template_text}\";");
    $page->addBodyComponent(new Component($text));
}
$page->show();
Ejemplo n.º 3
0
$page->setTitle('Project group data');
$nav = new Navigation($tutor_navtable, basename($PHP_SELF), $page_opening);
ob_start();
tutorHelper($dbConn, $isTutor);
$page->addBodyComponent(new Component(ob_get_clean()));
$page->addBodyComponent($nav);
$pp['prjList'] = $prjSel->getWidget();
$sqlm = "select '<a href=''mailto:'||rtrim(email1)||'''>'||roepnaam||coalesce(' '||voorvoegsel||' ',' ')||achternaam||'</a>' as name," . "role\n" . " from prj_grp pg join student using (snummer)\n" . "join all_prj_tutor using(prjtg_id)\n" . "  join student_role using (prjm_id,snummer)\n" . "  join project_roles using(prj_id,rolenum)\n" . " where pg.prjtg_id={$prjtg_id} order by achternaam,roepnaam";
$pp['memberTable'] = simpleTableString($dbConn, $sqlm);
if (!$resultSet->EOF) {
    $pp = array_merge($pp, $resultSet->fields);
    extract($resultSet->fields);
    $pp['field_alias'] = makeinputfor('alias', $alias, $may_change, 15);
    $pp['field_long_name'] = makeinputfor('long_name', $long_name, $may_change, 40);
    $pp['field_productname'] = makeinputfor('productname', $productname, $may_change, 60);
    $pp['field_website'] = $may_change ? makeinputfor('website', $website, $may_change, 80) : "<a href='{$website}'>{$website}</a>";
    $pp['field_youtube_link'] = $may_change ? makeinputfor('youtube_link', $youtube_link, $may_change, 80) : "<a href='{$youtube_link}'>{$youtube_link}</a>";
    $icon = "<a href='{$youtube_link}' target='_blank'><img src='{$youtube_icon_url}' alt='youtube_icon_url' border='0'/></a>";
    $pp['field_youtube_icon_url'] = $may_change ? $icon . '<br/>' . makeinputfor('youtube_icon_url', $youtube_icon_url, $may_change, 80) : $icon;
    $weblink = '';
    if ($website != '') {
        $weblink = '<a href=\'' . $website . '\' target=\'_blank\'>' . $long_name . '</a>';
    }
}
$pp['changeButton'] = $may_change ? "<input type='reset'/> To update, press <input type='submit' name='submit_data' value='submit'/>" : '';
$sqlp = "select pi_description,pi_name,pi_value,interpretation" . " from project_attributes_def " . "join (select prj_id from all_prj_tutor where prjtg_id={$prjtg_id}) apt " . "using(prj_id) natural left join ( select * from project_attributes_values where prjtg_id={$prjtg_id}) pav";
if (isset($prjtg_id)) {
    $pp['attributeTable'] = simpleTableString($dbConn, $sqlp);
}
$page->addHtmlFragment('templates/activegroup.html', $pp);
$page->show();
Ejemplo n.º 4
0
 function getPicker()
 {
     global $PHP_SELF;
     $selall = $this->selectOnFocus ? "onFocus='this.select()'" : "";
     $auto = $this->autosubmit ? "onkeydown='if (event.keyCode == 13) document.getElementById(\"baccept\").click()'" : '';
     $result = '<!-- Start output StudentPicker \\$Id\\$ -->' . "\n";
     $result .= "<form id='addStudent' method='post' name='addStudent' action='{$PHP_SELF}'>\n" . "<table summary='student data'>\n\t<tr>\n\t\t<th align='right'>Peerweb user number</th>\n" . "\t\t<td>\n" . "\t\t\t<input type='text' id='{$this->inputName}' name='{$this->inputName}' size= '8' value='{$this->newsnummer}' {$this->autoFocus} {$selall} {$auto}/>\n" . "\t\t\t<input type='submit' name='bsubmit' value='get'/>(integer, between 1 and 8 digits)\n" . "\t\t</td>\n" . "\t</tr>\n";
     if ($this->newsnummer != 0) {
         $sql = "select distinct roepnaam,voorvoegsel,voorletters,achternaam,email1,hoofdgrp,cl.sclass as sclass," . "course_description," . "foo.snummer as foo_snummer\n" . "from student \n" . "join student_class cl using(class_id) left join fontys_course on(opl=course)\n" . "left join ({$this->presentQuery}) as foo using(snummer)\n" . " where snummer={$this->newsnummer} order by sclass";
         $resultSet = $this->dbConn->execute($sql);
         $this->dbConn->log($sql);
         if ($resultSet === false) {
             $result .= "error with {$sql}, cause " . $this->dbConn->ErrorMsg();
         }
         if (!$resultSet->EOF) {
             extract($resultSet->fields);
             $acceptbutton = $this->newsnummer == $foo_snummer ? "<span style='color:#080'>Student is in project</span><input type='submit'" . " name='bdelete' value='Delete'/>" : "<input type='submit' id='baccept' name='baccept' value='accept' accesskey='A'/>";
             $result .= "\t<tr>" . "\t\t<th align='right'>Name</th>\n" . "\t\t<td>{$roepnaam} ({$voorletters}) {$voorvoegsel} {$achternaam}</td>\n" . "\t</tr>\n" . "\t<tr><th align='right'>email</th><td>{$email1}</td></tr>\n" . "\t<tr><th align='right'>class</th><td>{$sclass}</td></tr>\n" . "\t<tr><th align='right'>(major) course</th><td>{$course_description}</td></tr>\n";
             if ($this->showAcceptButton) {
                 $result .= "\t<tr><th align='right'>This is ok</th><td>{$acceptbutton}</td></tr>\n";
             }
         }
     }
     if ($this->presentQuery != '') {
         $sql = 'select count(*) as listsize from (' . $this->presentQuery . ') as foo';
         $rs = $this->dbConn->execute($sql);
         if ($rs === false) {
             $result .= "error with {$sql}, cause " . $this->dbConn->ErrorMsg();
         } else {
             $result .= "\t<tr><th>current list size</th><td>" . $rs->fields['listsize'] . "&nbsp;participants</td></tr>\n";
         }
     }
     $result .= "</table>\n" . "</form>\n" . "<form method='post' name='search' action='{$PHP_SELF}'>\n" . "<p>To search a student, enter lastename and optionally first, separated by a comma: ([last][,[first]])<br/>" . " as in \"<span style='font-family:courier;'>Fitzgerald,Ella</span>\" or" . " \"<span style='font-family:courier;'>Fitz,E</span>\", " . "which might both yield the same person. Note that you should not enter any quotes.</p>\n" . "<table summary='Search data'>\n" . "\t<tr>\n" . "\t\t<th>Last name</th>\n" . "\t\t<td><input type='text' name='searchname' value='{$this->searchString}'/></td>\n" . "\t\t<td><input type='submit' value='Search'/></td>\n" . "\t</tr>\n" . "</table>\n" . "</form>\n";
     if ($this->searchString != '') {
         $searchsql = "select '<a href=''{$PHP_SELF}?newsnummer='||snummer||'''>'||snummer||'</a>' as snummer,\n" . " achternaam,roepnaam,voorvoegsel,voorletters,email1,cl.sclass as sclass" . " from student " . " join student_class cl using(class_id)\n" . " where " . $this->buildWhereClause() . " order by achternaam,roepnaam";
         #        $this->dbConn->log($searchsql);
         $result .= simpleTableString($this->dbConn, $searchsql, "<table summary='students found' border='1' style='border-collapse:collapse'>");
     }
     $result .= '<!-- End output StudentPicker $Id: studentpicker.php 1853 2015-07-25 14:17:12Z hom $ -->';
     return $result;
 }
Ejemplo n.º 5
0
}
$tabsql = "select *,email as email1,'SEN1' as project,'2013-04-10' as adate,\n" . "firstname||coalesce(' '||tussenvoegsel||' ',' ')||lastname as name\n" . " from sen1_result_20130410 where final notnull order by lastname";
$rsnames = $dbConn->Execute($tabsql);
$colcount = $rsnames->FieldCount();
$columnNames = array();
for ($i = 0; $i < $colcount; $i++) {
    $field = $rsnames->FetchField($i);
    $columnNames[$i] = $field->name;
}
$availableNames = '$' . join(", \$", $columnNames);
if (isset($_POST['invite'])) {
    formMailer($dbConn, $tabsql, $mailsubject, $mailbody, $sender, $sender_name);
}
$page = new PageContainer();
$page->setTitle('Assessment result mailer');
$tab = simpleTableString($dbConn, $tabsql, "<table id='myTable' name='myTable' class='tablesorter' summary='simple table' style='empty-cells:show;border-collapse:collapse' border='1'>");
$templatefile = 'templates/resultmailform.html';
$template_text = file_get_contents($templatefile, true);
$text = '';
if ($template_text === false) {
    $page->addBodyComponent(new Component("<strong>cannot read template file {$templatefile}</strong>"));
} else {
    eval("\$text = \"{$template_text}\";");
    $page->addBodyComponent(new Component($text));
}
$page->addHeadText('<script language="javascript" type="text/javascript" src="/js/tiny_mce/tiny_mce.js"></script>
 <script language="javascript" type="text/javascript">
   tinyMCE.init({
        theme: "advanced",
        /*auto_resize: true,*/
        gecko_spellcheck : true,