本文整理汇总了PHP中SessionUtils::setFormValue方法的典型用法代码示例。如果您正苦于以下问题:PHP SessionUtils::setFormValue方法的具体用法?PHP SessionUtils::setFormValue怎么用?PHP SessionUtils::setFormValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SessionUtils
的用法示例。
在下文中一共展示了SessionUtils::setFormValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
function index()
{
$view = $this->getView();
$view->getVoidForm();
// $view->uploadJS();
if (!is_null(SessionUtils::getError())) {
$view->setResponse(SessionUtils::getError());
$view->setFormData(SessionUtils::getFormValue(), FORGOT_PWD_FORM);
SessionUtils::setError(NULL);
SessionUtils::setFormValue(NULL);
}
$view->loadPage();
}
示例2: forgotPasswordModel
public function forgotPasswordModel($forgotPasswordForm)
{
$formObjRaw = new FormDTO(FORGOT_PWD_FORM, $forgotPasswordForm);
$responseDTO = new ResponseDTO(FORGOT_PWD_FORM);
try {
$formDataObj = $formObjRaw->getFormData();
$validator = new FormValidator(FORGOT_PWD_FORM, $formDataObj);
$validationError = $validator->checkAll();
if (sizeof($validationError) == 0) {
$userDAO = new UserDAO();
$userDTO = $userDAO->getUserByEmail($formDataObj[FORGOT_PWD_FORM . EMAIL]);
if (is_null($userDTO)) {
$responseDTO->setErrField(ERROR_RESPONSE, "Nessun user presente con questa mail");
} else {
$newPassword = PasswordUtils::createRandomicPassword();
$userDTO->setPassword($newPassword);
$resultMail = DataModelUtils::sendMail($userDTO, FORGOT_PWD_FORM);
$hashedPwd = PasswordUtils::getPassword($newPassword);
$userDTO->setPassword($hashedPwd);
$result = $userDAO->updateUserPassword($userDTO);
if ($result != 1) {
$responseDTO->setErrField(ERROR_RESPONSE, "Problema nel cambio della password");
} else {
$responseDTO->setResponseSucc("Verra mandata una mail con una nuova password all'indirizzo " . $userDTO->getEmail());
}
}
} else {
if (array_key_exists(EMAIL, $validationError)) {
$responseDTO->setErrField(EMAIL, $validationError[EMAIL]);
}
SessionUtils::setFormValue($formDataObj);
}
return $responseDTO;
} catch (PDOException $pdoe) {
throw $pdoe;
} catch (Exception $e) {
throw $e;
}
}
示例3: index
public function index()
{
try {
$this->getNotifications();
$this->loadDashboardUser();
SessionUtils::setLastPageVisited(ALBUM_CONTROLLER);
$view = $this->getView();
$model = $this->getModel();
$view->uploadJS();
$view->setArg('userCanWrite', SessionUtils::userCanWrite());
$view->setArg('albumOwnerId', SessionUtils::getDashboardId());
if (!is_null(SessionUtils::getAlbumId())) {
$albumDTO = $model->getAlbumModel(SessionUtils::getAlbumId());
$view->setArg("notificationAlbum", $albumDTO);
SessionUtils::setAlbumId(NULL);
} else {
$userAlbums = $model->getUserAlbumsModel(SessionUtils::getDashboardId());
$view->setArg('userAlbumList', $userAlbums);
if (!is_null(SessionUtils::getError())) {
$view->setResponse(SessionUtils::getError());
$view->setFormData(SessionUtils::getFormValue(), ADD_ALBUM_FORM);
SessionUtils::setError(NULL);
SessionUtils::setFormValue(NULL);
}
}
$view->setArg(LAST_NAV_ITEM_SELECTED, 5);
$view->loadPage();
} catch (PDOException $pdoe) {
throw $pdoe;
} catch (UserNotAuthenticatedExceptionDTO $authExp) {
SessionUtils::logout();
header("Location:" . URL . LOGIN_CONTROLLER);
} catch (Exception $e) {
throw $e;
}
}
示例4: addAlbumModel
function addAlbumModel($albumForm)
{
$formObjRaw = new FormDTO(ADD_ALBUM_FORM, $albumForm);
$responseDTO = new ResponseDTO(ADD_ALBUM_FORM);
try {
$formDataObj = $formObjRaw->getFormData();
$validator = new FormValidator(ADD_ALBUM_FORM, $formDataObj);
$validationError = $validator->checkAll();
// $validationError = array();
if (sizeof($validationError) == 0) {
$userLogged = SessionUtils::getUserLogged();
$uploadedPhoto = FileUtils::uploadPhotoModel($formDataObj[ADD_ALBUM_FORM . COVER], NULL, ADD_ALBUM_FORM);
if (get_class($uploadedPhoto) === PHOTODTO) {
$userDAO = new UserDAO();
$userDTO = $userDAO->getUserByUserId($userLogged->getUserId());
$albumDAO = new AlbumDAO();
$albumDTO = new AlbumDTO(null, date(DATE_FORMAT), $formDataObj[ADD_ALBUM_FORM . TITLE], $uploadedPhoto, $userDTO);
$albumDTO = $albumDAO->insertNewAlbum($albumDTO);
if ($albumDTO->getAlbumId() != 0) {
$photoAlbumPath = FileUtils::createAlbumDirOnServer($userDTO->getUserId(), $albumDTO->getAlbumId());
DataModelUtils::notifyAction($albumDTO->getCover()->getPhotoId() . SEPARATOR . $albumDTO->getCover()->getPhotoUrl() . SEPARATOR . $albumDTO->getAlbumId() . SEPARATOR . $albumDTO->getTitle(), ADD_ALBUM_FORM);
return $albumDTO;
} else {
$responseDTO->setErrField(ERROR_RESPONSE, "Errore durante l'inserimento dell'album");
}
} else {
$responseDTO->setErrField(ERROR_RESPONSE, "Errore durante l'inserimento della foto profilo");
}
} else {
if (array_key_exists(TITLE, $validationError)) {
$responseDTO->setErrField(TITLE, $validationError[TITLE]);
}
if (array_key_exists(PHOTO, $validationError)) {
$responseDTO->setErrField(COVER, $validationError[PHOTO]);
}
SessionUtils::setFormValue($formDataObj);
}
return $responseDTO;
} catch (PDOException $pdoe) {
throw $pdoe;
} catch (UserNotAuthenticatedExceptionDTO $authExp) {
throw $authExp;
} catch (Exception $e) {
throw $e;
}
}
示例5: loadProfile
function loadProfile($view, $model)
{
try {
if (!is_null(SessionUtils::getAuthorId()) && !is_null(SessionUtils::getPost()) && !SessionUtils::isAdmin()) {
$postDto = $model->getPostModel(SessionUtils::getPost());
$view->setArg("notificationPost", $postDto);
$commentPostList = $model->getCommentPostList(SessionUtils::getPost());
$commentListIndex = 'notificationCommentList' . SessionUtils::getPost();
$view->setArg($commentListIndex, $commentPostList);
SessionUtils::setPost(NULL);
SessionUtils::setAuthorId(NULL);
} else {
$userAlbumListDTO = $model->getUserAlbumList(SessionUtils::getDashboardId());
$view->setArg('userAlbumList', $userAlbumListDTO);
$postList = $model->getPostsListModel(SessionUtils::getDashboardId());
$view->setArg('postList', $postList);
if (!is_null($postList)) {
for ($i = 0; $i < sizeof($postList); $i++) {
$index = 'post' . $i;
$postId = $postList[$index]->getPostId();
$commentPostList = $model->getCommentPostList($postId);
$commentListIndex = 'commentPostList' . $postId;
$view->setArg($commentListIndex, $commentPostList);
}
}
if (!is_null(SessionUtils::getError())) {
$view->setResponse(SessionUtils::getError());
if (!is_null(SessionUtils::getFormValue())) {
$view->setFormData(SessionUtils::getFormValue(), WRITE_POST_FORM);
}
SessionUtils::setError(NULL);
SessionUtils::setFormValue(NULL);
}
}
$view->loadPage();
} catch (PDOException $pdoe) {
throw $pdoe;
} catch (UserNotAuthenticatedExceptionDTO $authExp) {
throw $authExp;
} catch (Exception $e) {
throw $e;
}
}
示例6: writeAPostModel
public function writeAPostModel()
{
$responseDTO = new ResponseDTO(WRITE_POST_FORM);
$formObjRaw = new FormDTO(WRITE_POST_FORM, NULL);
try {
$formDataObj = $formObjRaw->getFormData();
$validator = new FormValidator(WRITE_POST_FORM, $formDataObj);
$validationError = $validator->checkAll();
if (sizeof($validationError) == 0) {
$uploadedPhoto = FileUtils::uploadPhotoModel($formDataObj[WRITE_POST_FORM . PHOTO], NULL, WRITE_POST_FORM, $formDataObj[WRITE_POST_FORM . LATITUDE], $formDataObj[WRITE_POST_FORM . LONGITUDE]);
$uploadedPost = $this->saveNewPost($uploadedPhoto, $formDataObj);
if (get_class($uploadedPost) === POSTDTO) {
return $uploadedPost;
} else {
$responseDTO->setErrField(ADDRESS, "Errore durante l'inserimento del post");
}
return $responseDTO;
} else {
if (array_key_exists(TEXT, $validationError)) {
$responseDTO->setErrField(TEXT, $validationError[TEXT]);
}
if (array_key_exists(PHOTO, $validationError)) {
$responseDTO->setErrField(PHOTO, $validationError[PHOTO]);
}
if (array_key_exists(ADDRESS, $validationError)) {
$responseDTO->setErrField(ADDRESS, $validationError[ADDRESS]);
}
SessionUtils::setFormValue($formDataObj);
}
return $responseDTO;
} catch (PDOException $pdoe) {
throw $pdoe;
} catch (UserNotAuthenticatedExceptionDTO $authExp) {
throw $authExp;
} catch (Exception $e) {
throw $e;
}
}
示例7: signInModel
public function signInModel($loginForm)
{
$formObjRaw = new FormDTO(LOGIN_FORM, $loginForm);
$responseDTO = new ResponseDTO(LOGIN_FORM);
try {
$formDataObj = $formObjRaw->getFormData();
$validator = new FormValidator(LOGIN_FORM, $formDataObj);
$validationError = $validator->checkAll();
if (sizeof($validationError) == 0) {
$hashedPwd = PasswordUtils::getPassword($formDataObj[LOGIN_FORM . PASSWORD]);
$userDTO = new UserDTO(NULL, $formDataObj[LOGIN_FORM . USERNAME], $hashedPwd, NULL, NULL, NULL, NULL, NULL);
$userDAO = new UserDAO();
$userLoggedDTO = $userDAO->login($userDTO);
if (is_null($userLoggedDTO)) {
$responseDTO->setErrField(ERROR_RESPONSE, 'Username o password errati');
} else {
if (is_null($userLoggedDTO->getJoinedAt())) {
$responseDTO->setErrField(ERROR_RESPONSE, "Registrazione in attesa di conferma. Guarda nella mail all'indirizzo " . $userLoggedDTO->getEmail());
} else {
$this->prepareAndDoLogin($userLoggedDTO, $formDataObj[LOGIN_FORM . REMEMBERME]);
return $userLoggedDTO;
}
}
} else {
if (array_key_exists(USERNAME, $validationError)) {
$responseDTO->setErrField(USERNAME, $validationError[USERNAME]);
}
if (array_key_exists(PASSWORD, $validationError)) {
$responseDTO->setErrField(PASSWORD, $validationError[PASSWORD]);
}
SessionUtils::setFormValue($formDataObj);
}
return $responseDTO;
} catch (PDOException $pdoe) {
throw $pdoe;
} catch (Exception $e) {
throw $e;
}
}