Location: PHPKode > projects > Mac's MVC Framework > Application/plugins/CMS/models/PageComments_Model.php
<?php
/**
 * Roles Table Model
 *
 * @author Macdonald Robinson
 */

class PageComments_Model extends CMS_Model
{
    public function __construct()
    {
      parent::__construct();
    }

    public function getCMSTableNamePageComments()
    {
      return $this->getCMSTableName('PageComments');
    }

    public function insertPageComment($controller, $function, $language, $name, $subject, $url, $emailAddress, $comment, $showOnSite, $isAdminComment)
    {
      return $this->insert( $this->getCMSTableNamePageComments(), array('Controller'=>$controller, 'Function'=>$function, 'Language'=>$language, 'VisitorName'=> $name, 'Subject'=>$subject, 'URL'=>$url, 'EmailAddress'=>$emailAddress, 'Comment'=>$comment, 'ShowOnSite'=>$showOnSite, 'IsAdminComment'=>$isAdminComment , 'CreatedOn'=>time(), 'LastModifiedOn'=>time() ));
    }

    public function getPageComments($controller, $function, $language)
    {
      return $this->select( $this->getCMSTableNamePageComments(), array('Controller'=>$controller, 'Function'=>$function, 'Language'=>$language));
    }

    public function getModeratedPageComments($controller, $function, $language)
    {      
      return $this->select( $this->getCMSTableNamePageComments(), array('Controller'=>$controller, 'Function'=>$function, 'Language'=>$language, 'ShowOnSite'=>true));
    }

    public function allowCommentByID($commentId)
    {
      return $this->update( $this->getCMSTableNamePageComments(), array('ShowOnSite'=>true),  array('ID'=>$commentId));
    }

    public function deleteCommentByID($commentId)
    {
      return $this->delete( $this->getCMSTableNamePageComments(), array('ID'=>$commentId));
    }
}
?>
Return current item: Mac's MVC Framework