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


PHP Writer::init方法代码示例

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


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

示例1: init

 public function init(SurveyObj $survey, $sLanguageCode, FormattingOptions $oOptions)
 {
     parent::init($survey, $sLanguageCode, $oOptions);
     App()->setLanguage($sLanguageCode);
     if ($oOptions->output == 'display') {
         header("Content-Disposition: attachment; filename=results-survey" . $survey->id . ".doc");
         header("Content-type: application/vnd.ms-word");
     }
     $sOutput = '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
     <style>
     table {
     border-collapse:collapse;
     }
     td, th {
     border:solid black 1.0pt;
     }
     th {
     background: #c0c0c0;
     }
     </style>';
     if ($oOptions->output == 'display') {
         echo $sOutput;
     } elseif ($oOptions->output == 'file') {
         $this->file = fopen($this->filename, 'w');
         $this->output = $sOutput;
     }
 }
开发者ID:wrenchpilot,项目名称:LimeSurvey,代码行数:27,代码来源:DocWriter.php

示例2: init

 public function init(SurveyObj $survey, $sLanguageCode, FormattingOptions $oOptions)
 {
     parent::init($survey, $sLanguageCode, $oOptions);
     $this->survey = $survey;
     if ($oOptions->output == 'display') {
         //header("Content-Disposition: attachment; filename=results-survey".$survey->id.".html");
         header("Content-type: text/html; charset=UTF-8");
         $this->handle = fopen('php://output', 'w');
     } elseif ($oOptions->output == 'file') {
         $this->handle = fopen($this->filename, 'w');
     }
     $this->groupMap = array();
     $index = 0;
     foreach ($oOptions->selectedColumns as $column) {
         if (isset($survey->fieldMap[$column])) {
             $question = $survey->fieldMap[$column];
         } else {
             // Token field
             $question = array('gid' => 0, 'qid' => '');
         }
         $question['index'] = $index;
         $this->groupMap[intval($question['gid'])][] = $question;
         $index++;
     }
 }
开发者ID:jdbaltazar,项目名称:survey-office,代码行数:25,代码来源:HtmlWriter.php

示例3: init

 public function init(SurveyObj $survey, $sLanguageCode, FormattingOptions $oOptions)
 {
     parent::init($survey, $sLanguageCode, $oOptions);
     if ($oOptions->output == 'display') {
         header("Content-Disposition: attachment; filename=survey_" . $survey->id . "_R_syntax_file.R");
         header("Content-type: application/download; charset=UTF-8");
         header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
         header("Pragma: public");
         $this->handle = fopen('php://output', 'w');
     } elseif ($oOptions->output == 'file') {
         $this->handle = fopen($this->filename, 'w');
     }
     $this->out('data <- read.csv("survey_' . $survey->id . '_R_data_file.csv", quote = "\'\\"", na.strings=c("", "\\"\\""), stringsAsFactors=FALSE)');
     $this->out("");
     $this->out("");
     $oOptions->headingFormat = 'code';
     // Always use fieldcodes
     // R specific stuff
     Yii::app()->loadHelper("export");
     $tmpFieldmap = SPSSFieldMap($survey->id);
     foreach ($tmpFieldmap as $field => $values) {
         $fieldmap[$values['title']] = $values;
         if (array_key_exists('sql_name', $values)) {
             $fieldmap[$values['sql_name']] = $values;
         }
     }
     $this->customFieldmap = $fieldmap;
 }
开发者ID:jdbaltazar,项目名称:survey-office,代码行数:28,代码来源:RSyntaxWriter.php

示例4: init

 public function init(SurveyObj $survey, $sLanguageCode, FormattingOptions $oOptions)
 {
     parent::init($survey, $sLanguageCode, $oOptions);
     $this->csvFilename = "results-survey" . $survey->id . ".csv";
     if ($oOptions->output == 'file') {
         $this->file = fopen($this->filename, 'w');
     }
 }
开发者ID:wrenchpilot,项目名称:LimeSurvey,代码行数:8,代码来源:CsvWriter.php

示例5: init

 public function init(SurveyObj $survey, $sLanguageCode, FormattingOptions $oOptions)
 {
     parent::init($survey, $sLanguageCode, $oOptions);
     $sStartOutput = '{' . json_encode("responses") . ': [';
     if ($oOptions->output == 'display') {
         header("Content-type: application/json");
         echo $sStartOutput;
     } elseif ($oOptions->output == 'file') {
         $this->file = fopen($this->filename, 'w');
         fwrite($this->file, $sStartOutput);
     }
 }
开发者ID:wrenchpilot,项目名称:LimeSurvey,代码行数:12,代码来源:JsonWriter.php

示例6: init

 public function init(SurveyObj $survey, $sLanguageCode, FormattingOptions $oOptions)
 {
     parent::init($survey, $sLanguageCode, $oOptions);
     $this->survey = $survey;
     if ($oOptions->output == 'display') {
         //header("Content-Disposition: attachment; filename=results-survey".$survey->id.".html");
         header("Content-type: text/html; charset=UTF-8");
         $this->handle = fopen('php://output', 'w');
     } elseif ($oOptions->output == 'file') {
         $this->handle = fopen($this->filename, 'w');
     }
     $this->groupMap = $this->setGroupMap($survey, $oOptions);
 }
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:13,代码来源:HtmlWriter.php

示例7: init

 public function init(SurveyObj $survey, $sLanguageCode, FormattingOptions $oOptions)
 {
     parent::init($survey, $sLanguageCode, $oOptions);
     $this->workbook = new XLSXWriter();
     $this->workbook->setTempDir(Yii::app()->getConfig('tempdir'));
     $worksheetName = $survey->languageSettings['surveyls_title'];
     $worksheetName = substr(str_replace(array('*', ':', '/', '\\', '?', '[', ']'), array(' '), $worksheetName), 0, 31);
     // Remove invalid characters
     if ($worksheetName == '') {
         $worksheetName = 'survey_' . $survey->id;
     }
     $this->currentSheet = $worksheetName;
     $this->forceDownload = !($oOptions->output == 'file');
 }
开发者ID:sickpig,项目名称:LimeSurvey,代码行数:14,代码来源:ExcelWriter.php

示例8: init

 public function init(SurveyObj $survey, $sLanguageCode, FormattingOptions $oOptions)
 {
     parent::init($survey, $sLanguageCode, $oOptions);
     if ($oOptions->output == 'display') {
         header("Content-Disposition: attachment; filename=survey_" . $survey->id . "_STATA.xml");
         header("Content-type: application/download; charset=US-ASCII");
         header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
         header("Pragma: public");
         $this->handle = fopen('php://output', 'w');
     } elseif ($oOptions->output == 'file') {
         $this->handle = fopen($this->filename, 'w');
     }
     $this->headersSGQA = $oOptions->selectedColumns;
     $oOptions->headingFormat = 'code';
     // Always use fieldcodes
     $this->customFieldmap = $this->createStataFieldmap($survey, $sLanguageCode, $oOptions);
 }
开发者ID:wrenchpilot,项目名称:LimeSurvey,代码行数:17,代码来源:STATAxmlWriter.php

示例9: init

 public function init(SurveyObj $survey, $sLanguageCode, FormattingOptions $oOptions)
 {
     parent::init($survey, $sLanguageCode, $oOptions);
     $pdforientation = Yii::app()->getConfig('pdforientation');
     if ($oOptions->output == 'file') {
         $this->pdfDestination = 'F';
     } else {
         $this->pdfDestination = 'D';
     }
     Yii::import('application.libraries.admin.pdf', true);
     Yii::import('application.helpers.pdfHelper');
     $aPdfLanguageSettings = pdfHelper::getPdfLanguageSettings($sLanguageCode);
     // create PDF document
     $this->pdf = new pdf();
     $this->surveyName = $survey->info['surveyls_title'];
     $this->pdf->initAnswerPDF($survey->info, $aPdfLanguageSettings, Yii::app()->getConfig('sitename'), $this->surveyName);
     $this->separator = "\t";
     $this->rowCounter = 0;
     $this->aGroupMap = $this->setGroupMap($survey, $oOptions);
 }
开发者ID:GuillaumeSmaha,项目名称:LimeSurvey,代码行数:20,代码来源:PdfWriter.php

示例10: init

 public function init(SurveyObj $survey, $sLanguageCode, FormattingOptions $oOptions)
 {
     parent::init($survey, $sLanguageCode, $oOptions);
     if ($oOptions->output == 'file') {
         $this->workbook = new xlswriter($this->filename);
         $this->outputToFile = true;
     } else {
         $this->workbook = new xlswriter();
     }
     $this->workbook->setTempDir(Yii::app()->getConfig("tempdir"));
     if ($oOptions->output == 'display') {
         $this->workbook->send('results-survey' . $survey->id . '.xls');
     }
     $worksheetName = $survey->languageSettings['surveyls_title'];
     $worksheetName = substr(str_replace(array('*', ':', '/', '\\', '?', '[', ']'), array(' '), $worksheetName), 0, 31);
     // Remove invalid characters
     $this->workbook->setVersion(8);
     $sheet = $this->workbook->addWorksheet($worksheetName);
     // do not translate/change this - the library does not support any special chars in sheet name
     $sheet->setInputEncoding('utf-8');
     $this->currentSheet = $sheet;
 }
开发者ID:jdbaltazar,项目名称:survey-office,代码行数:22,代码来源:ExcelWriter.php

示例11: init

 public function init(SurveyObj $survey, $sLanguageCode, FormattingOptions $oOptions)
 {
     parent::init($survey, $sLanguageCode, $oOptions);
     $pdforientation = Yii::app()->getConfig('pdforientation');
     $this->clang = new limesurvey_lang($sLanguageCode);
     if ($oOptions->output == 'file') {
         $this->pdfDestination = 'F';
     } else {
         $this->pdfDestination = 'D';
     }
     Yii::import('application.libraries.admin.pdf', true);
     Yii::import('application.helpers.pdfHelper');
     $aPdfLanguageSettings = pdfHelper::getPdfLanguageSettings($sLanguageCode);
     // create new PDF document
     $this->pdf = new pdf();
     $this->pdf->SetFont($aPdfLanguageSettings['pdffont'], '', $aPdfLanguageSettings['pdffontsize']);
     $this->pdf->AddPage();
     $this->pdf->intopdf("PDF export " . date("Y.m.d-H:i", time()));
     $this->pdf->setLanguageArray($aPdfLanguageSettings['lg']);
     $this->separator = "\t";
     $this->rowCounter = 0;
     $this->surveyName = $survey->languageSettings['surveyls_title'];
     $this->pdf->titleintopdf($this->surveyName, $survey->languageSettings['surveyls_description']);
 }
开发者ID:jdbaltazar,项目名称:survey-office,代码行数:24,代码来源:PdfWriter.php

示例12: init

 public function init(SurveyObj $survey, $sLanguageCode, FormattingOptions $oOptions)
 {
     parent::init($survey, $sLanguageCode, $oOptions);
     if ($oOptions->output == 'file') {
         $this->pdfDestination = 'F';
     } else {
         $this->pdfDestination = 'D';
     }
     //The $pdforientation, $pdfDefaultFont, and $pdfFontSize values
     //come from the Lime Survey config files.
     global $pdforientation, $pdfdefaultfont, $pdffontsize;
     Yii::import('application.libraries.admin.pdf', true);
     $this->pdf = new pdf();
     $this->pdf->SetFont(Yii::app()->getConfig('pdfdefaultfont'), '', Yii::app()->getConfig('pdffontsize'));
     $this->pdf->AddPage();
     $this->pdf->intopdf("PDF export " . date("Y.m.d-H:i", time()));
     $this->separator = "\t";
     $this->rowCounter = 0;
     $this->surveyName = $survey->languageSettings[0]['surveyls_title'];
     $this->pdf->titleintopdf($this->surveyName, $survey->languageSettings[0]['surveyls_description']);
 }
开发者ID:ryu1inaba,项目名称:LimeSurvey,代码行数:21,代码来源:exportresults_helper.php

示例13: init

 public function init(SurveyObj $survey, $sLanguageCode, FormattingOptions $oOptions)
 {
     parent::init($survey, $sLanguageCode, $oOptions);
     $this->surveyName = $survey->languageSettings[0]['surveyls_title'];
     $this->pdf->titleintopdf($this->surveyName, $survey->languageSettings[0]['surveyls_description']);
 }
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:6,代码来源:exportresults_helper.php

示例14: init

 public function init(SurveyObj $survey, $sLanguageCode, FormattingOptions $oOptions)
 {
     parent::init($survey, $sLanguageCode, $oOptions);
     $pdfdefaultfont = Yii::app()->getConfig('pdfdefaultfont');
     $pdffontsize = Yii::app()->getConfig('pdffontsize');
     $pdforientation = Yii::app()->getConfig('pdforientation');
     $clang = new limesurvey_lang($sLanguageCode);
     if ($oOptions->output == 'file') {
         $this->pdfDestination = 'F';
     } else {
         $this->pdfDestination = 'D';
     }
     Yii::import('application.libraries.admin.pdf', true);
     if ($pdfdefaultfont == 'auto') {
         $pdfdefaultfont = PDF_FONT_NAME_DATA;
     }
     // Array of PDF core fonts: are replaced by according fonts according to the alternatepdffontfile array.Maybe just courier,helvetica and times but if a user want symbol: why not ....
     $pdfcorefont = array("courier", "helvetica", "symbol", "times", "zapfdingbats");
     $pdffontsize = Yii::app()->getConfig('pdffontsize');
     // create new PDF document
     $this->pdf = new pdf();
     if (in_array($pdfdefaultfont, $pdfcorefont)) {
         $alternatepdffontfile = Yii::app()->getConfig('alternatepdffontfile');
         if (array_key_exists($sLanguageCode, $alternatepdffontfile)) {
             $pdfdefaultfont = $alternatepdffontfile[$sLanguageCode];
             // Actually use only core font
         }
     }
     if ($pdffontsize == 'auto') {
         $pdffontsize = PDF_FONT_SIZE_MAIN;
     }
     $this->pdf = new pdf();
     $this->pdf->SetFont($pdfdefaultfont, '', $pdffontsize);
     $this->pdf->AddPage();
     $this->pdf->intopdf("PDF export " . date("Y.m.d-H:i", time()));
     //Set some pdf metadata
     Yii::app()->loadHelper('surveytranslator');
     $lg = array();
     $lg['a_meta_charset'] = 'UTF-8';
     if (getLanguageRTL($sLanguageCode)) {
         $lg['a_meta_dir'] = 'rtl';
     } else {
         $lg['a_meta_dir'] = 'ltr';
     }
     $lg['a_meta_language'] = $sLanguageCode;
     $lg['w_page'] = $clang->gT("page");
     $this->pdf->setLanguageArray($lg);
     $this->separator = "\t";
     $this->rowCounter = 0;
     $this->surveyName = $survey->languageSettings[0]['surveyls_title'];
     $this->pdf->titleintopdf($this->surveyName, $survey->languageSettings[0]['surveyls_description']);
 }
开发者ID:pmaonline,项目名称:limesurvey-quickstart,代码行数:52,代码来源:exportresults_helper.php


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