當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Forms類代碼示例

本文整理匯總了PHP中Forms的典型用法代碼示例。如果您正苦於以下問題:PHP Forms類的具體用法?PHP Forms怎麽用?PHP Forms使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Forms類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: actdelfield

 function actdelfield()
 {
     $model = new Forms();
     $field = $model->getField($_GET['id']);
     $model->delField();
     $this->redirect('/forms/' . $field['forms'] . '/');
 }
開發者ID:sov-20-07,項目名稱:billing,代碼行數:7,代碼來源:FormsController.php

示例2: leave

 public function leave()
 {
     $smarty = parent::load('smarty');
     $leave_form = parent::load('form', 'LeaveForm', $_POST);
     parent::load('model', 'forms');
     parent::load('model', 'system/contrib/auth.User');
     if (!$this->is_post()) {
         import('system/share/web/paginator');
         if (User::has_role('人力資源') || User::has_role('總經理')) {
             $data = Forms::get_by_type_and_user('請假申請');
             $smarty->assign('has_role', true);
         } else {
             $data = Forms::get_by_type_and_user('請假申請', User::info('id'));
         }
         $paginator = new Paginator((array) $data, $_GET['page'], 10);
         $smarty->assign('paginator', $paginator->output());
         $smarty->assign('page_title', '請假申請');
         $smarty->assign('leave_form', $leave_form->output());
         $smarty->display('forms/leave');
         return;
     }
     $form_data = new Forms();
     $form_data->user_id = User::info('id');
     $form_data->state = 0;
     $form_data->type = '請假申請';
     $form_data->form_data = serialize($_POST);
     $form_data->save();
     import('system/share/network/redirect');
     HTTPRedirect::flash_to('forms/leave', '提交請假申請成功, 請耐心等待審核', $smarty);
 }
開發者ID:uwitec,項目名稱:mgoa,代碼行數:30,代碼來源:FormsController.php

示例3: form

 public function form()
 {
     $form = new Forms();
     $form->start("barcodes.php");
     $form->input("import new barcodes", "import", $type = "textarea", null, null, 10);
     $form->button('import');
     $form->end();
 }
開發者ID:HQPDevCrew,項目名稱:BPU,代碼行數:8,代碼來源:Barcodes.class.php

示例4: actionEdit

 /**
  * Edit comment
  * @return void
  */
 public function actionEdit($id)
 {
     // authorization
     $this->checkAuth();
     $data = array();
     $data['page_title'] = 'Edit comment';
     $comment = $this->db->comment[$id];
     if (!$comment) {
         $this->notFound();
     }
     // Form
     $form = new Forms('commentEdit');
     $form->successMessage = 'Comment was saved.';
     $form->errorMessage = 'Error while saving comment. Try it later.';
     $form->addInput('text', 'name', 'Author', false, $comment['name']);
     $form->addInput('email', 'email', 'E-mail', true, $comment['email']);
     $form->addTextArea('comment', 'Comment', true, $comment['comment'], 2);
     $form->addSubmit('save', 'Save');
     if ($form->isValid()) {
         $auth = new Auth($this->db);
         $saveData = $form->values();
         $saveData['updated'] = new NotORM_Literal("NOW()");
         $commentSave = $comment->update($saveData);
         if ($commentSave) {
             $this->addMessage('success', 'Comment saved');
             $this->redirect('admin/comments');
         } else {
             $form->error();
         }
     }
     $data['editForm'] = $form->formHtml();
     $data['isAdmin'] = true;
     $this->renderTemplate('comment/edit', $data);
 }
開發者ID:rotten77,項目名稱:simpleblog,代碼行數:38,代碼來源:CommentController.php

示例5: actionEdit

 /**
  * Admin - edit post
  * 
  * @param  integer $id ID of post
  * @return void
  */
 public function actionEdit($id = null)
 {
     // authorization
     $this->checkAuth();
     $data = array();
     $data['page_title'] = 'New post';
     $post = array('title' => '', 'uri' => '', 'annotation' => '', 'content' => '', 'category_id' => '');
     if (!is_null($id)) {
         $post = $this->db->post[$id];
         if ($post) {
             $data['page_title'] = 'Edit post';
         } else {
             $this->notFound();
         }
     }
     // Form
     $form = new Forms('postEdit');
     $form->successMessage = 'Your post was saved.';
     $form->errorMessage = 'Error while saving post. Try it later.';
     $form->addInput('text', 'title', 'Title', true, $post['title']);
     $form->addInput('text', 'uri', 'URI', false, $post['uri']);
     // categories
     $categories = array('' => '= Choose category =');
     foreach ($this->db->category() as $category) {
         $categories[$category['id']] = $category['title'];
     }
     $form->addSelect('category_id', 'Category', $categories, true, $post['category_id']);
     $form->addTextArea('annotation', 'Annotation', true, $post['annotation']);
     $form->addTextArea('content', 'Content', true, $post['content']);
     $form->addSubmit('save', 'Save');
     if ($form->isValid()) {
         $auth = new Auth($this->db);
         $saveData = $form->values();
         $saveData['uri'] = trim($saveData['uri']);
         if ($saveData['uri'] == "") {
             $saveData['uri'] = $saveData['title'];
         }
         $saveData['uri'] = $this->text2url($saveData['uri']);
         $saveData['user_id'] = $auth->userInfo()->id;
         $saveData['updated'] = new NotORM_Literal("NOW()");
         if (is_null($id)) {
             $saveData['created'] = new NotORM_Literal("NOW()");
             $postSave = $this->db->post()->insert($saveData);
         } else {
             $postSave = $this->db->post[$id]->update($saveData);
         }
         if ($postSave) {
             $this->addMessage('success', 'Post saved');
             $this->redirect('admin');
             // $form->success();
         } else {
             $form->error();
         }
     }
     $data['editForm'] = $form->formHtml();
     $data['isAdmin'] = true;
     $this->renderTemplate('post/edit', $data);
 }
開發者ID:rotten77,項目名稱:simpleblog,代碼行數:64,代碼來源:PostController.php

示例6: actionRegister

 /**
  * Create user
  * @return void
  */
 public function actionRegister()
 {
     // if user is logged in, redirect to main page
     if ($this->checkLogin()) {
         $this->redirect('admin');
     }
     $form = new Forms('create');
     $form->successMessage = 'Account succesfully created.';
     $form->errorMessage = 'Error while creating account. Try it later.';
     $form->addInput('text', 'name', 'Full name', true);
     $form->addInput('email', 'email', 'E-mail', true);
     $form->addInput('password', 'password', 'Password', true);
     $form->addSubmit('create', 'Create account');
     if ($form->isValid()) {
         $formValues = $form->values();
         $userCheck = $this->db->user()->where('email', $formValues['email'])->count('id');
         if ($userCheck > 0) {
             $form->addMessage('warning', 'User with e-mail ' . $formValues['email'] . ' exists. LogIn or type other e-mail.');
         } else {
             $auth = new Auth($this->db);
             if ($auth->addUser($formValues['email'], $formValues['password'], $formValues['name'])) {
                 $auth->checkUser($formValues['email'], $formValues['password']);
                 $this->redirect('admin');
             } else {
                 $form->error();
             }
         }
     }
     $data['registerForm'] = $form->formHtml();
     $this->renderTemplate('admin/register', $data);
 }
開發者ID:rotten77,項目名稱:simpleblog,代碼行數:35,代碼來源:AdminController.php

示例7: lot_add

function lot_add()
{
    $session = Session::getInstance();
    if (!$session->checkLogin()) {
        return false;
    }
    $lot = new Lot();
    $lot->itemid = isset($_POST['itemid']) && is_numeric($_POST['itemid']) ? $_POST['itemid'] : 0;
    $lot->storeid = isset($_POST['storeid']) && is_numeric($_POST['storeid']) ? $_POST['storeid'] : 0;
    $lot->boxes = isset($_POST['box']) ? $_POST['box'] : 0;
    $lot->units = isset($_POST['units']) ? $_POST['units'] : 0;
    $lot->stock = isset($_POST['stock']) ? $_POST['stock'] : 0;
    $lot->active = isset($_POST['active']) ? $_POST['active'] : 0;
    $lot->cost = isset($_POST['costo']) ? $_POST['costo'] : 0;
    $lot->costMar = isset($_POST['tmar']) ? $_POST['tmar'] : 0;
    $lot->costTer = isset($_POST['tter']) ? $_POST['tter'] : 0;
    $lot->costAdu = isset($_POST['aduana']) ? $_POST['aduana'] : 0;
    $lot->costBank = isset($_POST['tbank']) ? $_POST['tbank'] : 0;
    $lot->costLoad = isset($_POST['cade']) ? $_POST['cade'] : 0;
    $lot->costOther = isset($_POST['other']) ? $_POST['other'] : 0;
    $lot->price = isset($_POST['pricef']) ? $_POST['pricef'] : 0;
    $lot->gloss = isset($_POST['notes']) ? $_POST['notes'] : '';
    if ($lot->add()) {
        header("location:" . Forms::getLink(FORM_LOT_DETAIL, array("lot" => $lot->id)));
    }
    return false;
}
開發者ID:BackupTheBerlios,項目名稱:rinventory-svn,代碼行數:27,代碼來源:lot.php

示例8: additional

 function additional()
 {
     $forms = Forms::getFormsList();
     foreach ($forms as $item) {
         Fields::$additional[$item['path']] = $item;
     }
     return Fields::$additional;
 }
開發者ID:sov-20-07,項目名稱:billing,代碼行數:8,代碼來源:Fields.php

示例9: testGetConfig

 public function testGetConfig()
 {
     $config = Forms::getConfig('form');
     $this->assertEquals('form', $config['name']);
     $config = Forms::getConfig('formGroup');
     $this->assertEquals('formGroup', $config['name']);
     $this->assertEquals('form-group', $config['attributes']['class']);
     $this->assertFalse(Forms::getConfig('NotKeyExists'));
 }
開發者ID:primalbase,項目名稱:twitter-bootstrap,代碼行數:9,代碼來源:NavbarTest.php

示例10: postDeleteField

 public function postDeleteField()
 {
     if (Helper::isBusinessOwner(Input::get('business_id'), Helper::userId())) {
         // PAG added permission checking
         Forms::deleteField(Input::get('form_id'));
         return json_encode(array('status' => 1));
     } else {
         return json_encode(array('message' => 'You are not allowed to access this function.'));
     }
 }
開發者ID:reminisense,項目名稱:featherq-laravel5,代碼行數:10,代碼來源:FormsController.php

示例11: showLogin

 public function showLogin($arr = array('user' => 'Username', 'pass' => 'Password', 'login' => 'Sign in'), $invalid)
 {
     require 'Forms.php';
     # in the same directory as Login.php
     $forms = new Forms('');
     $fcnt = 1;
     # First field
     foreach ($arr as $k => $v) {
         if ($k != 'login') {
             $forms->textBox($v, $k, $fcnt == 1 && isset($_POST["txt_{$k}"]) && !empty($_POST["txt_{$k}"]) ? $_POST["txt_{$k}"] : '', 1, in_array($v, $invalid), '', 1);
             if ($fcnt == 1) {
                 $u = $v;
                 $u2 = $k;
             }
             // End if.
             if ($fcnt == 2) {
                 $p = $v;
                 $p2 = $k;
             }
             // End if.
             $fcnt++;
         }
         // End if.
     }
     // End foreach.
     $forms->submitButton(isset($arr['login']) ? $arr['login'] : 'Sign in', 'login', 1);
     echo $forms->closeform();
     unset($forms);
     $focus = '';
     if (count($invalid) || empty($_POST["txt_{$p}"])) {
         $focus = "\n<script>document.forms[0].txt_{$p2}.focus();</script>";
     }
     if ((!count($invalid) || in_array($u, $invalid)) && empty($_POST["txt_{$u2}"])) {
         $focus = "\n<script>document.forms[0].txt_{$u2}.focus();</script>";
         //$focus = "\n<script>\$(document).ready(function(){ \$('.classform input[name=txt_{$u2}]').focus(); });</script>";
     }
     // End if.
     if (!empty($focus)) {
         echo $focus;
     }
     //else  echo '<script>document.forms[0].user.focus();</script>';
 }
開發者ID:bas2,項目名稱:classes,代碼行數:42,代碼來源:Login.php

示例12: saveCustomerRequest

 public static function saveCustomerRequest()
 {
     if (!isset($_POST['contact'])) {
         die(0);
     }
     $CustomerRequests = new Structures\CustomerRequests();
     $request = Forms::sanitize($_POST['contact']);
     $result = $CustomerRequests->set((object) $request);
     // Also notify admin
     Forms::sendToAdmin($request);
     die(!empty($result));
 }
開發者ID:Qclanton,項目名稱:retheme,代碼行數:12,代碼來源:Ajax.php

示例13: index

 public function index()
 {
     ipAddJs('Ip/Internal/Config/assets/config.js');
     ipAddCss('Ip/Internal/Config/assets/config.css');
     $form = Forms::getForm();
     $advancedForm = false;
     if (ipAdminPermission('Config advanced')) {
         $advancedForm = Forms::getAdvancedForm();
     }
     $data = array('form' => $form, 'advancedForm' => $advancedForm);
     return ipView('view/configWindow.php', $data)->render();
 }
開發者ID:Umz,項目名稱:ImpressPages,代碼行數:12,代碼來源:AdminController.php

示例14: actionEdit

 /**
  * Edit category
  * @return void
  */
 public function actionEdit($id = null)
 {
     // authorization
     $this->checkAuth();
     $data = array();
     $data['page_title'] = 'New category';
     $category = array('title' => '', 'uri' => '');
     if (!is_null($id)) {
         $category = $this->db->category[$id];
         if ($category) {
             $data['page_title'] = 'Edit category';
         } else {
             $this->notFound();
         }
     }
     // Form
     $form = new Forms('categoryEdit');
     $form->successMessage = 'Your category was saved.';
     $form->errorMessage = 'Error while saving category. Try it later.';
     $form->addInput('text', 'title', 'Title', true, $category['title']);
     $form->addInput('text', 'uri', 'URI', false, $category['uri']);
     $form->addSubmit('save', 'Save');
     if ($form->isValid()) {
         $auth = new Auth($this->db);
         $saveData = $form->values();
         $saveData['uri'] = trim($saveData['uri']);
         if ($saveData['uri'] == "") {
             $saveData['uri'] = $saveData['title'];
         }
         $saveData['uri'] = $this->text2url($saveData['uri']);
         $saveData['updated'] = new NotORM_Literal("NOW()");
         if (is_null($id)) {
             $categorySave = $this->db->category()->insert($saveData);
         } else {
             $categorySave = $this->db->category[$id]->update($saveData);
         }
         if ($categorySave) {
             $this->addMessage('success', 'Category saved');
             $this->redirect('admin/categories');
             // $form->success();
         } else {
             $form->error();
         }
     }
     $data['editForm'] = $form->formHtml();
     $data['isAdmin'] = true;
     $this->renderTemplate('category/edit', $data);
 }
開發者ID:rotten77,項目名稱:simpleblog,代碼行數:52,代碼來源:CategoryController.php

示例15: getMainSection

    protected function getMainSection()
    {
        $form = Forms::getRegisterForm();
        $js = Forms::getRegisterJs('/');
        $this->addInlineJs($js);
        return <<<HTML
<div class="container theme-showcase" role="main">
  <div class="jumbotron">
\t<h3>Register</h3>
{$form}
  </div>
</div>
HTML;
    }
開發者ID:excitom,項目名稱:megan-mvc,代碼行數:14,代碼來源:register-view.php


注:本文中的Forms類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。