<?php echo Form::label($field_id . '-wait', __('Wait'), array('title' => __('Wait'))); ?> <?php } ?> </li> <?php } ?> <?php if ($pending) { echo '<li class="unit size1of1">' . Form::radios_wrap('all', $approve ? array('approve' => __('Approve'), 'deny' => __('Deny'), 'wait' => __('Wait')) : array('deny' => __('Delete'), 'wait' => __('Wait')), null, null, __('All images'), null, null, 'horizontal'); } ?> </ul> <?php if ($pending) { echo Form::csrf(); if ($approve) { echo HTML::icon_value(array(':images' => 0), __('Approved'), null, 'approve') . ' '; } echo HTML::icon_value(array(':images' => 0), $approve ? __('Denied') : __('Deleted'), null, 'deny') . ' '; echo HTML::icon_value(array(':images' => count($images)), __('Waiting'), null, 'wait') . '<br />'; echo Form::submit_wrap('approve', __('Save'), null, Route::get('galleries')->uri(array('action' => 'approval'))); echo Form::close(); echo HTML::script_source('
/** * Render view. * * @return string */ public function content() { ob_start(); $facebook = $this->consumer ? $this->load_facebook() : false; $tabs = array('basic' => '<i class="hidden-sm fa fa-fw fa-user"></i> ' . __('Profile'), 'auth' => '<i class="hidden-sm fa fa-fw fa-key"></i> ' . __('Username & Email'), 'facebook' => '<i class="hidden-sm fa fa-fw fa-facebook"></i> ' . 'Facebook', 'forum' => '<i class="hidden-sm fa fa-fw fa-comments"></i> ' . __('Forum')); echo Form::open(); ?> <?php if ($this->errors) { ?> <div class="alert alert-danger"> <strong><?php echo __('Error happens!'); ?> </strong> <ul> <?php foreach ((array) $this->errors as $error) { ?> <li><?php echo $error; ?> </li> <?php } ?> </ul> </div> <?php } ?> <ul class="nav nav-pills nav-stacked col-sm-2"> <?php foreach ($tabs as $tab => $title) { ?> <li<?php echo $tab == $this->tab ? ' class="active"' : ''; ?> > <a href="#settings-<?php echo $tab; ?> " data-toggle="tab"><?php echo $title; ?> </a> </li> <?php } ?> </ul> <div class="tab-content col-md-10"> <div id="settings-basic" class="tab-pane<?php echo $this->tab == 'basic' ? ' active' : ''; ?> "> <fieldset id="fields-basic" class="col-sm-6"> <div class="row"> <div class="col-sm-10"> <?php echo Form::input_wrap('avatar', $this->user->avatar_url, null, __('Avatar'), Arr::get($this->errors, 'avatar')); ?> </div> <div class="col-sm-2"> <?php echo HTML::avatar($this->user->avatar_url, null, null, false); ?> </div> </div> <?php echo Form::input_wrap('name', $this->user->name, null, __('Name'), Arr::get($this->errors, 'name')); ?> <?php echo Form::radios_wrap('name_visibility', array(Model_User::NAME_VISIBLE => __('Visible'), Model_User::NAME_HIDDEN => __('Hidden')), $this->user->setting('user.name'), null, null, null, null, true); ?> <?php echo Form::input_wrap('homepage', $this->user->homepage, null, __('Homepage'), Arr::get($this->errors, 'homepage')); ?> <?php echo Form::radios_wrap('gender', array('f' => '<i class="fa fa-female female"></i> ' . __('Female'), 'm' => '<i class="fa fa-male male"></i> ' . __('Male'), 'o' => __('Other')), $this->user->gender, null, __('Gender'), Arr::get($this->errors, 'gender'), null, true); ?> <?php echo Form::input_wrap('dob', $this->user->dob ? Date::format('DMYYYY', $this->user->dob) : null, array('class' => 'date', 'maxlength' => 10, 'size' => 7, 'placeholder' => 'd.m.yyyy'), __('Date of Birth'), Arr::get($this->errors, 'dob')); ?> <?php echo Form::radios_wrap('dob_visibility', array(Model_User::DOB_VISIBLE => __('Visible'), Model_User::DOB_DATEONLY => __('Date only in profile'), Model_User::DOB_HIDDEN => __('Hidden')), $this->user->setting('user.dob'), null, null, null, null, true); ?> </fieldset> <fieldset id="fields-location" class="col-md-6"> <?php echo Form::input_wrap('location', $this->user->location, null, __('Where you at?'), Arr::get($this->errors, 'location'), __('e.g. <em>"Helsinki"</em> or <em>"Asema-aukio, Helsinki"</em>')); ?> <?php echo Form::input_wrap('city_name', $this->user->city_name, null, __('City'), Arr::get($this->errors, 'city_name')); ?> <div id="map"></div> </fieldset> </div> <div id="settings-auth" class="tab-pane<?php echo $this->tab == 'auth' ? ' active' : ''; ?> "> <fieldset id="fields-basic" class="col-md-6"> <?php echo Form::input_wrap('username', $this->user->username, array('required', 'placeholder' => __('Required')), __('Username'), Arr::get($this->errors, 'username')); ?> <?php echo Form::input_wrap('email', $this->user->email, array('required', 'placeholder' => __('Required')), __('Email'), Arr::get($this->errors, 'email')); ?> <?php echo Form::password_wrap('password', null, array('placeholder' => __('Optional')), __('New password'), Arr::get($this->errors, 'password'), __('Size <em>does</em> matter - the longer, the better.')); ?> <?php echo Form::password_wrap('current_password', null, array('placeholder' => __('Required')), __('Current password'), Arr::get($this->errors, 'current_password'), __('For your protection we require your current password.')); ?> </fieldset> </div> <div id="settings-facebook" class="tab-pane<?php echo $this->tab == 'facebook' ? ' active' : ''; ?> "> <fieldset id="fields-connections" class="col-md-6"> <?php if (!$this->external || !$this->external->loaded()) { ?> <?php echo HTML::anchor(Route::url('oauth', array('action' => 'login', 'provider' => 'facebook')), '<i class="fa fa-facebook"></i> ' . __('Connect to Facebook'), array('class' => 'btn btn-primary btn-lg', 'title' => __('Connect with your Facebook account'))); ?> <?php } elseif (is_array($facebook)) { $avatar = 'https://graph.facebook.com/' . $facebook['id'] . '/picture'; ?> <div class="media"> <?php echo HTML::avatar($avatar, null, 'pull-left facebook', false); ?> <div class="media-body"> <?php echo HTML::anchor($facebook['link'], HTML::chars($facebook['name']), array('target' => '_blank')); ?> <?php echo Form::checkbox_wrap('avatar', $avatar, $this->user->avatar_url == $avatar, null, __('Set as your avatar')); ?> <?php echo Form::checkbox_wrap('picture', $avatar . '?type=large', $this->user->picture == $avatar . '?type=large', null, __('Set as your profile image')); ?> <?php echo HTML::anchor(Route::url('oauth', array('action' => 'disconnect', 'provider' => 'facebook')), '<i class="icon-facebook"></i> ' . __('Disconnect your Facebook account'), array('class' => 'btn btn-danger facebook-delete', 'title' => __('Disconnect your Facebook account'))); ?> </div> </div> <?php } elseif ($facebook) { ?> <?php echo $facebook; ?> <?php echo HTML::anchor(Route::url('oauth', array('action' => 'disconnect', 'provider' => 'facebook')), '<i class="icon-facebook"></i> ' . __('Disconnect your Facebook account'), array('class' => 'btn btn-danger facebook-delete', 'title' => __('Disconnect your Facebook account'))); ?> <?php } ?> </fieldset> </div> <div id="settings-forum" class="tab-pane<?php echo $this->tab == 'forum' ? ' active' : ''; ?> "> <fieldset id="fields-forum" class="col-md-6"> <?php echo Form::input_wrap('title', $this->user->title, null, __('Title'), Arr::get($this->errors, 'title')); ?> <?php echo Form::textarea_wrap('signature', $this->user->signature, array('class' => 'monospace', 'rows' => 5), true, __('Signature'), Arr::get($this->errors, 'signature')); ?> </fieldset> </div> </div> <div class="row"> <fieldset class="col-xs-12 text-center"> <br> <?php echo Form::hidden('latitude', $this->user->latitude); ?> <?php echo Form::hidden('longitude', $this->user->longitude); ?> <?php echo Form::csrf(); ?> <?php echo Form::button('save', __('Save'), array('type' => 'submit', 'class' => 'btn btn-success btn-lg')); ?> <?php echo HTML::anchor(URL::user($this->user), __('Cancel'), array('class' => 'cancel')); ?> </fieldset> </div> <?php echo Form::close(); echo $this->javascript(); return ob_get_clean(); }
<?php echo Form::radios_wrap($name, array($true => $label_true, $false => $label_false), $value ? $true : $false, $attributes + Form::attributes($field), isset($label) ? $label : '', isset($errors) ? $errors : '', isset($tip) ? $tip : '', 'horizontal');
<?php echo isset($input) && $input == 'radio' ? Form::radios_wrap($name, $choices, $value, $attributes + Form::attributes($field), isset($label) ? $label : '', isset($errors) ? $errors : '', isset($tip) ? $tip : '') : Form::select_wrap($name, $choices, $value, $attributes + Form::attributes($field), isset($label) ? $label : '', isset($errors) ? $errors : '', isset($tip) ? $tip : '');
/** * Render view. * * @return string */ public function content() { ob_start(); echo Form::open(null, array('class' => 'row')); ?> <div class="span4"> <fieldset id="fields-basic"> <legend><?php echo __('Basic information'); ?> </legend> <?php echo Form::control_group(Form::input('name', $this->user->name, array('class' => 'input-large')), array('name' => __('Name')), Arr::get($this->errors, 'name')); ?> <?php echo Form::control_group(Form::input('email', $this->user->email, array('class' => 'input-large')), array('email' => __('Email')), Arr::get($this->errors, 'email')); ?> <?php echo Form::control_group(Form::input('homepage', $this->user->homepage, array('class' => 'input-large')), array('homepage' => __('Homepage')), Arr::get($this->errors, 'homepage')); ?> <?php echo Form::radios_wrap('gender', array('f' => __('Female'), 'm' => __('Male')), $this->user, null, __('Gender'), $this->errors); ?> <?php echo Form::control_group(Form::input('dob', Date::format('DMYYYY', $this->user->dob), array('class' => 'date input-small', 'maxlengt' => 10, 'placeholder' => __('d.m.yyyy'))), array('dob' => __('Date of Birth')), Arr::get($this->errors, 'dob')); ?> <?php echo Form::control_group(Form::input('title', $this->user->title, array('class' => 'input-large')), array('title' => __('Title')), Arr::get($this->errors, 'title')); ?> <?php echo Form::control_group(Form::textarea('description', $this->user->description, array('class' => 'input-large', 'rows' => 3), true), array('description' => __('Description')), Arr::get($this->errors, 'description')); ?> </fieldset> </div> <div class="span4"> <fieldset id="fields-contact"> <legend><?php echo __('Contact information'); ?> </legend> <?php echo Form::control_group(Form::input('address_street', $this->user->address_street), array('address_street' => __('Street address')), Arr::get($this->errors, 'address_street')); ?> <?php echo Form::control_group(Form::input('address_zip', $this->user->address_zip), array('address_zip' => __('Zip code')), Arr::get($this->errors, 'address_zip')); ?> <?php echo Form::control_group(Form::input('address_city', $this->user->address_city), array('address_city' => __('City')), Arr::get($this->errors, 'address_city')); ?> </fieldset> <fieldset id="fields-forum"> <legend><?php echo __('Forum settings'); ?> </legend> <?php echo Form::control_group(Form::textarea('signature', $this->user->signature, array('class' => 'input-large', 'rows' => 5), true), array('signature' => __('Signature')), Arr::get($this->errors, 'signature')); ?> </fieldset> </div> <fieldset class="span8 form-actions"> <?php echo Form::hidden('latitude', $this->user->latitude); ?> <?php echo Form::hidden('longitude', $this->user->longitude); ?> <?php echo Form::csrf(); ?> <?php echo Form::button('save', __('Save'), array('type' => 'submit', 'class' => 'btn btn-success btn-large')); ?> <?php echo HTML::anchor(URL::user($this->user), __('Cancel'), array('class' => 'cancel')); ?> </fieldset> <?php echo Form::close(); echo $this->javascript(); return ob_get_clean(); }
/** * Render view. * * @return string */ public function content() { ob_start(); // Get shown images if ($this->show_pending) { // Show pending images $images = $this->gallery->find_images_pending($this->can_approve ? null : self::$_user); $radios = array(); if ($this->can_approve) { $radios['approve'] = __('Approve'); } $radios['deny'] = $this->can_approve ? __('Deny') : __('Delete'); $radios['wait'] = __('Wait'); ?> <header class="well sticky"> <?php if ($this->can_approve) { echo __('Approve'), ': <var class="approve"">0</var>, '; echo __('Deny'), ': <var class="deny"">0</var>, '; } else { echo __('Delete'), ': <var class="deny"">0</var>, '; } echo __('Wait'), ': <var class="wait">', count($images), '</var><br />'; ?> </header> <?php } else { // Show approved images $images = $this->gallery->images(); } // Add pending images form? if ($this->show_pending) { echo Form::open(null, array('id' => 'form-image-approval', 'class' => 'form-horizontal')); } $copyright = $multiple = null; foreach ($images as $image) { // Add copyright if ($image->author_id != $copyright) { $copyright = $image->author_id; if ($multiple) { // Not first copyright ?> </ul> <?php } else { // First copyright $multiple = true; } ?> <header>© <?php echo HTML::user($copyright); ?> </header> <ul class="thumbnails"> <?php } // Copyright ?> <li class="span2"> <?php echo HTML::anchor(Route::url('gallery_image', array('gallery_id' => Route::model_id($this->gallery), 'id' => $image->id, 'action' => $this->show_pending ? 'approve' : '')), HTML::image($image->get_url('thumbnail', $this->gallery->dir)), $image->description ? array('class' => 'thumbnail', 'title' => HTML::chars($image->description)) : array('class' => 'thumbnail')); if (!$this->show_pending) { // Info echo '<i class="icon-comment icon-white"></i> ' . (int) $image->comment_count; echo '<i class="icon-eye-open icon-white"></i> ' . (int) $image->view_count; } else { // Pending image form echo Form::radios_wrap('image_id[' . $image->id . ']', $radios, 'wait'); } ?> </li> <?php } // Images ?> </ul> <?php // Form controls if ($this->show_pending) { ?> <fieldset class="form-actions"> <?php echo Form::radios_wrap('all', $radios, null, null, __('For all images'), null, null, 'inline'); echo Form::csrf(); echo Form::button('approve', __('Save'), array('type' => 'submit', 'class' => 'btn btn-success btn-large')), ' '; echo HTML::anchor(Route::url('galleries', array('action' => 'approval')), __('Cancel'), array('class' => 'cancel')); ?> </fieldset> <?php echo Form::close(); ?> <script> head.ready('jquery', function() { // Calculate totals function totals() { $.each([ 'approve', 'deny', 'wait' ], function totals() { $('var.' + this).text($('input[name!=all][value=' + this + ']:checked').length); }); } // Actions for all images $('form input[name=all]').change(function onChangeAll() { $('form input[value=' + $(this).val() + ']').attr('checked', 'checked'); totals(); }); // Single image actions $('form input[name^=image_id]').change(function onChangeOne() { $('input[name=all]').removeAttr('checked'); totals(); }); }); </script> <?php } return ob_get_clean(); }
* @license http://www.opensource.org/licenses/mit-license.php MIT license */ echo Form::open(); ?> <fieldset id="fields-basic"> <legend><?php echo __('Basic information'); ?> </legend> <ul> <?php echo Form::input_wrap('name', $user, null, __('Name'), $errors); ?> <?php echo Form::radios_wrap('gender', array('f' => __('Female'), 'm' => __('Male')), $user, null, __('Gender'), $errors); ?> <?php echo Form::input_wrap('dob', Date::format('DMYYYY', $user->dob), array('class' => 'date', 'maxlength' => 10), __('Date of Birth'), $errors); ?> <?php echo Form::input_wrap('title', $user, null, __('Title'), $errors); ?> <?php echo Form::textarea_wrap('description', $user, null, true, __('Description'), $errors); ?> </ul> </fieldset> <fieldset id="fields-contact"> <legend><?php
* @copyright (c) 2011 Antti Qvickström * @license http://www.opensource.org/licenses/mit-license.php MIT license */ $tabindex = 0; echo Form::open(null, array('id' => 'form-topic-edit')); ?> <fieldset id="fields-topic"> <ul> <?php echo Form::input_wrap('name', $topic, array('tabindex' => ++$tabindex), __('Topic'), $errors); ?> <?php if (!$post && $admin) { echo Form::select_wrap('status', array(Model_Forum_Topic::STATUS_NORMAL => __('Normal'), Model_Forum_Topic::STATUS_SINK => __('Sink'), Model_Forum_Topic::STATUS_LOCKED => __('Locked')), $topic, array('tabindex' => ++$tabindex), __('Status'), $errors); echo Form::radios_wrap('sticky', array(0 => __('Normal'), 1 => __('Sticky')), $topic->sticky, null, __('Sticky'), $errors); } ?> <?php if ($private) { echo Form::textarea_wrap('recipients', $recipients, array('rows' => 3, 'placeholder' => __('Required'), 'tabindex' => ++$tabindex), null, __('Recipients'), $errors); } ?> </ul> </fieldset> <?php if ($post) { ?> <fieldset id="fields-post"> <ul>
/** * Render view. * * @return string */ public function content() { ob_start(); // Create form attributes $attributes = array('class' => 'media'); if ($this->form_id) { $attributes['id'] = $this->form_id; } $button = __('Save'); $author = Visitor::$user; 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')); $author = $this->forum_post->author(); 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 = Visitor::$user->has_role(array('admin', 'moderator', 'forum moderator')); if ($is_admin) { // Build available areas list $areas = array(); foreach (Model_Forum_Group::factory()->find_all() as $_group) { $areas[$_group->name] = array(); foreach ($_group->areas() as $_area) { $areas[$_group->name][$_area->id] = $_area->name; } } ?> <div class="panel panel-danger"> <header class="panel-heading"><?php echo __('Admin tools'); ?> </header> <fieldset class="form-horizontal panel-body"> <div class="col-md-6"> <?php echo Form::radios_wrap('sticky', array(Model_Forum_Topic::STICKY_NORMAL => __('Normal'), Model_Forum_Topic::STICKY_STICKY => '<i class="fa fa-thumb-tack text-warning"></i> ' . __('Pinned')), (int) $this->forum_topic->sticky, array('class' => 'radios'), __('Pinning'), Arr::get($this->errors, 'sticky'), null, true); ?> </div> <div class="col-md-6"> <?php echo Form::radios_wrap('status', array(Model_Forum_Topic::STATUS_NORMAL => __('Normal'), Model_Forum_Topic::STATUS_SINK => '<i class="fa fa-unlock text-muted"></i> ' . __('Sink'), Model_Forum_Topic::STATUS_LOCKED => '<i class="fa fa-lock text-muted"></i> ' . __('Locked')), (int) $this->forum_topic->status, array('class' => 'radios'), __('Status'), Arr::get($this->errors, 'status'), null, true); ?> </div> <div class="col-md-12"> <?php if (!$this->private) { echo Form::select_wrap('forum_area_id', $areas, $this->forum_topic->forum_area_id, null, __('Area'), Arr::get($this->errors, 'forum_area_id')); } ?> </div> </fieldset> </div> <?php } // admin ?> <?php echo Form::input_wrap('name', $this->forum_topic->name, null, __('Topic'), Arr::get($this->errors, 'name')); ?> <?php if ($this->private) { echo Form::textarea_wrap('recipients', $this->recipients, array('rows' => 3, 'placeholder' => __('Required')), true, __('Recipients'), Arr::get($this->errors, 'recipients')); } ?> <?php if ($this->mode === self::EDIT_TOPIC && !$is_admin) { ?> <fieldset> <?php echo Form::button('save', $button, array('type' => 'submit', 'class' => 'btn btn-success btn-large')); ?> <?php echo Form::button('preview', __('Preview'), array('class' => 'btn btn-default btn-large')); ?> <?php echo $this->cancel ? HTML::anchor($this->cancel, __('Cancel'), array('class' => 'cancel')) : ''; ?> <?php echo Form::csrf(); ?> </fieldset> <?php break; } // Replying to a topic // Replying to a topic case self::REPLY: case self::QUOTE: ?> <div class="pull-left"> <?php echo HTML::avatar(Visitor::$user->avatar_url, Visitor::$user->username); ?> </div> <?php // Editing old post // Editing old post case self::EDIT_POST: ?> <div class="post-edit media-body panel panel-success form-vertical"> <header class="panel-heading"> <?php echo $author ? HTML::user($author) : HTML::chars($this->forum_post->author_name); ?> </header> <fieldset class="panel-body"> <?php echo Form::textarea_wrap('post', $this->forum_post->post, array('id' => uniqid()), true, null, Arr::get($this->errors, 'post'), null, true); ?> </fieldset> <fieldset class="panel-body"> <?php echo Form::button('save', $button, array('type' => 'submit', 'class' => 'btn btn-success btn-large')); ?> <?php echo Form::button('preview', __('Preview'), array('class' => 'btn btn-default btn-large')); ?> <?php echo $this->cancel ? HTML::anchor($this->cancel, __('Cancel'), array('class' => 'cancel')) : ''; ?> <?php echo Form::csrf(); ?> </fieldset> </div> <?php } ?> <?php echo Form::close(); // Auto-complete recipients if ($this->private) { ?> <script> head.ready('anqh', function() { $('textarea[name=recipients]').autocompleteUser({ user: <?php echo Visitor::$user->id; ?> , maxUsers: 100 }); }); </script> <?php } return ob_get_clean(); }