<?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'       => $CURRENT_USER['kids_name'],
    'perPage'     => '5',
  )); 

  // load records
  list($kids_galleryRecords, $kids_galleryMetaData) = getRecords(array(
    'tableName'   => 'kids_gallery',
    'where'       => $CURRENT_USER['kids_name'],
    'perPage'     => '10',
  ));

  // load records
  list($kids_nameRecords, $kids_nameMetaData) = getRecords(array(
    'tableName'   => 'kids_name',
    'where'       => $CURRENT_USER['kids_name'],
    'limit'       => '1',
  ));
  $kids_nameRecord = @$kids_nameRecords[0]; // get first record
        
?>
<?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'] ?> Portfolio</h1>
        <p><a href="?action=logoff">Logoff</a><br />
<br />
<?php if ($CURRENT_USER): ?>
  <strong>Welcome, <?php echo $CURRENT_USER['username'] ?></strong> <br/>
<?php else: ?>
  <a href="<?php echo $GLOBALS['WEBSITE_LOGIN_LOGIN_FORM_URL'] ?>">Login</a>
<?php endif ?></p>
      <h1>Gallery</h1>
      <p>  <!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
    <?php foreach ($kids_galleryRecords as $record): ?>
      <!-- STEP 2a: Display Uploads for field 'images' (Paste this anywhere inside STEP2 to display uploads) -->
        <!-- Upload Fields: num, createdTime, tableName, fieldName, recordNum, preSaveTempId, filePath, filename, extension, thumbFilePath, isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight, info1, info2, info3, info4, info5 -->
        <?php foreach ($record['images'] as $upload): ?>
          <?php if ($upload['hasThumbnail']): ?>
            <a href="<?php echo $upload['urlPath'] ?>" rel="shadowbox[a]"><img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /></a>
          <?php elseif ($upload['isImage']): ?>
            <a href="<?php echo $upload['urlPath'] ?>" rel="shadowbox[a]"><img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /></a><br/>

          <?php else: ?>
            <a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/>

          <?php endif ?>
        <?php endforeach ?>
      <!-- STEP2a: /Display Uploads -->
    <?php endforeach ?>

    <?php if ($kids_galleryMetaData['invalidPageNum']): ?>
      Results page '<?php echo $kids_galleryMetaData['page']?>' not found, <a href="<?php echo $kids_galleryMetaData['firstPageLink'] ?>">start over &gt;&gt;</a>.<br/><br/>
    <?php elseif (!$kids_galleryRecords): ?>
      No records were found!<br/><br/>
    <?php endif ?>
  <!-- /STEP2: Display Records -->


<br />
<br />
  <!-- STEP3: Display Page Links (Paste anywhere below "Load Record List") -->
    <?php if ($kids_galleryMetaData['prevPage']): ?>
      <a href="<?php echo $kids_galleryMetaData['prevPageLink'] ?>">&lt;&lt; prev</a>
    <?php else: ?>
      &lt;&lt; prev
    <?php endif ?>

    - page <?php echo $kids_galleryMetaData['page'] ?> of <?php echo $kids_galleryMetaData['totalPages'] ?> -

    <?php if ($kids_galleryMetaData['nextPage']): ?>
      <a href="<?php echo $kids_galleryMetaData['nextPageLink'] ?>">next &gt;&gt;</a>
    <?php else: ?>
      next &gt;&gt;
    <?php endif ?>
  <!-- /STEP3: Display Page Links -->


</p>
      </div>
      <div class="col-2">
        <h1>Diary notes</h1>
        <p>  <!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
    <?php foreach ($kids_diaryRecords as $record): ?>
      <strong><?php echo date("D, M jS, Y", strtotime($record['date'])) ?></strong>
      <!-- For date formatting codes see: http://www.php.net/date -->
      <?php echo $record['content'] ?><br/>
      <!-- STEP 2a: Display Uploads for field 'images' (Paste this anywhere inside STEP2 to display uploads) -->
        <!-- Upload Fields: num, createdTime, tableName, fieldName, recordNum, preSaveTempId, filePath, filename, extension, thumbFilePath, isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight, info1, info2, info3, info4, info5 -->
        <?php foreach ($record['images'] 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 ?>
      <!-- STEP2a: /Display Uploads -->
..................................................................................................<br />

    <?php endforeach ?>

    <?php if ($kids_diaryMetaData['invalidPageNum']): ?>
      Results page '<?php echo $kids_diaryMetaData['page']?>' not found, <a href="<?php echo $kids_diaryMetaData['firstPageLink'] ?>">start over &gt;&gt;</a>.<br/><br/>
    <?php elseif (!$kids_diaryRecords): ?>
      No records were found!<br/><br/>
    <?php endif ?>
  <!-- /STEP2: Display Records -->


  <!-- STEP3: Display Page Links (Paste anywhere below "Load Record List") -->
    <?php if ($kids_diaryMetaData['prevPage']): ?>
      <a href="<?php echo $kids_diaryMetaData['prevPageLink'] ?>">&lt;&lt; prev</a>
    <?php else: ?>
      &lt;&lt; prev
    <?php endif ?>

    - page <?php echo $kids_diaryMetaData['page'] ?> of <?php echo $kids_diaryMetaData['totalPages'] ?> -

    <?php if ($kids_diaryMetaData['nextPage']): ?>
      <a href="<?php echo $kids_diaryMetaData['nextPageLink'] ?>">next &gt;&gt;</a>
    <?php else: ?>
      next &gt;&gt;
    <?php endif ?>
  <!-- /STEP3: Display Page Links --></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>