当前位置: 首页>>代码示例>>PHP>>正文


PHP App::getModel方法代码示例

本文整理汇总了PHP中App::getModel方法的典型用法代码示例。如果您正苦于以下问题:PHP App::getModel方法的具体用法?PHP App::getModel怎么用?PHP App::getModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在App的用法示例。


在下文中一共展示了App::getModel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getProducerAll

    public function getProducerAll()
    {
        $sql = 'SELECT 
					P.idproducer AS id,
					PT.name,
					PT.seo, 
					P.photoid, 
					COUNT(PROD.idproduct) AS totalproducts
				FROM producer P
				LEFT JOIN producertranslation PT ON PT.producerid = P.idproducer AND PT.languageid = :language
				LEFT JOIN producerview PV ON P.idproducer = PV.producerid
				LEFT JOIN product PROD ON PROD.producerid = P.idproducer AND PROD.enable = 1
				WHERE PV.viewid = :viewid
				GROUP BY P.idproducer
				HAVING totalproducts > 0
				ORDER BY PT.name ASC';
        $Data = array();
        $stmt = Db::getInstance()->prepare($sql);
        $stmt->bindValue('language', Helper::getLanguageId());
        $stmt->bindValue('viewid', Helper::getViewId());
        $stmt->execute();
        while ($rs = $stmt->fetch()) {
            $Data[] = array('id' => $rs['id'], 'name' => $rs['name'], 'seo' => $rs['seo'], 'link' => $this->registry->router->generate('frontend.producerlist', true, array('param' => $rs['seo'])), 'active' => $this->getParam() == $rs['seo'] ? true : false, 'photo' => App::getModel('categorylist')->getImagePath($rs['photoid']));
        }
        return $Data;
    }
开发者ID:krisldz,项目名称:Gekosale2,代码行数:26,代码来源:producerbox.php

示例2: index

 public function index()
 {
     if (App::getModel('cart')->getMinimumOrderValue() > 0) {
         App::redirectUrl($this->registry->router->generate('frontend.cart'));
     }
     $this->Render('Checkout');
 }
开发者ID:krisldz,项目名称:Gekosale2,代码行数:7,代码来源:checkout.php

示例3: index

 public function index()
 {
     $this->registry->template->assign('producers', $this->producers);
     $this->registry->template->assign('activePath', App::getModel('staticcontent')->getActivePath());
     $this->registry->template->assign('view', $this->_boxAttributes['view']);
     return $this->registry->template->fetch($this->loadTemplate('index.tpl'));
 }
开发者ID:krisldz,项目名称:Gekosale2,代码行数:7,代码来源:producerbox.php

示例4: initDataset

    public function initDataset($dataset)
    {
        App::getModel('product')->productsDataset($dataset);
        $dataset->queryColumns['id'] = array('source' => 'UP.relatedproductid');
        $dataset->queryColumns['hierarchy'] = array('source' => 'UP.hierarchy');
        $dataset->queryFrom = '
      upsell UP
      LEFT JOIN product P ON  P.idproduct = UP.relatedproductid
      LEFT JOIN productcategory PC ON PC.productid = P.idproduct
      LEFT JOIN viewcategory VC ON PC.categoryid = VC.categoryid AND VC.viewid = :viewid
      LEFT JOIN productnew PN ON P.idproduct = PN.productid
    ' . $dataset->queryFrom;
        if ($this->registry->router->getCurrentController() == 'cart') {
            $dataset->setAdditionalWhere('
				FIND_IN_SET(CAST(UP.productid as CHAR), :ids) AND
				P.enable = 1 AND
				VC.viewid  = :viewid
			');
            $dataset->setSQLParams(array('ids' => App::getModel('cart')->getProductIds()));
        } else {
            $dataset->setAdditionalWhere('
				UP.productid = (SELECT productid FROM producttranslation WHERE seo = :seo LIMIT 1) AND 
				P.enable = 1 AND
				VC.viewid  = :viewid
			');
            $dataset->setSQLParams(array('seo' => $this->registry->core->getParam()));
        }
        $dataset->setGroupBy('
			UP.relatedproductid
		');
    }
开发者ID:krisldz,项目名称:Gekosale2,代码行数:31,代码来源:productsupsellbox.php

示例5: getMetadata

 public function getMetadata()
 {
     $id = App::getModel('staticcontent')->getConditionsId();
     if ($id > 0) {
         return App::getModel('staticcontent')->getMetaData($id);
     }
 }
开发者ID:krisldz,项目名称:Gekosale2,代码行数:7,代码来源:conditions.php

示例6: saveOrder

 public function saveOrder($Data)
 {
     $Data['clientaddress']['phone'] = $Data['contactData']['phone'];
     $Data['clientaddress']['phone2'] = $Data['contactData']['phone2'];
     $Data['clientaddress']['email'] = $Data['contactData']['email'];
     $Data['deliveryAddress']['phone'] = $Data['contactData']['phone'];
     $Data['deliveryAddress']['phone2'] = $Data['contactData']['phone2'];
     $Data['deliveryAddress']['email'] = $Data['contactData']['email'];
     Db::getInstance()->beginTransaction();
     try {
         $clientId = $Data['clientid'];
         if ($clientId == NULL || $clientId == 0) {
             $clientId = Session::getActiveClientid();
         }
         $orderId = $this->addOrder($Data, $clientId);
         $this->addOrderClientData($Data['clientaddress'], $clientId, $orderId);
         $this->addOrderClientDeliveryData($Data['deliveryAddress'], $orderId);
         $this->addOrderProduct($Data['cart'], $orderId);
         App::getModel('order')->updateSessionString($orderId);
         $this->syncStock();
         Event::dispatch($this, 'frontend.order.saveOrder', array('id' => $orderId, 'data' => $Data));
     } catch (Exception $e) {
         throw new FrontendException($e->getMessage());
     }
     Db::getInstance()->commit();
     return $orderId;
 }
开发者ID:krisldz,项目名称:Gekosale2,代码行数:27,代码来源:order.php

示例7: logout

 /**
  * Logout Action
  * Clears Session information & Redirects to index
  */
 public function logout()
 {
     $session = \App::getModel('session');
     $session->clear();
     header('Location: ' . \Config::get('site.url') . '/Index');
     exit;
 }
开发者ID:uaktags,项目名称:lyraEngine,代码行数:11,代码来源:Index.php

示例8: initDataset

    public function initDataset($dataset)
    {
        $product_id = App::getModel('product')->getProductIdBySeo($this->registry->core->getParam());
        App::getModel('product')->productsDataset($dataset);
        $dataset->queryColumns['count'] = array('source' => 'SUM(DISTINCT OP.qty)');
        $dataset->queryFrom = '
      orderproduct OP
      LEFT JOIN productcategory PC ON PC.productid = OP.productid
      LEFT JOIN category C ON PC.categoryid= C.idcategory
      LEFT JOIN viewcategory VC ON PC.categoryid = VC.categoryid
      LEFT JOIN product P ON PC.productid = P.idproduct
      LEFT JOIN productnew PN ON P.idproduct = PN.productid
    ' . $dataset->queryFrom;
        $dataset->setAdditionalWhere('
			OP.qty IS NOT NULL AND 
			OP.name IS NOT NULL AND 
			P.idproduct IS NOT NULL AND 
			VC.viewid = :viewid AND 
			OP.orderid IN (:ids) AND 
			OP.productid != :productid AND
			P.enable = 1
		');
        $dataset->setGroupBy('
				P.idproduct
			');
        $dataset->setSQLParams(array('ids' => App::getModel('product')->getAlsoProduct($product_id), 'productid' => $product_id));
    }
开发者ID:krisldz,项目名称:Gekosale2,代码行数:27,代码来源:productbuyalsobox.php

示例9: __construct

 public function __construct($registry, $box)
 {
     parent::__construct($registry, $box);
     $this->model = App::getModel('staticcontent');
     $this->id = App::getModel('staticcontent')->getConditionsId();
     $this->cms = $this->model->getStaticContent($this->id);
 }
开发者ID:krisldz,项目名称:Gekosale2,代码行数:7,代码来源:conditionsbox.php

示例10: getMetadata

 public function getMetadata()
 {
     if ($this->getParam() == '') {
         return App::getModel('seo')->getMetadataForPage();
     } else {
         return App::getModel('producerlistbox')->getProducerBySeo($this->getParam());
     }
 }
开发者ID:krisldz,项目名称:Gekosale2,代码行数:8,代码来源:producerlist.php

示例11: loadProductData

 public function loadProductData($request)
 {
     $products = [];
     foreach ($request['products'] as $product) {
         $products[] = App::getModel('product/product')->getProductVariantDetails($product);
     }
     return array('products' => $products);
 }
开发者ID:jmarceli,项目名称:WellCommerce,代码行数:8,代码来源:ProductAggregator.php

示例12: getDatagrid

 public function getDatagrid()
 {
     if ($this->datagrid == null) {
         $this->datagrid = App::getModel('datagrid/datagrid');
         call_user_func($this->attributes['datagrid_init_function'], $this->datagrid);
     }
     return $this->datagrid;
 }
开发者ID:jmarceli,项目名称:WellCommerce,代码行数:8,代码来源:DatagridSelect.php

示例13: __construct

 public function __construct()
 {
     $player = \App::getModel('session');
     if ($player->isLoggedIn()) {
         header('Location: Home');
         exit;
     }
 }
开发者ID:uaktags,项目名称:lyraEngine,代码行数:8,代码来源:Index.php

示例14: dbStatusAction

 public function dbStatusAction()
 {
     $yupp = new Yupp();
     $appNames = $yupp->getAppNames();
     $appModelClasses = array();
     // [appName][class][tablename,creada o no]
     // Incluye todas las clases del modelo de todas las apps
     YuppLoader::loadModel();
     // Para saber si se crearon las tablas para todas las
     // clases del modelo de todas las aplicaciones.
     $allTablesCreated = true;
     $fn = new FileNames();
     // http://code.google.com/p/yupp/issues/detail?id=123
     $createDatabaseForApps = array();
     // Aplicaciones a las que se sugiere que se cree su base de datos
     foreach ($appNames as $appName) {
         $app = new App($appName);
         $modelClassFileNames = $app->getModel();
         // no incluye las clases, solo obtiene los nombres
         //print_r($modelClassFileNames);
         // Necesito que sea plano el array, si no, tengo que hacer recorrida recursiva.
         // Esto no seria necesario si modifico la recorrida en la vista, para mostrar
         // la estructura interna de paquetes del modelo de la aplicacion.
         $modelClassFileNames = $this->array_flatten($modelClassFileNames);
         //print_r($modelClassFileNames);
         // Toda la informacion de las clases y tablas creadas para esta app
         $appModelClasses[$appName] = array();
         // http://code.google.com/p/yupp/issues/detail?id=123
         try {
             $dal = new DAL($appName);
             // Falla sino existe la base para la app $appName
         } catch (Exception $e) {
             if ($e->getCode() == 666) {
                 $createDatabaseForApps[] = $appName;
             }
             continue;
             // Para el for appNames
         }
         foreach ($modelClassFileNames as $classFileName) {
             $fileInfo = $fn->getFileNameInfo($classFileName);
             $className = $fileInfo['name'];
             // Para incluir las clases (por si no estan incluidas)
             // Ticket: http://code.google.com/p/yupp/issues/detail?id=71
             YuppLoader::load($fileInfo['package'], $className);
             $tableName = YuppConventions::tableName($className);
             if ($dal->tableExists($tableName)) {
                 $appModelClasses[$appName][$className] = array('tableName' => $tableName, 'created' => "CREADA");
             } else {
                 $appModelClasses[$appName][$className] = array('tableName' => $tableName, 'created' => "NO CREADA");
                 $allTablesCreated = false;
             }
         }
     }
     $this->params['allTablesCreated'] = $allTablesCreated;
     $this->params['appModelClasses'] = $appModelClasses;
     $this->params['createDatabaseForApps'] = $createDatabaseForApps;
     return $this->render("dbStatus");
 }
开发者ID:fkali,项目名称:yupp,代码行数:58,代码来源:apps.core.controllers.CoreController.class.php

示例15: initDataset

    public function initDataset($dataset)
    {
        App::getModel('product')->productsDataset($dataset);
        $dataset->queryFrom = '
      productcategory PC
      LEFT JOIN viewcategory VC ON PC.categoryid = VC.categoryid
      LEFT JOIN product P ON PC.productid = P.idproduct
      LEFT JOIN productnew PN ON P.idproduct = PN.productid
    ' . $dataset->queryFrom;
        if ($this->registry->router->getCurrentController() == 'categorylist') {
            $dataset->setAdditionalWhere('
					IF(PGP.promotion = 1 AND IF(PGP.promotionstart IS NOT NULL, PGP.promotionstart <= CURDATE(), 1) AND IF(PGP.promotionend IS NOT NULL, PGP.promotionend >= CURDATE(), 1),
				 	PGP.discountprice IS NOT NULL,
				 	IF(PGP.groupprice IS NULL AND P.promotion = 1 AND IF(P.promotionstart IS NOT NULL, P.promotionstart <= CURDATE(), 1) AND IF(P.promotionend IS NOT NULL, P.promotionend >= CURDATE(), 1), P.discountprice IS NOT NULL, NULL)
					) AND
					VC.viewid = :viewid AND
					P.enable = 1 AND
					CT.seo = :seo
				');
            $dataset->setSQLParams(array('seo' => $this->getParam()));
        } elseif ($this->registry->router->getCurrentController() == 'producerlist') {
            $producer = App::getModel('producerlistbox')->getProducerBySeo($this->getParam());
            $dataset->setAdditionalWhere('
					IF(PGP.promotion = 1 AND IF(PGP.promotionstart IS NOT NULL, PGP.promotionstart <= CURDATE(), 1) AND IF(PGP.promotionend IS NOT NULL, PGP.promotionend >= CURDATE(), 1),
				 	PGP.discountprice IS NOT NULL,
				 	IF(PGP.groupprice IS NULL AND P.promotion = 1 AND IF(P.promotionstart IS NOT NULL, P.promotionstart <= CURDATE(), 1) AND IF(P.promotionend IS NOT NULL, P.promotionend >= CURDATE(), 1), P.discountprice IS NOT NULL, NULL)
					) AND
					VC.viewid = :viewid AND
					P.enable = 1 AND
					P.producerid = :id
				');
            $dataset->setSQLParams(array('id' => $producer['id']));
        } else {
            $dataset->setAdditionalWhere('
          IF(PGP.promotion = 1 AND IF(PGP.promotionstart IS NOT NULL, PGP.promotionstart <= CURDATE(), 1) AND IF(PGP.promotionend IS NOT NULL, PGP.promotionend >= CURDATE(), 1),
          PGP.discountprice IS NOT NULL,
          IF(PGP.groupprice IS NULL AND P.promotion = 1 AND IF(P.promotionstart IS NOT NULL, P.promotionstart <= CURDATE(), 1) AND IF(P.promotionend IS NOT NULL, P.promotionend >= CURDATE(), 1), P.discountprice IS NOT NULL, NULL)
            ) AND
            VC.viewid = :viewid AND
          IF(:filterbyproducer > 0, FIND_IN_SET(CAST(P.producerid as CHAR), :producer), 1) AND
          P.enable = 1 AND
          IF(:enablelayer > 0, FIND_IN_SET(CAST(P.idproduct as CHAR), :products), 1)
        ');
            //$dataset->queryFrom = '
            //productcategory PC
            //LEFT JOIN viewcategory VC ON PC.categoryid = VC.categoryid AND VC.viewid = :viewid
            //LEFT JOIN product P ON PC.productid = P.idproduct
            //LEFT JOIN productnew PN ON P.idproduct = PN.productid
            //' . $dataset->queryFrom;
            $dataset->setHavingString('
          finalprice BETWEEN IF(:pricefrom > 0, :pricefrom, 0) AND IF( :priceto > 0, :priceto, 999999)
        ');
            $dataset->setSQLParams(array('producer' => 0, 'pricefrom' => 0, 'priceto' => 0, 'filterbyproducer' => 0, 'enablelayer' => 0, 'products' => array()));
        }
        $dataset->setGroupBy('
			P.idproduct
		');
    }
开发者ID:krisldz,项目名称:Gekosale2,代码行数:58,代码来源:productpromotion.php


注:本文中的App::getModel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。