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


PHP HTMLForm::getData方法代码示例

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


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

示例1: renderForm

 public function renderForm()
 {
     $model = $this->model;
     $form = new HTMLForm();
     $form->open('addsection', '', 'POST');
     $form->setInput('sname')->setAttr('type|text')->setAttr('onkeyup|document.getElementById(\'child\').value=translit(this.value)')->setAttr(isset($_POST['sname']) ? 'value|' . $_POST['sname'] : '')->setRules('notempty')->setErrorText('Введите наименование раздела')->setAttr('class|form-control input-lg')->addInput();
     $form->setInput('sindex')->setAttr('type|text')->setAttr('id|child')->setAttr(isset($_POST['sindex']) ? 'value|' . $_POST['sindex'] : '')->setRules('notempty|regexp[#([a-z]){3,}#i]')->setErrorText('Введите псевдоним раздела (от 3х букв)')->setAttr('class|form-control input-lg')->addInput();
     $form->setTextarea('sdescription')->setAttr('class|form-control')->setRules('notempty')->setText(isset($_POST['sdescription']) ? $_POST['sdescription'] : '')->setErrorText('Введите описание раздела')->addTextarea();
     $form->setInput('createsection')->setAttr('type|submit')->setAttr('class|btn btn-primary btn-lg addpage')->setAttr('value|Создать')->addInput();
     $formAddsection = $form->close();
     Bufer::set(array('formAddsection' => $formAddsection));
     if (!$form->sendForm('createsection')) {
         $errors = $form->getErrors();
         Bufer::add(array('errors' => $errors));
     } else {
         $data = $form->getData();
         $data = array('sname' => $this->model->escape($data['sname']), 'sdescription' => $this->model->escape($data['sdescription']), 'sindex' => $this->model->escape($data['sindex']));
         $checkIndexSection = $this->model->checkIndexSection($data);
         if (!isset($checkIndexSection['errors'])) {
             $result = $this->addsection($data, $formAddsection);
             if ($result['errors']) {
                 Bufer::add(array('errors' => $result['errors']));
             }
         } else {
             Bufer::add(array('errors' => $checkIndexSection['errors']));
         }
     }
 }
开发者ID:vasinsky,项目名称:fw-test,代码行数:28,代码来源:addsection.php

示例2: renderForm

 public function renderForm()
 {
     $form = new HTMLForm();
     $form->open('addgroupusers', '', 'POST');
     $form->setInput('aname')->setAttr('type|text')->setRules('notempty|trim')->setErrorText('Введите наименование группы')->setAttr('class|form-control input-lg')->addInput();
     $form->setInput('addgroupusers')->setAttr('type|submit')->setAttr('class|btn btn-primary btn-lg addpage')->setAttr('value|Создать')->addInput();
     $formAddGroupUsers = $form->close();
     Bufer::set(array('formAddGroupUsers' => $formAddGroupUsers));
     if (!$form->sendForm('addgroupusers')) {
         $errors = $form->getErrors();
         Bufer::add(array('errors' => $errors));
     } else {
         $data = $form->getData();
         $checkName = $this->checkName($data['aname']);
         if ($checkName['success'] === false) {
             Bufer::add(array('errors' => $checkName['error']));
         } else {
             $data = array('aname' => $this->model->escape($data['aname']));
             $result = $this->addGroupUsers($data);
             if ($result['success'] === false) {
                 Bufer::add(array('errors' => $result['error']));
             } else {
                 Route::go('?mode=admin&route=groupsusers');
             }
         }
     }
 }
开发者ID:vasinsky,项目名称:test,代码行数:27,代码来源:addgroupusers.php

示例3: renderForm

 public function renderForm()
 {
     $form = new HTMLForm();
     $hsid = isset($_GET['hsid']) ? (int) $_GET['hsid'] : 0;
     $data = $this->getDataHtmlSnippet($hsid);
     $form->open('editsnippet', '', 'POST');
     $form->setInput('hsname')->setRules('regexp[#[a-z\\-_0-9]{3,15}#i]')->setErrorText('Имя сниппета может содержать след. символы: a-z_-0-9  от 3 до 15 символов')->setAttr('class|form-control input-lg')->setAttr(isset($data['hsname']) ? 'value|' . $data['hsname'] : '')->addInput();
     $form->setTextarea('hsdescription')->setRules('trim|notempty')->setErrorText('Введите описание снипета')->setAttr('class|desc  form-control')->setText(isset($data['hsdescription']) ? $data['hsdescription'] : '')->addTextarea();
     $form->setTextarea('code')->setRules('trim|notempty')->setErrorText('Введите код снипета')->setAttr('class|preview_desc form-control')->setAttr('id|content')->setText(isset($data['code']) ? $data['code'] : '')->addTextarea();
     $form->setInput('editsnippet')->setAttr('type|submit')->setAttr('class|btn btn-primary btn-lg addpage')->setAttr('value|Сохранить')->addInput();
     $formEditSnippet = $form->close();
     Bufer::add(array('formEditSnippet' => $formEditSnippet));
     /**
      * Провервка отправленной формы
      */
     if (!$form->sendForm('editsnippet')) {
         $errors = $form->getErrors();
         Bufer::add(array('errors' => $errors));
     } else {
         $data = $form->getData();
         $data = array('hsid' => $hsid = isset($_GET['hsid']) ? (int) $_GET['hsid'] : 0, 'hsname' => $this->model->escape($data['hsname']), 'hsdescription' => $this->model->escape($data['hsdescription']), 'code' => $this->model->escape($data['code']));
         $checkHsname = $this->model->checkHsname($data);
         if (!isset($checkHsname['error'])) {
             $result = $this->saveSnippet($data);
             if ($result['success'] === false) {
                 Bufer::add(array('errors' => $result['error']));
             } else {
                 Route::go('?mode=admin&route=edithtmlsnippets&hsid=' . $data['hsid']);
             }
         } else {
             Bufer::add(array('errors' => $checkHsname['error']));
         }
     }
 }
开发者ID:vasinsky,项目名称:test,代码行数:34,代码来源:edithtmlsnippets.php

示例4: renderForm

 public function renderForm()
 {
     $uid = isset($_GET['uid']) ? (int) $_GET['uid'] : 1;
     $result = $this->getUserData($uid);
     $access = $this->getAccessList();
     $form = new HTMLForm();
     $form->open('edituser', '', 'POST');
     $form->setInput('login')->setAttr('type|text')->setAttr(isset($result['userData']['login']) ? 'value|' . $result['userData']['login'] : '')->setRules('notempty|trim')->setErrorText('Введите логин пользователя')->setAttr('class|form-control input-lg')->addInput();
     $form->setInput('uid')->setAttr('type|hidden')->setAttr('value|' . $result['userData']['uid'])->addInput();
     $form->setInput('password')->setAttr('type|text')->setAttr(isset($result['userData']['password']) ? 'value|' . $result['userData']['password'] : '')->setRules('notempty|trim|length[40|40]')->setErrorText('Введите hash пароля пользователя (можно получить в генераторе под формой)')->setAttr('class|form-control input-lg')->addInput();
     $form->setInput('email')->setAttr('type|text')->setAttr(isset($result['userData']['email']) ? 'value|' . $result['userData']['email'] : '')->setRules('email')->setErrorText('Введён не корректный email пользователя')->setAttr('class|form-control input-lg')->addInput();
     $form->setSelect('access')->setAttr('class|form-control')->setAttr('style|width:300px')->setRules('notempty')->addSelect();
     $form->setInput('edituser')->setAttr('type|submit')->setAttr('class|btn btn-primary btn-lg addpage')->setAttr('value|Сохранить')->addInput();
     foreach ($access as $k => $v) {
         if (!in_array($v['acid'], array(2))) {
             $form->setOption($v['aname'])->setAttr('value|' . $v['acid'])->setAttr($result['userData']['isadmin'] == $v['acid'] ? 'selected|selected' : '')->addOption('access');
         }
     }
     $formUserData = $form->close();
     Bufer::set(array('errors' => isset($result['errors']) ? $result['errors'] : array(), 'userData' => $result['userData'], 'formUserData' => $formUserData));
     if (!$form->sendForm('edituser')) {
         $errors = $form->getErrors();
         Bufer::set(array('errors' => $errors, 'formUserData' => $formUserData));
     } else {
         $data = $form->getData();
         $data = array('uid' => $uid, 'login' => $this->model->escape($data['login']), 'password' => $this->model->escape($data['password']), 'email' => $this->model->escape($data['email']), 'access' => $this->model->escape($data['access']));
         $saveUser = $this->saveUser($data);
         if (!isset($saveUser['error'])) {
             Route::go('?mode=admin&route=edituser&uid=' . $uid);
         } else {
             Bufer::set(array('errors' => $saveUser['error'], '$formUserData' => $formUserData));
         }
     }
 }
开发者ID:vasinsky,项目名称:test,代码行数:34,代码来源:edituser.php

示例5: renderForm

 public function renderForm()
 {
     $acid = isset($_GET['acid']) ? (int) $_GET['acid'] : 0;
     $groupUsersData = $this->model->getGroupUsersData($acid);
     //echo '<pre>' . print_r($groupUsersData, 1) . '</pre>';
     $form = new HTMLForm();
     $form->open('editgroupusers', '', 'POST');
     $form->setInput('aname')->setAttr('type|text')->setAttr('value|' . $groupUsersData['groupUsersData']['aname'])->setRules('notempty|trim')->setErrorText('Введите наименование группы')->setAttr('class|form-control input-lg')->addInput();
     $form->setInput('editgroupusers')->setAttr('type|submit')->setAttr('class|btn btn-primary btn-lg addpage')->setAttr('value|Сохранить')->addInput();
     $formEditGroupUsers = $form->close();
     Bufer::set(array('formEditGroupUsers' => $formEditGroupUsers));
     if ($groupUsersData['success'] === false) {
         Bufer::add(array('errors' => $groupUsersData['error']));
     }
     if (!$form->sendForm('editgroupusers')) {
         $errors = $form->getErrors();
         Bufer::add(array('errors' => $errors));
     } else {
         $data = $form->getData();
         $data = array('acid' => $acid, 'aname' => $this->model->escape($data['aname']));
         $checkName = $this->checkName($data);
         if ($checkName['success'] === true) {
             $result = $this->saveGroupUsers($data);
             if ($result['success'] === false) {
                 Bufer::add(array('errors' => $result['error']));
             } else {
                 Route::go('?mode=admin&route=editgroupusers&acid=' . $acid);
             }
         } else {
             Bufer::add(array('errors' => $checkName['error']));
         }
     }
 }
开发者ID:vasinsky,项目名称:fw-test,代码行数:33,代码来源:editgroupusers.php

示例6: renderForm

 public function renderForm()
 {
     $form = new HTMLForm();
     $form->open('addsnippet', '', 'POST');
     $form->setInput('hsname')->setRules('regexp[#[a-z\\-_0-9]{3,15}#i]')->setErrorText('Имя сниппета может содержать след. символы: a-z_-0-9  от 3 до 15 символов')->setAttr('class|form-control input-lg')->setAttr(isset($_POST['hsname']) ? 'value|' . $_POST['hsname'] : '')->addInput();
     $form->setTextarea('hsdescription')->setRules('trim|notempty')->setErrorText('Введите описание снипета')->setAttr('class|desc  form-control')->setText(isset($_POST['hsdescription']) ? $_POST['hsdescription'] : '')->addTextarea();
     $form->setTextarea('hscode')->setRules('trim|notempty')->setErrorText('Введите код снипета')->setAttr('class|preview desc form-control')->setAttr('id|content')->setText(isset($_POST['hscode']) ? $_POST['hscode'] : '')->addTextarea();
     $form->setInput('addsnippet')->setAttr('type|submit')->setAttr('class|btn btn-primary btn-lg addpage')->setAttr('value|Создать')->addInput();
     $formAddSnippet = $form->close();
     Bufer::add(array('formAddSnippet' => $formAddSnippet));
     /**
      * Провервка отправленной формы
      */
     if (!$form->sendForm('addsnippet')) {
         $errors = $form->getErrors();
         Bufer::add(array('errors' => $errors));
     } else {
         $data = $form->getData();
         $data = array('hsname' => $this->model->escape($data['hsname']), 'hsdescription' => $this->model->escape($data['hsdescription']), 'hscode' => $this->model->escape($data['hscode']));
         $checkHsname = $this->model->checkHsname($data);
         if (!isset($checkHsname['error'])) {
             $this->addSnippet($data);
         } else {
             Bufer::add(array('errors' => $checkHsname['error']));
         }
     }
 }
开发者ID:vasinsky,项目名称:test,代码行数:27,代码来源:addhtmlsnippets.php

示例7: renderForm

 public function renderForm()
 {
     $model = $this->model;
     $pid = isset($_GET['pid']) ? (int) $_GET['pid'] : 0;
     $pageData = $this->getPage($pid);
     if (isset($pageData['errors'])) {
         Bufer::set(array('errors' => $pageData['errors']));
     } else {
         Bufer::set(array('pageData' => $pageData['pageData']));
     }
     $errors = isset($pageData['errors']) ? $pageData['errors'] : false;
     $dataPage = isset($pageData['pageData'][0]) ? $pageData['pageData'][0] : false;
     $getSections = $model->returnData("select * from section");
     $form = new HTMLForm();
     $form->open('addpage', '', 'POST');
     $form->setInput('title')->setAttr('type|text')->setAttr('onkeyup|document.getElementById(\'child\').value=translit(this.value)')->setAttr(isset($dataPage['title']) ? 'value|' . $dataPage['title'] : '')->setRules('notempty|trim')->setErrorText('Введите Title страницы')->setAttr('class|form-control input-lg')->addInput();
     $form->setInput('pid')->setAttr('type|hidden')->setAttr('value|' . $pid)->setRules('notempty')->addInput();
     $form->setInput('description')->setAttr('type|text')->setAttr(isset($dataPage['description']) ? 'value|' . $dataPage['description'] : '')->setRules('notempty')->setErrorText('Введите описание для страницы')->setAttr('class|form-control input-lg')->addInput();
     $form->setInput('keywords')->setAttr('type|text')->setAttr(isset($dataPage['keywords']) ? 'value|' . $dataPage['keywords'] : '')->setRules('notempty')->setErrorText('Введите ключевые слова для  страницы')->setAttr('class|form-control input-lg')->addInput();
     $form->setInput('index')->setAttr('type|text')->setAttr('id|child')->setAttr(isset($dataPage['name']) ? 'value|' . $dataPage['name'] : '')->setRules('notempty')->setErrorText('Введите псевдоним страницы')->setAttr('class|form-control input-lg')->addInput();
     $form->setSelect('section')->setAttr('class|form-control')->setAttr('style|width:300px')->setRules('notempty')->addSelect();
     foreach ($getSections as $s) {
         $form->setOption($s['sname'] . ' (' . $s['sindex'] . ')')->setAttr('value|' . $s['sid'])->setAttr(isset($dataPage['sid']) && $dataPage['sid'] == $s['sid'] ? 'selected|selected' : '')->addOption('section');
     }
     $form->setSelect('display')->setAttr('class|form-control')->setAttr('style|width:300px')->setRules('notempty')->addSelect();
     $display = array(1 => 'да', 2 => 'нет', 3 => 'только для администрации');
     foreach ($display as $k => $v) {
         $form->setOption($v)->setAttr('value|' . $k)->setAttr(isset($dataPage['display']) && $dataPage['display'] == $k ? 'selected|selected' : '')->addOption('display');
     }
     $form->setTextarea('preview')->setAttr('id|preview')->setText(isset($dataPage['preview']) ? $dataPage['preview'] : '')->setAttr('class|preview form-control')->setRules('trim')->addTextarea();
     $form->setTextarea('content')->setAttr('id|content')->setText(isset($dataPage['content']) ? $dataPage['content'] : '')->setAttr('class|addpage form-control content')->setRules('notempty')->addTextarea();
     $form->setInput('editpage')->setAttr('type|submit')->setAttr('class|btn btn-primary btn-lg addpage')->setAttr('value|Сохранить')->addInput();
     $formEditpage = $form->close();
     Bufer::set(array('errors' => $errors, 'formEditpage' => $formEditpage, 'titlePage' => isset($dataPage['title']) ? $dataPage['title'] : ''));
     /**
      * Провервка отправленной формы
      */
     if (!$form->sendForm('editpage')) {
         $errors = $form->getErrors();
         Bufer::set(array('errors' => $errors, 'formEditpage' => $formEditpage, 'titlePage' => isset($dataPage['title']) ? $dataPage['title'] : ''));
     } else {
         $data = $form->getData();
         $data = array('pid' => (int) $data['pid'], 'title' => $this->model->escape($data['title']), 'description' => $this->model->escape($data['description']), 'keywords' => $this->model->escape($data['keywords']), 'index' => $this->model->escape($data['index']), 'sid' => (int) $data['section'], 'display' => (int) $data['display'], 'preview' => $this->model->escape($data['preview']), 'content' => $this->model->escape($data['content']));
         $savePage = $this->savePage($data);
         $checkIndexPage = $this->model->checkIndexPage($data);
         if (!isset($checkIndexPage['error'])) {
             $result = $this->savePage($data, $formEditpage);
             if (!isset($savePage['errors'])) {
                 Route::go('?mode=admin&route=editpage&pid=' . $data['pid']);
             } else {
                 Bufer::set(array('errors' => $savePage['error'], 'formEditpage' => $formEditpage, 'titlePage' => isset($data['title']) ? $data['title'] : ''));
             }
         } else {
             Bufer::set(array('errors' => $checkIndexPage['error'], 'formEditpage' => $formEditpage, 'titlePage' => isset($data['title']) ? $data['title'] : ''));
         }
     }
 }
开发者ID:vasinsky,项目名称:fw-test,代码行数:57,代码来源:editpage.php

示例8: renderForm

 /**
  * Создание и  валидация формы
  */
 public function renderForm()
 {
     $form = new HTMLForm();
     $form->open('access', '', 'POST');
     $form->setInput('login')->setAttr('type|text')->setAttr('value| ')->setAttr('class|form-control input-lg')->setRules('trim|notempty')->setErrorText('Введите логин')->addInput();
     $form->setInput('password')->setAttr('type|password')->setAttr('class|form-control input-lg')->setRules('trim|notempty')->setErrorText('Введите пароль')->addInput();
     $form->setInput('capcha')->setAttr('type|text')->setAttr('class|form-control input-lg')->setAttr('id|captcha-form')->setRules('code[captcha]')->setErrorText('Не верно введён защитный код')->addInput();
     $form->setInput('enter')->setAttr('type|submit')->setAttr('class|btn btn-primary btn-lg')->setAttr('value|Войти')->addInput();
     $formAutorize = $form->close();
     /**
      * Провервка отправленной формы
      */
     if (!$form->sendForm('enter')) {
         $errors = $form->getErrors();
         Bufer::set(array('errors' => $errors, 'formAutorize' => $formAutorize));
     } else {
         $data = $form->getData();
         $this->access($data, $formAutorize);
     }
 }
开发者ID:vasinsky,项目名称:fw-test,代码行数:23,代码来源:autorization.php

示例9: renderForm

 public function renderForm()
 {
     $name = isset($_POST['name']) ? htmlspecialchars($_POST['name']) : '';
     $form = new HTMLForm();
     $form->open('addmodule', '', 'POST');
     $form->setInput('name')->setAttr('type|text')->setAttr('value|' . $name)->setRules('regexp[#^([a-z]{3,15})#iu]')->setErrorText('Наименование модуля должно быть выполнено по шаблону [a-z0-9]{3,15}')->setAttr('class|form-control input-lg')->addInput();
     $form->setSelect('mode')->setAttr('class|form-control')->setRules('notempty')->setErrorText('Укажите режим модуля')->addSelect();
     $display = array('2' => 'Для административной части (mode=admin)', '1' => 'Публичный (mode=public)');
     foreach ($display as $k => $v) {
         $form->setOption($v)->setAttr('value|' . $k)->addOption('mode');
     }
     $form->setInput('createmodule')->setAttr('type|submit')->setAttr('class|btn btn-primary btn-lg addpage')->setAttr('value|Создать')->addInput();
     $formAddModule = $form->close();
     Bufer::set(array('formAddModule' => $formAddModule));
     if (!$form->sendForm('createmodule')) {
         $errors = $form->getErrors();
         Bufer::add(array('errors' => $errors));
     } else {
         $data = $form->getData();
         $createmodule = $this->createModule(array('name' => $data['name'], 'mode' => $data['mode']), $formAddModule);
         return $createmodule;
     }
 }
开发者ID:vasinsky,项目名称:fw-test,代码行数:23,代码来源:addmodule.php


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