Example #1
0
<?php

// Load all values if not already set
if (!isset($values)) {
    $values = array();
    foreach (Jelly::select($foreign['model'])->execute() as $related) {
        $values[$related->id()] = $related->name();
    }
}
// Set checked values
$checked = array_flip($ids);
echo Form::checkboxes_wrap($name, $values, $checked, isset($label) ? $label : '', isset($errors) ? $errors : '', isset($tip) ? $tip : '', isset($class) ? $class : '');
Example #2
0
File: edit.php Project: anqh/events
    /**
     * 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">&euro;</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();
    }
Example #3
0
File: edit.php Project: anqh/anqh
    /**
     * 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'), '&nbsp;', 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'), '&nbsp;', 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, '&euro;');
        ?>
		</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();
    }
Example #4
0
File: edit.php Project: anqh/anqh
    /**
     * 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();
    }