Generates an Excel document.

@return void
961015
public function generateExcel(): void
    {
        // Set Document Properties from Service values.
        $this->builder
             ->setCreator($this->getCreator())
             ->setLastModifiedBy($this->getCreator())
             ->setTitle($this->getTitle())
             ->setSubject($this->getTitle())
             ->setDescription($this->getDescription());

        if ($this->hasSheets()) {
            // Multiple sheets.
            $this->createSheets();
        } else {
            // Single sheet - these will be an array and a string.
            $headers     = $this->getHeaders();
            $reportArray = $this->getData();
            $sheetTitle  = $this->getSheetTitles();

            $this->builder->setActiveSheetIndex(0);

            $this->createSheet(
                $headers,
                $reportArray,
                $sheetTitle
            );
        }

        // Close the builder and write the file.
        $this->builder->closeAndWrite();

        return;
    }
722128
public function generate()
	{
		$output    = parent::generate();
		$columnSet = \Netzmacht\ColumnSet\ColumnsetModel::findByPK($this->columnset_id);

		if(TL_MODE == 'BE') {
			$output = sprintf(
				'<h1>%s <small>[%s: %s]</small></h1>%s',
				$this->headline,
				$GLOBALS['TL_LANG']['CTE']['bootstrap_columnset'][0],
				$columnSet->title,
				$output
			);
		}

		return $output;
	}
572045
public function excel()
    {
        $ext = '.' . strtolower($this->excelWriter);

        return $this->buildExcelFile()->download($this->getFilename() . $ext, $this->excelWriter);
    }
696490
public function current()
	{
		$headers = $this->headers();

		$result = new stdClass;

		$currentRow = $this->sheet[$this->position];

		// Excel documents have alphanumeric columns
		foreach ($headers as $col => $column)
		{
			$result->$column = (isset($currentRow[$col]) ? $currentRow[$col] : '');
		}

		return $result;
	}
875649
protected function generate()
    {
        if ($this->subperiodsProcessed) {
            return;
        }

        parent::generate();

        $date = $this->date;

        $startMonth = $date->setDay(1)->setTime('00:00:00');
        $endMonth   = $startMonth->addPeriod(1, 'month')->setDay(1)->subDay(1);

        $this->processOptimalSubperiods($startMonth, $endMonth);
    }
1229523
public function generate()
	{
		$title         = $this->getTitle();
		$description   = $this->getDescription();
		$keywords      = $this->getKeywords();
		$miscellaneous = $this->getMiscellaneous();
		$canonical     = $this->getCanonical();

		$html[] = '<title>'.$title.'</title>'.PHP_EOL;

		if (! is_null($description)) {
			$html[] = '<meta name="description" content="'.$description.'">';
		}

		if (! is_null($keywords)) {
			$html[] = '<meta name="keywords" content="'.$keywords.'">';
		}

		if (! is_null($miscellaneous)) {
			foreach ($miscellaneous as $name => $content) {
				$html[] = '<meta name="'.$name.'" content="'.$content.'">';
			}
		}

		if (! is_null($canonical)) {
			$currentUrl = $this->request->fullUrl();

			if ($canonical != $currentUrl) {
				$html[] = PHP_EOL.'<link rel="canonical" href="'.$canonical.'">';
			}
		}

		return implode(PHP_EOL, $html);
	}
1229324
public function createWorkbookFile($worksheets)
    {
        $workbookXmlFileContents = <<<EOD
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
    <sheets>
EOD;

        /** @noinspection PhpUnnecessaryFullyQualifiedNameInspection */
        $escaper = \Box\Spout\Common\Escaper\XLSX::getInstance();

        /** @var Worksheet $worksheet */
        foreach ($worksheets as $worksheet) {
            $worksheetName = $worksheet->getExternalSheet()->getName();
            $worksheetId = $worksheet->getId();
            $workbookXmlFileContents .= '<sheet name="' . $escaper->escape($worksheetName) . '" sheetId="' . $worksheetId . '" r:id="rIdSheet' . $worksheetId . '"/>';
        }

        $workbookXmlFileContents .= <<<EOD
    </sheets>
</workbook>
EOD;

        $this->createFileWithContents($this->xlFolder, self::WORKBOOK_XML_FILE_NAME, $workbookXmlFileContents);

        return $this;
    }
650912
private function generateMethods(): void
    {
        $this->printer->writeln('Generating methods.');
        $this->generator->setChildNamespace('Method');

        /** @var Method $method */
        foreach ($this->wsdl->getMethods() as $name => $method) {
            $this->printer->writeln(" |\-Generating method $name");
            $code = $method->visit($this->generator);
            $className = $this->findClassName($code);
            $filename = $this->destination . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $className) . '.php';

            $this->writer->writeFile($filename, $code);
            $this->printer->writeln("  |- Wrote $className to $filename");
        }
    }
251653
protected function generate()
	{
		if ( $this->fields ) {
			parent::fire();

			if ( $this->log ) {
				$file = $this->datePrefix . '_' . $this->migrationName;
				$this->repository->log($file, $this->batch);
			}
		}
	}
940948
public function generate()
  {
    $this->printMessage('');

    $this->printMessage(
      'Creating Collection config'
    );

    Files::saveCollectionConfig((new ConfigGenerator($this->config))->create());

    $this->printMessage(
      'Creating Models, Controllers, Requests, Responses, and Exceptions'
    );

    /**
     * @var string $name
     * @var Config $entity
     */
    foreach ($this->config->versions as $version => $api)
    {
      $requests = [];
      $this->printMessage($version . '...');
      foreach ($api as $entityName => $entity)
      {
        $entity = $this->vaidateEntityConfig($entityName, $entity);

        Files::initializeFolders($version, $entityName);

        if (isset($entity->model))
        {
          $columns = $entity->model->columns;

          // Models
          Files::saveModel(
            new ModelGenerator($version, $entityName, $columns)
          );

          // Requests
          foreach ($entity->requests as $requestMethod => $actions)
          {
            foreach ($actions as $actionName => $action)
            {
              if (empty($action))
              {
                continue;
              }

              $requests[] = Files::saveRequest(
                new RequestGenerator(
                  $version,
                  $entityName,
                  $entity->model,
                  $requestMethod,
                  $actionName,
                  $action
                )
              );
            }
          }

          // Responses
          Files::saveResponse(
            new ResponseGenerator($version, $entityName, $columns)
          );
        }

        // Exceptions
        $exceptions = $this->getExceptionsFromEntityConfig($entity);
        foreach ($exceptions as $exception)
        {
          Files::saveException(
            new ExceptionGenerator($version, $entityName, $exception)
          );
        }

        // Controllers
        Files::saveController(
          new ControllerGenerator($version, $entityName, $entity)
        );
      }

      Files::saveSDK(
        new SDKGenerator($version, $this->config->name, $requests)
      );
    }

    $this->printMessage("All done, Remember to add the files to VCS!");
  }
832764
public function generate()
    {
        $version = date('YmdHis');

        $this->_generateMigrationFile($version);
        print PHP_EOL . Color::success('Version ' . $version . ' was successfully generated') . PHP_EOL;
    }
778047
public function generate(): void
    {
        $this->filesystem->mkdir($this->getDirectories());

        foreach ($this->getFiles() as $filePath => $fileContent) {
            $this->filesystem->dumpFile($filePath, $fileContent);
        }

        $this->filesystem->remove($this->clean());
    }
1266073
private function finalizeSheet()
    {
        $this->sheetFile->fwrite('</sheetData></worksheet>');
        $this->sheetFile->rewind();
        $this->sheetFile->fwrite(SheetXml::HEADER_XML);
        $this->sheetFile->fwrite($this->sheet->getDimensionXml());
        $this->sheetFile->fwrite($this->sheet->getSheetViewsXml());
        $this->sheetFile->fwrite($this->sheet->getColsXml());
        $this->zip->addFile($this->sheetFile->getFilePath(), 'xl/worksheets/sheet1.xml');
    }
277357
private function createFormFiles() {
        $db = \Cityware\Db\Factory::factory('zend');
        $tableMetadata = new \Zend\Db\Metadata\Metadata($db->getAdapter());
        $tableInfo = $tableMetadata->getTable($this->getTable(), $this->getSchema());

        $iniFile = $this->genConfigFormIni();
        $iniFile .= $this->genFieldsFormIni($tableInfo);
        $iniFile .= $this->genButtonsFormIni();

        $translateFile = $this->genTranslateFormArray($tableInfo);

        $moduleName = ucfirst($this->getModule());
        $moduleNameLower = strtolower($this->getModule());

        try {
            if (!empty($this->formName)) {
                file_put_contents($this->dstIniDirectory . $this->formName . '.ini', $iniFile);
                chmod($this->dstIniDirectory . $this->formName . '.ini', 0777);

                file_put_contents($this->dstTranslateDirectory . $this->formName . '.php', $translateFile);
                chmod($this->dstTranslateDirectory . $this->formName . '.php', 0777);

                $template_Form = file_get_contents($this->srcTemplateDirectory . 'Template_Form.tmpl');
                $templateForm = str_replace("%moduleName%", $moduleName, str_replace("%moduleNameLower%", $moduleNameLower, $template_Form));
                file_put_contents($this->dstViewDirectory . $this->formName . '.phtml', $templateForm);
                chmod($this->dstViewDirectory . $this->formName . '.phtml', 0644);
            } else {
                file_put_contents($this->dstIniDirectory . 'add.ini', $iniFile);
                chmod($this->dstIniDirectory . 'add.ini', 0777);

                file_put_contents($this->dstTranslateDirectory . 'add.php', $translateFile);
                chmod($this->dstTranslateDirectory . 'add.php', 0777);

                file_put_contents($this->dstIniDirectory . 'edit.ini', $iniFile);
                chmod($this->dstIniDirectory . 'edit.ini', 0777);

                file_put_contents($this->dstTranslateDirectory . 'edit.php', $translateFile);
                chmod($this->dstTranslateDirectory . 'edit.php', 0777);

                $template_Form = file_get_contents($this->srcTemplateDirectory . 'Template_Form.tmpl');
                $templateForm = str_replace("%moduleName%", $moduleName, str_replace("%moduleNameLower%", $moduleNameLower, $template_Form));

                file_put_contents($this->dstViewDirectory . 'add.phtml', $templateForm);
                chmod($this->dstViewDirectory . 'add.phtml', 0644);

                file_put_contents($this->dstViewDirectory . 'edit.phtml', $templateForm);
                chmod($this->dstViewDirectory . 'edit.phtml', 0644);
            }
        } catch (Exception $exc) {
            throw new Exception('Não foi possivel criar o arquivo de configuração do formulário! <br />' . $exc->getMessage(), 500);
        }
    }
1115418
public function generate($document)
    {
        $lexer = new Lexer();
        $tokenStream = $lexer->tokenize($document);
        $tokenParser = new TokenParser();
        $nodeStream = $tokenParser->parse($tokenStream);
        $nodeParser = new NodeParser();
        $this->classBuilder = $nodeParser->parse($nodeStream);
        $compiler = new Compiler($this->options);
        $this->streamWriter = $compiler->compile($this->classBuilder);

        return $this;
    }
36132
public function docGenerate()
    {
        $this->_exec('cd '.__DIR__.'/docs && composer install');
        $this->_exec(__DIR__.'/docs/build');
        $this->_exec(__DIR__.'/vendor/bin/couscous preview');
    }
233599
public function generatepage_html(){
		$bhtml=BHTML::getInstance();
		$status=200;
		//Forming page from blocks...
		$jsused=array();
		$cssused=array();
		foreach($this->rules as &$c){
			if(isset($this->positions[$c->position])){
				$this->positions[$c->position].=$c->output;
				}else{
				$this->positions[$c->position]=$c->output;
				}
			if($c->status!=200){
				$status=$c->status;
				}
			if(isset($c->locationurl)){
				$bhtml->setLocationUrl($c->locationurl,$c->locationtime);
				}
			if(isset($c->modified)){
				$bhtml->setLastModified($c->modified);
				}
			if(isset($c->title)){
				$bhtml->setTitle($c->title);
				}
			if(isset($c->meta)){
				foreach($c->meta as $meta){
					$bhtml->add_meta($meta['name'],$meta['content'],$meta['http_equiv']);
					}
				}
			if(isset($c->link)){
				foreach($c->link as $link){
					//Remove dublicates...
					$wasused=false;
					if($link['rel']=='stylesheet'){
						$wasused=isset($cssused[$link['href']]);
						$cssused[$link['href']]=1;
						}
					if(!$wasused){
						$bhtml->add_link($link);
						}
					}
				}
			if(isset($c->js)){
				foreach($c->js as $js){
					//Remove dublicates...
					$wasused=false;
					if(!empty($js['file'])){
						$wasused=isset($jsused[$js['file']]);
						$jsused[$js['file']]=1;
						}
					if(!$wasused){
						$bhtml->addJS($js['file'],$js['src'],$js['priority']);
						}
					}
				}
			if(isset($c->style)){
				foreach($c->style as $st){
					$bhtml->addCSSDeclaration($st);
					}
				}
			if(isset($c->frameworks)){
				foreach($c->frameworks as $framework){
					$bhtml->useFramework($framework);
					}
				}
			//Add breadcrumbs elements
			if(isset($c->breadcrumbs)){
				bimport('cms.breadcrumbs');
				$gbc=BGeneralBreadcrumbs::getInstance();
				foreach($c->breadcrumbs as $bc){
					$gbc->elements[]=$bc;
					}
				}
			}
		//Output the page
		header('Content-Type: text/html; charset=utf-8');
		if($status==403){
			header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden');
			}
		if($status==404){
			header($_SERVER['SERVER_PROTOCOL'].' 404 Page Not Found');
			}
		if($status==500){
			header($_SERVER['SERVER_PROTOCOL'].' 500 Server Error!');
			}
		$bhtml->headers_check();
		//Check for last-modified
		if((isset($_SERVER['HTTP_IF_MODIFIED_SINCE']))&&(isset($bhtml->last_modified))){
			$mod_since=new DateTime($_SERVER['HTTP_IF_MODIFIED_SINCE']);
			$interval=date_diff($bhtml->last_modified,$mod_since);
			if($interval->invert==0){
	        		header($_SERVER['SERVER_PROTOCOL'].' 304 Not Modified');
				return;//return nothing!
				}
			}
		if($this->templatename===NULL){
			$this->templatename='default';
			}
		//Detect device...
		$device=BBrowserUseragent::detectDevice();
		if($device==DEVICE_TYPE_MPHONE){
			$suffix='.m';
			}
		elseif($device==DEVICE_TYPE_TABLET){
			$suffix='.m';
			}else{
			$suffix='.d';
			}
		$fn=BTEMPLATESPATH.$this->templatename.DIRECTORY_SEPARATOR.'template'.$suffix.'.php';
		//
		if(!file_exists($fn)){
			$fn=BTEMPLATESPATH.$this->templatename.DIRECTORY_SEPARATOR.'template.d.php';
			}
		//
		if(!file_exists($fn)){
			$fn=BTEMPLATESPATH.'default'.DIRECTORY_SEPARATOR.'template'.$suffix.'.php';
			}
		//
		if(!file_exists($fn)){
			$fn=BTEMPLATESPATH.'default'.DIRECTORY_SEPARATOR.'template.d.php';
			}

		//Starting render
		if(DEBUG_MODE){
			BLog::addToLog('[Router]: Rendering template...');
			}
		ob_start();
		include $fn;
		$tpl_str=ob_get_clean();
		$tpl_str=str_replace('{{head}}','',$tpl_str);
		if(DEBUG_MODE){
			BLog::addToLog('[Router]: Filling empty positions...');
			}
		$pattern='/{{position.(?P<position>\w+)*}}/';
		preg_match_all($pattern, $tpl_str, $matches);
		foreach($matches['position'] as $pos){
			if(!isset($this->positions[$pos])){
				$this->positions[$pos]='';
				}
			}
		if(DEBUG_MODE){
			BLog::addToLog('[Router]: Put content into positions...');
			}
		foreach($this->positions as $p=>$val){
			$tpl_str=str_replace('{{position:'.$p.'}}',$val,$tpl_str);
			}
		//Output debug information, if necessary.
		if(DEBUG_MODE){
			BLog::addToLog('[Router]: Generation time: '.sprintf('%7.7f',self::page_time()));
			BLog::addToLog('[Router]: MySQL queries:'.BMySQL::getQueriesCount());
			$qc=BCache::getQueriesCount();
			BLog::addToLog('[Router]: Cache queries: get-'.$qc['get'].' set-'.$qc['set'].' mset-'.$qc['mset'].' mget-'.$qc['mget'].' gc-'.$qc['gc']);
			BLog::addToLog('[Router]: Outputing the template...');
			}
		echo($tpl_str);
		BLog::addToLog('[Router]: All done!');
		if(!empty($this->htmllogger)){
			$this->htmllogger->print_html();
			}
		}