Пример #1
0
	/**
	 * Set the fields for the blog article
	 */
	public function _init() {
		parent::_init();
		$this->_title_key = "title";
		$this->_fields += array(
			'id'         => new Sprig_Field_Auto,
			// Metadata
			'title' => new Sprig_Field_Tracked,
			'slug'  => new Sprig_Field_Tracked(array(
				'editable' => FALSE,
			)),
			'date'  => new Sprig_Field_Timestamp(array(
				'auto_now_create' => TRUE,
				'editable'        => FALSE,
				'format'          => 'F jS, Y \a\t g:s a',
			)),
			'state' => new Sprig_Field_Tracked(array(
				'choices' => array(
					'draft'     => 'Draft',
					'published' => 'Published',
					'archived'  => 'Archived'
				),
			)),
			'text'  => new Sprig_Field_Versioned,
			'description'  => new Sprig_Field_char,
			'keywords'  => new Sprig_Field_char,
			'comment'   => new Sprig_Field_Char(array(
				'empty' => TRUE,
				'in_db' => FALSE,
				'label' => 'Reason for edit',
			)),
			// Relationships
			'statistic'  => new Sprig_Field_HasOne(array(
				'model'  => 'statistic',
			)),
			'subcategory'   => new Sprig_Field_BelongsTo(array(
				'model'  => 'subcategory',
				'null'   => FALSE,
			)),
			'author'     => new Sprig_Field_BelongsTo(array(
				'model'    => 'user',
				'column'   => 'author_id',
				'editable' => FALSE,
			)),
			/* To be implemented
			'comments'   => new Sprig_Field_HasMany(array(
				'model'  => 'comment',
			)),
			 */
			'revisions'  => new Sprig_Field_HasMany(array(
				'model'  => 'Article_Revision',
			)),
			'tags'       => new Sprig_Field_ManyToMany(array(
				'model'  => 'tag',
			)),
			'photos' => new Sprig_Field_HasMany(array(
				'model'  => 'photo',
			)),
		);
	}
Пример #2
0
 /**
  * Set the fields for the blog article
  */
 public function _init()
 {
     parent::_init();
     $this->_fields += array('id' => new Sprig_Field_Auto(), 'title' => new Sprig_Field_Tracked(), 'slug' => new Sprig_Field_Tracked(array('editable' => FALSE)), 'date' => new Sprig_Field_Timestamp(array('auto_now_create' => TRUE, 'editable' => FALSE, 'format' => 'F jS, Y \\a\\t g:s a')), 'state' => new Sprig_Field_Tracked(array('choices' => array('draft' => 'Draft', 'published' => 'Published', 'archived' => 'Archived'))), 'text' => new Sprig_Field_Versioned(), 'comment' => new Sprig_Field_Char(array('empty' => TRUE, 'in_db' => FALSE, 'label' => 'Reason for edit')), 'statistic' => new Sprig_Field_HasOne(array('model' => 'statistic')), 'category' => new Sprig_Field_BelongsTo(array('model' => 'category', 'null' => FALSE)), 'author' => new Sprig_Field_BelongsTo(array('model' => 'user', 'column' => 'author_id', 'editable' => FALSE)), 'revisions' => new Sprig_Field_HasMany(array('model' => 'Article_Revision')), 'tags' => new Sprig_Field_ManyToMany(array('model' => 'tag')));
 }
Пример #3
0
 public function _init()
 {
     parent::_init();
     $this->_fields += array('text' => new Sprig_Field_Versioned(), 'title' => new Sprig_Field_Tracked(array('empty' => TRUE)), 'revisions' => new Sprig_Field_HasMany(array('model' => 'Entry_Revision')));
 }
Пример #4
0
 public function _init()
 {
     parent::_init();
     $this->_fields += array('title' => new Sprig_Field_Tracked(array('empty' => TRUE)), 'text' => new Sprig_Field_Versioned(), 'revisions' => new Sprig_Field_HasMany(array('model' => 'Page_Revision')), 'comment' => new Sprig_Field_Char(array('in_db' => FALSE)));
 }