Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Channel extends Activerecord\Model {
- /**
- * |-----------------------------------------------------------------------
- * | Channels Setup
- * |-----------------------------------------------------------------------
- * |
- */
- public static $table_name = 'channels';
- public static $primary_key = 'channel';
- /**
- * |-----------------------------------------------------------------------
- * | Channels Validation
- * |-----------------------------------------------------------------------
- * |
- */
- static $validates_presence_of = array();
- static $validates_numericality_of = array();
- static $validates_inclusion_of = array();
- static $validates_uniqueness_of = array();
- /**
- * Initialize static variables
- */
- static function int()
- {
- self::$validates_uniqueness_of = array(
- array('channel'),
- array('title'),
- array('slug')
- );
- self::$validates_presence_of = array(
- array('channel'),
- array('slug'),
- array('title'),
- array('section')
- );
- self::$validates_inclusion_of = array(
- array('section', 'in' => unserialize(self::getSections()))
- );
- self::$validates_numericality_of = array(
- array('channel', 'only_integer' => true)
- );
- }
- /**
- * Get section names from CI config
- *
- * @return string
- */
- static function getSections()
- {
- require dirname(dirname(dirname(__FILE__))) . '/config/prtv.php';
- return serialize(array_keys($config['allowedChannelSections']));
- }
- }
- Channel::int();
- /* End of file Channel.php */
- /* Location: ./xx/xx/models/ar/Channel.php */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement