public function __construct($f = array(), $privileged = false) { $this->id = new FormText(array('value' => $f['id'])); $this->name = new FormText(array('maxlength' => 100, 'size' => 50)); $this->slug = new FormText(array('maxlength' => 100, 'size' => 50)); $this->content_text = new FormTextarea(array('rows' => 5, 'cols' => 43)); $this->description = new FormTextarea(array('rows' => 5, 'cols' => 43)); $this->content_url = new FormText(array('maxlength' => 150, 'size' => 50)); $this->targets = new FormSelect(array('options' => MyValues::targets(), 'size' => 10, 'multiple' => true, 'selected' => MyChannel::targets($f['id']), 'hasBlank' => false)); parent::__construct($f, $privileged); }
/** * pushes default channels to users */ public function push() { $this->_force_admin(); $pushed = MyChannel::push_default_channels(); $_SESSION['successes'][] = 'Default channel push has completed (' . $pushed . ' channels pushed)!'; PSU::redirect($GLOBALS['BASE_URL'] . '/admin'); }
/** * Save tester. */ private function save() { $c = MyChannel::fetch(1); $c->save(); }
/** * Custom constructor to load base meta in addition to userchannel meta. */ public function __construct($params = array()) { if (!$params['channel_id']) { throw new Exception("You cannot create a MyUserChannel without an underlying channel id"); } // load meta so we get a proper overlay of: // // 1. Channel, replaced by... // 2. UserChannel, replaced by... // 3. $params['meta'] // // TODO: this is slightly inefficient, since we will also load the meta // below. $this->meta()->load($params['channel_id'], 'MyChannel'); parent::__construct($params); $this->base = MyChannel::fetch($this->channel_id); $this->base->parent = $this; $this->data['name'] =& $this->base->name; $this->data['slug'] =& $this->base->slug; $this->data['content_url'] =& $this->base->content_url; $this->data['content_text'] =& $this->base->content_text; }