public function __construct($f = array(), $privileged = false) { $this->id = new FormText(array('value' => $f['id'])); $this->name = new FormText(array('maxlength' => 30, 'size' => 50)); $this->slug = new FormText(array('maxlength' => 30, 'size' => 50)); $this->lock_state = new FormCheckbox(array('options' => array(array(1, 'Move Lock'), array(2, 'Remove Lock'), array(4, 'Name Lock')), 'selected' => MyValues::parse_my_bits($f['lock_state']), 'hasBlank' => false)); $this->targets = new FormSelect(array('options' => MyValues::targets(), 'size' => 10, 'multiple' => true, 'selected' => MyTab::targets($f['id']), 'hasBlank' => false)); unset($f['lock_state']); parent::__construct($f, $privileged); }
/** * Constructor for MyUserTab. */ public function __construct(array $params = array()) { if (!$params['tab_id']) { throw new Exception("You cannot create a MyUserTab without an underlying tab id"); } parent::__construct($params); $this->base = MyTab::fetch($this->tab_id); $this->base->parent($this); // override usertab slug with tab slug if it was missing if (!$this->slug) { $this->slug = $this->base->slug; } }
/** * */ public function index() { $this->_force_admin(); $tabs = MyTab::fetchAll(); $channels = MyChannel::fetchAll(); foreach ($channels as $channel) { $targets = MyChannel::targetNames($channel->id); if (ChannelAuthZ::_has_authz($channel->slug)) { $targets[] = '<strong>custom</strong>'; } if (count($targets) > 0) { $channel->target_names = implode(', ', $targets); } } $this->tpl->assign_by_ref('tabs', $tabs); $this->tpl->assign_by_ref('channels', $channels); $this->display('admin-index.tpl'); }