예제 #1
0
 /**
  * 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;
 }
예제 #2
0
 /**
  * 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($parameters)
 {
     switch ($parameters['target']) {
         case 'buildTargetAddressesToOrderPerson':
             require_once dirname(__FILE__) . '/ShipTo.php';
             $targetAdresses = \shiporder\ShipTo::getListOfTypeShipTo(array('idOfParent' => $parameters['id']));
             require_once dirname(__FILE__) . '/ShipToView.php';
             $shipToView = \shiporder\ShipToView::buildListOfTargetAddresses(array('idOfParent' => $parameters['id'], 'targetAddresses' => $targetAddresses));
             $content = array('rows' => array('targetAddresses' => $shipToView));
             return json_encode($content, JSON_FORCE_OBJECT);
         case 'listOfOrderPerson':
             require_once dirname(__FILE__) . '/OrderPerson.php';
             $orderPersons = \shiporder\OrderPerson::getListOfTypeOrderPerson(array());
             //		echo '<pre> 100 '; var_dump($orderPersons);
             //		echo '</pre>';
             require_once dirname(__FILE__) . '/OrderPersonView.php';
             $orderPersonView = \shiporder\OrderPersonView::buildListOfOrderPersons(array('orderPersons' => $orderPersons));
             return $orderPersonView;
             break;
         case 'selectOrderPerson':
             require_once dirname(__FILE__) . '/OrderPerson.php';
             $orderPerson = new \shiporder\OrderPerson();
             $orderPerson->setIdOrdePerson($parameters['id']);
             $orderPerson->setCompleteOrderPerson();
             require_once dirname(__FILE__) . '/OrderPersonView.php';
             $orderPersonView = \shiporder\OrderPersonView::buildOrderPerson(array('orderPerson' => $orderPerson));
             return $orderPersonView;
             break;
         default:
             return 'Mida teeme klientide osas?';
     }
 }
예제 #3
0
var_dump(\shiporder\ShipTo::getListOfTypeShipTo(array('forAutocompletion' => true)));
echo '</pre>';
//Inserting an order person
$newOrderPerson = new \shiporder\OrderPerson();
$newOrderPerson->setEmail('*****@*****.**');
$newOrderPerson->setFirstName('lilian');
$newOrderPerson->setLastName('tikk');
$newOrderPerson->insert();
echo var_dump(\shiporder\OrderPerson::getListOfTypeOrderPerson(array('forAutocompletion' => false)));
//Inserting new ShipTo location
$newShipTo = new \shiporder\ShipTo();
$newShipTo->setNameOfRecipient('Peeter');
$newShipTo->setCity('Tallinn');
$newShipTo->setCountry('Estonia');
$newShipTo->insert();
echo var_dump(\shiporder\ShipTo::getListOfTypeShipTo(array('forAutocompletion' => false)));
//Inserting a new item
$newShipTo = new \shiporder\Item();
$newShipTo->setAmount('50');
$newShipTo->setPriece('30');
$newShipTo->setName('Auto');
$newShipTo->insert();
echo var_dump(\shiporder\Item::getListOfTypeItem(array('forAutocompletion' => false)));
class OrderPersonController
{
    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));