Beispiel #1
0
 public function registerAction()
 {
     $user = new User();
     $form = new UserForm($user);
     $form->setFieldsMap(array('PlainPassword' => array(new Limit(null, 255), new NotBlank(), new Password())));
     if ($this->request->isPostMethod()) {
         $form->handleRequest($this->request);
         if ($form->isValid()) {
             $plainPassword = $user->getPlainPassword();
             DB::create($user, $errors);
             if ($this->registry->auth->login($user->Email, $plainPassword)) {
                 FormMessage::sendMessage(FormMessage::SUCCESS, 'Your account is successfully registered.');
                 $this->redirectUrl(BASE_URL . '/profile');
             }
         }
     }
     return array('title' => 'Create Account', 'form' => $form);
 }
<?php

AssetBuilder::set('jquery', ['/jquery/jquery-1.12.0.min.js'], true, 1);
AssetBuilder::set('bootstrap', ['/bootstrap/js/bootstrap.min.js', '/bootstrap/css/bootstrap.min.css'], true, 2);
AssetBuilder::set('jquery-ui', ['/jquery-ui/jquery-ui.min.js', '/jquery-ui/jquery-ui.min.css', '/jquery-ui/jquery.ui.touch-punch.min.js'], false, 5);
AssetBuilder::set('jquery-sortable', ['/jquery-ui/jquery-ui.min.js', '/jquery-ui/jquery.ui.touch-punch.min.js', '/jquery/jquery.mjs.nestedSortable.js', '/app/css/sortable.css'], false, 5);
AssetBuilder::set('cms-main', ['/app/css/main.css', '/app/js/main.js', '/app/js/functions.js'], true, 100);
AssetBuilder::set('cms-editor', ['/jquery-ui/jquery-ui.min.js', '/jquery-ui/jquery-ui.min.css', '/jquery-ui/jquery.ui.touch-punch.min.js', '/jquery/jquery.mousewheel.js', '/jquery/fancybox/jquery.fancybox.pack.js', '/jquery/fancybox/jquery.fancybox.css', '/jquery-ui/jquery-ui-timepicker-addon.js', '/jquery/select2/select2.min.js', '/jquery/select2/select2.min.css', config('coaster::admin.tinymce') == 'compressed' ? '/jquery/tinymce/tinymce.gzip.js' : '/jquery/tinymce/tinymce.jquery.min.js', '/app/js/functions.js', '/app/js/pageInfo.js', '/app/js/editor.js'], false, 5);
AssetBuilder::set('cms-versions', ['/app/js/versions.js'], false, 10);
FormMessage::setErrorClass('has-error');
Beispiel #3
0
<?php
$classes = array(
    'error',
    'success',
    'info',
);
if (FormMessage::hasMessage()) {?>
    <div id="form-message" class="form-message <?= $classes[FormMessage::messageType()] ?>">
        <?=$this->trans(FormMessage::showMessage()) ?>
    </div>
<? } ?>
Beispiel #4
0
 public function editEduAction()
 {
     $id = $this->request->getRouteValue('id');
     /** @var Education $record */
     $record = DB::getObjectByID('Education', $id);
     $form = $this->getEducationForm($record);
     if ($this->request->isPostMethod()) {
         $form->handleRequest($this->request);
         if ($form->isValid()) {
             // update record
             if (!DB::update($record, $errors)) {
                 throw new Exception($errors['message'][2], (int) $errors['code']);
             }
             FormMessage::sendMessage(FormMessage::SUCCESS, 'Your institution is successfully saved.');
             if ($this->request->getValue('SaveAndExit')) {
                 $this->redirectUrl(BASE_URL . '/profile');
             }
         } else {
             FormMessage::sendMessage(FormMessage::ERROR, 'Sorry, saving went wrong... Try again.');
         }
     }
     return array('title' => 'Edit Institution', 'form' => $form);
 }