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


PHP sfWebRequest::getUriPrefix方法代码示例

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


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

示例1: executeAsistencia

 public function executeAsistencia(sfWebRequest $request)
 {
     $evaluacion = $request->getParameter('evaluacion');
     // Id de la evaluacion
     $aspirante = $this->getUser()->getAttribute('usuarioId');
     $asistencia = AsistenciasPeer::getAsistencia($evaluacion, $aspirante);
     //Recupero de la lista de aspirantes de la evaluacion
     if (isset($asistencia)) {
         $this->getUser()->setEvaluacion($asistencia->getEvaluaciones());
         $this->getUser()->setPruebas();
         // guardo en un arreglo todas las pruebas de la evaluacion seleccionada
         $this->getUser()->initResultados();
         // inicia el arreglo de resultados
         //        $this->getUser()->setStarTestTimeStamp();// seteo el time stamp de inicio de test.
         $this->forward('principal', 'pregunta');
         // me voy a realizar las preguntas
     } else {
         $this->redirect($request->getUriPrefix());
     }
     // lo pateo porque no esta asistido
 }
开发者ID:qwerfaqs,项目名称:psicotest,代码行数:21,代码来源:actions.class.php

示例2: executeImportRestApiMerge


//.........这里部分代码省略.........
         if (!$fileError and $fileSize <= sfConfig::get('app_max_file_size', '10000000')) {
             if (!is_dir($dir_path)) {
                 mkdir($dir_path, 0777, true);
             }
             $dest_path = $dir_path . "/" . $fileName;
             $idx = 0;
             while (is_file($dest_path)) {
                 $idx++;
                 $dest_path = $dir_path . "/" . "(" . $idx . ")" . $fileName;
             }
             // Move file to uploads directory
             move_uploaded_file($file['tmp_name'], $dest_path);
             if ($idx == 0) {
                 $web_path = "/uploads" . "/testsession_" . $testSessionId . "/" . $fileName;
             } else {
                 $web_path = "/uploads" . "/testsession_" . $testSessionId . "/" . "(" . $idx . ")" . $fileName;
             }
             $fileAttachment = new FileAttachment();
             $fileAttachment->setName($fileName);
             $fileAttachment->setUserId($user_id);
             $fileAttachment->setUploadedAt(date("Y-m-d H:i:s"));
             $fileAttachment->setFilename($fileName);
             $fileAttachment->setFileSize($fileSize);
             $fileAttachment->setFileMimeType($fileType);
             $fileAttachment->setLink($web_path);
             $fileAttachment->setChecksum($fileChecksum);
             $fileAttachment->setTableNameId($tableNameTestSessionId);
             $fileAttachment->setTableEntryId($testSessionId);
             if ((preg_match("#\\.xml\$#i", $fileName) | preg_match("#\\.csv\$#i", $fileName)) & !preg_match("#attachment.?[0-9]*#i", $key)) {
                 $report_file_found = true;
                 $reportType = true;
                 $fileAttachment->setCategory(1);
             } else {
                 if (preg_match("#attachment.?[0-9]*#i", $key)) {
                     $fileAttachment->setCategory(2);
                 } else {
                     $conn->rollback();
                     $conn->setAttribute(Doctrine_Core::ATTR_AUTOCOMMIT, TRUE);
                     echo "{\"ok\":\"0\",\"errors\":\"Only upload files with the extension .xml or .csv\"}\n";
                     exit;
                 }
             }
             $fileAttachment->save($conn);
             // If it is an XML or CSV file, parse it and fill qa_generic database
             if ($reportType) {
                 if ($err_code = Import::file($dest_path, $testSessionId, $configurationId, $conn, true)) {
                     // Delete new files
                     $fileAttachments = Doctrine_Query::create()->select('*')->from('FileAttachment')->where('table_entry_id = ?', $testSessionId)->andWhere('table_name_id = ?', $tableNameTestSessionId)->andWhereNotIn('id', $fileAttachmentIdList)->execute();
                     foreach ($fileAttachments as $fileAttachment) {
                         unlink(sfConfig::get('sf_web_dir') . $fileAttachment->getLink());
                     }
                     $error_message = Import::getImportErrorMessage($err_code);
                     $conn->rollback();
                     $conn->setAttribute(Doctrine_Core::ATTR_AUTOCOMMIT, TRUE);
                     echo "{\"ok\":\"0\",\"errors\":\"File " . $fileName . " is not valid = " . $error_message . "\"}\n";
                     exit;
                 }
             }
         } else {
             // Delete new files
             $fileAttachments = Doctrine_Query::create()->select('*')->from('FileAttachment')->where('table_entry_id = ?', $testSessionId)->andWhere('table_name_id = ?', $tableNameTestSessionId)->andWhereNotIn('id', $fileAttachmentIdList)->execute();
             foreach ($fileAttachments as $fileAttachment) {
                 unlink(sfConfig::get('sf_web_dir') . $fileAttachment->getLink());
             }
             $conn->rollback();
             $conn->setAttribute(Doctrine_Core::ATTR_AUTOCOMMIT, TRUE);
             echo "{\"ok\":\"0\",\"errors\":\"File " . $fileName . " exceed maximum size\"}\n";
             exit;
         }
     }
     // If only attachment files have been found, cancel the new test session
     if (!$report_file_found) {
         $conn->rollback();
         $conn->setAttribute(Doctrine_Core::ATTR_AUTOCOMMIT, TRUE);
         echo "{\"ok\":\"0\",\"errors\":\"Missing report file\"}\n";
         exit;
     }
     if ($similarFileFound) {
         // Delete similar files and attachment entries
         $fileAttachments = Doctrine_Query::create()->select('*')->from('FileAttachment')->where('table_entry_id = ?', $testSessionId)->andWhere('table_name_id = ?', $tableNameTestSessionId)->andWhereIn('id', $fileAttachmentResultIds)->execute();
         foreach ($fileAttachments as $fileAttachment) {
             unlink(sfConfig::get('sf_web_dir') . $fileAttachment->getLink());
             $fileAttachment->delete($conn);
         }
     }
     $conn->commit();
     $conn->setAttribute(Doctrine_Core::ATTR_AUTOCOMMIT, TRUE);
     // Retrieve project name_slug, product name_slug, test environment name_slug and image name_slug
     $query = "SELECT i.name_slug image_name_slug, te.name_slug test_environment_name_slug, p.name_slug project_name_slug, pt.name_slug product_name_slug\n\t\t\t\t\tFROM " . $qa_generic . ".test_session ts\n\t\t\t\t\tJOIN " . $qa_generic . ".configuration c ON c.id = ts.configuration_id\n\t\t\t\t\tJOIN " . $qa_generic . ".image i ON i.id = c.image_id\n\t\t\t\t\tJOIN " . $qa_generic . ".test_environment te ON te.id = c.test_environment_id\n\t\t\t\t\tJOIN " . $qa_generic . ".project_to_product ptp ON ptp.id = c.project_to_product_id\n\t\t\t\t\tJOIN " . $qa_generic . ".project p ON p.id = ptp.project_id\n\t\t\t\t\tJOIN " . $qa_core . ".product_type pt ON pt.id = ptp.product_id\n\t\t\t\t\tWHERE ts.id = " . $testSessionId;
     $configInfo = Doctrine_Manager::getInstance()->getCurrentConnection()->execute($query)->fetch(PDO::FETCH_ASSOC);
     $projectNameSlug = $configInfo['project_name_slug'];
     $productNameSlug = $configInfo['product_name_slug'];
     $testEnvironmentNameSlug = $configInfo['test_environment_name_slug'];
     $imageNameSlug = $configInfo['image_name_slug'];
     // Return datas to CATS
     $url_to_return = $request->getUriPrefix() . $this->generateUrl("test_session", array('project' => $projectNameSlug, 'product' => $productNameSlug, 'environment' => $testEnvironmentNameSlug, 'image' => $imageNameSlug, 'id' => $testSessionId));
     echo "{\"ok\":\"1\",\"url\":\"" . $url_to_return . "\"}\n";
     // Return is done (with echo) so make sure nothing else will be sent
     exit;
 }
开发者ID:alex1818,项目名称:TestReportCenter,代码行数:101,代码来源:actions.class.php


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