Location: PHPKode > projects > Whiteboard > whiteboard1.0.3/program/restricted/index.php
<?php
/* Whiteboard Courseware System v1.0.3
   Copyright (C) 2002-2003 Todd Templeton

   This program is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by the Free
   Software Foundation; either version 2 of the License, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful, but WITHOUT
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
   more details.

   You should have received a copy of the GNU General Public License along with
   this program; if not, write to the Free Software Foundation, Inc., 59 Temple
   Place, Suite 330, Boston, MA 02111-1307 USA

   Contact info: my paper address changes often, but you can contact me at
   hide@address.com
*/


define ("MODULE", "affiliatedcourses");
define ("PATHTOHTTPROOT", "../");

unset ($course);
unset ($page);

require (PATHTOHTTPROOT . "include/include.php");
require (PATHTOHTTPROOT . "include/coursesinclude.php");


/*logout*/
if (!isemptystring ($netid) && isset ($action) && ($action == "logout")) {
  session_unset ();
  $sessionname = session_name ();
  session_destroy ();
  setcookie ($sessionname, "", 0, "/");
  $netid = "";
  $priv['isadmin'] = false;
  $priv['isstaff'] = false;
  $priv['isstudent'] = false;
  $priv['isnonstudent'] = false;
  $priv['iscourseaffiliated'] = false;
  $priv['isvisitor'] = true;
}
$options = getdefaults ($courseconfigoptions);
if (isemptystring ($netid))
  loginpage (courselink ("userhome.php", false));
$departments = getdepartments ();
$semesters = getsemesters ();
/*print affiliated courses*/
if (is_array ($departments) && (count ($departments) > 0)) {
  if (is_array ($semesters) && (count ($semesters) > 0)) {
    reset ($semesters);
    while ($elementinfo = each ($semesters)) {
      $semester = $elementinfo['key'];
      reset ($departments);
      while ($elementinfo2 = each ($departments)) {
        $departmentid = $elementinfo2['key'];
        $courses = getcourses ($semester, $departmentid);
        if (is_array ($courses)) {
	  for ($i = 0; $i < count ($courses); $i++) {
	    $isaffiliated = false;
	    $fullcourse = $departmentid . $courses[$i]['course'];
	    if (isstudent ($netid, $fullcourse, $semester))
	      $isaffiliated = true;
	    else if (isstaff ($netid, $fullcourse, $semester))
	      $isaffiliated = true;
	    if ($isaffiliated) {
	      $courseinfo = getcourseinfo ($departmentid, $courses[$i]['course'], $semester);
	      if (!is_bool ($courseinfo)) {
	        $courseinfo['department'] = $departmentid;
	        $affiliated[$semester][] = $courseinfo;
	      }
	    }
	  }
	}
      }
    }
  }
}
$page['browsertitle'] = "Affiliated Courses";
$page['title'] = "Affiliated Courses";
courselisting ($affiliated, false);
printpage ($page);
?>
Return current item: Whiteboard