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

Source for file ArticleVoteObject.inc

Documentation is available at ArticleVoteObject.inc

  1. <?php
  2.  
  3. require_once $config->get('sysRoot').'alpha/model/AlphaDAO.inc';
  4.  
  5. /**
  6.  *
  7.  * An article vote class for user ratings
  8.  * 
  9.  * @package alpha::model
  10.  * @since 1.0
  11.  * @author John Collins <dev@alphaframework.org>
  12.  * @version $Id: ArticleVoteObject.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 ArticleVoteObject 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 person who cast the vote
  61.      * 
  62.      * @var Relation 
  63.      * @since 1.0
  64.      */
  65.     protected $personOID;
  66.     
  67.     /**
  68.      * The actual vote score (default 1-10)
  69.      * 
  70.      * @var Integer 
  71.      * @since 1.0
  72.      */    
  73.     protected $score;
  74.     
  75.     /**
  76.      * An array of data display labels for the class properties
  77.      * 
  78.      * @var array 
  79.      * @since 1.0
  80.      */
  81.     protected $dataLabels = array("OID"=>"Article Vote ID#","articleOID"=>"Article","personOID"=>"Voter","score"=>"Article Score");
  82.     
  83.     /**
  84.      * The name of the database table for the class
  85.      * 
  86.      * @var string 
  87.      * @since 1.0
  88.      */
  89.     const TABLE_NAME = 'ArticleVote';
  90.     
  91.     /**
  92.      * Trace logger
  93.      * 
  94.      * @var Logger 
  95.      * @since 1.1
  96.      */
  97.     private static $logger null;
  98.     
  99.     /**
  100.      * Constructor for the class
  101.      * 
  102.      * @since 1.0
  103.      */
  104.     public function __construct({
  105.         self::$logger new Logger('ArticleVoteObject');
  106.         
  107.         // ensure to call the parent constructor
  108.         parent::__construct();
  109.         
  110.         $this->articleOID = new Relation();
  111.         $this->articleOID->setRelatedClass('ArticleObject');
  112.         $this->articleOID->setRelatedClassField('OID');
  113.         $this->articleOID->setRelatedClassDisplayField('description');
  114.         $this->articleOID->setRelationType('MANY-TO-ONE');
  115.         
  116.         $this->personOID = new Relation();
  117.         $this->personOID->setRelatedClass('PersonObject');
  118.         $this->personOID->setRelatedClassField('OID');
  119.         $this->personOID->setRelatedClassDisplayField('email');
  120.         $this->personOID->setRelationType('MANY-TO-ONE');
  121.         
  122.         $this->score = new Integer();
  123.     }    
  124. }
  125.  
  126. ?>

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