/** * Render view. * * @return string */ public function content() { ob_start(); echo Form::open(); ?> <fieldset> <?php echo Form::control_group(Form::input('name', $this->blog_entry->name, array('class' => 'input-xxlarge')), array('name' => __('Title')), Arr::get($this->errors, 'name')); ?> <?php echo Form::control_group(Form::textarea_editor('content', $this->blog_entry->content, array('class' => 'input-xxlarge'), true), array('content' => __('Content')), Arr::get($this->errors, 'content')); ?> </fieldset> <fieldset class="form-actions"> <?php echo Form::csrf(); ?> <?php echo Form::button('save', __('Save'), array('type' => 'submit', 'class' => 'btn btn-success btn-large')); ?> <?php echo $this->cancel ? HTML::anchor($this->cancel, __('Cancel'), array('class' => 'cancel')) : ''; ?> </fieldset> <?php echo Form::close(); return ob_get_clean(); }
/** * Render view. * * @return string */ public function content() { ob_start(); // Create form attributes $attributes = array('class' => 'form-horizontal small-labels'); if ($this->form_id) { $attributes['id'] = $this->form_id; } $button = __('Save'); if (!$this->form_action) { switch ($this->mode) { case self::QUOTE: $this->form_action = Route::url($this->private ? 'forum_private_post' : 'forum_post', array('topic_id' => $this->forum_topic->id, 'id' => $this->forum_post->parent_id, 'action' => 'quote')); $button = __('Reply'); break; case self::REPLY: $this->form_action = Route::model($this->forum_topic, 'reply'); $button = __('Reply'); break; case self::EDIT_POST: $this->form_action = Route::url($this->private ? 'forum_private_post' : 'forum_post', array('topic_id' => $this->forum_topic->id, 'id' => $this->forum_post->id, 'action' => 'edit')); break; } } echo Form::open($this->form_action ? $this->form_action : null, $attributes); // Progressively add content, note that we don't break switch ($this->mode) { // Adding new topic case self::NEW_TOPIC: // Editing an old topic // Editing an old topic case self::EDIT_TOPIC: $is_admin = self::$_user->has_role(array('admin', 'moderator', 'forum moderator')); if ($is_admin) { ?> <fieldset class="row"> <div class="span3"> <?php echo Form::control_group(Form::select('status', array(Model_Forum_Topic::STATUS_NORMAL => __('Normal'), Model_Forum_Topic::STATUS_SINK => __('Sink'), Model_Forum_Topic::STATUS_LOCKED => __('Locked')), $this->forum_topic->status, array('class' => 'input-small')), array('status' => __('Status')), Arr::get($this->errors, 'status')); ?> </div> <div class="span3"> <?php echo Form::control_group(Form::select('sticky', array(Model_Forum_Topic::STICKY_NORMAL => __('Normal'), Model_Forum_Topic::STICKY_STICKY => __('Sticky')), $this->forum_topic->sticky, array('class' => 'input-small')), array('sticky' => __('Stickyness')), Arr::get($this->errors, 'sticky')); ?> </div> </fieldset> <?php } ?> <?php echo Form::control_group(Form::input('name', $this->forum_topic->name, array('class' => 'input-block-level')), array('name' => __('Topic')), Arr::get($this->errors, 'name')); ?> <?php if ($this->private) { echo Form::control_group(Form::textarea('recipients', $this->recipients, array('rows' => 3, 'placeholder' => __('Required'), 'class' => 'input-block-level'), true), array('recipients' => __('Recipients')), Arr::get($this->errors, 'recipients')); } ?> <?php if ($this->mode === self::EDIT_TOPIC && !$is_admin) { break; } // Replying to a topic // Replying to a topic case self::REPLY: case self::QUOTE: ?> <div class="pull-left"> <?php echo HTML::avatar(self::$_user->avatar, self::$_user->username); ?> </div> <div class="arrow"></div> <?php // Editing old post // Editing old post case self::EDIT_POST: ?> <div class="post-edit media-body form-vertical"> <header> <?php echo HTML::user(self::$_user); ?> </header> <fieldset> <?php echo Form::control_group(Form::textarea_editor('post', $this->forum_post->post, array('id' => uniqid(), 'class' => 'input-block-level'), true), null, Arr::get($this->errors, 'post')); ?> </fieldset> <fieldset class="form-actions"> <?php echo Form::button('save', $button, array('type' => 'submit', 'class' => 'btn btn-success btn-large')); ?> <?php echo $this->cancel ? HTML::anchor($this->cancel, __('Cancel'), array('class' => 'cancel')) : ''; ?> <?php echo Form::csrf(); ?> </fieldset> </div> <?php } echo Form::close(); // Auto-complete recipients if ($this->private) { ?> <script> head.ready('anqh', function() { $('textarea[name=recipients]').autocompleteUser({ user: <?php echo self::$_user_id; ?> , maxUsers: 100 }); }); </script> <?php } return ob_get_clean(); }
/** * Render content. * * @return string */ public function content() { ob_start(); echo Form::open(null, array('id' => 'form-event', 'class' => 'row')); ?> <!-- <?php if ($this->event_errors) { ?> <ul class="errors"> <?php foreach ($this->event_errors as $error) { ?> <li><?php echo $error; ?> </li> <?php } ?> </ul> <?php } ?> <?php if ($this->venue_errors) { ?> <ul class="errors"> <?php foreach ($this->venue_errors as $error) { ?> <li><?php echo $error; ?> </li> <?php } ?> </ul> <?php } ?> --> <div class="span8"> <fieldset id="fields-primary"> <?php echo Form::control_group(Form::input('name', $this->event->name, array('class' => 'input-block-level')), array('name' => __('Event')), Arr::get($this->event_errors, 'name')); ?> <?php echo Form::control_group(Form::textarea('dj', $this->event->dj, array('class' => 'input-block-level'), true), array('dj' => __('Line-up')), Arr::get($this->event_errors, 'dj')); ?> <?php echo Form::control_group(Form::textarea_editor('info', $this->event->info, array('class' => 'input-block-level'), true), array('info' => __('Other information')), Arr::get($this->event_errors, 'info')); ?> </fieldset> <fieldset class="form-actions"> <?php echo Form::button('save', __('Save event'), array('type' => 'submit', 'class' => 'btn btn-success btn-large')); ?> <?php echo $this->cancel ? HTML::anchor($this->cancel, __('Cancel'), array('class' => 'cancel')) : ''; ?> <?php echo Form::csrf(); ?> <?php echo Form::hidden('latitude', $this->venue->latitude); ?> <?php echo Form::hidden('longitude', $this->venue->longitude); ?> <?php echo Form::hidden('venue_id', $this->venue->id); ?> </fieldset> </div> <div class="span4"> <fieldset id="fields-when" class="row"> <?php echo Form::control_group(Form::input('stamp_begin[date]', is_numeric($this->event->stamp_begin) ? Date::format('DMYYYY', $this->event->stamp_begin) : $this->event->stamp_begin, array('class' => 'date', 'maxlength' => 10, 'placeholder' => 'd.m.yyyy')), array('stamp_begin[date]' => __('Date')), Arr::get($this->event_errors, 'stamp_begin'), null, array('class' => 'span1')); ?> <?php echo Form::control_group(Form::select('stamp_begin[time]', array_reverse(Date::hours_minutes(30, true)), is_numeric($this->event->stamp_begin) ? Date::format('HHMM', $this->event->stamp_begin) : (empty($this->event->stamp_begin) ? '22:00' : $this->event->stamp_begin), array('class' => 'time')), array('stamp_begin[time]' => __('From')), Arr::get($this->event_errors, 'stamp_begin'), null, array('class' => 'span1')); ?> <?php echo Form::control_group(Form::select('stamp_end[time]', Date::hours_minutes(30, true), is_numeric($this->event->stamp_end) ? Date::format('HHMM', $this->event->stamp_end) : (empty($this->event->stamp_end) ? '04:00' : $this->event->stamp_end), array('class' => 'time')), array('stamp_end[time]' => __('To')), Arr::get($this->event_errors, 'stamp_end'), null, array('class' => 'span1')); ?> </fieldset> <?php echo Form::control_group(Form::input('homepage', $this->event->homepage, array('class' => 'input-block-level', 'placeholder' => 'http://')), array('homepage' => __('Homepage')), Arr::get($this->event_errors, 'homepage')); ?> <fieldset id="fields-venue"> <legend> <?php echo Form::control_group('<label class="checkbox">' . Form::checkbox('venue_hidden', 'true', (bool) $this->event->venue_hidden, array('id' => 'field-ug')) . ' ' . __('Underground') . '</label>', null, null, null, array('class' => 'span2')); ?> <?php echo __('Venue'); ?> </legend> <?php echo Form::control_group(Form::input('venue_name', $this->event->venue_name, (bool) $this->event->venue_hidden ? array('class' => 'input-block-level', 'disabled' => 'disabled') : array('class' => 'input-block-level')), array('venue_name' => __('Venue')), Arr::get($this->event_errors, 'venue_name'), null, array('id' => 'group-venue')); ?> <?php echo Form::control_group(Form::input('city_name', $this->event->city_name, array('class' => 'input-block-level')), array('city_name' => __('City')), Arr::get($this->event_errors, 'city_name')); ?> </fieldset> <fieldset id="fields-tickets"> <legend> <?php echo Form::control_group('<label class="checkbox">' . Form::checkbox('free', 'true', $this->event->price === '0.00', array('id' => 'field-free')) . ' ' . __('Free entry') . '</label>', null, null, null, array('class' => 'span2')); ?> <?php echo __('Tickets'); ?> </legend> <?php echo Form::control_group('<div class="input-append">' . Form::input('price', $this->event->price, $this->event->price === '0.00' ? array('class' => 'input-mini', 'disabled' => 'disabled') : array('class' => 'input-mini')) . '<span class="add-on">€</span>' . '</div>', array('price' => __('Tickets')), Arr::get($this->event_errors, 'price'), null, array('id' => 'group-price')); ?> <?php echo Form::control_group('<div class="input-append">' . Form::input('age', $this->event->age, array('class' => 'input-mini')) . '<span class="add-on">years</span>' . '</div>', array('age' => __('Age limit')), Arr::get($this->event_errors, 'age')); ?> </fieldset> <fieldset id="fields-music"> <legend><?php echo __('Music'); ?> </legend> <?php echo Form::checkboxes_wrap('tag', $this->tags(), $this->event->tags(), null, $this->event_errors, null, 'block-grid three-up'); ?> </fieldset> </div> <?php echo Form::close(); echo $this->javascript(); return ob_get_clean(); }