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


PHP url_for2函数代码示例

本文整理汇总了PHP中url_for2函数的典型用法代码示例。如果您正苦于以下问题:PHP url_for2函数的具体用法?PHP url_for2怎么用?PHP url_for2使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: execute

 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function execute($request)
 {
     sfContext::getInstance()->getConfiguration()->loadHelpers('Url');
     $this->editForm = new dayForm();
     $this->day = DaysOrderTable::getInstance()->findOneById($this->getRequest()->getParameter('id'));
     if ($this->day) {
         $this->editForm->setDefaults($this->day->toArray());
     }
     if ($this->getRequest()->hasParameter('editDay')) {
         $this->editForm->bind($this->getRequest()->getParameter('editDay'), $this->getRequest()->getFiles('editDay'));
         if ($this->editForm->isValid()) {
             $files = $request->getFiles('editDay');
             $i = '';
             foreach ($files as $key => $file) {
                 if ($file['name']) {
                     $image = new UploadService();
                     $image->setPath('./uploads/');
                     $image->setFile($file);
                     $image->setFileName(md5($file['name'] . date('YmdGis')) . '.' . UploadService::findexts($file['name']));
                     $image->save();
                     $this->day['image_name' . $i] = $image->getFileName();
                 }
                 $i = 2;
             }
             $this->day->fromArray(array('day_number' => $this->editForm->getValue('day_number'), 'day_tip' => $this->editForm->getValue('day_tip'), 'day_letter' => $this->editForm->getValue('day_letter')));
             $this->day->save();
             $this->getUser()->setFlash('editSuccess', true);
             $this->redirect(url_for2('default', array('module' => 'days', 'action' => 'index')));
         }
     }
 }
开发者ID:radzikowski,项目名称:ankieta,代码行数:36,代码来源:editAction.class.php

示例2: execute

 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function execute($request)
 {
     sfContext::getInstance()->getConfiguration()->loadHelpers('Url');
     // Creating pager object
     $this->pager = new Doctrine_Pager(Doctrine_Query::create()->from('Poll p')->where('p.is_active =?', '1')->orderby('p.id ASC'), $this->getRequest()->getParameter('page', 0), 25);
     $this->pagerLayout = new Doctrine_Pager_Layout($this->pager, new Doctrine_Pager_Range_Sliding(array('chunk' => 5)), url_for2('default', array('module' => 'polls', 'action' => 'index'), true) . '?page={%page_number}');
     $this->pagerLayout->setTemplate(' <li><a href="{%url}">{%page}</a></li> ');
     $this->polls = $this->pager->execute();
 }
开发者ID:radzikowski,项目名称:ankieta,代码行数:14,代码来源:indexAction.class.php

示例3: execute

 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function execute($request)
 {
     sfContext::getInstance()->getConfiguration()->loadHelpers('Url');
     // Creating pager object
     $this->pager = new Doctrine_Pager(Doctrine_Query::create()->from('Questions q')->leftJoin('q.QuestionsOrder qo')->orderby('qo.day_number ASC')->addOrderBy('qo.question_number ASC'), $this->getRequest()->getParameter('page', 0), 25);
     $this->pagerLayout = new Doctrine_Pager_Layout($this->pager, new Doctrine_Pager_Range_Sliding(array('chunk' => 5)), url_for2('default_index', array('module' => 'questions'), true) . '?page={%page_number}');
     $this->pagerLayout->setTemplate(' <li><a href="{%url}">{%page}</a></li> ');
     $this->questions = $this->pager->execute();
 }
开发者ID:radzikowski,项目名称:ankieta,代码行数:14,代码来源:indexAction.class.php

示例4: execute

 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function execute($request)
 {
     sfContext::getInstance()->getConfiguration()->loadHelpers('Url');
     $this->day = DaysOrderTable::getInstance()->findOneById($this->getRequest()->getParameter('id'));
     if ($this->day) {
         $this->day['image_name2'] = null;
         $this->day->save();
     }
     $this->redirect(url_for2('default_index', array('module' => 'days'), true));
 }
开发者ID:radzikowski,项目名称:ankieta,代码行数:15,代码来源:deleteImageAction.class.php

示例5: execute

 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function execute($request)
 {
     sfContext::getInstance()->getConfiguration()->loadHelpers('Url');
     $questionId = $this->getRequest()->getParameter('questionId');
     $question = QuestionsTable::getInstance()->findOneById($questionId);
     if ($question) {
         $question['answer_id'] = null;
         $question->save();
     }
     $this->redirect(url_for2('default', array('module' => 'questions', 'action' => 'answers'), true) . '?id=' . $questionId);
 }
开发者ID:radzikowski,项目名称:ankieta,代码行数:16,代码来源:delCorrectAnswerAction.class.php

示例6: preExecute

 public function preExecute()
 {
     $this->user = $this->getContext()->get('userFromBase');
     $this->getContext()->getConfiguration()->loadHelpers('Url');
     if (!$this->request->hasParameter('name')) {
         $this->redirect(url_for2('default', array('module' => 'missing', 'action' => 'index'), true));
     }
     $this->poll = PollTable::getInstance()->findOneByName($this->request->getParameter('name'));
     if (!$this->poll) {
         $this->redirect(url_for2('default', array('module' => $this->request->getParameter('name'), 'action' => 'index'), true));
     }
     if ($this->user->UsersAnswers->count() > 0) {
         $this->redirect(url_for2('default', array('module' => 'result', 'action' => 'index'), true));
     }
 }
开发者ID:radzikowski,项目名称:ankieta,代码行数:15,代码来源:indexAction.class.php

示例7: execute

 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function execute($request)
 {
     sfContext::getInstance()->getConfiguration()->loadHelpers('Url');
     $this->day = DaysOrderTable::getInstance()->findOneById($this->getRequest()->getParameter('id'));
     if ($this->day) {
         $this->deleteDayForm = new deleteDayForm();
         $this->deleteDayForm->setDefaults($this->day->toArray());
         if ($this->getRequest()->hasParameter('deleteDay')) {
             $this->deleteDayForm->bind($this->getRequest()->getParameter('deleteDay'));
             if ($this->deleteDayForm->isValid()) {
                 $this->day->delete();
                 $this->redirect(url_for2('default_index', array('module' => 'days'), true));
             }
         }
     }
 }
开发者ID:radzikowski,项目名称:ankieta,代码行数:21,代码来源:deleteDayAction.class.php

示例8: execute

 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function execute($request)
 {
     sfContext::getInstance()->getConfiguration()->loadHelpers('Url');
     $dayNumber = DaysOrderTable::getInstance()->count();
     $this->addDayForm = new addDayForm();
     //		$this->addDayForm->setDefault('day_number', $dayNumber+1);
     if ($this->getRequest()->hasParameter('addDay')) {
         $this->addDayForm->bind($this->getRequest()->getParameter('addDay'));
         if ($this->addDayForm->isValid()) {
             $this->poll = new Poll();
             $this->poll->fromArray(array('' => $this->addDayForm->getValue('day_number'), '' => $this->addDayForm->getValue('day_tip'), '' => $this->addDayForm->getValue('day_letter')));
             $this->poll->save();
             $this->redirect(url_for2('default', array('module' => 'questions', 'action' => 'dayQuestions'), true) . '?nr=' . $this->day->day_number);
         }
     }
 }
开发者ID:radzikowski,项目名称:ankieta,代码行数:21,代码来源:addPollAction.class.php

示例9: execute

 public function execute($request)
 {
     $this->loginForm = new loginForm();
     $this->error = false;
     if ($request->hasParameter(get_class($this->loginForm))) {
         $this->loginForm->bind($request->getParameter(get_class($this->loginForm)));
         if ($this->loginForm->isValid()) {
             if (array_key_exists($this->loginForm->getValue('username'), $this->logins)) {
                 if ($this->logins[$this->loginForm->getValue('username')] == $this->loginForm->getValue('password')) {
                     $this->user->setAuthenticated(true);
                     $this->redirect(url_for2('default', array('module' => 'main', 'action' => 'index'), true));
                 }
             } else {
                 $this->error = 'Login lub hasło jest nie poprawne';
             }
         }
     }
 }
开发者ID:radzikowski,项目名称:ankieta,代码行数:18,代码来源:loginAction.class.php

示例10: execute

 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function execute($request)
 {
     sfContext::getInstance()->getConfiguration()->loadHelpers('Url');
     $this->question = QuestionsTable::getInstance()->findOneById($this->getRequest()->getParameter('questionId'));
     if ($this->question) {
         $this->addAnswerForm = new addAnswerForm();
         $this->addAnswerForm->setDefault('question_id', $this->question['id']);
         if ($this->getRequest()->hasParameter('addAnswer')) {
             $this->addAnswerForm->bind($this->getRequest()->getParameter('addAnswer'));
             if ($this->addAnswerForm->isValid()) {
                 $this->questionAnswer = new QuestionsAnswers();
                 $this->questionAnswer->fromArray($this->addAnswerForm->getValues());
                 $this->questionAnswer->save();
                 $this->redirect(url_for2('default', array('module' => 'questions', 'action' => 'answers'), true) . '?id=' . $this->question->id);
             }
         }
     }
 }
开发者ID:radzikowski,项目名称:ankieta,代码行数:23,代码来源:addAnswerAction.class.php

示例11: execute

 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function execute($request)
 {
     sfContext::getInstance()->getConfiguration()->loadHelpers('Url');
     $this->editForm = new questionForm();
     $this->question = QuestionsTable::getInstance()->findOneById($this->getRequest()->getParameter('id'));
     if ($this->question) {
         $this->editForm->setDefaults($this->question->toArray());
     }
     if ($this->getRequest()->hasParameter('editQuestion')) {
         $this->editForm->bind($this->getRequest()->getParameter('editQuestion'));
         if ($this->editForm->isValid()) {
             $this->question->fromArray($this->editForm->getValues());
             $this->question->save();
             $this->getUser()->setFlash('editSuccess', true);
             $this->redirect(url_for2('default', array('module' => 'questions', 'action' => 'index')));
         }
     }
 }
开发者ID:radzikowski,项目名称:ankieta,代码行数:23,代码来源:editAction.class.php

示例12: execute

 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function execute($request)
 {
     sfContext::getInstance()->getConfiguration()->loadHelpers('Url');
     $this->question = QuestionsTable::getInstance()->findOneById($this->getRequest()->getParameter('questionId'));
     if ($this->question) {
         $this->answer = QuestionsAnswersTable::getInstance()->findOneByQuestionIdAndId($this->question->id, $this->getRequest()->getParameter('answerId'));
     }
     if ($this->answer) {
         $this->deleteAnswerForm = new deleteAnswerForm();
         $this->deleteAnswerForm->setDefaults($this->answer->toArray());
         if ($this->getRequest()->hasParameter('deleteAnswer')) {
             $this->deleteAnswerForm->bind($this->getRequest()->getParameter('deleteAnswer'));
             if ($this->deleteAnswerForm->isValid()) {
                 $this->answer->delete();
                 $this->redirect(url_for2('default', array('module' => 'questions', 'action' => 'answers'), true) . '?id=' . $this->question->id);
             }
         }
     }
 }
开发者ID:radzikowski,项目名称:ankieta,代码行数:24,代码来源:deleteAnswerAction.class.php

示例13: executeSideBarHeaderObject

 public function executeSideBarHeaderObject(sfWebRequest $request)
 {
     $this->checkProject($request);
     //Récupération du projet
     $this->checkProfile($request, $this->ei_project);
     $this->checkEiScenario($request, $this->ei_project);
     $this->mod = $request->getParameter('module');
     $this->act = $request->getParameter('action');
     $this->objMenu = array();
     switch ($this->mod) {
         case 'eidataset':
             switch ($this->act) {
                 case 'edit':
                 case 'update':
                     $this->urlExcelRequest = url_for2("api_generate_excel_request_api", array('project_id' => $this->project_id, 'project_ref' => $this->project_ref, 'profile_id' => $this->profile_id, 'profile_ref' => $this->profile_ref, 'profile_name' => $this->profile_name));
                     $urlOpenDataSetXml = url_for2("eidataset_download", array('project_id' => $this->project_id, 'project_ref' => $this->project_ref, 'profile_id' => $this->profile_id, 'profile_ref' => $this->profile_ref, 'profile_name' => $this->profile_name, 'ei_data_set_id' => $this->ei_data_set->getId(), 'sf_format' => "xml"));
                     $this->objTitle = $this->ei_data_set->getEiDataSetTemplate()->getName();
                     $this->logoTitle = ei_icon('ei_dataset');
                     $this->objMenu[] = array('logo' => '<i class="fa fa-wrench"></i>', 'title' => 'Properties', 'uri' => '#datasetProperties', 'active' => true, 'class' => "", 'tab' => 'tab', 'id' => "datasetPropertiesTab", 'titleAttr' => "Data set properties");
                     $this->objMenu[] = array('logo' => '<i class="fa fa-code"></i>', 'title' => 'Sources', 'uri' => '#datasetSource', 'active' => false, 'class' => "", 'id' => "datasetSourceTab", 'tab' => 'tab', 'titleAttr' => "Data set XML source");
                     $this->objMenu[] = array('logo' => ei_icon('ei_version'), 'title' => 'Versions', 'uri' => '#datasetVersions', 'active' => false, 'class' => "", 'id' => "datasetVersionsTab", 'tab' => 'tab', 'titleAttr' => "Data set versions");
                     //                        $this->objMenu[] = array(
                     //                            'logo' =>     ei_icon("ei_testset"),
                     //                            'title' => 'Reports',
                     //                            'uri' => '#datasetReports',
                     //                            'active' => false,
                     //                            'class' => "",
                     //                            'id' => "datasetReportsTab",
                     //                            'tab' => 'tab',
                     //                            'titleAttr' => "Data set reports");
                     $this->objMenu[] = array('logo' => '<i class="fa fa-download"></i>', 'title' => '', 'uri' => $urlOpenDataSetXml, 'active' => false, 'class' => "", 'id' => "datasetDownloadTab", 'titleAttr' => "Download data set");
                     $this->objMenu[] = array('logo' => '<img src="' . sfConfig::get("app_icone_excel_24x24_path") . '" alt="" width="20" title="Open data set in Excel" class="excel-icon-img disabledOracle" />', 'title' => '', 'uri' => $this->urlExcelRequest, 'active' => false, 'class' => "excel-open-jdd excelIcon", 'id' => "datasetOpenInExcelTab", 'titleAttr' => "Open in Excel", 'data-id' => $this->ei_data_set->getId());
                     $this->objMenu[] = array('logo' => '<i class="fa fa-times"></i>', 'title' => '', 'uri' => '#', 'active' => false, 'class' => "btn-close", 'id' => "datasetCloseTab", 'tab' => 'tab', 'titleAttr' => "Close Data set");
                     break;
                 default:
                     break;
             }
             break;
         default:
             break;
     }
 }
开发者ID:lendji4000,项目名称:compose,代码行数:42,代码来源:components.class.php

示例14: execute

 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function execute($request)
 {
     sfContext::getInstance()->getConfiguration()->loadHelpers('Url');
     $this->addQuestionForm = new addQuestionForm();
     if ($this->getRequest()->hasParameter('nr')) {
         $this->dayNumber = $this->getRequest()->getParameter('nr');
     }
     if ($this->getRequest()->hasParameter('addQuestion')) {
         $this->addQuestionForm->bind($this->getRequest()->getParameter('addQuestion'));
         if ($this->addQuestionForm->isValid()) {
             $this->question = new Questions();
             $this->question->fromArray($this->addQuestionForm->getValues());
             $this->question->save();
             $questionNumber = QuestionsOrderTable::getInstance()->findByDayNumber($this->dayNumber)->count();
             $this->questionOrder = new QuestionsOrder();
             $this->questionOrder->fromArray(array('day_number' => $this->dayNumber, 'question_number' => $questionNumber, 'question_id' => $this->question->id));
             $this->questionOrder->save();
             $this->redirect(url_for2('default', array('module' => 'questions', 'action' => 'answers'), true) . '?id=' . $this->question->id);
         }
     }
 }
开发者ID:radzikowski,项目名称:ankieta,代码行数:26,代码来源:addQuestionAction.class.php

示例15: execute

 public function execute($request)
 {
     $this->result = Doctrine_Query::create()->select('ua.*, qa.*, q.*, p.*')->from('Questions q')->leftJoin('q.QuestionsAnswers qa')->leftJoin('qa.UsersAnswers ua')->leftJoin('q.Poll p')->where('p.id = ?', $this->poll->id)->orderBy('ua.answer_id')->execute();
     if (!$this->result) {
         $this->redirect(url_for2('default', array('module' => 'result', 'action' => 'index'), true));
     }
     if ($this->poll['self_answers']) {
         $this->selfAnswer = Doctrine_Query::create()->select('ua.*, q.*')->from('Questions q')->leftJoin('q.UsersAnswers ua')->leftJoin('q.Poll p')->where('p.id = ?', $this->poll->id)->addWhere('ua.answer_id is NULL')->execute();
         $this->bestAnswers = Doctrine_Query::create()->select('u.*, ba.*, q.*')->from('Questions q')->leftjoin('q.BestAnswers ba')->leftJoin('ba.Users u')->orderBy('q.id')->execute();
     }
     $this->comments = Doctrine_Query::create()->select('c.*, u.*')->from('PollComment c')->leftJoin('c.Users u')->where('c.poll_id =?', $this->poll->id)->addWhere('c.is_visible =?', 1)->orderBy('c.id DESC')->execute();
     $this->commentForm = new commentForm();
     if ($request->hasParameter('comment')) {
         $this->commentForm->bind($request->getParameter('comment'));
         if ($this->commentForm->isValid()) {
             $comment = new PollComment();
             $comment->fromArray(array('user_id' => $this->user['id'], 'poll_id' => $this->poll['id'], 'comment' => $this->commentForm->getValue('comment')));
             $comment->save();
             $this->redirect(url_for2('default', array('module' => 'result', 'action' => 'single'), true) . '/poll/' . $this->poll->id);
         }
     }
 }
开发者ID:radzikowski,项目名称:ankieta,代码行数:22,代码来源:singleAction.class.php


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