• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Kwf_Model_Select类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: orderConfirmed

 public function orderConfirmed(Kwc_Shop_Cart_Order $order)
 {
     if (!$order->voucher_code) {
         return;
     }
     $c = Kwf_Component_Data_Root::getInstance()->getComponentByDbId($order->checkout_component_id);
     foreach ($c->getComponent()->getSumRows($order) as $sumRow) {
         if (isset($sumRow['type']) && $sumRow['type'] == 'voucher') {
             $s = new Kwf_Model_Select();
             $s->whereEquals('code', $order->voucher_code);
             $row = Kwf_Model_Abstract::getInstance('Kwc_Shop_Cart_Plugins_Voucher_Vouchers')->getRow($s);
             $remainingAmount = $row->amount - $row->used_amount + $sumRow['amount'];
             $h = $row->createChildRow('history');
             $h->amount = -$sumRow['amount'];
             $h->order_id = $order->id;
             $h->date = $order->date;
             $h->comment = trlKwf('Order') . ' ' . $order->order_number;
             $h->save();
             //verbrauchten betrag auch noch bei der order speichern
             $order->voucher_amount = (double) $h->amount;
             $order->voucher_remaining_amount = (double) $remainingAmount;
             $order->save();
             break;
         }
     }
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:26,代码来源:Component.php


示例2: testChildCountEager

 public function testChildCountEager()
 {
     $s = new Kwf_Model_Select();
     $s->whereId(1);
     $s->expr('parent_child_count');
     $this->_modelChild->getRow($s)->parent_child_count;
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:7,代码来源:Test.php


示例3: _getLanguageRow

 protected function _getLanguageRow($parentData)
 {
     $s = new Kwf_Model_Select();
     $s->whereEquals('domain', $parentData->id);
     $s->whereEquals('master', 1);
     return $this->_getModel()->getRow($s);
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:7,代码来源:MasterGenerator.php


示例4: testIgnoreDeleted

 public function testIgnoreDeleted()
 {
     $model = Kwf_Model_Abstract::getInstance('Kwf_Model_Union_DeletedFlag_TestModel');
     $s = new Kwf_Model_Select();
     $s->ignoreDeleted();
     $this->assertEquals($model->countRows($s), 3);
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:7,代码来源:Test.php


示例5: getFavouriteComponentIds

 /**
  * returns a list of all visible favourite componentIds
  */
 public static function getFavouriteComponentIds($favouritesModel)
 {
     $ret = array();
     $userId = Kwf_Registry::get('userModel')->getAuthedUserId();
     if ($userId) {
         $cacheIdUser = 'favCIds' . $userId;
         $ret = Kwf_Cache_Simple::fetch($cacheIdUser, $success);
         if (!$success) {
             // get all favourites related to user
             $select = new Kwf_Model_Select();
             $select->whereEquals('user_id', $userId);
             $favouritesModel = Kwf_Model_Abstract::getInstance($favouritesModel);
             $favourites = $favouritesModel->getRows($select);
             $componentIds = array();
             foreach ($favourites as $favourite) {
                 $component = Kwf_Component_Data_Root::getInstance()->getComponentById($favourite->component_id);
                 // check if component is visible and existent
                 if ($component) {
                     // if component is visible create list of users related to component
                     $componentIds[] = $component->componentId;
                 }
             }
             // cache relation of visible components to user
             Kwf_Cache_Simple::add($cacheIdUser, $componentIds);
             $ret = $componentIds;
         }
     }
     return $ret;
 }
开发者ID:koala-framework,项目名称:koala-framework,代码行数:32,代码来源:Component.php


示例6: testParentOrder

 public function testParentOrder()
 {
     $s = new Kwf_Model_Select();
     $s->order('if_field', 'DESC');
     $row = $this->_modelChild->getRow($s);
     $this->assertEquals(207, $row->if_field);
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:7,代码来源:Test.php


示例7: updatePages

 public function updatePages($cmp)
 {
     $s = new Kwf_Model_Select();
     $s->whereEquals('component_id', $cmp->dbId);
     $rows = $this->getRows($s);
     $rowsByTargetPageId = array();
     foreach ($rows as $r) {
         $rowsByTargetPageId[$r->target_page_id] = $r;
     }
     $childPagesComponentSelect = array('ignoreVisible' => true);
     $pos = 0;
     foreach ($cmp->getPage()->getChildPages($childPagesComponentSelect) as $childPage) {
         if (is_numeric($childPage->dbId)) {
             $id = $childPage->dbId;
         } else {
             $id = substr(md5($childPage->dbId), 0, 5);
         }
         $pos++;
         if (isset($rowsByTargetPageId[$childPage->dbId])) {
             $row = $rowsByTargetPageId[$childPage->dbId];
             unset($rowsByTargetPageId[$childPage->dbId]);
         } else {
             $row = $this->createRow();
             $row->target_page_id = $childPage->dbId;
             $row->visible = false;
         }
         $row->child_id = $id;
         $row->pos = $pos;
         $row->component_id = $cmp->dbId;
         $row->save();
     }
     foreach ($rowsByTargetPageId as $row) {
         $row->delete();
     }
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:35,代码来源:Model.php


示例8: _getNetworks

 private function _getNetworks($currentPage)
 {
     $networks = array();
     foreach (Kwf_Model_Abstract::getInstance('Kwc_Advanced_SocialBookmarks_AvaliableModel')->getRows() as $n) {
         $networks[$n->id] = $n->toArray();
     }
     $s = new Kwf_Model_Select();
     $s->order('pos');
     $ret = array();
     foreach ($this->getRow()->getChildRows('Networks', $s) as $net) {
         if (isset($networks[$net->network_id])) {
             $icon = '/Kwc/Advanced/SocialBookmarks/Icons/' . $this->_getSetting('iconSet') . '/';
             if (file_exists(KWF_PATH . $icon . $net->network_id . '.jpg')) {
                 $icon .= $net->network_id . '.jpg';
             } else {
                 if (file_exists(KWF_PATH . $icon . $net->network_id . '.png')) {
                     $icon .= $net->network_id . '.png';
                 } else {
                     $icon = false;
                 }
             }
             if ($icon) {
                 $icon = '/assets/kwf' . $icon;
             }
             $url = str_replace('{0}', $currentPage->getAbsoluteUrl(), $networks[$net->network_id]['url']);
             $ret[] = array('id' => $net->network_id, 'name' => $networks[$net->network_id]['name'], 'url' => $url, 'icon' => $icon);
         }
     }
     return $ret;
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:30,代码来源:Component.php


示例9: processInput

 public function processInput(array $postData)
 {
     parent::processInput($postData);
     $this->_accessByMailRow = false;
     if (isset($postData['key'])) {
         $s = new Kwf_Model_Select();
         $s->whereEquals('key', $postData['key']);
         $s->where(new Kwf_Model_Select_Expr_Higher('date', new Kwf_Date(time() - 24 * 60 * 60)));
         $this->_accessByMailRow = Kwf_Model_Abstract::getInstance('Kwf_Component_Plugin_AccessByMail_Model')->getRow($s);
         if (!$this->_accessByMailRow) {
             $this->_errors[] = array('message' => trlKwf("Invalid or expired Link. Please request a new one."));
         } else {
             $session = new Kwf_Session_Namespace('kwc_' . $this->getData()->parent->componentId);
             $session->login = true;
             $session->key = $postData['key'];
         }
     } else {
         $session = new Kwf_Session_Namespace('kwc_' . $this->getData()->parent->componentId);
         if ($session->login) {
             $s = new Kwf_Model_Select();
             $s->whereEquals('key', $session->key);
             $this->_accessByMailRow = Kwf_Model_Abstract::getInstance('Kwf_Component_Plugin_AccessByMail_Model')->getRow($s);
         }
     }
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:25,代码来源:Component.php


示例10: testExprCompareHigherInSelect

 public function testExprCompareHigherInSelect()
 {
     $select = new Kwf_Model_Select();
     $select->whereEquals('expr_foo_bar_higher', true);
     $count = $this->_modelChild->countRows($select);
     $this->assertEquals(2, $count);
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:7,代码来源:Test.php


示例11: update

 public function update()
 {
     parent::update();
     $select = new Kwf_Model_Select();
     $select->where(new Kwf_Model_Select_Expr_Or(array(new Kwf_Model_Select_Expr_Equals('dimension', 'customcrop'), new Kwf_Model_Select_Expr_Equals('dimension', 'custombestfit'))));
     $select->order('dimension', 'asc');
     $rows = Kwf_Model_Abstract::getInstance('Kwc_Abstract_Image_Model')->getRows($select);
     foreach ($rows as $row) {
         if ($row->dimension == 'customcrop') {
             $row->dimension = 'custom';
             $row->crop_x = null;
             $row->crop_y = null;
             $row->crop_width = null;
             $row->crop_heigth = null;
         } else {
             if ($row->dimension == 'custombestfit') {
                 $row->dimension = 'custom';
                 if ($row->imageExists()) {
                     $targetSize = array('width' => $row->width, 'height' => $row->height, 'cover' => false);
                     $outputSize = Kwf_Media_Image::calculateScaleDimensions($row->getParentRow('Image')->getFileSource(), $targetSize);
                     $row->width = $outputSize['width'];
                     $row->height = $outputSize['height'];
                     $row->crop_x = $outputSize['crop']['x'];
                     $row->crop_y = $outputSize['crop']['y'];
                     $row->crop_width = $outputSize['crop']['width'];
                     $row->crop_height = $outputSize['crop']['height'];
                 }
             }
         }
         $row->save();
     }
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:32,代码来源:20150309Legacy40002.php


示例12: _getSelect

 protected function _getSelect(ParamFetcher $paramFetcher, Request $request)
 {
     $select = new \Kwf_Model_Select();
     $select->limit($paramFetcher->get('limit'), $paramFetcher->get('start'));
     $queryValue = trim($request->get('query'));
     if ($queryValue) {
         $exprs = array();
         if (!$this->_queryColumns) {
             throw new \Kwf_Exception("_queryColumns are required to be set");
         }
         if ($this->_querySplit) {
             $queryValue = explode(' ', $queryValue);
         } else {
             $queryValue = array($queryValue);
         }
         foreach ($queryValue as $q) {
             $e = array();
             foreach ($this->_queryColumns as $c) {
                 $e[] = new \Kwf_Model_Select_Expr_Like($c, '%' . $q . '%');
             }
             if (count($e) > 1) {
                 $exprs[] = new \Kwf_Model_Select_Expr_Or($e);
             } else {
                 $exprs[] = $e[0];
             }
         }
         if (count($exprs) > 1) {
             $select->where(new \Kwf_Model_Select_Expr_And($exprs));
         } else {
             $select->where($exprs[0]);
         }
     }
     return $select;
 }
开发者ID:koala-framework,项目名称:koala-framework,代码行数:34,代码来源:FOSRestModelController.php


示例13: getRow

 public function getRow($select)
 {
     if (!is_object($select)) {
         $select = new Kwf_Model_Select($select);
     }
     $id = null;
     if ($select->getPart(Kwf_Model_Select::WHERE_EQUALS)) {
         foreach ($select->getPart(Kwf_Model_Select::WHERE_EQUALS) as $k => $i) {
             if ($k == 'id') {
                 $id = $i;
             }
         }
     }
     $componentId = $this->_getComponentId($select);
     if ($id && !$componentId) {
         //only id passed, in detail form controller
         $c = Kwf_Component_Data_Root::getInstance()->getComponentByDbId($id, array('ignoreVisible' => true));
         $select->whereEquals('component_id', $c->parent->chained->dbId);
         $select->whereEquals('id', $c->id);
         $componentId = $c->parent->dbId;
     } else {
         if ($componentId && $id) {
             $c = Kwf_Component_Data_Root::getInstance()->getComponentByDbId($componentId, array('ignoreVisible' => true));
             $select->whereEquals('component_id', $c->chained->dbId);
             $select->whereEquals('id', $id);
         } else {
             throw new Kwf_Exception("invalid select");
         }
     }
     $proxyRow = $this->_proxyModel->getRow($select);
     return $this->getRowByProxiedRow($proxyRow, $componentId);
 }
开发者ID:nsams,项目名称:koala-framework,代码行数:32,代码来源:AdminModel.php


示例14: getUserToLoginByParams

 public function getUserToLoginByParams($redirectBackUrl, array $params)
 {
     $userData = $this->_getUserDataByParams($redirectBackUrl, $params);
     $s = new Kwf_Model_Select();
     $s->whereEquals('facebook_user_id', $userData->id);
     return $this->_model->getRow($s);
 }
开发者ID:koala-framework,项目名称:kwf-facebook-auth,代码行数:7,代码来源:Auth.php


示例15: setUp

 public function setUp()
 {
     parent::setUp();
     $select = new Kwf_Model_Select();
     $select->whereEquals('active', 1);
     $this->_model = new Kwf_Model_Union(array('models' => array('a' => 'Kwf_Model_Union_MergeSelect_Model1', 'b' => array('model' => 'Kwf_Model_Union_MergeSelect_Model2', 'select' => $select)), 'columnMapping' => 'Kwf_Model_Union_MergeSelect_TestMapping'));
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:7,代码来源:Test.php


示例16: _getRecipient

 protected function _getRecipient()
 {
     $rs = $this->_getMailComponent()->getRecipientSources();
     $recipientId = $this->_getParam('recipientId');
     if (!$recipientId) {
         $component = Kwf_Component_Data_Root::getInstance()->getComponentById($this->_getParam('componentId'), array('ignoreVisible' => true));
         $source = reset($rs);
         $model = Kwf_Model_Abstract::getInstance($source['model']);
         $select = $model->select();
         if ($model->hasColumn('newsletter_component_id')) {
             $select->whereEquals('newsletter_component_id', $component->parent->componentId);
         }
         if (isset($source['select'])) {
             $select->merge($source['select']);
         }
         $row = $model->getRow($select);
         if (!$row) {
             throw new Kwf_Exception_Client(trlKwf('Preview cannot be shown because it needs at least one recipient of this newsletter'));
         }
         $recipientId = $row->id;
     }
     $select = new Kwf_Model_Select();
     $select->whereEquals('id', $recipientId);
     $subscribeModelKey = $this->_getParam('subscribeModelKey');
     if (!$subscribeModelKey) {
         $subscribeModelKey = current(array_keys($rs));
     }
     $model = $rs[$subscribeModelKey]['model'];
     $row = Kwf_Model_Abstract::getInstance($model)->getRow($select);
     return $row;
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:31,代码来源:PreviewController.php


示例17: jsonParseFilesAction

 public function jsonParseFilesAction()
 {
     $pattern = array('start' => array('** Exception **', '** Thrown **', '** Message **', '** ExceptionDetail **', '** REQUEST_URI **', '** HTTP_REFERER **', '** User **', '** Time **', '** _USERAGENT **', '** _GET **', '** _POST **', '** _SERVER **', '** _FILES **', '** _SESSION **'), 'end' => array('-- Exception --', '-- Thrown --', '-- Message --', '-- ExceptionDetail --', '-- REQUEST_URI --', '-- HTTP_REFERER --', '-- User --', '-- Time --', '-- _USERAGENT --', '-- _GET --', '-- _POST --', '-- _SERVER --', '-- _FILES --', '-- _SESSION --'));
     $files = glob('log/*/*/*');
     if (empty($files)) {
         throw new Kwf_Exception_Client(trlKwf('No log files found.'));
     }
     $data = array();
     foreach ($files as $filename) {
         $logMessage = array();
         $fileInfo = pathinfo($filename);
         $folders = explode('/', $fileInfo['dirname']);
         $file = file_get_contents($filename);
         for ($i = 0; $i < count($pattern['start']); $i++) {
             preg_match_all('/(' . preg_quote($pattern['start'][$i]) . ')(.+?)(' . preg_quote($pattern['end'][$i]) . ')/si', $file, $matches);
             if (empty($matches[1])) {
                 continue;
             }
             $logMessage[trim(str_replace('**', '', $matches[1][0]))] = trim($matches[2][0]);
         }
         $select = new Kwf_Model_Select();
         $select->whereEquals('filename', $fileInfo['filename']);
         if ($this->_getModel()->countRows($select) > 0) {
             continue;
         }
         $data[] = array('type' => $folders[1], 'exception' => isset($logMessage['Exception']) ? $logMessage['Exception'] : '', 'thrown' => isset($logMessage['Thrown']) ? $logMessage['Thrown'] : '', 'message' => isset($logMessage['Message']) ? $logMessage['Message'] : '', 'exception_detail' => isset($logMessage['ExceptionDetail']) ? $logMessage['ExceptionDetail'] : '', 'request_uri' => isset($logMessage['REQUEST_URI']) ? $logMessage['REQUEST_URI'] : '', 'http_referer' => isset($logMessage['HTTP_REFERER']) ? $logMessage['HTTP_REFERER'] : '', 'user' => isset($logMessage['User']) ? $logMessage['User'] : '', 'useragent' => isset($logMessage['_USERAGENT']) ? $logMessage['_USERAGENT'] : '', 'get' => isset($logMessage['_GET']) ? $logMessage['_GET'] : '', 'post' => isset($logMessage['_POST']) ? $logMessage['_POST'] : '', 'server' => isset($logMessage['_SERVER']) ? $logMessage['_SERVER'] : '', 'files' => isset($logMessage['_FILES']) ? $logMessage['_FILES'] : '', 'session' => isset($logMessage['_SESSION']) ? $logMessage['_SESSION'] : '', 'filename' => $fileInfo['filename'], 'date' => $folders[2] . ' ' . $logMessage['Time']);
     }
     $this->_getModel()->import(Kwf_Model_Abstract::FORMAT_ARRAY, $data);
     $this->view->message = trlKwf('All files successfully parsed');
 }
开发者ID:nsams,项目名称:koala-framework,代码行数:30,代码来源:LogsController.php


示例18: __get

 public function __get($name)
 {
     if ($name == 'name' || $name == 'col_span' || $name == 'total_columns' || $name == 'columns') {
         if (!isset($this->_rows)) {
             $select = new Kwf_Model_Select();
             $select->whereEquals('component_id', $this->component_id);
             $select->order('pos');
             $this->_rows = $this->getModel()->getRows($select);
         }
         $columnTypes = Kwc_Abstract::getSetting($this->getModel()->getComponentClass(), 'columns');
         $typeName = array_keys($columnTypes);
         $typeName = array_shift($typeName);
         if ($parentRow = $this->getParentRow('Component')) {
             $typeName = $parentRow->type;
         }
         $type = $columnTypes[$typeName];
         if ($name == 'columns') {
             return array_sum($type['colSpans']);
         }
         if ($name == 'total_columns') {
             return count($type['colSpans']);
         }
         unset($columnTypes);
         $i = 0;
         $countInvisible = 0;
         foreach ($this->_rows as $row) {
             if (!$row->visible) {
                 $countInvisible++;
                 $i++;
                 if ($this == $row) {
                     if ($name == 'name') {
                         return trlKwf('Invisible');
                     } else {
                         if ($name == 'col_span') {
                             return max($type['colSpans']);
                         }
                     }
                 } else {
                     continue;
                 }
             }
             $number = $i - $countInvisible;
             while ($number >= count($type['colSpans'])) {
                 $number -= count($type['colSpans']);
             }
             if ($this == $row) {
                 if ($name == 'name') {
                     return trlKwf('Column {0}, width {1}%', array($number + 1, floor($type['colSpans'][$number] / array_sum($type['colSpans']) * 100)));
                 } else {
                     if ($name == 'col_span') {
                         return $type['colSpans'][$number];
                     }
                 }
             }
             $i++;
         }
     }
     return parent::__get($name);
 }
开发者ID:koala-framework,项目名称:koala-framework,代码行数:59,代码来源:Row.php


示例19: testParentExpression

 public function testParentExpression()
 {
     $s = new Kwf_Model_Select();
     $s->whereEquals('id', 2);
     $s->expr('parent_bar');
     $row = $this->_model->getRow($s);
     $this->assertEquals(5, $row->parent_bar);
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:8,代码来源:Test.php


示例20: testChildCountExpression

 public function testChildCountExpression()
 {
     $s = new Kwf_Model_Select();
     $s->expr('child_count');
     $s->whereId(1);
     $row = $this->_modelFoo->getRow($s);
     $this->assertEquals(2, $row->child_count);
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:8,代码来源:Test.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Kwf_Registry类代码示例发布时间:2022-05-23
下一篇:
PHP Kwf_Model_Abstract类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap