Exemplo n.º 1
0
 public function renderSampleAjax()
 {
     \EShop\Helpers\ViewHelpers\FormViewHelper::init(true);
     \EShop\Helpers\ViewHelpers\FormViewHelper::setAction(\EShop\Config\RouteConfig::getBasePath() . "test/testAjax");
     \EShop\Helpers\ViewHelpers\FormViewHelper::setMethod("post");
     \EShop\Helpers\ViewHelpers\FormViewHelper::initTextField()->setName("limit")->setAttribute('placeholder', 'Limit')->create();
     \EShop\Helpers\ViewHelpers\FormViewHelper::initSubmitButton()->setName('btn')->setValue('Generate Table')->create()->render();
 }
 public function renderAddCategoryMenu()
 {
     if (AppUserRolesConfig::hasAddEditDeletePriviligies()) {
         FormViewHelper::init();
         FormViewHelper::setMethod("post");
         FormViewHelper::setAction(\EShop\Config\RouteConfig::getBasePath() . "categories/add");
         FormViewHelper::initTextField()->setName('name')->setAttribute('placeholder', 'Category name')->setAttribute('class', 'add-category-field')->create();
         FormViewHelper::initSubmitButton()->setValue('Add Category')->setAttribute('class', 'btn btn-default')->create()->render();
     }
 }
 public function renderDeleteProductButton($productId)
 {
     if (AppUserRolesConfig::hasAddEditDeletePriviligies()) {
         FormViewHelper::init();
         FormViewHelper::setMethod("post");
         FormViewHelper::setAction(\EShop\Config\RouteConfig::getBasePath() . 'products/deleteProduct');
         FormViewHelper::initHiddenField()->setName('productId')->setValue($productId)->create();
         FormViewHelper::initHiddenField()->setName('categoryId')->setValue(substr($_GET['uri'], strlen($_GET['uri']) - 1, strlen($_GET['uri'])))->create();
         FormViewHelper::initSubmitButton()->setValue('Delete')->setAttribute('class', 'btn-default product-btn')->create()->render();
     }
 }
 public function renderChangePasswordForm()
 {
     FormViewHelper::init();
     FormViewHelper::setAttribute('class', 'productForm');
     FormViewHelper::setMethod("post");
     FormViewHelper::setAction(\EShop\Config\RouteConfig::getBasePath() . 'account/changePassword');
     FormViewHelper::initPasswordField()->setName("newPassword")->setAttribute('placeholder', 'New password')->create();
     FormViewHelper::initPasswordField()->setName("confirmPassword")->setAttribute('placeholder', 'Confirm password')->create();
     FormViewHelper::initSubmitButton()->setValue("Change password")->setAttribute('class', 'btn btn-danger')->create();
     FormViewHelper::render();
 }
 public function renderSoldProducts()
 {
     if (AppUserRolesConfig::hasAddEditDeletePriviligies()) {
         if ($this->soldProducts) {
             FormViewHelper::init();
             FormViewHelper::setMethod("post");
             FormViewHelper::setAction(\EShop\Config\RouteConfig::getBasePath() . 'account/reorder');
             FormViewHelper::setAttribute('class', 'productForm');
             $select = FormViewHelper::initSelect();
             $select->setName('productId');
             foreach ($this->soldProducts as $product) {
                 $select->addOption($product->getId(), $product->getName());
             }
             $select->create();
             FormViewHelper::initNumberField()->setName('quantity')->setAttribute('min', '1')->setAttribute('placeholder', 'Order counts')->create();
             FormViewHelper::initSubmitButton()->setValue('Reorder')->setAttribute('class', 'btn btn-primary')->create();
             FormViewHelper::render();
         }
     }
 }
 public function renderProduct()
 {
     if (AppUserRolesConfig::hasAddEditDeletePriviligies()) {
         FormViewHelper::init();
         FormViewHelper::setAttribute('class', 'productForm');
         FormViewHelper::setMethod("post");
         FormViewHelper::setAction(\EShop\Config\RouteConfig::getBasePath() . 'products/edit');
         FormViewHelper::initTextField()->setName('productName')->setValue($this->productOldInformation->getProductName())->setAttribute('class', 'form-group')->create();
         FormViewHelper::initHiddenField()->setName('productId')->setValue($this->productOldInformation->getProductId())->setAttribute('class', 'form-group')->create();
         FormViewHelper::initTextField()->setName('quantity')->setValue($this->productOldInformation->getQuantity())->create();
         $select = FormViewHelper::initSelect();
         $select->setAttribute('class', 'form-group');
         $select->setName('categoryId');
         foreach ($this->categories as $category) {
             if ($category->getId() == $this->productOldInformation->getCategoryId()) {
                 $select->addOption($category->getId(), $category->getName(), true);
             } else {
                 $select->addOption($category->getId(), $category->getName());
             }
         }
         $select->create();
         FormViewHelper::initSubmitButton()->setValue('Edit')->setAttribute('class', 'btn-primary btn-lg')->create()->render();
     }
 }
Exemplo n.º 7
0
                        <!--                    TODO-->
                        <a href="<?php 
    echo \EShop\Config\RouteConfig::getBasePath();
    ?>
account/removeProduct/<?php 
    echo $cartItems->getId();
    ?>
/<?php 
    echo $cartItems->getProductId();
    ?>
">
                            Remove from cart
                        </a>
                    </li>
                <?php 
}
?>
            </ul>
        </div>
        <div>
            <b>Total price: </b> <?php 
echo $this->getProductsTotalSum();
?>
 лв.
        </div>
        <?php 
\EShop\Helpers\ViewHelpers\FormViewHelper::initSubmitButton()->setValue('Checkout cart')->setAttribute('class', 'btn btn-success')->create();
\EShop\Helpers\ViewHelpers\FormViewHelper::setAction(\EShop\Config\RouteConfig::getBasePath() . 'account/checkoutCart/' . $this->cart[0]->getId())->setMethod('post')->render();
?>
    </div>
</div>
 public function renderCertainProductsPromoMenu()
 {
     if (AppUserRolesConfig::isAdmin()) {
         FormViewHelper::init();
         FormViewHelper::setMethod("post");
         FormViewHelper::setAction(\EShop\Config\RouteConfig::getBasePath() . 'admin/admin/addPromotionOnCertainProduct');
         $select = FormViewHelper::initSelect();
         $select->setName('productId');
         foreach ($this->allProducts as $product) {
             $select->addOption($product->getid(), $product->getName());
         }
         $select->create();
         FormViewHelper::initNumberField()->setAttribute('placeholder', 'Product promo in %')->setName('discount')->setAttribute('class', 'discount')->create();
         FormViewHelper::initSubmitButton()->setValue('Add promotion')->setAttribute('class', 'btn btn-primary')->create();
         FormViewHelper::render();
     }
 }