protected function buildInternal() { parent::buildInternal(); if ($this->id === null || $this->comment->author !== null) { $this->ui->getWidget('edit_form')->action = sprintf('%s?post=%d', $this->source, $this->comment->post->id); $this->ui->getWidget('author_field')->visible = true; $instance_id = $this->app->getInstanceId(); $sql = sprintf('select BlorgAuthor.*, AdminUserInstanceBinding.usernum from BlorgAuthor left outer join AdminUserInstanceBinding on AdminUserInstanceBinding.default_author = BlorgAuthor.id where BlorgAuthor.instance %s %s and BlorgAuthor.visible = %s order by displayorder', SwatDB::equalityOperator($instance_id), $this->app->db->quote($instance_id, 'integer'), $this->app->db->quote(true, 'boolean')); $rs = SwatDB::query($this->app->db, $sql); $default_author = null; $authors = array(); foreach ($rs as $row) { $authors[$row->id] = $row->name; if ($this->id === null && $row->usernum == $this->app->session->user->id) { $this->ui->getWidget('author')->value = $row->id; } } $this->ui->getWidget('author')->addOptionsByArray($authors); } $statuses = SiteComment::getStatusArray(); $this->ui->getWidget('status')->addOptionsByArray($statuses); }
protected function buildInternal() { parent::buildInternal(); $this->ui->getWidget('edit_form')->action = sprintf('%s?photo=%d', $this->source, $this->comment->photo->id); if (count($this->photographers) > 0) { $this->ui->getWidget('photographer_field')->visible = true; $this->ui->getWidget('fullname_field')->visible = false; $this->ui->getWidget('link_field')->visible = false; $this->ui->getWidget('email_field')->visible = false; $this->ui->getWidget('status_field')->visible = false; $this->ui->getWidget('photographer')->addOptionsByArray($photographers); if ($this->comment->photographer !== null) { $this->ui->getWidget('photographer')->value = $this->comment->photographer->id; } } $statuses = SiteComment::getStatusArray(); $this->ui->getWidget('status')->addOptionsByArray($statuses); }