<?php
/*
Plugin - PlogBirthdays
Copyright (C) 2005 Matthew Wood
   
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/siteadminaction.class.php");
include_once(PLOG_CLASS_PATH.
    "plugins/plogbirthdays/class/dao/plogbirthdays.class.php");
include_once(PLOG_CLASS_PATH.
    "plugins/plogbirthdays/class/dao/plogbirthday.class.php");

include_once(PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php");

class AdminPlogBirthdaysNewEntryAction extends SiteAdminAction
{
  function perform()
  {
    $pbdays = new PlogBirthdays();
    $name = $this->_request->getValue('namek');
    $month = $this->_request->getValue('month');
    $day = $this->_request->getValue('day');
    $year = $this->_request->getValue('year');
    $desc = $this->_request->getValue('description');
    
    $svalid = new StringValidator();
    if ($svalid->validate($name) && $svalid->validate($desc) &&
        is_numeric($month) && is_numeric($year) && is_numeric($day))
    {
      $bday = new PlogBirthday('',$name,$month,$day,$year,$desc);
      if ($pbdays->addBirthday(&$bday))
        Controller::setForwardAction('plogbirthdaysView');
      else
        die("Unable to Execute Query in PlogBirthdays");
    }
  }
}


/* vim:cin:ai:expandtab:sw=2:
*/
?>
