<?php
/*
Plugin - PlogHaiku
Copyright (C) 2005 Darren Greer
                                                                                
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
*/


include_once(PLOG_CLASS_PATH."class/action/admin/blogowneradminaction.class.php");
include_once(PLOG_CLASS_PATH."plugins/ploghaiku/class/view/managehaikuview.class.php");

class ManageHaikuViewAction extends BlogOwnerAdminAction
{
  function perform()
  {
    $haikuDao = new PlogHaikuDao($this->_blogInfo);
    $page = $this->getCurrentPageFromRequest();
    $totalHaiku = $haikuDao->getHaikuCount($this->_blogInfo->getId());

    $haikuList = $haikuDao->getHaikuList(100,$page,$this->_blogInfo->getId());

    $this->_view = new ManageHaikuView($this->_blogInfo,$page,$totalHaiku,"manageHaikuView");
    $this->_view->setValue("haikuList",$haikuList);

    $this->setCommonData();

    return true;
  }

  function getCurrentPageFromRequest()
  {
    $page = HttpVars::getRequestValue( VIEW_DEFAULT_PAGE_PARAMETER );

    $val = new IntegerValidator();
    if( !$val->validate( $page ))
      $page = VIEW_DEFAULT_START_PAGE;

    return $page;
  }

}

?>
