/** * @param ENTRY $entry Will be attached to this object. */ public function __construct($entry) { $folder = $entry->parent_folder(); parent::__construct($folder); $this->_entry = $entry; $field = new TEXT_FIELD(); $field->id = 'type'; $field->caption = 'Type'; $field->required = true; $field->visible = false; $this->add_field($field); $field = new BOOLEAN_FIELD(); $field->id = 'create_thumbnail'; $field->caption = 'Generate thumbnail'; $field->sticky = true; $this->add_field($field); $field = new INTEGER_FIELD(); $field->id = 'thumbnail_size'; $field->caption = 'Thumbnail'; $field->min_value = 32; $field->max_value = 400; $field->sticky = true; $this->add_field($field); $field = new BOOLEAN_FIELD(); $field->id = 'overwrite'; $field->caption = 'Overwrite existing file'; $field->sticky = true; $this->add_field($field); $field = new UPLOAD_FILE_FIELD(); $field->id = 'file_name'; $field->caption = 'File'; $field->required = true; $this->add_field($field); }
/** * @param ENTRY $entry Retrieve comments from this entry. */ public function __construct($entry) { parent::__construct($entry->parent_folder()); $this->_entry = $entry; }
/** * Attach this comment to an entry. * Does not store to the database. Sets up both the entry and the folder information * for this comment; used during object setup when retrieved from database. * @param ENTRY $entry */ public function set_entry($entry) { $this->set_parent_folder($entry->parent_folder()); $this->_entry = $entry; $this->entry_id = $entry->id; }
/** * Draws {@link COMMENT}s and {@link ATTACHMENT}s. * @param ENTRY $obj * @param OBJECT_RENDERER_OPTIONS $options */ public function display($obj, $options = null) { $folder = $obj->parent_folder(); if ($this->login->is_allowed(Privilege_set_attachment, Privilege_view, $folder)) { $attachment_query = $obj->attachment_query(); if ($attachment_query->size()) { ?> <h2 id="attachments"> Attachments </h2> <div class="grid-content"> <?php $class_name = $this->app->final_class_name('ATTACHMENT_GRID', 'webcore/gui/attachment_grid.php'); /** @var $grid ATTACHMENT_GRID */ $grid = new $class_name($this->app); $grid->pager->page_anchor = 'attachments'; $grid->pager->page_number_var_name = 'attachment_page_number'; $grid->set_page_size(Default_page_size); $grid->set_query($attachment_query); $grid->display(); ?> </div> <?php } } if ($this->login->is_allowed(Privilege_set_comment, Privilege_view, $folder)) { $com_query = $obj->comment_query(); if ($com_query->size()) { $class_name = $this->app->final_class_name('COMMENT_LIST_RENDERER', 'webcore/gui/comment_renderer.php'); /** @var $com_renderer COMMENT_LIST_RENDERER */ $com_renderer = new $class_name($com_query, $obj); ?> <h2 id="comments" class="clear-both"> Comments </h2> <?php $commands = $com_renderer->make_commands(); if ($commands->num_executable_commands() > 0) { ?> <div class="button-content"> <span class="field"><?php echo $com_renderer->size(); ?> </span> Replies <?php $menu_renderer = $this->app->make_menu_renderer(); $menu_renderer->content_mode = Menu_show_as_buttons; $menu_renderer->display($commands); ?> </div> <?php } ?> <div class="grid-content"> <?php $com_renderer->display(); ?> </div> <?php } } }
/** * @param SUBSCRIBER $subscriber * @param ENTRY $obj * @param integer[] $kinds * @param OBJECT_RENDERER_OPTIONS $options */ protected function _display($obj, $subscriber, $kinds, $options) { $this->show_subscription($subscriber, $obj->parent_folder(), 'subscribe_to_folder.php', in_array(Subscribe_folder, $kinds), true, ''); $this->show_subscription($subscriber, $obj, 'subscribe_to_entry.php', in_array(Subscribe_entry, $kinds), false, ''); $this->show_subscription($subscriber, $obj->creator(), 'subscribe_to_user.php', in_array(Subscribe_user, $kinds), true, 'creator'); }