Code Duplication    Length = 30-30 lines in 3 locations

blocks/customer.php 1 location

@@ 66-95 (lines=30) @@
63
 *
64
 * @return string
65
 */
66
function editEquipmentCustomer($options)
67
{
68
    require_once dirname(__DIR__) . '/class/customer.php';
69
    $moduleDirName = basename(dirname(__DIR__));
70
71
    $form = MB_EQUIPMENT_DISPLAY;
72
    $form .= "<input type='hidden' name='options[0]' value='" . $options[0] . "' />";
73
    $form .= "<input name='options[1]' size='5' maxlength='255' value='" . $options[1] . "' type='text' />&nbsp;<br>";
74
    $form .= MB_EQUIPMENT_TITLELENGTH . " : <input name='options[2]' size='5' maxlength='255' value='" . $options[2] . "' type='text' /><br><br>";
75
76
    /** @var XoopsObjectHandler $'. customer . 'Handler */
77
    $customerHandler = xoops_getModuleHandler('customer', $moduleDirName);
78
    $criteria        = new CriteriaCompo();
79
    array_shift($options);
80
    array_shift($options);
81
    array_shift($options);
82
    $criteria->add(new Criteria('id', 0, '!='));
83
    $criteria->setSort('id');
84
    $criteria->setOrder('ASC');
85
    $customerArray = $customerHandler->getAll($criteria);
86
    $form          .= MB_EQUIPMENT_CATTODISPLAY . "<br><select name='options[]' multiple='multiple' size='5'>";
87
    $form          .= "<option value='0' " . (in_array(0, $options) === false ? '' : "selected='selected'") . '>' . MB_EQUIPMENT_ALLCAT . '</option>';
88
    foreach (array_keys($customerArray) as $i) {
89
        $id   = $customerArray[$i]->getVar('id');
90
        $form .= "<option value='" . $id . "' " . (in_array($id, $options) === false ? '' : "selected='selected'") . '>' . $customerArray[$i]->getVar('last') . '</option>';
91
    }
92
    $form .= '</select>';
93
94
    return $form;
95
}
96

blocks/equipment.php 1 location

@@ 68-97 (lines=30) @@
65
 *
66
 * @return string
67
 */
68
function editEquipmentEquipment($options)
69
{
70
    require_once dirname(__DIR__) . '/class/equipment.php';
71
    $moduleDirName = basename(dirname(__DIR__));
72
73
    $form = MB_EQUIPMENT_DISPLAY;
74
    $form .= "<input type='hidden' name='options[0]' value='" . $options[0] . "' />";
75
    $form .= "<input name='options[1]' size='5' maxlength='255' value='" . $options[1] . "' type='text' />&nbsp;<br>";
76
    $form .= MB_EQUIPMENT_TITLELENGTH . " : <input name='options[2]' size='5' maxlength='255' value='" . $options[2] . "' type='text' /><br><br>";
77
78
    /** @var XoopsObjectHandler $'. equipment . 'Handler */
79
    $equipmentHandler = xoops_getModuleHandler('equipment', $moduleDirName);
80
    $criteria         = new CriteriaCompo();
81
    array_shift($options);
82
    array_shift($options);
83
    array_shift($options);
84
    $criteria->add(new Criteria('id', 0, '!='));
85
    $criteria->setSort('id');
86
    $criteria->setOrder('ASC');
87
    $equipmentArray = $equipmentHandler->getAll($criteria);
88
    $form           .= MB_EQUIPMENT_CATTODISPLAY . "<br><select name='options[]' multiple='multiple' size='5'>";
89
    $form           .= "<option value='0' " . (in_array(0, $options) === false ? '' : "selected='selected'") . '>' . MB_EQUIPMENT_ALLCAT . '</option>';
90
    foreach (array_keys($equipmentArray) as $i) {
91
        $id   = $equipmentArray[$i]->getVar('id');
92
        $form .= "<option value='" . $id . "' " . (in_array($id, $options) === false ? '' : "selected='selected'") . '>' . $equipmentArray[$i]->getVar('name') . '</option>';
93
    }
94
    $form .= '</select>';
95
96
    return $form;
97
}
98

blocks/rentals.php 1 location

@@ 67-96 (lines=30) @@
64
 *
65
 * @return string
66
 */
67
function editEquipmentRentals($options)
68
{
69
    require_once dirname(__DIR__) . '/class/rentals.php';
70
    $moduleDirName = basename(dirname(__DIR__));
71
72
    $form = MB_EQUIPMENT_DISPLAY;
73
    $form .= "<input type='hidden' name='options[0]' value='" . $options[0] . "' />";
74
    $form .= "<input name='options[1]' size='5' maxlength='255' value='" . $options[1] . "' type='text' />&nbsp;<br>";
75
    $form .= MB_EQUIPMENT_TITLELENGTH . " : <input name='options[2]' size='5' maxlength='255' value='" . $options[2] . "' type='text' /><br><br>";
76
77
    /** @var XoopsObjectHandler $'. rentals . 'Handler */
78
    $rentalsHandler = xoops_getModuleHandler('rentals', $moduleDirName);
79
    $criteria       = new CriteriaCompo();
80
    array_shift($options);
81
    array_shift($options);
82
    array_shift($options);
83
    $criteria->add(new Criteria('id', 0, '!='));
84
    $criteria->setSort('id');
85
    $criteria->setOrder('ASC');
86
    $rentalsArray = $rentalsHandler->getAll($criteria);
87
    $form         .= MB_EQUIPMENT_CATTODISPLAY . "<br><select name='options[]' multiple='multiple' size='5'>";
88
    $form         .= "<option value='0' " . (in_array(0, $options) === false ? '' : "selected='selected'") . '>' . MB_EQUIPMENT_ALLCAT . '</option>';
89
    foreach (array_keys($rentalsArray) as $i) {
90
        $id   = $rentalsArray[$i]->getVar('id');
91
        $form .= "<option value='" . $id . "' " . (in_array($id, $options) === false ? '' : "selected='selected'") . '>' . $rentalsArray[$i]->getVar('customerid') . '</option>';
92
    }
93
    $form .= '</select>';
94
95
    return $form;
96
}
97