Footer::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php namespace XoopsModules\Tdmcreate\Files\Templates\User;
2
3
use XoopsModules\Tdmcreate;
4
use XoopsModules\Tdmcreate\Files;
5
6
/*
7
 You may not change or alter any portion of this comment or credits
8
 of supporting developers from this source code or any supporting source code
9
 which is considered copyrighted (c) material of the original comment or credit authors.
10
11
 This program is distributed in the hope that it will be useful,
12
 but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
 */
15
/**
16
 * tdmcreate module.
17
 *
18
 * @copyright       XOOPS Project (https://xoops.org)
19
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
20
 *
21
 * @since           2.5.0
22
 *
23
 * @author          Txmod Xoops http://www.txmodxoops.org
24
 *
25
 * @version         $Id: templates_footer.php 12258 2014-01-02 09:33:29Z timgno $
26
 */
27
28
/**
29
 * class Footer.
30
 */
31
class Footer extends Files\CreateFile
32
{
33
    /**
34
    * @var string
35
    */
36
    private $tdmcfile = null;
0 ignored issues
show
introduced by
The private property $tdmcfile is not used, and could be removed.
Loading history...
37
38
    /**
39
    *  @public function constructor
40
    *  @param null
41
    */
42
43
    public function __construct()
44
    {
45
        parent::__construct();
46
        $this->htmlcode = Tdmcreate\Files\CreateHtmlSmartyCodes::getInstance();
0 ignored issues
show
Documentation Bug introduced by
It seems like XoopsModules\Tdmcreate\F...rtyCodes::getInstance() of type XoopsModules\Tdmcreate\Files\CreateHtmlSmartyCodes is incompatible with the declared type string of property $htmlcode.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
47
    }
48
49
    /**
50
    *  @static function getInstance
51
    *  @param null
52
     * @return Footer
53
     */
54
    public static function getInstance()
55
    {
56
        static $instance = false;
57
        if (!$instance) {
58
            $instance = new self();
59
        }
60
61
        return $instance;
62
    }
63
64
    /**
65
    *  @public function write
66
    *  @param string $module
67
    *  @param mixed $table
68
    *  @param string $filename
69
     */
70
    public function write($module, $table, $filename)
71
    {
72
        $this->setModule($module);
73
        $this->setTable($table);
74
        $this->setFileName($filename);
75
    }
76
77
    /**
78
     *  @public function getTemplateUserFooterFacebookLikeButton
79
     *  @param null
80
     *
81
     * @return bool|string
82
     */
83
    public function getTemplateUserFooterFacebookLikeButton()
84
    {
85
        return "<li class='fb-like' data-href='<{\$xoops_mpageurl}>' data-layout='standard' data-action='like' data-show-faces='true'></li>";
86
    }
87
88
    /**
89
     *  @public function getTemplateUserFooterFacebookShareButton
90
     *  @param null
91
     *
92
     * @return bool|string
93
     */
94
    public function getTemplateUserFooterFacebookShareButton()
95
    {
96
        return "<li class='fb-share-button' data-href='<{\$xoops_mpageurl}>' data-layout='button_count'></li>";
97
    }
98
99
    /**
100
    *  @public function render
101
    *  @param null
102
     * @return bool|string
103
     */
104
    public function render()
105
    {
106
        $module = $this->getModule();
107
        $table = $this->getTable();
108
        $filename = $this->getFileName();
109
        $moduleDirname = $module->getVar('mod_dirname');
110
        $language = $this->getLanguage($moduleDirname, 'MA');
111
        $content = <<<EOT
112
<{if \$bookmarks != 0}>
113
<{include file="db:system_bookmarks.tpl"}>
114
<{/if}>
115
\n<{if \$fbcomments != 0}>
116
<{include file="db:system_fbcomments.tpl"}>
117
<{/if}>
118
<div class="pull-left"><{\$copyright}></div>\n
119
EOT;
120
        if (is_object($table) && null != $table->getVar('table_name')) {
121
            $content .= <<<EOT
122
<{if \$pagenav != ''}>
123
    <div class="pull-right"><{\$pagenav}></div>
124
<{/if}>
125
<br>\n
126
EOT;
127
        }
128
        $content .= <<<EOT
129
<{if \$xoops_isadmin}>
130
   <div class="text-center bold"><a href="<{\$admin}>"><{\$smarty.const.{$language}ADMIN}></a></div><br>
131
<{/if}>\n
132
EOT;
133
        if (is_object($table)) {
134
            if (1 == $table->getVar('table_comments')) {
135
                $content .= <<<EOT
136
<div class="pad2 marg2">
137
    <{if \$comment_mode == "flat"}>
138
        <{include file="db:system_comments_flat.tpl"}>
139
    <{elseif \$comment_mode == "thread"}>
140
        <{include file="db:system_comments_thread.tpl"}>
141
    <{elseif \$comment_mode == "nest"}>
142
        <{include file="db:system_comments_nest.tpl"}>
143
    <{/if}>
144
</div>\n
145
<br>\n
146
EOT;
147
            }
148
            if (1 == $table->getVar('table_notifications')) {
149
                $content .= <<<'EOT'
150
<{include file='db:system_notification_select.tpl'}>
151
EOT;
152
            }
153
        }
154
        $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
155
156
        return $this->renderFile();
157
    }
158
}
159