Ejemplo n.º 1
0
 /**
  * Executes feedback action
  *
  */
 public function executeFeedback(sfRequest $request)
 {
     $section = $request->getParameter('section', false);
     $this->form = new aFeedbackForm($section);
     $this->feedbackSubmittedBy = false;
     $this->failed = false;
     sfContext::getInstance()->getConfiguration()->loadHelpers(array('Tag', 'Url'));
     if ($request->isMethod('post')) {
         $this->form->bind($request->getParameter('feedback'), $request->getFiles('feedback'));
         // $this->form->bind(array_merge($request->getParameter('feedback'), array('captcha' => $request->getParameter('captcha'))), $request->getFiles('feedback'));
         if ($this->form->isValid()) {
             $feedback = $this->form->getValues();
             $feedback['browser'] = $_SERVER['HTTP_USER_AGENT'];
             try {
                 aZendSearch::registerZend();
                 $mail = new Zend_Mail();
                 $mail->setBodyText($this->getPartial('feedbackEmailText', array('feedback' => $feedback)))->setFrom($feedback['email'], $feedback['name'])->addTo(sfConfig::get('app_aFeedback_email_auto'))->setSubject($this->form->getValue('subject', 'New aBugReport submission'));
                 if ($screenshot = $this->form->getValue('screenshot')) {
                     $mail->createAttachment(file_get_contents($screenshot->getTempName()), $screenshot->getType());
                 }
                 $mail->send();
                 // A new form for a new submission
                 $this->form = new aFeedbackForm();
             } catch (Exception $e) {
                 $this->logMessage('Request email failed: ' . $e->getMessage(), 'err');
                 $this->failed = true;
                 return 'Success';
             }
             $this->getUser()->setFlash('reportSubmittedBy', $feedback['name']);
             $this->redirect($feedback['section']);
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Execute any application/business logic for this component.
  *
  * @param sfRequest $request The current sfRequest object
  *
  * @return mixed     A string containing the view name associated with this action
  */
 function execute($request)
 {
     //pas de jenkins => pas de form
     if (!$this->getJenkins()->isAvailable()) {
         $this->redirect('jenkins/index');
     }
     if (is_array($buildRequest = $request->getParameter('build'))) {
         $groupRunId = isset($buildRequest['group_run_id']) ? $buildRequest['group_run_id'] : null;
     } else {
         $groupRunId = $request->getParameter('group_run_id');
     }
     $this->forward404If($groupRunId === null, 'group_run_id parameter is required');
     $jenkinsGroupRun = JenkinsGroupRunPeer::retrieveByPK($groupRunId);
     $this->forward404Unless($jenkinsGroupRun instanceof JenkinsGroupRun, sprintf('Can\'t create JenkinsGroupRun with id %s', $groupRunId));
     $defaults = array();
     if ($request->hasParameter('auto_launch')) {
         $autoLaunch = $request->getParameter('auto_launch');
         if ('on' === $autoLaunch) {
             $defaults = array('auto_launch' => true);
         }
     } else {
         $defaults = array('auto_launch' => true);
     }
     $form = new BuildForm($defaults, array('jenkins' => $this->getJenkins(), 'group_run' => $jenkinsGroupRun));
     if (sfRequest::POST === $request->getMethod()) {
         $form->bind($buildRequest);
         if ($form->isValid()) {
             $jobName = $form->getValue('job');
             $autoLaunch = 'on' === $form->getValue('auto_launch');
             $extraParameters = $form->getValue('parameters');
             $jobParameters = array();
             if (isset($extraParameters[$jobName])) {
                 $jobParameters = $extraParameters[$jobName];
             }
             //créer les builds
             $run = new JenkinsRun();
             $run->setJenkinsGroupRun($jenkinsGroupRun);
             $run->setJobName($jobName);
             $run->encodeParameters($jobParameters);
             $run->setLaunched($autoLaunch);
             $run->save();
             //launcher les builds
             if ($autoLaunch) {
                 $run->launch($this->getJenkins(), $jobParameters);
                 $run->computeJobBuildNumber($this->getJenkins(), $this->getUser());
             }
             $this->getUser()->setFlash('info', sprintf('Build [%s] has been added to build branch [%s]', $run->getJobName(), $jenkinsGroupRun->getLabel()));
             if ($request->hasParameter('add_and_continue')) {
                 $urlRedirect = sprintf('jenkins/addBuild?auto_launch=%s&group_run_id=%s', $autoLaunch ? 'on' : 'off', $jenkinsGroupRun->getId());
             } else {
                 $urlRedirect = $this->generateUrl('branch_view', $jenkinsGroupRun);
             }
             $this->redirect($urlRedirect);
         }
     }
     $this->setVar('form', $form);
     $this->setVar('group_run', array('label' => $jenkinsGroupRun->getLabel(), 'git_branch' => $jenkinsGroupRun->getGitBranch(), 'git_branch_slug' => $jenkinsGroupRun->getGitBranchSlug(), 'result' => $jenkinsGroupRun->getResult($this->getJenkins()), 'url' => $this->generateUrl('branch_view', $jenkinsGroupRun)));
 }
Ejemplo n.º 3
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfRequest $request)
 {
     $params = array('filename' => $request->getParameter('filename', null), 'format' => $request->getParameter('format', null), 'width' => str_replace('w', '', $request->getParameter('width', null)), 'height' => str_replace('h', '', $request->getParameter('height', null)));
     $image = new sfImageHandler($params);
     $this->forward404Unless($image->isValidSource(), 'Invalid URL.');
     $binary = $image->createImage();
     header('Content-Type:' . $image->getContentType());
     echo $binary;
     exit;
 }
 /**
  *
  * @param sfRequest $request The current sfRequest object
  *
  * @return mixed     A string containing the view name associated with this action
  */
 function execute($request)
 {
     $this->forward404Unless($request->hasParameter('id'), 'id parameter is required');
     $jenkinsGroupRun = JenkinsGroupRunPeer::retrieveByPK($request->getParameter('id'));
     $this->forward404Unless($jenkinsGroupRun instanceof JenkinsGroupRun, sprintf('Can\'t create JenkinsGroupRun with id %s', $request->getParameter('id')));
     //suppression du group run (et, en cascade, des runs)
     $jenkinsGroupRun->delete(null);
     $this->getUser()->setFlash('info', sprintf('Build branch [%s] has been deleted', $jenkinsGroupRun->getLabel()));
     $this->redirect('jenkins/index');
 }
 /**
  * Processes the current request.
  *
  * @param  sfRequest A sfRequest instance
  *
  * @return Boolean   true if the form is valid, false otherwise
  */
 public function process(sfRequest $request)
 {
     $data = array('max_per_page' => $request->getParameter('max_per_page', $this->user->getAttribute(self::getMaxPerPageName(), $this->getDefault('max_per_page'))));
     if ($request->hasParameter(self::$CSRFFieldName)) {
         $data[self::$CSRFFieldName] = $request->getParameter(self::$CSRFFieldName);
     }
     $this->bind($data);
     if ($isValid = $this->isValid()) {
         $this->save();
     }
     return $isValid;
 }
 /**
  * Processes the current request.
  *
  * @param  sfRequest A sfRequest instance
  *
  * @return Boolean   true if the form is valid, false otherwise
  */
 public function process(sfRequest $request)
 {
     $data = array('language' => $request->getParameter('language'));
     if ($request->hasParameter(self::$CSRFFieldName)) {
         $data[self::$CSRFFieldName] = $request->getParameter(self::$CSRFFieldName);
     }
     $this->bind($data);
     if ($isValid = $this->isValid()) {
         $this->save();
     }
     return $isValid;
 }
Ejemplo n.º 7
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex($request)
 {
     if ($request->hasParameter('show')) {
         $this->getUser()->setAttribute('show', $request->getParameter('show'));
     }
     $this->show = $this->getUser()->getAttribute('show', 'people');
     $table = $this->getShowTable($this->show);
     $this->pager = new sfDoctrinePager($table, sfConfig::get('app_max_entities_on_contacts'));
     $this->pager->setQuery(Doctrine::getTable($table)->getListQuery());
     $this->pager->setPage($request->getParameter('page', 1));
     $this->pager->init();
 }
 /**
  * Executes deleteLeaveType action
  *
  * @param sfRequest $request A request object
  */
 public function execute($request)
 {
     if ($request->isMethod('post')) {
         if (count($request->getParameter('chkSelectRow')) == 0) {
             $this->getUser()->setFlash('notice', __(TopLevelMessages::SELECT_RECORDS));
         } else {
             $leaveTypeService = $this->getLeaveTypeService();
             $leaveTypeIds = $request->getParameter('chkSelectRow');
             $leaveTypeService->deleteLeaveType($leaveTypeIds);
             $this->getUser()->setFlash('success', __(TopLevelMessages::DELETE_SUCCESS));
         }
         $this->redirect('leave/leaveTypeList');
     }
 }
Ejemplo n.º 9
0
 public function executeEdit(sfRequest $request)
 {
     if ($request->getParameter('aMediaCancel')) {
         $this->redirectToPage();
     }
     $this->logMessage("====== in aPDFSlotActions::executeEdit", "info");
     $this->editSetup();
     $item = Doctrine::getTable('aMediaItem')->find($request->getParameter('aMediaId'));
     if (!$item || $item->type !== 'pdf') {
         return $this->redirectToPage();
     }
     $this->slot->unlink('MediaItems');
     $this->slot->link('MediaItems', array($item->id));
     $this->editSave();
 }
Ejemplo n.º 10
0
 /**
  * Executes configUID action
  *
  * @param sfRequest $request A request object
  */
 public function executeConfigUID($request)
 {
     $option = array('member' => $this->getUser()->getMember());
     $this->passwordForm = new sfOpenPNEPasswordForm(array(), $option);
     $mobileUid = Doctrine::getTable('MemberConfig')->retrieveByNameAndMemberId('mobile_uid', $this->getUser()->getMemberId());
     $this->isSetMobileUid = !is_null($mobileUid);
     $this->isDeletableUid = (int) opConfig::get('retrieve_uid') < 2 && $this->isSetMobileUid;
     if ($request->isMethod('post')) {
         $this->passwordForm->bind($request->getParameter('password'));
         if ($this->passwordForm->isValid()) {
             if ($request->hasParameter('update')) {
                 $memberConfig = Doctrine::getTable('MemberConfig')->retrieveByNameAndMemberId('mobile_uid', $this->getUser()->getMemberId());
                 if (!$memberConfig) {
                     $memberConfig = new MemberConfig();
                     $memberConfig->setMember($this->getUser()->getMember());
                     $memberConfig->setName('mobile_uid');
                 }
                 $memberConfig->setValue($request->getMobileUID());
                 $memberConfig->save();
                 $this->getUser()->setFlash('notice', 'Your mobile UID was set successfully.');
                 $this->redirect('member/configUID');
             } elseif ($request->hasParameter('delete') && $this->isDeletableUid) {
                 $mobileUid->delete();
                 $this->getUser()->setFlash('notice', 'Your mobile UID was deleted successfully.');
                 $this->redirect('member/configUID');
             }
         }
     }
     return sfView::SUCCESS;
 }
Ejemplo n.º 11
0
 /**
  * Executes link action
  *
  * @param sfRequest $request A request object
  */
 public function executeLink($request)
 {
     $this->redirectUnless(opConfig::get('enable_friend_link'), '@error');
     $this->redirectIf($this->relation->isAccessBlocked(), '@error');
     $this->forward404If($this->relation->getMemberIdFrom() == $this->relation->getMemberIdTo());
     $this->member = Doctrine::getTable('Member')->find($this->id);
     $this->forward404Unless($this->member);
     if ($this->relation->isFriend()) {
         $this->getUser()->setFlash('error', 'This member already belongs to %my_friend%.');
         $this->getUser()->setFlash('error_params', array('%my_friend%' => Doctrine::getTable('SnsTerm')->get('my_friend')->pluralize()));
         $this->redirect('@member_profile?id=' . $this->id);
     }
     if ($this->relation->isFriendPreFrom()) {
         $this->getUser()->setFlash('error', '%Friend% request is already sent.');
         $this->redirect('@member_profile?id=' . $this->id);
     }
     $this->form = new FriendLinkForm();
     if ($request->isMethod(sfWebRequest::POST)) {
         $this->form->bind($request->getParameter('friend_link'));
         if ($this->form->isValid()) {
             $this->getUser()->setFlash('notice', 'You have requested %friend% link.');
             $this->redirectToHomeIfIdIsNotValid();
             $this->relation->setFriendPre();
             $this->redirect('@member_profile?id=' . $this->id);
         }
     }
     return sfView::INPUT;
 }
 /**
  * Executes link action
  *
  * @param sfRequest $request A request object
  */
 public function executeLink($request)
 {
     $this->redirectUnless(opConfig::get('enable_friend_link'), '@error');
     $this->redirectIf($this->relation->isAccessBlocked(), '@error');
     if ($this->relation->isFriend()) {
         $this->getUser()->setFlash('error', 'This member already belongs to %my_friend%.');
         $this->getUser()->setFlash('error_params', array('%my_friend%' => Doctrine::getTable('SnsTerm')->get('my_friend')->pluralize()));
         $this->redirect('member/profile?id=' . $this->id);
     }
     if ($this->relation->isFriendPreFrom()) {
         $this->getUser()->setFlash('error', '%Friend% request is already sent.');
         $this->redirect('member/profile?id=' . $this->id);
     }
     $this->form = new FriendLinkForm();
     if ($request->isMethod(sfWebRequest::POST)) {
         $this->form->bind($request->getParameter('friend_link'));
         if ($this->form->isValid()) {
             $this->getUser()->setFlash('notice', 'You have requested %friend% link.');
             $this->redirectToHomeIfIdIsNotValid();
             $this->relation->setFriendPre();
             $this->dispatcher->notify(new sfEvent($this, 'op_action.post_execute_' . $this->moduleName . '_' . $this->actionName, array('moduleName' => $this->moduleName, 'actionName' => $this->actionName, 'actionInstance' => $this, 'result' => sfView::SUCCESS)));
             $this->redirect('member/profile?id=' . $this->id);
         }
     }
     $this->member = Doctrine::getTable('Member')->find($this->id);
     return sfView::INPUT;
 }
Ejemplo n.º 13
0
 /**
  * Executes joinlist action
  *
  * @param sfRequest $request A request object
  */
 public function executeJoinlist($request)
 {
     sfConfig::set('sf_nav_type', 'default');
     if ($request->hasParameter('id') && $request->getParameter('id') != $this->getUser()->getMemberId()) {
         sfConfig::set('sf_nav_type', 'friend');
     }
     return parent::executeJoinlist($request);
 }
Ejemplo n.º 14
0
 /**
  * Handles setDefault action
  *
  * @param sfRequest $request A request object
  */
 public function executeSetDefault($request)
 {
     $c = BadgePeer::retrieveByPK($request->getParameter('id'));
     if ($c) {
         $c->setAsDefault();
     }
     $this->redirect('badge/list');
 }
Ejemplo n.º 15
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfRequest $request)
 {
     $params = array('filename' => $request->getParameter('filename', null), 'format' => $request->getParameter('format', null), 'width' => str_replace('w', '', $request->getParameter('width', null)), 'height' => str_replace('h', '', $request->getParameter('height', null)));
     try {
         $image = new sfImageHandler($params);
     } catch (RuntimeException $e) {
         if (sfImageGenerator::ERROR_NOT_ALLOWED_SIZE !== $e->getCode()) {
             throw $e;
         }
         $this->forward404($e->getMessage());
     }
     $this->forward404Unless($image->isValidSource(), 'Invalid URL.');
     $binary = $image->createImage();
     header('Content-Type:' . $image->getContentType());
     echo $binary;
     exit;
 }
Ejemplo n.º 16
0
 /**
  * Executes login action
  *
  *
  * @param sfRequest $request A request object
  */
 public function executeLogin($request)
 {
     $this->form = new LoginForm();
     if ($request->isMethod('post')) {
         $this->form->bind($request->getParameter('login'));
         if ($this->form->isValid()) {
             $this->redirect('@homepage');
         }
     }
 }
 public function executeEdit(sfRequest $request)
 {
     $this->logMessage("====== in aSlideshowSlotActions::executeEdit", "info");
     if ($request->getParameter('aMediaCancel')) {
         return $this->redirectToPage();
     }
     $this->editSetup();
     $ids = preg_split('/,/', $request->getParameter('aMediaIds'));
     $q = Doctrine::getTable('aMediaItem')->createQuery('m')->select('m.*')->whereIn('m.id', $ids)->andWhere('m.type = "image"');
     // Let the query preserve order for us
     $items = aDoctrine::orderByList($q, $ids)->execute();
     $this->slot->unlink('MediaItems');
     $links = aArray::getIds($items);
     $this->slot->link('MediaItems', $links);
     // Save just the order in the value field. Use a hash so we can add
     // other metadata later
     $this->slot->value = serialize(array('order' => $links));
     $this->editSave();
 }
Ejemplo n.º 18
0
 /**
  * @param sfRequest       $request
  * @param jenkinsKhanUser $user
  *
  * @return JenkinsGroupRun
  * @throws RuntimeException
  */
 public function getJenkinsGroupRun(sfRequest $request, jenkinsKhanUser $user)
 {
     $branchName = $request->getParameter('git_branch_slug');
     $userId = $user->getUserId();
     $groupRun = JenkinsGroupRunPeer::retrieveBySfGuardUserIdAndGitBranchSlug($userId, $branchName);
     if (null === $groupRun) {
         throw new RuntimeException(sprintf('Can\'t retrieve JenkinsGroupRun with branch name %s for user %s.', $branchName, $user->getUsername()));
     }
     return $groupRun;
 }
Ejemplo n.º 19
0
 public static function getSelectedItems(sfRequest $request, $singular = false, $type = false)
 {
     if ($singular) {
         if (!$request->hasParameter('aMediaId')) {
             return false;
         }
         $id = $request->getParameter('aMediaId');
         if (!preg_match("/^\\d+\$/", $id)) {
             return false;
         }
         $ids = $id;
     } else {
         if (!$request->hasParameter('aMediaIds')) {
             // User cancelled the operation in the media plugin
             return false;
         }
         $ids = $request->getParameter('aMediaIds');
         if (!preg_match("/^(\\d+\\,?)*\$/", $ids)) {
             // Bad input, possibly a hack attempt
             return false;
         }
     }
     $ids = explode(",", $ids);
     if ($ids === false) {
         // Empty list, nothing to ask for
         return array();
     }
     $api = new aMediaAPI();
     $results = $api->getItems($ids);
     if ($type !== false) {
         // This is intended to filter out user attempts to jam video into the list
         // of ids before we ever got to the API stage
         $nresults = array();
         foreach ($results as $result) {
             if ($result->type === $type) {
                 $nresults[] = $result;
             }
         }
         $results = $nresults;
     }
     return $results;
 }
Ejemplo n.º 20
0
 public function executeEdit(sfRequest $request)
 {
     $this->editSetup();
     $item = Doctrine::getTable('aMediaItem')->find($request->getParameter('aMediaId'));
     if (!$item || $item->type !== 'video') {
         return $this->redirectToPage();
     }
     $this->slot->unlink('MediaItems');
     $this->slot->link('MediaItems', array($item->id));
     $this->editSave();
 }
Ejemplo n.º 21
0
 /**
  * Executes insertEntry action
  *
  * @param sfRequest $request A request object
  */
 public function executeInsertEntry($request)
 {
     $this->result = $this->api->insert($this->api->getEntryXMLFromRequestBody());
     $this->forward404Unless($this->result);
     $params = array('model' => $request->getParameter('model'), 'id' => $this->result->getId());
     $url = $this->generateUrl('feeds_community_retrieve_resource_normal', $params, true);
     $this->getResponse()->setStatusCode(201);
     $this->getResponse()->setHttpHeader('Location', $url);
     $entry = $this->api->createEntryByInstance($this->result);
     return $this->renderText($this->api->convertEmojiForAPI($entry->publish()));
 }
 /**
  * 
  * @param sfRequest $request
  */
 public function execute($request)
 {
     $this->setForm(new BeaconRegistrationForm());
     if ($request->isMethod('post')) {
         $this->form->bind($request->getParameter($this->form->getName()));
         if ($this->form->isValid()) {
             $result = $this->form->save();
             $this->getUser()->setFlash($result['messageType'], $result['message']);
         }
     }
 }
Ejemplo n.º 23
0
 /**
  * @param sfRequest $request The current sfRequest object
  *
  * @return mixed|void A string containing the view name associated with this action|void
  * @throws Exception
  */
 function execute($request)
 {
     $jenkins = $this->getJenkins();
     if ($request->hasParameter('group_run_id')) {
         $jenkinsGroupRun = JenkinsGroupRunPeer::retrieveByPK($request->getParameter('group_run_id'));
         $this->forward404Unless($jenkinsGroupRun instanceof JenkinsGroupRun, sprintf('can\'t create JenkinsGroupRun with id %s', $request->getParameter('group_run_id')));
         $jenkinsRuns = $jenkinsGroupRun->getJenkinsRuns();
         foreach ($jenkinsRuns as $jenkinsRun) {
             $this->cancelJenkinsRun($jenkinsRun, $jenkins);
         }
         $this->getUser()->setFlash('info', sprintf('All builds of group [%s] have been canceled', $jenkinsGroupRun->getLabel()));
         $this->redirect($this->generateUrl('branch_view', $jenkinsGroupRun));
     } elseif ($request->hasParameter('run_id')) {
         $jenkinsRun = JenkinsRunPeer::retrieveByPK($request->getParameter('run_id'));
         $this->forward404Unless($jenkinsRun instanceof JenkinsRun, sprintf('can\'t create JenkinsRun with id %s', $request->getParameter('run_id')));
         $this->cancelJenkinsRun($jenkinsRun, $jenkins);
         $this->redirect($this->generateUrl('branch_view', $jenkinsRun->getJenkinsGroupRun()));
     } else {
         throw new Exception('run_id or group_run_id parameter is required');
     }
 }
 /**
  * Executes create action
  *
  * @param sfRequest $request A request object
  */
 public function executeCreate($request)
 {
     $this->forward404Unless($this->communityEvent->isCreatableCommunityEventComment($this->getUser()->getMemberId()));
     $this->form = new CommunityEventCommentForm();
     $this->form->getObject()->setMemberId($this->getUser()->getMemberId());
     $this->form->getObject()->setCommunityEvent($this->communityEvent);
     $this->form->bind($request->getParameter($this->form->getName()));
     if ($this->form->isValid()) {
         try {
             if (!$request->getParameter('comment')) {
                 $this->form->getObject()->toggleEventMember($this->getUser()->getMemberId());
             }
             $this->form->save();
             $this->redirect('@communityEvent_show?id=' . $this->communityEvent->getId());
         } catch (opCommunityEventMemberAppendableException $e) {
             $this->getUser()->setFlash('error', $e->getMessage());
         }
     }
     $this->setTemplate('../../communityEvent/templates/show');
     return sfView::SUCCESS;
 }
 /**
  * Executes deleteLeaveType action
  *
  * @param sfRequest $request A request object
  */
 public function execute($request)
 {
     $this->leaveTypePermissions = $this->getDataGroupPermissions('leave_types');
     if ($request->isMethod('post')) {
         if (count($request->getParameter('chkSelectRow')) == 0) {
             $this->getUser()->setFlash('notice', __(TopLevelMessages::SELECT_RECORDS));
         } else {
             if ($this->leaveTypePermissions->canDelete()) {
                 $form = new DefaultListForm(array(), array(), true);
                 $form->bind($request->getParameter($form->getName()));
                 if ($form->isValid()) {
                     $leaveTypeService = $this->getLeaveTypeService();
                     $leaveTypeIds = $request->getParameter('chkSelectRow');
                     $leaveTypeService->deleteLeaveType($leaveTypeIds);
                     $this->getUser()->setFlash('success', __(TopLevelMessages::DELETE_SUCCESS));
                 }
             }
         }
         $this->redirect('leave/leaveTypeList');
     }
 }
 /**
  * Execute
  *
  * @param sfRequest $request A request object
  */
 public function execute($request)
 {
     $user = $this->getUser()->getUserRecord();
     $start = $this->getVar('start') ? $this->getVar('start') : $request->getParameter('start', date('Y-m-01'));
     $start = preg_replace("/(\\d{2})\\.(\\d{2})\\.(\\d{4})/", "\$3-\$2-\$1", $start);
     $returnJSON = $this->getVar('returnJSON') ? true : false;
     $budget = new BudgetManager();
     $rate = $this->getContext()->getMyCurrencyExchange()->getRate($user->getCurrencyId());
     $budgetCategories = $budget->load($user, new DateTime($start));
     $this->setVar('budgetCategories', $budgetCategories, $noEscape = true);
     $this->setVar('returnJSON', $returnJSON);
 }
 /**
  * Executes create action
  *
  * @param sfRequest $request A request object
  */
 public function executeCreate($request)
 {
     $this->form = new BbsCommentForm();
     $this->form->getObject()->setMemberId($this->getUser()->getMemberId());
     $this->form->getObject()->setBbs($this->bbs);
     $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName()));
     if ($this->form->isValid()) {
         $this->form->save();
         $this->redirect('@bbs_show?id=' . $this->bbs->getId());
     }
     $this->setTemplate('../../bbs/templates/show');
     return sfView::SUCCESS;
 }
Ejemplo n.º 28
0
 /**
  * DOCUMENT ME
  * @param sfRequest $request
  * @return mixed
  */
 public function executeEdit(sfRequest $request)
 {
     $this->logMessage("====== in aSlideshowSlotActions::executeEdit", "info");
     if ($request->getParameter('aMediaCancel')) {
         return $this->redirectToPage();
     }
     $this->editSetup();
     if ($request->hasParameter('aMediaIds')) {
         $ids = preg_split('/,/', $request->getParameter('aMediaIds'));
         $q = Doctrine::getTable('aMediaItem')->createQuery('m')->select('m.*')->whereIn('m.id', $ids)->andWhere('m.type = "image"');
         // Let the query preserve order for us
         $items = aDoctrine::orderByList($q, $ids)->execute();
         $this->slot->unlink('MediaItems');
         $links = aArray::getIds($items);
         $this->slot->link('MediaItems', $links);
         // This isn't a normal form submission, but the act of selecting items for a
         // slideshow implies we picked the 'selected' radio button, so just save 'form' as if
         // that choice had been saved normally
         $this->slot->value = serialize(array('form' => array('type' => 'selected'), 'order' => $links));
         return $this->editSave();
     }
 }
 /**
  *
  * @param sfRequest $request 
  */
 public function execute($request)
 {
     $this->setTemplateVariables();
     $this->params = array();
     foreach ($this->getVarHolder()->getAll() as $param => $val) {
         $this->params[$param] = $val;
     }
     $recordsLimit = self::$itemsPerPage;
     //sfConfig::get('app_items_per_page');
     $pageNo = $request->getParameter('pageNo', 1);
     if (self::$pageNumber) {
         $pageNo = self::$pageNumber;
     } else {
         $pageNo = $request->getParameter('pageNo', 1);
     }
     $numberOfRecords = self::$numberOfRecords;
     //replace with the count of all the records(self::$listData instanceof Doctrine_Collection) ? self::$listData->count() : count(self::$listData); // TODO: Remove the dependancy of ORM here; Use a Countable interface and a Iterator interface
     $pager = new SimplePager($this->className, $recordsLimit);
     $pager->setPage($pageNo);
     $pager->setNumResults($numberOfRecords);
     $pager->init();
     $offset = $pager->getOffset();
     $offset = empty($offset) ? 0 : $offset;
     $this->offset = $offset;
     $this->pager = $pager;
     $this->recordLimit = $recordsLimit;
     $this->currentSortField = $request->getParameter('sortField', '');
     $this->currentSortOrder = $request->getParameter('sortOrder', '');
     $this->showGroupHeaders = self::$configurationFactory->showGroupHeaders();
     $this->headerGroups = self::$configurationFactory->getHeaderGroups();
     $this->columns = self::$configurationFactory->getHeaders();
     $this->data = self::$listData;
     $this->className = self::$configurationFactory->getClassName();
     $this->partial = self::$headerPartial;
     $this->footerPartial = self::$footerPartial;
     $this->listForm = empty(self::$listForm) ? new DefaultListForm(array(), array(), true) : self::$listForm;
     $this->applyRuntimeDefinitions();
     $this->makePluginCalls();
 }
 /**
  * Executes create action
  *
  * @param sfRequest $request A request object
  */
 public function executeCreate($request)
 {
     $this->forward404Unless($this->communityTopic->isCreatableCommunityTopicComment($this->getUser()->getMemberId()));
     $this->form = new CommunityTopicCommentForm();
     $this->form->getObject()->setMemberId($this->getUser()->getMemberId());
     $this->form->getObject()->setCommunityTopic($this->communityTopic);
     $this->form->bind($request->getParameter($this->form->getName()));
     if ($this->form->isValid()) {
         $this->form->save();
         $this->redirect('@communityTopic_show?id=' . $this->communityTopic->getId());
     }
     $this->setTemplate('../../communityTopic/templates/show');
     return sfView::SUCCESS;
 }