本文整理汇总了PHP中UserForm::getValue方法的典型用法代码示例。如果您正苦于以下问题:PHP UserForm::getValue方法的具体用法?PHP UserForm::getValue怎么用?PHP UserForm::getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserForm
的用法示例。
在下文中一共展示了UserForm::getValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: signupAction
public function signupAction()
{
$account = new Account();
$accountForm = new AccountForm($account);
$this->view->accountForm = $accountForm;
$user = new User();
$userForm = new UserForm($user);
$this->view->userForm = $userForm;
$this->view->setVar("tab", 0);
if ($this->request->isPost()) {
try {
$this->db->begin();
$accountForm->bind($this->request->getPost(), $account);
$userForm->bind($this->request->getPost(), $user);
$idAccountplan = $accountForm->getValue('idAccountplan');
$idAccounttype = $accountForm->getValue('idAccounttype');
$city = $accountForm->getValue('city');
$pass1 = $userForm->getValue('pass1');
$pass2 = $userForm->getValue('pass2');
$email = $this->request->getPost('email');
$this->validateEqualsPassword($pass1, $pass2);
$this->validateFields(array($idAccounttype, $idAccountplan, $city), array("Debes seleccionar un tipo de cuenta", "Debes seleccionar un plan de pago, recuerda que tenemos algunos gratuitos", "Debes seleccionar una ciudad"));
if ($this->saveAccount($account, $accountForm, $userForm)) {
if ($this->saveUser($user, $account)) {
$file = $_FILES['avatar'];
$ext = explode("/", $file['type']);
$file['newName'] = "{$user->idUser}.{$ext[1]}";
$dir = $this->uploader->user_avatar_dir . "/" . $user->idUser . "/images/avatar/";
$uploader = new \Sayvot\Misc\Uploader();
$uploader->setExtensionsAllowed(array("png", "jpg", "jpeg"));
$uploader->setFile($file);
$uploader->setMaxSizeSupported($this->uploader->images_max_size);
$uploader->setDir($dir);
$uploader->validate();
$uploader->upload();
if ($this->saveCredential($user, $email, $pass1)) {
$this->db->commit();
$pe = new \Sayvot\Misc\ParametersEncoder();
$link = $pe->encodeLink("account/verify", array($account->idAccount, $user->idUser));
$this->flashSession->warning($link);
return $this->response->redirect("session/login");
}
}
}
} catch (InvalidArgumentException $ex) {
$this->flashSession->error($ex->getMessage());
$this->db->rollback();
} catch (Exception $ex) {
$this->db->rollback();
$this->flashSession->error("Ha ocurrido un error, por favor contacta al administrador");
$this->logger->log("Exception while creating account: " . $ex->getMessage());
$this->logger->log($ex->getTraceAsString());
}
}
}
示例2: editAction
public function editAction($id)
{
$account = $this->user->account;
$editUser = User::findFirst(array("conditions" => "idUser = ?1 AND idAccount = ?2", "bind" => array(1 => $id, 2 => $account->idAccount)));
if (!$editUser) {
$this->flashSession->error("El usuario que intenta editar no existe, por favor verifique la información");
return $this->response->redirect("user/index");
}
$this->view->setVar("user", $editUser);
$editUser->address_user = $editUser->address;
$editUser->name_user = $editUser->name;
$editUser->city_user = $editUser->city;
$editUser->state_user = $editUser->state;
$editUser->phone_user = $editUser->phone;
$form = new UserForm($editUser, $this->user->role);
if ($this->request->isPost()) {
$form->bind($this->request->getPost(), $editUser);
$editUser->updated = time();
$email = strtolower($form->getValue('email'));
$editUser->email = $email;
$editUser->name = $this->request->getPost('name_user');
$editUser->phone = $this->request->getPost('phone_user');
$editUser->address = $this->request->getPost('address_user');
$editUser->state = $this->request->getPost('state_user');
$editUser->city = $this->request->getPost('city_user');
if ($editUser->save()) {
$this->flashSession->success('Se ha editado exitosamente el usuario <strong>' . $editUser->userName . '</strong>');
$this->trace("success", "Se edito un usuario con ID: {$editUser->idUser}");
return $this->response->redirect("user/index");
} else {
foreach ($editUser->getMessages() as $message) {
$this->flashSession->error($message);
}
$this->trace("fail", "No se edito el usuario con ID: {$editUser->idUser}");
}
}
$this->view->setVar("user", $editUser);
$this->view->UserForm = $form;
}
示例3: editAction
public function editAction($id)
{
$user = User::findFirst(array("conditions" => "idUser = ?1", "bind" => array(1 => $id)));
if (!$user) {
$this->flashSession->warning('El usuario que desea editar no existe, por favor valide la información');
return $this->response->redirect('user');
}
$form = new UserForm($user, $this->user);
if ($this->request->isPost()) {
$form->bind($this->request->getPost(), $user);
$status = $form->getValue('status2');
$user->status = empty($status) || !$status ? 0 : 1;
$user->updated = time();
if ($form->isValid() && $user->save()) {
$this->flashSession->success("Se ha editado el usuario exitosamente");
return $this->response->redirect("user");
}
foreach ($user->getMessages() as $msg) {
$this->flashSession->error($msg);
}
}
$this->view->UserForm = $form;
$this->view->setVar("user", $user);
}
示例4: newuserAction
public function newuserAction($idAccount)
{
$account = Account::findFirst(array('conditions' => 'idAccount = ?1', 'bind' => array(1 => $idAccount)));
if (!$account) {
$this->flashSession->error("No se encuentra la cuenta, por favor valide la información");
return $this->response->redirect("account");
}
$user = new User();
$form = new UserForm($user, $this->user);
if ($this->request->isPost()) {
$form->bind($this->request->getPost(), $user);
$pass1 = $form->getValue('password1');
$pass2 = $form->getValue('password2');
$status = $form->getValue('status');
if ($this->checkPassword($pass1, $pass2)) {
$user->idAccount = $account->idAccount;
$user->password = $this->hash->hash($pass1);
$user->status = $status;
$user->created = time();
$user->updated = time();
if ($form->isValid() && $user->save()) {
$this->flashSession->success("Se ha creado el usuario exitosamente");
return $this->response->redirect("account/showusers/{$idAccount}");
}
foreach ($user->getMessages() as $msg) {
$this->flashSession->error($msg->getMessage());
}
}
}
$this->view->UserForm = $form;
$this->view->setVar('account', $account);
}