<?php
/*
*/
   include_once("_nemo.basic.cls.php");


   $page = new NemoBasic();
//print_rr($_SESSION);

   if($Action == "Print Schedule")
   {

      $row = $xdb->getRowSQL("SELECT * FROM tblCourse WHERE CourseID = ". $xdb->qs($CID));

      header("Content-type: application/ms-excel");
      header("Content-Disposition: attachment; filename=KM_". str_replace(" ","", $row->strCourse) ."_". str_replace("/","_", $row->strCourseCode) ."_".date("Y-m-d").".xls");
      echo $page->getCourseSchedule($CID);
      die;
   }

   $row = $xdb->getRowSQL("SELECT * FROM sysLogin WHERE strUsername = ". $xdb->qs($page->Learner->strEmail) ." AND LEFT(strDateTime,10) <> '". date("Y-m-d") ."' ORDER BY LoginID DESC");
   if($row)
      $strLastLogin = "<p>You last logged in on ". date("j F Y H:i", strtotime($row->strDateTime)) ."</p>";

   $rstCourses = $xdb->doQuery("
      SELECT tblCourse.CourseID, tblCourse.refCourseTypeID, tblCourse.strCourse, tblCourse.strCourseHTML, tblCourse.strCourseCode, tblCourse.dblCost, tblCourse.dtStartDate, tblCourse.dtEndDate, tblCourse.blnActive, tblCourse.strLastUser, tblCourse.dtLastEdit, tblLicence.refLearnerID, tblLicence.strStatus, Sum(modAssignment.intMarks) AS SumOfintMarks
      FROM modAssignment RIGHT JOIN (modModule RIGHT JOIN (tblLicence INNER JOIN tblCourse ON tblLicence.refCourseID = tblCourse.CourseID) ON modModule.refCourseID = tblCourse.CourseID) ON modAssignment.refModuleID = modModule.ModuleID
      WHERE tblCourse.blnWorkshop = 1
      GROUP BY tblCourse.CourseID, tblCourse.refCourseTypeID, tblCourse.strCourse, tblCourse.strCourseHTML, tblCourse.strCourseCode, tblCourse.dblCost, tblCourse.dtStartDate, tblCourse.dtEndDate, tblCourse.blnActive, tblCourse.strLastUser, tblCourse.dtLastEdit, tblLicence.refLearnerID, tblLicence.strStatus
      HAVING (((tblCourse.dtEndDate)>=LEFT('$DT',10)) AND ((tblLicence.refLearnerID)=". $page->Learner->LearnerID .") AND ((tblLicence.strStatus)='Active'))");
   
   while($rowCourse = $xdb->fetch_object($rstCourses))
   {      
      $row = $xdb->getRowSQL("SELECT COUNT(refLearnerID) as intLearners FROM (SELECT DISTINCT refLearnerID FROM tblLicence WHERE refCourseID = $rowCourse->CourseID AND strStatus='Active') as tblDir");
      
      $strCourses .= "
      <h2 class='textColour'>$rowCourse->strCourse</h2>
      <p>Welcome and congratulations. You are one of $row->intLearners people who have signed up for this course. We sincerely believe that this is going to make a difference in your working life.</p>";
      //print_rr($rowCourse);
       $strCourses .= "
      <p>Your course program is as follows: <span class='fr'>To print your Course program, <a href='?Action=Print Schedule&CID=$rowCourse->CourseID'>click here</a>.</span></p>".$page->getCourseSchedule($rowCourse->CourseID); 
      $strCourses .= "".$page->getCourseCoordinators($rowCourse->CourseID);      
     
   }//eoCourses

   $page->Content = "   <h1>OM Wealth Workshops</h1>";
   // $page->Content .= "  <p>Welcome to the Old Mutual Wealth Investment Proposition Training Program. We trust that you and your clients will benefit from the time that you spend with us.</p>
   //                      <p> By the time you have completed the workshop you will be able to introduce your clients to the Old Mutual Wealth offering with confidence. We hope that it will make your job easier and even more stimulating.</p>
   //                      <p style='display: none;'>The last module listed on the left contain venue details for your workshop as well as directions on how to get there.      </p>
   //                      <p>We have prepared background material and user guides and urge you to read it before attending the workshop (see left). By clicking on the links in the left column on this page, you will be able to access the material, module by module. Please print it or save it on your computer. </p>
   //                      <p>If you would like to test your knowledge, assessment questions will be made available in each module which you should access after the workshop.</p>";
   $page->Content .= getTypoIframe($id="hidden/workshops/");
   //$page->Content .= $strCourses;


   /*
   <h2 class='textColour'>Technical requirements</h2>
   <p>
      In order to access the course material you will need to have Adobe Acrobat Reader installed on your computer. If you do not have this program or would like an updated version thereof, <a href='http://get.adobe.com/reader/' target=_blank >click here</a>.$BR$BR
      Certain module contains a brief video clip. In order to view this material you will need to have Windows Media Player or a similar program installed on your computer. If you do not have such a program, please refer to your IT support technician for assistance.
   </p>
   
   <h2 class='textColour'>Adhere to your company requirements</h2>
   <p>
   The notes, material and templates provided by <b>Know</b><b class='textColour'>More</b> are based on industry best principles and are carefully researched. However, there may be very valid reasons for doing things differently in your business. This is often the case when it comes to technology.
   Before implementing new ideas and suggestions, always check your company’s business guidelines and IT policies before you proceed.
   </p>*/

   $page->Display();

?>
