Beispiel #1
0
function convertdatauris($in)
{
    global $CFG, $userid;
    $okext = array('jpeg' => '.jpg', 'gif' => '.gif', 'png' => '.png');
    if (strpos($in, 'data:image') === false) {
        return $in;
    }
    $in = preg_replace('/<img[^>]*src="data:image[^>]*$/', '', $in);
    if (!isset($CFG['GEN']['noFileBrowser'])) {
        preg_match_all('/<img[^>]*src="(data:image\\/(\\w+);base64,([^"]*))"/', $in, $matches);
        foreach ($matches[3] as $k => $code) {
            $img = base64_decode($code);
            $ext = $matches[2][$k];
            if (!isset($okext[$ext])) {
                continue;
            }
            $key = "ufiles/{$userid}/pastedimage" . tzdate("ymd-His", time()) . '-' . $k . $okext[$ext];
            storecontenttofile($img, $key, "public");
            $in = str_replace($matches[1][$k], getuserfileurl($key), $in);
        }
        return $in;
    } else {
        $in = preg_replace('/<img[^>]*src="data:image[^>]*>/', '', $in);
    }
    return $in;
}
Beispiel #2
0
    echo "No thread specified";
    exit;
}
$thread = intval($_GET['thread']);
$query = "SELECT imas_forums.id FROM imas_forums JOIN imas_forum_threads ON imas_forums.id=imas_forum_threads.forumid ";
$query .= " WHERE imas_forum_threads.id={$thread} AND imas_forums.courseid='{$cid}'";
$result = mysql_query($query) or die("Query failed : {$query}: " . mysql_error());
if (mysql_num_rows($result) == 0) {
    echo 'Invalid thread';
    exit;
}
$flexwidth = true;
$nologo = true;
require "../header.php";
echo '<h4>' . _('Thread Views') . '</h4>';
$query = "SELECT iu.LastName,iu.FirstName,ifv.lastview FROM imas_users AS iu JOIN ";
$query .= "imas_forum_views AS ifv ON iu.id=ifv.userid WHERE ifv.threadid={$thread} ORDER BY ifv.lastview";
$result = mysql_query($query) or die("Query failed : {$query}: " . mysql_error());
if (mysql_num_rows($result) == 0) {
    echo '<p>' . _('No thread views') . '</p>';
} else {
    echo '<table><thead><tr><th>' . _('Name') . '</th><th>' . _('Last Viewed') . '</th></tr></thead>';
    echo '<tbody>';
    while ($row = mysql_fetch_assoc($result)) {
        echo '<tr><td>' . $row['LastName'] . ', ' . $row['FirstName'] . '</td>';
        echo '<td>' . tzdate("F j, Y, g:i a", $row['lastview']) . '</td></tr>';
    }
    echo '</tbody></table>';
}
echo '<p class="small">' . _('Note: Only the most recent thread view per person is shown') . '</p>';
require "../footer.php";
Beispiel #3
0
$i = 0;
if (mysql_num_rows($result) > 0) {
    while ($row = mysql_fetch_row($result)) {
        $page_gbcatSelect['val'][$i] = $row[0];
        $page_gbcatSelect['label'][$i] = $row[1];
        $i++;
    }
}
$hr = floor($coursedeftime / 60) % 12;
$min = $coursedeftime % 60;
$am = $coursedeftime < 12 * 60 ? 'am' : 'pm';
$deftime = ($hr == 0 ? 12 : $hr) . ':' . ($min < 10 ? '0' : '') . $min . ' ' . $am;
$replybydate = tzdate("m/d/Y", time() + 7 * 24 * 60 * 60);
$replybytime = $deftime;
//tzdate("g:i a",time()+7*24*60*60);
$postbydate = tzdate("m/d/Y", time() + 7 * 24 * 60 * 60);
$postbytime = $deftime;
//tzdate("g:i a",time()+7*24*60*60);
//HTML output
$placeinhead = "<script type=\"text/javascript\" src=\"{$imasroot}/javascript/DatePicker.js\"></script>";
$placeinhead .= '<style type="text/css">
table td {
	border-bottom: 1px solid #ccf;	
}
</style>
<script type="text/javascript">
function valform() {
	if ($("#mainform input:checkbox[name=\'checked[]\']:checked").length == 0) {
		if (!confirm("No forums are selected to be changed. Cancel to go back and select some forums, or click OK to make no changes")) {
			return false;
		}
Beispiel #4
0
 if ($isteacher || $line['ownerid'] == $userid && $allowmod) {
     echo "<a href=\"postsbyname.php?cid={$cid}&forum={$forumid}&thread={$line['threadid']}&modify={$line['id']}\">Modify</a> \n";
 }
 if ($isteacher || $allowdel && $line['ownerid'] == $userid) {
     echo "<a href=\"postsbyname.php?cid={$cid}&forum={$forumid}&thread={$line['threadid']}&remove={$line['id']}\">Remove</a> \n";
 }
 if ($line['posttype'] != 2 && $myrights > 5 && $allowreply) {
     echo "<a href=\"postsbyname.php?cid={$cid}&forum={$forumid}&thread={$line['threadid']}&modify=reply&replyto={$line['id']}\">Reply</a>";
 }
 echo '</span>';
 echo "<input type=\"button\" value=\"+\" onclick=\"toggleshow({$cnt})\" id=\"butn{$cnt}\" />";
 echo '<b>' . $line['subject'] . '</b>';
 if ($line['parent'] != 0) {
     echo '</span>';
 }
 $dt = tzdate("F j, Y, g:i a", $line['postdate']);
 echo ', Posted: ' . $dt;
 if ($line['lastview'] == null || $line['postdate'] > $line['lastview']) {
     echo " <span style=\"color:red;\">New</span>\n";
 }
 echo '</div>';
 echo "<div id=\"m{$cnt}\" class=\"hidden\">" . filter($line['message']);
 if ($haspoints) {
     if ($caneditscore && $ownerid[$child] != $userid) {
         echo '<hr/>';
         echo "Private Feedback: <textarea cols=\"50\" rows=\"2\" name=\"feedback[{$line['id']}]\" id=\"feedback{$line['id']}\">";
         if ($feedback[$line['id']] !== null) {
             echo $feedback[$line['id']];
         }
         echo "</textarea>";
     } else {
Beispiel #5
0
            $edate = tzdate("m/d/Y", $row[1]);
            $stime = tzdate("g:i a", $row[0]);
            $etime = tzdate("g:i a", $row[1]);
            //check if exception already exists
            $query = "SELECT id,startdate,enddate FROM imas_exceptions WHERE userid='{$_GET['uid']}' AND assessmentid='{$_GET['aid']}'";
            $result = mysql_query($query) or die("Query failed : " . mysql_error());
            $erow = mysql_fetch_row($result);
            $page_isExceptionMsg = "";
            $savetitle = _('Create Exception');
            if ($erow != null) {
                $savetitle = _('Save Changes');
                $page_isExceptionMsg = "<p>An exception already exists.  <button type=\"button\" onclick=\"window.location.href='exception.php?cid={$cid}&aid={$_GET['aid']}&uid={$_GET['uid']}&clear={$erow[0]}&asid={$asid}&stu={$stu}&from={$from}'\">" . _("Clear Exception") . '</button> or modify below.</p>';
                $sdate = tzdate("m/d/Y", $erow[1]);
                $edate = tzdate("m/d/Y", $erow[2]);
                $stime = tzdate("g:i a", $erow[1]);
                $etime = tzdate("g:i a", $erow[2]);
            }
        }
    }
    //DEFAULT LOAD DATA MANIPULATION
    $address = $urlmode . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . "/exception.php?cid={$_GET['cid']}&uid={$_GET['uid']}&asid={$asid}&stu={$stu}&from={$from}";
    $query = "SELECT id,name from imas_assessments WHERE courseid='{$cid}' ORDER BY name";
    $result = mysql_query($query) or die("Query failed : " . mysql_error());
    $page_courseSelect = array();
    $i = 0;
    while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
        $page_courseSelect['val'][$i] = $line['id'];
        $page_courseSelect['label'][$i] = $line['name'];
        $i++;
    }
}
Beispiel #6
0
                echo "\t\t<tr class=even>";
                $alt = 1;
            } else {
                echo "\t\t<tr class=odd>";
                $alt = 0;
            }
            ?>
			
			<td>
			<input type=checkbox name='checked[]' value='<?php 
            echo $calitems[$i][0];
            ?>
' checked="checked"/>
			</td>
			<td class="nowrap"><?php 
            echo tzdate("m/d/Y", $calitems[$i][1]);
            ?>
</td>
			<td><?php 
            echo $calitems[$i][2];
            ?>
</td>
			<td><?php 
            echo $calitems[$i][3];
            ?>
</td>
		</tr>
<?php 
        }
        ?>
		
Beispiel #7
0
    }
}
echo '<table><thead><tr><th>Date</th><th>Action</th></tr></thead><tbody>';
foreach ($actions as $r) {
    if (isset($r[3])) {
        $r3pts = explode('::', $r[3]);
        if (count($r3pts) == 2) {
            $thelink = '<a href="' . $r3pts[0] . '" target="_blank">' . $r3pts[1] . '</a>';
            $href = $r3pts[0];
        } else {
            $thelink = $r[3];
            $href = $r[3];
        }
    }
    echo '<tr>';
    echo '<td>' . tzdate("l, F j, Y, g:i a", $r[2]) . '</td>';
    echo '<td>';
    switch ($r[0]) {
        case 'inlinetext':
            echo 'In inline text item ' . $innames[$r[1]] . ', clicked link to ' . $thelink;
            break;
        case 'linkedsum':
            echo 'From linked item ' . $linames[$r[1]] . ' summary, clicked link to ' . $thelink;
            break;
        case 'linkedlink':
            if ($r[3] == $r[1] || strpos($href, 'showlinkedtext') !== false && strpos($href, 'id=' . $r[1]) !== false) {
                echo 'Opened linked text item ' . $linames[$r[1]];
            } else {
                echo 'Clicked linked item <a target="_blank" href="' . $href . '">' . $linames[$r[1]] . '</a>';
            }
            break;
Beispiel #8
0
function formatdate($date)
{
    return tzdate("D n/j/y, g:i a", $date);
    //return tzdate("M j, Y, g:i a",$date);
}
Beispiel #9
0
             }
             $duetimenote .= ceil($timebeforedue % 3600 / 60) . " " . _('minutes');
             $duetimenote .= '. ';
             if ($exceptionduedate > 0) {
                 $duetimenote .= _('Due') . " " . tzdate('D m/d/Y g:i a', $exceptionduedate);
             } else {
                 $duetimenote .= _('Due') . " " . tzdate('D m/d/Y g:i a', $testsettings['enddate']);
             }
         } else {
             if ($testsettings['enddate'] == 2000000000) {
                 $duetimenote = '';
             } else {
                 if ($exceptionduedate > 0) {
                     $duetimenote = _('Due') . " " . tzdate('D m/d/Y g:i a', $exceptionduedate);
                 } else {
                     $duetimenote = _('Due') . " " . tzdate('D m/d/Y g:i a', $testsettings['enddate']);
                 }
             }
         }
     }
 }
 $restrictedtimelimit = false;
 if ($testsettings['timelimit'] > 0 && !$isreview && !$superdone) {
     $now = time();
     $totremaining = $testsettings['timelimit'] - ($now - $starttime);
     $remaining = $totremaining;
     if ($timebeforedue < $remaining) {
         $remaining = $timebeforedue - 5;
         $restrictedtimelimit = true;
     }
     if ($testsettings['timelimit'] > 3600) {
Beispiel #10
0
function showcalendar($refpage)
{
    global $imasroot, $cid, $userid, $teacherid, $previewshift, $latepasses, $urlmode, $latepasshrs, $myrights, $tzoffset, $tzname, $havecalcedviewedassess, $viewedassess;
    $now = time();
    if ($previewshift != -1) {
        $now = $now + $previewshift;
    }
    if (!isset($_COOKIE['calstart' . $cid]) || $_COOKIE['calstart' . $cid] == 0) {
        $today = $now;
    } else {
        $today = $_COOKIE['calstart' . $cid];
    }
    if (isset($_GET['calpageshift'])) {
        $pageshift = $_GET['calpageshift'];
    } else {
        $pageshift = 0;
    }
    if (!isset($_COOKIE['callength' . $cid])) {
        $callength = 4;
    } else {
        $callength = $_COOKIE['callength' . $cid];
    }
    $today = $today + $pageshift * 7 * $callength * 24 * 60 * 60;
    $dayofweek = tzdate('w', $today);
    $curmonum = tzdate('n', $today);
    $dayofmo = tzdate('j', $today);
    $curyr = tzdate('Y', $today);
    if ($tzname == '') {
        $serveroffset = date('Z') + $tzoffset * 60;
    } else {
        $serveroffset = 0;
        //don't need this if user's timezone has been set
    }
    $midtoday = mktime(12, 0, 0, $curmonum, $dayofmo, $curyr) + $serveroffset;
    $hdrs = array();
    $ids = array();
    $lastmo = '';
    for ($i = 0; $i < 7 * $callength; $i++) {
        $row = floor($i / 7);
        $col = $i % 7;
        list($thismo, $thisday, $thismonum, $datestr) = explode('|', tzdate('M|j|n|l F j, Y', $midtoday - ($dayofweek - $i) * 24 * 60 * 60));
        if ($thismo == $lastmo) {
            $hdrs[$row][$col] = $thisday;
        } else {
            $hdrs[$row][$col] = "{$thismo} {$thisday}";
            $lastmo = $thismo;
        }
        $ids[$row][$col] = "{$thismonum}-{$thisday}";
        $dates[$ids[$row][$col]] = $datestr;
    }
    ?>


<?php 
    //echo '<div class="floatleft">Jump to <a href="'.$refpage.'.php?calpageshift=0&cid='.$cid.'">Now</a></div>';
    $address = $urlmode . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . "/{$refpage}.php?cid={$cid}";
    echo '<script type="text/javascript">var calcallback = "' . $address . '";</script>';
    echo '<div class="floatright">Show <select id="callength" onchange="changecallength(this)">';
    for ($i = 2; $i < 26; $i++) {
        echo '<option value="' . $i . '" ';
        if ($i == $callength) {
            echo 'selected="selected"';
        }
        echo '>' . $i . '</option>';
    }
    echo '</select> weeks </div>';
    echo '<div class=center><a href="' . $refpage . '.php?calpageshift=' . ($pageshift - 1) . '&cid=' . $cid . '">&lt; &lt;</a> ';
    //echo $longcurmo.' ';
    if ($pageshift == 0 && (!isset($_COOKIE['calstart' . $cid]) || $_COOKIE['calstart' . $cid] == 0)) {
        echo "Now ";
    } else {
        echo '<a href="' . $refpage . '.php?calpageshift=0&calstart=0&cid=' . $cid . '">Now</a> ';
    }
    echo '<a href="' . $refpage . '.php?calpageshift=' . ($pageshift + 1) . '&cid=' . $cid . '">&gt; &gt;</a> ';
    echo '</div> ';
    echo "<table class=\"cal\" >";
    //onmouseout=\"makenorm()\"
    $exlowertime = mktime(0, 0, 0, $curmonum, $dayofmo - $dayofweek, $curyr) + $serveroffset;
    $lowertime = max($now, $exlowertime);
    $uppertime = mktime(0, 0, 0, $curmonum, $dayofmo - $dayofweek + 7 * $callength, $curyr) + $serveroffset;
    $exceptions = array();
    if (!isset($teacherid)) {
        $query = "SELECT assessmentid,startdate,enddate,islatepass,waivereqscore FROM imas_exceptions WHERE userid='{$userid}'";
        $result = mysql_query($query) or die("Query failed : {$query}" . mysql_error());
        while ($row = mysql_fetch_row($result)) {
            $exceptions[$row[0]] = array($row[1], $row[2], $row[3], $row[4]);
        }
    }
    $byid = array();
    $k = 0;
    $query = "SELECT id,name,startdate,enddate,reviewdate,gbcategory,reqscore,reqscoreaid,timelimit,allowlate,caltag,calrtag FROM imas_assessments WHERE avail=1 AND courseid='{$cid}' AND enddate<2000000000 ORDER BY name";
    $result = mysql_query($query) or die("Query failed : {$query}" . mysql_error());
    while ($row = mysql_fetch_row($result)) {
        $canundolatepass = false;
        $latepasscnt = 0;
        if (isset($exceptions[$row[0]])) {
            if ($exceptions[$row[0]][2] > 0 && ($now < $row[3] || $exceptions[$row[0]][1] > $now + $latepasshrs * 60 * 60)) {
                $canundolatepass = true;
            }
            $latepasscnt = round(($exceptions[$row[0]][1] - $row[3]) / ($latepasshrs * 3600));
            $row[2] = $exceptions[$row[0]][0];
            $row[3] = $exceptions[$row[0]][1];
        }
        //2: start, 3: end, 4: review
        //if enddate past end of calendar
        if ($row[3] > $uppertime && ($row[4] == 0 || $row[4] > $uppertime || $row[4] < $row[3])) {
            continue;
        }
        //if enddate is past, and reviewdate is past end of calendar
        if ($row[3] < $now && $row[4] > $uppertime) {
            //continue;
        }
        //echo "{$row[1]}, {$row[3]}, $uppertime, {$row[4]}<br/>";
        //if startdate is past now
        if ($row[2] > $now && !isset($teacherid)) {
            continue;
        }
        //if past reviewdate
        if ($row[4] > 0 && $now > $row[4] && !isset($teacherid)) {
            //if has reviewdate and we're past it   //|| ($now>$row[3] && $row[4]==0)
            //continue;
        }
        if (!isset($teacherid) && $row[6] > 0 && $row[7] > 0 && (!isset($exceptions[$row[0]]) || $exceptions[$row[0]][3] == 0)) {
            $query = "SELECT bestscores FROM imas_assessment_sessions WHERE assessmentid='{$row[7]}' AND userid='{$userid}'";
            $r2 = mysql_query($query) or die("Query failed : " . mysql_error());
            if (mysql_num_rows($r2) == 0) {
                continue;
            } else {
                $scores = explode(';', mysql_result($r2, 0, 0));
                if (getpts($scores[0]) < $row[6]) {
                    continue;
                }
            }
        }
        if ($row[4] < $uppertime && $row[4] > 0 && $now > $row[3]) {
            //has review, and we're past enddate
            list($moday, $time) = explode('~', tzdate('n-j~g:i a', $row[4]));
            $row[1] = htmlentities($row[1], ENT_COMPAT | ENT_HTML401, "UTF-8", false);
            $tag = htmlentities($row[11], ENT_COMPAT | ENT_HTML401, "UTF-8", false);
            if ($now < $row[4]) {
                $colors = '#99f';
            } else {
                $colors = '#ccc';
            }
            $json = "{type:\"AR\", time:\"{$time}\", tag:\"{$tag}\", ";
            if ($now < $row[4] || isset($teacherid)) {
                $json .= "id:\"{$row['0']}\",";
            }
            $json .= "color:\"" . $colors . "\",name:\"{$row['1']}\"" . (isset($teacherid) ? ", editlink:true" : "") . "}";
            if ($row[3] < $uppertime && $row[3] > $exlowertime) {
                //if going to do a second tag, need to increment.
                $byid['AR' . $row[0]] = array($moday, $tag, $colors, $json);
            }
        }
        if ($row[3] < $uppertime && $row[3] > $exlowertime) {
            // taking out "hide if past due" && ($now<$row[3] || isset($teacherid))) {
            /*if (isset($gbcats[$row[5]])) {
            			$tag = $gbcats[$row[5]];
            		} else {
            			$tag = '?';
            		}*/
            $tag = htmlentities($row[10], ENT_COMPAT | ENT_HTML401, "UTF-8", false);
            if (!$havecalcedviewedassess && $now > $row[3] && $row[9] > 10) {
                $havecalcedviewedassess = true;
                $viewedassess = array();
                $query = "SELECT typeid FROM imas_content_track WHERE courseid='{$cid}' AND userid='{$userid}' AND type='gbviewasid'";
                $r2 = mysql_query($query) or die("Query failed : " . mysql_error());
                while ($r = mysql_fetch_row($r2)) {
                    $viewedassess[] = $r[0];
                }
            }
            if (($row[9] % 10 == 1 || $row[9] % 10 - 1 > $latepasscnt) && $latepasses > 0 && ($now < $row[3] || $row[9] > 10 && $now - $row[3] < $latepasshrs * 3600 && !in_array($row[0], $viewedassess))) {
                $lp = 1;
            } else {
                $lp = 0;
            }
            if ($canundolatepass) {
                $ulp = 1;
            } else {
                $ulp = 0;
            }
            list($moday, $time) = explode('~', tzdate('n-j~g:i a', $row[3]));
            $row[1] = htmlentities($row[1], ENT_COMPAT | ENT_HTML401, "UTF-8", false);
            $colors = makecolor2($row[2], $row[3], $now);
            $json = "{type:\"A\", time:\"{$time}\", ";
            if ($now < $row[3] || $row[4] > $now || isset($teacherid) || $lp == 1) {
                $json .= "id:\"{$row['0']}\",";
            }
            if ($now > $row[3] && $now > $row[4] && !isset($teacherid)) {
                $json .= 'inactive:true,';
            }
            $json .= "name:\"{$row['1']}\", color:\"" . $colors . "\", allowlate:\"{$lp}\", undolate:\"{$ulp}\", tag:\"{$tag}\"" . ($row[8] != 0 ? ", timelimit:true" : "") . (isset($teacherid) ? ", editlink:true" : "") . "}";
            //"<span class=icon style=\"background-color:#f66\">?</span> <a href=\"../assessment/showtest.php?id={$row[0]}&cid=$cid\">{$row[1]}</a> Due $time<br/>";
            $byid['A' . $row[0]] = array($moday, $tag, $colors, $json);
        }
    }
    // 4/4/2011, changing tthis to code block below.  Not sure why change on 10/23 was made :/
    //if (isset($teacherid)) {
    //$query = "SELECT id,title,enddate,text,startdate,oncal,caltag,avail FROM imas_inlinetext WHERE ((oncal=2 AND enddate>$exlowertime AND enddate<$uppertime) OR (oncal=1 AND startdate<$uppertime AND startdate>$exlowertime)) AND (avail=1 OR (avail=2 AND startdate>0)) AND courseid='$cid'";
    //} else {
    //	$query = "SELECT id,title,enddate,text,startdate,oncal,caltag FROM imas_inlinetext WHERE ((oncal=2 AND enddate>$lowertime AND enddate<$uppertime AND startdate<$now) OR (oncal=1 AND startdate<$now AND startdate>$exlowertime)) AND avail=1 AND courseid='$cid'";  //chg 10/23/09: replace $now with $uppertime
    //}
    if (isset($teacherid)) {
        $query = "SELECT id,title,enddate,text,startdate,oncal,caltag,avail FROM imas_inlinetext WHERE ((oncal=2 AND enddate>{$exlowertime} AND enddate<{$uppertime}) OR (oncal=1 AND startdate<{$uppertime} AND startdate>{$exlowertime})) AND (avail=1 OR (avail=2 AND startdate>0)) AND courseid='{$cid}'";
    } else {
        $query = "SELECT id,title,enddate,text,startdate,oncal,caltag,avail FROM imas_inlinetext WHERE ";
        $query .= "((avail=1 AND ((oncal=2 AND enddate>{$exlowertime} AND enddate<{$uppertime} AND startdate<{$now}) OR (oncal=1 AND startdate<{$now} AND startdate>{$exlowertime}))) OR ";
        $query .= "(avail=2 AND oncal=1 AND startdate<{$uppertime} AND startdate>{$exlowertime})) AND courseid='{$cid}'";
    }
    $result = mysql_query($query) or die("Query failed : {$query}" . mysql_error());
    while ($row = mysql_fetch_row($result)) {
        if ($row[1] == '##hidden##') {
            $row[1] = strip_tags($row[3]);
        }
        if ($row[5] == 1) {
            list($moday, $time) = explode('~', tzdate('n-j~g:i a', $row[4]));
        } else {
            list($moday, $time) = explode('~', tzdate('n-j~g:i a', $row[2]));
        }
        $row[1] = htmlentities($row[1], ENT_COMPAT | ENT_HTML401, "UTF-8", false);
        $colors = makecolor2($row[4], $row[2], $now);
        if ($row[7] == 2) {
            $colors = "#0f0";
        }
        $tag = htmlentities($row[6], ENT_COMPAT | ENT_HTML401, "UTF-8", false);
        $json = "{type:\"I\", folder:\"@@@\", time:\"{$time}\", id:\"{$row['0']}\", name:\"{$row['1']}\", color:\"" . $colors . "\", tag:\"{$tag}\"" . (isset($teacherid) ? ", editlink:true" : "") . "}";
        //"<span class=icon style=\"background-color:#f66\">?</span> <a href=\"../assessment/showtest.php?id={$row[0]}&cid=$cid\">{$row[1]}</a> Due $time<br/>";
        $byid['I' . $row[0]] = array($moday, $tag, $colors, $json);
    }
    //$query = "SELECT id,title,enddate,text,startdate,oncal,caltag FROM imas_linkedtext WHERE ((oncal=2 AND enddate>$lowertime AND enddate<$uppertime AND startdate<$now) OR (oncal=1 AND startdate<$now AND startdate>$exlowertime)) AND avail=1 AND courseid='$cid'";
    if (isset($teacherid)) {
        $query = "SELECT id,title,enddate,text,startdate,oncal,caltag,avail FROM imas_linkedtext WHERE ((oncal=2 AND enddate>{$exlowertime} AND enddate<{$uppertime}) OR (oncal=1 AND startdate<{$uppertime} AND startdate>{$exlowertime})) AND (avail=1 OR (avail=2 AND startdate>0)) AND courseid='{$cid}' ORDER BY title";
    } else {
        $query = "SELECT id,title,enddate,text,startdate,oncal,caltag,avail FROM imas_linkedtext WHERE ";
        $query .= "((avail=1 AND ((oncal=2 AND enddate>{$exlowertime} AND enddate<{$uppertime} AND startdate<{$now}) OR (oncal=1 AND startdate<{$now} AND startdate>{$exlowertime}))) OR ";
        $query .= "(avail=2 AND oncal=1 AND startdate<{$uppertime} AND startdate>{$exlowertime})) AND courseid='{$cid}' ORDER BY title";
    }
    $result = mysql_query($query) or die("Query failed : {$query}" . mysql_error());
    while ($row = mysql_fetch_row($result)) {
        if ($row[5] == 1) {
            list($moday, $time) = explode('~', tzdate('n-j~g:i a', $row[4]));
        } else {
            list($moday, $time) = explode('~', tzdate('n-j~g:i a', $row[2]));
        }
        $row[1] = htmlentities($row[1], ENT_COMPAT | ENT_HTML401, "UTF-8", false);
        if (substr($row[3], 0, 4) == "http" && strpos($row[3], " ") === false) {
            //is a web link
            $alink = trim($row[3]);
        } else {
            if (substr($row[3], 0, 5) == "file:") {
                $filename = substr(strip_tags($row[3]), 5);
                $alink = getcoursefileurl($filename);
                //$alink = $imasroot . "/course/files/".$filename;
            } else {
                $alink = '';
            }
        }
        $colors = makecolor2($row[4], $row[2], $now);
        if ($row[7] == 2) {
            $colors = "#0f0";
        }
        $json = "{type:\"L\", time:\"{$time}\", ";
        if (isset($teacherid) || $now < $row[2] && $now > $row[4] || $row[7] == 2) {
            $json .= "id:\"{$row['0']}\", ";
        }
        $tag = htmlentities($row[6], ENT_COMPAT | ENT_HTML401, "UTF-8", false);
        $alink = htmlentities($alink, ENT_COMPAT | ENT_HTML401, "UTF-8", false);
        $json .= "name:\"{$row['1']}\", link:\"{$alink}\", color:\"" . $colors . "\", tag:\"{$tag}\"" . (isset($teacherid) ? ", editlink:true" : "") . "}";
        //"<span class=icon style=\"background-color:#f66\">?</span> <a href=\"../assessment/showtest.php?id={$row[0]}&cid=$cid\">{$row[1]}</a> Due $time<br/>";
        $byid['L' . $row[0]] = array($moday, $tag, $colors, $json);
    }
    $query = "SELECT id,name,postby,replyby,startdate,caltag FROM imas_forums WHERE enddate>{$exlowertime} AND ((postby>{$exlowertime} AND postby<{$uppertime}) OR (replyby>{$exlowertime} AND replyby<{$uppertime})) AND avail>0 AND courseid='{$cid}' ORDER BY name";
    $result = mysql_query($query) or die("Query failed : {$query}" . mysql_error());
    while ($row = mysql_fetch_row($result)) {
        if ($row[4] > $now && !isset($teacherid)) {
            continue;
        }
        list($posttag, $replytag) = explode('--', $row[5]);
        $posttag = htmlentities($posttag, ENT_COMPAT | ENT_HTML401, "UTF-8", false);
        $replytag = htmlentities($replytag, ENT_COMPAT | ENT_HTML401, "UTF-8", false);
        if ($row[2] != 2000000000) {
            //($row[2]>$now || isset($teacherid))
            list($moday, $time) = explode('~', tzdate('n-j~g:i a', $row[2]));
            $row[1] = htmlentities($row[1], ENT_COMPAT | ENT_HTML401, "UTF-8", false);
            $colors = makecolor2($row[4], $row[2], $now);
            $json = "{type:\"FP\", time:\"{$time}\", ";
            if ($row[2] > $now || isset($teacherid)) {
                $json .= "id:\"{$row['0']}\",";
            }
            $json .= "name:\"{$row['1']}\", color:\"" . $colors . "\", tag:\"{$posttag}\"" . (isset($teacherid) ? ", editlink:true" : "") . "}";
            $byid['FP' . $row[0]] = array($moday, $posttag, $colors, $json);
        }
        if ($row[3] != 2000000000) {
            //($row[3]>$now || isset($teacherid))
            list($moday, $time) = explode('~', tzdate('n-j~g:i a', $row[3]));
            $colors = makecolor2($row[4], $row[3], $now);
            $json = "{type:\"FR\", time:\"{$time}\",";
            if ($row[3] > $now || isset($teacherid)) {
                $json .= "id:\"{$row['0']}\",";
            }
            $json .= "name:\"{$row['1']}\", color:\"" . $colors . "\", tag:\"{$replytag}\"" . (isset($teacherid) ? ", editlink:true" : "") . "}";
            $byid['FR' . $row[0]] = array($moday, $replytag, $colors, $json);
        }
    }
    $query = "SELECT itemorder FROM imas_courses WHERE id='{$cid}'";
    $result = mysql_query($query) or die("Query failed : {$query}" . mysql_error());
    $itemorder = unserialize(mysql_result($result, 0, 0));
    $itemsimporder = array();
    $itemfolder = array();
    flattenitems($itemorder, $itemsimporder, $itemfolder, '0');
    $itemsassoc = array();
    $query = "SELECT id,itemtype,typeid FROM imas_items WHERE courseid='{$cid}'";
    $result = mysql_query($query) or die("Query failed : {$query}" . mysql_error());
    while ($row = mysql_fetch_row($result)) {
        $itemsassoc[$row[0]] = array($row[1], $row[2]);
    }
    $assess = array();
    $colors = array();
    $tags = array();
    $k = 0;
    foreach ($itemsimporder as $item) {
        if ($itemsassoc[$item][0] == 'Assessment') {
            if (isset($byid['A' . $itemsassoc[$item][1]])) {
                $moday = $byid['A' . $itemsassoc[$item][1]][0];
                $tags[$k] = $byid['A' . $itemsassoc[$item][1]][1];
                $colors[$k] = $byid['A' . $itemsassoc[$item][1]][2];
                $assess[$moday][$k] = $byid['A' . $itemsassoc[$item][1]][3];
                $k++;
            }
            if (isset($byid['AR' . $itemsassoc[$item][1]])) {
                $moday = $byid['AR' . $itemsassoc[$item][1]][0];
                $tags[$k] = $byid['AR' . $itemsassoc[$item][1]][1];
                $colors[$k] = $byid['AR' . $itemsassoc[$item][1]][2];
                $assess[$moday][$k] = $byid['AR' . $itemsassoc[$item][1]][3];
                $k++;
            }
        } else {
            if ($itemsassoc[$item][0] == 'Forum') {
                if (isset($byid['FP' . $itemsassoc[$item][1]])) {
                    $moday = $byid['FP' . $itemsassoc[$item][1]][0];
                    $tags[$k] = $byid['FP' . $itemsassoc[$item][1]][1];
                    $colors[$k] = $byid['FP' . $itemsassoc[$item][1]][2];
                    $assess[$moday][$k] = $byid['FP' . $itemsassoc[$item][1]][3];
                    $k++;
                }
                if (isset($byid['FR' . $itemsassoc[$item][1]])) {
                    $moday = $byid['FR' . $itemsassoc[$item][1]][0];
                    $tags[$k] = $byid['FR' . $itemsassoc[$item][1]][1];
                    $colors[$k] = $byid['FR' . $itemsassoc[$item][1]][2];
                    $assess[$moday][$k] = $byid['FR' . $itemsassoc[$item][1]][3];
                    $k++;
                }
            } else {
                if ($itemsassoc[$item][0] == 'InlineText') {
                    if (isset($byid['I' . $itemsassoc[$item][1]])) {
                        $moday = $byid['I' . $itemsassoc[$item][1]][0];
                        $tags[$k] = $byid['I' . $itemsassoc[$item][1]][1];
                        $colors[$k] = $byid['I' . $itemsassoc[$item][1]][2];
                        if (isset($itemfolder[$item])) {
                            $assess[$moday][$k] = str_replace('@@@', $itemfolder[$item], $byid['I' . $itemsassoc[$item][1]][3]);
                        } else {
                            $assess[$moday][$k] = str_replace('"@@@"', 'null', $byid['I' . $itemsassoc[$item][1]][3]);
                        }
                        $k++;
                    }
                } else {
                    if ($itemsassoc[$item][0] == 'LinkedText') {
                        if (isset($byid['L' . $itemsassoc[$item][1]])) {
                            $moday = $byid['L' . $itemsassoc[$item][1]][0];
                            $tags[$k] = $byid['L' . $itemsassoc[$item][1]][1];
                            $colors[$k] = $byid['L' . $itemsassoc[$item][1]][2];
                            $assess[$moday][$k] = $byid['L' . $itemsassoc[$item][1]][3];
                            $k++;
                        }
                    }
                }
            }
        }
    }
    $query = "SELECT title,tag,date FROM imas_calitems WHERE date>{$exlowertime} AND date<{$uppertime} and courseid='{$cid}' ORDER BY title";
    $result = mysql_query($query) or die("Query failed : {$query}" . mysql_error());
    while ($row = mysql_fetch_row($result)) {
        list($moday, $time) = explode('~', tzdate('n-j~g:i a', $row[2]));
        $row[0] = htmlentities($row[0], ENT_COMPAT | ENT_HTML401, "UTF-8", false);
        $row[1] = htmlentities($row[1], ENT_COMPAT | ENT_HTML401, "UTF-8", false);
        $assess[$moday][$k] = "{type:\"C\", time:\"{$time}\", tag:\"{$row['1']}\", name:\"{$row['0']}\"}";
        $tags[$k] = $row[1];
        $k++;
    }
    $jsarr = '{';
    foreach ($dates as $moday => $val) {
        if ($jsarr != '{') {
            $jsarr .= ',';
        }
        if (isset($assess[$moday])) {
            $jsarr .= '"' . $moday . '":{date:"' . $dates[$moday] . '",data:[' . implode(',', $assess[$moday]) . ']}';
        } else {
            $jsarr .= '"' . $moday . '":{date:"' . $dates[$moday] . '"}';
        }
    }
    $jsarr .= '}';
    echo '<script type="text/javascript">';
    echo "cid = {$cid};";
    echo "caleventsarr = {$jsarr};";
    echo '</script>';
    echo "<thead><tr><th>Sunday</th> <th>Monday</th> <th>Tuesday</th> <th>Wednesday</th> <th>Thursday</th> <th>Friday</th> <th>Saturday</th></tr></thead>";
    echo "<tbody>";
    for ($i = 0; $i < count($hdrs); $i++) {
        echo "<tr>";
        for ($j = 0; $j < count($hdrs[$i]); $j++) {
            if ($i == 0 && $j == $dayofweek && $pageshift == 0) {
                //onmouseover="makebig(this)"
                echo '<td id="' . $ids[$i][$j] . '" onclick="showcalcontents(this)" class="today"><div class="td"><span class=day>' . $hdrs[$i][$j] . "</span><div class=center>";
            } else {
                $addr = $refpage . ".php?cid={$cid}&calstart=" . ($midtoday + $i * 7 * 24 * 60 * 60 + ($j - $dayofweek) * 24 * 60 * 60);
                echo '<td id="' . $ids[$i][$j] . '" onclick="showcalcontents(this)" ><div class="td"><span class=day><a href="' . $addr . '" class="caldl">' . $hdrs[$i][$j] . "</a></span><div class=center>";
            }
            if (isset($assess[$ids[$i][$j]])) {
                foreach ($assess[$ids[$i][$j]] as $k => $info) {
                    //echo $assess[$ids[$i][$j]][$k];
                    if (strpos($info, 'type:"AR"') !== false) {
                        echo "<span class=\"calitem\" style=\"background-color:" . $colors[$k] . ";\">{$tags[$k]}</span> ";
                    } else {
                        if (strpos($info, 'type:"A"') !== false) {
                            echo "<span class=\"calitem\" style=\"background-color:" . $colors[$k] . ";\">{$tags[$k]}</span> ";
                        } else {
                            if (strpos($info, 'type:"F') !== false) {
                                echo "<span class=\"calitem\" style=\"background-color:" . $colors[$k] . ";\">{$tags[$k]}</span> ";
                            } else {
                                if (strpos($info, 'type:"C') !== false) {
                                    echo "<span class=\"calitem\" style=\"background-color: #0ff;\">{$tags[$k]}</span> ";
                                } else {
                                    //textitems
                                    if (isset($tags[$k])) {
                                        echo "<span class=\"calitem\" style=\"background-color:" . $colors[$k] . ";\">{$tags[$k]}</span> ";
                                    } else {
                                        echo "<span class=\"calitem\" style=\"background-color:" . $colors[$k] . ";\">!</span> ";
                                    }
                                }
                            }
                        }
                    }
                }
            }
            echo "</div></div></td>";
        }
        echo "</tr>";
    }
    echo "</tbody></table>";
    echo "<div style=\"margin-top: 10px; padding:10px; border:1px solid #000;\">";
    echo '<span class=right><a href="#" onclick="showcalcontents(' . 1000 * ($midtoday - $dayofweek * 24 * 60 * 60) . '); return false;"/>Show all</a></span>';
    echo "<div id=\"caleventslist\"></div><div class=\"clear\"></div></div>";
    if ($pageshift == 0) {
        echo "<script>showcalcontents(document.getElementById('{$ids[0][$dayofweek]}'));</script>";
    }
}
Beispiel #11
0
 if ($numrevisions > 1) {
     $i = 0;
     while ($row = mysql_fetch_row($result)) {
         $revisionusers[$row[5]] = $row[3] . ', ' . $row[4];
         //$row[1] = filter(str_replace('"','@^@^@',$row[1]));
         //$row[1] = str_replace('"','\\"',$row[1]);
         //$row[1] = str_replace('@^@^@','"',$row[1]);
         //$revisionhistory .= ',{u:'.$row[5].',c:'.$row[1].',t:"'.tzdate("F j, Y, g:i a",$row[2]).'",id:'.$row[0].'}';
         if (function_exists('json_encode')) {
             $row[1] = json_decode($row[1]);
         } else {
             require_once "../includes/JSON.php";
             $jsonser = new Services_JSON();
             $row[1] = $jsonser->decode($row[1]);
         }
         $revisionhistory[] = array('u' => $row[5], 'c' => $row[1], 't' => tzdate("F j, Y, g:i a", $row[2]), 'id' => $row[0]);
         $i++;
     }
     //$revisionhistory .= ']';
     $keys = array_keys($revisionusers);
     $i = 0;
     //$users = '{';
     $users = array();
     foreach ($keys as $uid) {
         //if ($i>0) { $users .= ',';}
         //$users .= $uid.':"'.str_replace(array('\\','"',), array('\\\\','\"'), $revisionusers[$uid]).'"';
         $users[$uid] = $revisionusers[$uid];
         $i++;
     }
     //$users .= '}';
 } else {
Beispiel #12
0
function printPostsGadget()
{
    global $page_newpostlist, $page_coursenames, $postthreads, $imasroot;
    echo '<div class="block">';
    //echo "<span class=\"floatright\"><a href=\"#\" onclick=\"GB_show('Forum Widget Settings','$imasroot/forms.php?action=forumwidgetsettings&greybox=true',800,'auto')\" title=\"Forum Widget Settings\"><img style=\"vertical-align:top\" src=\"$imasroot/img/gears.png\"/></a></span>";
    echo "<span class=\"floatright\"><a href=\"forms.php?action=forumwidgetsettings\"><img style=\"vertical-align:top\" src=\"{$imasroot}/img/gears.png\"/></a></span>";
    echo '<h3>', _('New forum posts'), '</h3></div>';
    echo '<div class="blockitems">';
    if (count($page_newpostlist) == 0) {
        echo '<p>', _('No new posts'), '</p>';
        echo '</div>';
        return;
    }
    $threadlist = implode(',', $postthreads);
    $threaddata = array();
    $query = "SELECT imas_forum_posts.*,imas_users.LastName,imas_users.FirstName FROM imas_forum_posts,imas_users ";
    $query .= "WHERE imas_forum_posts.userid=imas_users.id AND imas_forum_posts.id IN ({$threadlist})";
    $result = mysql_query($query) or die("Query failed : {$query} " . mysql_error());
    while ($tline = mysql_fetch_array($result, MYSQL_ASSOC)) {
        $threaddata[$tline['id']] = $tline;
    }
    echo '<table class="gb" id="newpostlist"><thead><tr><th>', _('Thread'), '</th><th>', _('Started By'), '</th><th>', _('Course'), '</th><th>', _('Last Post'), '</th></tr></thead>';
    echo '<tbody>';
    foreach ($page_newpostlist as $line) {
        echo '<tr>';
        $subject = $threaddata[$line['threadid']]['subject'];
        if (trim($subject) == '') {
            $subject = '[' . _('No Subject') . ']';
        }
        $n = 0;
        while (strpos($subject, 'Re: ') === 0) {
            $subject = substr($subject, 4);
            $n++;
        }
        if ($n == 1) {
            $subject = 'Re: ' . $subject;
        } else {
            if ($n > 1) {
                $subject = "Re<sup>{$n}</sup>: " . $subject;
            }
        }
        echo "<td><a href=\"forums/posts.php?page=-3&cid={$line['courseid']}&forum={$line['id']}&thread={$line['threadid']}\">";
        echo $subject;
        echo '</a></td>';
        if ($threaddata[$line['threadid']]['isanon'] == 1) {
            echo '<td>', _('Anonymous'), '</td>';
        } else {
            echo '<td>' . $threaddata[$line['threadid']]['LastName'] . ', ' . $threaddata[$line['threadid']]['FirstName'] . '</td>';
        }
        echo '<td>' . $page_coursenames[$line['courseid']] . '</td>';
        echo '<td>' . tzdate("D n/j/y, g:i a", $line['lastposttime']) . '</td>';
        echo '</tr>';
    }
    echo '</tbody></table>';
    echo '<script type="text/javascript">initSortTable("newpostlist",Array("S","S","S","D"),false);</script>';
    echo '</div>';
}
Beispiel #13
0
function gbinstrdisp()
{
    global $hidenc, $showpics, $isteacher, $istutor, $cid, $gbmode, $stu, $availshow, $catfilter, $secfilter, $totonleft, $imasroot, $isdiag, $tutorsection, $avgontop, $hidelocked, $colorize, $urlmode, $overridecollapse, $includeduedate, $lastlogin;
    $curdir = rtrim(dirname(__FILE__), '/\\');
    if ($availshow == 4) {
        $availshow = 1;
        $hidepast = true;
    }
    $gbt = gbtable();
    if ($avgontop) {
        $avgrow = array_pop($gbt);
        array_splice($gbt, 1, 0, array($avgrow));
    }
    //print_r($gbt);
    //echo "<script type=\"text/javascript\" src=\"$imasroot/javascript/tablesorter.js\"></script>\n"; in placeinhead
    echo "<div id=\"tbl-container\">";
    echo '<div id="bigcontmyTable"><div id="tblcontmyTable">';
    echo '<table class="gb" id="myTable"><thead><tr>';
    $sortarr = array();
    for ($i = 0; $i < count($gbt[0][0]); $i++) {
        //biographical headers
        if ($i == 1) {
            echo '<th><div>&nbsp;</div></th>';
            $sortarr[] = 'false';
        }
        //for pics
        if ($i == 1 && $gbt[0][0][1] != 'ID') {
            continue;
        }
        if ($gbt[0][0][$i] == 'Section' || $gbt[0][0][$i] == 'Code' || $gbt[0][0][$i] == 'Last Login') {
            echo '<th class="nocolorize"><div>';
        } else {
            echo '<th><div>';
        }
        echo $gbt[0][0][$i];
        if (($gbt[0][0][$i] == 'Section' || $isdiag && $i == 4) && (!$istutor || $tutorsection == '')) {
            echo "<br/><select id=\"secfiltersel\" onchange=\"chgsecfilter()\"><option value=\"-1\" ";
            if ($secfilter == -1) {
                echo 'selected=1';
            }
            echo '>', _('All'), '</option>';
            $query = "SELECT DISTINCT section FROM imas_students WHERE courseid='{$cid}' ORDER BY section";
            $result = mysql_query($query) or die("Query failed : " . mysql_error());
            while ($row = mysql_fetch_row($result)) {
                if ($row[0] == '') {
                    continue;
                }
                echo "<option value=\"{$row[0]}\" ";
                if ($row[0] == $secfilter) {
                    echo 'selected=1';
                }
                echo ">{$row[0]}</option>";
            }
            echo "</select>";
        } else {
            if ($gbt[0][0][$i] == 'Name') {
                echo '<br/><span class="small">N=' . (count($gbt) - 2) . '</span><br/>';
                echo "<select id=\"toggle5\" onchange=\"chgtoggle()\">";
                echo "<option value=0 ";
                writeHtmlSelected($hidelocked, 0);
                echo ">", _('Show Locked'), "</option>";
                echo "<option value=2 ";
                writeHtmlSelected($hidelocked, 2);
                echo ">", _('Hide Locked'), "</option>";
                echo "</select>";
            }
        }
        echo '</div></th>';
        if ($gbt[0][0][$i] == 'Last Login') {
            $sortarr[] = "'D'";
        } else {
            if ($i != 1) {
                $sortarr[] = "'S'";
            }
        }
    }
    $n = 0;
    //get collapsed gb cat info
    if (count($gbt[0][2]) > 1) {
        $collapsegbcat = array();
        for ($i = 0; $i < count($gbt[0][2]); $i++) {
            if (isset($overridecollapse[$gbt[0][2][$i][10]])) {
                $collapsegbcat[$gbt[0][2][$i][1]] = $overridecollapse[$gbt[0][2][$i][10]];
            } else {
                $collapsegbcat[$gbt[0][2][$i][1]] = $gbt[0][2][$i][12];
            }
        }
    }
    if ($totonleft && !$hidepast) {
        //total totals
        if ($catfilter < 0) {
            if (isset($gbt[0][3][0])) {
                //using points based
                echo '<th><div><span class="cattothdr">', _('Total'), '<br/>' . $gbt[0][3][$availshow] . '&nbsp;', _('pts'), '</span></div></th>';
                echo '<th><div>%</div></th>';
                $n += 2;
            } else {
                echo '<th><div><span class="cattothdr">', _('Weighted Total %'), '</span></div></th>';
                $n++;
            }
        }
        if (count($gbt[0][2]) > 1 || $catfilter != -1) {
            //want to show cat headers?
            for ($i = 0; $i < count($gbt[0][2]); $i++) {
                //category headers
                if (($availshow < 2 || $availshow == 3) && $gbt[0][2][$i][2] > 1) {
                    continue;
                } else {
                    if ($availshow == 2 && $gbt[0][2][$i][2] == 3) {
                        continue;
                    }
                }
                echo '<th class="cat' . $gbt[0][2][$i][1] . '"><div><span class="cattothdr">';
                if ($availshow < 3) {
                    echo $gbt[0][2][$i][0] . '<br/>';
                    if (isset($gbt[0][3][0])) {
                        //using points based
                        echo $gbt[0][2][$i][3 + $availshow] . '&nbsp;', _('pts');
                    } else {
                        echo $gbt[0][2][$i][11] . '%';
                    }
                } else {
                    if ($availshow == 3) {
                        //past and attempted
                        echo $gbt[0][2][$i][0];
                        if (isset($gbt[0][2][$i][11])) {
                            echo '<br/>' . $gbt[0][2][$i][11] . '%';
                        }
                    }
                }
                if ($collapsegbcat[$gbt[0][2][$i][1]] == 0) {
                    echo "<br/><a class=small href=\"gradebook.php?cid={$cid}&amp;cat={$gbt[0][2][$i][10]}&amp;catcollapse=2\">", _('[Collapse]'), "</a>";
                } else {
                    echo "<br/><a class=small href=\"gradebook.php?cid={$cid}&amp;cat={$gbt[0][2][$i][10]}&amp;catcollapse=0\">", _('[Expand]'), "</a>";
                }
                echo '</span></div></th>';
                $n++;
            }
        }
    }
    if ($catfilter > -2) {
        for ($i = 0; $i < count($gbt[0][1]); $i++) {
            //assessment headers
            if (!$isteacher && !$istutor && $gbt[0][1][$i][4] == 0) {
                //skip if hidden
                continue;
            }
            if ($hidenc == 1 && $gbt[0][1][$i][4] == 0) {
                //skip NC
                continue;
            } else {
                if ($hidenc == 2 && ($gbt[0][1][$i][4] == 0 || $gbt[0][1][$i][4] == 3)) {
                    //skip all NC
                    continue;
                }
            }
            if ($gbt[0][1][$i][3] > $availshow) {
                continue;
            }
            if ($hidepast && $gbt[0][1][$i][3] == 0) {
                continue;
            }
            if ($collapsegbcat[$gbt[0][1][$i][1]] == 2) {
                continue;
            }
            //name and points
            echo '<th class="cat' . $gbt[0][1][$i][1] . '"><div>' . $gbt[0][1][$i][0] . '<br/>';
            if ($gbt[0][1][$i][4] == 0 || $gbt[0][1][$i][4] == 3) {
                echo $gbt[0][1][$i][2] . '&nbsp;', _('pts'), ' ', _('(Not Counted)');
            } else {
                echo $gbt[0][1][$i][2] . '&nbsp;', _('pts');
                if ($gbt[0][1][$i][4] == 2) {
                    echo ' (EC)';
                }
            }
            if ($gbt[0][1][$i][5] == 1 && $gbt[0][1][$i][6] == 0) {
                echo ' (PT)';
            }
            if ($includeduedate && $gbt[0][1][$i][11] < 2000000000 && $gbt[0][1][$i][11] > 0) {
                echo '<br/><span class="small">' . tzdate('n/j/y&\\n\\b\\s\\p;g:ia', $gbt[0][1][$i][11]) . '</span>';
            }
            //links
            if ($gbt[0][1][$i][6] == 0) {
                //online
                if ($isteacher) {
                    echo "<br/><a class=small href=\"addassessment.php?id={$gbt[0][1][$i][7]}&amp;cid={$cid}&amp;from=gb\">", _('[Settings]'), "</a>";
                    echo "<br/><a class=small href=\"isolateassessgrade.php?cid={$cid}&amp;aid={$gbt[0][1][$i][7]}\">", _('[Isolate]'), "</a>";
                    if ($gbt[0][1][$i][10] == true) {
                        echo "<br/><a class=small href=\"isolateassessbygroup.php?cid={$cid}&amp;aid={$gbt[0][1][$i][7]}\">", _('[By Group]'), "</a>";
                    }
                } else {
                    echo "<br/><a class=small href=\"isolateassessgrade.php?cid={$cid}&amp;aid={$gbt[0][1][$i][7]}\">", _('[Isolate]'), "</a>";
                }
            } else {
                if ($gbt[0][1][$i][6] == 1 && ($isteacher || $istutor && $gbt[0][1][$i][8] == 1)) {
                    //offline
                    if ($isteacher) {
                        echo "<br/><a class=small href=\"addgrades.php?stu={$stu}&amp;cid={$cid}&amp;grades=all&amp;gbitem={$gbt[0][1][$i][7]}\">", _('[Settings]'), "</a>";
                        echo "<br/><a class=small href=\"addgrades.php?stu={$stu}&amp;cid={$cid}&amp;grades=all&amp;gbitem={$gbt[0][1][$i][7]}&amp;isolate=true\">", _('[Isolate]'), "</a>";
                    } else {
                        echo "<br/><a class=small href=\"addgrades.php?stu={$stu}&amp;cid={$cid}&amp;grades=all&amp;gbitem={$gbt[0][1][$i][7]}&amp;isolate=true\">", _('[Scores]'), "</a>";
                    }
                } else {
                    if ($gbt[0][1][$i][6] == 2 && $isteacher) {
                        //discussion
                        echo "<br/><a class=small href=\"addforum.php?id={$gbt[0][1][$i][7]}&amp;cid={$cid}&amp;from=gb\">", _('[Settings]'), "</a>";
                    } else {
                        if ($gbt[0][1][$i][6] == 3 && $isteacher) {
                            //exttool
                            echo "<br/><a class=small href=\"addlinkedtext.php?id={$gbt[0][1][$i][7]}&amp;cid={$cid}&amp;from=gb\">", _('[Settings]'), "</a>";
                            echo "<br/><a class=small href=\"edittoolscores.php?stu={$stu}&amp;cid={$cid}&amp;uid=all&amp;lid={$gbt[0][1][$i][7]}&amp;isolate=true\">", _('[Isolate]'), "</a>";
                        }
                    }
                }
            }
            echo '</div></th>';
            $n++;
        }
    }
    if (!$totonleft && !$hidepast) {
        if (count($gbt[0][2]) > 1 || $catfilter != -1) {
            //want to show cat headers?
            for ($i = 0; $i < count($gbt[0][2]); $i++) {
                //category headers
                if (($availshow < 2 || $availshow == 3) && $gbt[0][2][$i][2] > 1) {
                    continue;
                } else {
                    if ($availshow == 2 && $gbt[0][2][$i][2] == 3) {
                        continue;
                    }
                }
                echo '<th class="cat' . $gbt[0][2][$i][1] . '"><div><span class="cattothdr">';
                if ($availshow < 3) {
                    echo $gbt[0][2][$i][0] . '<br/>';
                    if (isset($gbt[0][3][0])) {
                        //using points based
                        echo $gbt[0][2][$i][3 + $availshow] . '&nbsp;', _('pts');
                    } else {
                        echo $gbt[0][2][$i][11] . '%';
                    }
                } else {
                    if ($availshow == 3) {
                        //past and attempted
                        echo $gbt[0][2][$i][0];
                    }
                }
                if ($collapsegbcat[$gbt[0][2][$i][1]] == 0) {
                    echo "<br/><a class=small href=\"gradebook.php?cid={$cid}&amp;cat={$gbt[0][2][$i][10]}&amp;catcollapse=2\">", _('[Collapse]'), "</a>";
                } else {
                    echo "<br/><a class=small href=\"gradebook.php?cid={$cid}&amp;cat={$gbt[0][2][$i][10]}&amp;catcollapse=0\">", _('[Expand]'), "</a>";
                }
                echo '</span></div></th>';
                $n++;
            }
        }
        //total totals
        if ($catfilter < 0) {
            if (isset($gbt[0][3][0])) {
                //using points based
                echo '<th><div><span class="cattothdr">', _('Total'), '<br/>' . $gbt[0][3][$availshow] . '&nbsp;', _('pts'), '</span></div></th>';
                echo '<th><div>%</div></th>';
                $n += 2;
            } else {
                echo '<th><div><span class="cattothdr">', _('Weighted Total %'), '</span></div></th>';
                $n++;
            }
        }
    }
    echo '</tr></thead><tbody>';
    //create student rows
    if (isset($GLOBALS['CFG']['GEN']['AWSforcoursefiles']) && $GLOBALS['CFG']['GEN']['AWSforcoursefiles'] == true) {
        $userimgbase = $urlmode . "s3.amazonaws.com/{$GLOBALS['AWSbucket']}/cfiles";
    } else {
        $userimgbase = "{$imasroot}/course/files";
    }
    for ($i = 1; $i < count($gbt); $i++) {
        if ($i == 1) {
            $insdiv = "<div>";
            $enddiv = "</div>";
        } else {
            $insdiv = '';
            $enddiv = '';
        }
        if ($i % 2 != 0) {
            echo "<tr class=even onMouseOver=\"highlightrow(this)\" onMouseOut=\"unhighlightrow(this)\">";
        } else {
            echo "<tr class=odd onMouseOver=\"highlightrow(this)\" onMouseOut=\"unhighlightrow(this)\">";
        }
        echo '<td class="locked" scope="row"><div class="trld">';
        if ($gbt[$i][0][0] != "Averages" && $isteacher) {
            echo "<input type=\"checkbox\" name='checked[]' value='{$gbt[$i][4][0]}' />&nbsp;";
        }
        echo "<a href=\"gradebook.php?cid={$cid}&amp;stu={$gbt[$i][4][0]}\">";
        if ($gbt[$i][4][1] > 0) {
            echo '<span class="greystrike">' . $gbt[$i][0][0] . '</span>';
        } else {
            echo $gbt[$i][0][0];
        }
        echo '</a>';
        if ($gbt[$i][4][3] == 1) {
            echo '<sup>*</sup>';
        }
        echo '</div></td>';
        if ($showpics == 1 && $gbt[$i][4][2] == 1) {
            //file_exists("$curdir//files/userimg_sm{$gbt[$i][4][0]}.jpg")) {
            echo "<td>{$insdiv}<div class=\"trld\"><img src=\"{$userimgbase}/userimg_sm{$gbt[$i][4][0]}.jpg\"/></div></td>";
        } else {
            if ($showpics == 2 && $gbt[$i][4][2] == 1) {
                echo "<td>{$insdiv}<div class=\"trld\"><img src=\"{$userimgbase}/userimg_{$gbt[$i][4][0]}.jpg\"/></div></td>";
            } else {
                echo '<td>' . $insdiv . '<div class="trld">&nbsp;</div></td>';
            }
        }
        for ($j = $gbt[0][0][1] == 'ID' ? 1 : 2; $j < count($gbt[0][0]); $j++) {
            echo '<td class="c">' . $insdiv . $gbt[$i][0][$j] . $enddiv . '</td>';
        }
        if ($totonleft && !$hidepast) {
            //total totals
            if ($catfilter < 0) {
                if ($availshow == 3) {
                    if ($gbt[$i][0][0] == 'Averages') {
                        if (isset($gbt[$i][3][8])) {
                            //using points based
                            echo '<td class="c">' . $insdiv . $gbt[$i][3][6] . '%' . $enddiv . '</td>';
                        }
                        echo '<td class="c">' . $insdiv . $gbt[$i][3][6] . '%' . $enddiv . '</td>';
                    } else {
                        if (isset($gbt[$i][3][8])) {
                            //using points based
                            echo '<td class="c">' . $insdiv . $gbt[$i][3][6] . '/' . $gbt[$i][3][7] . $enddiv . '</td>';
                            echo '<td class="c">' . $insdiv . $gbt[$i][3][8] . '%' . $enddiv . '</td>';
                        } else {
                            echo '<td class="c">' . $insdiv . $gbt[$i][3][6] . '%' . $enddiv . '</td>';
                        }
                    }
                } else {
                    if (isset($gbt[0][3][0])) {
                        //using points based
                        echo '<td class="c">' . $insdiv . $gbt[$i][3][$availshow] . $enddiv . '</td>';
                        echo '<td class="c">' . $insdiv . $gbt[$i][3][$availshow + 3] . '%' . $enddiv . '</td>';
                    } else {
                        echo '<td class="c">' . $insdiv . $gbt[$i][3][$availshow] . '%' . $enddiv . '</td>';
                    }
                }
            }
            //category totals
            if (count($gbt[0][2]) > 1 || $catfilter != -1) {
                //want to show cat headers?
                for ($j = 0; $j < count($gbt[0][2]); $j++) {
                    //category headers
                    if (($availshow < 2 || $availshow == 3) && $gbt[0][2][$j][2] > 1) {
                        continue;
                    } else {
                        if ($availshow == 2 && $gbt[0][2][$j][2] == 3) {
                            continue;
                        }
                    }
                    if ($catfilter != -1 && $availshow < 3 && $gbt[0][2][$j][$availshow + 3] > 0) {
                        //echo '<td class="c">'.$gbt[$i][2][$j][$availshow].' ('.round(100*$gbt[$i][2][$j][$availshow]/$gbt[0][2][$j][$availshow+3])  .'%)</td>';
                        echo '<td class="c">' . $insdiv;
                        if ($gbt[$i][0][0] == 'Averages' && $availshow != 3) {
                            echo "<span onmouseover=\"tipshow(this,'", _('5-number summary:'), " {$gbt[0][2][$j][6 + $availshow]}')\" onmouseout=\"tipout()\" >";
                        }
                        echo $gbt[$i][2][$j][$availshow] . ' (' . round(100 * $gbt[$i][2][$j][$availshow] / $gbt[0][2][$j][$availshow + 3]) . '%)';
                        if ($gbt[$i][0][0] == 'Averages' && $availshow != 3) {
                            echo '</span>';
                        }
                        echo $enddiv . '</td>';
                    } else {
                        //echo '<td class="c">'.$gbt[$i][2][$j][$availshow].'</td>';
                        echo '<td class="c">' . $insdiv;
                        if ($gbt[$i][0][0] == 'Averages') {
                            echo "<span onmouseover=\"tipshow(this,'", _('5-number summary:'), " {$gbt[0][2][$j][6 + $availshow]}')\" onmouseout=\"tipout()\" >";
                        }
                        if ($availshow == 3) {
                            if ($gbt[$i][0][0] == 'Averages') {
                                echo $gbt[$i][2][$j][3] . '%';
                                //echo '-';
                            } else {
                                echo $gbt[$i][2][$j][3] . '/' . $gbt[$i][2][$j][4];
                            }
                        } else {
                            if (isset($gbt[$i][3][8])) {
                                //using points based
                                echo $gbt[$i][2][$j][$availshow];
                            } else {
                                if ($gbt[0][2][$j][3 + $availshow] > 0) {
                                    echo round(100 * $gbt[$i][2][$j][$availshow] / $gbt[0][2][$j][3 + $availshow], 1) . '%';
                                } else {
                                    echo '0%';
                                }
                            }
                        }
                        if ($gbt[$i][0][0] == 'Averages') {
                            echo '</span>';
                        }
                        echo $enddiv . '</td>';
                    }
                }
            }
        }
        //assessment values
        if ($catfilter > -2) {
            for ($j = 0; $j < count($gbt[0][1]); $j++) {
                if (!$isteacher && !$istutor && $gbt[0][1][$j][4] == 0) {
                    //skip if hidden
                    continue;
                }
                if ($hidenc == 1 && $gbt[0][1][$j][4] == 0) {
                    //skip NC
                    continue;
                } else {
                    if ($hidenc == 2 && ($gbt[0][1][$j][4] == 0 || $gbt[0][1][$j][4] == 3)) {
                        //skip all NC
                        continue;
                    }
                }
                if ($gbt[0][1][$j][3] > $availshow) {
                    continue;
                }
                if ($hidepast && $gbt[0][1][$j][3] == 0) {
                    continue;
                }
                if ($collapsegbcat[$gbt[0][1][$j][1]] == 2) {
                    continue;
                }
                //if online, not average, and either score exists and active, or score doesn't exist and assess is current,
                if ($gbt[0][1][$j][6] == 0 && $gbt[$i][1][$j][4] != 'average' && (isset($gbt[$i][1][$j][3]) && $gbt[$i][1][$j][3] > 9 || !isset($gbt[$i][1][$j][3]) && $gbt[0][1][$j][3] == 1)) {
                    echo '<td class="c isact">' . $insdiv;
                } else {
                    echo '<td class="c">' . $insdiv;
                }
                if (isset($gbt[$i][1][$j][5]) && $gbt[$i][1][$j][5] & 1 << $availshow && !$hidepast) {
                    echo '<span style="font-style:italic">';
                }
                if ($gbt[0][1][$j][6] == 0) {
                    //online
                    if (isset($gbt[$i][1][$j][0])) {
                        if ($istutor && $gbt[$i][1][$j][4] == 'average') {
                        } else {
                            if ($gbt[$i][1][$j][4] == 'average') {
                                echo "<a href=\"gb-itemanalysis.php?stu={$stu}&amp;cid={$cid}&amp;asid={$gbt[$i][1][$j][4]}&amp;aid={$gbt[0][1][$j][7]}\" ";
                                echo "onmouseover=\"tipshow(this,'", _('5-number summary:'), " {$gbt[0][1][$j][9]}')\" onmouseout=\"tipout()\" ";
                                echo ">";
                            } else {
                                echo "<a href=\"gb-viewasid.php?stu={$stu}&amp;cid={$cid}&amp;asid={$gbt[$i][1][$j][4]}&amp;uid={$gbt[$i][4][0]}\">";
                            }
                        }
                        if ($gbt[$i][1][$j][3] > 9) {
                            $gbt[$i][1][$j][3] -= 10;
                        }
                        echo $gbt[$i][1][$j][0];
                        if ($gbt[$i][1][$j][3] == 1) {
                            echo ' (NC)';
                        } else {
                            if ($gbt[$i][1][$j][3] == 2) {
                                echo ' (IP)';
                            } else {
                                if ($gbt[$i][1][$j][3] == 3) {
                                    echo ' (OT)';
                                } else {
                                    if ($gbt[$i][1][$j][3] == 4) {
                                        echo ' (PT)';
                                    }
                                }
                            }
                        }
                        if ($istutor && $gbt[$i][1][$j][4] == 'average') {
                        } else {
                            echo '</a>';
                        }
                        if ($gbt[$i][1][$j][1] == 1) {
                            echo '<sup>*</sup>';
                        }
                    } else {
                        //no score
                        if ($gbt[$i][0][0] == 'Averages') {
                            echo '-';
                        } else {
                            if ($isteacher) {
                                echo "<a href=\"gb-viewasid.php?stu={$stu}&amp;cid={$cid}&amp;asid=new&amp;aid={$gbt[0][1][$j][7]}&amp;uid={$gbt[$i][4][0]}\">-</a>";
                            } else {
                                echo '-';
                            }
                        }
                    }
                    if (isset($gbt[$i][1][$j][6])) {
                        if ($gbt[$i][1][$j][6] > 1) {
                            if ($gbt[$i][1][$j][6] > 2) {
                                echo '<sup>LP (' . ($gbt[$i][1][$j][6] - 1) . ')</sup>';
                            } else {
                                echo '<sup>LP</sup>';
                            }
                        } else {
                            echo '<sup>e</sup>';
                        }
                    }
                } else {
                    if ($gbt[0][1][$j][6] == 1) {
                        //offline
                        if ($isteacher) {
                            if ($gbt[$i][0][0] == 'Averages') {
                                echo "<a href=\"addgrades.php?stu={$stu}&amp;cid={$cid}&amp;grades=all&amp;gbitem={$gbt[0][1][$j][7]}\" ";
                                echo "onmouseover=\"tipshow(this,'", _('5-number summary:'), " {$gbt[0][1][$j][9]}')\" onmouseout=\"tipout()\" ";
                                echo ">";
                            } else {
                                echo "<a href=\"addgrades.php?stu={$stu}&amp;cid={$cid}&amp;grades={$gbt[$i][4][0]}&amp;gbitem={$gbt[0][1][$j][7]}\">";
                            }
                        } else {
                            if ($istutor && $gbt[0][1][$j][8] == 1) {
                                if ($gbt[$i][0][0] == 'Averages') {
                                    echo "<a href=\"addgrades.php?stu={$stu}&amp;cid={$cid}&amp;grades=all&amp;gbitem={$gbt[0][1][$j][7]}\">";
                                } else {
                                    echo "<a href=\"addgrades.php?stu={$stu}&amp;cid={$cid}&amp;grades={$gbt[$i][4][0]}&amp;gbitem={$gbt[0][1][$j][7]}\">";
                                }
                            }
                        }
                        if (isset($gbt[$i][1][$j][0])) {
                            echo $gbt[$i][1][$j][0];
                            if ($gbt[$i][1][$j][3] == 1) {
                                echo ' (NC)';
                            }
                        } else {
                            echo '-';
                        }
                        if ($isteacher || $istutor && $gbt[0][1][$j][8] == 1) {
                            echo '</a>';
                        }
                        if ($gbt[$i][1][$j][1] == 1) {
                            echo '<sup>*</sup>';
                        }
                    } else {
                        if ($gbt[0][1][$j][6] == 2) {
                            //discuss
                            if (isset($gbt[$i][1][$j][0])) {
                                if ($gbt[$i][0][0] != 'Averages') {
                                    echo "<a href=\"viewforumgrade.php?cid={$cid}&amp;stu={$stu}&amp;uid={$gbt[$i][4][0]}&amp;fid={$gbt[0][1][$j][7]}\">";
                                    echo $gbt[$i][1][$j][0];
                                    echo '</a>';
                                } else {
                                    echo "<span onmouseover=\"tipshow(this,'", _('5-number summary:'), " {$gbt[0][1][$j][9]}')\" onmouseout=\"tipout()\"> ";
                                    echo $gbt[$i][1][$j][0];
                                    echo '</span>';
                                }
                                if ($gbt[$i][1][$j][1] == 1) {
                                    echo '<sup>*</sup>';
                                }
                            } else {
                                if ($isteacher && $gbt[$i][0][0] != 'Averages') {
                                    echo "<a href=\"viewforumgrade.php?cid={$cid}&amp;stu={$stu}&amp;uid={$gbt[$i][4][0]}&amp;fid={$gbt[0][1][$j][7]}\">-</a>";
                                } else {
                                    echo '-';
                                }
                            }
                        } else {
                            if ($gbt[0][1][$j][6] == 3) {
                                //exttool
                                if ($isteacher) {
                                    if ($gbt[$i][0][0] == 'Averages') {
                                        echo "<a href=\"edittoolscores.php?stu={$stu}&amp;cid={$cid}&amp;uid=all&amp;lid={$gbt[0][1][$j][7]}\" ";
                                        echo "onmouseover=\"tipshow(this,'", _('5-number summary:'), " {$gbt[0][1][$j][9]}')\" onmouseout=\"tipout()\" ";
                                        echo ">";
                                    } else {
                                        echo "<a href=\"edittoolscores.php?stu={$stu}&amp;cid={$cid}&amp;uid={$gbt[$i][4][0]}&amp;lid={$gbt[0][1][$j][7]}\">";
                                    }
                                } else {
                                    if ($istutor && $gbt[0][1][$j][8] == 1) {
                                        if ($gbt[$i][0][0] == 'Averages') {
                                            echo "<a href=\"edittoolscores.php?stu={$stu}&amp;cid={$cid}&amp;uid=all&amp;lid={$gbt[0][1][$j][7]}\">";
                                        } else {
                                            echo "<a href=\"edittoolscores.php?stu={$stu}&amp;cid={$cid}&amp;uid={$gbt[$i][4][0]}&amp;lid={$gbt[0][1][$j][7]}\">";
                                        }
                                    }
                                }
                                if (isset($gbt[$i][1][$j][0])) {
                                    echo $gbt[$i][1][$j][0];
                                    if ($gbt[$i][1][$j][3] == 1) {
                                        echo ' (NC)';
                                    }
                                } else {
                                    echo '-';
                                }
                                if ($isteacher || $istutor && $gbt[0][1][$j][8] == 1) {
                                    echo '</a>';
                                }
                                if ($gbt[$i][1][$j][1] == 1) {
                                    echo '<sup>*</sup>';
                                }
                            }
                        }
                    }
                }
                if (isset($gbt[$i][1][$j][5]) && $gbt[$i][1][$j][5] & 1 << $availshow && !$hidepast) {
                    echo '<sub>d</sub></span>';
                }
                echo $enddiv . '</td>';
            }
        }
        if (!$totonleft && !$hidepast) {
            //category totals
            if (count($gbt[0][2]) > 1 || $catfilter != -1) {
                //want to show cat headers?
                for ($j = 0; $j < count($gbt[0][2]); $j++) {
                    //category headers
                    if (($availshow < 2 || $availshow == 3) && $gbt[0][2][$j][2] > 1) {
                        continue;
                    } else {
                        if ($availshow == 2 && $gbt[0][2][$j][2] == 3) {
                            continue;
                        }
                    }
                    if ($catfilter != -1 && $availshow < 3 && $gbt[0][2][$j][$availshow + 3] > 0) {
                        //echo '<td class="c">'.$gbt[$i][2][$j][$availshow].' ('.round(100*$gbt[$i][2][$j][$availshow]/$gbt[0][2][$j][$availshow+3])  .'%)</td>';
                        echo '<td class="c">' . $insdiv;
                        if ($gbt[$i][0][0] == 'Averages' && $availshow != 3) {
                            echo "<span onmouseover=\"tipshow(this,'", _('5-number summary:'), " {$gbt[0][2][$j][6 + $availshow]}')\" onmouseout=\"tipout()\" >";
                        }
                        echo $gbt[$i][2][$j][$availshow] . ' (' . round(100 * $gbt[$i][2][$j][$availshow] / $gbt[0][2][$j][$availshow + 3]) . '%)';
                        if ($gbt[$i][0][0] == 'Averages' && $availshow != 3) {
                            echo '</span>';
                        }
                        echo $enddiv . '</td>';
                    } else {
                        //echo '<td class="c">'.$gbt[$i][2][$j][$availshow].'</td>';
                        echo '<td class="c">' . $insdiv;
                        if ($gbt[$i][0][0] == 'Averages' && $availshow < 3) {
                            echo "<span onmouseover=\"tipshow(this,'", _('5-number summary:'), " {$gbt[0][2][$j][6 + $availshow]}')\" onmouseout=\"tipout()\" >";
                        }
                        if ($availshow == 3) {
                            if ($gbt[$i][0][0] == 'Averages') {
                                echo $gbt[$i][2][$j][3] . '%';
                            } else {
                                echo $gbt[$i][2][$j][3] . '/' . $gbt[$i][2][$j][4];
                            }
                        } else {
                            if (isset($gbt[$i][3][8])) {
                                //using points based
                                echo $gbt[$i][2][$j][$availshow];
                            } else {
                                if ($gbt[0][2][$j][3 + $availshow] > 0) {
                                    echo round(100 * $gbt[$i][2][$j][$availshow] / $gbt[0][2][$j][3 + $availshow], 1) . '%';
                                } else {
                                    echo '0%';
                                }
                            }
                        }
                        if ($gbt[$i][0][0] == 'Averages' && $availshow < 3) {
                            echo '</span>';
                        }
                        echo $enddiv . '</td>';
                    }
                }
            }
            //total totals
            if ($catfilter < 0) {
                if ($availshow == 3) {
                    if ($gbt[$i][0][0] == 'Averages') {
                        if (isset($gbt[$i][3][8])) {
                            //using points based
                            echo '<td class="c">' . $insdiv . $gbt[$i][3][6] . '%' . $enddiv . '</td>';
                        }
                        echo '<td class="c">' . $insdiv . $gbt[$i][3][6] . '%' . $enddiv . '</td>';
                    } else {
                        if (isset($gbt[$i][3][8])) {
                            //using points based
                            echo '<td class="c">' . $insdiv . $gbt[$i][3][6] . '/' . $gbt[$i][3][7] . $enddiv . '</td>';
                            echo '<td class="c">' . $insdiv . $gbt[$i][3][8] . '%' . $enddiv . '</td>';
                        } else {
                            echo '<td class="c">' . $insdiv . $gbt[$i][3][6] . '%' . $enddiv . '</td>';
                        }
                    }
                } else {
                    if (isset($gbt[0][3][0])) {
                        //using points based
                        echo '<td class="c">' . $insdiv . $gbt[$i][3][$availshow] . $enddiv . '</td>';
                        echo '<td class="c">' . $insdiv . $gbt[$i][3][$availshow + 3] . '%' . $enddiv . '</td>';
                    } else {
                        echo '<td class="c">' . $insdiv . $gbt[$i][3][$availshow] . '%' . $enddiv . '</td>';
                    }
                }
            }
        }
        echo '</tr>';
    }
    echo "</tbody></table></div></div>";
    if ($n > 1) {
        $sarr = array_merge($sortarr, array_fill(0, $n, "'N'"));
    } else {
        $sarr = array();
    }
    $sarr = implode(",", $sarr);
    if (count($gbt) < 500) {
        if ($avgontop) {
            echo "<script>initSortTable('myTable',Array({$sarr}),true,true,false);</script>\n";
        } else {
            echo "<script>initSortTable('myTable',Array({$sarr}),true,false);</script>\n";
        }
    }
    if ($colorize != '0') {
        echo '<script type="text/javascript">addLoadEvent( function() {updateColors(document.getElementById("colorsel"));} );</script>';
    }
}
Beispiel #14
0
 } else {
     $query = "SELECT name,points,showdate,gbcategory,cntingb,tutoredit,rubric,outcomes FROM imas_gbitems WHERE id='{$_GET['gbitem']}'";
     $result = mysql_query($query) or die("Query failed : " . mysql_error());
     list($name, $points, $showdate, $gbcat, $cntingb, $tutoredit, $rubric, $gradeoutcomes) = mysql_fetch_row($result);
     if ($gradeoutcomes != '') {
         $gradeoutcomes = explode(',', $gradeoutcomes);
     } else {
         $gradeoutcomes = array();
     }
 }
 if ($showdate != 0) {
     $sdate = tzdate("m/d/Y", $showdate);
     $stime = tzdate("g:i a", $showdate);
 } else {
     $sdate = tzdate("m/d/Y", time() + 60 * 60);
     $stime = tzdate("g:i a", time() + 60 * 60);
 }
 $rubric_vals = array(0);
 $rubric_names = array('None');
 $query = "SELECT id,name FROM imas_rubrics WHERE ownerid='{$userid}' OR groupid='{$gropuid}' ORDER BY name";
 $result = mysql_query($query) or die("Query failed : " . mysql_error());
 while ($row = mysql_fetch_row($result)) {
     $rubric_vals[] = $row[0];
     $rubric_names[] = $row[1];
 }
 $query = "SELECT id,name FROM imas_outcomes WHERE courseid='{$cid}'";
 $result = mysql_query($query) or die("Query failed : " . mysql_error());
 $outcomenames = array();
 while ($row = mysql_fetch_row($result)) {
     $outcomenames[$row[0]] = $row[1];
 }
Beispiel #15
0
 function printchildren($base, $restricttoowner = false)
 {
     $curdir = rtrim(dirname(__FILE__), '/\\');
     global $children, $date, $subject, $message, $poster, $email, $forumid, $threadid, $isteacher, $cid, $userid, $ownerid, $points;
     global $feedback, $posttype, $lastview, $bcnt, $icnt, $myrights, $allowreply, $allowmod, $allowdel, $allowlikes, $view, $page, $allowmsg;
     global $haspoints, $imasroot, $postby, $replyby, $files, $CFG, $rubric, $pointsposs, $hasuserimg, $urlmode, $likes, $mylikes, $section;
     global $canviewall, $caneditscore, $canviewscore;
     if (!isset($CFG['CPS']['itemicons'])) {
         $itemicons = array('web' => 'web.png', 'doc' => 'doc.png', 'wiki' => 'wiki.png', 'html' => 'html.png', 'forum' => 'forum.png', 'pdf' => 'pdf.png', 'ppt' => 'ppt.png', 'zip' => 'zip.png', 'png' => 'image.png', 'xls' => 'xls.png', 'gif' => 'image.png', 'jpg' => 'image.png', 'bmp' => 'image.png', 'mp3' => 'sound.png', 'wav' => 'sound.png', 'wma' => 'sound.png', 'swf' => 'video.png', 'avi' => 'video.png', 'mpg' => 'video.png', 'nb' => 'mathnb.png', 'mws' => 'maple.png', 'mw' => 'maple.png');
     } else {
         $itemicons = $CFG['CPS']['itemicons'];
     }
     foreach ($children[$base] as $child) {
         if ($restricttoowner && $ownerid[$child] != $userid) {
             continue;
         }
         echo "<div class=block> ";
         echo '<span class="leftbtns">';
         if (isset($children[$child])) {
             if ($view == 1) {
                 $lbl = '+';
                 $img = "expand";
             } else {
                 $lbl = '-';
                 $img = "collapse";
             }
             //echo "<input type=button id=\"butb$bcnt\" value=\"$lbl\" onClick=\"toggleshow($bcnt)\"> ";
             echo "<img class=\"pointer\" id=\"butb{$bcnt}\" src=\"{$imasroot}/img/{$img}.gif\" onClick=\"toggleshow({$bcnt})\"/> ";
         }
         if ($hasuserimg[$child] == 1) {
             if (isset($GLOBALS['CFG']['GEN']['AWSforcoursefiles']) && $GLOBALS['CFG']['GEN']['AWSforcoursefiles'] == true) {
                 echo "<img src=\"{$urlmode}s3.amazonaws.com/{$GLOBALS['AWSbucket']}/cfiles/userimg_sm{$ownerid[$child]}.jpg\"  onclick=\"togglepic(this)\" />";
             } else {
                 echo "<img src=\"{$imasroot}/course/files/userimg_sm{$ownerid[$child]}.jpg\"  onclick=\"togglepic(this)\" />";
             }
         }
         echo '</span>';
         echo "<span class=right>";
         if ($view == 2) {
             echo "<input type=button id=\"buti{$icnt}\" value=\"Show\" onClick=\"toggleitem({$icnt})\">\n";
         } else {
             echo "<input type=button id=\"buti{$icnt}\" value=\"Hide\" onClick=\"toggleitem({$icnt})\">\n";
         }
         if ($isteacher) {
             echo "<a href=\"posts.php?view={$view}&cid={$cid}&forum={$forumid}&thread={$threadid}&page={$page}&move={$child}\">Move</a> \n";
         }
         if ($isteacher || $ownerid[$child] == $userid && $allowmod) {
             if ($base == 0 && time() < $postby || $base > 0 && time() < $replyby || $isteacher) {
                 echo "<a href=\"posts.php?view={$view}&cid={$cid}&forum={$forumid}&thread={$threadid}&page={$page}&modify={$child}\">Modify</a> \n";
             }
         }
         if ($isteacher || $allowdel && $ownerid[$child] == $userid && !isset($children[$child])) {
             echo "<a href=\"posts.php?view={$view}&cid={$cid}&forum={$forumid}&thread={$threadid}&page={$page}&remove={$child}\">Remove</a> \n";
         }
         if ($posttype[$child] != 2 && $myrights > 5 && $allowreply) {
             echo "<a href=\"posts.php?view={$view}&cid={$cid}&forum={$forumid}&thread={$threadid}&page={$page}&modify=reply&replyto={$child}\">Reply</a>";
         }
         echo "</span>\n";
         echo '<span style="float:left">';
         echo "<b>{$subject[$child]}</b><br/>Posted by: ";
         //if ($isteacher && $ownerid[$child]!=0) {
         //	echo "<a href=\"mailto:{$email[$child]}\">";
         //} else if ($allowmsg && $ownerid[$child]!=0) {
         if (($isteacher || $allowmsg) && $ownerid[$child] != 0) {
             echo "<a href=\"../msgs/msglist.php?cid={$cid}&add=new&to={$ownerid[$child]}\" ";
             if ($section[$child] != '') {
                 echo 'title="Section: ' . $section[$child] . '"';
             }
             echo ">";
         }
         echo $poster[$child];
         if (($isteacher || $allowmsg) && $ownerid[$child] != 0) {
             echo "</a>";
         }
         if ($isteacher && $ownerid[$child] != 0 && $ownerid[$child] != $userid) {
             echo " <a class=\"small\" href=\"{$imasroot}/course/gradebook.php?cid={$cid}&stu={$ownerid[$child]}\" target=\"_popoutgradebook\">[GB]</a>";
             if ($base == 0 && preg_match('/Question\\s+about\\s+#(\\d+)\\s+in\\s+(.*)\\s*$/', $subject[$child], $matches)) {
                 $query = "SELECT ias.id FROM imas_assessment_sessions AS ias JOIN imas_assessments AS ia ON ia.id=ias.assessmentid ";
                 $aname = addslashes($matches[2]);
                 $query .= "WHERE ia.name='{$aname}' AND ias.userid=" . intval($ownerid[$child]);
                 $result = mysql_query($query) or die("Query failed : {$query} " . mysql_error());
                 if (mysql_num_rows($result) > 0) {
                     $r = mysql_fetch_row($result);
                     echo " <a class=\"small\" href=\"{$imasroot}/course/gb-viewasid.php?cid={$cid}&uid={$ownerid[$child]}&asid={$r[0]}\" target=\"_popoutgradebook\">[assignment]</a>";
                 }
             }
         }
         echo ', ';
         echo tzdate("D, M j, Y, g:i a", $date[$child]);
         if ($date[$child] > $lastview) {
             echo " <span style=\"color:red;\">New</span>\n";
         }
         echo '</span>';
         if ($allowlikes) {
             $icon = in_array($child, $mylikes) ? 'liked' : 'likedgray';
             $likemsg = 'Liked by ';
             $likecnt = 0;
             $likeclass = '';
             if ($likes[$child][0] > 0) {
                 $likeclass = ' liked';
                 $likemsg .= $likes[$child][0] . ' ' . ($likes[$child][0] == 1 ? 'student' : 'students');
                 $likecnt += $likes[$child][0];
             }
             if ($likes[$child][1] > 0 || $likes[$child][2] > 0) {
                 $likeclass = ' likedt';
                 $n = $likes[$child][1] + $likes[$child][2];
                 if ($likes[$child][0] > 0) {
                     $likemsg .= ' and ';
                 }
                 $likemsg .= $n . ' ';
                 if ($likes[$child][2] > 0) {
                     $likemsg .= $n == 1 ? 'teacher' : 'teachers';
                     if ($likes[$child][1] > 0) {
                         $likemsg .= '/tutors/TAs';
                     }
                 } else {
                     if ($likes[$child][1] > 0) {
                         $likemsg .= $n == 1 ? 'tutor/TA' : 'tutors/TAs';
                     }
                 }
                 $likecnt += $n;
             }
             if ($likemsg == 'Liked by ') {
                 $likemsg = '';
             } else {
                 $likemsg .= '.';
             }
             if ($icon == 'liked') {
                 $likemsg = 'You like this. ' . $likemsg;
             } else {
                 $likemsg = 'Click to like this post. ' . $likemsg;
             }
             echo '<div class="likewrap">';
             echo "<img id=\"likeicon{$child}\" class=\"likeicon{$likeclass}\" src=\"{$imasroot}/img/{$icon}.png\" title=\"{$likemsg}\" onclick=\"savelike(this)\">";
             echo " <span class=\"pointer\" id=\"likecnt{$child}\" onclick=\"GB_show('" . _('Post Likes') . "','listlikes.php?cid={$cid}&amp;post={$child}',500,500);\">" . ($likecnt > 0 ? $likecnt : '') . ' </span> ';
             echo '</div>';
         }
         echo '<div class="clear"></div>';
         echo "</div>\n";
         if ($view == 2) {
             echo "<div class=hidden id=\"item{$icnt}\">";
         } else {
             echo "<div class=blockitems id=\"item{$icnt}\" style=\"clear:all\">";
         }
         if (isset($files[$child]) && $files[$child] != '') {
             $fl = explode('@@', $files[$child]);
             if (count($fl) > 2) {
                 echo '<p><b>Files:</b> ';
                 //<ul class="nomark">';
             } else {
                 echo '<p><b>File:</b> ';
             }
             for ($i = 0; $i < count($fl) / 2; $i++) {
                 //if (count($fl)>2) {echo '<li>';}
                 echo '<a href="' . getuserfileurl('ffiles/' . $child . '/' . $fl[2 * $i + 1]) . '" target="_blank">';
                 $extension = ltrim(strtolower(strrchr($fl[2 * $i + 1], ".")), '.');
                 if (isset($itemicons[$extension])) {
                     echo "<img alt=\"{$extension}\" src=\"{$imasroot}/img/{$itemicons[$extension]}\" class=\"mida\"/> ";
                 } else {
                     echo "<img alt=\"doc\" src=\"{$imasroot}/img/doc.png\" class=\"mida\"/> ";
                 }
                 echo $fl[2 * $i] . '</a> ';
                 //if (count($fl)>2) {echo '</li>';}
             }
             //if (count($fl)>2) {echo '</ul>';}
             echo '</p>';
         }
         echo filter($message[$child]);
         if ($haspoints) {
             if ($caneditscore && $ownerid[$child] != $userid) {
                 echo '<hr/>';
                 echo "Score: <input type=text size=2 name=\"score[{$child}]\" id=\"scorebox{$child}\" value=\"";
                 if ($points[$child] !== null) {
                     echo $points[$child];
                 }
                 echo "\"/> ";
                 if ($rubric != 0) {
                     echo printrubriclink($rubric, $pointsposs, "scorebox{$child}", "feedback{$child}");
                 }
                 echo " Private Feedback: <textarea cols=\"50\" rows=\"2\" name=\"feedback[{$child}]\" id=\"feedback{$child}\">";
                 if ($feedback[$child] !== null) {
                     echo $feedback[$child];
                 }
                 echo "</textarea>";
             } else {
                 if (($ownerid[$child] == $userid || $canviewscore) && $points[$child] !== null) {
                     echo '<div class="signup">Score: ';
                     echo "<span class=red>{$points[$child]} points</span><br/> ";
                     if ($feedback[$child] !== null && $feedback[$child] != '') {
                         echo 'Private Feedback: ';
                         echo $feedback[$child];
                     }
                     echo '</div>';
                 }
             }
         }
         echo "<div class=\"clear\"></div></div>\n";
         $icnt++;
         if (isset($children[$child])) {
             //if has children
             echo "<div class=";
             if ($view == 0 || $view == 2) {
                 echo '"forumgrp"';
             } else {
                 if ($view == 1) {
                     echo '"hidden"';
                 }
             }
             echo " id=\"block{$bcnt}\">\n";
             $bcnt++;
             printchildren($child, $posttype[$child] == 3 && !$isteacher);
             echo "</div>\n";
         }
         //}
     }
 }
Beispiel #16
0
    exit;
}
//Prep for output
$query = "SELECT id,name FROM imas_gbcats WHERE courseid='{$cid}'";
$result = mysql_query($query) or die("Query failed : " . mysql_error());
$i = 0;
$page_gbcatSelect = array();
if (mysql_num_rows($result) > 0) {
    while ($row = mysql_fetch_row($result)) {
        $page_gbcatSelect['val'][$i] = $row[0];
        $page_gbcatSelect['label'][$i] = $row[1];
        $i++;
    }
}
$sdate = tzdate("m/d/Y", time());
$stime = tzdate("g:i a", time());
$line['tutoredit'] = isset($CFG['AMS']['tutoredit']) ? $CFG['AMS']['tutoredit'] : 0;
//HTML output
$placeinhead = "<script type=\"text/javascript\" src=\"{$imasroot}/javascript/DatePicker.js\"></script>";
require "../header.php";
echo "<div class=breadcrumb>{$breadcrumbbase} <a href=\"course.php?cid={$_GET['cid']}\">{$coursename}</a> ";
echo "&gt; <a href=\"gradebook.php?stu=0&cid={$cid}\">Gradebook</a> ";
echo "&gt; Manage Offline Grades</div>";
echo '<div id="headerchgoffline" class="pagetitle"><h2>Manage Offline Grades</h2></div>';
echo "<form id=\"mainform\" method=post action=\"chgoffline.php?cid={$cid}\">";
$gbitems = array();
$query = "SELECT id,name FROM imas_gbitems WHERE courseid='{$cid}' ORDER BY name";
$result = mysql_query($query) or die("Query failed : " . mysql_error());
while ($row = mysql_fetch_row($result)) {
    $gbitems[$row[0]] = $row[1];
}
Beispiel #17
0
function printchildren($base)
{
    global $children, $date, $subject, $message, $poster, $email, $forumid, $threadid, $isteacher, $cid, $userid, $ownerid, $points, $posttype, $lastview, $bcnt, $icnt, $myrights, $allowreply, $allowmod, $allowdel, $view, $page, $allowmsg, $haspoints, $cansendmsgs;
    global $filtercid, $page, $type, $imasroot;
    $curdir = rtrim(dirname(__FILE__), '/\\');
    foreach ($children[$base] as $child) {
        echo "<div class=block> ";
        echo '<span class="leftbtns">';
        if (isset($children[$child])) {
            if ($view == 1) {
                $lbl = '+';
                $img = "expand";
            } else {
                $lbl = '-';
                $img = "collapse";
            }
            //echo "<input type=button id=\"butb$bcnt\" value=\"$lbl\" onClick=\"toggleshow($bcnt)\"> ";
            echo "<img class=\"pointer\" id=\"butb{$bcnt}\" src=\"{$imasroot}/img/{$img}.gif\" onClick=\"toggleshow({$bcnt})\"/> ";
        }
        echo '</span>';
        echo "<span class=right>";
        if ($ownerid[$child] != $userid && $cansendmsgs) {
            echo "<a href=\"msglist.php?cid={$cid}&filtercid={$filtercid}&page={$page}&type={$type}&add=new&to={$ownerid[$child]}&toquote={$child}\">Reply</a> ";
        }
        echo "<input type=button id=\"buti{$icnt}\" value=\"Hide\" onClick=\"toggleitem({$icnt})\">\n";
        echo "</span>\n";
        echo "<b>{$subject[$child]}</b><br/>Posted by: ";
        if ($isteacher && $ownerid[$child] != 0) {
            echo "<a href=\"mailto:{$email[$child]}\">";
        } else {
            if ($allowmsg && $ownerid[$child] != 0) {
                echo "<a href=\"../msgs/msglist.php?cid={$cid}&add=new&to={$ownerid[$child]}\">";
            }
        }
        echo $poster[$child];
        if (($isteacher || $allowmsg) && $ownerid[$child] != 0) {
            echo "</a>";
        }
        echo ', ';
        echo tzdate("F j, Y, g:i a", $date[$child]);
        if ($date[$child] > $lastview) {
            echo " <span style=\"color:red;\">New</span>\n";
        }
        echo "</div>\n";
        echo "<div class=\"blockitems\" id=\"item{$icnt}\">";
        $icnt++;
        echo filter($message[$child]);
        echo "</div>\n";
        if (isset($children[$child]) && ($posttype[$child] != 3 || $isteacher)) {
            //if has children
            echo "<div class=";
            if ($view == 0) {
                echo '"forumgrp"';
            } else {
                if ($view == 1) {
                    echo '"hidden"';
                }
            }
            echo " id=\"block{$bcnt}\">\n";
            $bcnt++;
            printchildren($child);
            echo "</div>\n";
        }
    }
}
Beispiel #18
0
 function printparents($id)
 {
     global $parent, $date, $subject, $message, $posttype, $poster;
     echo "<div class=block>";
     echo "<b>{$subject[$id]}</b><br/>Posted by: {$poster[$id]}, ";
     echo tzdate("F j, Y, g:i a", $date[$id]);
     echo "</div><div class=blockitems>";
     echo filter($message[$id]);
     echo "</div>\n";
     if ($parent[$id] != 0) {
         printparents($parent[$id]);
     }
 }
Beispiel #19
0
$curBreadcrumb = "{$breadcrumbbase} <a href=\"course.php?cid={$cid}\"> {$coursename}</a>\n";
if (isset($teacherid)) {
    if (isset($_GET['from']) && $_GET['from'] == 'gb') {
        $curBreadcrumb .= " &gt; <a href=\"gradebook.php?cid={$cid}&stu=0\">Gradebook</a> ";
        $curBreadcrumb .= " &gt; <a href=\"gradebook.php?cid={$cid}&stu={$uid}\">Student Detail</a> ";
    } else {
        $curBreadcrumb .= " &gt; <a href=\"listusers.php?cid={$cid}\">Roster</a> ";
    }
}
$curBreadcrumb .= "&gt; View Login Log\n";
$pagetitle = "View Login Log";
require "../header.php";
echo "<div class=\"breadcrumb\">{$curBreadcrumb}</div>";
echo '<div id="headerloginlog" class="pagetitle"><h2>' . $pagetitle . '</h2></div>';
echo '<div class="cpmid"><a href="viewactionlog.php?cid=' . $cid . '&uid=' . $uid . '">View Activity Log</a></div>';
$query = "SELECT LastName,FirstName FROM imas_users WHERE id='{$uid}'";
$result = mysql_query($query) or die("Query failed : " . mysql_error());
$row = mysql_fetch_row($result);
echo '<h3>Login Log for ' . $row[0] . ', ' . $row[1] . '</h3>';
echo '<ul class="nomark">';
$query = "SELECT logintime,lastaction FROM imas_login_log WHERE userid='{$uid}' AND courseid='{$cid}' ORDER BY logintime DESC";
$result = mysql_query($query) or die("Query failed : " . mysql_error());
while ($row = mysql_fetch_row($result)) {
    echo '<li>' . tzdate("l, F j, Y, g:i a", $row[0]);
    if ($row[1] > 0) {
        echo '.  On for about ' . round(($row[1] - $row[0]) / 60) . ' minutes.';
    }
    echo '</li>';
}
echo '</ul>';
require "../footer.php";
Beispiel #20
0
        $n++;
    }
    if ($n == 1) {
        $line['title'] = 'Re: ' . $line['title'];
    } else {
        if ($n > 1) {
            $line['title'] = "Re<sup>{$n}</sup>: " . $line['title'];
        }
    }
    echo "<tr><td><input type=checkbox name=\"checked[]\" value=\"{$line['id']}\"/></td><td>";
    echo "<a href=\"viewmsg.php?page{$page}&cid={$cid}&filterstu={$filterstu}&type=msg&msgid={$line['id']}&type=allstu\">";
    echo $line['title'];
    echo "</a></td><td>";
    echo $stulist[$line['msgfrom']];
    echo "</td><td>{$stulist[$line['msgto']]}</td>";
    $senddate = tzdate("F j, Y, g:i a", $line['senddate']);
    echo "<td>{$senddate}</td></tr>";
}
?>
	</tbody>
	</table>
	</form>
<?php 
if ($prevnext != '') {
    echo "<p>{$prevnext}</p>";
}
echo "<p><a href=\"msglist.php?cid={$cid}\">Back to My Messages</a></p>";
require "../footer.php";
?>
		
	
Beispiel #21
0
     $stime = $defstime;
     //tzdate("g:i a",time());
 }
 if ($enddate != 2000000000) {
     $edate = tzdate("m/d/Y", $enddate);
     $etime = tzdate("g:i a", $enddate);
 } else {
     $edate = tzdate("m/d/Y", time() + 7 * 24 * 60 * 60);
     $etime = $deftime;
     //tzdate("g:i a",time()+7*24*60*60);
 }
 if ($revisedate < 2000000000 && $revisedate > 0) {
     $rdate = tzdate("m/d/Y", $revisedate);
     $rtime = tzdate("g:i a", $revisedate);
 } else {
     $rdate = tzdate("m/d/Y", time() + 7 * 24 * 60 * 60);
     $rtime = $deftime;
     //tzdate("g:i a",time()+7*24*60*60);
 }
 if (!isset($_GET['id'])) {
     $stime = $defstime;
     $etime = $deftime;
     $rtime = $deftime;
 }
 $query = "SELECT id,name FROM imas_stugroupset WHERE courseid='{$cid}' ORDER BY name";
 $result = mysql_query($query) or die("Query failed : " . mysql_error());
 $i = 0;
 $page_groupSelect = array();
 while ($row = mysql_fetch_row($result)) {
     $page_groupSelect['val'][$i] = $row[0];
     $page_groupSelect['label'][$i] = "Use group set: {$row[1]}";
Beispiel #22
0
			<th>Lock Out</th>
		</tr>
		</thead>
		<tbody>	
<?php 
        $alt = 0;
        $numstu = 0;
        while ($line = mysql_fetch_array($resultDefaultUserList, MYSQL_ASSOC)) {
            if ($line['section'] == null) {
                $line['section'] = '';
            }
            $numstu++;
            if ($line['locked'] > 0) {
                $lastaccess = "Is locked out";
            } else {
                $lastaccess = $line['lastaccess'] > 0 ? tzdate("n/j/y g:ia", $line['lastaccess']) : "never";
            }
            $hasSectionData = $hassection ? "<td>{$line['section']}</td>" : "";
            $hasCodeData = $hascode ? "<td>{$line['code']}</td>" : "";
            if ($alt == 0) {
                echo "\t\t\t<tr class=even>";
                $alt = 1;
            } else {
                echo "\t\t\t<tr class=odd>";
                $alt = 0;
            }
            ?>
			
				<td><input type=checkbox name="checked[]" value="<?php 
            echo $line['userid'];
            ?>
Beispiel #23
0
 function getshortday($atime)
 {
     global $shortdays;
     return $shortdays[tzdate('w', $atime)];
 }
Beispiel #24
0
 $query = "SELECT imas_assessments.name,imas_assessments.defpoints,imas_assessments.defoutcome,imas_assessment_sessions.* ";
 $query .= "FROM imas_assessments,imas_assessment_sessions ";
 $query .= "WHERE imas_assessments.id=imas_assessment_sessions.assessmentid AND imas_assessment_sessions.id='{$_GET['asid']}'";
 $result = mysql_query($query) or die("Query failed : " . mysql_error());
 $line = mysql_fetch_array($result, MYSQL_ASSOC);
 if (!$isteacher && !$istutor) {
     $query = "INSERT INTO imas_content_track (userid,courseid,type,typeid,viewtime) VALUES ";
     $query .= "({$userid},'{$cid}','gbviewasid','{$line['assessmentid']}',{$now})";
     mysql_query($query) or die("Query failed : " . mysql_error());
 }
 echo "<h4>{$line['name']}</h4>\n";
 echo "<p>Started: " . tzdate("F j, Y, g:i a", $line['starttime']) . "<BR>\n";
 if ($line['endtime'] == 0) {
     echo "Not Submitted</p>\n";
 } else {
     echo "Last change: " . tzdate("F j, Y, g:i a", $line['endtime']) . "</p>\n";
 }
 $query = "SELECT COUNT(id) from imas_questions WHERE assessmentid='{$line['assessmentid']}' AND category<>'0'";
 $result = mysql_query($query) or die("Query failed : {$query};  " . mysql_error());
 if (mysql_result($result, 0, 0) > 0) {
     include "../assessment/catscores.php";
     $sp = explode(';', $line['bestscores']);
     catscores(explode(',', $line['questions']), explode(',', $sp[0]), $line['defpoints'], $line['defoutcome'], $cid);
 }
 $scores = array();
 $qs = explode(',', $line['questions']);
 $sp = explode(';', $line['bestscores']);
 foreach (explode(',', $sp[0]) as $k => $score) {
     $scores[$qs[$k]] = getpts($score);
 }
 echo "<h4>Question Breakdown</h4>\n";
Beispiel #25
0
                    mysql_query($query) or die("Query failed : {$query}" . mysql_error());
                    $query = "UPDATE {$table} SET postby=postby+{$shift} WHERE id='{$row[1]}' AND postby>0 AND postby<2000000000";
                    mysql_query($query) or die("Query failed : {$query}" . mysql_error());
                }
            }
        }
        //update Calendar items
        $query = "UPDATE imas_calitems SET date=date+{$shift} WHERE courseid='{$cid}'";
        mysql_query($query) or die("Query failed : {$query}" . mysql_error());
        header('Location: ' . $urlmode . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . "/course.php?cid={$cid}");
        exit;
    } else {
        //DEFAULT DATA MANIPULATION
        $curBreadcrumb = "{$breadcrumbbase} <a href=\"course.php?cid={$cid}\">{$coursename}</a>";
        $curBreadcrumb .= " &gt; Shift Course Dates ";
        $sdate = tzdate("m/d/Y", time());
        $query = "SELECT id,name from imas_assessments WHERE courseid='{$cid}'";
        $result = mysql_query($query) or die("Query failed : " . mysql_error());
        $i = 0;
        while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
            $page_assessmentList['val'][$i] = $line['id'];
            $page_assessmentList['label'][$i] = $line['name'];
            $i++;
        }
    }
}
/******* begin html output ********/
$placeinhead = "<script type=\"text/javascript\" src=\"{$imasroot}/javascript/DatePicker.js\"></script>";
require "../header.php";
if ($overwriteBody == 1) {
    echo $body;
Beispiel #26
0
     }
 }
 $result = mysql_query($query) or die("Query failed : " . mysql_error());
 if (mysql_num_rows($result) == 0) {
     echo "No results found";
 } else {
     while ($row = mysql_fetch_assoc($result)) {
         echo '<p><b>' . $row['LastName'] . ', ' . $row['FirstName'] . '</b></p>';
         echo '<form method="post" action="../admin/actions.php?action=resetpwd&id=' . $row['id'] . '">';
         echo '<ul><li>Username: <a href="../admin/admin.php?showcourses=' . $row['id'] . '">' . $row['SID'] . '</a></li>';
         echo '<li>ID: ' . $row['id'] . '</li>';
         if ($row['name'] != null) {
             echo '<li>Group: ' . $row['name'] . '</li>';
         }
         echo '<li>Email: ' . $row['email'] . '</li>';
         echo '<li>Last Login: '******'lastaccess']) . '</li>';
         echo '<li>Rights: ' . $row['rights'] . '</li>';
         echo '<li>Reset Password to <input type="text" name="newpw"/> <input type="submit" value="' . _('Go') . '"/></li>';
         $query = "SELECT ic.id,ic.name FROM imas_courses AS ic JOIN imas_students AS istu ON istu.courseid=ic.id AND istu.userid=" . $row['id'];
         $res2 = mysql_query($query) or die("Query failed : " . mysql_error());
         if (mysql_num_rows($res2) > 0) {
             echo '<li>Enrolled as student in: <ul>';
             while ($r = mysql_fetch_row($res2)) {
                 echo '<li><a target="_blank" href="../course/course.php?cid=' . $r[0] . '">' . $r[1] . ' (ID ' . $r[0] . ')</a></li>';
             }
             echo '</ul></li>';
         }
         $query = "SELECT ic.id,ic.name FROM imas_courses AS ic JOIN imas_tutors AS istu ON istu.courseid=ic.id AND istu.userid=" . $row['id'];
         $res2 = mysql_query($query) or die("Query failed : " . mysql_error());
         if (mysql_num_rows($res2) > 0) {
             echo '<li>Tutor in: <ul>';
Beispiel #27
0
                }
                echo "<tr><td>";
                if ($isteacher) {
                    echo '<span class="right">';
                    echo "<a href=\"../course/addforum.php?cid={$cid}&id={$line['id']}\">Modify</a> ";
                    echo '</span>';
                }
                echo "<b><a href=\"thread.php?cid={$cid}&forum={$line['id']}\">{$line['name']}</a></b> ";
                if ($newcnt[$line['id']] > 0) {
                    echo "<a href=\"thread.php?cid={$cid}&forum={$line['id']}&page=-1\" style=\"color:red\">New Posts ({$newcnt[$line['id']]})</a>";
                }
                echo "</td>\n";
                if (isset($threadcount[$line['id']])) {
                    $threads = $threadcount[$line['id']];
                    $posts = $postcount[$line['id']];
                    $lastpost = tzdate("F j, Y, g:i a", $maxdate[$line['id']]);
                } else {
                    $threads = 0;
                    $posts = 0;
                    $lastpost = '';
                }
                echo "<td class=c>{$threads}</td><td class=c>{$posts}</td><td class=c>{$lastpost}</td></tr>\n";
            }
            ?>
	</tbody>
	</table>
<?php 
        }
    }
}
require "../footer.php";
Beispiel #28
0
}
if (isset($teacherof[$line['courseid']])) {
    echo " <a href=\"mailto:{$line['email']}\">email</a> | ";
    echo " <a href=\"{$imasroot}/course/gradebook.php?cid={$line['courseid']}&stu={$line['msgfrom']}\" target=\"_popoutgradebook\">gradebook</a>";
    if (preg_match('/Question\\s+about\\s+#(\\d+)\\s+in\\s+(.*)\\s*$/', $line['title'], $matches)) {
        $aname = addslashes($matches[2]);
        $query = "SELECT id,enddate FROM imas_assessments WHERE name='{$aname}' AND courseid='{$line['courseid']}'";
        $res = mysql_query($query) or die("Query failed : {$query} " . mysql_error());
        if (mysql_num_rows($res) > 0) {
            list($aid, $due) = mysql_fetch_row($res);
            $query = "SELECT enddate FROM imas_exceptions WHERE userid='{$line['msgfrom']}' AND assessmentid='{$aid}'";
            $res = mysql_query($query) or die("Query failed : {$query} " . mysql_error());
            if (mysql_num_rows($res) > 0) {
                $due = mysql_result($res, 0, 0);
            }
            $duedate = tzdate('D m/d/Y g:i a', $due);
            $query = "SELECT id FROM imas_assessment_sessions WHERE assessmentid='{$aid}' AND userid='{$line['msgfrom']}'";
            $res = mysql_query($query) or die("Query failed : {$query} " . mysql_error());
            if (mysql_num_rows($res) > 0) {
                $asid = mysql_result($res, 0, 0);
                echo " | <a href=\"{$imasroot}/course/gb-viewasid.php?cid={$line['courseid']}&uid={$line['msgfrom']}&asid={$asid}\" target=\"_popoutgradebook\">assignment</a>";
                if ($due < 2000000000) {
                    echo ' <span class="small">Due ' . $duedate . '</span>';
                }
            }
        }
    }
}
echo "</td></tr><tr><td><b>Sent:</b></td><td>{$senddate}</td></tr>";
echo "<tr><td><b>Subject:</b></td><td>{$line['title']}</td></tr>";
echo "</tbody></table>";
Beispiel #29
0
             $query .= "imas_wiki_revisions as i_w_r JOIN imas_users as i_u ON i_u.id=i_w_r.userid ";
             $query .= "WHERE i_w_r.wikiid='{$id}' AND i_w_r.stugroupid='{$groupid}' ORDER BY i_w_r.id DESC";
             $result = mysql_query($query) or die("Query failed : " . mysql_error());
             $numrevisions = mysql_num_rows($result);
             if ($numrevisions == 0) {
                 $text = '';
             } else {
                 $row = mysql_fetch_row($result);
                 $text = $row[1];
                 if (strlen($text) > 6 && substr($text, 0, 6) == '**wver') {
                     $wikiver = substr($text, 6, strpos($text, '**', 6) - 6);
                     $text = substr($text, strpos($text, '**', 6) + 2);
                 } else {
                     $wikiver = 1;
                 }
                 $lastedittime = tzdate("F j, Y, g:i a", $row[2]);
                 $lasteditedby = $row[3] . ', ' . $row[4];
             }
             if (isset($studentid)) {
                 $rec = "data-base=\"wikiintext-{$id}\" ";
                 $text = str_replace('<a ', '<a ' . $rec, $text);
             }
             $query = "UPDATE imas_wiki_views SET lastview={$now} WHERE userid='{$userid}' AND wikiid='{$id}' AND stugroupid='{$groupid}'";
             mysql_query($query) or die("Query failed : " . mysql_error());
             if (mysql_affected_rows() == 0) {
                 $query = "INSERT INTO imas_wiki_views (userid,wikiid,stugroupid,lastview) VALUES ('{$userid}','{$id}',{$groupid},{$now})";
                 mysql_query($query) or die("Query failed : " . mysql_error());
             }
         }
     }
 }
Beispiel #30
0
 } else {
     $edate = tzdate("m/d/Y", time() + 7 * 24 * 60 * 60);
     $etime = $deftime;
     //tzdate("g:i a",time()+7*24*60*60);
 }
 if ($line['reviewdate'] > 0) {
     if ($line['reviewdate'] == '2000000000') {
         $rdate = tzdate("m/d/Y", $line['enddate'] + 7 * 24 * 60 * 60);
         $rtime = $deftime;
         //tzdate("g:i a",$line['enddate']+7*24*60*60);
     } else {
         $rdate = tzdate("m/d/Y", $line['reviewdate']);
         $rtime = tzdate("g:i a", $line['reviewdate']);
     }
 } else {
     $rdate = tzdate("m/d/Y", $line['enddate'] + 7 * 24 * 60 * 60);
     $rtime = $deftime;
     //tzdate("g:i a",$line['enddate']+7*24*60*60);
 }
 if (!isset($_GET['id'])) {
     $stime = $defstime;
     $etime = $deftime;
     $rtime = $deftime;
 }
 if ($line['defpenalty'][0] === 'L') {
     $line['defpenalty'] = substr($line['defpenalty'], 1);
     $skippenalty = 10;
 } else {
     if ($line['defpenalty'][0] === 'S') {
         $skippenalty = $line['defpenalty'][1];
         $line['defpenalty'] = substr($line['defpenalty'], 2);