Skip to content

Commit

Permalink
Merge pull request #60 from ggoffy/master
Browse files Browse the repository at this point in the history
various fixes;moved to final
  • Loading branch information
ggoffy committed Nov 11, 2020
2 parents e093d80 + f12c363 commit 517fde3
Show file tree
Hide file tree
Showing 15 changed files with 377 additions and 215 deletions.
31 changes: 15 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,12 @@ If you liked the modulebuilder module and thanks to the long process for giving

# ModuleBuilder version 3.x

[![Build Status](https://scrutinizer-ci.com/g/txmodxoops/modulebuilder/badges/build.png?b=master)](https://travis-ci.org/txmodxoops/modulebuilder)
[![Jenkins coverage](https://img.shields.io/jenkins/c/https/jenkins.qa.ubuntu.com/address-book-service-utopic-i386-ci.svg)](https://github.com/txmodxoops/modulebuilder)
[![Build Status](https://scrutinizer-ci.com/g/ggoffy/modulebuilder/badges/build.png?b=master)](https://travis-ci.org/ggoffy/modulebuilder)
[![Jenkins coverage](https://img.shields.io/jenkins/c/https/jenkins.qa.ubuntu.com/address-book-service-utopic-i386-ci.svg)](https://github.com/XoopsModules25x/modulebuilder)
[![Software License](https://img.shields.io/badge/license-GPL-brightgreen.svg?style=flat)](docs/license.txt)
[![Quality Score](https://img.shields.io/scrutinizer/g/txmodxoops/modulebuilder.svg?style=flat)](https://scrutinizer-ci.com/g/txmodxoops/modulebuilder)
[![Gem](https://img.shields.io/gem/dt/rails.svg)](txmodxoops/modulebuilder)
[![Latest Version](https://img.shields.io/github/release/txmodxoops/modulebuilder.svg?style=flat)](https://github.com/txmodxoops/ModuleBuilder-1.91/releases/latest)

<p>
<a href="http://issuestats.com/github/txmodxoops/modulebuilder"><img alt="Issue Stats" src="http://issuestats.com/github/txmodxoops/modulebuilder/badge/pr?style=flat"></a>
<a href="http://issuestats.com/github/txmodxoops/modulebuilder"><img alt="Issue Stats" src="http://issuestats.com/github/txmodxoops/modulebuilder/badge/issue?style=flat"></a>
<!--[![Github Releases (by Release)](https://img.shields.io/badge/modulebuilder-alpha%203.2-green.svg)](https://github.com/txmodxoops/modulebuilder/tree/alpha-3-4)-->
</p>
[![Quality Score](https://img.shields.io/scrutinizer/g/ggoffy/modulebuilder.svg?style=flat)](https://scrutinizer-ci.com/g/ggoffy/modulebuilder)
[![Gem](https://img.shields.io/gem/dt/rails.svg)](XoopsModules25x/modulebuilder)
[![Latest Version](https://img.shields.io/github/release/XoopsModules25x/modulebuilder.svg?style=flat)](https://github.com/XoopsModules25x/modulebuilder/releases/latest)

> **Note:** This repository contains the code of the modulebuilder module
It's under development currently. If you want to build with developers this version of module or create a base modules, you can use the last version of this module at [Txmod XOOPS Web Site](http://www.txmodxoops.org), and visit the main discussion forum at [XOOPS Web Site](https://xoops.org/modules/newbb/viewtopic.php?topic_id=76746) for more information.
Expand Down Expand Up @@ -61,11 +55,16 @@ Apache = 2.4.10, 2.4.18
XOOPS = 2.5.11

Codeception = 2.0.13

Selenium IDE = 2.9.0

[![Stories in Ready](https://badge.waffle.io/txmodxoops/modulebuilder.svg?label=ready&title=Ready)](http://waffle.io/txmodxoops/modulebuilder)
[![Stories in Work in Progress](https://badge.waffle.io/txmodxoops/modulebuilder.svg?label=Work in Progress&title=Work in Progress)](http://waffle.io/txmodxoops/modulebuilder)
[![Stories in Done](https://badge.waffle.io/txmodxoops/modulebuilder.svg?label=done&title=Done)](http://waffle.io/txmodxoops/modulebuilder)
[![Stories in Roadmap](https://badge.waffle.io/txmodxoops/modulebuilder.svg?label=roadmap&title=Roadmap)](http://waffle.io/txmodxoops/modulebuilder)
#### Tutorial:
[![Tutorial Available](https://xoops.org/images/tutorial-available-blue.svg)](https://xoops.gitbook.io/modulebuilder-tutorial/) Tutorial: coming soon on [GitBook](https://xoops.gitbook.io/modulebuilder-tutorial/).
To contribute to the Tutorial, [fork it on GitHub](https://github.com/XoopsDocs/modulebuilder-tutorial)

#### Translation:
[![Translations on Transifex](https://xoops.org/images/translations-transifex-blue.svg)](https://www.transifex.com/xoops)

Please visit us on https://xoops.org

[![Throughput Graph](https://graphs.waffle.io/txmodxoops/modulebuilder/throughput.svg)](https://waffle.io/txmodxoops/modulebuilder/metrics)
Current and upcoming "next generation" versions of XOOPS CMS are being crafted on GitHub at: https://github.com/XOOPS
2 changes: 2 additions & 0 deletions class/Devtools.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public static function function_qualifier($src_path, $dst_path, $moduleName) {
'in_array',
'ini_get',
'intval',
'include',
'is_array',
'is_bool',
'is_callable',
Expand Down Expand Up @@ -132,6 +133,7 @@ public static function function_qualifier($src_path, $dst_path, $moduleName) {
'readlink',
'redirect_header',
'rename',
'require',
'rmdir',
'round',
'scandir',
Expand Down
50 changes: 30 additions & 20 deletions class/Files/CreateArchitecture.php
Original file line number Diff line number Diff line change
Expand Up @@ -645,31 +645,41 @@ public function setFilesToBuilding($module)
}
// User Pdf File
if (\in_array(1, $tablePdf)) {
$userPdf = Modulebuilder\Files\User\UserPdf::getInstance();
$userPdf->write($module, $table, 'pdf.php');
$ret[] = $userPdf->render();
// User Templates Pdf File
if ($templateType == 'bootstrap') {
$userTemplatesPdf = Modulebuilder\Files\Templates\User\Bootstrap\Pdf::getInstance();
} else {
$userTemplatesPdf = Modulebuilder\Files\Templates\User\Defstyle\Pdf::getInstance();
foreach ($tables as $table) {
if ($table->getVar('table_pdf')) {
$tableName = $table->getVar('table_name');
$userPdf = Modulebuilder\Files\User\UserPdf::getInstance();
$userPdf->write($module, $table, $tableName . '_pdf.php');
$ret[] = $userPdf->render();
// User Templates Pdf File
if ($templateType == 'bootstrap') {
$userTemplatesPdf = Modulebuilder\Files\Templates\User\Bootstrap\Pdf::getInstance();
} else {
$userTemplatesPdf = Modulebuilder\Files\Templates\User\Defstyle\Pdf::getInstance();
}
$userTemplatesPdf->write($module, $table, $moduleDirname . '_' . $tableName . '_pdf.tpl');
$ret[] = $userTemplatesPdf->render();
}
}
$userTemplatesPdf->write($module, $moduleDirname . '_pdf.tpl');
$ret[] = $userTemplatesPdf->render();
}
// User Print File
if (\in_array(1, $tablePrint)) {
$userPrint = Modulebuilder\Files\User\UserPrint::getInstance();
$userPrint->write($module, $table, 'print.php');
$ret[] = $userPrint->render();
// User Templates Print File
if ($templateType == 'bootstrap') {
$userTemplatesPrint = Modulebuilder\Files\Templates\User\Bootstrap\UserPrint::getInstance();
} else {
$userTemplatesPrint = Modulebuilder\Files\Templates\User\Defstyle\UserPrint::getInstance();
foreach ($tables as $table) {
if ($table->getVar('table_print')) {
$tableName = $table->getVar('table_name');
$userPrint = Modulebuilder\Files\User\UserPrint::getInstance();
$userPrint->write($module, $table, $tableName . '_print.php');
$ret[] = $userPrint->render();
// User Templates Print File
if ($templateType == 'bootstrap') {
$userTemplatesPrint = Modulebuilder\Files\Templates\User\Bootstrap\UserPrint::getInstance();
} else {
$userTemplatesPrint = Modulebuilder\Files\Templates\User\Defstyle\UserPrint::getInstance();
}
$userTemplatesPrint->write($module, $table, $moduleDirname . '_' . $tableName . '_print.tpl');
$ret[] = $userTemplatesPrint->render();
}
}
$userTemplatesPrint->write($module, $table, $moduleDirname . '_print.tpl');
$ret[] = $userTemplatesPrint->render();
}

//TODO: UserSearch has to be adapted
Expand Down
13 changes: 9 additions & 4 deletions class/Files/CreateXoopsCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -885,16 +885,17 @@ public function getXcHandlerDelete($left, $var, $obj = '', $handler = 'Handler')
* @param string $index
* @param bool $noArray
* @param string $t
* @param string $obj
* @return string
*/
public function getXcGetValues($tableName, $tableSoleName, $index = 'i', $noArray = false, $t = '')
public function getXcGetValues($tableName, $tableSoleName, $index = 'i', $noArray = false, $t = '', $obj = '')
{
$index = '' !== $index ? $index : 'i';
$ucfTableName = \ucfirst($tableName);
if (!$noArray) {
$ret = "{$t}\${$tableSoleName} = \${$tableName}All[\${$index}]->getValues{$ucfTableName}();\n";
} else {
$ret = "{$t}\${$tableSoleName} = \${$tableName}->getValues{$ucfTableName}();\n";
$ret = "{$t}\${$tableSoleName} = \${$tableName}{$obj}->getValues{$ucfTableName}();\n";
}

return $ret;
Expand Down Expand Up @@ -1576,13 +1577,17 @@ public function getXcXoopsUserUnameFromId($left, $value, $t = '')
* @param $tplString
* @param $phpRender
* @param bool $leftIsString
*
* @param string $t
* @param string $tpl
* @return string
*/
public function getXcXoopsTplAssign($tplString, $phpRender, $leftIsString = true, $t = '')
public function getXcXoopsTplAssign($tplString, $phpRender, $leftIsString = true, $t = '', $tpl = '')
{
$assign = "{$t}\$GLOBALS['xoopsTpl']->assign(";
if ('' !== $tpl) {
$assign = "{$t}\${$tpl}->assign(";
}

if (false === $leftIsString) {
$ret = $assign . "{$tplString}, {$phpRender});\n";
} else {
Expand Down
22 changes: 15 additions & 7 deletions class/Files/Language/LanguageAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,27 @@ public function write($module, $table, $tables, $filename)
*/
public function getLanguageAdminIndex($language, $tables)
{
$thereare = '';
$tableUser = 0;
foreach (\array_keys($tables) as $t) {
if (1 == (int)$tables[$t]->getVar('table_user')) {
$tableUser = 1;
}
$tableName = $tables[$t]->getVar('table_name');
$stuTableName = \mb_strtoupper($tableName);
$stlTableName = \mb_strtolower($tableName);
$thereare .= $this->ld->getDefine($language, "THEREARE_{$stuTableName}", "There are <span class='bold'>%s</span> {$stlTableName} in the database", true);
}
$ret = $this->ld->getBlankLine();
$ret .= $this->pc->getPhpCodeIncludeDir('__DIR__','common', true);
$ret .= $this->pc->getPhpCodeIncludeDir('__DIR__','main', true);
if ($tableUser) {
$ret .= $this->pc->getPhpCodeIncludeDir('__DIR__', 'main', true);
}
$ret .= $this->ld->getBlankLine();
$ret .= $this->ld->getAboveHeadDefines('Admin Index');
$ret .= $this->ld->getDefine($language, 'STATISTICS', 'Statistics');
$ret .= $this->ld->getAboveDefines('There are');
foreach (\array_keys($tables) as $t) {
$tableName = $tables[$t]->getVar('table_name');
$stuTableName = \mb_strtoupper($tableName);
$stlTableName = \mb_strtolower($tableName);
$ret .= $this->ld->getDefine($language, "THEREARE_{$stuTableName}", "There are <span class='bold'>%s</span> {$stlTableName} in the database", true);
}
$ret .= $thereare;

return $ret;
}
Expand Down
8 changes: 8 additions & 0 deletions class/Files/Language/LanguageMain.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ private function getLanguageMain($module, $language)
$tableSubmit = 0;
$tableBroken = 0;
$tableRate = 0;
$tablePrint = 0;
foreach (\array_keys($tables) as $i) {
if (1 == $tables[$i]->getVar('table_user')) {
$tableName = $tables[$i]->getVar('table_name');
Expand All @@ -133,6 +134,9 @@ private function getLanguageMain($module, $language)
if (1 === (int)$tables[$i]->getVar('table_rate')) {
$tableRate = 1;
}
if (1 === (int)$tables[$i]->getVar('table_print')) {
$tablePrint = 1;
}
$stuTableName = \mb_strtoupper($tableName);
$stuTableSoleName = \mb_strtoupper($tableSoleName);
$ucfTableName = $utility::UcFirstAndToLower($tableName);
Expand Down Expand Up @@ -197,6 +201,10 @@ private function getLanguageMain($module, $language)
$ret .= $this->ld->getDefine($language, 'RATING_DISLIKE', 'Dislike');
$ret .= $this->ld->getDefine($language, 'RATING_ERROR1', 'Error: update base table failed!');
}
if (1 === $tablePrint) {
$ret .= $this->ld->getAboveHeadDefines('Print');
$ret .= $this->ld->getDefine($language, 'PRINT', 'Print');
}
return $ret;
}

Expand Down
79 changes: 69 additions & 10 deletions class/Files/Templates/User/Defstyle/Pdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,24 @@
*/
class Pdf extends Files\CreateFile
{
/**
* @var mixed
*/
private $hc = null;

/**
* @var mixed
*/
private $sc = null;
/**
* @public function constructor
* @param null
*/
public function __construct()
{
parent::__construct();
$this->hc = Modulebuilder\Files\CreateHtmlCode::getInstance();
$this->sc = Modulebuilder\Files\CreateSmartyCode::getInstance();
}

/**
Expand All @@ -59,26 +70,68 @@ public static function getInstance()
* @public function write
*
* @param $module
* @param $table
* @param $filename
*/
public function write($module, $filename)
public function write($module, $table, $filename)
{
$this->setModule($module);
$this->setFileName($filename);
$this->setTable($table);
}

/**
* @private function getTemplatesUserPdfBody
*
* @param null
*
* @private function getTemplatesUserPagesItemPanel
* @param string $moduleDirname
* @param $tableId
* @param $tableMid
* @param $tableName
* @param $tableSoleName
* @param $language
* @return string
*/
private function getTemplatesUserPdfBody()
private function getTemplatesUserPdfBody($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $language)
{
$ret = <<<'EOT'
<div><{$pdfoutput}></div>
EOT;
$fields = $this->getTableFields($tableMid, $tableId);
$ret = '';
$content_header = $this->sc->getSmartySingleVar('content_header');
$ret .= $this->hc->getHtmlDiv($content_header, 'panel-heading', '',"\n", false);
$retElem = '';
foreach (\array_keys($fields) as $f) {
$fieldElement = $fields[$f]->getVar('field_element');
if (1 == $fields[$f]->getVar('field_user')) {
if (1 == $fields[$f]->getVar('field_tbody')) {
$fieldName = $fields[$f]->getVar('field_name');
$rpFieldName = $this->getRightString($fieldName);
$langConst = \mb_strtoupper($tableSoleName) . '_' . \mb_strtoupper($rpFieldName);
$lang = $this->sc->getSmartyConst($language, $langConst);
$retElem .= $this->hc->getHtmlDiv($lang . ': ' , 'col-sm-3',"\t", "\n", false);
switch ($fieldElement) {
default:
//case 3:
//case 4:
$doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName);
$retElem .= $this->hc->getHtmlDiv($doubleVar, 'col-sm-8', "\t", "\n", false);
break;
case 10:
$singleVar = $this->sc->getSmartySingleVar('xoops_icons32_url');
$doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName);
$img = $this->hc->getHtmlImage($singleVar . '/' . $doubleVar, (string)$tableName);
$retElem .= $this->hc->getHtmlDiv($img, 'col-sm-8', "\t", "\n", false);
unset($img);
break;
case 13:
$singleVar = $this->sc->getSmartySingleVar($moduleDirname . '_upload_url');
$doubleVar = $this->sc->getSmartyDoubleVar($tableSoleName, $rpFieldName);
$img = $this->hc->getHtmlImage($singleVar . "/images/{$tableName}/" . $doubleVar, (string)$tableName);
$retElem .= $this->hc->getHtmlDiv($img, 'col-sm-9',"\t", "\n", false);
unset($img);
break;
}
}
}
}
$ret .= $this->hc->getHtmlDiv($retElem, 'panel-body');

return $ret;
}
Expand All @@ -93,7 +146,13 @@ public function render()
$module = $this->getModule();
$filename = $this->getFileName();
$moduleDirname = $module->getVar('mod_dirname');
$content = $this->getTemplatesUserPdfBody();
$table = $this->getTable();
$language = $this->getLanguage($moduleDirname, 'MA');
$tableId = $table->getVar('table_id');
$tableMid = $table->getVar('table_mid');
$tableName = $table->getVar('table_name');
$tableSoleName = $table->getVar('table_solename');
$content = $this->getTemplatesUserPdfBody($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $language);

$this->create($moduleDirname, 'templates', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED);

Expand Down
Loading

0 comments on commit 517fde3

Please sign in to comment.