Alpha Framework alpha--model
[ class tree: alpha--model ] [ index: alpha--model ] [ all elements ]

Source for file ArticleCommentObject.inc

Documentation is available at ArticleCommentObject.inc

  1. <?php
  2.  
  3. require_once $config->get('sysRoot').'alpha/model/AlphaDAO.inc';
  4.  
  5. /**
  6.  *
  7.  * An article comment class for user comments
  8.  * 
  9.  * @package alpha::model
  10.  * @since 1.0
  11.  * @author John Collins <dev@alphaframework.org>
  12.  * @version $Id: ArticleCommentObject.inc 1463 2011-12-08 21:15:48Z johnc $
  13.  * @license http://www.opensource.org/licenses/bsd-license.php The BSD License
  14.  * @copyright Copyright (c) 2011, John Collins (founder of Alpha Framework).
  15.  *  All rights reserved.
  16.  * 
  17.  *  <pre>
  18.  *  Redistribution and use in source and binary forms, with or
  19.  *  without modification, are permitted provided that the
  20.  *  following conditions are met:
  21.  * 
  22.  *  * Redistributions of source code must retain the above
  23.  *    copyright notice, this list of conditions and the
  24.  *    following disclaimer.
  25.  *  * Redistributions in binary form must reproduce the above
  26.  *    copyright notice, this list of conditions and the
  27.  *    following disclaimer in the documentation and/or other
  28.  *    materials provided with the distribution.
  29.  *  * Neither the name of the Alpha Framework nor the names
  30.  *    of its contributors may be used to endorse or promote
  31.  *    products derived from this software without specific
  32.  *    prior written permission.
  33.  *   
  34.  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
  35.  *  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
  36.  *  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  37.  *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  38.  *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
  39.  *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  40.  *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  41.  *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  42.  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  43.  *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  44.  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  45.  *  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  46.  *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  47.  *  </pre>
  48.  *  
  49.  */
  50. class ArticleCommentObject extends AlphaDAO {
  51.     /**
  52.      * The article this comment belongs to
  53.      * 
  54.      * @var Relation 
  55.      * @since 1.0
  56.      */
  57.     protected $articleOID;
  58.     
  59.     /**
  60.      * The content of the comment posted by the user
  61.      * 
  62.      * @var Text 
  63.      * @since 1.0
  64.      */    
  65.     protected $content;
  66.     
  67.     /**
  68.      * An array of data display labels for the class properties
  69.      * 
  70.      * @var array 
  71.      * @since 1.0
  72.      */
  73.     protected $dataLabels = array("OID"=>"Article Comment ID#","articleOID"=>"Article","content"=>"Comment");
  74.     
  75.     /**
  76.      * The name of the database table for the class
  77.      * 
  78.      * @var string 
  79.      * @since 1.0
  80.      */
  81.     const TABLE_NAME = 'ArticleComment';
  82.     
  83.     /**
  84.      * Trace logger
  85.      * 
  86.      * @var Logger 
  87.      * @since 1.1
  88.      */
  89.     private static $logger null;
  90.     
  91.     /**
  92.      * constructor for the class
  93.      * 
  94.      * @since 1.0
  95.      */
  96.     public function __construct({
  97.         self::$logger new Logger('ArticleCommentObject');
  98.         
  99.         // ensure to call the parent constructor
  100.         parent::__construct();
  101.         
  102.         $this->articleOID = new Relation();
  103.         $this->articleOID->setRelatedClass('ArticleObject');
  104.         $this->articleOID->setRelatedClassField('OID');
  105.         $this->articleOID->setRelatedClassDisplayField('description');
  106.         $this->articleOID->setRelationType('MANY-TO-ONE');
  107.                 
  108.         $this->content = new Text();
  109.         $this->content->setAllowHTML(false);
  110.     }    
  111. }
  112.  
  113. ?>

Documentation generated on Tue, 13 Dec 2011 20:26:24 +0000 by phpDocumentor 1.4.3