Ver código fonte

Ajout du script de Google Analytics

prodstable
keun 8 anos atrás
pai
commit
83cc6f1c3c
10 arquivos alterados com 23 adições e 6167 exclusões
  1. +11
    -0
      backend/views/layouts/main.php
  2. +11
    -0
      frontend/views/layouts/main.php
  3. +1
    -0
      vendor/kartik-v/yii2-mpdf
  4. +0
    -19
      vendor/kartik-v/yii2-mpdf/CHANGE.md
  5. +0
    -28
      vendor/kartik-v/yii2-mpdf/LICENSE.md
  6. +0
    -405
      vendor/kartik-v/yii2-mpdf/Pdf.php
  7. +0
    -124
      vendor/kartik-v/yii2-mpdf/README.md
  8. +0
    -5555
      vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.css
  9. +0
    -8
      vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css
  10. +0
    -28
      vendor/kartik-v/yii2-mpdf/composer.json

+ 11
- 0
backend/views/layouts/main.php Ver arquivo

@@ -94,6 +94,17 @@ AppAsset::register($this);
<!-- chat -->
<script src="//code.tidio.co/gngxwpdobb64cpvhd8patajpurs5feom.js"></script>
<!-- analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-86917043-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>
<?php $this->endPage() ?>

+ 11
- 0
frontend/views/layouts/main.php Ver arquivo

@@ -77,6 +77,17 @@ AppAsset::register($this);
<!-- chat -->
<script src="//code.tidio.co/gngxwpdobb64cpvhd8patajpurs5feom.js"></script>
<!-- analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-86917043-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>
<?php $this->endPage() ?>

+ 1
- 0
vendor/kartik-v/yii2-mpdf

@@ -0,0 +1 @@
Subproject commit 94de4fd901036bb086bf86e10509649345b462a0

+ 0
- 19
vendor/kartik-v/yii2-mpdf/CHANGE.md Ver arquivo

@@ -1,19 +0,0 @@
Change Log: `yii2-mpdf`
=======================

## Version 1.0.1

**Date:** 08-Apr-2016

- (enh #12): New `tempPath` property to allow setting temporary folder for mpdf font data.
- (enh #13): Default mode setting for Asian Languages via `Pdf::MODE_ASIAN`.
- (enh #14): Initialize with default mPDF configuration options.
- Update mpdf source to use repo https://github.com/mpdf/mpdf.
- Add branch alias for dev-master latest release.

## Version 1.0.0

**Date:** 03-Nov-2014

- Initial release.
- Set release to stable.

+ 0
- 28
vendor/kartik-v/yii2-mpdf/LICENSE.md Ver arquivo

@@ -1,28 +0,0 @@
Copyright (c) 2014 - 2015, Kartik Visweswaran
Krajee.com
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.

* Neither the names of Kartik Visweswaran or Krajee nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+ 0
- 405
vendor/kartik-v/yii2-mpdf/Pdf.php Ver arquivo

@@ -1,405 +0,0 @@
<?php

/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2015
* @package yii2-mpdf
* @version 1.0.1
*/

namespace kartik\mpdf;

use Yii;
use yii\base\Component;
use yii\base\InvalidConfigException;
use yii\base\InvalidParamException;
use \mPDF;

/**
* PDF library component wrapping the mPDF class with additional enhancements.
*
* @author Kartik Visweswaran <kartikv2@gmail.com>
* @since 1.0
*/
class Pdf extends Component
{
// mode
const MODE_BLANK = '';
const MODE_CORE = 'c';
const MODE_UTF8 = 'UTF-8';
const MODE_ASIAN = '+aCJK';

// format
const FORMAT_A3 = 'A3';
const FORMAT_A4 = 'A4';
const FORMAT_LETTER = 'Letter';
const FORMAT_LEGAL = 'Legal';
const FORMAT_FOLIO = 'Folio';
const FORMAT_LEDGER = 'Ledger-L';
const FORMAT_TABLOID = 'Tabloid';

// orientation
const ORIENT_PORTRAIT = 'P';
const ORIENT_LANDSCAPE = 'L';

// output destination
const DEST_BROWSER = 'I';
const DEST_DOWNLOAD = 'D';
const DEST_FILE = 'F';
const DEST_STRING = 'S';

/**
* @var string specifies the mode of the new document. If the mode is set by passing a country/language string,
* this may also set: available fonts, text justification, and directionality RTL.
*/
public $mode = self::MODE_BLANK;

/**
* @var string|array, the format can be specified either as a pre-defined page size,
* or as an array of width and height in millimetres.
*/
public $format = self::FORMAT_A4;

/**
* @var int sets the default document font size in points (pt)
*/
public $defaultFontSize = 0;

/**
* @var string sets the default font-family for the new document. Uses default value set in defaultCSS
* unless codepage has been set to "win-1252". If codepage="win-1252", the appropriate core Adobe font
* will be set i.e. Helvetica, Times, or Courier.
*/
public $defaultFont = '';

/**
* @var float sets the page left margin for the new document. All values should be specified as LENGTH in millimetres.
* If you are creating a DOUBLE-SIDED document, the margin values specified will be used for ODD pages; left and right margins
* will be mirrored for EVEN pages.
*/
public $marginLeft = 15;

/**
* @var float sets the page right margin for the new document (in millimetres).
*/
public $marginRight = 15;

/**
* @var float sets the page top margin for the new document (in millimetres).
*/
public $marginTop = 16;

/**
* @var float sets the page bottom margin for the new document (in millimetres).
*/
public $marginBottom = 16;

/**
* @var float sets the page header margin for the new document (in millimetres).
*/
public $marginHeader = 9;

/**
* @var float sets the page footer margin for the new document (in millimetres).
*/
public $marginFooter = 9;

/**
* @var string specifies the default page orientation of the new document.
*/
public $orientation = self::ORIENT_PORTRAIT;

/**
* @var string css file to prepend to the PDF
*/
public $cssFile = '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css';

/**
* @var string additional inline css to append after the cssFile
*/
public $cssInline = '';

/**
* @var string the HTML content to be converted to PDF
*/
public $content = '';

/**
* @var string the output filename
*/
public $filename = '';

/**
* @var string the output destination
*/
public $destination = self::DEST_BROWSER;
/**
* @var string the folder path for storing the temporary data generated by mpdf.
* If not set this defaults to `Yii::getAlias('@runtime/mpdf')`.
*/
public $tempPath;

/**
* @var array the mPDF methods that will called in the sequence listed before
* rendering the content. Should be an associative array of $method => $params
* format, where:
* - `$method`: string, is the mPDF method / function name
* - `$param`: mixed, are the mPDF method parameters
*/
public $methods = '';

/**
* @var string the mPDF configuration options entered as a `$key => value`
* associative array, where:
* - `$key`: string is the mPDF configuration property name
* - `$value`: mixed is the mPDF configured property value
*/
public $options = [
'autoScriptToLang' => true,
'ignore_invalid_utf8' => true,
'tabSpaces' => 4
];

/**
* @var mPDF api instance
*/
protected $_mpdf;

/**
* @var string the css file content
*/
protected $_css;

/**
*
* @var array Array of file-pathes that should be attached to the generated PDF
*/
protected $_pdfAttachements;
/**
* @inherit doc
*/
public function init()
{
$this->initTempPaths();
parent::init();
$this->parseFormat();
}

/**
* Initialize folder paths to allow mpdf to write temporary data.
*/
public function initTempPaths()
{
if (empty($this->tempPath)) {
$this->tempPath = Yii::getAlias('@runtime/mpdf');
}
$prefix = $this->tempPath . DIRECTORY_SEPARATOR;
static::definePath('_MPDF_TEMP_PATH', "{$prefix}tmp");
static::definePath('_MPDF_TTFONTDATAPATH', "{$prefix}ttfontdata");
}
/**
* Defines a mPDF temporary path if not set
*
* @param string $prop the mPDF constant to define
* @param string $dir the directory to create
*
* @return bool
* @throws InvalidConfigException
*/
protected static function definePath($prop, $dir)
{
if (defined($prop)) {
return;
}
$status = true;
if (!is_dir($dir)) {
$status = mkdir($dir, 0777, true);
}
if (!$status) {
throw new InvalidConfigException("Could not create the folder '{$dir}' in '\$tempPath' set.");
}
define($prop, $dir);
}
/**
* Renders and returns the PDF output. Uses the class level property settings.
*/
public function render()
{
$this->configure($this->options);
if (!empty($this->methods)) {
foreach ($this->methods as $method => $param) {
$this->execute($method, $param);
}
}
return $this->output($this->content, $this->filename, $this->destination);
}

/**
* Initializes (if needed) and fetches the mPDF API instance
* @return mPDF instance
*/
public function getApi()
{
if (empty($this->_mpdf) || !$this->_mpdf instanceof mPDF) {
$this->setApi();
}
return $this->_mpdf;
}

/**
* Sets the mPDF API instance
*/
public function setApi()
{
$this->_mpdf = new mPDF(
$this->mode,
$this->format,
$this->defaultFontSize,
$this->defaultFont,
$this->marginLeft,
$this->marginRight,
$this->marginTop,
$this->marginBottom,
$this->marginHeader,
$this->marginFooter,
$this->orientation
);
}

/**
* Fetches the content of the CSS file if supplied
* @return string
*/
public function getCss()
{
if (!empty($this->_css)) {
return $this->_css;
}
$cssFile = empty($this->cssFile) ? '' : Yii::getAlias($this->cssFile);
if (empty($cssFile) || !file_exists($cssFile)) {
$css = '';
} else {
$css = file_get_contents($cssFile);
}
$css .= $this->cssInline;
return $css;
}
/**
* @return array Array of attachements
*/
public function getPdfAttachements (){
return $this->_pdfAttachements;
}
/**
* add an PDF to attach to the generated PDF
* @param string $filePath
*/
public function addPdfAttachement ($filePath){
$this->_pdfAttachements[] = $filePath;
}
/**
* Configures mPDF options
* @param array the mPDF configuration options entered as a `$key => value`
* associative array, where:
* - `$key`: string is the configuration property name
* - `$value`: mixed is the configured property value
*/
public function configure($options = [])
{
if (empty($options)) {
return;
}
$api = $this->api;
foreach ($options as $key => $value) {
if (property_exists($api, $key)) {
$api->$key = $value;
}
}
}

/**
* Calls the mPDF method with parameters
* @param string method the mPDF method / function name
* @param array params the mPDF parameters
* @return mixed
*/
public function execute($method, $params = [])
{
$api = $this->api;
if (!method_exists($api, $method)) {
throw new InvalidParamException("Invalid or undefined mPDF method '{$method}' passed to 'Pdf::execute'.");
}
if (!is_array($params)) {
$params = [$params];
}
return call_user_func_array([$api, $method], $params);
}

/**
* Generates a PDF output
* @param string content, the input HTML content
* @param string file, the name of the file. If not specified, the document will be
* sent to the browser inline (destination I).
* @param string dest, the destination. Defaults to Pdf::DEST_BROWSER.
* @return mixed
*/
public function output($content = '', $file = '', $dest = self::DEST_BROWSER)
{
$api = $this->api;
$css = $this->css;
$pdfAttachements = $this->getPdfAttachements();
if (!empty($css)) {
$api->WriteHTML($css, 1);
$api->WriteHTML($content, 2);
} else {
$api->WriteHTML($content);
}
if($pdfAttachements){
$api->SetImportUse();
$api->SetHeader(null);
$api->SetFooter(null);
foreach ($pdfAttachements as $attachement){
$this->writePdfAttachement($api, $attachement);
}
}
return $api->Output($file, $dest);
}
/**
* appends the given attachement to the generated PDF
* @param mPDF $api
* @param String $attachement
*/
private function writePdfAttachement ($api, $attachement){
try {
$pageCount = $api->SetSourceFile($attachement);
} catch (\MpdfException $e){
$pageCount = 0;
}
for($i=1; $i<=$pageCount; $i++){
$api->AddPage();
$templateId = $api->ImportPage($i);
$api->UseTemplate($templateId);
}
}
/**
* Parse the format automatically based on the orientation
*/
protected function parseFormat()
{
$tag = '-' . self::ORIENT_LANDSCAPE;
if ($this->orientation == self::ORIENT_LANDSCAPE && is_string($this->format) && substr($this->format,
-2) != $tag
) {
$this->format .= $tag;
}
}

}

+ 0
- 124
vendor/kartik-v/yii2-mpdf/README.md Ver arquivo

@@ -1,124 +0,0 @@
yii2-mpdf
=============

[![Stable Version](https://poser.pugx.org/kartik-v/yii2-mpdf/v/stable)](https://packagist.org/packages/kartik-v/yii2-mpdf)
[![Untable Version](https://poser.pugx.org/kartik-v/yii2-mpdf/v/unstable)](https://packagist.org/packages/kartik-v/yii2-mpdf)
[![License](https://poser.pugx.org/kartik-v/yii2-mpdf/license)](https://packagist.org/packages/kartik-v/yii2-mpdf)
[![Total Downloads](https://poser.pugx.org/kartik-v/yii2-mpdf/downloads)](https://packagist.org/packages/kartik-v/yii2-mpdf)
[![Monthly Downloads](https://poser.pugx.org/kartik-v/yii2-mpdf/d/monthly)](https://packagist.org/packages/kartik-v/yii2-mpdf)
[![Daily Downloads](https://poser.pugx.org/kartik-v/yii2-mpdf/d/daily)](https://packagist.org/packages/kartik-v/yii2-mpdf)

The **yii2-mpdf** extension is a Yii2 wrapper component for the [mPDF library](http://www.mpdf1.com/) with enhancements. The mPDF library offers ability to generate PDF files from UTF-8 encoded HTML. This library is based on [FPDF](http://www.fpdf.org/) and [HTML2FPDF](http://html2fpdf.sourceforge.net/), with a number of enhancements. The key features in the library are to be able to generate PDF files 'on-the-fly' from HTML content, handling different languages. Refer the [documentation manual](https://mpdf.github.io) or the [upstream mpdf site](http://mpdf1.com) for further details and understanding of the library. The yii2-mpdf extension offers an easy way to integrate and use the mPDF library within your Yii application with subtle enhancements. The key features offerred with this release are:

- Setup `pdf` component globally in your yii application configuration.
- Setup mPDF properties or call mPDF methods easily using simple array configuration.
- Enhances extension to setup your own custom CSS file for rendering the formatted HTML content.
- Extension has a built-in version of bootstrap.css (v3.3.0 modified for mPDF) to be applied by default. This will allow you to generate PDF content from bootstrap markup HTML easily.
- Offers easy way to prepend inline CSS in addition to your own CSS file.
- Offers easy to use object oriented methods to render complex PDF.
- Easy use of the extension like any Yii widget by using the render method with minimal configuration.
- The extension uses the latest development version (v6.0beta) of the mPDF library. It uses the composer repository `kartik-v/mpdf` on packagist as a source for this latest version. mPDF 6.0 can utilise OpenType layout tables to display complex scripts. This release (v6.0) contains fonts (open source) to cover almost every imaginable script / language. Includes support for Arabic or Indic scripts (as well as Khmer, Lao, Myanmar etc.). It also is expected to improve the display of Thai, Vietnamese and Hebrew. It also includes additional fonts for Chinese, Japanese, and Korean.
- Inbuilt integration with [yii2-grid](http://demos.krajee.com/grid) extension that allows you to export grid as PDF and even generate advanced PDF reports.

### Demo
Read the detailed [documentation and usage](http://demos.krajee.com/mpdf) of the extension.

## Installation

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

> Note: Check the [composer.json](https://github.com/kartik-v/yii2-mpdf/blob/master/composer.json) for this extension's requirements and dependencies.
Read this [web tip /wiki](http://webtips.krajee.com/setting-composer-minimum-stability-application/) on setting the `minimum-stability` settings for your application's composer.json.

Either run

```
$ php composer.phar require kartik-v/yii2-mpdf "dev-master"
```

or add

```
"kartik-v/yii2-mpdf": "dev-master"
```

to the ```require``` section of your `composer.json` file.

## Usage

### Widget Like Usage
The component can be used straightforward in a manner similar to any widget to render your HTML content as PDF. For example, you
can call the component simply like below in your controller action:

```php
use kartik\mpdf\Pdf;

public function actionReport() {
// get your HTML raw content without any layouts or scripts
$content = $this->renderPartial('_reportView');
// setup kartik\mpdf\Pdf component
$pdf = new Pdf([
// set to use core fonts only
'mode' => Pdf::MODE_CORE,
// A4 paper format
'format' => Pdf::FORMAT_A4,
// portrait orientation
'orientation' => Pdf::ORIENT_PORTRAIT,
// stream to browser inline
'destination' => Pdf::DEST_BROWSER,
// your html content input
'content' => $content,
// format content from your own css file if needed or use the
// enhanced bootstrap css built by Krajee for mPDF formatting
'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css',
// any css to be embedded if required
'cssInline' => '.kv-heading-1{font-size:18px}',
// set mPDF properties on the fly
'options' => ['title' => 'Krajee Report Title'],
// call mPDF methods on the fly
'methods' => [
'SetHeader'=>['Krajee Report Header'],
'SetFooter'=>['{PAGENO}'],
]
]);
// return the pdf output as per the destination setting
return $pdf->render();
}
```

### Global Component

You can also setup the widget as a global component for use across your application with defaults preset. For example, setup the following in
the components section of your Yii application configuration file:

```php
use kartik\mpdf\Pdf;
// ...
'components' => [
// setup Krajee Pdf component
'pdf' => [
'class' => Pdf::classname(),
'format' => Pdf::FORMAT_A4,
'orientation' => Pdf::ORIENT_PORTRAIT,
'destination' => Pdf::DEST_BROWSER,
// refer settings section for all configuration options
]
]
```

Once you have setup the component, you can refer it across your application easily:

```php
$pdf = Yii::$app->pdf;
$pdf->content = $htmlContent;
return $pdf->render();
```

For other usage and details, read the detailed [documentation](http://demos.krajee.com/mpdf).

## License

**yii2-mpdf** is released under the BSD 3-Clause License. See the bundled `LICENSE.md` for details.
cd

+ 0
- 5555
vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.css
Diferenças do arquivo suprimidas por serem muito extensas
Ver arquivo


+ 0
- 8
vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css
Diferenças do arquivo suprimidas por serem muito extensas
Ver arquivo


+ 0
- 28
vendor/kartik-v/yii2-mpdf/composer.json Ver arquivo

@@ -1,28 +0,0 @@
{
"name": "kartik-v/yii2-mpdf",
"description": "A Yii2 wrapper component for the mPDF library which generates PDF files from UTF-8 encoded HTML.",
"keywords": ["yii2", "extension", "pdf", "mpdf", "utf8", "html", "component"],
"homepage": "https://github.com/kartik-v/yii2-mpdf",
"type": "yii2-extension",
"license": "BSD 3-Clause",
"authors": [
{
"name": "Kartik Visweswaran",
"email": "kartikv2@gmail.com",
"homepage": "http://www.krajee.com/"
}
],
"require": {
"mpdf/mpdf": "<7.0"
},
"autoload": {
"psr-4": {
"kartik\\mpdf\\": ""
}
},
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
}
}

Carregando…
Cancelar
Salvar