Ejemplo n.º 1
0
function accommodationdetails_merchantdetails_sales($merchant_name)
{
    $parts = explode('-', $merchant_name);
    $merchant_id = $parts[0];
    $model = new BookingForConnectorModelMerchantDetails();
    $page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1;
    $num_per_page = 20;
    $total = $model->getTotalOnSellUnits($merchant_id);
    $pages = ceil($total / $num_per_page);
    $start = ($page - 1) * $num_per_page;
    $merchant = $model->getItem($merchant_id);
    $onsellunits = $model->getItems('onsellunits', $start, $merchant_id);
    $resource_ids = array();
    if (isset($onsellunits) && !empty($onsellunits)) {
        foreach ($onsellunits as $resource) {
            $resource_ids[] = $resource->ResourceId;
        }
    }
    $resource_ids = implode(',', $resource_ids);
    $url = $_SERVER['REQUEST_URI'];
    $pagination_args = array('base' => $url . '%_%', 'format' => '&page=%#%', 'total' => $pages, 'current' => $page, 'show_all' => false, 'end_size' => 5, 'mid_size' => 2, 'prev_next' => true, 'prev_text' => __('«'), 'next_text' => __('»'), 'type' => 'plain', 'add_args' => false, 'add_fragment' => '');
    $output = '';
    $paginate_links = paginate_links($pagination_args);
    if ($paginate_links) {
        $output = $output . "<nav class='custom-pagination'>";
        //  $output = $output. "<span class='page-numbers page-num'>Page " . $page . " of " . $numpages . "</span> ";
        $output = $output . "<span class='page-numbers page-num'>" . __('Page', 'bfi') . " </span> ";
        $output = $output . $paginate_links;
        $output = $output . "</nav>";
    }
    $output = $output . '<div id="idsforajax" rel="' . $resource_ids . '"></div>';
    $output = $output . '<div id="ajaxurl" rel="' . get_site_url() . '/merchant-details/sales/' . $merchant_name . '"></div>';
    if (!isset($_REQUEST['task'])) {
        include 'templates/onsellunits.php';
        echo $output;
    } else {
        if (isset($_REQUEST['task']) && $_REQUEST['task'] == 'GetResourcesOnSellByIds') {
            $language = $_REQUEST['language'];
            $listsId = $_REQUEST['resourcesId'];
            $return = BFCHelper::GetResourcesOnSellByIds($listsId, $language);
            @header('Content-Type: application/json; charset=' . get_option('blog_charset'));
            echo $return;
            die;
        }
    }
}
Ejemplo n.º 2
0
 function GetResourcesOnSellByIds()
 {
     $listsId = JRequest::getVar('resourcesId');
     $language = JRequest::getVar('language');
     $return = BFCHelper::GetResourcesOnSellByIds($listsId, $language);
     echo $return;
     $app = JFactory::getApplication();
     $app->close();
 }