Example #1
0
File: signin.php Project: anqh/anqh
 /**
  * Get form.
  *
  * @return  string
  */
 public static function form()
 {
     ob_start();
     echo HTML::anchor(Route::url('oauth', array('action' => 'login', 'provider' => 'facebook')), '&nbsp;<i class="fa fa-facebook"></i> ' . __('Connect with Facebook') . '&nbsp;', array('class' => 'btn btn-block btn-facebook', 'title' => __('Sign in with your Facebook account')));
     echo '<hr>';
     echo Form::open(Route::url('sign', array('action' => 'in')));
     echo Form::input_wrap('username', null, array('autofocus'), __('Username or email'));
     echo Form::password_wrap('password', null, null, __('Password') . ' &nbsp; ' . HTML::anchor(Route::url('sign', array('action' => 'password')), __('Forgot?'), array('class' => 'text-muted')));
     echo Form::form_group(Form::checkbox_wrap('remember', 'true', true, null, __('Stay logged in')));
     echo Form::button(null, __('Login'), array('class' => 'btn btn-block btn-primary', 'title' => __('Remember to sign out if on a public computer!')));
     echo Form::close();
     return ob_get_clean();
 }
Example #2
0
    /**
     * 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();
    }
Example #3
0
 * Comments
 *
 * @package    Anqh
 * @author     Antti Qvickström
 * @copyright  (c) 2010-2011 Antti Qvickström
 * @license    http://www.opensource.org/licenses/mit-license.php MIT license
 */
echo Form::open();
?>
<fieldset class="horizontal">
	<ul>
		<?php 
if (isset($private) && $private) {
    ?>
		<?php 
    echo Form::checkbox_wrap('private', '1', $values, array('onchange' => "\$('input[name=comment]').toggleClass('private', this.checked)\""), '<abbr class="private" title="' . __('Private comment') . '">' . __('Priv') . '</abbr>');
    ?>
		<?php 
}
?>

		<?php 
echo Form::input_wrap('comment', $values, array('maxlength' => 300), null, $errors);
?>

		<li><?php 
echo Form::submit(false, __('Comment'));
?>
</li>
	</ul>
	<?php 
Example #4
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 #5
0
File: form.php Project: anqh/core
 /**
  * Creates checkboxes list
  *
  * @param   string        $name     input name
  * @param   array         $values   input values
  * @param   array         $checked  checked statuses
  *
  * @param   string        $label
  * @param   string|array  $error
  * @param   string|array  $tip
  * @param   string        $class
  * @return  string
  */
 public static function checkboxes_wrap($name, $values = array(), $checked = array(), $label = null, $error = null, $tip = null, $class = null)
 {
     $input = ($class ? '<ul class="unstyled ' . $class . '">' : '<ul class="unstyled">') . "\n";
     foreach ($values as $checkbox_value => $checkbox_title) {
         $id = self::input_id($name) . '-' . $checkbox_value;
         $input .= '<li>';
         $input .= Form::checkbox_wrap($name . '[]', $checkbox_value, isset($checked[$checkbox_value]), array('id' => $id), $checkbox_title);
         $input .= "</li>\n";
     }
     $input .= "</ul>\n";
     return Form::wrap($input, $name, $label, $error, $tip);
 }
Example #6
0
File: form.php Project: anqh/anqh
 /**
  * Creates checkboxes list.
  *
  * @param   string        $name        input name
  * @param   array         $values      input values
  * @param   array         $checked     checked statuses
  * @param   array         $attributes  html attributes
  *
  * @param   string        $label
  * @param   string|array  $error
  * @param   string|array  $tip
  * @return  string
  */
 public static function checkboxes_wrap($name, $values = array(), $checked = array(), array $attributes = null, $label = null, $error = null, $tip = null)
 {
     $list_class = 'list-unstyled ' . Arr::get_once($attributes, 'class');
     $input = '<ul class="' . $list_class . '">' . "\n";
     foreach ($values as $checkbox_value => $checkbox_title) {
         $id = self::input_id($name) . '-' . $checkbox_value;
         $input .= '<li>';
         $input .= Form::checkbox_wrap($name . '[]', $checkbox_value, isset($checked[$checkbox_value]), array('id' => $id), $checkbox_title);
         $input .= "</li>\n";
     }
     $input .= "</ul>\n";
     return Form::wrap($input, $name, $label, $error, $tip);
 }