当前位置: 首页>>代码示例>>PHP>>正文


PHP sfWebRequest::getFiles方法代码示例

本文整理汇总了PHP中sfWebRequest::getFiles方法的典型用法代码示例。如果您正苦于以下问题:PHP sfWebRequest::getFiles方法的具体用法?PHP sfWebRequest::getFiles怎么用?PHP sfWebRequest::getFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sfWebRequest的用法示例。


在下文中一共展示了sfWebRequest::getFiles方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: executeFor

 public function executeFor(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod(sfRequest::POST));
     //@todo: check component name input
     $componentName = $request->getParameter('component');
     $commentName = 'Comment' . $componentName;
     $formName = $commentName . 'Form';
     $form = new $formName();
     $toward = $form->getToward();
     $data = $request->getParameter($form->getName());
     $tree = Doctrine::getTable($commentName)->getTree();
     $tree->setBaseQuery(Doctrine_Query::create()->from($commentName . ' c')->where('c.' . $toward . '_id = ?', $data[$toward . '_id']));
     $form->bind($data, $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $root = $tree->fetchRoots()->getFirst();
         if (!$root) {
             $root = new $commentName();
             $root->message = 'root';
             $root[$toward . '_id'] = $data[$toward . '_id'];
             $root->parent = null;
             $root->save();
             $tree->createRoot($root);
             $getterCommented = "get{$componentName}";
             BotNet::create()->attachTo($root, BotNet::create()->getRandomBot(), $root->{$getterCommented}()->getDateTimeObject('created_at')->format('U'));
         }
         $parent = $root;
         if ($data['parent']) {
             $parent = Doctrine_Core::getTable('Comment')->find($data['parent']);
         }
         $data['parent'] = $parent->getId();
         $form->bind($data, $request->getFiles($form->getName()));
         $this->comment = $form->save();
         $this->comment->getNode()->insertAsLastChildOf($parent);
         $prevCom = $parent;
         if ($parent->message == 'root') {
             $sibling = $this->comment->getNode()->getPrevSibling();
             if ($sibling) {
                 $prevCom = $sibling;
             }
         }
         BotNet::create()->spammed($this->comment, 'message', $prevCom->getDateTimeObject('created_at')->format('U'));
         $this->noVote = $form->getValue('noVote', false);
         if ($cache = $this->getContext()->getViewCacheManager()) {
             $cache->remove('@sf_cache_partial?module=comment&action=_last&sf_cache_key=comment', '', 'all');
         }
         $this->setTemplate('created');
     } else {
         foreach ($form->getFormFieldSchema() as $name => $formField) {
             if ($formField->getError() != "") {
                 echo "ActionClassName::methodName( ): Field Error for :" . $name . " : " . $formField->getError();
             }
         }
     }
 }
开发者ID:limitium,项目名称:uberlov,代码行数:54,代码来源:actions.class.php

示例2: submitForm

 protected function submitForm(sfWebRequest $request, sfForm $form, sfForm $form2)
 {
     //processform logic
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     $form2->bind($request->getParameter($form2->getName()), $request->getFiles($form2->getName()));
     if ($form2->isValid()) {
         if ($form->isValid()) {
             $instructresult = $form->save();
             $form2->getObject()->setInstructorId($instructresult->getId());
             $instructdetailresult = $form2->save();
             $this->redirect('admininstructor/edit?id=' . $instructresult->getId());
             //$this->redirect('course/index');
         }
     }
 }
开发者ID:jasonkouoft,项目名称:SkuleCourses,代码行数:15,代码来源:actions.class.php

示例3: executeAttachmentSave

 public function executeAttachmentSave(sfWebRequest $request)
 {
     $files = $request->getFiles('attachment');
     $this->setTemplate('iframe');
     if ($this->isUpload($files)) {
         if (!$this->isEmptyFile($files)) {
             $this->bindAttachment($request->getParameter('attachment'), $files);
             if ($this->form->isValid()) {
                 $this->form->save();
             } else {
                 $errors = $this->form->getErrorList();
                 $this->alert = implode("\n", $errors);
             }
         } else {
             $this->alert = 'Please select a file to upload';
         }
     } else {
         $this->bindExternalUrl($request);
         if ($this->form->isValid()) {
             $this->form->save();
         } else {
             $errors = $this->form->getErrorList();
             $this->alert = 'Errors on: ' . implode(", ", array_keys($errors)) . ': ' . implode("\n", $errors);
         }
     }
 }
开发者ID:bshaffer,项目名称:Symplist,代码行数:26,代码来源:BasecsAttachableActions.class.php

示例4: processForm

 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $contact_req = new ContactRequest();
         $contact_req->setRequestDate(date('Y-m-d'));
         $contact_req->setTitle($request->getParameter('contact_request[title]'));
         $contact_req->setFirstName($request->getParameter('contact_request[first_name]'));
         $contact_req->setLastName($request->getParameter('contact_request[last_name]'));
         $contact_req->setAddress1($request->getParameter('contact_request[address1]'));
         $contact_req->setAddress2($request->getParameter('contact_request[address2]'));
         $contact_req->setCity($request->getParameter('contact_request[city]'));
         $contact_req->setState($request->getParameter('contact_request[state]'));
         $contact_req->setZipcode($request->getParameter('contact_request[zipcode]'));
         $contact_req->setCountry($request->getParameter('contact_request[country]'));
         $contact_req->setDayPhone($request->getParameter('contact_request[day_phone]'));
         $contact_req->setEvePhone($request->getParameter('contact_request[eve_phone]'));
         $contact_req->setFaxPhone($request->getParameter('contact_request[fax_phone]'));
         $contact_req->setMobilePhone($request->getParameter('contact_request[mobile_phone]'));
         $contact_req->setEmail($request->getParameter('contact_request[email]'));
         $contact_req->setRefSourceId($request->getParameter('contact_request[ref_source_id]'));
         $contact_req->setSendAppFormat($request->getParameter('contact_request[send_app_format]'));
         $contact_req->setComment($request->getParameter('contact_request[comment]'));
         //Set Session Id
         $sessionId = session_id();
         $contact_req->setSessionId($sessionId);
         //end set session id
         $contact_req->setIpAddress($request->getRemoteAddress());
         $contact_req->save();
         $this->redirect('contact_request/thankyou');
     }
 }
开发者ID:yasirgit,项目名称:afids,代码行数:32,代码来源:actions.class.php

示例5: processForm

 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $file = '';
         $year = $form->getValue('years');
         $semester = $form->getValue('semester');
         $year = substr($year, 0, 4);
         $form->getObject()->setYear($year . $semester);
         if ($form->getValue('file_path') !== null || $form->getValue('file_path') != '') {
             $myfile = $this->form->getObject()->getFilePath();
             if ($myfile !== null || $myfile != '') {
                 //previously there was something there
                 $this->delExam($myfile);
             }
             $file = $form->getValue('file_path');
             $dateTime = new DateTime('now');
             $filename = '' . $dateTime->format(skuleadminConst::EXAM_FILE_DATEFORMAT) . '';
             $extension = $file->getOriginalExtension();
             $path = sfConfig::get('sf_web_dir') . skuleadminConst::INDIVIDUALEXAMFOLDER . $year . '/';
             if ($file->save($path . $filename . $extension)) {
                 $exam = $form->save();
                 $this->redirect('adminexam/edit?id=' . $exam->getId());
             } else {
                 $this->redirect('adminexam/failederr?msg=save');
             }
         } else {
             $exam = $form->save();
             $this->redirect('adminexam/edit?id=' . $exam->getId());
         }
     }
 }
开发者ID:jasonkouoft,项目名称:SkuleCourses,代码行数:32,代码来源:actions.class.php

示例6: processForm

 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $requestparam = $request->getParameter('accountentry');
     $account = AccountTable::fetchById($requestparam['account_id']);
     $qty = $requestparam['qty'];
     $date = $requestparam['date']['year'] . "-" . $requestparam['date']['month'] . "-" . $requestparam['date']['day'];
     //$ref_class=$requestparam['ref_class'];
     //$ref_id=$requestparam['ref_id'];
     $type = $requestparam['type'] != "" ? $requestparam['type'] : 'Adjustment';
     //$priority=0;
     $description = $requestparam['description'];
     if ($qty == 0) {
         $this->redirect('home/error?msg="Invalid Qty"');
     }
     $accountentry = $account->addEntry($date, $qty, null, null, $type, $description);
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $notice = $form->getObject()->isNew() ? 'The item was created successfully.' : 'The item was updated successfully.';
         $this->dispatcher->notify(new sfEvent($this, 'admin.save_object', array('object' => $accountentry)));
         $this->getUser()->setFlash('notice', $notice);
         $this->redirect('account/view?id=' . $accountentry->getaccountId());
     } else {
         if ($form['qty']->getError()) {
             $this->redirect('home/error?msg="Invalid Qty: ' . $qty . '"');
         }
         if ($form['date']->getError()) {
             $this->redirect('home/error?msg="Invalid Date: ' . $date . '"');
         }
         //$this->getUser()->setFlash('error', 'The item has not been saved due to some errors.', false);
     }
 }
开发者ID:jaspertomas,项目名称:tmcprogram_tacloban,代码行数:31,代码来源:actions.class.php

示例7: processForm

 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $notice = $form->getObject()->isNew() ? 'The item was created successfully.' : 'The item was updated successfully.';
         try {
             $stock = $form->save();
             $stock->calc($stock->getDate());
         } catch (Doctrine_Validator_Exception $e) {
             $errorStack = $form->getObject()->getErrorStack();
             $message = get_class($form->getObject()) . ' has ' . count($errorStack) . " field" . (count($errorStack) > 1 ? 's' : null) . " with validation errors: ";
             foreach ($errorStack as $field => $errors) {
                 $message .= "{$field} (" . implode(", ", $errors) . "), ";
             }
             $message = trim($message, ', ');
             $this->getUser()->setFlash('error', $message);
             return sfView::SUCCESS;
         }
         $this->dispatcher->notify(new sfEvent($this, 'admin.save_object', array('object' => $stock)));
         if ($request->hasParameter('_save_and_add')) {
             $this->getUser()->setFlash('notice', $notice . ' You can add another one below.');
             $this->redirect('@stock_new');
         } else {
             $this->getUser()->setFlash('notice', $notice);
             $this->redirect("stock/view?id=" . $stock->getId());
         }
     } else {
         $this->getUser()->setFlash('error', 'The item has not been saved due to some errors.', false);
     }
 }
开发者ID:jaspertomas,项目名称:tmcprogram_tacloban,代码行数:30,代码来源:actions.class.php

示例8: executeAdvancedRender

 public function executeAdvancedRender(sfWebRequest $request)
 {
     $this->form = new AdvancedSearchForm();
     if (!$request->isMethod("POST")) {
         $this->forward("Not Supported!");
     }
     $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName()));
     $page = $request->getParameter($this->form->getName() . "[page]");
     $arr = array();
     $arr["jobStatus"] = $request->getParameter($this->form->getName() . "[status_id]");
     $arr["dueDateStart"] = $this->getFormattedDate($request->getParameter($this->form->getName() . "[due_date_start]"));
     $arr["dueDateEnd"] = $this->getFormattedDate($request->getParameter($this->form->getName() . "[due_date_end]"));
     $arr["shootDateStart"] = $this->getFormattedDate($request->getParameter($this->form->getName() . "[shoot_date_start]"));
     $arr["shootDateEnd"] = $this->getFormattedDate($request->getParameter($this->form->getName() . "[shoot_date_end]"));
     $arr["clientId"] = $request->getParameter($this->form->getName() . "[client_id]");
     $arr["photographerId"] = $request->getParameter($this->form->getName() . "[photo_id]");
     $arr["sortOn"] = $request->getParameter($this->form->getName() . "[sort]");
     $arr["sortDirection"] = $request->getParameter($this->form->getName() . "[sort_direction]");
     $c = $this->createAdvancedSearchCriteria($arr);
     $this->pager = new sfPropelPager("Job", sfConfig::get("app_items_per_page"));
     $this->pager->setCriteria($c);
     $this->pager->setPage($page);
     $this->pager->setPeerMethod("doSelectJoinAll");
     $this->pager->init();
     $this->results = $this->pager->getResults();
     sfPropelActAsTaggableBehavior::preloadTags($this->results);
 }
开发者ID:adatta02,项目名称:comp190-code,代码行数:27,代码来源:actions.class.php

示例9: processForm

 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     $comprobanteFlash = $this->getUser()->getFlash('comprobante');
     if ($form->isValid()) {
         $comprobante = $form->updateObject();
         $comprobante->copiarImportes($comprobanteFlash);
         try {
             $comprobante->generate();
             $comprobante->save();
             $this->messageBox = new MessageBox('success', "Su comprobante ya está avalado por la AFIP", $this->getUser());
             $this->redirect('comprobante/show?id=' . $comprobante->getId());
         } catch (WsaaException $wsaaE) {
             $this->messageBox = new MessageBox('error', $wsaaE->getMessage(), $this->getUser());
             $this->redirect('comprobante/index');
         } catch (WsfeException $wsfeE) {
             $this->getUser()->setFlash('comprobante', $comprobanteFlash);
             $this->messageBox = new MessageBox('error', $wsfeE->getMessage(), $this->getUser());
         } catch (BusinessException $be) {
             $this->getUser()->setFlash('comprobante', $comprobanteFlash);
             $this->messageBox = new MessageBox('error', $be->getMessage(), $this->getUser());
         }
     } else {
         $this->getUser()->setFlash('comprobante', $comprobanteFlash);
         $this->messageBox = new MessageBox('error', "Complete los datos requeridos", $this->getUser());
     }
 }
开发者ID:lapuntasoft,项目名称:facturacionafip,代码行数:27,代码来源:actions.class.php

示例10: executeInjection

 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
  public function executeInjection(sfWebRequest $request)
  {
	$this->form = new InjectionForm();
    if ($request->isMethod('post'))
    {
		$this->form->bind($request->getParameter('injection'), $request->getFiles('injection'));
		if ($this->form->isValid())
		{
		  $file = $this->form->getValue('fichier');
		  $file->save(sfConfig::get('sf_upload_dir').'/injection.csv');
		  
			if (($handle = fopen(sfConfig::get('sf_upload_dir').'/injection.csv', "r")) !== FALSE) {
				while (($data = fgetcsv($handle, 0, ";")) !== FALSE) {
					if ($data[9] != '') {
						$question = new Question();
						$question->setNom($data[4]);
						$question->setPrenom($data[5]);
						$question->setCodePostal($data[6]);
						$question->setPays($data[7]);
						$question->setTelephone($data[9]);
						$question->setEmail($data[8]);
						$question->setTexteQuestion(str_replace("\\", "", $data[3]));
	//					$question->setSite("lejuridique");
						$question->setDateQuestion($data[2]);
						$question->save();
					}
				}
				fclose($handle);
			}		  
		}
    }
	
  }
开发者ID:nacef,项目名称:juriste,代码行数:38,代码来源:actions.class.php

示例11: executePost

 public function executePost(sfWebRequest $request)
 {
     $this->forward400If('' === (string) $request['body'], 'body parameter is not specified.');
     $this->forward400If('' === (string) $request['toMember'], 'toMember parameter is not specified.');
     $body = $request['body'];
     $this->myMember = $this->member;
     $toMember = Doctrine::getTable('Member')->find($request['toMember']);
     $this->forward400Unless($toMember, 'invalid member');
     $relation = Doctrine_Core::getTable('MemberRelationship')->retrieveByFromAndTo($toMember->getId(), $this->member->getId());
     $this->forward400If($relation && $relation->getIsAccessBlock(), 'Cannot send the message.');
     $message = Doctrine::getTable('SendMessageData')->sendMessage($toMember, SendMessageData::SMARTPHONE_SUBJECT, $body, array());
     $file = $request->getFiles('message_image');
     try {
         $validator = new opValidatorImageFile(array('required' => false));
         $clean = $validator->clean($file);
         if (is_null($clean)) {
             // if empty.
             return sfView::SUCCESS;
         }
     } catch (Exception $e) {
         $this->logMessage($e->getMessage());
         $this->forward400('This image file is invalid.');
     }
     $file = new File();
     $file->setFromValidatedFile($clean);
     $file->save();
     $messageFile = new MessageFile();
     $messageFile->setMessageId($message->getId());
     $messageFile->setFile($file);
     $messageFile->save();
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:31,代码来源:actions.class.php

示例12: executeAds

 public function executeAds(sfWebRequest $request)
 {
     $this->form = new adsSettingsForm();
     if ($request->isMethod('post')) {
         $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName()));
         if ($this->form->isValid()) {
             $ads = array();
             $bdd = unserialize(peanutConfig::get('ads'));
             foreach ($this->form->getValues() as $name => $value) {
                 if ($name == 'logo') {
                     if ($value) {
                         $extension = $value->getExtension($value->getOriginalExtension());
                         $value->save(sfConfig::get('sf_upload_dir') . '/ads/' . $value->getOriginalName());
                         $ads[$name] = $value->getOriginalName();
                     } else {
                         $ads[$name] = $bdd[$name];
                     }
                 } else {
                     $ads[$name] = $value;
                 }
             }
             peanutConfig::set('ads', serialize($ads));
         }
     }
 }
开发者ID:ndachez,项目名称:acb,代码行数:25,代码来源:BaseSettingsActions.class.php

示例13: processForm

 protected function processForm(sfWebRequest $request, sfForm $form, $celulaId = null)
 {
     $asistencia = $request->getParameter('reunion')['asistencias'];
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     $fields = $form->getFormFieldSchema()->getValue();
     if ($form->isValid()) {
         $reunion = $form->save();
         foreach ($reunion->getAsistencias() as $borrable) {
             $borrable->delete();
         }
         $asistencias = explode(',', $asistencia);
         foreach ($asistencias as $key => $asistencia) {
             if ($asistencia > 0) {
                 $source = new Asistencia();
                 $source->setReunionId($reunion->getId());
                 $source->setMiembroCelulaId($asistencia);
                 $source->save();
             }
         }
         $this->getUser()->setFlash('notice', "Reunión guardada exitosamente", true);
         if (isset($celulaId)) {
             $this->redirect('celulas/show?id=' . $celulaId);
         } else {
             $this->forward('celulas', 'index');
         }
     }
     $this->getUser()->setFlash('error', "Error!!! " . $form->getErrorSchema(), true);
     if (isset($celulaId)) {
         $this->redirect('celulas/show?id=' . $celulaId);
     } else {
         $this->forward('celulas', 'index');
     }
 }
开发者ID:laiello,项目名称:tesiscdfeg12,代码行数:33,代码来源:actions.class.php

示例14: executeUserEdit

 public function executeUserEdit(sfWebRequest $request)
 {
     $form = new sfGuardUserAdminForm(Doctrine_Core::getTable('sfGuardUser')->find($request->getParameter('id')));
     unset($form['groups_list']);
     unset($form['permissions_list']);
     unset($form['responsible_for_company_list']);
     unset($form['responsible_for_tickets_list']);
     unset($form['is_active']);
     unset($form['is_super_admin']);
     $this->form = $form;
     if ($request->isMethod('put')) {
         $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName()));
         if ($this->form->isValid()) {
             $object = $this->form->save();
             $flash = array('success', '', 'настройки сохранены');
             if ($flash and is_array($flash)) {
                 $this->getUser()->setFlash('message', $flash);
             }
         } else {
             $flash = array('error', '', 'настройки не сохранены');
             if ($flash and is_array($flash)) {
                 $this->getUser()->setFlash('message', $flash);
             }
         }
     }
 }
开发者ID:vik0803,项目名称:helpdesk,代码行数:26,代码来源:actions.class.php

示例15: processForm

 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $value = $form->getValue('example');
         $example = Doctrine_Core::getTable('Example')->find(array($value));
         if ($example) {
             $comment = $form->save();
             $this->redirect('example/show?slug=' . $example->getSlug());
         }
         $value = $form->getValue('project');
         $project = Doctrine_Core::getTable('Project')->find(array($value));
         if ($project) {
             $comment = $form->save();
             $this->redirect('project/show?slug=' . $project->getSlug());
         }
         $value = $form->getValue('hint');
         $hint = Doctrine_Core::getTable('Hint')->find(array($value));
         if ($hint) {
             $comment = $form->save();
             $this->redirect('hint/show?slug=' . $hint->getSlug());
         }
         //????
         //jaka akcja ma byc podjeta gdy brak example, project, hint?
         //$comment = $form->save();
     }
 }
开发者ID:rafal2208,项目名称:by-examples,代码行数:27,代码来源:actions.class.php


注:本文中的sfWebRequest::getFiles方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。