<?php 
	 

	$utils = new Utils;
	
	$db = new EO_DB;
	$db1 = new EO_DB;
	$cq = new ClassQuest;

	// Set this page to the Section title for the left navigation bar
	$thispagebookmark = "classquestlesson";
	$expedition = new Expedition;


	$euser = new EUser;
	$username = $euser->getUserName();
	if (!$pageno)
	{
		$pageno = 1;
	}

	if ($expcatid <= 0)
		unset($expcatid);

	
	if ($doSearch == 9 && $txtsearch)
	{
		$cq = new ClassQuest;
		$iexps = $cq->getLessonsByCat($expcatid,$pageno,$txtsearch);
	}
	else
	if ($expcatid)
	{
		$iexps = $cq->getLessonsByCat($expcatid,$pageno);
	}
?>
<html>
<head>
<title>Expedition Quest - Lesson Plans</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT LANGUAGE="JavaScript" src="/ell/functions.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" >
	function open_addwin()
	{
		open("/classroom/addlessons.ell","addlessons","width=600,height=500,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=1");
	}
</SCRIPT>
</head>

<body bgcolor="#FFFFFF" leftmargin=0 topmargin=0>
<table width="<?=$t1_width?>" border="0" cellspacing="0" cellpadding="0">
  <?php
	$UI=new UserInterface;
	$UI->DisplayHeader();
	$UI->DisplayTab($thispagebookmark);
  ?>  <tr valign="top"> 
    <td height="2"> 
      <table width="<?=$t2_width?>" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <?php include "ell/left_navigation_bar.inc"; ?>
          <td width="<?=$t3_width?>" valign="top"> 
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td rowspan="7" width="3%"><img src="/images/dot.GIF" width="20" height="1"></td>
                <td colspan="2" height="6"> <?php include "ell/welcome_banner.ell"; ?> 
                </td>
              </tr>
              <tr> 
                <td colspan="2">&nbsp;</td>
              </tr>
              <tr> 
                <td colspan="2"><font face="Verdana, Arial, Helvetica, sans-serif" size="1">Expedition 
                  Research enables educators to make a direct connection between 
                  a lesson plan and what scientists and explorers are doing right 
                  now in the field. Use this to inspire, motivate, and stimulate 
                  your students.</font></td>
              </tr>
              <tr> 
                <td colspan="2">&nbsp;</td>
              </tr>
              <tr> 
                <td valign="top" height="23">
                  <table width="280" border="0" cellspacing="0" cellpadding="0" height="70">
                    <tr> 
                      <td width="52%" bgcolor="1E55DF" height="9"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#FFFFFF">&nbsp;<b>Search 
                        Lesson Plans</b></font></td>
                      <td width="48%" valign="bottom" height="9"><img src="/images/sub_tab_right.gif"></td>
                    </tr>
                    <tr bgcolor="#666666"> 
                      <td colspan="2" height="1"><img src="/images/dot.GIF" width="1" height="1"></td>
                    </tr>
                    <tr align="left" bgcolor="#EFEFEF"> 
                      <td colspan="2" height="10"><img src="../images/dot.GIF" width="1" height="1"></td>
                    </tr>
                    <tr align="left" bgcolor="#EFEFEF"> 
                      <form action="lessonplan.ell" method="POST">
                        <td colspan="2" height="30"><font face="Arial, Helvetica, sans-serif" size="2">&nbsp;<font face="Verdana, Arial, Helvetica, sans-serif" size="1">Keywords 
                          : 
                          <input type="text" name="txtsearch" size="15">
                          <input type="image" border="0" name="imageField" src="../images/search_button.gif">
                          <input type="hidden" name="doSearch" value="9">
                          </font> </font> 
                        </td>
                        <input type="hidden" name="doSearch2" value="9">
                      </form>
                    </tr>
                    <tr align="left" bgcolor="#EFEFEF"> 
                      <td colspan="2" height="10"><img src="../images/dot.GIF" width="1" height="1"></td>
                    </tr>
                  </table>
                </td>
                <td valign="top" height="23"> 
                  <table width="265" border="0" cellspacing="0" cellpadding="0" height="70">
                    <tr> 
                      <td width="44%" bgcolor="1E55DF" height="10"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#FFFFFF">&nbsp;<b>Add 
                        Lesson Plan </b></font></td>
                      <td valign="bottom" height="10"><img src="/images/sub_tab_right.gif"></td>
                    </tr>
                    <tr bgcolor="#666666"> 
                      <td colspan="2" height="1"><img src="/images/dot.GIF" width="1" height="1"></td>
                    </tr>
                    <tr align="left" bgcolor="#EFEFEF"> 
                      <td colspan="2" height="10"><img src="../images/dot.GIF" width="1" height="1"></td>
                    </tr>
                    <tr align="left" bgcolor="#EFEFEF"> 
                       <td colspan="2" height="33"> 
                          <div align="left"><font size="2" face="Arial, Helvetica,sans-serif"> 
                          <font size="1" face="Verdana, Arial, Helvetica, sans-serif">&nbsp;To 
                          add a new Lesson Plan, click <a href="javascript:open_addwin()">here</a></font></font></div>
                        </td>
                    </tr>
                    <tr align="left" bgcolor="#EFEFEF"> 
                      <td colspan="2" height="10"><img src="../images/dot.GIF" width="1" height="1"></td>
                    </tr>
                  </table>
                </td>
              </tr>
              <tr> 
                <td colspan="2">&nbsp;</td>
              </tr>
              <?php
	        if ($expcatid >0)
	      	  $pagingtext = $cq->doLessonsPagenums($expcatid,$pageno,$txtsearch);
	      ?> 
              <tr> 
                <td width="80%" valign="top" height="2" colspan="2"> 
                  <table width="570" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td colspan="3" height="20"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><a href="index.ell"><font color="#0000CC">ClassQuest</font></a> 
                        &gt; <a href="lessonplan.ell"><font color="#0000CC">Lesson 
                        Plans</font></a> <?php
				if($expcatid)
					print " &gt;<font color=\"#666666\"> <b> ".$expedition->getExpeditionCategoryName($expcatid);
			?> </font></td>
                    </tr>
                    <tr bgcolor="#99CCFF"> 
                      <td colspan="2" height="15"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">&nbsp;<b> 
                        Lesson Plans <?php
			if ($expcatid)
				print " in ".$expedition->getExpeditionCategoryName($expcatid);
			?> </b></font></td>
                      <td width="45%" valign="bottom" height="10" align="right"> 
                        <font face="Arial, Helvetica, sans-serif" size="2" color="#000000"> 
                        <?php
				if($pagingtext !="-1")
				{
					echo $pagingtext;
				}
			?> </font> </td>
                    </tr>
                    <tr valign="top"> 
                      <td colspan="3" height="7"><img src="/images/dot.GIF" width="1" height="1"></td>
                    </tr>
                    <?php
		    if (!$expcatid && !$txtsearch)
		     {
		    ?> 
                    <tr valign="top"> 
                      <td colspan="3" height="2"> 
<?php
							$Set_URL = "./lessonplan.ell?expcatid=";
							/* Browse by Category */
							include("ed/exp_category_list.ell");
					  ?> 		      		      
</td>
                    </tr>
                    <?php
		    }
		    ?> 
                    <tr valign="top"> 
                      <td colspan="3" height="9"> 
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                          <?php 
			  if ($expcatid || ($doSearch == 9 && $txtsearch))
			  {
				  print "<tr><td colspan=\"3\"><font face=\"Arial,Verdana,Helvetica\" size=2>";
				  if ($doSearch == 9 && $txtsearch)
				  {
					print "Search results for '<b>".$txtsearch."</b>'";
				  }
				  else
				  {
			        print "Click on a lesson plan title to download it.";
				  }
				  print "</font></td></tr><tr><td>&nbsp;</td></tr>";
			 ?> <?php
				for ($i = 0;$i < count($iexps);$i++)
				{
			  ?> 
                          <tr> 
                            <td colspan="2" height="25"> 
                              <div align="center"><img src="../images/a2.gif" width="11" height="11"></div>
                            </td>
                            <td width="96%" height="25"><font size="2" face="Arial, Helvetica, sans-serif"> 
                              <?php
			        echo "<a href=\"/classroom/send2user.ell?fn=".$DOCUMENT_ROOT.$upldir.$upllessonplans."/".$iexps[$i]["filename"]."&mt=".$iexps[$i]["mimetype"]."\"><b>".$iexps[$i]["title"]."</b></a>";
			      ?> &nbsp;&nbsp;( <?php 
					echo "Uploaded by: <b>".$euser->getFirstName($iexps[$i]["username"])." ".$euser->getLastName($iexps[$i]["username"])."</b>";
					echo ", Institution : <b>".$iexps[$i]["inst"]."</b>";
			      ?> ) </font></td>
                          </tr>
                          <tr> 
                            <td colspan="2" height="25"><font size="2" face="Arial, Helvetica, sans-serif"> 
                              </font></td>
                            <td width="96%" height="25"><font size="2" face="Arial, Helvetica, sans-serif"> 
                              <?php 
				echo $utils->putbreaks($iexps[$i]["desc"],80);
			      ?> </font></td>
                          </tr>
                          <tr> 
                            <td colspan="3" height="10"><img src="../images/dot.GIF" width="1" height="1"></td>
                          </tr>
                          <?php
				}
			    }

			    if ($i==0 && ($expcatid || ($doSearch == 9 && $txtsearch)))
			    {
			      echo "<tr><td colspan=3><font face=arial size=2 color=#660000>No Lesson Plans found </td></tr>";
			    }	
			?> 
                        </table>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
              <tr> 
                <td colspan="3" height="2">&nbsp;</td>
              </tr>
            </table>
          </td>
        </tr>
        <tr> 
          <td width="128" height="2"><img src="/images/dot.GIF" width="1" height="1"></td>
          <td width="642" height="2"><img src="/images/dot.GIF" width="1" height="1"></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<?php
	$UI->DisplayMap();
?>

</body>
</html>