Skip to content

Commit

Permalink
Use Null Comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
mambax7 committed Jul 17, 2017
1 parent 1d9a0c8 commit c85383e
Show file tree
Hide file tree
Showing 28 changed files with 430 additions and 456 deletions.
2 changes: 1 addition & 1 deletion admin/about.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
11 changes: 3 additions & 8 deletions admin/admin_footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<div class='adminfooter'>\n"
." <div style='text-align: center;'>\n"
." <a href='http://www.xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n"
." </div>\n"
.' ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n"
.'</div>';
echo "<div class='adminfooter'>\n" . " <div style='text-align: center;'>\n" . " <a href='http://www.xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n" . " </div>\n" . ' ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" . '</div>';

xoops_cp_footer();
2 changes: 1 addition & 1 deletion admin/admin_header.php
Original file line number Diff line number Diff line change
Expand Up @@ -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__)));
Expand Down
145 changes: 67 additions & 78 deletions admin/borrow.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/

/**
* Module: Equipment
*
Expand All @@ -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 */
Expand All @@ -45,15 +45,15 @@
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();
$criteria->setSort('id ASC, borrower');
$criteria->setOrder('ASC');
$criteria->setLimit($borrowPaginationLimit);
$criteria->setStart($start);
$borrowTempRows = $borrowHandler->getCount();
$borrowTempRows = $borrowHandler->getCount();
$borrowTempArray = $borrowHandler->getAll($criteria);/*
//
//
Expand All @@ -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'] =
"<a href='borrow.php?op=edit&id=" . $i . "'><img src=" . $pathIcon16 . "/edit.png alt='" . _EDIT . "' title='" . _EDIT . "'></a>
$selectoramount = EquipmentUtility::selectSorting(AM_EQUIPMENT_BORROW_AMOUNT, 'amount');
$GLOBALS['xoopsTpl']->assign('selectoramount', $selectoramount);
$borrowArray['amount'] = $borrowTempArray[$i]->getVar('amount');
$borrowArray['edit_delete'] = "<a href='borrow.php?op=edit&id=" . $i . "'><img src=" . $pathIcon16 . "/edit.png alt='" . _EDIT . "' title='" . _EDIT . "'></a>
<a href='borrow.php?op=delete&id=" . $i . "'><img src=" . $pathIcon16 . "/delete.png alt='" . _DELETE . "' title='" . _DELETE . "'></a>
<a href='borrow.php?op=clone&id=" . $i . "'><img src=" . $pathIcon16 . "/editcopy.png alt='" . _CLONE . "' title='". _CLONE . "'></a>";


$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));
}
<a href='borrow.php?op=clone&id=" . $i . "'><img src=" . $pathIcon16 . "/editcopy.png alt='" . _CLONE . "' title='" . _CLONE . "'></a>";

$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 "<td class='center width5'>
// echo "<td class='center width5'>

// <a href='borrow.php?op=edit&id=".$i."'><img src=".$pathIcon16."/edit.png alt='"._EDIT."' title='"._EDIT."'></a>
// <a href='borrow.php?op=delete&id=".$i."'><img src=".$pathIcon16."/delete.png alt='"._DELETE."' title='"._DELETE."'></a>
// </td>";
// <a href='borrow.php?op=edit&id=".$i."'><img src=".$pathIcon16."/edit.png alt='"._EDIT."' title='"._EDIT."'></a>
// <a href='borrow.php?op=delete&id=".$i."'><img src=".$pathIcon16."/delete.png alt='"._DELETE."' title='"._DELETE."'></a>
// </td>";

// echo "</tr>";
// echo "</tr>";

// }
// }

// echo "</table><br><br>";
// echo "</table><br><br>";

// } else {
// } else {

// echo "<table width='100%' cellspacing='1' class='outer'>
// echo "<table width='100%' cellspacing='1' class='outer'>

// <tr>
// <tr>

// <th class='center width5'>".AM_EQUIPMENT_FORM_ACTION."XXX</th>
// </tr><tr><td class='errorMsg' colspan='4'>There are noXXX borrow</td></tr>";
// echo "</table><br><br>";
// <th class='center width5'>".AM_EQUIPMENT_FORM_ACTION."XXX</th>
// </tr><tr><td class='errorMsg' colspan='4'>There are noXXX borrow</td></tr>";
// echo "</table><br><br>";

//-------------------------------------------
//-------------------------------------------

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;

Expand All @@ -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)) {
Expand All @@ -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', ''));
Expand All @@ -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':

Expand All @@ -225,6 +214,6 @@
redirect_header('borrow.php', 3, AM_EQUIPMENT_CLONED_FAILED);
}

break;
break;
}
require_once __DIR__ . '/admin_footer.php';
Loading

0 comments on commit c85383e

Please sign in to comment.