本文整理汇总了PHP中Zend\Form\Form::addConfirmField方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::addConfirmField方法的具体用法?PHP Form::addConfirmField怎么用?PHP Form::addConfirmField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Form\Form
的用法示例。
在下文中一共展示了Form::addConfirmField方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleConfirm
/**
* Handle Confirm (Stage 4)
*
* @param array $post
* @param Form $form
* @param boolean $reload
*
* @return mixed
*/
protected function handleConfirm($post, $form, $reload = false)
{
$outcome = false;
$valid = false;
$request = $this->getRequest();
$invalid = false;
$form->setData($post);
if ($form->isValid()) {
if ($post && isset($post['match'], $post['leadTmpFile'])) {
$match = $post['match'];
if (Helper::is_json($match)) {
$match = json_decode($match, true);
}
$company = $post['Company'];
$tmp_file = $this->getUploadPath() . '/' . $post['leadTmpFile'];
$duplicates = isset($post['duplicate']) ? $post['duplicate'] : false;
$importFieldset = $form->getImportFieldset();
$form->addConfirmField();
$csv = $this->parseFile($tmp_file);
if ($csv['count']) {
$data = $this->mapImportedValues($csv['body'], $match, false);
$valid = $this->validateImportData($data, $duplicates);
if ($valid) {
$outcome = true;
$headings = $this->getHeadings();
$invalid = array_filter($valid);
$form = $this->addImportFields($form, $data, $valid);
$form->get('submit')->setValue('Confirm');
$form->addCancelField();
$form->addHiddenField('Company', $company);
$this->stage = 4;
$this->results['stage'] = $this->stage;
$this->results['fields'] = $form->getLeadAttributes();
$this->results['data'] = $data;
$this->results['valid'] = $valid;
$this->results['form'] = $form;
$this->results['headings'] = $headings;
$this->setImportCache($this->stage, $post);
}
}
if (!$valid || $valid === $invalid) {
$outcome = false;
$message = "No valid records could be imported.";
$this->flashMessenger()->addErrorMessage($message);
}
}
} else {
$message = "You have invalid Form Entries.";
$this->flashMessenger()->addErrorMessage($message);
$messages = $form->getMessages();
if ($messages) {
$this->flashMessenger()->addErrorMessage($this->formatFormMessages($form));
}
}
return $outcome;
}