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)); }
namespace shiporder; require_once dirname(__FILE__) . '/e_settings.php'; /** * This class controls shippings * * @namespace shiporder */ class ShipToController { /** * 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\ShipTo for shipping list * @uses \shiporder\ShipToView for the visual part of the list */ public static function start() { require_once dirname(__FILE__) . '/ShipTo.php'; $shipTos = \shiporder\ShipTo::getListOfTypeShipTo(array()); require_once dirname(__FILE__) . '/ShipToView.php'; $shipToView = \shiporder\ShipToView::buildListOfShipTos(array('shipTos' => $shipTos)); echo $shipToView; } } \shiporder\ShipToController::start();