コード例 #1
0
    $result = $ui->popupActionButton($lh->translationFor("choose_action"), array($modifyOption, $moduleActions, $eventOption, $separator, $typeOptions, $separator, $deleteOption), array("default"));
    return $result;
}
// initialize database
$db = new \creamy\DbHandler();
// get customer_type and customerid for selecting the right customers.
if (!isset($_GET["customer_type"])) {
    fatal_error("Wrong request. Missing customer_type");
}
$customer_type = $_GET["customer_type"];
// paging
$length = isset($_GET[CRM_CUSTOMER_DATATABLE_LIMIT]) ? intval($_GET[CRM_CUSTOMER_DATATABLE_LIMIT]) : 10;
$offset = isset($_GET[CRM_CUSTOMER_DATATABLE_OFFSET]) ? intval($_GET[CRM_CUSTOMER_DATATABLE_OFFSET]) : null;
$numRows = isset($offset) ? array($offset, $length) : $length;
// Ordering
$columns = $db->getCustomerColumnsToBeShownInCustomerList($customer_type);
$sorting = array();
if (isset($_GET[CRM_CUSTOMER_DATATABLE_SORT_COLUMN . "0"])) {
    for ($i = 0; $i < intval($_GET[CRM_CUSTOMER_DATATABLE_SORT_COLUMNS]); $i++) {
        if ($_GET[CRM_CUSTOMER_DATATABLE_IS_SORTABLE . intval($_GET[CRM_CUSTOMER_DATATABLE_SORT_COLUMN . $i])] == "true") {
            $columnToSort = $columns[intval($_GET[CRM_CUSTOMER_DATATABLE_SORT_COLUMN . $i])];
            $sortType = $_GET[CRM_CUSTOMER_DATATABLE_SORT_DIRECTION . $i] === 'asc' ? 'asc' : 'Desc';
            $sorting[$columnToSort] = $sortType;
        }
    }
}
// filtering
$filtering = array();
if (isset($_GET[CRM_CUSTOMER_DATATABLE_SEARCH]) && $_GET[CRM_CUSTOMER_DATATABLE_SEARCH] != "") {
    $wordToSearch = $db->escape_string($_GET[CRM_CUSTOMER_DATATABLE_SEARCH]);
    for ($i = 0; $i < count($columns); $i++) {