本文整理汇总了PHP中sfForm::renderGlobalErrors方法的典型用法代码示例。如果您正苦于以下问题:PHP sfForm::renderGlobalErrors方法的具体用法?PHP sfForm::renderGlobalErrors怎么用?PHP sfForm::renderGlobalErrors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfForm
的用法示例。
在下文中一共展示了sfForm::renderGlobalErrors方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processForm
protected function processForm(sfWebRequest $request, sfForm $form, $redirect = true)
{
$form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
if ($form->isValid()) {
$setDefaultProfiles = false;
if ($form->getObject()->isNew()) {
$setDefaultProfiles = true;
}
$ei_version = $form->save();
/* Si la version est nouvellement créée , on créee les associations entre la nouvelle version et les profils */
if ($setDefaultProfiles) {
//On met à jour tous les éléments de la table EiProfilScenario (en changeant le champs ei_version_id
Doctrine_Query::create()->update('EiProfilScenario ps')->set('ps.ei_version_id', '?', $ei_version->getId())->where('ps.ei_scenario_id=' . $this->ei_scenario->getId() . ' And (ps.ei_version_id=' . ($this->ei_scenario_package ? $this->ei_scenario_package->getEiVersionId() : 0) . ' Or ps.profile_id=' . $this->ei_profile->getProfileId() . ' And ps.profile_ref=' . $this->ei_profile->getProfileRef() . ')')->execute();
}
if ($redirect) {
if ($form->getObject()->isNew()) {
$message = "Version has been created successfully.";
} else {
$message = "Version has been saved successfully.";
}
$this->getUser()->setFlash('alert_version_form', array('title' => 'Success! ', 'class' => 'alert-success', 'text' => $message));
$this->getUser()->setFlash('version_success', $message);
$projet_edit_eiversion = $this->urlParameters;
$projet_edit_eiversion['ei_scenario_id'] = $this->ei_scenario->getId();
$projet_edit_eiversion['ei_version_id'] = $ei_version->id;
$projet_edit_eiversion['action'] = 'edit';
return $this->redirect('projet_edit_eiversion', $projet_edit_eiversion);
} else {
$JSONResponse['status'] = "ok";
$JSONResponse['message'] = "The version has been saved successfully.";
return $this->renderText(json_encode($JSONResponse));
}
} else {
$this->getUser()->setFlash('alert_version_form', array('title' => 'Error !', 'class' => 'alert-danger', 'text' => 'Error occur when saving version ...'));
$JSONResponse['status'] = "error";
$JSONResponse['message'] = $form->renderGlobalErrors();
return $this->renderText(json_encode($JSONResponse));
}
}