Beispiel #1
0
 public function reportsAction()
 {
     $oRequest = App_Request::getInstance();
     if ('admin' == App_Auth::getInstance()->getIdentity()->user_type) {
         $oClientModel = new Model_Client();
         $oUserModel = new Model_User();
         $oPackageModel = new Model_Package();
         $this->view->couriers = count($oUserModel->setOption('type', 'courier')->getList());
         $this->view->admins = count($oUserModel->setOption('type', 'admin')->getList());
         $this->view->clients = count($oClientModel->getList());
         $this->view->packages_total = count($oPackageModel->getList());
         $this->view->packages_new = count($oPackageModel->setOption('type', 'new')->getList());
         $this->view->packages_delivered = count($oPackageModel->setOption('type', 'complete')->getList());
     } else {
         $this->view->setView('admin/noperms.phtml');
     }
 }
Beispiel #2
0
 public function payAction()
 {
     $oRequest = App_Request::getInstance();
     if (0 != $oRequest->getParam('tracking_code', 0)) {
         $oPackageModel = new Model_Package();
         $oPackageModel->setOption('package_tracking_code', (int) $oRequest->getParam('tracking_code'));
         $oPackage = $oPackageModel->getByTrackingCode();
         if ('instant' == $oPackage->package_payment_method) {
             $oPackageModel->setOption('package_id', $oPackage->package_id);
             $oPackageModel->setOption('package_payment_received', 1);
             try {
                 if ($oPackageModel->update()) {
                     $this->view->success = true;
                 } else {
                     $this->view->success = false;
                 }
             } catch (Exception $e) {
                 $this->view->success = false;
                 trigger_error('Error while paying: ' . $e->getMessage(), E_USER_WARNING);
             }
             $this->view->payment_type_mismatch = false;
         } else {
             $this->view->payment_type_mismatch = true;
         }
     }
 }
Beispiel #3
0
 public function __construct()
 {
     $this->view = new App_View();
     $this->_request = App_Request::getInstance();
     $this->init();
 }
Beispiel #4
0
<?php

date_default_timezone_set('Europe/Warsaw');
ini_set('display_errors', 0);
try {
    defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
    require_once APPLICATION_PATH . '/bootstrap.php';
    if ('' == session_id()) {
        session_start();
    }
    $oRequest = App_Request::getInstance();
    try {
        $sControllerClass = 'Controller_' . ucfirst($oRequest->getController()) . '';
        $oController = new $sControllerClass();
        $oController->init();
        $sActionMethod = strtolower($oRequest->getAction()) . 'Action';
        $oController->{$sActionMethod}();
        $content = $oController->view->render();
        include APPLICATION_PATH . '/views/' . $oController->view->getLayout() . '.phtml';
    } catch (Exception $e) {
        trigger_error('General error occured: ' . $e->getMessage(), E_USER_WARNING);
        $oController = new Controller_Default();
        $oController->init();
        $oController->errorAction();
        $oController->view->setView('default/error.phtml');
        $content = $oController->view->render();
        include APPLICATION_PATH . '/views/' . $oController->view->getLayout() . '.phtml';
    }
    session_write_close();
} catch (Exception $e) {
}