<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
  /* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */

  // load viewer library
  $libraryPath = 'cmsAdmin/lib/viewer_functions.php';
  $dirsToCheck = array('/home/waggacc/domains/waggachildcare.com.au/public_html/','','../','../../','../../../');
  foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
  if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

  // error checking
  // die("Security Check - Remove this error from this script before you use it.");
  if (!@$GLOBALS['WEBSITE_MEMBERSHIP_PLUGIN']) { die("You must activate the Website Membership plugin before you can access this page."); }
  
  // load records
  list($google_analyticsRecords, $google_analyticsMetaData) = getRecords(array(
    'tableName'   => 'google_analytics',
    'limit'       => '1',
  ));
  $google_analyticsRecord = @$google_analyticsRecords[0]; // get first record

  // load records
  list($portfolio_metaRecords, $portfolio_metaMetaData) = getRecords(array(
    'tableName'   => 'portfolio_meta',
    'limit'       => '1',
  ));
  $portfolio_metaRecord = @$portfolio_metaRecords[0]; // get first record

  // load records
  list($sloganRecords, $sloganMetaData) = getRecords(array(
    'tableName'   => 'slogan',
    'limit'       => '1',
  ));
  $sloganRecord = @$sloganRecords[0]; // get first record

 // load records 
  list($kids_diaryRecords, $kids_diaryMetaData) = getRecords(array( 
    'tableName'   => 'kids_diary', 
    'where'       => "kids_name = '".mysql_escape($CURRENT_USER['kids_portfolio'])."'",
    'limit'       => '1',
  ));  
 $kids_diaryRecord = @$kids_diaryRecords[0]; // get first record
 
  // load records 
  list($kids_nameRecords, $kids_nameMetaData) = getRecords(array( 
    'tableName'   => 'kids_name', 
    'where'       => "title = '".mysql_escape($CURRENT_USER['kids_portfolio'])."'", 
    'limit'       => '1', 
  )); 
  $kids_nameRecord = @$kids_nameRecords[0]; // get first record

  // show error message if no matching record is found
  if (!$kids_diaryRecord) { dieWith404("Record not found!"); }        

?>
<?php if (!$CURRENT_USER) { websiteLogin_redirectToLogin(); } ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><?php echo $portfolio_metaRecord['page_title'] ?></title>
<meta name="keywords" content="<?php echo $portfolio_metaRecord['keywords'] ?>" />
<meta name="description" content="<?php echo $portfolio_metaRecord['description_tag'] ?>" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" >
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<link href="style.css" rel="stylesheet" type="text/css" />
<link href="layout.css" rel="stylesheet" type="text/css" />
<link href="buttons.css" rel="stylesheet" type="text/css" />
<script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="js/cufon-yui.js" type="text/javascript"></script>
<script src="js/cufon-replace.js" type="text/javascript"></script>
<script src="js/Challenge_Extra_Bold_400.font.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="shadowbox/shadowbox.css">
<script type="text/javascript" src="shadowbox/shadowbox.js"></script>
<script type="text/javascript">
Shadowbox.init({
    handleOversize: "drag",
    modal: true
});
</script>
<!--[if lt IE 7]>
	<link href="ie_style.css" rel="stylesheet" type="text/css" />
     	<script src="js/ie_png.js" type="text/javascript"></script>   
    <script type="text/javascript">
           DD_belatedPNG.fix('.logo img, .png, .button2, .button2 span, .button2 span, .button, .button span, .button span,');
   </script>
<![endif]-->
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', '<?php echo $google_analyticsRecord['google_code'] ?>']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
</head>
<body id="page2">
<div id="main">
  <!-- header -->
  <div id="header">
    <div class="logo"><a href="index.php"><img src="images/logo.png" alt="" width="900" height="100" /></a></div>
    <div class="menu">
      <ul>
        <li><a href="index.php"><span><span>Home</span></span></a></li>
        <li><a href="enrolments.php"><span><span>Enrolments</span></span></a></li>
        <li><a href="downloads.php"><span><span>Downloads</span></span></a></li>
        <li><a href="about-us.php"><span><span>About us</span></span></a></li>
        <li><a href="gallery.php"><span><span>Gallery</span></span></a></li>
        <li><a href="kids-portfolio.php" class="active"><span><span>Kids Portfolios</span></span></a></li>
        <li><a href="contact-us.php"><span><span>Contact us</span></span></a></li>
      </ul>
    </div>
    <div class="slogan">
      <div class="s1"><?php echo $sloganRecord['line_1'] ?></div><div class="s2"><?php echo $sloganRecord['line_2'] ?></div><div class="s3"><?php echo $sloganRecord['line_3'] ?></div>
    </div>
  </div>
  <!-- content -->
  <div id="content">
    <div class="wrapper">
      <div class="col-1">
        <h1><?php echo $kids_nameRecord['title'] ?> Diary notes</h1>
        <p>
      <?php echo date("D, M jS, Y", strtotime($kids_diaryRecord['date'])) ?><br/>
      <!-- For date formatting codes see: http://www.php.net/date -->
      <?php echo $kids_diaryRecord['content'] ?><br/>
        <?php foreach ($kids_diaryRecord['images'] as $upload): ?>
          <?php if ($upload['hasThumbnail']): ?>
            <a href="<?php echo $upload['urlPath'] ?>" rel="shadowbox[b]"><img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>"  alt="<?php echo $upload['info1'] ?> <?php echo $upload['info2'] ?>" title="<?php echo $upload['info1'] ?> <?php echo $upload['info2'] ?>" /></a><br/>

          <?php elseif ($upload['isImage']): ?>
            <img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /><br/>

          <?php endif ?>
        <?php endforeach ?><br />
        <?php foreach ($kids_diaryRecord['file_upload'] as $upload): ?>
          <?php if ($upload['hasThumbnail']): ?>
            <img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>
          <?php elseif ($upload['isImage']): ?>
            <img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /><br/>

          <?php else: ?>
            <a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/>

          <?php endif ?>
        <?php endforeach ?>

    <?php if (!$kids_diaryRecord): ?>
      No record found!<br/><br/>
    <?php endif ?>
  <!-- /STEP2: Display Records -->
  <br /><a href="javascript: history.go(-1)">Back</a></p>
      </div>
    </div>
  </div>
  <!-- footer -->
  <div id="footer">
    <div id="foot">
    <?php include("includes/footer.inc.php"); ?>
    </div>
  </div>
  <script type="text/javascript"> Cufon.now(); </script>
</div>
</body>
</html>