当前位置: 首页>>代码示例>>PHP>>正文


PHP CForm::__construct方法代码示例

本文整理汇总了PHP中Mos\HTMLForm\CForm::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP CForm::__construct方法的具体用法?PHP CForm::__construct怎么用?PHP CForm::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mos\HTMLForm\CForm的用法示例。


在下文中一共展示了CForm::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * 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;
 }
开发者ID:stjo15,项目名称:myDrone,代码行数:11,代码来源:CFormCommentEdit.php

示例2: __construct

 /**
  * 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;
 }
开发者ID:stjo15,项目名称:myDrone,代码行数:11,代码来源:CFormQuestionAdd.php

示例3: __construct

 /**
  * 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;
         }]]);
     }
 }
开发者ID:emanuelzone,项目名称:audiobox,代码行数:30,代码来源:CQuestionsForm.php

示例4: __construct

 /**
  * 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;
 }
开发者ID:stjo15,项目名称:janax,代码行数:11,代码来源:CFormCommentEdit.php

示例5: __construct

 /**
  * 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'];
 }
开发者ID:helikopterspark,项目名称:Anax-MVC,代码行数:11,代码来源:CFormEditComment.php

示例6: __construct

 /**
  * 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' => 'email@example.com', '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' => 'email@example.com', '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;
 }
开发者ID:stjo15,项目名称:janax,代码行数:29,代码来源:CFormUserUpdate.php

示例7: __construct

 /**
  * 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;
 }
开发者ID:KarlGW,项目名称:fo,代码行数:11,代码来源:CFormCommentAdd.php

示例8: __construct

 /**
  * 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;
 }
开发者ID:stjo15,项目名称:janax,代码行数:11,代码来源:CFormNewsAdd.php

示例9: __construct

 /**
  * 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']]]);
 }
开发者ID:helikopterspark,项目名称:WGTOTW,代码行数:11,代码来源:CFormAddComment.php

示例10: __construct

 /**
  * 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;
     })]);
 }
开发者ID:helikopterspark,项目名称:DV1483,代码行数:11,代码来源:CFormCCCheckout.php

示例11: __construct

 /**
  * 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;
 }
开发者ID:KarlGW,项目名称:phpmvc,代码行数:11,代码来源:CFormCommentEdit.php

示例12: __construct

 /**
  * 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']]);
 }
开发者ID:JompaGlitter,项目名称:phpmvc-project,代码行数:11,代码来源:FormUpdateUser.php

示例13: __construct

 /**
  * 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']]);
 }
开发者ID:JompaGlitter,项目名称:phpmvc-project,代码行数:14,代码来源:FormAddQuestionComment.php

示例14: __construct

 /**
  * 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']]);
 }
开发者ID:JompaGlitter,项目名称:phpmvc-project,代码行数:11,代码来源:FormAddQuestion.php

示例15: __construct

 /**
  * 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']]]);
 }
开发者ID:markusdybeck,项目名称:MVC-Projekt,代码行数:11,代码来源:FormUpdateTag.php


注:本文中的Mos\HTMLForm\CForm::__construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。