3131 */
3232class Pdf extends Files \CreateFile
3333{
34+ /**
35+ * @var mixed
36+ */
37+ private $ hc = null ;
38+
39+ /**
40+ * @var mixed
41+ */
42+ private $ sc = null ;
3443 /**
3544 * @public function constructor
3645 * @param null
3746 */
3847 public function __construct ()
3948 {
4049 parent ::__construct ();
50+ $ this ->hc = Modulebuilder \Files \CreateHtmlCode::getInstance ();
51+ $ this ->sc = Modulebuilder \Files \CreateSmartyCode::getInstance ();
4152 }
4253
4354 /**
@@ -59,26 +70,70 @@ public static function getInstance()
5970 * @public function write
6071 *
6172 * @param $module
73+ * @param $table
6274 * @param $filename
6375 */
64- public function write ($ module , $ filename )
76+ public function write ($ module , $ table , $ filename )
6577 {
6678 $ this ->setModule ($ module );
6779 $ this ->setFileName ($ filename );
80+ $ this ->setTable ($ table );
6881 }
6982
7083 /**
71- * @private function getTemplatesUserPdfBody
72- *
73- * @param null
74- *
84+ * @private function getTemplatesUserPagesItemPanel
85+ * @param string $moduleDirname
86+ * @param $tableId
87+ * @param $tableMid
88+ * @param $tableName
89+ * @param $tableSoleName
90+ * @param $tableRate
91+ * @param $tableBroken
92+ * @param $language
7593 * @return string
7694 */
77- private function getTemplatesUserPdfBody ()
95+ private function getTemplatesUserPdfBody ($ moduleDirname , $ tableId , $ tableMid , $ tableName , $ tableSoleName , $ tableRate , $ tableBroken , $ language )
7896 {
79- $ ret = <<<'EOT'
80- <div><{$pdfoutput}></div>
81- EOT;
97+ $ fields = $ this ->getTableFields ($ tableMid , $ tableId );
98+ $ ret = '' ;
99+ $ content_header = $ this ->sc ->getSmartySingleVar ('content_header ' );
100+ $ ret .= $ this ->hc ->getHtmlDiv ($ content_header , 'panel-heading ' , '' ,"\n" , false );
101+ $ retElem = '' ;
102+ foreach (\array_keys ($ fields ) as $ f ) {
103+ $ fieldElement = $ fields [$ f ]->getVar ('field_element ' );
104+ if (1 == $ fields [$ f ]->getVar ('field_user ' )) {
105+ if (1 == $ fields [$ f ]->getVar ('field_tbody ' )) {
106+ $ fieldName = $ fields [$ f ]->getVar ('field_name ' );
107+ $ rpFieldName = $ this ->getRightString ($ fieldName );
108+ $ langConst = \mb_strtoupper ($ tableSoleName ) . '_ ' . \mb_strtoupper ($ rpFieldName );
109+ $ lang = $ this ->sc ->getSmartyConst ($ language , $ langConst );
110+ $ retElem .= $ this ->hc ->getHtmlDiv ($ lang . ': ' , 'col-sm-3 ' ,"\t" , "\n" , false );
111+ switch ($ fieldElement ) {
112+ default :
113+ //case 3:
114+ //case 4:
115+ $ doubleVar = $ this ->sc ->getSmartyDoubleVar ($ tableSoleName , $ rpFieldName );
116+ $ retElem .= $ this ->hc ->getHtmlDiv ($ doubleVar , 'col-sm-8 ' , "\t" , "\n" , false );
117+ break ;
118+ case 10 :
119+ $ singleVar = $ this ->sc ->getSmartySingleVar ('xoops_icons32_url ' );
120+ $ doubleVar = $ this ->sc ->getSmartyDoubleVar ($ tableSoleName , $ rpFieldName );
121+ $ img = $ this ->hc ->getHtmlImage ($ singleVar . '/ ' . $ doubleVar , (string )$ tableName );
122+ $ retElem .= $ this ->hc ->getHtmlDiv ($ img , 'col-sm-8 ' , "\t" , "\n" , false );
123+ unset($ img );
124+ break ;
125+ case 13 :
126+ $ singleVar = $ this ->sc ->getSmartySingleVar ($ moduleDirname . '_upload_url ' );
127+ $ doubleVar = $ this ->sc ->getSmartyDoubleVar ($ tableSoleName , $ rpFieldName );
128+ $ img = $ this ->hc ->getHtmlImage ($ singleVar . "/images/ {$ tableName }/ " . $ doubleVar , (string )$ tableName );
129+ $ retElem .= $ this ->hc ->getHtmlDiv ($ img , 'col-sm-9 ' ,"\t" , "\n" , false );
130+ unset($ img );
131+ break ;
132+ }
133+ }
134+ }
135+ }
136+ $ ret .= $ this ->hc ->getHtmlDiv ($ retElem , 'panel-body ' );
82137
83138 return $ ret ;
84139 }
@@ -93,7 +148,13 @@ public function render()
93148 $ module = $ this ->getModule ();
94149 $ filename = $ this ->getFileName ();
95150 $ moduleDirname = $ module ->getVar ('mod_dirname ' );
96- $ content = $ this ->getTemplatesUserPdfBody ();
151+ $ table = $ this ->getTable ();
152+ $ language = $ this ->getLanguage ($ moduleDirname , 'MA ' );
153+ $ tableId = $ table ->getVar ('table_id ' );
154+ $ tableMid = $ table ->getVar ('table_mid ' );
155+ $ tableName = $ table ->getVar ('table_name ' );
156+ $ tableSoleName = $ table ->getVar ('table_solename ' );
157+ $ content = $ this ->getTemplatesUserPdfBody ($ moduleDirname , $ tableId , $ tableMid , $ tableName , $ tableSoleName , $ tableRate , $ tableBroken , $ language );
97158
98159 $ this ->create ($ moduleDirname , 'templates ' , $ filename , $ content , _AM_MODULEBUILDER_FILE_CREATED , _AM_MODULEBUILDER_FILE_NOTCREATED );
99160
0 commit comments