diff --git a/admin/about.php b/admin/about.php
index e58b7b9..6082e23 100644
--- a/admin/about.php
+++ b/admin/about.php
@@ -14,7 +14,7 @@
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @package
* @since
- * @author XOOPS Development Team
+ * @author XOOPS Development Team
*/
require __DIR__ . '/admin_header.php';
diff --git a/admin/admin_footer.php b/admin/admin_footer.php
index 5ba8ac5..c90968a 100644
--- a/admin/admin_footer.php
+++ b/admin/admin_footer.php
@@ -14,16 +14,11 @@
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @package
* @since
- * @author XOOPS Development Team
+ * @author XOOPS Development Team
*/
-$pathIcon32 = Xmf\Module\Admin::iconUrl('', 32);
+$pathIcon32 = Xmf\Module\Admin::iconUrl('', 32);
-echo "
';
+echo "';
xoops_cp_footer();
diff --git a/admin/admin_header.php b/admin/admin_header.php
index 89855ca..647cbf0 100644
--- a/admin/admin_header.php
+++ b/admin/admin_header.php
@@ -14,7 +14,7 @@
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @package
* @since
- * @author XOOPS Development Team
+ * @author XOOPS Development Team
*/
$path = dirname(dirname(dirname(__DIR__)));
diff --git a/admin/borrow.php b/admin/borrow.php
index 80add78..e832870 100644
--- a/admin/borrow.php
+++ b/admin/borrow.php
@@ -9,6 +9,7 @@
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
+
/**
* Module: Equipment
*
@@ -31,10 +32,9 @@
require_once __DIR__ . '/admin_header.php';
xoops_cp_header();
//It recovered the value of argument op in URL$
-$op = Request::getString('op', 'list');
-$order = Request::getString('order', 'desc');
-$sort = Request::getString('sort', '');
-
+$op = Request::getString('op', 'list');
+$order = Request::getString('order', 'desc');
+$sort = Request::getString('sort', '');
$adminObject->displayNavigation(basename(__FILE__));
/** @var Permission $permHelper */
@@ -45,7 +45,7 @@
default:
$adminObject->addItemButton(AM_EQUIPMENT_ADD_BORROW, 'borrow.php?op=new', 'add');
echo $adminObject->displayButton('left');
- $start = Request::getInt('start', 0);
+ $start = Request::getInt('start', 0);
$borrowPaginationLimit = $GLOBALS['xoopsModuleConfig']['userpager'];
$criteria = new CriteriaCompo();
@@ -53,7 +53,7 @@
$criteria->setOrder('ASC');
$criteria->setLimit($borrowPaginationLimit);
$criteria->setStart($start);
- $borrowTempRows = $borrowHandler->getCount();
+ $borrowTempRows = $borrowHandler->getCount();
$borrowTempArray = $borrowHandler->getAll($criteria);/*
//
//
@@ -66,106 +66,95 @@
if ($borrowTempRows > $borrowPaginationLimit) {
require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
- $pagenav = new XoopsPageNav($borrowTempRows, $borrowPaginationLimit, $start, 'start',
- 'op=list' . '&sort=' . $sort . '&order=' . $order
- . '');
+ $pagenav = new XoopsPageNav($borrowTempRows, $borrowPaginationLimit, $start, 'start', 'op=list' . '&sort=' . $sort . '&order=' . $order . '');
$GLOBALS['xoopsTpl']->assign('pagenav', null === $pagenav ? $pagenav->renderNav() : '');
}
$GLOBALS['xoopsTpl']->assign('borrowRows', $borrowTempRows);
- $borrowArray = array();
-
-// $fields = explode('|', id:smallint:5:unsigned:NOT NULL::primary:ID|borrower:varchar:10::NOT NULL::primary:Customer|amount:int:10:unsigned:NOT NULL:::Amount);
-// $fieldsCount = count($fields);
+ $borrowArray = array();
-$criteria = new CriteriaCompo();
+ // $fields = explode('|', id:smallint:5:unsigned:NOT NULL::primary:ID|borrower:varchar:10::NOT NULL::primary:Customer|amount:int:10:unsigned:NOT NULL:::Amount);
+ // $fieldsCount = count($fields);
-//$criteria->setOrder('DESC');
-$criteria->setSort($sort);
-$criteria->setOrder($order);
-$criteria->setLimit($borrowPaginationLimit);
-$criteria->setStart($start);
+ $criteria = new CriteriaCompo();
+ //$criteria->setOrder('DESC');
+ $criteria->setSort($sort);
+ $criteria->setOrder($order);
+ $criteria->setLimit($borrowPaginationLimit);
+ $criteria->setStart($start);
-$borrowCount = $borrowHandler->getCount($criteria);
-$borrowTempArray = $borrowHandler->getAll($criteria);
+ $borrowCount = $borrowHandler->getCount($criteria);
+ $borrowTempArray = $borrowHandler->getAll($criteria);
-// for ($i = 0; $i < $fieldsCount; ++$i) {
- if ($borrowCount > 0) {
- foreach (array_keys($borrowTempArray) as $i) {
+ // for ($i = 0; $i < $fieldsCount; ++$i) {
+ if ($borrowCount > 0) {
+ foreach (array_keys($borrowTempArray) as $i) {
-// $field = explode(':', $fields[$i]);
+ // $field = explode(':', $fields[$i]);
-$selectorid = EquipmentUtility::selectSorting(AM_EQUIPMENT_BORROW_ID, 'id');
- $GLOBALS['xoopsTpl']->assign('selectorid', $selectorid);
- $borrowArray['id'] = $borrowTempArray[$i]->getVar('id');
+ $selectorid = EquipmentUtility::selectSorting(AM_EQUIPMENT_BORROW_ID, 'id');
+ $GLOBALS['xoopsTpl']->assign('selectorid', $selectorid);
+ $borrowArray['id'] = $borrowTempArray[$i]->getVar('id');
- $selectorborrower = EquipmentUtility::selectSorting(AM_EQUIPMENT_BORROW_BORROWER, 'borrower');
- $GLOBALS['xoopsTpl']->assign('selectorborrower', $selectorborrower);
- $borrowArray['borrower'] = $borrowTempArray[$i]->getVar('borrower');
+ $selectorborrower = EquipmentUtility::selectSorting(AM_EQUIPMENT_BORROW_BORROWER, 'borrower');
+ $GLOBALS['xoopsTpl']->assign('selectorborrower', $selectorborrower);
+ $borrowArray['borrower'] = $borrowTempArray[$i]->getVar('borrower');
- $selectoramount = EquipmentUtility::selectSorting(AM_EQUIPMENT_BORROW_AMOUNT, 'amount');
- $GLOBALS['xoopsTpl']->assign('selectoramount', $selectoramount);
- $borrowArray['amount'] = $borrowTempArray[$i]->getVar('amount');
- $borrowArray['edit_delete'] =
- "
+ $selectoramount = EquipmentUtility::selectSorting(AM_EQUIPMENT_BORROW_AMOUNT, 'amount');
+ $GLOBALS['xoopsTpl']->assign('selectoramount', $selectoramount);
+ $borrowArray['amount'] = $borrowTempArray[$i]->getVar('amount');
+ $borrowArray['edit_delete'] = "
- ";
-
-
- $GLOBALS['xoopsTpl']->append_by_ref('borrowArrays', $borrowArray);
- unset($borrowArray);
- }
- unset($borrowTempArray);
- // Display Navigation
- if ($borrowCount > $borrowPaginationLimit) {
- require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
- $pagenav = new XoopsPageNav($borrowCount, $borrowPaginationLimit, $start, 'start',
- 'op=list' . '&sort=' . $sort . '&order=' . $order
- . '');
- $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4));
- }
+ ";
+ $GLOBALS['xoopsTpl']->append_by_ref('borrowArrays', $borrowArray);
+ unset($borrowArray);
+ }
+ unset($borrowTempArray);
+ // Display Navigation
+ if ($borrowCount > $borrowPaginationLimit) {
+ require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
+ $pagenav = new XoopsPageNav($borrowCount, $borrowPaginationLimit, $start, 'start', 'op=list' . '&sort=' . $sort . '&order=' . $order . '');
+ $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4));
+ }
-// echo "
+ // echo " |
-//
-//
-// | ";
+ //
+ //
+ // ";
-// echo "";
+ // echo "";
-// }
+ // }
-// echo "
";
+ // echo "
";
-// } else {
+ // } else {
-// echo "
+ // echo "
-//
+ //
- // ".AM_EQUIPMENT_FORM_ACTION."XXX |
-//
There are noXXX borrow |
";
-// echo "
";
+ // ".AM_EQUIPMENT_FORM_ACTION."XXX |
+ // There are noXXX borrow |
";
+ // echo "
";
-//-------------------------------------------
+ //-------------------------------------------
- echo $GLOBALS['xoopsTpl']->fetch(
- XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['xoopsModule']->getVar('dirname') . '/templates/admin/equipment_admin_borrow.tpl'
- );
- }
+ echo $GLOBALS['xoopsTpl']->fetch(XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['xoopsModule']->getVar('dirname') . '/templates/admin/equipment_admin_borrow.tpl');
+ }
-
- break;
+ break;
case 'new':
$adminObject->addItemButton(AM_EQUIPMENT_BORROW_LIST, 'borrow.php', 'list');
echo $adminObject->displayButton('left');
$borrowObject = $borrowHandler->create();
- $form = $borrowObject->getForm();
+ $form = $borrowObject->getForm();
$form->display();
break;
@@ -178,7 +167,7 @@
} else {
$borrowObject = $borrowHandler->create();
}
-// Form save fields
+ // Form save fields
$borrowObject->setVar('borrower', Request::getVar('borrower', ''));
$borrowObject->setVar('amount', Request::getVar('amount', ''));
if ($borrowHandler->insert($borrowObject)) {
@@ -188,16 +177,16 @@
echo $borrowObject->getHtmlErrors();
$form = $borrowObject->getForm();
$form->display();
- break;
+ break;
case 'edit':
$adminObject->addItemButton(AM_EQUIPMENT_ADD_BORROW, 'borrow.php?op=new', 'add');
$adminObject->addItemButton(AM_EQUIPMENT_BORROW_LIST, 'borrow.php', 'list');
echo $adminObject->displayButton('left');
$borrowObject = $borrowHandler->get(Request::getString('id', ''));
- $form = $borrowObject->getForm();
+ $form = $borrowObject->getForm();
$form->display();
- break;
+ break;
case 'delete':
$borrowObject = $borrowHandler->get(Request::getString('id', ''));
@@ -213,7 +202,7 @@
} else {
xoops_confirm(array('ok' => 1, 'id' => Request::getString('id', ''), 'op' => 'delete'), Request::getCmd('REQUEST_URI', '', 'SERVER'), sprintf(AM_EQUIPMENT_FORMSUREDEL, $borrowObject->getVar('borrower')));
}
- break;
+ break;
case 'clone':
@@ -225,6 +214,6 @@
redirect_header('borrow.php', 3, AM_EQUIPMENT_CLONED_FAILED);
}
- break;
+ break;
}
require_once __DIR__ . '/admin_footer.php';
diff --git a/admin/desc.php b/admin/desc.php
index 579e4a8..bb7ad44 100644
--- a/admin/desc.php
+++ b/admin/desc.php
@@ -9,6 +9,7 @@
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
+
/**
* Module: Equipment
*
@@ -31,10 +32,9 @@
require_once __DIR__ . '/admin_header.php';
xoops_cp_header();
//It recovered the value of argument op in URL$
-$op = Request::getString('op', 'list');
-$order = Request::getString('order', 'desc');
-$sort = Request::getString('sort', '');
-
+$op = Request::getString('op', 'list');
+$order = Request::getString('order', 'desc');
+$sort = Request::getString('sort', '');
$adminObject->displayNavigation(basename(__FILE__));
/** @var Permission $permHelper */
@@ -45,7 +45,7 @@
default:
$adminObject->addItemButton(AM_EQUIPMENT_ADD_DESC, 'desc.php?op=new', 'add');
echo $adminObject->displayButton('left');
- $start = Request::getInt('start', 0);
+ $start = Request::getInt('start', 0);
$descPaginationLimit = $GLOBALS['xoopsModuleConfig']['userpager'];
$criteria = new CriteriaCompo();
@@ -53,7 +53,7 @@
$criteria->setOrder('ASC');
$criteria->setLimit($descPaginationLimit);
$criteria->setStart($start);
- $descTempRows = $descHandler->getCount();
+ $descTempRows = $descHandler->getCount();
$descTempArray = $descHandler->getAll($criteria);/*
//
//
@@ -66,118 +66,107 @@
if ($descTempRows > $descPaginationLimit) {
require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
- $pagenav = new XoopsPageNav($descTempRows, $descPaginationLimit, $start, 'start',
- 'op=list' . '&sort=' . $sort . '&order=' . $order
- . '');
+ $pagenav = new XoopsPageNav($descTempRows, $descPaginationLimit, $start, 'start', 'op=list' . '&sort=' . $sort . '&order=' . $order . '');
$GLOBALS['xoopsTpl']->assign('pagenav', null === $pagenav ? $pagenav->renderNav() : '');
}
$GLOBALS['xoopsTpl']->assign('descRows', $descTempRows);
- $descArray = array();
-
-// $fields = explode('|', id:smallint:5:unsigned:NOT NULL::primary:ID|owner:varchar:10::NOT NULL::index:Owner|name:varchar:30::NOT NULL::index:Name|amount:int:10:unsigned:NOT NULL:::Amount|total:int:10:unsigned:NOT NULL:::Total|image_b64:mediumtext:0::NOT NULL:::Image);
-// $fieldsCount = count($fields);
+ $descArray = array();
-$criteria = new CriteriaCompo();
+ // $fields = explode('|', id:smallint:5:unsigned:NOT NULL::primary:ID|owner:varchar:10::NOT NULL::index:Owner|name:varchar:30::NOT NULL::index:Name|amount:int:10:unsigned:NOT NULL:::Amount|total:int:10:unsigned:NOT NULL:::Total|image_b64:mediumtext:0::NOT NULL:::Image);
+ // $fieldsCount = count($fields);
-//$criteria->setOrder('DESC');
-$criteria->setSort($sort);
-$criteria->setOrder($order);
-$criteria->setLimit($descPaginationLimit);
-$criteria->setStart($start);
+ $criteria = new CriteriaCompo();
+ //$criteria->setOrder('DESC');
+ $criteria->setSort($sort);
+ $criteria->setOrder($order);
+ $criteria->setLimit($descPaginationLimit);
+ $criteria->setStart($start);
-$descCount = $descHandler->getCount($criteria);
-$descTempArray = $descHandler->getAll($criteria);
+ $descCount = $descHandler->getCount($criteria);
+ $descTempArray = $descHandler->getAll($criteria);
-// for ($i = 0; $i < $fieldsCount; ++$i) {
- if ($descCount > 0) {
- foreach (array_keys($descTempArray) as $i) {
+ // for ($i = 0; $i < $fieldsCount; ++$i) {
+ if ($descCount > 0) {
+ foreach (array_keys($descTempArray) as $i) {
-// $field = explode(':', $fields[$i]);
+ // $field = explode(':', $fields[$i]);
-$selectorid = EquipmentUtility::selectSorting(AM_EQUIPMENT_DESC_ID, 'id');
- $GLOBALS['xoopsTpl']->assign('selectorid', $selectorid);
- $descArray['id'] = $descTempArray[$i]->getVar('id');
+ $selectorid = EquipmentUtility::selectSorting(AM_EQUIPMENT_DESC_ID, 'id');
+ $GLOBALS['xoopsTpl']->assign('selectorid', $selectorid);
+ $descArray['id'] = $descTempArray[$i]->getVar('id');
- $selectorowner = EquipmentUtility::selectSorting(AM_EQUIPMENT_DESC_OWNER, 'owner');
- $GLOBALS['xoopsTpl']->assign('selectorowner', $selectorowner);
- $descArray['owner'] = $descTempArray[$i]->getVar('owner');
+ $selectorowner = EquipmentUtility::selectSorting(AM_EQUIPMENT_DESC_OWNER, 'owner');
+ $GLOBALS['xoopsTpl']->assign('selectorowner', $selectorowner);
+ $descArray['owner'] = $descTempArray[$i]->getVar('owner');
- $selectorname = EquipmentUtility::selectSorting(AM_EQUIPMENT_DESC_NAME, 'name');
- $GLOBALS['xoopsTpl']->assign('selectorname', $selectorname);
- $descArray['name'] = $descTempArray[$i]->getVar('name');
+ $selectorname = EquipmentUtility::selectSorting(AM_EQUIPMENT_DESC_NAME, 'name');
+ $GLOBALS['xoopsTpl']->assign('selectorname', $selectorname);
+ $descArray['name'] = $descTempArray[$i]->getVar('name');
- $selectoramount = EquipmentUtility::selectSorting(AM_EQUIPMENT_DESC_AMOUNT, 'amount');
- $GLOBALS['xoopsTpl']->assign('selectoramount', $selectoramount);
- $descArray['amount'] = $descTempArray[$i]->getVar('amount');
+ $selectoramount = EquipmentUtility::selectSorting(AM_EQUIPMENT_DESC_AMOUNT, 'amount');
+ $GLOBALS['xoopsTpl']->assign('selectoramount', $selectoramount);
+ $descArray['amount'] = $descTempArray[$i]->getVar('amount');
- $selectortotal = EquipmentUtility::selectSorting(AM_EQUIPMENT_DESC_TOTAL, 'total');
- $GLOBALS['xoopsTpl']->assign('selectortotal', $selectortotal);
- $descArray['total'] = $descTempArray[$i]->getVar('total');
+ $selectortotal = EquipmentUtility::selectSorting(AM_EQUIPMENT_DESC_TOTAL, 'total');
+ $GLOBALS['xoopsTpl']->assign('selectortotal', $selectortotal);
+ $descArray['total'] = $descTempArray[$i]->getVar('total');
- $selectorimage_b64 = EquipmentUtility::selectSorting(AM_EQUIPMENT_DESC_IMAGE_B64, 'image_b64');
- $GLOBALS['xoopsTpl']->assign('selectorimage_b64', $selectorimage_b64);
- $descArray['image_b64'] = $descTempArray[$i]->getVar('image_b64');
- $descArray['edit_delete'] =
- "
+ $selectorimage_b64 = EquipmentUtility::selectSorting(AM_EQUIPMENT_DESC_IMAGE_B64, 'image_b64');
+ $GLOBALS['xoopsTpl']->assign('selectorimage_b64', $selectorimage_b64);
+ $descArray['image_b64'] = $descTempArray[$i]->getVar('image_b64');
+ $descArray['edit_delete'] = "
- ";
-
-
- $GLOBALS['xoopsTpl']->append_by_ref('descArrays', $descArray);
- unset($descArray);
- }
- unset($descTempArray);
- // Display Navigation
- if ($descCount > $descPaginationLimit) {
- require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
- $pagenav = new XoopsPageNav($descCount, $descPaginationLimit, $start, 'start',
- 'op=list' . '&sort=' . $sort . '&order=' . $order
- . '');
- $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4));
- }
+ ";
+ $GLOBALS['xoopsTpl']->append_by_ref('descArrays', $descArray);
+ unset($descArray);
+ }
+ unset($descTempArray);
+ // Display Navigation
+ if ($descCount > $descPaginationLimit) {
+ require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
+ $pagenav = new XoopsPageNav($descCount, $descPaginationLimit, $start, 'start', 'op=list' . '&sort=' . $sort . '&order=' . $order . '');
+ $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4));
+ }
-// echo "
+ // echo " |
-//
-//
-// | ";
+ //
+ //
+ // ";
-// echo "";
+ // echo "";
-// }
+ // }
-// echo "
";
+ // echo "
";
-// } else {
+ // } else {
-// echo "
+ // echo "
-//
+ //
- // ".AM_EQUIPMENT_FORM_ACTION."XXX |
-//
There are noXXX desc |
";
-// echo "
";
+ // ".AM_EQUIPMENT_FORM_ACTION."XXX |
+ // There are noXXX desc |
";
+ // echo "
";
-//-------------------------------------------
+ //-------------------------------------------
- echo $GLOBALS['xoopsTpl']->fetch(
- XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['xoopsModule']->getVar('dirname') . '/templates/admin/equipment_admin_desc.tpl'
- );
- }
+ echo $GLOBALS['xoopsTpl']->fetch(XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['xoopsModule']->getVar('dirname') . '/templates/admin/equipment_admin_desc.tpl');
+ }
-
- break;
+ break;
case 'new':
$adminObject->addItemButton(AM_EQUIPMENT_DESC_LIST, 'desc.php', 'list');
echo $adminObject->displayButton('left');
$descObject = $descHandler->create();
- $form = $descObject->getForm();
+ $form = $descObject->getForm();
$form->display();
break;
@@ -190,21 +179,20 @@
} else {
$descObject = $descHandler->create();
}
-// Form save fields
+ // Form save fields
$descObject->setVar('owner', Request::getVar('owner', ''));
$descObject->setVar('name', Request::getVar('name', ''));
$descObject->setVar('amount', Request::getVar('amount', ''));
$descObject->setVar('total', Request::getVar('total', ''));
- require_once XOOPS_ROOT_PATH.'/class/uploader.php';
- $uploadDir = XOOPS_UPLOAD_PATH.'/equipment/images/';
- $uploader = new XoopsMediaUploader($uploadDir, xoops_getModuleOption('mimetypes', 'equipment'),
- xoops_getModuleOption('maxsize', 'equipment'), null, null);
+ require_once XOOPS_ROOT_PATH . '/class/uploader.php';
+ $uploadDir = XOOPS_UPLOAD_PATH . '/equipment/images/';
+ $uploader = new XoopsMediaUploader($uploadDir, xoops_getModuleOption('mimetypes', 'equipment'), xoops_getModuleOption('maxsize', 'equipment'), null, null);
if ($uploader->fetchMedia(Request::getArray('xoops_upload_file', '', 'POST')[0])) {
-
+
//$extension = preg_replace( '/^.+\.([^.]+)$/sU' , '' , $_FILES['attachedfile']['name']);
//$imgName = str_replace(' ', '', $_POST['']).'.'.$extension;
-
+
$uploader->setPrefix('image_b64_');
$uploader->fetchMedia(Request::getArray('xoops_upload_file', '', 'POST')[0]);
if (!$uploader->upload()) {
@@ -216,14 +204,14 @@
} else {
$descObject->setVar('image_b64', Request::getVar('image_b64', ''));
}
-
- //Permissions
-//===============================================================
- $mid = $GLOBALS['xoopsModule']->mid();
- /** @var XoopsGroupPermHandler $gpermHandler */
- $gpermHandler = xoops_getHandler('groupperm');
- $id = Request::getInt('id', 0);
+ //Permissions
+ //===============================================================
+
+ $mid = $GLOBALS['xoopsModule']->mid();
+ /** @var XoopsGroupPermHandler $gpermHandler */
+ $gpermHandler = xoops_getHandler('groupperm');
+ $id = Request::getInt('id', 0);
/**
* @param $myArray
@@ -233,110 +221,108 @@
* @param $permissionName
* @param $mid
*/
- function setPermissions($myArray, $permissionGroup, $id, $gpermHandler, $permissionName, $mid)
- {
- $permissionArray = $myArray;
- if ($id > 0) {
- $sql = 'DELETE FROM `' . $GLOBALS['xoopsDB']->prefix('group_permission') . "` WHERE `gperm_name` = '" . $permissionName
- . "' AND `gperm_itemid`= $id;";
- $GLOBALS['xoopsDB']->query($sql);
- }
- //admin
- $gperm = $gpermHandler->create();
- $gperm->setVar('gperm_groupid', XOOPS_GROUP_ADMIN);
- $gperm->setVar('gperm_name', $permissionName);
- $gperm->setVar('gperm_modid', $mid);
- $gperm->setVar('gperm_itemid', $id);
- $gpermHandler->insert($gperm);
- unset($gperm);
- //non-Admin groups
- if (is_array($permissionArray)) {
- foreach ($permissionArray as $key => $cat_groupperm) {
- if ($cat_groupperm > 0) {
- $gperm = $gpermHandler->create();
- $gperm->setVar('gperm_groupid', $cat_groupperm);
- $gperm->setVar('gperm_name', $permissionName);
- $gperm->setVar('gperm_modid', $mid);
- $gperm->setVar('gperm_itemid', $id);
- $gpermHandler->insert($gperm);
- unset($gperm);
- }
- }
- } elseif ($permissionArray > 0) {
- $gperm = $gpermHandler->create();
- $gperm->setVar('gperm_groupid', $permissionArray);
- $gperm->setVar('gperm_name', $permissionName);
- $gperm->setVar('gperm_modid', $mid);
- $gperm->setVar('gperm_itemid', $id);
- $gpermHandler->insert($gperm);
- unset($gperm);
- }
- }
-
- //setPermissions for View items
- $permissionGroup = 'groupsRead';
- $permissionName = 'equipment_view';
- $permissionArray = Request::getArray($permissionGroup, '');
- $permissionArray[] = XOOPS_GROUP_ADMIN;
- //setPermissions($permissionArray, $permissionGroup, $id, $gpermHandler, $permissionName, $mid);
- $permHelper->savePermissionForItem($permissionName, $id, $permissionArray);
-
-
- //setPermissions for Submit items
- $permissionGroup = 'groupsSubmit';
- $permissionName = 'equipment_submit';
- $permissionArray = Request::getArray($permissionGroup, '');
- $permissionArray[] = XOOPS_GROUP_ADMIN;
- //setPermissions($permissionArray, $permissionGroup, $id, $gpermHandler, $permissionName, $mid);
- $permHelper->savePermissionForItem($permissionName, $id, $permissionArray);
-
- //setPermissions for Approve items
- $permissionGroup = 'groupsModeration';
- $permissionName = 'equipment_approve';
- $permissionArray = Request::getArray($permissionGroup, '');
- $permissionArray[] = XOOPS_GROUP_ADMIN;
- //setPermissions($permissionArray, $permissionGroup, $id, $gpermHandler, $permissionName, $mid);
- $permHelper->savePermissionForItem($permissionName, $id, $permissionArray);
-
-/*
- //Form equipment_view
- $arr_equipment_view = Request::getArray('cat_gperms_read');
+ function setPermissions($myArray, $permissionGroup, $id, $gpermHandler, $permissionName, $mid)
+ {
+ $permissionArray = $myArray;
if ($id > 0) {
- $sql
- =
- 'DELETE FROM `' . $GLOBALS['xoopsDB']->prefix('group_permission') . "` WHERE `gperm_name`='equipment_view' AND `gperm_itemid`=$id;";
+ $sql = 'DELETE FROM `' . $GLOBALS['xoopsDB']->prefix('group_permission') . "` WHERE `gperm_name` = '" . $permissionName . "' AND `gperm_itemid`= $id;";
$GLOBALS['xoopsDB']->query($sql);
}
//admin
$gperm = $gpermHandler->create();
$gperm->setVar('gperm_groupid', XOOPS_GROUP_ADMIN);
- $gperm->setVar('gperm_name', 'equipment_view');
+ $gperm->setVar('gperm_name', $permissionName);
$gperm->setVar('gperm_modid', $mid);
$gperm->setVar('gperm_itemid', $id);
$gpermHandler->insert($gperm);
unset($gperm);
- if (is_array($arr_equipment_view)) {
- foreach ($arr_equipment_view as $key => $cat_groupperm) {
- $gperm = $gpermHandler->create();
- $gperm->setVar('gperm_groupid', $cat_groupperm);
- $gperm->setVar('gperm_name', 'equipment_view');
- $gperm->setVar('gperm_modid', $mid);
- $gperm->setVar('gperm_itemid', $id);
- $gpermHandler->insert($gperm);
- unset($gperm);
+ //non-Admin groups
+ if (is_array($permissionArray)) {
+ foreach ($permissionArray as $key => $cat_groupperm) {
+ if ($cat_groupperm > 0) {
+ $gperm = $gpermHandler->create();
+ $gperm->setVar('gperm_groupid', $cat_groupperm);
+ $gperm->setVar('gperm_name', $permissionName);
+ $gperm->setVar('gperm_modid', $mid);
+ $gperm->setVar('gperm_itemid', $id);
+ $gpermHandler->insert($gperm);
+ unset($gperm);
+ }
}
- } else {
+ } elseif ($permissionArray > 0) {
$gperm = $gpermHandler->create();
- $gperm->setVar('gperm_groupid', $arr_equipment_view);
- $gperm->setVar('gperm_name', 'equipment_view');
+ $gperm->setVar('gperm_groupid', $permissionArray);
+ $gperm->setVar('gperm_name', $permissionName);
$gperm->setVar('gperm_modid', $mid);
$gperm->setVar('gperm_itemid', $id);
$gpermHandler->insert($gperm);
unset($gperm);
}
-*/
+ }
+
+ //setPermissions for View items
+ $permissionGroup = 'groupsRead';
+ $permissionName = 'equipment_view';
+ $permissionArray = Request::getArray($permissionGroup, '');
+ $permissionArray[] = XOOPS_GROUP_ADMIN;
+ //setPermissions($permissionArray, $permissionGroup, $id, $gpermHandler, $permissionName, $mid);
+ $permHelper->savePermissionForItem($permissionName, $id, $permissionArray);
+
+ //setPermissions for Submit items
+ $permissionGroup = 'groupsSubmit';
+ $permissionName = 'equipment_submit';
+ $permissionArray = Request::getArray($permissionGroup, '');
+ $permissionArray[] = XOOPS_GROUP_ADMIN;
+ //setPermissions($permissionArray, $permissionGroup, $id, $gpermHandler, $permissionName, $mid);
+ $permHelper->savePermissionForItem($permissionName, $id, $permissionArray);
+
+ //setPermissions for Approve items
+ $permissionGroup = 'groupsModeration';
+ $permissionName = 'equipment_approve';
+ $permissionArray = Request::getArray($permissionGroup, '');
+ $permissionArray[] = XOOPS_GROUP_ADMIN;
+ //setPermissions($permissionArray, $permissionGroup, $id, $gpermHandler, $permissionName, $mid);
+ $permHelper->savePermissionForItem($permissionName, $id, $permissionArray);
+
+ /*
+ //Form equipment_view
+ $arr_equipment_view = Request::getArray('cat_gperms_read');
+ if ($id > 0) {
+ $sql
+ =
+ 'DELETE FROM `' . $GLOBALS['xoopsDB']->prefix('group_permission') . "` WHERE `gperm_name`='equipment_view' AND `gperm_itemid`=$id;";
+ $GLOBALS['xoopsDB']->query($sql);
+ }
+ //admin
+ $gperm = $gpermHandler->create();
+ $gperm->setVar('gperm_groupid', XOOPS_GROUP_ADMIN);
+ $gperm->setVar('gperm_name', 'equipment_view');
+ $gperm->setVar('gperm_modid', $mid);
+ $gperm->setVar('gperm_itemid', $id);
+ $gpermHandler->insert($gperm);
+ unset($gperm);
+ if (is_array($arr_equipment_view)) {
+ foreach ($arr_equipment_view as $key => $cat_groupperm) {
+ $gperm = $gpermHandler->create();
+ $gperm->setVar('gperm_groupid', $cat_groupperm);
+ $gperm->setVar('gperm_name', 'equipment_view');
+ $gperm->setVar('gperm_modid', $mid);
+ $gperm->setVar('gperm_itemid', $id);
+ $gpermHandler->insert($gperm);
+ unset($gperm);
+ }
+ } else {
+ $gperm = $gpermHandler->create();
+ $gperm->setVar('gperm_groupid', $arr_equipment_view);
+ $gperm->setVar('gperm_name', 'equipment_view');
+ $gperm->setVar('gperm_modid', $mid);
+ $gperm->setVar('gperm_itemid', $id);
+ $gpermHandler->insert($gperm);
+ unset($gperm);
+ }
+ */
-//===============================================================
+ //===============================================================
if ($descHandler->insert($descObject)) {
redirect_header('desc.php?op=list', 2, AM_EQUIPMENT_FORMOK);
@@ -345,16 +331,16 @@ function setPermissions($myArray, $permissionGroup, $id, $gpermHandler, $permiss
echo $descObject->getHtmlErrors();
$form = $descObject->getForm();
$form->display();
- break;
+ break;
case 'edit':
$adminObject->addItemButton(AM_EQUIPMENT_ADD_DESC, 'desc.php?op=new', 'add');
$adminObject->addItemButton(AM_EQUIPMENT_DESC_LIST, 'desc.php', 'list');
echo $adminObject->displayButton('left');
$descObject = $descHandler->get(Request::getString('id', ''));
- $form = $descObject->getForm();
+ $form = $descObject->getForm();
$form->display();
- break;
+ break;
case 'delete':
$descObject = $descHandler->get(Request::getString('id', ''));
@@ -370,7 +356,7 @@ function setPermissions($myArray, $permissionGroup, $id, $gpermHandler, $permiss
} else {
xoops_confirm(array('ok' => 1, 'id' => Request::getString('id', ''), 'op' => 'delete'), Request::getCmd('REQUEST_URI', '', 'SERVER'), sprintf(AM_EQUIPMENT_FORMSUREDEL, $descObject->getVar('id')));
}
- break;
+ break;
case 'clone':
@@ -382,6 +368,6 @@ function setPermissions($myArray, $permissionGroup, $id, $gpermHandler, $permiss
redirect_header('desc.php', 3, AM_EQUIPMENT_CLONED_FAILED);
}
- break;
+ break;
}
require_once __DIR__ . '/admin_footer.php';
diff --git a/admin/index.php b/admin/index.php
index 8f9e2dc..b56258d 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -14,7 +14,7 @@
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @package
* @since
- * @author XOOPS Development Team
+ * @author XOOPS Development Team
*/
require_once __DIR__ . '/admin_header.php';
diff --git a/admin/menu.php b/admin/menu.php
index 38e7b41..bfdccf8 100644
--- a/admin/menu.php
+++ b/admin/menu.php
@@ -1,6 +1,6 @@
loadLanguage('modinfo');
$moduleHelper->loadLanguage('main');
-
$adminmenu = [
[
'title' => _MI_EQUIPMENT_MENU0,
@@ -53,13 +52,13 @@
],
[
'title' => MI_EQUIPMENT_ADMENU6,
- 'link' => 'admin/borrow.php',
+ 'link' => 'admin/borrow.php',
'desc' => MI_EQUIPMENT_ADMENU6_DESC,
'icon' => $pathIcon32 . '/user-icon.png'
],
[
'title' => MI_EQUIPMENT_ADMENU7,
- 'link' => 'admin/permissions.php',
+ 'link' => 'admin/permissions.php',
'desc' => MI_EQUIPMENT_ADMENU7_DESC,
'icon' => $pathIcon32 . '/permissions.png'
],
diff --git a/admin/permissions.php b/admin/permissions.php
index 27cfbf2..f18e93d 100644
--- a/admin/permissions.php
+++ b/admin/permissions.php
@@ -9,6 +9,7 @@
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
+
/**
* Module: Equipment
*
@@ -20,14 +21,15 @@
* @link https://xoops.org/
* @since 1.0.0
*/
+
use Xmf\Module\Admin;
use Xmf\Request;
require_once __DIR__ . '/admin_header.php';
xoops_cp_header();
-require_once XOOPS_ROOT_PATH.'/class/xoopsform/grouppermform.php';
+require_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php';
if ('' != Request::getString('submit', '')) {
- redirect_header(XOOPS_URL.'/modules/'.$GLOBALS['xoopsModule']->dirname().'/admin/permissions.php', 1, AM_EQUIPMENT_PERMISSIONS__GPERMUPDATED);
+ redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['xoopsModule']->dirname() . '/admin/permissions.php', 1, AM_EQUIPMENT_PERMISSIONS__GPERMUPDATED);
}
// Check admin have access to this page
/*$group = $GLOBALS['xoopsUser']->getGroups ();
@@ -37,9 +39,9 @@
}*/
$adminObject->displayNavigation(basename(__FILE__));
-$permission = Request::getInt('permission', 1, 'POST');
-$selected = array('', '', '', '');
-$selected[$permission-1] = ' selected';
+$permission = Request::getInt('permission', 1, 'POST');
+$selected = array('', '', '', '');
+$selected[$permission - 1] = ' selected';
echo "