Example #1
0
 /**
  * Constructor
  *
  */
 public function __construct($id, $content, $name, $web, $mail, $pagekey, $redirect)
 {
     parent::__construct([], ['content' => ['type' => 'textarea', 'label' => 'Kommentar', 'value' => $content, 'required' => true, 'validation' => ['not_empty']], 'submit' => ['type' => 'submit', 'callback' => [$this, 'callbackSubmit'], 'value' => 'Spara'], 'reset' => ['type' => 'reset', 'value' => 'Återställ'], 'delete' => ['type' => 'submit', 'callback' => [$this, 'callbackDelete'], 'value' => 'Radera']]);
     $this->id = $id;
     $this->redirect = $redirect;
     $this->pagekey = $pagekey;
 }
Example #2
0
 /**
  * Constructor
  *
  */
 public function __construct($redirect)
 {
     parent::__construct([], ['tag' => array('type' => 'checkbox-multiple', 'label' => 'Kategori', 'required' => true, 'values' => array('Programmering', 'Flygning', 'Inköp', 'Design', 'Lagar och regler', 'Användning', 'Allmänt')), 'title' => ['type' => 'text', 'label' => 'Frågans titel', 'required' => true], 'content' => ['type' => 'textarea', 'label' => 'Beskrivning', 'required' => true, 'validation' => ['not_empty']], 'submit' => ['type' => 'submit', 'callback' => [$this, 'callbackSubmit'], 'value' => 'Spara'], 'reset' => ['type' => 'reset', 'value' => 'Återställ']]);
     $this->redirect = $redirect;
     $this->id = $_SESSION['user']->id;
     $this->acronym = $_SESSION['user']->acronym;
 }
Example #3
0
 /**
  * Constructor
  *
  */
 public function __construct($tags = array())
 {
     if (isset($tags[0])) {
         foreach ($tags as $tag) {
             $tagoptions[$tag->id] = $tag->name;
         }
         parent::__construct([], ['subject' => ['type' => 'text', 'placeholder' => 'Rubrik', 'id' => 'inputEmail', 'class' => 'form-control', 'label' => 'Rubrik', 'required' => true, 'validation' => ['not_empty']], 'text' => ['type' => 'textarea', 'placeholder' => 'Fråga', 'id' => 'inputEmail', 'class' => 'form-control', 'label' => 'Fråga', 'required' => true, 'validation' => ['not_empty']], 'old_tags' => ['type' => 'select-multiple', 'placeholder' => 'Taggar', 'id' => 'inputEmail', 'class' => 'form-control', 'options' => $tagoptions, 'label' => 'Befintliga taggar'], 'new_tags' => ['type' => 'text', 'placeholder' => 'Tag?, ', 'id' => 'inputEmail', 'class' => 'form-control', 'label' => 'Skapa nya taggar, separera med komma-tecken'], 'submit' => ['type' => 'submit', 'class' => 'btn btn-lg btn-primary btn-block', 'value' => 'Skicka', 'callback' => function () {
             $old_tags = null;
             if (isset($_POST['old_tags'])) {
                 $old_tags = $_POST['old_tags'];
             }
             $res = $this->di->dispatcher->forward(['controller' => 'questions', 'action' => 'add', 'params' => [$this->Value('subject'), $this->Value('text'), $old_tags, $this->Value('new_tags')]]);
             $this->saveInSession = true;
             return $res;
         }]]);
     } else {
         parent::__construct([], ['subject' => ['type' => 'text', 'placeholder' => 'Rubrik', 'id' => 'inputEmail', 'class' => 'form-control', 'label' => 'Rubrik', 'required' => true, 'validation' => ['not_empty']], 'text' => ['type' => 'textarea', 'placeholder' => 'Fråga', 'id' => 'inputEmail', 'class' => 'form-control', 'label' => 'Fråga', 'required' => true, 'validation' => ['not_empty']], 'tags_new' => ['type' => 'text', 'placeholder' => 'Taggar', 'id' => 'inputEmail', 'class' => 'form-control', 'label' => 'Skapa nya taggar, separera med komma-tecken'], 'submit' => ['type' => 'submit', 'class' => 'btn btn-lg btn-primary btn-block', 'callback' => function () {
             $res = $this->di->dispatcher->forward(['controller' => 'questions', 'action' => 'add', 'params' => [$this->Value('subject'), $this->Value('text')]]);
             $this->saveInSession = true;
             return $res;
         }], 'submit-fail' => ['type' => 'submit', 'callback' => function () {
             $this->AddOutput("<p><i>DoSubmitFail(): Form was submitted but I failed to process/save/validate it</i></p>");
             return false;
         }]]);
     }
 }
Example #4
0
 /**
  * Constructor
  *
  */
 public function __construct($id, $content, $acronym, $web, $mail, $pagekey, $redirect)
 {
     parent::__construct([], ['content' => ['type' => 'textarea', 'label' => 'Comment', 'description' => 'Write a comment about the subject above. This is a great place to ask for clarification or details. Markdown syntax supported.', 'value' => $content, 'required' => true, 'validation' => ['not_empty']], 'submit' => ['type' => 'submit', 'callback' => [$this, 'callbackSubmit'], 'value' => 'Submit'], 'reset' => ['type' => 'reset', 'value' => 'Reset'], 'delete' => ['type' => 'submit', 'callback' => [$this, 'callbackDelete'], 'value' => 'Delete']]);
     $this->id = $id;
     $this->redirect = $redirect;
     $this->pagekey = $pagekey;
 }
 /**
  * Constructor
  *
  */
 public function __construct($comment = null, $params = null)
 {
     parent::__construct([], ['content' => ['type' => 'textarea', 'label' => 'Kommentar (använd gärna Markdown):', 'required' => true, 'validation' => ['not_empty'], 'value' => $comment->getProperties()['content']], 'name' => ['type' => 'text', 'label' => 'Namn:', 'required' => true, 'validation' => ['not_empty'], 'value' => $comment->getProperties()['name']], 'email' => ['type' => 'text', 'label' => 'Email:', 'required' => true, 'validation' => ['not_empty', 'email_adress'], 'value' => $comment->getProperties()['email']], 'url' => ['type' => 'url', 'label' => 'Hemsida:', 'required' => false, 'value' => $comment->getProperties()['url']], 'submit' => ['type' => 'submit', 'value' => 'Spara', 'callback' => [$this, 'callbackSubmit']], 'reset' => ['type' => 'reset', 'value' => 'Återställ'], 'delete' => ['type' => 'submit', 'value' => 'Radera', 'callback' => [$this, 'callbackDelete']], 'submit-abort' => ['type' => 'submit', 'value' => 'Avbryt', 'formnovalidate' => true, 'callback' => [$this, 'callbackSubmitFail']]]);
     $this->commentUpd = $comment;
     $this->page = $params['page'];
     $this->redirect = $params['redirect'];
 }
Example #6
0
 /**
  * Constructor
  *
  */
 public function __construct($id = null, $acronym = '', $presentation = '', $email = '', $web = '', $password = '', $activedate = null)
 {
     $activecheck = $activedate == null ? false : true;
     parent::__construct([], ['presentation' => ['type' => 'textarea', 'label' => 'Presentation', 'description' => 'The name which will be displayed on your public profile. The name must be unique and contain maximum 20 characters.', 'required' => false, 'validation' => [], 'value' => $presentation], 'email' => ['type' => 'text', 'label' => 'E-mail', 'placeholder' => '*****@*****.**', 'description' => 'Make sure that you enter the correct e-mail address. It is needed in case you need to restore your password and also for other important messages. Your e-mail address will not be displayed publicly.', 'required' => true, 'value' => $email, 'validation' => array('not_empty', 'email_adress', 'custom_test' => array('message' => 'This E-mail adress is already registered.', 'test' => function ($value) {
         if ($_SESSION['user']->email == $value) {
             return true;
         } else {
             if ($email != $value) {
                 $this->user = new \Anax\Users\User();
                 $this->user->setDI($this->di);
                 $users = $this->user->findAll();
                 foreach ($users as $user) {
                     $otheremail = $user->email;
                     if ($otheremail == $value) {
                         return false;
                     }
                 }
             }
         }
     }))], 'email2' => ['type' => 'text', 'label' => 'Repeat E-mail adress', 'placeholder' => '*****@*****.**', 'required' => true, 'value' => $email, 'validation' => ['not_empty', 'email_adress', 'match' => 'email']], 'web' => ['type' => 'text', 'label' => 'Website', 'placeholder' => 'http://www.example.com', 'description' => 'Tip! You can promote a website you like on your public profile. However, links to sexual, violent or illegal content will not be accepted! The URL character limit is 200.', 'validation' => ['web_adress'], 'value' => $web], 'password' => ['type' => 'password', 'label' => 'Current password', 'required' => true, 'validation' => ['not_empty']], 'newpassword' => ['type' => 'password', 'label' => 'Choose a new password', 'description' => 'Choose a password which contains at least 8 characters. It should contain both letters, numbers and special characters. Your password will be encrypted and is not visible to anyone. Make sure the browser URL starts with "https://" when you fill out this form.', 'required' => false, 'validation' => []], 'newpassword2' => ['type' => 'password', 'label' => 'Repeat new password', 'required' => false, 'validation' => ['match' => 'newpassword']], 'submit' => ['type' => 'submit', 'callback' => [$this, 'callbackSubmit'], 'value' => 'Submit'], 'submit-delete' => ['type' => 'submit', 'callback' => [$this, 'callbackSubmitDelete'], 'value' => 'Delete account']]);
     $this->id = $id;
     $this->acronym = $acronym;
     $this->password = $password;
     $this->activedate = $activedate;
 }
Example #7
0
 /**
  * Constructor
  *
  */
 public function __construct($key, $type, $redirect)
 {
     parent::__construct(['id' => 'comment-form'], ['content' => ['type' => 'textarea', 'label' => 'Kommentar', 'required' => true, 'validation' => ['not_empty']], 'submit' => ['type' => 'submit', 'callback' => [$this, 'callbackSubmit'], 'value' => 'Kommentera']]);
     $this->key = $key;
     $this->type = $type;
     $this->redirect = $redirect;
 }
Example #8
0
 /**
  * Constructor
  *
  */
 public function __construct($redirect)
 {
     parent::__construct([], ['tag' => array('type' => 'checkbox-multiple', 'label' => 'Tags', 'required' => true, 'values' => array('News', 'Technology', 'Economy', 'Purchase', 'Design', 'Performance', 'Maintenance', 'Accessories', 'General')), 'author' => ['type' => 'text', 'label' => 'Author', 'description' => 'The full name of the author. It will be visible above the article.', 'required' => true], 'title' => ['type' => 'text', 'label' => 'Header', 'description' => 'The header or title that summarizes the article content in one sentence. Maximum 110 characters.', 'required' => true], 'image' => ['type' => 'text', 'label' => 'Image name', 'placeholder' => 'myimage.png', 'description' => 'The name of the article image. It should not include a path, but must include the file name .jpg, .png, or .gif. The width should be at least 696px.', 'required' => false], 'image-width' => ['type' => 'range', 'label' => 'Image width', 'max' => 900, 'min' => 696, 'value' => 696, 'description' => 'The width should be at least 696px but no more than 900px.', 'required' => false], 'image-height' => ['type' => 'range', 'label' => 'Image height', 'max' => 696, 'min' => 250, 'value' => 389, 'description' => 'The height should not exceed 696px but be at least 250px.', 'required' => false], 'content' => ['type' => 'textarea', 'label' => 'Content', 'description' => 'The main content. Support for Markdown syntax.', 'required' => true, 'validation' => ['not_empty']], 'submit' => ['type' => 'submit', 'callback' => [$this, 'callbackSubmit'], 'value' => 'Publish'], 'reset' => ['type' => 'reset', 'value' => 'Reset']]);
     $this->redirect = $redirect;
     $this->id = $_SESSION['user']->id;
     $this->acronym = $_SESSION['user']->acronym;
 }
 /**
  * Constructor
  *
  */
 public function __construct($params = null)
 {
     $this->postId = $params['postId'];
     $this->type = $params['type'];
     $this->pageId = $params['pageId'];
     parent::__construct(['id' => 'comment-form', 'class' => 'comment-form'], ['content' => ['type' => 'textarea', 'label' => 'Kommentar (använd gärna Markdown):', 'required' => true, 'autofocus' => true, 'validation' => ['not_empty']], 'submit' => ['type' => 'submit', 'value' => 'Spara', 'callback' => [$this, 'callbackSubmit']], 'reset' => ['type' => 'reset', 'value' => 'Rensa'], 'submit-abort' => ['type' => 'submit', 'value' => 'Avbryt', 'formnovalidate' => true, 'callback' => [$this, 'callbackSubmitFail']]]);
 }
 /**
  * Constructor
  *
  */
 public function __construct()
 {
     $this->currentYear = date("Y");
     parent::__construct([], ['payment' => ['type' => 'hidden', 'value' => 10], 'name' => ['type' => 'text', 'label' => 'Name on credit card:', 'required' => true, 'autofocus' => true, 'validation' => array('not_empty')], 'address' => ['type' => 'text', 'label' => 'Address', 'required' => true, 'validation' => array('not_empty')], 'zip' => ['type' => 'text', 'label' => 'Zip code', 'required' => true, 'validation' => array('not_empty')], 'city' => ['type' => 'text', 'label' => 'City', 'required' => true, 'validation' => array('not_empty')], 'country' => ['type' => 'select', 'label' => 'Country', 'options' => array('default' => 'Select country', 'dk' => 'Denmark', 'fi' => 'Finland', 'no' => 'Norway', 'se' => 'Sweden'), 'validation' => array('not_empty', 'not_equal' => 'default')], 'cctype' => array('type' => 'select', 'label' => 'Credit card type', 'options' => array('default' => 'Select credit card type', 'visa' => 'VISA', 'mastercard' => 'MasterCard', 'eurocard' => 'Eurocard', 'amex' => 'American Express'), 'validation' => array('not_empty', 'not_equal' => 'default')), 'ccnumber' => array('type' => 'text', 'label' => 'Credit card number', 'validation' => array('not_empty', 'custom_test' => array('message' => 'Invalid credit card number, try 4408 0412 3456 7893 or 4417 1234 5678 9113', 'test' => 'isValidCCNumber'))), 'expmonth' => array('type' => 'select', 'label' => 'Expiration month:', 'options' => array('default' => 'Select credit card expiration month...', '01' => 'January', '02' => 'February', '03' => 'March', '04' => 'April', '05' => 'May', '06' => 'June', '07' => 'July', '08' => 'August', '09' => 'September', '10' => 'October', '11' => 'November', '12' => 'December'), 'validation' => array('not_empty', 'not_equal' => 'default')), 'expyear' => array('type' => 'select', 'label' => 'Expiration year:', 'options' => array('default' => 'Select credit card expiration year...', $this->currentYear => $this->currentYear, ++$this->currentYear => $this->currentYear, ++$this->currentYear => $this->currentYear, ++$this->currentYear => $this->currentYear, ++$this->currentYear => $this->currentYear, ++$this->currentYear => $this->currentYear), 'validation' => array('not_empty', 'not_equal' => 'default')), 'cvc' => array('type' => 'text', 'label' => 'CVC:', 'required' => true, 'validation' => array('not_empty', 'numeric')), 'pay' => array('type' => 'submit', 'value' => 'Perform payment', 'callback' => function ($this) {
         return true;
     })]);
 }
Example #11
0
 /**
  * Constructor
  *
  */
 public function __construct($id, $pageKey, $redirect, $values = null)
 {
     parent::__construct([], ['name' => ['type' => 'text', 'label' => 'Namn', 'required' => true, 'validation' => ['not_empty'], 'value' => $values['name']], 'mail' => ['type' => 'text', 'label' => 'E-post', 'required' => true, 'validation' => ['not_empty', 'email_adress'], 'value' => $values['mail']], 'web' => ['type' => 'text', 'label' => 'Site', 'value' => $values['web']], 'content' => ['type' => 'textarea', 'label' => 'Kommentar', 'required' => true, 'validation' => ['not_empty'], 'value' => $values['content']], 'submit' => ['type' => 'submit', 'callback' => [$this, 'callbackSubmit'], 'value' => 'Uppdatera']]);
     $this->id = $id;
     $this->pageKey = $pageKey;
     $this->redirect = $redirect;
 }
 /**
  * Constructor
  *
  */
 public function __construct($id, $username, $about, $email, $url)
 {
     // Set params
     $this->user_id = $id;
     // Construct the form
     parent::__construct([], ['id' => ['type' => 'hidden', 'value' => $id, 'required' => true, 'validation' => ['not_empty']], 'about' => ['type' => 'textarea', 'label' => 'Kort beskrivning:', 'value' => $about, 'required' => true, 'validation' => ['not_empty']], 'email' => ['type' => 'email', 'label' => 'Email:', 'value' => $email, 'required' => true, 'validation' => ['not_empty', 'email_adress']], 'url' => ['type' => 'url', 'label' => 'Hemsida:', 'value' => $url, 'required' => true, 'validation' => ['not_empty']], 'submit' => ['type' => 'submit', 'value' => 'Spara', 'callback' => [$this, 'callbackSubmit']], 'submit-reset' => ['type' => 'reset', 'value' => 'Återställ']]);
 }
Example #13
0
 /**
  * Constructor
  *
  */
 public function __construct($id, $content, $acronym, $web, $mail, $pagekey, $redirect)
 {
     parent::__construct([], ['content' => ['type' => 'textarea', 'label' => 'Answer', 'description' => 'Give an answer to the question asked. There is no character limit. Please stay to the topic of the question. If you need the asker to clarify the question, please write a comment instead. Markdown syntax suppported.', 'value' => $content, 'required' => true, 'validation' => ['not_empty']], 'submit' => ['type' => 'submit', 'callback' => [$this, 'callbackSubmit'], 'value' => 'Submit'], 'reset' => ['type' => 'reset', 'value' => 'Reset'], 'delete' => ['type' => 'submit', 'callback' => [$this, 'callbackDelete'], 'value' => 'Delete']]);
     $this->id = $id;
     $this->redirect = $redirect;
     $this->pagekey = $pagekey;
 }
 /**
  * Constructor
  * 
  * @param $username, name of the user.
  * @param $id, id of the answered question.
  *
  */
 public function __construct($username, $id)
 {
     // Set params
     $this->question_id = $id;
     // Construct the form
     parent::__construct([], ['question' => ['type' => 'hidden', 'value' => $id], 'username' => ['type' => 'hidden', 'value' => $username], 'text' => ['type' => 'textarea', 'label' => 'Svar:', 'required' => true, 'validation' => ['not_empty']], 'submit' => ['type' => 'submit', 'value' => 'Svara', 'callback' => [$this, 'callbackSubmit']], 'reset' => ['type' => 'reset', 'value' => 'Ångra']]);
 }
 /**
  * Constructor
  *
  */
 public function __construct($username, $dbTags)
 {
     //Set params
     $this->dbTags = $dbTags;
     // Construct the form
     parent::__construct([], ['username' => ['type' => 'hidden', 'value' => $username], 'title' => ['type' => 'text', 'label' => 'Titel:', 'required' => true, 'validation' => ['not_empty']], 'text' => ['type' => 'textarea', 'label' => 'Lägg till en kommentar:', 'required' => true, 'validation' => ['not_empty']], 'tags' => ['type' => 'text', 'label' => 'Taggar (OBS! Separera med komma-tecken likt exempel-koden):', 'required' => false, 'placeholder' => 'php, javascript, turbopascal etc.'], 'submit' => ['type' => 'submit', 'value' => 'Skapa', 'callback' => [$this, 'callbackSubmit']], 'reset' => ['type' => 'reset', 'value' => 'Ångra']]);
 }
 /**
  * Constructor
  *
  */
 public function __construct($id = null, $desc = null, $name = null)
 {
     $this->id = $id;
     $this->desc = $desc;
     $this->name = $name;
     parent::__construct(['class' => 'user-form'], ['name' => ['type' => 'text', 'label' => 'Name:', 'required' => true, 'validation' => ['not_empty'], 'value' => $name], 'desc' => ['type' => 'textarea', 'label' => 'Description:', 'value' => $desc], 'submit' => ['type' => 'submit', 'callback' => [$this, 'callbackSubmit']], 'submit-fail' => ['type' => 'submit', 'callback' => [$this, 'callbackSubmitFail']]]);
 }
Example #17
0
 public function __construct($redirectURL = null)
 {
     // $acronym = isset($user->acronym) ? htmlentities($user->acronym) : null;
     // set redirect url
     // $this->redirectURL = isset($redirectURL) ? $redirectURL : 'users/login';
     parent::__construct([], ['acronym' => ['type' => 'text', 'label' => 'Användarnamn:', 'required' => true, 'validation' => ['not_empty']], 'password' => ['type' => 'password', 'label' => 'Lösenord:', 'required' => true, 'validation' => ['not_empty']], 'Login' => ['type' => 'submit', 'value' => 'Logga in', 'callback' => [$this, 'callbackLogin']]]);
 }
Example #18
0
 public function __construct($users, $user = null, $userId)
 {
     $this->users = $users;
     $this->user = $user;
     $this->userId = $userId;
     parent::__construct([], ['name' => ['type' => 'text', 'class' => 'form-control', 'label' => 'Namn:', 'autofocus' => true, 'required' => true, 'validation' => ['not_empty'], 'value' => isset($user) ? $user->name : ''], 'email' => ['type' => 'text', 'class' => 'form-control', 'label' => 'E-post:', 'required' => true, 'validation' => ['not_empty', 'email_adress'], 'value' => isset($user) ? $user->email : ''], 'password' => ['type' => 'password', 'class' => 'form-control', 'label' => 'Lösenord:', 'required' => true, 'validation' => ['not_empty'], 'value' => ''], 'about' => ['type' => 'textarea', 'class' => 'form-control', 'label' => 'Om mig:', 'validation' => ['not_empty'], 'value' => isset($user) ? $user->about : ''], 'city' => ['type' => 'text', 'class' => 'form-control', 'label' => 'Stad:', 'value' => isset($user) ? $user->city : ''], 'country' => ['type' => 'text', 'class' => 'form-control', 'label' => 'Land:', 'value' => isset($user) ? $user->country : ''], 'website' => ['type' => 'text', 'class' => 'form-control', 'label' => 'Webbsida:', 'value' => isset($user) ? $user->website : ''], 'uppdatera' => ['type' => 'submit', 'class' => 'btn', 'value' => 'Uppdatera', 'callback' => [$this, 'callbackSubmit']]]);
 }
 /**
  * Constructor
  *
  */
 public function __construct($id = null, $com = null, $qid = null)
 {
     $this->id = $id;
     $this->com = $com;
     $this->qid = $qid;
     parent::__construct(['class' => 'user-form'], ['com' => ['type' => 'textarea', 'label' => 'Kommentar', 'required' => true, 'validation' => ['not_empty'], 'value' => $com], 'submit' => ['type' => 'submit', 'callback' => [$this, 'callbackSubmit']], 'submit-fail' => ['type' => 'submit', 'callback' => [$this, 'callbackSubmitFail']]]);
 }
Example #20
0
 /**
  * Constructor
  *
  */
 public function __construct()
 {
     parent::__construct([], ['acronym' => ['type' => 'text', 'label' => 'Username', 'description' => 'The name which will be displayed on your public profile. The name must be unique and contain maximum 20 characters.', 'required' => true, 'validation' => array('not_empty', 'custom_test' => array('message' => 'Username is already taken.', 'test' => function ($value) {
         $this->user = new \Anax\Users\User();
         $this->user->setDI($this->di);
         $users = $this->user->findAll();
         foreach ($users as $user) {
             $acronym = $user->acronym;
             if ($acronym == $value) {
                 return false;
             }
         }
     }))], 'presentation' => ['type' => 'textarea', 'label' => 'Presentation', 'description' => 'The presentation will appear in your public profile. There is no character limit, but it is recommended to limit the presentation to 400 characters.', 'required' => false, 'validation' => []], 'email' => ['type' => 'text', 'label' => 'E-mail', 'placeholder' => '*****@*****.**', 'description' => 'Make sure that you enter the correct e-mail address. It is needed in case you need to restore your password and also for other important messages. Your e-mail address will not be displayed publicly.', 'required' => true, 'validation' => array('not_empty', 'email_adress', 'custom_test' => array('message' => 'This E-mail adress is already registered.', 'test' => function ($value) {
         $this->user = new \Anax\Users\User();
         $this->user->setDI($this->di);
         $users = $this->user->findAll();
         foreach ($users as $user) {
             $email = $user->email;
             if ($email == $value) {
                 return false;
             }
         }
     }))], 'email2' => ['type' => 'text', 'label' => 'Repeat E-mail adress', 'placeholder' => '*****@*****.**', 'required' => true, 'validation' => ['not_empty', 'email_adress', 'match' => 'email']], 'web' => ['type' => 'text', 'label' => 'Website', 'placeholder' => 'http://www.example.com', 'description' => 'Tip! You can promote a website you like on your public profile. However, links to sexual, violent or illegal content will not be accepted! The URL character limit is 200.', 'validation' => ['web_adress']], 'password' => ['type' => 'password', 'label' => 'Choose password', 'description' => 'Choose a password which contains at least 8 characters. It should contain both letters, numbers and special characters. Your password will be encrypted and is not visible to anyone. Make sure the browser URL starts with "https://" when you fill out this form.', 'required' => true, 'validation' => array('not_empty', 'custom_test' => array('message' => 'You need to enter at least 8 characters.', 'test' => function ($value) {
         if (strlen($value) < 8) {
             return false;
         }
     }))], 'password2' => ['type' => 'password', 'label' => 'Repeat password', 'required' => true, 'validation' => ['not_empty', 'match' => 'password']], 'submit' => ['type' => 'submit', 'callback' => [$this, 'callbackSubmit'], 'value' => 'Register']]);
 }
Example #21
0
 /**
  * Constructor
  *
  */
 public function __construct(User $user)
 {
     parent::__construct([], ['acronym' => ['type' => 'text', 'label' => 'Användarnamn', 'required' => true, 'validation' => ['not_empty'], 'value' => $user->acronym], 'text' => ['type' => 'textarea', 'label' => 'Presentation', 'value' => $user->text], 'email' => ['type' => 'text', 'required' => true, 'validation' => ['not_empty', 'email_adress'], 'value' => $user->email], 'id' => ['type' => 'hidden', 'value' => $user->id], 'submit' => ['type' => 'submit', 'value' => 'Spara ändringar', 'callback' => function () {
         $res = $this->di->dispatcher->forward(['controller' => 'user', 'action' => 'update', 'params' => [$this->Value('id'), $this->Value('acronym'), $this->Value('email'), $this->Value('text')]]);
         $this->saveInSession = true;
         return $res;
     }]]);
 }
Example #22
0
 /**
  * Constructor
  *
  */
 public function __construct($answerId = null, $questionId = null)
 {
     parent::__construct([], ['text' => ['type' => 'textarea', 'placeholder' => '...', 'id' => 'inputEmail', 'class' => 'form-control', 'label' => 'Din kommentar', 'required' => true, 'validation' => ['not_empty']], 'questionId' => ['type' => 'hidden', 'value' => $questionId], 'answerId' => ['type' => 'hidden', 'value' => $answerId], 'submit' => ['type' => 'submit', 'class' => 'btn btn-lg btn-primary btn-block', 'value' => 'Skicka', 'callback' => function () {
         $res = $this->di->dispatcher->forward(['controller' => 'comments', 'action' => 'addComment', 'params' => [$this->Value('text'), $this->Value('answerId'), $this->Value('questionId')]]);
         $this->saveInSession = true;
         return $res;
     }]]);
 }
Example #23
0
 /**
  * Constructor
  *
  */
 public function __construct()
 {
     parent::__construct([], ['text' => ['type' => 'textarea', 'label' => 'Ditt svar', 'required' => true, 'validation' => ['not_empty']], 'submit' => ['type' => 'submit', 'callback' => function () {
         $res = $this->di->dispatcher->forward(['controller' => 'answers', 'action' => 'add', 'params' => [$this->Value('text')]]);
         $this->saveInSession = true;
         return $res;
     }]]);
 }
Example #24
0
 /**
  * Constructor
  *
  */
 public function __construct()
 {
     parent::__construct([], ['acronym' => ['type' => 'text', 'placeholder' => 'Användarnamn', 'id' => 'inputEmail', 'class' => 'form-control', 'label' => 'Användarnamn', 'required' => true, 'validation' => ['not_empty']], 'password' => ['type' => 'password', 'placeholder' => 'Lösenord', 'id' => 'inputPassword', 'class' => 'form-control', 'label' => 'Lösenord: ', 'required' => true, 'validation' => ['not_empty']], 'pwd-repeat' => ['type' => 'password', 'placeholder' => 'Lösenord', 'id' => 'inputPassword', 'class' => 'form-control', 'label' => 'Repetera lösenord', 'required' => true, 'validation' => ['match' => 'password']], 'email' => ['type' => 'text', 'placeholder' => 'E-mail', 'id' => 'inputEmail', 'class' => 'form-control', 'required' => true, 'validation' => ['not_empty', 'email_adress']], 'submit' => ['type' => 'submit', 'class' => 'btn btn-lg btn-primary btn-block', 'value' => 'Registrera dig', 'callback' => function () {
         $res = $this->di->dispatcher->forward(['controller' => 'user', 'action' => 'add', 'params' => [$this->Value('acronym'), $this->Value('password'), $this->Value('email')]]);
         $this->saveInSession = true;
         return $res;
     }]]);
 }
Example #25
0
 /**
  * Constructor need param page to keep track
  * of the right page to save comments to
  * @param  $page
  */
 public function __construct($tags = null)
 {
     $array = array();
     foreach ($tags as $tag) {
         $array[] = $tag->name;
     }
     parent::__construct([], ['title' => ['type' => 'text', 'label' => 'Title:', 'required' => false, 'validation' => ['not_empty']], 'content' => ['type' => 'textarea', 'label' => 'question:', 'required' => false, 'validation' => ['not_empty']], 'items' => array('type' => 'checkbox-multiple', 'values' => $array), 'submit' => ['type' => 'submit', 'callback' => [$this, 'callbackSubmit'], 'value' => 'save', 'class' => 'btn btn-primary']]);
 }
Example #26
0
 /**
  * Constructor
  *
  */
 public function __construct($pagekey, $redirect)
 {
     parent::__construct([], ['content' => ['type' => 'textarea', 'label' => 'Svar', 'required' => true, 'validation' => ['not_empty']], 'submit' => ['type' => 'submit', 'callback' => [$this, 'callbackSubmit'], 'value' => 'Spara'], 'reset' => ['type' => 'reset', 'value' => 'Återställ']]);
     $this->pagekey = $pagekey;
     $this->redirect = $redirect;
     $this->id = $_SESSION['user']->id;
     $this->acronym = $_SESSION['user']->acronym;
 }
Example #27
0
 /**
  * Constructor
  *
  */
 public function __construct()
 {
     parent::__construct([], ['acronym' => ['type' => 'text', 'label' => 'Användarnamn', 'required' => true, 'validation' => ['not_empty']], 'password' => ['type' => 'password', 'label' => 'Lösenord', 'required' => true, 'validation' => ['not_empty']], 'submit' => ['type' => 'submit', 'value' => 'Logga in', 'callback' => function () {
         $res = $this->di->dispatcher->forward(['controller' => 'user', 'action' => 'login', 'params' => [true, $this->Value('acronym'), $this->Value('password')]]);
         $this->saveInSession = true;
         return $res;
     }]]);
 }
Example #28
0
 /**
  * Constructor
  *
  */
 public function __construct($id = null, $pagekey = null, $title = null, $description = null, $language = '', $image_title = '', $image_url = '', $image_link = '', $image_width = '', $image_height = '')
 {
     parent::__construct([], ['pagekey' => ['type' => 'text', 'label' => 'Sidans nyckel (page key)', 'required' => true, 'validation' => ['not_empty'], 'value' => $pagekey], 'title' => ['type' => 'text', 'label' => 'Titel', 'required' => true, 'validation' => ['not_empty'], 'value' => $title], 'description' => ['type' => 'text', 'label' => 'Beskrivning', 'required' => true, 'validation' => ['not_empty'], 'value' => $description], 'language' => ['type' => 'text', 'label' => 'Språk (t.ex. sv-se)', 'required' => false, 'validation' => [], 'value' => $language], 'image_title' => ['type' => 'text', 'label' => 'Bildtitel', 'required' => false, 'validation' => [], 'value' => $image_title], 'image_url' => ['type' => 'text', 'label' => 'URL till bilden', 'required' => false, 'validation' => ['web_adress'], 'value' => $image_url], 'image_link' => ['type' => 'text', 'label' => 'Bildlänk', 'required' => false, 'validation' => ['web_adress'], 'value' => $image_link], 'image_width' => ['type' => 'text', 'label' => 'Bildbredd', 'required' => false, 'validation' => [], 'value' => $image_width], 'image_height' => ['type' => 'text', 'label' => 'Bildhöjd', 'required' => false, 'validation' => [], 'value' => $image_height], 'submit' => ['type' => 'submit', 'callback' => [$this, 'callbackSubmit'], 'value' => 'Spara']]);
     $this->id = $id;
     $this->pagekey = $pagekey;
     $this->title = $title;
     $this->description = $description;
 }
 /**
  * Constructor
  *
  */
 public function __construct($id = null, $heading = null, $desc = null, $tags = null)
 {
     $this->id = $id;
     $this->heading = $heading;
     $this->desc = $desc;
     $this->tags = $tags;
     parent::__construct(['class' => 'user-form'], ['heading' => ['type' => 'text', 'label' => 'Name:', 'required' => true, 'validation' => ['not_empty'], 'value' => $heading], 'tags' => ['type' => 'text', 'label' => 'Tags:', 'value' => $tags], 'desc' => ['type' => 'textarea', 'required' => true, 'validation' => ['not_empty'], 'value' => $desc], 'submit' => ['type' => 'submit', 'callback' => [$this, 'callbackSubmit']], 'submit-fail' => ['type' => 'submit', 'callback' => [$this, 'callbackSubmitFail']]]);
 }
Example #30
0
 public function __construct($answers, $activities, $userId, $question, $acronym, $answer = null)
 {
     $this->answers = $answers;
     $this->activities = $activities;
     $this->userId = $userId;
     $this->question = $question;
     $this->acronym = $acronym;
     parent::__construct([], ['text' => ['type' => 'textarea', 'class' => 'form-control', 'label' => 'Svar:', 'required' => true, 'validation' => ['not_empty'], 'value' => isset($answer) ? $answer->text : ''], 'submit' => ['type' => 'submit', 'class' => 'btn', 'value' => 'Skicka', 'callback' => [$this, 'callbackSubmit']]]);
 }