Passed
Push — master ( 09f9f5...606015 )
by Michael
16s
created

TemplatesUserPdf::render()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 11
rs 9.4285
cc 1
eloc 7
nc 1
nop 0
1
<?php
2
3
/*
4
 You may not change or alter any portion of this comment or credits
5
 of supporting developers from this source code or any supporting source code
6
 which is considered copyrighted (c) material of the original comment or credit authors.
7
8
 This program is distributed in the hope that it will be useful,
9
 but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
 */
12
/**
13
 * tdmcreate module.
14
 *
15
 * @copyright       The XOOPS Project http://sourceforge.net/projects/xoops/
16
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
17
 *
18
 * @since           2.5.0
19
 *
20
 * @author          Txmod Xoops http://www.txmodxoops.org
21
 *
22
 * @version         $Id: TemplatesUserPdf.php 12258 2014-01-02 09:33:29Z timgno $
23
 */
24
25
/**
26
 * Class TemplatesUserPdf.
27
 */
28
class TemplatesUserPdf extends TDMCreateFile
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
29
{    
0 ignored issues
show
Coding Style introduced by
The opening class brace should be on a newline by itself.
Loading history...
30
    /*
31
    *  @public function constructor
32
    *  @param null
33
    */
34
    /**
35
     *
36
     */
37
    public function __construct()
38
    {
39
        parent::__construct();
40
    }
41
42
    /*
43
    *  @static function &getInstance
44
    *  @param null
45
    */
46
    /**
47
     * @return TemplatesUserPdf
48
     */
49
    public static function &getInstance()
50
    {
51
        static $instance = false;
52
        if (!$instance) {
53
            $instance = new self();
54
        }
55
56
        return $instance;
57
    }
58
59
    /**
60
     *  @public function write
61
     *  @param $module
62
     *  @param $filename
63
     */    
64
    public function write($module, $filename)
65
    {
66
        $this->setModule($module);
67
		$this->setFileName($filename);
68
    }
69
70
    /*
71
    *  @private function getTemplatesUserPdfBody
72
    *  @param null
73
74
    */
75
    /**
76
     * @param null
77
     *
78
     * @return string
79
     */
80
    private function getTemplatesUserPdfBody()
81
    {
82
        $ret = <<<EOT
83
<div><{\$pdfoutput}></div>
84
EOT;
85
86
        return $ret;
87
    }
88
89
    /*
90
    *  @public function renderFile
91
    *  @param string $filename
92
    */
93
    /**
94
     * @param null
95
     *
96
     * @return bool|string
97
     */
98
    public function render()
99
    {
100
        $module = $this->getModule();
101
        $moduleDirname = $module->getVar('mod_dirname');
102
		$filename = $this->getFileName();
103
        $content = $this->getTemplatesUserPdfBody();
104
        //
105
        $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
106
107
        return $this->renderFile();
108
    }
109
}
110