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


PHP Kwf_Model_Select::whereEquals方法代码示例

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


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

示例1: _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

示例2: _getSelect

 protected function _getSelect($row)
 {
     $ret = new Kwf_Model_Select();
     foreach ($this->_groupBy as $k => $field) {
         if (is_array($field)) {
             $values = $field;
             $field = $k;
             $valueFound = false;
             foreach ($values as $value) {
                 if ($row->{$field} == $value) {
                     $valueFound = true;
                     $ret->whereEquals($field, $value);
                     break;
                 }
             }
             if (!$valueFound) {
                 $ret->whereNotEquals($field, $values);
             }
         } else {
             if (is_null($row->{$field})) {
                 $ret->whereNull($field);
             } else {
                 $ret->whereEquals($field, $row->{$field});
             }
         }
     }
     return $ret;
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:28,代码来源:AutoIncrement.php

示例3: _fetchRedirectUrl

 private function _fetchRedirectUrl($type, $source, $host)
 {
     $s = new Kwf_Model_Select();
     $s->whereEquals('type', $type);
     $source = rtrim($source, '/');
     if ($type == 'domain' || $type == 'domainPath') {
         $sourceWithoutWww = preg_replace('#^www\\.#', '', $source);
         $sources = array($source, 'http://' . $source, $source . '/', 'http://' . $source . '/', $sourceWithoutWww, 'http://' . $sourceWithoutWww, $sourceWithoutWww . '/', 'http://' . $sourceWithoutWww . '/');
         $s->whereEquals('source', $sources);
     } else {
         if (substr($source, 0, 6) == '/media') {
             $parts = explode('/', $source);
             if (isset($parts[6])) {
                 $source = str_replace($parts[6], '%', $source);
             }
             $s->where(new Kwf_Model_Select_Expr_Like('source', $source));
         } else {
             $sources = array($source, $source . '/');
             $s->whereEquals('source', $sources);
         }
     }
     $s->whereEquals('active', true);
     if ($type == 'path') {
         if ($root = Kwf_Component_Data_Root::getInstance()) {
             $domainComponents = $root->getDomainComponents(array('ignoreVisible' => true));
             if (count($domainComponents) > 1) {
                 $path = $root->getComponent()->formatPath(array('host' => $host, 'path' => ''));
                 if (!is_null($path)) {
                     $path = trim($path, '/');
                     $component = $root->getComponent()->getPageByUrl($path, null);
                     if ($component) {
                         $s->whereEquals('domain_component_id', $component->getDomainComponent()->dbId);
                     } else {
                         return null;
                     }
                 } else {
                     return null;
                 }
             }
         }
     }
     $row = $this->getRow($s);
     $target = null;
     if ($row) {
         if ($row->target_type == 'extern') {
             $target = $row->target;
         } else {
             if ($row->target_type == 'intern' || $row->target_type == 'downloadTag') {
                 $c = Kwf_Component_Data_Root::getInstance()->getComponentByDbId($row->target);
                 if ($c) {
                     $target = $c->getAbsoluteUrl();
                 }
             }
         }
     }
     return $target;
 }
开发者ID:koala-framework,项目名称:koala-framework,代码行数:57,代码来源:Redirects.php

示例4: _getRowById

 protected function _getRowById($id)
 {
     if (!$id) {
         return null;
     }
     $s = new Kwf_Model_Select();
     $s->whereEquals($this->_model->getPrimaryKey(), $id);
     $s->whereEquals('component_id', $this->_getParam('componentId'));
     return $this->_model->getRow($s);
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:10,代码来源:Controller.php

示例5: getSettings

 public static function getSettings()
 {
     $ret = parent::getSettings();
     $ret['generators']['content'] = array('class' => 'Kwf_Component_Generator_Static', 'component' => 'Kwc_Newsletter_Detail_Mail_Paragraphs_Component');
     $select = new Kwf_Model_Select();
     $select->whereEquals('unsubscribed', false);
     $select->whereEquals('activated', true);
     $select->order('id', 'ASC');
     $ret['recipientSources'] = array('n' => array('model' => 'Kwc_Newsletter_Subscribe_Model', 'select' => $select));
     $ret['trackViews'] = true;
     return $ret;
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:12,代码来源:Component.php

示例6: importToQueue

 public function importToQueue(Kwf_Model_Abstract $model, Kwf_Model_Select $select)
 {
     $newsletter = $this->getData()->row;
     if (in_array($newsletter->status, array('start', 'stop', 'finished', 'sending'))) {
         throw new Kwf_ClientException(trlKwf('Can only add users to a paused newsletter'));
     }
     $ret = array('rtrExcluded' => array());
     // check if the necessary modelShortcut is set in 'mail' childComponent
     // this function checks if everything neccessary is set
     $this->getData()->getChildComponent('_mail')->getChildComponent('_redirect')->getComponent()->getRecipientModelShortcut(get_class($model));
     if (!$model->hasColumnMappings('Kwc_Mail_Recipient_Mapping')) {
         throw new Kwf_Exception('Model "' . get_class($model) . '" has to implement column mapping "Kwc_Mail_Recipient_Mapping"');
     }
     if ($model->hasColumnMappings('Kwc_Mail_Recipient_UnsubscribableMapping')) {
         $unsubscribeColumn = $model->getColumnMapping('Kwc_Mail_Recipient_UnsubscribableMapping', 'unsubscribed');
         $select->whereEquals($unsubscribeColumn, 0);
     }
     if ($model->hasColumn('activated')) {
         $select->whereEquals('activated', 1);
     }
     $mapping = $model->getColumnMappings('Kwc_Mail_Recipient_Mapping');
     $import = array();
     $emails = array();
     foreach ($model->export(Kwf_Model_Abstract::FORMAT_ARRAY, $select) as $e) {
         $searchArray = array();
         foreach ($e as $k => $field) {
             if ($k == 'firstname' || $k == 'lastname' || $k == 'email') {
                 $searchArray[] = $field;
             }
         }
         $searchText = implode(' ', $searchArray);
         $import[] = array('newsletter_id' => $newsletter->id, 'recipient_model' => get_class($model), 'recipient_id' => $e['id'], 'searchtext' => $searchText);
         $emails[] = $e[$mapping['email']];
     }
     // check against rtr-ecg list
     if (count($emails) && $this->_getSetting('checkRtrList')) {
         $badKeys = Kwf_Util_RtrList::getBadKeys($emails);
         // remove the bad rtr entries from the list
         if ($badKeys) {
             foreach ($badKeys as $badKey) {
                 $ret['rtrExcluded'][] = $emails[$badKey];
                 unset($import[$badKey]);
             }
         }
     }
     // add to model
     $queueModel = $this->getData()->parent->getComponent()->getChildModel()->getDependentModel('Queue');
     $queueModel->import(Kwf_Model_Db::FORMAT_ARRAY, $import, array('ignore' => true));
     return $ret;
 }
开发者ID:koala-framework,项目名称:koala-framework,代码行数:50,代码来源:Component.php

示例7: testWhere

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

示例8: 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

示例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: _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

示例11: 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

示例12: 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

示例13: _subscriptionExists

 protected function _subscriptionExists(Kwc_Newsletter_Subscribe_Row $row)
 {
     if ($row->id) {
         throw new Kwf_Exception("you can only insert unsaved rows");
     }
     $s = new Kwf_Model_Select();
     $s->whereEquals('email', $row->email);
     //what if the email field is not named email?
     $s->whereEquals('newsletter_component_id', $this->getSubscribeToNewsletterComponent()->dbId);
     $s->where(new Kwf_Model_Select_Expr_Or(array(new Kwf_Model_Select_Expr_Equal('unsubscribed', 1), new Kwf_Model_Select_Expr_Equal('activated', 1))));
     if ($row->getModel()->countRows($s)) {
         //already subscribed, don't save
         return true;
     }
     return false;
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:16,代码来源:Component.php

示例14: 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

示例15: 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


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