Skip to content

Commit

Permalink
Lots of updates to fix notices (mostly missing isset s)
Browse files Browse the repository at this point in the history
Add wrapper and header divs to header/footer to support more advanced themes 
Add option to set $defaultcoursetheme and $loginpage in config.php

git-svn-id: http://imathas.googlecode.com/svn/trunk@488 c89b4f0b-ac2a-0410-9773-c9071ee4f95d
  • Loading branch information
drlippman committed Dec 28, 2009
1 parent aa40ff1 commit 6afe2fb
Show file tree
Hide file tree
Showing 22 changed files with 121 additions and 64 deletions.
6 changes: 3 additions & 3 deletions admin/forms.php
Expand Up @@ -139,7 +139,7 @@
$topbar = array(array(),array());
$avail = 0;
$lockaid = 0;
$theme = "default.css";
$theme = $defaultcoursetheme;
$ltisecret = "";
$chatset = 0;
$showlatepass = 0;
Expand Down Expand Up @@ -253,9 +253,9 @@
if ($copyrights==0) { echo "checked=1";}
echo '/> Require enrollment key from everyone<br/> <input type=radio name="copyrights" value="1" ';
if ($copyrights==1) { echo "checked=1";}
echo '/>No key required for group members, require key from others <br/><input type=radio name="copyrights" value="2" ';
echo '/> No key required for group members, require key from others <br/><input type=radio name="copyrights" value="2" ';
if ($copyrights==2) { echo "checked=1";}
echo '/>No key required from anyone</span><br class=form />';
echo '/> No key required from anyone</span><br class=form />';

echo "<span class=form>Message System:</span><span class=formright>";
//0 on, 1 to instr, 2 to stu, 3 nosend, 4 off
Expand Down
8 changes: 4 additions & 4 deletions assessment/displayq2.php
Expand Up @@ -577,11 +577,11 @@ function makeanswerbox($anstype, $qn, $la, $options,$multi) {
if ($displayformat == "horiz") {
$out .= "<div class=choice>{$questions[$randkeys[$i]]}<br/>";
$out .= "<input type=checkbox name=\"qn$qn"."[$i]\" value=$i ";
if (($labits[$i]!='') && ($labits[$i] == $i)) { $out .= "CHECKED";}
if (isset($labits[$i]) && ($labits[$i]!='') && ($labits[$i] == $i)) { $out .= "CHECKED";}
$out .= " /></div> \n";
} else if ($displayformat == "inline") {
$out .= "<input type=checkbox name=\"qn$qn"."[$i]\" value=$i ";
if (($labits[$i]!='') && ($labits[$i] == $i)) { $out .= "CHECKED";}
if (isset($labits[$i]) && ($labits[$i]!='') && ($labits[$i] == $i)) { $out .= "CHECKED";}
$out .= " />{$questions[$randkeys[$i]]} ";
} else if ($displayformat == 'column') {
if ($i%$itempercol==0) {
Expand All @@ -591,11 +591,11 @@ function makeanswerbox($anstype, $qn, $la, $options,$multi) {
$out .= '<div class="match"><ul class=nomark>';
}
$out .= "<li><input type=checkbox name=\"qn$qn"."[$i]\" value=$i ";
if (($labits[$i]!='') && ($labits[$i] == $i)) { $out .= "CHECKED";}
if (isset($labits[$i]) && ($labits[$i]!='') && ($labits[$i] == $i)) { $out .= "CHECKED";}
$out .= " />{$questions[$randkeys[$i]]}</li> \n";
} else {
$out .= "<li><input type=checkbox name=\"qn$qn"."[$i]\" value=$i ";
if (($labits[$i]!='') && ($labits[$i] == $i)) { $out .= "CHECKED";}
if (isset($labits[$i]) && ($labits[$i]!='') && ($labits[$i] == $i)) { $out .= "CHECKED";}
$out .= " />{$questions[$randkeys[$i]]}</li> \n";
}
}
Expand Down
7 changes: 6 additions & 1 deletion assessment/header.php
Expand Up @@ -25,7 +25,12 @@ function init() {
<?php
echo "<script type=\"text/javascript\" src=\"$imasroot/javascript/general.js?ver=120209\"></script>\n";
if (isset($sessiondata['coursetheme'])) {
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$imasroot/themes/{$sessiondata['coursetheme']}\"/>\n";
if (isset($flexwidth)) {
$coursetheme = str_replace('_fw','',$sessiondata['coursetheme']);
} else {
$coursetheme = $sessiondata['coursetheme'];
}
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$imasroot/themes/$coursetheme\"/>\n";
}
if ($isdiag) {
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$imasroot/diag/print.css\" media=\"print\"/>\n";
Expand Down
12 changes: 9 additions & 3 deletions assessment/interpret5.php
Expand Up @@ -524,17 +524,23 @@ function tokenize($str,$anstype) {
//end of line
$intype = 7;
$i++;
$c = $str{$i};
if ($i<$len) {
$c = $str{$i};
}
} else if ($c==';') {
//end of line
$intype = 7;
$i++;
$c = $str{$i};
if ($i<$len) {
$c = $str{$i};
}
} else {
//no type - just append string. Could be operators
$out .= $c;
$i++;
$c = $str{$i};
if ($i<$len) {
$c = $str{$i};
}
}
while ($c==' ') { //eat up extra whitespace
$i++;
Expand Down
2 changes: 2 additions & 0 deletions assessment/libs/libhelp.php
@@ -1,5 +1,7 @@
<?php
require("../../validate.php");
$nologo = true;
$flexwidth = true;
require("../../header.php");

echo "<h1>Installed Macro Libraries</h1>\n";
Expand Down
30 changes: 15 additions & 15 deletions assessment/macros.php
Expand Up @@ -42,7 +42,7 @@ function showplot($funcs) { //optional arguments: $xmin,$xmax,$ymin,$ymax,label
$ymin = $settings[2];
$ymax = $settings[3];
$yminauto = false;
$yminauto = false;
$ymaxauto = false;
if (substr($ymin,0,4)=='auto') {
$yminauto = true;
if (strpos($ymin,':')!==false) {
Expand Down Expand Up @@ -122,19 +122,19 @@ function showplot($funcs) { //optional arguments: $xmin,$xmax,$ymin,$ymax,label


$path = '';
if ($function[1]!='') {
if (isset($function[1]) && $function[1]!='') {
$path .= "stroke=\"{$function[1]}\";";
$alt .= ", Color {$function[1]}";
} else {
$path .= "stroke=\"black\";";
$alt .= ", Color black";
}
if ($function[6]!='') {
if (isset($function[6]) && $function[6]!='') {
$path .= "strokewidth=\"{$function[6]}\";";
} else {
$path .= "strokewidth=\"1\";";
}
if ($function[7]!='') {
if (isset($function[7]) && $function[7]!='') {
if ($function[7]=="dash") {
$path .= "strokedasharray=\"5\";";
$alt .= ", Dashed";
Expand All @@ -146,17 +146,17 @@ function showplot($funcs) { //optional arguments: $xmin,$xmax,$ymin,$ymax,label
}

$avoid = array();
if ($function[2]!='') {$xmin = $function[2];} else {$xmin = $settings[0];}
if ($function[3]!='') {
$domainlimited = false;
if (isset($function[2]) && $function[2]!='') {
$xmin = $function[2];
$domainlimited = true;
} else {$xmin = $settings[0];}
if (isset($function[3]) && $function[3]!='') {
$xmaxarr = explode('!',$function[3]);
$xmax = $xmaxarr[0];
$avoid = array_slice($xmaxarr,1);
} else {$xmax = $settings[1];}
if ($function[2]!='' || $function[3]!='') {
$domainlimited = true;
} else {
$domainlimited = false;
}
} else {$xmax = $settings[1];}

if ($GLOBALS['sessiondata']['graphdisp']==0) {
$dx = 1;
Expand Down Expand Up @@ -247,14 +247,14 @@ function showplot($funcs) { //optional arguments: $xmin,$xmax,$ymin,$ymax,label
}
if ($lastl > 0) {$path .= "]);";}
$alt .= "</tbody></table>\n";
if ($function[5]=='open') {
if (isset($function[5]) && $function[5]=='open') {
$path .= "dot([$x,$y],\"open\");";
$alt .= "Open dot at $x,$y";
} else if ($function[5]=='closed') {
} else if (isset($function[5]) && $function[5]=='closed') {
$path .= "dot([$x,$y],\"closed\");";
$alt .= "Closed dot at $x,$y";
}
if ($function[4]=='open') {
if (isset($function[4]) && $function[4]=='open') {
if ($isparametric) {
$t = $xmin;
$x = round(eval("return ($xfunc);"),3);
Expand All @@ -270,7 +270,7 @@ function showplot($funcs) { //optional arguments: $xmin,$xmax,$ymin,$ymax,label
$absymax = $y;
}
$alt .= "Open dot at $x,$y";
} else if ($function[4]=='closed') {
} else if (isset($function[4]) && $function[4]=='closed') {
if ($isparametric) {
$t = $xmin;
$x = round(eval("return ($xfunc);"),3);
Expand Down
16 changes: 12 additions & 4 deletions assessment/mathphp2.php
Expand Up @@ -186,10 +186,12 @@ function mathphptokenize($str,$vars,$ignorestrings) {
$maxvarlen = $l;
}
}
$connecttolast = 0;
$i=0;
$cnt = 0;
$len = strlen($str);
$syms = array();
$lastsym = array();
while ($i<$len) {
$cnt++;
if ($cnt>100) {
Expand Down Expand Up @@ -327,7 +329,7 @@ function mathphptokenize($str,$vars,$ignorestrings) {
$intype = 3; //number
$cont = true;
//handle . 3 which needs to act as concat
if ($lastsym[0]=='.') {
if (isset($lastsym[0]) && $lastsym[0]=='.') {
$syms[count($syms)-1][0] .= ' ';
}
do {
Expand Down Expand Up @@ -447,17 +449,23 @@ function mathphptokenize($str,$vars,$ignorestrings) {
//end of line
$intype = 7;
$i++;
$c = $str{$i};
if ($i<$len) {
$c = $str{$i};
}
} else if ($c==';') {
//end of line
$intype = 7;
$i++;
$c = $str{$i};
if ($i<$len) {
$c = $str{$i};
}
} else {
//no type - just append string. Could be operators
$out .= $c;
$i++;
$c = $str{$i};
if ($i<$len) {
$c = $str{$i};
}
}
while ($c==' ') { //eat up extra whitespace
$i++;
Expand Down
3 changes: 3 additions & 0 deletions assessment/print.css
Expand Up @@ -27,3 +27,6 @@ div.question {
div.nobreak {
page-break-inside:avoid;
}
.headerwrapper {
height: 0px;
}
1 change: 1 addition & 0 deletions assessment/printtest.php
Expand Up @@ -7,6 +7,7 @@
}

include("displayq2.php");
$flexwidth = true; //tells header to use non _fw stylesheet
require("header.php");
echo "<style type=\"text/css\" media=\"print\">p.tips { display: none;}\n input.btn {display: none;}\n textarea {display: none;}\n input.sabtn {display: none;}</style>\n";
echo "<style type=\"text/css\">p.tips { display: none;}\n </style>\n";
Expand Down
11 changes: 6 additions & 5 deletions assessment/showtest.php
Expand Up @@ -14,6 +14,7 @@
exit;
}
$actas = false;
$isreview = false;
if (isset($teacherid) && isset($_GET['actas'])) {
$userid = $_GET['actas'];
unset($teacherid);
Expand Down Expand Up @@ -665,7 +666,7 @@
//if was added to existing group, need to reload $questions, etc

echo "<h2>{$testsettings['name']}</h2>\n";
if ($sessiondata['actas']) {
if (isset($sessiondata['actas'])) {
echo '<p style="color: red;">Teacher Acting as ';
$query = "SELECT LastName, FirstName FROM imas_users WHERE id='{$sessiondata['actas']}'";
$result = mysql_query($query) or die("Query failed : $query:" . mysql_error());
Expand Down Expand Up @@ -766,11 +767,11 @@
} else {
echo "<div class=right>No time limit</div>\n";
}
if ($_GET['action']=="skip" || $_GET['action']=="seq") {
echo "<div class=right><span onclick=\"document.getElementById('intro').className='intro';\"><a href=\"#\">Show Instructions</a></span></div>\n";
}

if (isset($_GET['action'])) {

if ($_GET['action']=="skip" || $_GET['action']=="seq") {
echo "<div class=right><span onclick=\"document.getElementById('intro').className='intro';\"><a href=\"#\">Show Instructions</a></span></div>\n";
}
if ($_GET['action']=="scoreall") {
//score test
for ($i=0; $i < count($questions); $i++) {
Expand Down
4 changes: 2 additions & 2 deletions course/addquestions.php
Expand Up @@ -686,7 +686,7 @@
echo 'How do I find questions to add?</a>';
echo '<div id="helpwithadding" style="display:none">';
if ($sessiondata['selfrom'.$aid]=='lib') {
echo "<p>You are current set to select questions from the question libraries. If you would like to select questions from ";
echo "<p>You are currently set to select questions from the question libraries. If you would like to select questions from ";
echo "assessments you've already created, click the <b>Select From Assessments</b> button below</p>";
echo "<p>To find questions to add from the question libraries:";
echo "<ol><li>Click the <b>Select Libraries</b> button below to pop open the library selector</li>";
Expand All @@ -695,7 +695,7 @@
echo " <li>On this page, click the <b>Search</b> button to list the questions in the libraries selected.<br/> You can limit the listing by entering a sepecific search term in the box provided first, or leave it blank to view all questions in the chosen libraries</li>";
echo "</ol>";
} else if ($sessiondata['selfrom'.$aid]=='assm') {
echo "<p>You are current set to select questions existing assessments. If you would like to select questions from ";
echo "<p>You are currently set to select questions existing assessments. If you would like to select questions from ";
echo "the question libraries, click the <b>Select From Libraries</b> button below</p>";
echo "<p>To find questions to add from existing assessments:";
echo "<ol><li>Use the checkboxes to select the assessments you want to pull questions from</li>";
Expand Down
2 changes: 1 addition & 1 deletion course/course.php
Expand Up @@ -132,7 +132,7 @@
$_GET['folder'] = '0';
$sessiondata['folder'.$cid] = '0';
writesessiondata();
} else if ((isset($_GET['folder']) && $_GET['folder']!='') && $sessiondata['folder'.$cid]!=$_GET['folder']) {
} else if ((isset($_GET['folder']) && $_GET['folder']!='') && (!isset($sessiondata['folder'.$cid]) || $sessiondata['folder'.$cid]!=$_GET['folder'])) {
$sessiondata['folder'.$cid] = $_GET['folder'];
writesessiondata();
} else if ((!isset($_GET['folder']) || $_GET['folder']=='') && isset($sessiondata['folder'.$cid])) {
Expand Down
2 changes: 1 addition & 1 deletion course/courseshowitems.php
Expand Up @@ -207,7 +207,7 @@ function showitems($items,$parent,$inpublic=false) {
echo "<div class=hidden ";
}
$style = '';
if ($items[$i]['fixedheight']>0) {
if (isset($items[$i]['fixedheight']) && $items[$i]['fixedheight']>0) {
if (strpos($_SERVER['HTTP_USER_AGENT'],'MSIE 6')!==false) {
$style .= 'overflow: auto; height: expression( this.offsetHeight > '.$items[$i]['fixedheight'].' ? \''.$items[$i]['fixedheight'].'px\' : \'auto\' );';
} else {
Expand Down
1 change: 1 addition & 0 deletions course/testquestion.php
Expand Up @@ -90,6 +90,7 @@

/******* begin html output ********/
$sessiondata['coursetheme'] = $coursetheme;
$flexwidth = true; //tells header to use non _fw stylesheet
require("../assessment/header.php");

if ($overwriteBody==1) {
Expand Down
4 changes: 2 additions & 2 deletions filter/filter.php
Expand Up @@ -6,11 +6,11 @@
//load in filters as needed
$filterdir = rtrim(dirname(__FILE__), '/\\');
//include("$filterdir/simplelti/simplelti.php");
if ($sessiondata['mathdisp']==2) { //use image fallback for math
if (isset($sessiondata['mathdisp']) && $sessiondata['mathdisp']==2) { //use image fallback for math
include("$filterdir/math/ASCIIMath2TeX.php");
$AMT = new AMtoTeX;
}
if ($sessiondata['graphdisp']==2 || isset($loadgraphfilter)) { //use image fallback for graphs
if (isset($sessiondata['graphdisp']) && $sessiondata['graphdisp']==2 || isset($loadgraphfilter)) { //use image fallback for graphs
include("$filterdir/graph/asciisvgimg.php");
$AS = new AStoIMG;
}
Expand Down
2 changes: 1 addition & 1 deletion filter/math/ASCIIMath2TeX.php
Expand Up @@ -316,7 +316,7 @@ function AMnewcommand($oldstr,$newstr) {
}

function AMremoveCharsAndBlanks($str,$n) {
if (strlen($str)>1 && $str{$n}=='\\' && $str{$n+1}!= '\\' && $str{$n+1}!=' ') {
if (strlen($str)>$n+1 && $str{$n}=='\\' && $str{$n+1}!= '\\' && $str{$n+1}!=' ') {
$st = substr($str, $n+1);
} else {
$st = substr($str,$n);
Expand Down

0 comments on commit 6afe2fb

Please sign in to comment.