Exemple #1
0
 public static function start($parameters)
 {
     switch ($parameters['target']) {
         case 'buildTargetAddressesToOrderPerson':
             require_once dirname(__FILE__) . '/OrderPerson/OrderPersonController.php';
             echo \shiporder\OrderPersonCOntroller::start(array('id' => isset($_GET['idOrderPerson']) ? $_GET['idOrderPerson'] : 0, 'target' => 'buildTargetAddressesToOrderPerson'));
             exit;
         case 'listOfItems':
             require_once dirname(__FILE__) . '/Item/ItemController.php';
             $body = \shiporder\ItemController::start();
             $title = 'Tooted';
             break;
         case 'listOfOrderPerson':
             require_once dirname(__FILE__) . '/OrderPerson/OrderPersonController.php';
             $body = \shiporder\OrderPersonController::start(array('target' => 'listOfOrderPerson'));
             $title = 'Kliendid';
             break;
         case 'selectOrderPerson':
             require_once dirname(__FILE__) . '/OrderPerson/OrderPersonController.php';
             $body = \shiporder\OrderPersonController::start(array('id' => $_GET['id'], 'target' => 'selectOrderPerson'));
             $title = 'Kliendid';
             break;
         case 'listOfShipTo':
             require_once dirname(__FILE__) . '/ShipTo/ShipToController.php';
             $body = \shiporder\ShipToController::start();
             $title = 'Sihtkohad';
             break;
         default:
             exit('Mida teeme?');
     }
     require_once dirname(__FILE__) . '/View.php';
     echo View::buildView(array('body' => $body, 'title' => $title));
 }
Exemple #2
0
 public static function start($parameters)
 {
     switch ($parameters['target']) {
         case 'listOfItems':
             require_once dirname(__FILE__) . '/items/ItemController.php';
             $body = \shiporder\ItemController::start();
             $title = 'Tooted';
             break;
         case 'listOfOrderPersons':
             require_once dirname(__FILE__) . '/order-persons/OrderPersonController.php';
             $body = \shiporder\OrderPersonController::start();
             $title = 'Kliendid';
             break;
         case 'selectOrderPerson':
             require_once dirname(__FILE__) . '/orderpersons/OrderPersonController.php';
             $body = \shiporder\OrderPersonController::start(array('id' => $_GET['id'], 'target' => 'selectOrderPerson'));
             $title = 'Kliendid';
             break;
         default:
             exit('Mida teeme?');
     }
     require_once dirname(__FILE__) . '/View.php';
     echo View::buildView(array('body' => $body, 'title' => $title));
 }
        var_dump(\shiporder\OrderPerson::getListOfTypeOrderPerson(array('forAutocompletion' => false)));
        echo '</pre>';
        // Deleting the order person #2
        $orderPerson = new \shiporder\OrderPerson();
        $orderPerson->setIdOrderPerson(2);
        $orderPerson->delete();
        echo ' After deleting the order person #2: <pre>';
        var_dump(\shiporder\OrderPerson::getListOfTypeOrderPerson(array('forAutocompletion' => false)));
        echo '</pre>';
    }
    /**
     * This function does anything we want.
     * Sometimes we want it to build something. Then, the result will be
     * returned.
     *
     * @access public
     * @return string
     * @uses \shiporder\OrderPerson for order person list
     * @uses \shiporder\OrderPersonView for the visual part of the list
     */
    public static function start()
    {
        require_once dirname(__FILE__) . '/OrderPerson.php';
        $orderPersons = \shiporder\OrderPerson::getListOfTypeOrderPerson(array());
        require_once dirname(__FILE__) . '/OrderPersonView.php';
        $orderPersonView = \shiporder\OrderPersonView::buildListOfOrderPersons(array('orderPersons' => $orderPersons));
        echo $orderPersonView;
    }
}
\shiporder\OrderPersonController::start();