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


PHP Form::getValues方法代码示例

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


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

示例1: onSubmit

 public function onSubmit(Form $form)
 {
     $data = $form->getValues();
     // Předáme data do šablony
     $this->template->values = $data;
     $queueId = uniqid();
     \dibi::begin();
     $gallery_id = $this->gallery->insert(array("name" => $data["name"]));
     // Přesumene uploadované soubory
     foreach ($data["upload"] as $file) {
         // $file je instance HttpUploadedFile
         $newFilePath = FILESTORAGE_DIR . "/q{" . $queueId . "}__f{" . rand(10, 99) . "}__" . $file->getName();
         // V produkčním módu nepřesunujeme soubory...
         if (!Environment::isProduction()) {
             if ($file->move($newFilePath)) {
                 $this->flashMessage("Soubor " . $file->getName() . " byl úspěšně přesunut!");
             } else {
                 $this->flashMessage("Při přesouvání souboru " . $file->getName() . " nastala chyba! Pro více informací se podívejte do logů.");
             }
         }
         $this->files->insert($file);
         $this->gallery->addFile($gallery_id, $file_id);
         dump($file);
     }
     \dibi::commit();
 }
开发者ID:soundake,项目名称:pd,代码行数:26,代码来源:GalleryJoinPresenter.php

示例2: saveEvent

 public function saveEvent(Form $form)
 {
     $values = $form->getValues();
     if ($form['save']->isSubmittedBy()) {
         $categories = $values['categories'];
         unset($values['categories']);
         if ($form->onSuccess) {
             unset($values['agree']);
             $values['user_id'] = $this->user->loggedIn ? $this->user->id : null;
             $values['subject_id'] = 1;
             // anonymní akce // anonymní subjekt
             $values['approved'] = 0;
             $values['visible'] = 1;
             $values['reviewed'] = 0;
             $pd = $this->context->createService('events')->insert($values);
             $id = $pd->id;
             $this->flashMessage('Akce uložena do zásobníku', 'success');
             \dibi::begin();
             foreach ($categories as $n) {
                 \dibi::query('INSERT INTO [event_x_category] SET [event_id]=%i', $id, ', [category_id]=%i', $n);
             }
             \dibi::commit();
         }
         $form->addError('Something bad happend.');
     }
     $this->redirect('upload-photos', array('event_id' => $id));
 }
开发者ID:soundake,项目名称:pd,代码行数:27,代码来源:AddPresenter.php

示例3: getValues

 /**
  * @inheritDoc
  */
 public function getValues($asArray = false)
 {
     $values = parent::getValues(true);
     // Sanitize Redirect URIs
     $redirect_uris = preg_split("/[\t\r\n]+/", $values['redirect_uri']);
     $redirect_uris = array_filter($redirect_uris, function ($redirect_uri) {
         return !empty(trim($redirect_uri));
     });
     $values['redirect_uri'] = $redirect_uris;
     return $values;
 }
开发者ID:sgomez,项目名称:simplesamlphp-module-oauth2,代码行数:14,代码来源:ClientForm.php

示例4: savePassword

 public function savePassword(Form $form)
 {
     $values = $form->getValues();
     try {
         $this->item->update(array('password' => hash("sha512", $values->prvniheslo . str_repeat('mooow', 10)), 'generated_password' => 0));
         $this->flashMessage('Password saved', 'success');
         $this->redirect('User:');
     } catch (Nette\InvalidArgumentException $e) {
         $this->flashMessage($e, 'error');
     }
 }
开发者ID:soundake,项目名称:pd,代码行数:11,代码来源:UserPresenter.php

示例5: savePassword

 public function savePassword(Form $form)
 {
     $values = $form->getValues();
     try {
         $users = $this->context->createServiceUsers();
         $users->get($this->user->id)->update(array('password' => $users->calculateHash($values['prvniheslo']), 'generated_password' => 0));
         $this->flashMessage('Password saved', 'success');
         $this->redirect('User:');
     } catch (\Nette\InvalidArgumentException $e) {
         $this->flashMessage($e, 'error');
     }
 }
开发者ID:soundake,项目名称:pd,代码行数:12,代码来源:UserPresenter.php

示例6: createComponentArticleForm

 public function createComponentArticleForm()
 {
     $form = new Nette\Forms\Form();
     $form->addText('title', 'Název')->setRequired('Název je povinný')->addRule(Form::MAX_LENGTH, 'Délka je maximálně 60 znaků', 60);
     $form->addTextArea('content', 'Obsah')->setRequired();
     $form->addButton('send', 'Přidat');
     $form->onSuccess[] = array($form, function ($form) {
         $values = $form->getValues();
         //doSomething($values->title);
     });
     return $form;
 }
开发者ID:KennyDaren,项目名称:Nette_Lessons,代码行数:12,代码来源:HomepagePresenter.php

示例7: aktualityFormSuccess

 public function aktualityFormSuccess(Nette\Forms\Form $form)
 {
     $values = $form->getValues();
     $aktualitaId = $this->getParameter('id');
     if ($aktualitaId) {
         //Debugger::fireLog('editace');
         $this->aktualityModel->updateAktuality($aktualitaId, $values);
         $this->flashMessage("aktualita " . $values['name'] . " byla upravena");
         $this->redirect('Aktuality:prehledAktualit');
     } else {
         $this->aktualityModel->newAktualita($values);
         $this->flashMessage("Aktualita vložena");
         $this->redirect('Aktuality:prehledAktualit');
     }
 }
开发者ID:re1la2pse,项目名称:detinsky_projekt,代码行数:15,代码来源:AktualityPresenter.php

示例8: rezervaceFormSuccess

 public function rezervaceFormSuccess(Nette\Forms\Form $form)
 {
     $values = $form->getValues();
     $rezervaceId = $this->getParameter('id');
     if ($rezervaceId) {
         //Debugger::fireLog('editace');
         $this->rezervaceModel->updateRezervace($rezervaceId, $values);
         $this->flashMessage("Rezervace " . $values['name'] . " upravena");
         $this->redirect('Ubytovani:prehledRezervace');
     } else {
         //Debugger::fireLog('nova rezervace');
         $this->rezervaceModel->newRezervace($values);
         $this->flashMessage("Rezervace vložena");
         $this->redirect('Ubytovani:prehledRezervace');
     }
 }
开发者ID:re1la2pse,项目名称:detinsky_projekt,代码行数:16,代码来源:UbytovaniPresenter.php

示例9: pageSaving

 private function pageSaving(\Nette\Forms\Form $form, $isDraft)
 {
     if (!$this->authorizator->isAllowed($this->user, 'page', 'create') or !$this->authorizator->isAllowed($this->user, 'page', 'edit')) {
         $this->flashMessage('authorization.noPermission', FlashMessage::WARNING);
         return;
     }
     $values = $form->getValues(true);
     $values['saveAsDraft'] = (bool) $isDraft;
     $values['author'] = $this->user;
     $tags = $form->getHttpData(Form::DATA_TEXT, 'tags[]');
     $values['tags'] = $tags;
     try {
         $page = $this->pageFacade->save($values, $this->page);
         $this->flashMessage('pageEditForm.messages.success' . ($values['saveAsDraft'] ? 'Draft' : 'Publish'), FlashMessage::SUCCESS);
         $this->onSuccessPageSaving($this, $page);
     } catch (PagePublicationTimeMissingException $ptm) {
         $form->addError($this->translator->translate('pageEditForm.messages.missingPublicationTime'));
         return;
     } catch (PagePublicationTimeException $pt) {
         $form->addError($this->translator->translate('pageEditForm.messages.publishedPageInvalidPublicationTime'));
         return;
     } catch (PageIntroHtmlLengthException $pi) {
         $form->addError($this->translator->translate('pageEditForm.messages.pageIntroHtmlLength'));
         return;
     } catch (PageTitleAlreadyExistsException $at) {
         $form->addError($this->translator->translate('pageEditForm.messages.titleExists'));
         return;
     } catch (UrlAlreadyExistsException $ur) {
         $form['url']->setValue(Strings::webalize($values['title'], '/'));
         $form->addError($this->translator->translate('pageEditForm.messages.urlExists'));
         return;
     } catch (DBALException $e) {
         $form->addError($this->translator->translate('pageEditForm.messages.savingError'));
         return;
     }
 }
开发者ID:blitzik,项目名称:CMS,代码行数:36,代码来源:PageFormControl.php

示例10: quickSearchFormSucceeded

 /**
  * @param Form $form
  */
 public function quickSearchFormSucceeded(Form $form)
 {
     $v = $form->getValues();
     if (Strings::length($v->q) >= 3) {
         $this->fulltextQuery = $v->q;
     }
     if ($this->isAjax()) {
         $this->redrawControl('datalist');
     }
 }
开发者ID:aprila,项目名称:app-knowledge-base,代码行数:13,代码来源:UsersPresenter.php

示例11: array

$form->addHidden('b7', '[B7]');
$form->addText('stanoviste', 'Číslo stanoviště:')->setOption('description', 'Zadejte číslo stanoviště od 1 do 999')->setRequired('Zadejte číslo od 1 do 999')->addRule(Form::INTEGER, 'Stanoviště musí být číslo')->addRule(Form::RANGE, 'Číslo musí být od 1 do 99', array(1, 999))->setType('number');
$form->addHidden('cards');
$form->addHidden('ftp', '[FTP]');
$form->addHidden('server');
$form->addHidden('user');
$form->addHidden('password');
$form->addHidden('dstdir');
$form->addHidden('db', '[DB]');
$form->addHidden('script');
$form->addHidden('dbserver');
$form->addHidden('dbport');
$form->addHidden('dbuser');
$form->addHidden('dbpassword');
$form->addHidden('dbname');
$form->addHidden('dbtablename');
$form->addSubmit('send', 'Uložit');
$form->setDefaults($ini_array);
echo $form;
// vykreslí formulář
if ($form->isSuccess()) {
    $values = $form->getValues(true);
    if ($IniFile->write_php_ini($values)) {
        echo "\t<script>\n\t\t\t\t\t\t\talert('Formulář byl uložen');\n\t\t\t\t\t\t\twindow.location.replace('index.php');\n\t\t\t\t\t\t</script>)";
    }
}
?>
		</div>
	</body>
</html>
开发者ID:nakoukal,项目名称:raspi_www,代码行数:30,代码来源:index.php

示例12: Form

<div class="page-header">
  <h1>
    <i class="fa fa-plus"></i> Add a new station log
  </h1>
</div>
<?php 
use Nette\Forms\Form;
use Kdyby\BootstrapFormRenderer\BootstrapRenderer;
$form = new Form();
$form->setRenderer(new BootstrapRenderer());
$form->addProtection();
$form->addText('reporter', 'Nickname')->setAttribute('placeholder', 'anonymous')->setRequired();
date_default_timezone_set("UTC");
$form->addText('datetime', 'When')->setAttribute('placeholder', '2014-01-01 14:00')->setDefaultValue(date('Y-m-d H:i:s'))->setRequired();
$form->addText('station', 'Station designator')->setRequired()->setAttribute('placeholder', 'E11');
$form->addText('qrh', 'Frequency')->setRequired()->setAttribute('placeholder', '4625')->addRule(Form::FLOAT);
$form->addText('callnumber', 'Call # (leave empty if not captured)')->setAttribute('placeholder', '472 639 5 or 441/30');
$form->addText('callid', 'Call ID (leave empty if not captured)')->setAttribute('placeholder', '472 639 5 or 441/30');
$form->addText('gc', 'Group Count')->setAttribute('placeholder', '10');
$form->addTextArea('body', 'Message (leave empty if not captured)')->setAttribute('placeholder', '39715 12345');
$form->addSubmit('send', 'Add to our mighty database');
if ($form->isSuccess() && $form->isValid()) {
    //die();
    $f = $form->getValues();
    //dump($f);
    $arr = array('time' => $f['datetime'], 'station' => $f['station'], 'qrh' => $f['qrh'], 'call_number' => $f['callnumber'], 'call_id' => $f['callid'], 'gc' => $f['gc'], 'body' => $f['body'], 'reporter' => $f['reporter']);
    dibi::query('insert into logs_new', $arr);
    echo "Log has been added. Thank you.";
}
$form->render();
开发者ID:TomHetmer,项目名称:logs-db,代码行数:30,代码来源:new.php

示例13: array

// group Your account
$form->addGroup('Your account');
$form->addPassword('password', 'Choose password')->addRule(Form::FILLED, 'Choose your password')->addRule(Form::MIN_LENGTH, 'The password is too short: it must be at least %d characters', 3)->setOption('description', '(at least 3 characters)');
$form->addPassword('password2', 'Reenter password')->addConditionOn($form['password'], Form::VALID)->addRule(Form::FILLED, 'Reenter your password')->addRule(Form::EQUAL, 'Passwords do not match', $form['password']);
$form->addFile('avatar', 'Picture');
$form->addHidden('userid');
$form->addTextArea('note', 'Comment');
// group for buttons
$form->addGroup();
$form->addSubmit('submit', 'Send');
// Step 2: Check if form was submitted?
if ($form->isSubmitted()) {
    // Step 2c: Check if form is valid
    if ($form->isValid()) {
        echo '<h2>Form was submitted and successfully validated</h2>';
        $values = $form->getValues();
        Debug::dump($values);
        // this is the end, my friend :-)
        if (empty($disableExit)) {
            exit;
        }
    }
} else {
    // not submitted, define default values
    $defaults = array('name' => 'John Doe', 'userid' => 231, 'country' => 'CZ');
    $form->setDefaults($defaults);
}
// Step 3: Render form
?>
<!DOCTYPE html>
<html lang="en">
开发者ID:jakubkulhan,项目名称:nette,代码行数:31,代码来源:custom-rendering.php

示例14:

$countries = ['World' => ['bu' => 'Buranda', 'qu' => 'Qumran', 'st' => 'Saint Georges Island'], '?' => 'other'];
$form->addSelect('country', 'Country:', $countries)->setPrompt('Select your country')->addConditionOn($form['send'], $form::FILLED)->setRequired('Select your country');
// group Your account
$form->addGroup('Your account');
$form->addPassword('password', 'Choose password:')->setRequired('Choose your password')->addRule($form::MIN_LENGTH, 'The password is too short: it must be at least %d characters', 3);
$form->addPassword('password2', 'Reenter password:')->setRequired('Reenter your password')->addRule($form::EQUAL, 'Passwords do not match', $form['password']);
$form->addUpload('avatar', 'Picture:')->setRequired(FALSE)->addRule($form::IMAGE, 'Uploaded file is not image');
$form->addHidden('userid');
$form->addTextArea('note', 'Comment:');
// group for buttons
$form->addGroup();
$form->addSubmit('submit', 'Send');
$form->setDefaults(['name' => 'John Doe', 'userid' => 231]);
if ($form->isSuccess()) {
    echo '<h2>Form was submitted and successfully validated</h2>';
    Dumper::dump($form->getValues(), [Dumper::COLLAPSE => FALSE]);
    exit;
}
?>
<!DOCTYPE html>
<meta charset="utf-8">
<title>Nette Forms basic example</title>
<link rel="stylesheet" media="screen" href="assets/style.css" />
<script src="https://nette.github.io/resources/js/netteForms.js"></script>

<h1>Nette Forms basic example</h1>

<?php 
echo $form;
?>
开发者ID:nette,项目名称:forms,代码行数:30,代码来源:basic-example.php

示例15: Form

use Nette\Diagnostics\Debugger;
use Nette\Forms\Form;
// Generate form
$f = new Form("upload-form");
$f->getElementPrototype()->id = "frm";
$f->setMethod("GET");
$f->addSelect("speed", "Speed", array(1 => "1byte/s", 50 => "50bytes/s", 512 => "512bytes/s", 1 * FDTools::KILOBYTE => "1kb/s", 5 * FDTools::KILOBYTE => "5kb/s", 20 * FDTools::KILOBYTE => "20kb/s", 32 * FDTools::KILOBYTE => "32kb/s", 50 * FDTools::KILOBYTE => "50kb/s", 64 * FDTools::KILOBYTE => "64kb/s", 100 * FDTools::KILOBYTE => "100kb/s", 128 * FDTools::KILOBYTE => "128kb/s", 200 * FDTools::KILOBYTE => "200kb/s", 256 * FDTools::KILOBYTE => "256kb/s", 300 * FDTools::KILOBYTE => "300kb/s", 512 * FDTools::KILOBYTE => "512kb/s", 1 * FDTools::MEGABYTE => "1mb/s", 2 * FDTools::MEGABYTE => "2mb/s", 5 * FDTools::MEGABYTE => "5mb/s", 10 * FDTools::MEGABYTE => "10mb/s", 0 => "Unlimited"));
$f->addText("filename", "Filename")->addRule(Form::FILLED, "You must fill name!");
$f->addSelect("size", "Size", array(1 => "1MB", 4 => "4MB", 8 => "8MB", 16 => "16MB", 32 => "32MB", 64 => "64MB", 128 => "128MB", 256 => "256MB", 512 => "512MB"));
$f->addSelect("log", "Log called events?", array(0 => "No", 1 => "Yes (may cause CPU load)"));
$f->addSubmit("download", "Download!");
$f->setDefaults(array("speed" => 50, "filename" => "Some horrible file name - ěščřžýáíé.bin", "size" => 8, "log" => 1));
if ($f->isSubmitted() and $f->isValid()) {
    Debugger::enable(Debugger::PRODUCTION);
    // Log errors to file!
    $val = $f->getValues();
    $location = dirname(__FILE__) . "/cache/test-" . $val["size"] . "MB.tmp";
    if (!file_exists($location)) {
        generateFile($location, $val["size"] * 1024);
    }
    /* Interface with getters and setters */
    $file = new FileDownload();
    $file->sourceFile = $location;
    $file->transferFileName = $val["filename"];
    $file->speedLimit = (int) $val["speed"];
    //$file->mimeType = $val["mimeType"];
    /* Functions defined in example_library.php */
    if ($val["log"] == 1) {
        $file->onBeforeDownloaderStarts[] = "onBeforeDownloaderStarts";
        $file->onBeforeOutputStarts[] = "onBeforeOutputStarts";
        $file->onStatusChange[] = "onStatusChange";
开发者ID:jkuchar,项目名称:FileDownloader-example,代码行数:31,代码来源:index.php


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