/** * 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(); if (self::$_request_type == Controller::REQUEST_AJAX) { $cancel_attributes = array('class' => 'ajaxify'); } else { $cancel_attributes = null; } echo Form::open($this->action, array('enctype' => 'multipart/form-data')); ?> <fieldset> <?php echo Form::file('file'); ?> </fieldset> <fieldset> <?php echo Form::csrf(); ?> <?php echo Form::button('save', '<i class="icon-upload icon-white"></i> ' . __('Upload'), array('type' => 'submit', 'class' => 'btn btn-primary btn-small')); ?> <?php echo $this->cancel ? HTML::anchor($this->cancel, __('Cancel'), $cancel_attributes) : ''; ?> </fieldset> <?php echo Form::close(); return ob_get_clean(); }
/** * Render view. * * @return string */ public function content() { ob_start(); $gallery = $this->image->gallery(); echo Form::open(Route::url('gallery_image', array('gallery_id' => Route::model_id($gallery), 'id' => $this->image->id, 'action' => 'report')), array('class' => Request::current()->is_ajax() ? 'ajaxify' : '')); ?> <fieldset> <?php echo Form::control_group(Form::input('reason', null, array('class' => 'input-block-level')), array('name' => __('Reason')), null, __('You can enter an optional reason for reporting this image, e.g. why it should be removed')); ?> </fieldset> <fieldset class="form-actions"> <?php echo Form::button('save', __('Report'), array('type' => 'submit', 'class' => 'btn btn-danger btn-large')); ?> <?php echo Request::current()->is_ajax() ? '' : HTML::anchor(Route::url('gallery_image', array('gallery_id' => Route::model_id($gallery), 'id' => $this->image->id, 'action' => '')), __('Cancel'), array('class' => 'cancel')); ?> <?php echo Form::csrf(); ?> </fieldset> <?php return ob_get_clean(); }
/** * Render view. * * @return string */ public function content() { ob_start(); echo Form::open(); ?> <fieldset> <?php echo Form::input_wrap('name', $this->blog_entry->name, array('class' => 'input-lg', 'placeholder' => __('Title')), null, Arr::get($this->errors, 'name')); ?> <?php echo Form::textarea_wrap('content', $this->blog_entry->content, array('class' => 'input-lg', 'placeholder' => __('Content')), true, null, Arr::get($this->errors, 'content'), null, true); ?> </fieldset> <fieldset> <?php echo Form::csrf(); ?> <?php echo Form::button('save', __('Save'), array('type' => 'submit', 'class' => 'btn btn-primary btn-lg')); ?> <?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(); echo Form::open(); ?> <div class="row"> <fieldset class="col-sm-6"> <?php echo Form::input_wrap('name', $this->name, null, __('Name'), Arr::get($this->errors, 'name')); ?> <?php echo Form::input_wrap('email', $this->email, array('type' => 'email'), __('Email'), Arr::get($this->errors, 'email')); ?> <?php echo Form::input_wrap('subject', $this->subject, null, __('Subject'), Arr::get($this->errors, 'subject')); ?> <?php echo Form::textarea_wrap('content', $this->content, null, true, __('Content'), Arr::get($this->errors, 'content')); ?> </fieldset> </div> <fieldset> <?php echo Form::csrf(); ?> <?php echo Form::button('save', __('Send'), array('type' => 'submit', 'class' => 'btn btn-primary btn-lg')); ?> </fieldset> <?php echo Form::close(); return ob_get_clean(); }
/** * Render view. * * @return string */ public function content() { ob_start(); echo Form::open(); ?> <fieldset> <?php echo Form::input_wrap('name', $this->group->name, null, __('Name'), Arr::get($this->errors, 'name')); ?> <?php echo Form::input_wrap('description', $this->group->description, null, __('Description'), Arr::get($this->errors, 'description')); ?> <?php echo Form::input_wrap('sort', $this->group->sort, null, __('Sort'), Arr::get($this->errors, 'sort')); ?> </fieldset> <fieldset> <?php echo Form::button('save', __('Save'), array('type' => 'submit', 'class' => 'btn btn-success btn-large')); ?> <?php echo HTML::anchor(Request::back(Route::url('forum'), true), __('Cancel'), array('class' => 'cancel')); ?> <?php echo Form::csrf(); ?> </fieldset> <?php echo Form::close(); return ob_get_clean(); }
/** * Render view. * * @return string */ public function content() { ob_start(); // Build available groups list $groups = array(); foreach (Model_Forum_Group::factory()->find_all() as $_group) { $groups[$_group->id] = $_group->name; } echo Form::open(); ?> <fieldset> <?php echo Form::control_group(Form::select('forum_group_id', $groups, $this->area->id), array('forum_group_id' => __('Group')), Arr::get($this->errors, 'forum_group_id')); ?> <?php echo Form::control_group(Form::input('name', $this->area->name), array('name' => __('Name')), Arr::get($this->errors, 'name')); ?> <?php echo Form::control_group(Form::input('description', $this->area->description), array('description' => __('Description')), Arr::get($this->errors, 'description')); ?> <?php echo Form::control_group(Form::input('sort', $this->area->sort, array('class' => 'input-mini')), array('sort' => __('Sort')), Arr::get($this->errors, 'sort')); ?> </fieldset> <fieldset> <legend><?php echo __('Settings'); ?> </legend> <?php echo Form::control_group(Form::select('access_read', array(Model_Forum_Area::READ_NORMAL => __('Everybody'), Model_Forum_Area::READ_MEMBERS => __('Members only')), $this->area->access_read), array('access_read' => __('Read access')), Arr::get($this->errors, 'access_read')); ?> <?php echo Form::control_group(Form::select('access_write', array(Model_Forum_Area::WRITE_NORMAL => __('Members'), Model_Forum_Area::WRITE_ADMINS => __('Admins only')), $this->area->access_write), array('access_write' => __('Write access')), Arr::get($this->errors, 'access_write')); ?> <?php echo Form::control_group(Form::select('type', array(Model_Forum_Area::TYPE_NORMAL => __('Normal'), Model_Forum_Area::TYPE_BIND => __('Bind, topics bound to content')), $this->area->type), array('type' => __('Type')), Arr::get($this->errors, 'type')); ?> <?php echo Form::control_group(Form::select('bind', array('' => __('None')) + Model_Forum_Area::get_binds(), $this->area->bind), array('bind' => __('Bind config')), Arr::get($this->errors, 'bind')); ?> <?php echo Form::control_group(Form::select('status', array(Model_Forum_Area::STATUS_NORMAL => __('Normal'), Model_Forum_Area::STATUS_HIDDEN => __('Hidden')), $this->area->status), array('status' => __('Status')), Arr::get($this->errors, 'status')); ?> </fieldset> <fieldset class="form-actions"> <?php echo Form::button('save', __('Save'), array('type' => 'submit', 'class' => 'btn btn-success btn-large')); ?> <?php echo HTML::anchor(Request::back(Route::url('forum_group'), true), __('Cancel'), array('class' => 'cancel')); ?> <?php echo Form::csrf(); ?> </fieldset> <?php echo Form::close(); return ob_get_clean(); }
<?php if ($model) { echo $model->input($name, 'form/anqh', $field + array('errors' => Arr::get($form, 'errors'))); } ?> <?php } ?> </ul> </fieldset> <?php } ?> <fieldset> <?php echo Form::csrf(Arr::path($form, 'csrf.id'), Arr::path($form, 'csrf.action')); ?> <?php if (!isset($form['save']) || $form['save'] !== false) { echo Form::submit_wrap('save', Arr::path($form, 'save.label', __('Save')), Arr::path($form, 'save.attributes'), Arr::get($form, 'cancel'), $cancel_attributes, Arr::get($form, 'hidden')); } ?> </fieldset> <?php echo Form::close();
/** * Render view. * * @return string */ public function content() { ob_start(); echo Form::open(null, array('id' => 'form-venue', 'class' => 'row')); ?> <div class="span8"> <fieldset> <?php echo Form::control_group(Form::input('name', $this->venue->name, array('class' => 'input-block-level')), array('name' => __('Venue')), Arr::get($this->errors, 'name')); ?> <?php echo Form::control_group(Form::input('homepage', $this->venue->homepage, array('class' => 'input-block-level')), array('homepage' => __('Homepage')), Arr::get($this->errors, 'homepage')); ?> <?php echo Form::control_group(Form::input('description', $this->venue->description, array('class' => 'input-block-level')), array('description' => __('Short description')), Arr::get($this->errors, 'description')); ?> <?php echo Form::control_group(Form::textarea('hours', $this->venue->hours, array('class' => 'input-block-level'), true), array('hours' => __('Opening hours')), Arr::get($this->errors, 'hours')); ?> <?php echo Form::control_group(Form::textarea('info', $this->venue->info, array('class' => 'input-block-level'), true), array('info' => __('Other information')), Arr::get($this->errors, 'info')); ?> </fieldset> <fieldset class="form-actions"> <?php echo Form::hidden('city_id', $this->venue->city_id); ?> <?php echo Form::hidden('latitude', $this->venue->latitude); ?> <?php echo Form::hidden('longitude', $this->venue->longitude); ?> <!--<?php echo Form::hidden('foursquare_id', $this->venue->foursquare_id); ?> --> <!--<?php echo Form::hidden('foursquare_category_id', $this->venue->foursquare_category_id); ?> --> <?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> </div> <div class="span4"> <fieldset id="fields-location"> <?php echo Form::control_group(Form::input('city_name', $this->venue->city_name, array('class' => 'input-block-level')), array('city_name' => __('City')), Arr::get($this->errors, 'city_name')); ?> <?php echo Form::control_group(Form::input('address', $this->venue->address, array('class' => 'input-block-level')), array('address' => __('Address')), Arr::get($this->errors, 'address')); ?> </fieldset> </div> <?php echo Form::close(); ?> <script> head.ready('anqh', function() { $('#fields-location').append('<div id="map"><?php echo __('Loading map..'); ?> </div>'); var loader; function initMap() { if ('maps' in google && 'Geocoder' in google.maps) { clearTimeout(loader); } else { loader = setTimeout(initMap, 500); return; } $('#map').googleMap(<?php echo $this->venue->latitude ? json_encode(array('marker' => true, 'lat' => $this->venue->latitude, 'long' => $this->venue->longitude)) : ''; ?> ); } initMap(); $('input[name=city_name]').autocompleteGeo(); $('input[name=address], input[name=city_name]').on('blur', function geoCode(event) { var address = $("input[name=address]").val() , city = $("input[name=city_name]").val(); if (city != '') { var geocode = city; if (address != '') { geocode = address + ", " + geocode; } Anqh.geocoder.geocode({ address: geocode }, function geoCoded(results, status) { if (status == google.maps.GeocoderStatus.OK && results.length) { Anqh.map.setCenter(results[0].geometry.location); $('input[name=latitude]').val(results[0].geometry.location.lat()); $('input[name=longitude]').val(results[0].geometry.location.lng()); var marker = new google.maps.Marker({ position: results[0].geometry.location, map: Anqh.map }); } }); } }); }); </script> <?php return ob_get_clean(); }
/** * Date select form. * * @return string */ public function date() { ob_start(); // Date picker options $options = array('changeMonth' => true, 'changeYear' => true, 'dateFormat' => 'd.m.yy', 'dayNames' => array(__('Sunday'), __('Monday'), __('Tuesday'), __('Wednesday'), __('Thursday'), __('Friday'), __('Saturday')), 'dayNamesMin' => array(__('Su'), __('Mo'), __('Tu'), __('We'), __('Th'), __('Fr'), __('Sa')), 'firstDay' => 1, 'monthNames' => array(__('January'), __('February'), __('March'), __('April'), __('May'), __('June'), __('July'), __('August'), __('September'), __('October'), __('November'), __('December')), 'monthNamesShort' => array(__('Jan'), __('Feb'), __('Mar'), __('Apr'), __('May'), __('Jun'), __('Jul'), __('Aug'), __('Sep'), __('Oct'), __('Nov'), __('Dec')), 'nextText' => __('»'), 'prevText' => __('«'), 'showWeek' => true, 'showOtherMonths' => true, 'weekHeader' => __('Wk')); // Form echo Form::open(null, array('id' => 'form-flyer-edit', 'class' => 'form-inline')); echo Form::input_wrap('name', $this->flyer->name, array('id' => 'field-unknown-event', 'class' => 'input-xxlarge', 'title' => __('Clean event name'), 'placeholder' => __('Clean event name')), __('Event')) . ' '; echo Form::input_wrap('stamp_begin[date]', is_numeric($this->flyer->stamp_begin) ? Date::format('DMYYYY', $this->flyer->stamp_begin) : $this->flyer->stamp_begin, array('id' => 'field-date', 'class' => 'input-small date', 'maxlength' => 10), __('Date')) . ' '; echo Form::select_wrap('stamp_begin[time]', array_reverse(Date::hours_minutes(30, true), true), is_numeric($this->flyer->stamp_begin) ? Date::format('HHMM', $this->flyer->stamp_begin) : (empty($this->flyer->stamp_begin) ? '22:00' : $this->flyer->stamp_begin), array('id' => 'field-time', 'class' => 'input-small time'), __('At')) . ' '; echo Form::submit('save', __('Save'), array('class' => 'btn btn-default')); echo Form::csrf(); echo Form::close(); ?> <script> head.ready('jquery-ui', function() { $('#field-date').datepicker(<?php echo json_encode($options); ?> ); }); </script> <?php return ob_get_clean(); }
/** * Get edit form. * * @return string */ public function form() { ob_start(); // Map options $options = array('marker' => HTML::chars($this->venue->name), 'infowindow' => HTML::chars($this->venue->address) . '<br />' . HTML::chars($this->venue->city_name), 'lat' => $this->venue->latitude, 'long' => $this->venue->longitude); // Form echo Form::open(Route::url('venue', array('id' => Route::model_id($this->venue), 'action' => 'foursquare')), array('id' => 'form-foursquare-link', 'style' => 'display: none')); ?> <fieldset> <?php echo Form::control_group(Form::input('city_name', $this->venue->city_name, array('class' => 'input-large')), array('city_name' => __('City'))); ?> <?php echo Form::control_group(Form::input('name', $this->venue->name, array('class' => 'input-large', 'placeholder' => __('Fill city first'))), array('name' => __('Name'))); ?> <?php echo Form::control_group(Form::input('address', $this->venue->address, array('class' => 'input-large', 'placeholder' => __('Fill venue first'))), array('address' => __('Address'))); ?> <?php echo Form::control_group(Form::input('foursquare_id', $this->venue->foursquare_id, array('class' => 'input', 'readonly' => 'readonly')), array('foursquare_id' => __('Foursquare ID'))); ?> <?php echo Form::control_group(Form::input('foursquare_category_id', $this->venue->foursquare_category_id, array('class' => 'input', 'readonly' => 'readonly')), array('foursquare_category_id' => __('Foursquare Category ID'))); ?> </fieldset> <fieldset> <?php echo Form::hidden('latitude', Arr::pick($this->venue->latitude, $this->venue->city ? $this->venue->city->latitude : 0)); ?> <?php echo Form::hidden('longitude', Arr::pick($this->venue->longitude, $this->venue->city ? $this->venue->city->longitude : 0)); ?> <?php echo Form::csrf(); ?> <?php echo Form::button('save', __('Link'), array('type' => 'submit', 'class' => 'btn btn-success')); ?> </fieldset> <?php echo Form::close(); ?> <script> head.ready('anqh', function hookFoursquare() { $("#link-foursquare").on('click', function linkFoursquare(event) { event.preventDefault(); $(this).hide(); $('#foursquare .alert').hide(); $('#form-foursquare-link').show('fast'); $('#map').show('fast', function toggleMap() { $('#map').googleMap(<?php echo json_encode($options); ?> ); }); }); $('[name=city_name]:input').autocompleteGeo(); $('[name=name]:input').foursquareVenue({ venueId: 'foursquare_id', categoryId: 'foursquare_category_id', latitudeSearch: 'latitude', longitudeSearch: 'longitude' }); }); </script> <?php return ob_get_clean(); }
/** * Render content. * * @return string */ public function content() { ob_start(); ?> <div id="preview"></div> <?php echo Form::open(null, array('id' => 'form-event', 'class' => 'row')); ?> <div class="col-md-8"> <?php if ($this->event_errors || $this->venue_errors) { ?> <div class="alert alert-danger"> <strong><?php echo __('Error happens!'); ?> </strong> <ul class=""> <?php foreach ((array) $this->event_errors as $error) { ?> <li><?php echo $error; ?> </li> <?php } ?> <?php foreach ((array) $this->venue_errors as $error) { ?> <li><?php echo __('Venue'); ?> : <?php echo $error; ?> </li> <?php } ?> </ul> </div> <?php } ?> <fieldset id="fields-primary"> <?php echo Form::input_wrap('name', $this->event->name, array('class' => 'input-lg'), __('Name'), Arr::get($this->event_errors, 'name'), __("Please don't use dates in the name, looks nasty everywhere as the date is usually shown automagically.")); ?> <?php echo Form::textarea_wrap('info', $this->event->info, array('class' => 'input-lg', 'rows' => 20), true, __('Information'), Arr::get($this->event_errors, 'info'), __('Remember, only the first few rows are visible in the calendar view.'), true); ?> </fieldset> <fieldset> <?php echo Form::button('save', __('Save event'), array('type' => 'submit', 'class' => 'btn btn-success btn-lg')); ?> <?php echo Form::button('preview', __('Preview'), array('class' => 'btn btn-default btn-lg', 'data-content-class' => '*', 'data-prepend' => '#preview')); ?> <?php echo $this->cancel ? HTML::anchor($this->cancel, __('Cancel'), array('class' => 'cancel')) : ''; ?> <?php echo Form::csrf(); ?> <?php echo Form::hidden('latitude', $this->venue->latitude, array('data-geo' => 'lat')); ?> <?php echo Form::hidden('longitude', $this->venue->longitude, array('data-geo' => 'lng')); ?> <?php echo Form::hidden('city', $this->event->city_name, array('data-geo' => 'locality')); ?> <?php echo Form::hidden('venue_id', $this->venue->id); ?> <?php echo Form::hidden('foursquare_id', $this->venue->foursquare_id); ?> </fieldset> </div> <div class="col-md-4"> <fieldset id="fields-when" class="row form-inline"> <div class="col-md-3"> <?php echo Form::input_wrap('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, 'size' => 7, 'placeholder' => 'd.m.yyyy'), __('From'), Arr::Get($this->event_errors, 'stamp_begin')); ?> </div> <div class="col-md-3"> <?php echo Form::select_wrap('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'), ' ', Arr::get($this->event_errors, 'stamp_begin')); ?> </div> <div class="col-md-3"> <?php echo Form::select_wrap('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'), __('To'), Arr::get($this->event_errors, 'stamp_end')); ?> </div> <div class="col-md-3"> <?php echo Form::input_wrap('stamp_end[date]', is_numeric($this->event->stamp_end) ? Date::format('DMYYYY', $this->event->stamp_end) : $this->event->stamp_end, array('class' => 'date', 'maxlength' => 10, 'size' => 7, 'placeholder' => 'd.m.yyyy'), ' ', Arr::Get($this->event_errors, 'stamp_end')); ?> </div> </fieldset> <br> <fieldset id="fields-venue" class="row"> <div class="col-md-12"> <?php echo Form::input_wrap('city_name', $this->event->city_name, null, __('City'), Arr::get($this->event_errors, 'city_name')); ?> </div> <div class="col-md-7"> <?php echo Form::input_wrap('venue_name', $this->event->venue_name, (bool) $this->event->venue_hidden ? array('disabled') : null, __('Venue'), Arr::get($this->event_errors, 'venue_name')); ?> </div> <div class="col-md-5"> <br> <?php echo Form::checkbox_wrap('venue_hidden', 'true', (bool) $this->event->venue_hidden, array('id' => 'field-ug'), __('Underground')); ?> </div> <div class="col-md-12 venue-placeholder hidden"> <label><?php echo __('Venue'); ?> </label> <p> <span class="venue-name"><?php echo $this->event->venue_name; ?> </span>, <span class="venue-city"><?php echo $this->event->city_name; ?> </span> <a href="#venue"><?php echo __('Change'); ?> </a> </p> </div> </fieldset> <div id="map" class="well"></div> <fieldset> <?php if (!$this->event->flyer_id) { echo Form::input_wrap('flyer', $this->event->flyer_url, array('type' => 'url', 'placeholder' => 'http://'), __('Flyer'), $this->flyer_error, __('If you have the flyer only locally you can upload it after saving the event.')); } ?> <?php echo Form::input_wrap('url', $this->event->url, array('type' => 'url', 'placeholder' => 'http://'), __('Homepage'), Arr::get($this->event_errors, 'url')); ?> </fieldset> <fieldset id="fields-tickets" class="row"> <div class="col-md-4"> <?php echo Form::input_wrap('price', $this->event->price, $this->event->price === '0.00' ? array('disabled', 'type' => 'number', 'min' => 0, 'step' => 0.5) : array('type' => 'number', 'min' => 0, 'step' => 0.5), __('Tickets'), Arr::get($this->event_errors, 'tickets'), null, '€'); ?> </div> <div class="col-md-8"> <br> <?php echo Form::checkbox_wrap('free', 'true', $this->event->price === '0.00', array('id' => 'field-free'), __('Free entry')); ?> </div> <div class="col-md-12"> <?php echo Form::input_wrap('ticket_url', $this->event->ticket_url, array('placeholder' => 'http://'), __('Buy tickets from'), Arr::get($this->event_errors, 'ticket_url')); ?> </div> <div class="col-md-5"> <?php echo Form::input_wrap('age', $this->event->age, array('type' => 'number', 'min' => 0, 'max' => 50, 'maxlength' => 3), __('Age limit'), Arr::get($this->event_errors, 'age'), null, __('years')); ?> </div> </fieldset> <fieldset id="fields-music"> <?php echo Form::checkboxes_wrap('tag', $this->tags(), $this->event->tags(), array('class' => 'block-grid three-up'), __('Music'), $this->event_errors); ?> </fieldset> </div> <?php echo Form::close(); echo $this->javascript(); return ob_get_clean(); }
/** * Add link form. * * @return string */ public function form() { ob_start(); echo Form::open(null, array('id' => 'form-link', 'class' => 'collapse')); echo '<hr>'; echo Form::input_wrap('link', null, array('placeholder' => 'http://'), null, Arr::get($this->errors, 'link')); echo Form::button('save', __('Add link'), array('type' => 'submit', 'class' => 'btn btn-success')); echo Form::csrf(); echo Form::close(); return ob_get_clean(); }
/** * Render view. * * @return string */ public function content() { ob_start(); echo Form::open(null, array('id' => 'form-venue', 'class' => 'row')); ?> <div class="col-md-8"> <fieldset> <?php echo Form::input_wrap('name', $this->venue->name, array('class' => 'input-lg'), __('Venue'), Arr::get($this->errors, 'name')); ?> <?php echo Form::input_wrap('homepage', $this->venue->url, null, __('Homepage'), Arr::get($this->errors, 'homepage')); ?> <?php echo Form::input_wrap('description', $this->venue->description, null, __('Short description'), Arr::get($this->errors, 'description')); ?> <?php echo Form::textarea_wrap('hours', $this->venue->hours, null, true, __('Opening hours'), Arr::get($this->errors, 'hours')); ?> <?php echo Form::textarea_wrap('info', $this->venue->info, null, true, __('Other information'), Arr::get($this->errors, 'info')); ?> </fieldset> <fieldset> <?php echo Form::hidden('latitude', $this->venue->latitude, array('data-geo' => 'lat')); ?> <?php echo Form::hidden('longitude', $this->venue->longitude, array('data-geo' => 'lng')); ?> <?php echo Form::hidden('foursquare_id', $this->venue->foursquare_id); ?> <!--<?php echo Form::hidden('foursquare_category_id', $this->venue->foursquare_category_id); ?> --> <?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> </div> <div class="col-md-4"> <fieldset id="fields-location"> <?php echo Form::input_wrap('city_name', $this->venue->city_name, array('data-geo' => 'locality'), __('City'), Arr::get($this->errors, 'city_name')); ?> <?php echo Form::input_wrap('foursquare', $this->venue->foursquare_id ? $this->venue->name : null, null, '<i class="fa fa-foursquare"></i> ' . __('Foursquare Venue') . ' ' . ($this->venue->foursquare_id ? '<span class="text-success" title="' . $this->venue->foursquare_id . '">(' . __('Set') . ')</span>' : '<span class="text-warning">(' . __('Not set') . ')</span>')); ?> <?php echo Form::input_wrap('address', $this->venue->address, null, __('Address'), Arr::get($this->errors, 'address')); ?> </fieldset> </div> <?php echo Form::close(); ?> <script> head.ready('anqh', function() { $('#fields-location').append('<div id="map"><?php echo __('Loading map..'); ?> </div>'); var $city = $('input[name=city_name]'); $city.geocomplete({ map: '#map', details: '#form-venue', detailsAttribute: 'data-geo', location: <?php echo $this->venue->latitude ? '[ ' . $this->venue->latitude . ', ' . $this->venue->longitude . ' ]' : "'" . ($this->venue->city_name ? $this->venue->city_name : 'Helsinki') . "'"; ?> , types: [ '(cities)' ] }); var $latitude = $('input[name=latitude]'), $longitude = $('input[name=longitude]'), $address = $('input[name=address]') $('input[name=foursquare]') .on('typeahead:selected', function(event, selection, name) { var map = $city.geocomplete('map') , marker = $city.geocomplete('marker'); // Update form if (selection.foursquare_id) { $('input[name=foursquare_id]').val(selection.foursquare_id); } else { $('input[name=foursquare_id]').val(''); } if (selection.latitude && selection.longitude) { $latitude.val(selection.latitude); $longitude.val(selection.longitude); var center = new google.maps.LatLng(selection.latitude, selection.longitude); map.setCenter(center); marker.setPosition(center); $address.val(selection.address); } else { $city.geocomplete('find', selection.city); } $('input[name=city_name], input[name=city]').val(selection.city); // Update label // $('#fields-venue .venue-name').text(selection.value); // $('#fields-venue .venue-city').text(selection.city || ''); // toggleVenue(true); }) .typeahead([ { name: 'foursquare', remote: { url: Anqh.APIURL + '/v1/venues/foursquare', dataType: 'jsonp', replace: function(url, uriEncodedQuery) { return url += '?method=venues&ll=' + $latitude.val() + ',' + $longitude.val() + '&query=' + uriEncodedQuery; }, filter: function(parsedResponse) { return parsedResponse.venues || []; } } } ]); /* $('input[name=address], input[name=city_name]').on('blur', function geoCode(event) { var address = $("input[name=address]").val() , city = $("input[name=city_name]").val(); if (city != '') { var geocode = city; if (address != '') { geocode = address + ", " + geocode; } Anqh.geocoder.geocode({ address: geocode }, function geoCoded(results, status) { if (status == google.maps.GeocoderStatus.OK && results.length) { Anqh.map.setCenter(results[0].geometry.location); $('input[name=latitude]').val(results[0].geometry.location.lat()); $('input[name=longitude]').val(results[0].geometry.location.lng()); var marker = new google.maps.Marker({ position: results[0].geometry.location, map: Anqh.map }); } }); } }); */ }); </script> <?php return ob_get_clean(); }
/** * Comment form view. * * @return string */ public function form() { ob_start(); echo Form::open(null, array('class' => 'form-inline')); // Private message? if ($this->private) { $input = Form::checkbox('private', 1, Arr::get($this->values, 'private'), array('id' => 'field-private', 'onchange' => "\$('input[name=comment]').toggleClass('private', this.checked);")); echo Form::label('field-private', $input . ' <span class="label label-special private" title="' . __('Private comment') . '">' . __('Priv') . '</span> ', array('class' => 'checkbox')); } echo Form::input('comment', Arr::get($this->values, 'comment'), array('class' => 'input-xlarge', 'maxlength' => 300)), ' '; echo Form::submit(false, __('Comment'), array('class' => 'btn btn-primary')); echo Form::csrf(); echo Form::close(); return ob_get_clean(); }
<li class="errorMessage"><?php echo e($mesage); ?> </li> <?php } ?> </ul> <?php } ?> <form id="login" action="/reminder/resetpassword?token=<?php echo $hash; ?> " accept-charset="utf-8" method="post"> <?php echo \Form::csrf(); ?> <div class="form-group text-left"> <label for="mail" class="text-left">パスワード</label> <input type="password" class="form-control" id="password" name="password"> <label for="mail" class="text-left">パスワード(確認用)</label> <input type="password" class="form-control" id="password2" name="password2"> </div> <button type="submit" class="btn btn-default">送信する</button> </form> </div> </div> <!-- /loginForm --> </div>
/** * Render content. * * @return string */ public function content() { ob_start(); echo Form::open(null, array('id' => 'form-music', 'class' => 'row')); ?> <div class="col-md-8"> <fieldset> <?php echo Form::input_wrap('name', $this->track->name, array('class' => 'input-lg'), __('Name'), Arr::get($this->errors, 'name')); ?> <?php echo Form::input_wrap('url', $this->track->url, array('placeholder' => 'http://'), __('URL'), Arr::get($this->errors, 'url')); ?> <?php echo Form::textarea_wrap('description', $this->track->description, null, true, __('Description'), Arr::get($this->errors, 'description')); ?> <?php if ($this->track->type == Model_Music_Track::TYPE_MIX) { echo Form::textarea_wrap('tracklist', $this->track->tracklist, null, true, __('Tracklist'), Arr::get($this->errors, 'tracklist')); } ?> </fieldset> <fieldset class="form-actions"> <?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')) : ''; ?> <?php echo Form::csrf(); ?> </fieldset> </div> <div class="col-md-4"> <fieldset> <?php echo Form::input_wrap('cover', $this->track->cover, array('placeholder' => 'http://'), __('Cover'), Arr::get($this->errors, 'cover')); ?> <?php echo Form::input_wrap('size_time', $this->track->size_time, array('maxlength' => $this->track->type == Model_Music_Track::TYPE_MIX ? 8 : 6, 'placeholder' => $this->track->type == Model_Music_Track::TYPE_MIX ? __('hh:mm:ss') : __('mm:ss')), __('Length'), Arr::get($this->event_errors, 'size_time'), null, 'min'); ?> </fieldset> <fieldset id="fields-music"> <?php echo Form::checkboxes_wrap('tag', $this->tags(), $this->track->tags(), array('class' => 'block-grid three-up'), __('Music'), $this->errors); ?> </fieldset> </div> <?php echo Form::close(); return ob_get_clean(); }
/** * 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(); }
/** * Comment form view. * * @return string */ public function form() { ob_start(); // echo new View_Generic_Smileys('input[name=comment]'); // echo Form::button('smileys', '<i class="fa fa-smile-o"></i>', array('class' => 'btn btn-default', 'title' => __('Show smileys'), 'type' => 'button', 'data-toggle' => 'collapse', 'data-target' => '.smileys')); echo Form::open(null, array('class' => 'form-inline')); if ($this->private) { // Private messaging available echo Form::hidden('private', 0); echo '<div class="input-group">'; echo '<span class="input-group-btn">' . Form::button('private-toggle', __('Priv'), array('type' => 'button', 'title' => __('Private message'), 'class' => 'btn btn-special', 'data-toggle' => 'button')) . '</span>'; /* $input = Form::checkbox( 'private', 1, Arr::get($this->values, 'private'), array( 'id' => 'field-private', 'onchange' => "\$('input[name=comment]').toggleClass('private', this.checked);" ) ); echo Form::label( 'field-private', $input . ' <span class="label label-special private" title="' . __('Private comment') . '">' . __('Priv') . '</span> ', array('class' => 'checkbox') );*/ } else { // No private available echo '<div class="input-group">'; } echo Form::input('comment', Arr::get($this->values, 'comment'), array('class' => 'form-control', 'maxlength' => 300)); echo '<span class="input-group-btn">' . Form::button(false, '<i class="fa fa-comment"></i>', array('class' => 'btn btn-primary', 'title' => __('Comment'), 'type' => 'submit')) . '</span>'; echo '</div>'; echo Form::csrf(); echo Form::close(); return ob_get_clean(); }
public static function factory($form_definitions_file, $initial_values = '') { // system based if (strpos($form_definitions_file, 'system::') !== FALSE) { $form_definitions_file = PATH_SYSTEM . '/forms/' . str_replace('system::', '', $form_definitions_file); } else { $form_definitions_file = PATH_APP . '/forms/' . $form_definitions_file; } Form::$skeleton = array(); Form::$rules = array(); Form::$hookup = array(); Form::$release = array(); Form::$conf = Read::file($form_definitions_file . '_form.php', $initial_values); // cross site request forgery Form::csrf(); // run through fields foreach (Form::$conf['fields'] as $field_id => $field_setup) { // global mark setting if (Form::$conf['config']['mark'] !== TRUE) { $field_setup['mark'] = FALSE; } if (empty($field_setup['group'])) { // set default group $field_setup['group'] = 'default'; } // set field label $form['labels'][$field_id] = $field_setup['label']; // handle read only fields if ($field_setup['metas']['readonly'] === TRUE) { $field_setup['attr']['disabled'] = 'disabled'; $field_setup['attr']['class'] = 'readonly ' . $field_setup['attr']['class']; $field_setup['rules'] = array(); } // set defined and posted value ... and clean da shizzle $field_setup['defined_value'] = $field_setup['value']; $field_setup['value'] = Form::get_value($field_id, $field_setup); // handle hookups (turn optional fields into required) if (!empty($field_setup['metas']['hookup'])) { foreach ($field_setup['metas']['hookup'] as $hu_val => $hu_fields) { if ($field_setup['value'] == $hu_val) { foreach ($hu_fields as $hu_field_id) { Form::$hookup[] = $hu_field_id; } } Session::cache('jsinline', 'system.form.hookup("' . $field_id . '", "' . $hu_val . '", ["' . Format::array_join($hu_fields, '","') . '"])'); } } if (in_array($field_id, Form::$hookup)) { $field_setup['rules'] = array('required'); } // handle releases (turn required fields into optional) if (!empty($field_setup['metas']['release'])) { foreach ($field_setup['metas']['release'] as $rl_val => $rl_fields) { if ($field_setup['value'] == $rl_val) { foreach ($rl_fields as $rl_field_id) { Form::$release[] = $rl_field_id; } } Session::cache('jsinline', 'system.form.release("' . $field_id . '", "' . $rl_val . '", ["' . Format::array_join($rl_fields, '","') . '"])'); } } if (in_array($field_id, Form::$release)) { $field_setup['rules'] = array(); } // if no rules array, set it as an array if (empty($field_setup['rules'])) { $field_setup['rules'] = array(); } // create html field widget $widget = Form::$field_setup['type']($field_id, $field_setup); // cache field type & value Form::$skeleton['types'][$field_id] = $field_setup['type']; Form::$skeleton['values'][$field_id] = $field_setup['value']; // cache field rules Form::rules($field_id, $field_setup['rules']); Form::$skeleton['rules'] = Form::$rules; $is_single_buttonset = FALSE; // no label for single checkbox/radio fields if (in_array($field_setup['type'], array('radio', 'checkbox')) && empty($field_setup['options'])) { $is_single_buttonset = $field_setup['metas']['buttonset'] ? TRUE : FALSE; } // set labels Form::$skeleton['labels'][$field_id] = $field_setup['label']; if (!isset($field_setup['metas']['label'])) { $field_setup['metas']['label'] = TRUE; } // handle label if ($field_setup['metas']['label'] === TRUE && !$is_single_buttonset && !($field_setup['type'] == 'upload' || $field_setup['type'] == 'hidden' || $field_setup['type'] == 'date' && ($field_setup['metas']['range'] === TRUE || $field_setup['metas']['time']))) { $label = Form::label($field_id, $field_setup['label'] . ':' . Form::field_mark($field_id, $field_setup)); } else { $label = NULL; } // set form view Form::$skeleton['view'][$field_id] = array('label' => $label, 'widget' => $widget, 'note' => '<div class="form_field_note">' . $field_setup['note'] . '</div>'); // group input results if (Form::is_submitted()) { $multi = Format::string_explode(str_replace(']', '', $field_id), '['); $data = array('old' => Format::string_clean($field_setup['defined_value']), 'set' => Format::string_clean($field_setup['value'])); // if multidimensional if (count($multi) > 1) { if (count($multi) == 1) { Form::$skeleton['data'][$field_setup['group']][$multi[0]] = $data; } if (count($multi) == 2) { Form::$skeleton['data'][$field_setup['group']][$multi[0]][$multi[1]] = $data; } if (count($multi) == 3) { Form::$skeleton['data'][$field_setup['group']][$multi[0]][$multi[1]][$multi[2]] = $data; } if (count($multi) == 4) { Form::$skeleton['data'][$field_setup['group']][$multi[0]][$multi[1]][$multi[2]][$multi[3]] = $data; } if (count($multi) == 5) { Form::$skeleton['data'][$field_setup['group']][$multi[0]][$multi[1]][$multi[2]][$multi[3]][$multi[4]] = $data; } if (count($multi) == 6) { Form::$skeleton['data'][$field_setup['group']][$multi[0]][$multi[1]][$multi[2]][$multi[3]][$multi[4]][$multi[5]] = $data; } if (count($multi) == 7) { Form::$skeleton['data'][$field_setup['group']][$multi[0]][$multi[1]][$multi[2]][$multi[3]][$multi[4]][$multi[5]][$multi[6]] = $data; } if (count($multi) == 8) { Form::$skeleton['data'][$field_setup['group']][$multi[0]][$multi[1]][$multi[2]][$multi[3]][$multi[4]][$multi[5]][$multi[6]][$multi[7]] = $data; } if (count($multi) == 9) { Form::$skeleton['data'][$field_setup['group']][$multi[0]][$multi[1]][$multi[2]][$multi[3]][$multi[4]][$multi[5]][$multi[6]][$multi[7]][$multi[8]] = $data; } if (count($multi) == 10) { Form::$skeleton['data'][$field_setup['group']][$multi[0]][$multi[1]][$multi[2]][$multi[3]][$multi[4]][$multi[5]][$multi[6]][$multi[7]][$multi[8]][$multi[9]] = $data; } } else { Form::$skeleton['data'][$field_setup['group']][$field_id] = $data; } } // helper: set most used view structure Form::$skeleton['group'][$field_id] = (!empty($field_setup['note']) ? Form::$skeleton['view'][$field_id]['note'] : NULL) . (!empty(Form::$skeleton['view'][$field_id]['label']) ? Form::$skeleton['view'][$field_id]['label'] . '<br>' : NULL) . '<error></error>' . Form::$skeleton['view'][$field_id]['widget']; } // if we have rules validate the form as soon its submitted if (Form::is_submitted() && !empty(Form::$rules)) { $input = Validation::factory(Form::$skeleton); Form::$skeleton['valid'] = $input->valid(); if (!Form::$skeleton['valid']) { Form::$skeleton['validation_failed'] = '<a name="form"></a><div class="form_validation_failed">' . (empty(Form::$conf['config']['error']) ? Lang::get('system::form_validation_failed') : Form::$conf['config']['error']) . '</div>'; foreach ($input->error_messages as $field_id => $error) { if (empty(Form::$skeleton['view'][$field_id]['label'])) { $error = '<br>' . $error; } Form::$skeleton['group'][$field_id] = str_replace('<error></error>', $error, Form::$skeleton['group'][$field_id]); Form::$skeleton['error'][$field_id] = $error; } } } // at last create basic fields Form::$skeleton['view']['open'] = Form::open(Form::$conf['config']['submit']['url'], array('id' => Form::$conf['config']['id'], 'method' => !empty(Form::$conf['config']['method']) ? Form::$conf['config']['method'] : 'post', 'upload' => Form::$conf['config']['upload'] ? TRUE : FALSE)); Form::$skeleton['view']['submit'] = Form::submit('submit', !empty(Form::$conf['config']['submit']['label']) ? Form::$conf['config']['submit']['label'] : Lang::get('system::form_submit_string'), array('class' => 'button')) . (!empty(Form::$conf['config']['cancel']['url']) ? '<span class="form_cancel_container"><span class="form_cancel_prestring">' . Lang::get('system::form_cancel_prestring') . '</span>' . Html::anchor(Form::$conf['config']['cancel']['url'], !empty(Form::$conf['config']['cancel']['label']) ? Form::$conf['config']['cancel']['label'] : Lang::get('system::form_cancel_string'), array('class' => 'form_cancel')) . '</span>' : NULL); // secure post form $secure_me = NULL; if (Form::$conf['config']['method'] != 'get') { $secure_me = Form::hidden('csrf', array('value' => session_id())) . Form::hidden('fuid', array('value' => empty($_POST['fuid']) ? Security::create_uid() : $_POST['fuid'])); } Form::$skeleton['view']['close'] = $secure_me . Form::close(); return (object) Form::$skeleton; }
<p><?php echo Form::input('username', Input::post('username')); ?> </p> <p><?php echo Form::label('メールアドレス', 'email'); ?> </p> <p><?php echo Form::input('email', Input::post('email')); ?> </p> <p><?php echo Form::label('パスワード', 'password'); ?> </p> <p><?php echo Form::password('password', Input::post('password')); ?> </p> <p><?php echo Form::submit('submit', '登録'); ?> </p> <?php echo Form::csrf(); ?> <?php echo Form::close(); ?> </div>
/** * 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(); }
/** * 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(); }
/** * 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(); }
/** * 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 view. * * @return string */ public function content() { ob_start(); // Upload form echo Form::open(null, array('id' => 'form-multiple-upload', 'method' => 'post', 'enctype' => 'multipart/form-data')); ?> <div> <div class="droparea hero-unit"><i class="icon-arrow-down"></i> <strong><?php echo __('Drag and drop files here'); ?> </strong></div> <span class="btn btn-success fileinput-button"> <i class="icon-plus icon-white"></i> <?php echo __('Add files...'); ?> <?php echo Form::file('file[]', array('multiple' => 'multiple', 'accept' => 'image/*')); ?> </span> <?php echo Form::button('upload', '<i class="icon-upload icon-white"></i> ' . __('Start upload'), array('type' => 'submit', 'class' => 'btn btn-primary start')); ?> <div class="progress progress-success progress-striped active fade"> <div class="bar" style="width: 0%;"></div> </div> </div> <div class="fileupload-loading"></div> <table class="table table-striped"> <tbody class="files"></tbody> </table> <?php echo Form::csrf(); echo Form::close(); // jQuery file upload $base = URL::base(!Request::current()->is_initial()); ?> <!-- The template to display files available for upload --> <script id="template-upload" type="text/x-tmpl"> {% for (var i=0, file; file=o.files[i]; i++) { %} <tr class="template-upload fade"> <td class="preview"><span class="fade"></span></td> <td class="name"><span>{%=file.name%}</span></td> <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td> {% if (file.error) { %} <td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td> {% } else if (o.files.valid && !i) { %} <td> <div class="progress progress-success progress-striped active"><div class="bar" style="width: 0%;"></div></div> </td> <td class="start">{% if (!o.options.autoUpload) { %} <button class="btn btn-primary"> <i class="icon-upload icon-white"></i> {%=locale.fileupload.start%} </button> {% } %}</td> {% } else { %} <td colspan="2"></td> {% } %} <td class="cancel">{% if (!i) { %} <button class="btn btn-warning"> <i class="icon-ban-circle icon-white"></i> {%=locale.fileupload.cancel%} </button> {% } %}</td> </tr> {% } %} </script> <!-- The template to display files available for download --> <script id="template-download" type="text/x-tmpl"> {% for (var i=0, file; file=o.files[i]; i++) { %} <tr class="template-download fade"> {% if (file.error) { %} <td></td> <td class="name"><span>{%=file.name%}</span></td> <td class="size">{%=o.formatFileSize(file.size)%}</td> <td class="error" colspan="3"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td> {% } else { %} <td class="preview">{% if (file.thumbnail_url) { %} <a href="{%=file.gallery_url%}" target="_blank"><img src="{%=file.thumbnail_url%}" /></a> {% } %}</td> <td class="name"> <a href="{%=file.url%}" title="{%=file.name%}" target="_blank">{%=file.name%}</a> </td> <td class="size">{%=o.formatFileSize(file.size)%}</td> <td class="delete" colspan="3">{% if (file.delete_url) { %} <button class="btn btn-danger" data-type="{%=file.delete_type%}" data-url="{%=file.delete_url%}"> <i class="icon-trash icon-white"></i> {%=locale.fileupload.destroy%} </button>{% } %} </td> {% } %} </tr> {% } %} </script> <script> head.ready('jquery-ui', function fileUpload() { head.js( { 'jquery-template': '<?php echo $base; ?> static/js/tmpl.js' }, { 'jquery-load-image': '<?php echo $base; ?> static/js/load-image.js' }, { 'jquery-iframe-transport': '<?php echo $base; ?> static/js/jquery.iframe-transport.js' }, { 'jquery-fileupload': '<?php echo $base; ?> static/js/jquery.fileupload.js' }, { 'jquery-fileupload-ui': '<?php echo $base; ?> static/js/jquery.fileupload-ui.js' }, { 'jquery-xdr-transport': '<?php echo $base; ?> static/js/jquery.xdr-transport.js' }, function fileUploadLoaded() { // Localization window.locale = { 'fileupload': { 'errors': { 'maxFileSize': 'File is too big', 'minFileSize': 'File is too small', 'acceptFileTypes': 'Filetype not allowed', 'maxNumberOfFiles': 'Max number of files exceeded', 'uploadedBytes': 'Uploaded bytes exceed file size', 'emptyResult': 'Empty file upload result' }, 'cancel': 'Cancel', 'destroy': 'Delete', 'error': 'Error', 'start': 'Start' } }; // Initialize fileupload $('#form-multiple-upload').fileupload({ acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i, //autoUpload: true, maxFileSize: <?php echo Num::bytes(Kohana::$config->load('image.filesize')); ?> , dropZone: $('.droparea'), formData: { token: $('input[name=token]').val(), multiple: true } }); $(document).on('drop dragover', function disableDrop(e) { e.preventDefault(); }); $('#form-multiple-upload').on('submit', function upload(e) { e.preventDefault(); $('.files .start button').click(); // $(this).fileupload('send'); }) } ); }); </script> <!--[if gte IE 8]><!--<script src="<?php echo $base; ?> static/js/jquery.xdr-transport.js"></script>--><![endif]--> <?php return ob_get_clean(); }