<?php require('config.php'); require('SRC/macros.php');
list ($home,$url,$users,$assign,$msg,$host,$sql,$MYCookie,$applet,$os)=courseAll();
$user_nbr=getaUserNbr($$MYCookie);
list ($user_name,$user_home,$user_url,$user_profile)=userid($user_nbr);

if ($user_nbr>99) {	                        # Registered user
  $db = SQLconnect($host,$sql);
  $cmd = "SELECT user_passed,admin_payed FROM users WHERE user_nbr=$user_nbr;";
  $users=SQLquery($db,$cmd);
  $user=SQLobject($users,0);
  SQLclose($db);
}
myheader('Download service','..',$myPermit);
?>

It is not necessary and not even useful to download the source files if you 
want to perform assignments and execute them in our web-browser; for that, 
you better 
<a href=register.php onMouseover="window.status=' # register'; return true"
>register</A> for an individual account on-line.
The download material here is intended for individuals who want to study 
without keeping the Internet connection active, or registered students who 
want to print their own solutions on paper and users who want to download 
the APPLET source code to compile it independently on their own computer.
You need to 
<a href=../login.php onMouseover="window.status=' # login'; return true"
>login</a> to be given access to some of the documents.


<h4>Syllabus (for registered users, to study off-line)</h4>
<?php if ($user_nbr>99) { 
  echo "<form action=fetch.php method=post> \n".
       "  <SELECT NAME=selectSyllabus>\n".
       "  <OPTION SELECTED>printed syllabus (Acrobat PDF)\n".
       "  <OPTION>java-powered syllabus (Windows zip)\n";
  if (strstr($user->admin_payed,'paid') || 
      strstr($user->user_passed,'Teacher'))
    echo "  <OPTION>complete CD-ROM + videos (Windows zip)\n";
  echo "</SELECT>\n".
       "<input type=submit value=Select>\n</form>\n";
} ?>

If you work from home and you want to access the material quickly without 
being connected to the Internet, you can download a compressed version of 
the java-powered syllabus (3.7 Mbytes) and perhaps even install a complete 
CD-ROM version including low resolution videos (97 MBytes).

<h4>Solutions / course certificate (for registered / qualifying users)</h4>
<?php 
if ($user_nbr>99) { 
  echo "<form action=print.php method=post>\n".
       "<SELECT NAME=action>\n".
       "    <OPTION SELECTED>solutions compile\n".
       "    <OPTION>solutions (TeX source)\n".
       "    <OPTION>solutions (Acrobat PDF)\n".
       "    <OPTION>solutions (Postscript)\n".
       "    <OPTION>solutions (UNIX tex.gz)\n".
       "    <OPTION>solutions (UNIX ps.gz)\n";
  if (strstr($user->user_passed,'passed') ||
      strstr($user->user_passed,'Teacher')) { 
    echo "    <OPTION>certificate (Acrobat PDF)\n".
         "    <OPTION>certificate (Postscript)\n".
         "    <OPTION>certificate (UNIX ps.gz)\n";
  }
  echo "</SELECT>\n".
       "<input type=submit value=Select>\n".
       "</form>\n";

#      "    <OPTION>solutions (Acrobat PDF)\n".

} ?>

Registered users may <i>compile</i> their own solutions into an electric 
document ready to be sent to a printer. Best is to choose the <i>pdf</i> 
or compressed <i>gz</i> format, but a TeX source is also provided if your 
own errors prevent the compiler to complete the work - allowing you finish 
the work on your own computer.


<h4>Applet source codes (for qualifying users)</h4>
Here you are given the possibility to download the source code of the 
VMARKET and MKTSolution applets with your own inserts directly included 
in the version that was available at the time of registration.
To qualify for this download service, local students must fullfill all 
the course requirements to <i>pass</i> and distance-learning student 
must <i>pay</i> their tuition fee.

<?php 
if ($user_nbr>99 && ( strstr($user->user_passed,'passed') || 
                      strstr($user->admin_payed,'paid')  || 
                      strstr($user->user_passed,'Teacher') || 
                      strstr($user->user_passed,'Assistant') ) ) { 
  echo "
   Your profile entitles you to download the source code of the
   VMARKET applet.
   <form action=fetch.php method=post>
   <SELECT NAME=selectApplet>
       <OPTION>Latest VMARKET (java listing)
       <OPTION>Latest VMARKET (UNIX make tar.gz)
       <OPTION>Latest MKTSolution (java listing)
       <OPTION>Latest MKTSolution (UNIX make tar.gz)
       <OPTION>Your project VMARKET (UNIX make tar.gz)
       <OPTION>Your project VMARKET (java listing)
   </SELECT>
   <input type=submit value=Select><br>
   <input type=checkbox name=publish checked value=t>
   We may publish your registration as a 
   <a href=users.php onMouseover=\"window.status=' # users'; return true\"
   >downloader of this course</a> (your email will not be exposed)<br>
   <input type=checkbox name=announcements checked value=t>
      Please keep me informed about new releases.
   </form>\n";
} else if ($user_nbr>99) {
  echo "Your profile does not presently allow you to download the source ".
       "source code. ";
} else {
  echo "You need to login to be given access to this service.";
}
myfooter($user_nbr,'..',$myPermit);
?>
