/** * Renders the summary and the display mode toggle. */ public function renderSummary() { // Render the actual summary into a variable ob_start(); parent::renderSummary(); $summaryContent = ob_get_clean(); ResultHelper::renderDisplayModeToggle($summaryContent, $this->displayModeContext); }
public function movePageRowDown($id) { $entityToMoveDown = $this->pageRowDao->get($id); ResultHelper::whenEmpty($entityToMoveDown, AppLabelUtil::$ERROR_APP_INTERNAL, HttpStatusCode::internalServerError()); $entityToMoveUp = $this->pageRowDao->getEntityWithLowerPosition($entityToMoveDown); if (!empty($entityToMoveUp)) { $this->swapPageRowPositions($entityToMoveDown, $entityToMoveUp); } }
public function validateUser($userName, $password, AuthenticationManager $authenticationManager) { ResultHelper::whenEqual($password, null, AppLabelUtil::$ERROR_USER_NOT_FOUND, HttpStatusCode::badRequest()); $user = $this->userService->validateUser($userName, $password); ResultHelper::whenEmpty($user, AppLabelUtil::$ERROR_USER_NOT_FOUND, HttpStatusCode::unauthorized()); $token = Hash::create("sha256", mcrypt_create_iv(64, MCRYPT_DEV_URANDOM), HASH_USER_TOKEN_KEY); $authenticationManager->createValidationToken($user->getId(), $user->getRole()->getName(), $token); return $this->userMapper->mapUserToDto($user, $token); }
public function update(ComponentImage $componentImage) { $result = $this->componentImageDao->get($componentImage->getId()); ResultHelper::whenEmpty($result, AppLabelUtil::$ERROR_COMPONENT_NOT_FOUND, HttpStatusCode::badRequest()); if ($result->getImage() != $componentImage->getImage()) { unlink($result->getImage()); } return $this->componentImageDao->update($componentImage); }
public function createResetToken(User $user) { ResultHelper::whenEmpty($user->getEmail(), AppLabelUtil::$ERROR_USER_NO_EMAIL, HttpStatusCode::internalServerError()); $tokenHash = Hash::create("sha256", mcrypt_create_iv(64, MCRYPT_DEV_URANDOM), HASH_GENERAL_KEY); $this->mailService->setMailHeading(array($user->getEmail() => $user->getFirstName() . " " . $user->getLastName())); $this->mailService->setBody("Instellen van uw wachtwoord", "Beste gebruiker, gelieve de volgende link te gebruiken om uw wachtwoord in te stellen: " . URL . "#/reset/token/" . $tokenHash); $this->mailService->sendMail(); $resetToken = $this->resetTokenFactory->createResetToken($user->getId(), $tokenHash); $this->resetTokenDao->create($resetToken); }
public function setNewPasswordForValidUser(ResetTokenDto $resetTokenDto) { ResultHelper::whenEmpty($resetTokenDto->getToken(), AppLabelUtil::$ERROR_RESET_TOKEN_INCOMPLETE, HttpStatusCode::badRequest()); ResultHelper::whenEmpty($resetTokenDto->getUserName(), AppLabelUtil::$ERROR_RESET_TOKEN_INCOMPLETE, HttpStatusCode::badRequest()); ResultHelper::whenEmpty($resetTokenDto->getPassword(), AppLabelUtil::$ERROR_RESET_TOKEN_INCOMPLETE, HttpStatusCode::badRequest()); $user = $this->userService->getUserByUserName($resetTokenDto->getUserName()); ResultHelper::whenEmpty($user, AppLabelUtil::$ERROR_RESET_TOKEN_INVALID, HttpStatusCode::badRequest()); $validationToken = $this->restTokenService->getResetTokenByUserId($user->getId(), $resetTokenDto->getToken()); ResultHelper::whenEmpty($validationToken, AppLabelUtil::$ERROR_RESET_TOKEN_INVALID, HttpStatusCode::unauthorized()); $result = $this->userService->setNewPassWordForUserId($user->getId(), $resetTokenDto->getPassword()); ResultHelper::whenEmpty($result, AppLabelUtil::$ERROR_RESET_TOKEN_INVALID, HttpStatusCode::unauthorized()); $this->restTokenService->removeResetTokenOfUser($user->getId()); }
public function update(ComponentForm $componentForm) { $result = $this->componentFormDao->get($componentForm->getId()); ResultHelper::whenEmpty($result, AppLabelUtil::$ERROR_COMPONENT_NOT_FOUND, HttpStatusCode::badRequest()); return $this->componentFormDao->update($componentForm); }
public function removeCompany($id) { $company = $this->companyDao->get($id); ResultHelper::whenEmpty($company, AppLabelUtil::$ERROR_COMPANY_NOT_FOUND, HttpStatusCode::badRequest()); $this->companyDao->delete($company); }
public function removePageComponent($id) { $tmpEntity = $this->pageComponentService->getPageComponent($id); ResultHelper::whenEmpty($tmpEntity, AppLabelUtil::$ERROR_COMPONENT_NOT_FOUND, HttpStatusCode::badRequest()); $type = PageComponentFilter::getComponentType($tmpEntity); ResultHelper::whenEmpty($type, AppLabelUtil::$ERROR_COMPONENT_NOT_FOUND, HttpStatusCode::badRequest()); $typeGetter = "get" . ucfirst($type); $tmpComponent = $tmpEntity->{$typeGetter}(); ResultHelper::whenEmpty($tmpComponent, AppLabelUtil::$ERROR_APP_INTERNAL, HttpStatusCode::internalServerError()); $typeService = lcfirst(get_class($tmpComponent)) . "Service"; $typeService->delete($tmpComponent); $this->pageComponentService->removePageComponent($id); }
public function uploadFileForUser($file, $id) { $user = $this->userDao->get($id); ResultHelper::whenEmpty($user, AppLabelUtil::$ERROR_USER_NOT_FOUND, HttpStatusCode::badRequest()); $fileUploader = new FileUploader(); $newFileName = $fileUploader->uploadFile($file["file"]["name"], $file["file"]["tmp_name"], WEB . "/assets/user/" . $user->getUsername() . "/cv/"); $user->setFile($newFileName); return $this->userDao->update($user); }
<div class="row-fluid"> <div class="span6"> <h3><?php echo Yii::t('TVShows', 'Seasons'); ?> </h3> </div> <div class="span6"> <?php echo ResultHelper::renderDisplayModeToggle(null, DisplayMode::CONTEXT_SEASONS); ?> </div> </div> <div class="row-fluid"> <div class="span12"> <?php $items = array(); // Use lazy-loading for the accordion contents foreach ($this->seasons as $season) { /* @var $season Season */ $items[] = array('season' => $season, 'content' => CHtml::image(Yii::app()->baseUrl . '/images/loader.gif', 'Loader'), 'contentUrl' => Yii::app()->createUrl('tvShow/renderEpisodeList', array('tvshowid' => $this->tvshow->getId(), 'season' => $season->season))); } $this->widget('SeasonAccordion', array('items' => $items, 'htmlOptions' => array('class' => 'season-list'))); ?> </div> </div>