Example #1
0
 function ordersAction()
 {
     $img_id = $_SESSION['imag_id'];
     $imgAccount = ImgAccountUtil::getImgAccountById($img_id, TRUE);
     $v_params['sys_name'] = SysPropertiesUtil::getPropertyValue("sys_name");
     $v_params['sys_slog'] = SysPropertiesUtil::getPropertyValue("sys_slog");
     if (NULL != $imgAccount) {
         $v_params['logined'] = LoginChecker::isLogined();
         if ($v_params['logined'] == $img_id) {
             $v_params['mysc']['main'] = TRUE;
             $v_params['img_name'] = $imgAccount['img_name'];
             $v_params['img_all_gds_cats_href'] = "/" . IMAG_PREFIX . $img_id . "/" . IMAG_DIR;
             $v_params['img_all_blog_cats_href'] = "/" . IMAG_PREFIX . $img_id . "/" . BLOG_DIR;
             $v_params['img_gds_cats_HTML'] = ImgGdsCatUtil::createTreeHTML($imgAccount['id'], "/" . IMAG_PREFIX . $img_id . "/" . IMAG_DIR . "?" . PROD_CAT_PARAM_NAME . "=");
             $v_params['img_blog_cats_HTML'] = ImgBlogCatUtil::createTreeHTML($imgAccount['id'], "/" . IMAG_PREFIX . $img_id . "/" . BLOG_DIR . "?" . ART_CAT_PARAM_NAME . "=");
             $orders_on_page = 20;
             $page = $_GET[PAGE_PARAM_NAME];
             if (0 == strcmp("last", $_GET['type'])) {
                 $v_params['orders_type'] = "Последние";
                 $count_orders = OrderUtil::getCountOrdersByAccountID($imgAccount['id']);
                 for ($i = 0; $i < $count_orders / $orders_on_page; $i++) {
                     $item['value'] = $i + 1;
                     $item['current'] = $i == $_REQUEST[PAGE_PARAM_NAME];
                     $item['url'] = "orders?type=" . $_GET['type'] . "&" . PAGE_PARAM_NAME . "=" . $i;
                     $v_params['paginator'][] = $item;
                 }
                 $v_params['orders'] = OrderUtil::getOrdersLastByLimit($imgAccount['id'], $page * $orders_on_page, $orders_on_page);
             } else {
                 if (0 == strcmp("notprocessed", $_GET['type'])) {
                     $v_params['orders_type'] = "Не завершенные";
                     $count_orders = OrderUtil::getCountOrdersNotSendedByAccountID($imgAccount['id']);
                     for ($i = 0; $i < $count_orders / $orders_on_page; $i++) {
                         $item['value'] = $i + 1;
                         $item['current'] = $i == $_REQUEST[PAGE_PARAM_NAME];
                         $item['url'] = "orders?type=" . $_GET['type'] . "&" . PAGE_PARAM_NAME . "=" . $i;
                         $v_params['paginator'][] = $item;
                     }
                     $v_params['orders'] = OrderUtil::getOrdersNotSendedByLimit($imgAccount['id'], $page * $orders_on_page, $orders_on_page);
                 } else {
                     $v_params['orders_type'] = "Все";
                     $count_orders = OrderUtil::getCountOrdersByAccountID($imgAccount['id']);
                     for ($i = 0; $i < $count_orders / $orders_on_page; $i++) {
                         $item['value'] = $i + 1;
                         $item['current'] = $i == $_REQUEST[PAGE_PARAM_NAME];
                         $item['url'] = "orders?type=" . $_GET['type'] . "&" . PAGE_PARAM_NAME . "=" . $i;
                         $v_params['paginator'][] = $item;
                     }
                     $v_params['orders'] = OrderUtil::getOrdersByLimit($imgAccount['id'], $page * $orders_on_page, $orders_on_page);
                 }
             }
             Application::fastView('imag-admin/order/img_admin_orders', $v_params);
             exit;
         }
     }
     Application::fastView('main/sys_error', $v_params);
 }