Skip to content

Commit

Permalink
Merge pull request #30 from ggoffy/master
Browse files Browse the repository at this point in the history
implementation of rating system and new xoops_confirm/code cosmetics
  • Loading branch information
ggoffy authored Jun 9, 2020
2 parents 11d4efc + efb8df6 commit ba8357b
Show file tree
Hide file tree
Showing 91 changed files with 1,522 additions and 520 deletions.
4 changes: 0 additions & 4 deletions _TODO.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,8 @@ I moved files, where I do not know whether they are still needed into folder _ar

TODOs:

new xoops_confirm


rate.php:
this file currently is not rating



Permissions:
Expand Down
144 changes: 0 additions & 144 deletions admin/addfiles.php

This file was deleted.

14 changes: 1 addition & 13 deletions admin/fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,19 +221,7 @@
exit;
break;
case 'delete':
$tablesObj = $helper->getHandler('Tables')->get($fieldTid);
if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) {
if (!$GLOBALS['xoopsSecurity']->check()) {
redirect_header('fields.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
}
if ($helper->getHandler('Tables')->delete($tablesObj)) {
redirect_header('fields.php', 3, _AM_MODULEBUILDER_FORMDELOK);
} else {
echo $tablesObj->getHtmlErrors();
}
} else {
xoops_confirm(['ok' => 1, 'field_tid' => $fieldTid, 'op' => 'delete'], \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), sprintf(_AM_MODULEBUILDER_FORMSUREDEL, $tablesObj->getVar('table_name')));
}
//delete is not needed as deletion is done by deleting whole table
break;
case 'display':
$fieldsArray = ['parent', 'inlist', 'inform', 'admin', 'user', 'block', 'main', 'search', 'required'];
Expand Down
9 changes: 5 additions & 4 deletions admin/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,11 @@
$GLOBALS['xoopsTpl']->assign('error', $modulesObj->getHtmlErrors());
}
} else {
$xoopsconfirm = new \XoopsModules\Modulebuilder\Common\XoopsConfirm();
$xoopsconfirm->hiddens = ['ok' => 1, 'mod_id' => $modId, 'op' => 'delete'];
$xoopsconfirm->action = \Xmf\Request::getString('REQUEST_URI', '', 'SERVER');
$xoopsconfirm->object = $modulesObj->getVar('mod_name');
$xoopsconfirm = new \XoopsModules\Modulebuilder\Common\XoopsConfirm(
['ok' => 1, 'mod_id' => $modId, 'op' => 'delete'],
\Xmf\Request::getString('REQUEST_URI', '', 'SERVER'),
$modulesObj->getVar('mod_name')
);
$form = $xoopsconfirm->getFormXoopsConfirm();
$GLOBALS['xoopsTpl']->assign('form', $form->render());
}
Expand Down
10 changes: 7 additions & 3 deletions admin/morefiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@
$GLOBALS['xoopsTpl']->assign('form', $form->render());
break;
case 'edit':
// Define main template
// $templateMain = 'modulebuilder_morefiles.tpl';
$GLOBALS['xoTheme']->addScript('modules/modulebuilder/assets/js/functions.js');
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('morefiles.php'));
$adminObject->addItemButton(_AM_MODULEBUILDER_MODULES_ADD, 'morefiles.php?op=new', 'add');
Expand All @@ -134,7 +132,13 @@
$GLOBALS['xoopsTpl']->assign('error', $morefilesObj->getHtmlErrors());
}
} else {
xoops_confirm(['ok' => 1, 'file_id' => $fileId, 'op' => 'delete'], \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), sprintf(_AM_MODULEBUILDER_FORM_SURE_DELETE, $morefilesObj->getVar('file_name')));
$xoopsconfirm = new \XoopsModules\Modulebuilder\Common\XoopsConfirm(
['ok' => 1, 'file_id' => $fileId, 'op' => 'delete'],
\Xmf\Request::getString('REQUEST_URI', '', 'SERVER'),
$morefilesObj->getVar('file_name')
);
$form = $xoopsconfirm->getFormXoopsConfirm();
$GLOBALS['xoopsTpl']->assign('form', $form->render());
}
break;
}
Expand Down
8 changes: 7 additions & 1 deletion admin/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,13 @@
$GLOBALS['xoopsTpl']->assign('error', $settingsObj->getHtmlErrors());
}
} else {
xoops_confirm(['ok' => 1, 'set_id' => $setId, 'op' => 'delete'], \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), sprintf(_AM_MODULEBUILDER_FORMSUREDEL, $settingsObj->getVar('set_name')));
$xoopsconfirm = new \XoopsModules\Modulebuilder\Common\XoopsConfirm(
['ok' => 1, 'set_id' => $setId, 'op' => 'delete'],
\Xmf\Request::getString('REQUEST_URI', '', 'SERVER'),
$settingsObj->getVar('set_name')
);
$form = $xoopsconfirm->getFormXoopsConfirm();
$GLOBALS['xoopsTpl']->assign('form', $form->render());
}
break;
case 'display':
Expand Down
8 changes: 7 additions & 1 deletion admin/tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,13 @@
$GLOBALS['xoopsTpl']->assign('error', $tablesObj->getHtmlErrors());
}
} else {
xoops_confirm(['ok' => 1, 'table_id' => $tableId, 'op' => 'delete'], \Xmf\Request::getString('REQUEST_URI', '', 'SERVER'), sprintf(_AM_MODULEBUILDER_FORMSUREDEL, $tablesObj->getVar('table_name')));
$xoopsconfirm = new \XoopsModules\Modulebuilder\Common\XoopsConfirm(
['ok' => 1, 'table_id' => $tableId, 'op' => 'delete'],
\Xmf\Request::getString('REQUEST_URI', '', 'SERVER'),
$tablesObj->getVar('table_name')
);
$form = $xoopsconfirm->getFormXoopsConfirm();
$GLOBALS['xoopsTpl']->assign('form', $form->render());
}
break;
case 'display':
Expand Down
35 changes: 13 additions & 22 deletions class/Common/XoopsConfirm.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,37 +30,28 @@
/**
* Class Object XoopsConfirm
*/
class XoopsConfirm extends \XoopsObject
class XoopsConfirm
{
public $hiddens = [];
public $action = '';
public $title = '';
public $label = '';
public $object = '';
private $hiddens = [];
private $action = '';
private $title = '';
private $label = '';
private $object = '';

/**
* @public function constructor class
*
* @param null
*/
public function __construct()
public function __construct($hiddens, $action, $object, $title = '', $label = '')
{
$this->hiddens = $hiddens;
$this->action = $action;
$this->object = $object;
$this->title = $title;
$this->label = $label;
}

/**
* @static function &getInstance
*
* @param null
*/
public static function getInstance()
{
static $instance = false;
if (!$instance) {
$instance = new self();
}
}


/**
* @public function getXoopsConfirm
* @param bool $action
Expand All @@ -85,7 +76,7 @@ public function getFormXoopsConfirm()
}

xoops_load('XoopsFormLoader');
$form = new \XoopsThemeForm($this->title, 'form', $this->action, 'post', true);
$form = new \XoopsThemeForm($this->title, 'formXoopsConfirm', $this->action, 'post', true);
$form->setExtra('enctype="multipart/form-data"');
$form->addElement(new \XoopsFormLabel($this->label, $this->object));
//hiddens
Expand Down
10 changes: 6 additions & 4 deletions class/Files/Blocks/BlocksFiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@
*/
class BlocksFiles extends Files\CreateFile
{
/**
* @var mixed
*/
private $axc = null;

/**
* @var mixed
Expand Down Expand Up @@ -147,6 +143,12 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $fie
$critStatus .= $this->xc->getXcCriteriaAdd($critName, $crit, "\t\t\t");
}

$case1 = [];
$case2 = [];
$case3 = [];
$case4 = [];
$case5 = [];

$case1[] = $this->pc->getPhpCodeCommentLine("For the block: {$tableName} last",'',"\t\t\t");
if ('' !== $fieldStatus) {
$case1[] = $critStatus;
Expand Down
Loading

0 comments on commit ba8357b

Please sign in to comment.