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


PHP Kwf_Model_Abstract类代码示例

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


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

示例1: _findAllInstancesProcessModel

 protected static function _findAllInstancesProcessModel(&$ret, $model)
 {
     $model = Kwf_Model_Abstract::getInstance($model);
     if (isset($ret[$model->getFactoryId()])) {
         return;
     }
     $ret[$model->getFactoryId()] = $model;
     if ($model instanceof Kwf_Model_Proxy) {
         self::_findAllInstancesProcessModel($ret, $model->getProxyModel());
     } else {
         if ($model instanceof Kwf_Model_Union) {
             foreach ($model->getUnionModels() as $subModel) {
                 self::_findAllInstancesProcessModel($ret, $subModel);
             }
         }
     }
     foreach ($model->getDependentModels() as $m) {
         self::_findAllInstancesProcessModel($ret, $m);
     }
     foreach ($model->getSiblingModels() as $m) {
         self::_findAllInstancesProcessModel($ret, $m);
     }
     foreach ($model->getReferences() as $rule) {
         $m = $model->getReferencedModel($rule);
         self::_findAllInstancesProcessModel($ret, $m);
     }
 }
开发者ID:koala-framework,项目名称:koala-framework,代码行数:27,代码来源:Abstract.php

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

示例3: processIpn

 public function processIpn(Kwc_Shop_Cart_Checkout_Payment_Wirecard_LogRow $row, $param)
 {
     if ($row->paymentState == 'SUCCESS' || $row->paymentState == 'PENDING') {
         $order = Kwf_Model_Abstract::getInstance(Kwc_Abstract::getSetting($this->getData()->parent->parent->componentClass, 'childModel'))->getReferencedModel('Order')->getRow($param['orderId']);
         if (!$order) {
             throw new Kwf_Exception("Order not found!");
         }
         $order->payment_component_id = $this->getData()->componentId;
         $order->checkout_component_id = $this->getData()->parent->componentId;
         $order->cart_component_class = $this->getData()->parent->parent->componentClass;
         if ($row->paymentState == 'SUCCESS') {
             $order->status = 'payed';
             $order->payed = date('Y-m-d H:i:s');
         }
         if (!$order->confirm_mail_sent) {
             foreach ($this->getData()->parent->parent->getComponent()->getShopCartPlugins() as $p) {
                 $p->orderConfirmed($order);
             }
             foreach ($order->getChildRows('Products') as $p) {
                 $addComponent = Kwf_Component_Data_Root::getInstance()->getComponentByDbId($p->add_component_id);
                 $addComponent->getComponent()->orderConfirmed($p);
             }
             $this->sendConfirmMail($order);
             $order->date = date('Y-m-d H:i:s');
             $order->confirm_mail_sent = date('Y-m-d H:i:s');
         }
         $order->save();
         return true;
     } else {
         throw new Kwf_Exception('Error by processing ipn');
     }
     return false;
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:33,代码来源:Component.php

示例4: alterBackendOrderForm

 public function alterBackendOrderForm(Kwc_Shop_AddToCartAbstract_FrontendForm $form)
 {
     $component = null;
     foreach (Kwc_Abstract::getComponentClasses() as $c) {
         if (is_instance_of($c, 'Kwc_Shop_Products_Directory_Component')) {
             $detailClasses = Kwc_Abstract::getChildComponentClasses($c, 'detail');
             foreach ($detailClasses as $key => $class) {
                 if (Kwc_Abstract::getChildComponentClass($class, 'addToCart') == $this->_class) {
                     $component = $key;
                 }
             }
         }
     }
     $m = Kwf_Model_Abstract::getInstance('Kwc_Shop_Products');
     $s = $m->select();
     $s->whereEquals('visible', 1);
     if ($component) {
         $s->whereEquals('component', $component);
     }
     $s->order('pos');
     $data = array();
     foreach ($m->getRows($s) as $product) {
         $data[] = array($product->current_price_id, $product->__toString() . ' (' . $product->current_price . ' €)');
     }
     $form->prepend(new Kwf_Form_Field_Select('shop_product_price_id', trlKwfStatic('Product')))->setValues($data)->setAllowBlank(false);
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:26,代码来源:OrderProductData.php

示例5: testProxy

 public function testProxy()
 {
     $proxyModel = Kwf_Model_Abstract::getInstance('Kwf_Model_FnF_ProxyFnFExtendedReference_ProxyModel');
     $row = $proxyModel->getRow(1);
     $foo = $row->getParentRow('Parent')->foo;
     $this->assertEquals(5, $foo);
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:7,代码来源:Test.php

示例6: getTemplateVars

 public function getTemplateVars()
 {
     $ret = parent::getTemplateVars();
     $r = Kwf_Model_Abstract::getInstance('Kwf_Component_Cache_CacheTag_Test_Model')->getRow(1);
     $ret['test'] = $r->test;
     return $ret;
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:7,代码来源:Component.php

示例7: updateReferences

 protected function updateReferences(Kwf_Model_Row_Interface $row)
 {
     $m1 = Kwf_Model_Abstract::getInstance('Linkdata');
     $s = $m1->select()->whereEquals('id', $row->subCompanyId);
     $prow = $m1->getRow($s);
     $row->subCompanyName = $prow->value;
 }
开发者ID:nsams,项目名称:aviashelf,代码行数:7,代码来源:StaffController.php

示例8: _initFields

 protected function _initFields()
 {
     $modelName = Kwc_Abstract::getSetting($this->_getParam('class'), 'projectsModel');
     $this->_form->setModel(Kwf_Model_Abstract::getInstance($modelName));
     $this->_form->add(new Kwf_Form_Field_TextField('text', trlKwf('Text')));
     $this->_form->add(new Kwf_Form_Field_Checkbox('visible', trlKwf('Visible')));
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:7,代码来源:ProjectController.php

示例9: testFeed

 public function testFeed()
 {
     Kwf_Component_Cache::setInstance(Kwf_Component_Cache::CACHE_BACKEND_FNF);
     $feed = Kwf_Component_Data_Root::getInstance()->getChildComponent('_feed');
     $xml = $feed->getComponent()->getXml();
     $rows = Kwf_Component_Cache::getInstance()->getModel()->getRows();
     $row = $rows->current();
     $feedRow = Kwf_Model_Abstract::getInstance('Kwc_Basic_Feed_Model')->getRows()->current();
     // XML prüfen
     $this->assertEquals('<?xml', substr($xml, 0, 5));
     $this->assertTrue(strpos($xml, '<rss') !== false);
     $this->assertTrue(strpos($xml, 'testtitle') !== false);
     $this->assertTrue(strpos($xml, 'testdescription') !== false);
     $this->assertTrue(strpos($xml, 'testlink') !== false);
     // Cache-Eintrag prüfen
     $this->assertEquals($xml, $feed->getComponent()->getXml());
     $this->assertEquals(1, count($rows));
     $this->assertEquals($xml, $row->content);
     // Cache-Eintrag ändern um festzustellen, ob eh Cache verwendet wird
     $feedRow->description = 'foo';
     $feedRow->save();
     $this->assertEquals($row->content, $feed->getComponent()->getXml());
     // Cache löschen
     $this->_process();
     $xml = $feed->getComponent()->getXml();
     $this->assertEquals('<?xml', substr($xml, 0, 5));
     $this->assertTrue(strpos($xml, '<rss') !== false);
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:28,代码来源:Test.php

示例10: updateReferences

 protected function updateReferences(Kwf_Model_Row_Interface $row)
 {
     $m2 = Kwf_Model_Abstract::getInstance('Employees');
     $s = $m2->select()->whereEquals('id', $row->responsibleId);
     $prow = $m2->getRow($s);
     $row->responsibleName = (string) $prow;
 }
开发者ID:nsams,项目名称:aviashelf,代码行数:7,代码来源:LandpointController.php

示例11: __construct

 public function __construct($config = array())
 {
     $this->_referenceMap['Image']['refModelClass'] = 'Kwc_ImageResponsive_MediaOutput_Image_UploadsModel';
     $m = Kwf_Model_Abstract::getInstance('Kwc_ImageResponsive_MediaOutput_Image_UploadsModel');
     $config['proxyModel'] = new Kwf_Model_FnF(array('columns' => array(), 'primaryKey' => 'component_id', 'data' => array(array('component_id' => 'root_imageabstract1', 'kwf_upload_id' => $m->uploadId1, 'dimension' => 'default'), array('component_id' => 'root_imageabstract2', 'kwf_upload_id' => $m->uploadId3, 'dimension' => 'default2'))));
     parent::__construct($config);
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:7,代码来源:TestModel.php

示例12: testEvents7

 public function testEvents7()
 {
     $model = Kwf_Model_Abstract::getInstance('Kwf_Component_Events_Table_Model');
     $row = $model->getRow(3);
     $row->delete();
     $this->assertEquals(0, $this->_events->countCalled);
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:7,代码来源:Test.php

示例13: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (!file_exists('bootstrap.php')) {
         throw new \Exception("Run this script in the application root directory");
     }
     \Kwf_Setup::setUp();
     if (file_exists('setup/initial/dump.sql')) {
         unlink('setup/initial/dump.sql');
     }
     if (file_exists('setup/initial/uploads')) {
         foreach (glob('setup/initial/uploads/*') as $f) {
             unlink($f);
         }
     }
     if ($input->getOption('include-initial-dump')) {
         $output->writeln("checking for pending updates...");
         $pendingUpdatesCount = \Kwf_Util_Update_Helper::countPendingUpdates();
         if ($pendingUpdatesCount) {
             throw new \Exception("{$pendingUpdatesCount} Updates have not been executed. Run update first.");
         }
         $output->writeln("creating database dump...");
         $dump = DbDump::dump();
         if (!file_exists('setup/initial')) {
             mkdir('setup/initial', 0777, true);
             $ignore = "";
             if (file_exists('setup/.gitignore')) {
                 $ignore = file_get_contents('setup/.gitignore');
             }
             if (!preg_match('#^initial$#m', $ignore)) {
                 $ignore = rtrim($ignore);
                 if ($ignore) {
                     $ignore .= "\n";
                 }
                 $ignore .= "initial\n";
             }
             file_put_contents('setup/.gitignore', $ignore);
         }
         file_put_contents('setup/initial/dump.sql', $dump);
         $output->writeln("copying uploads...");
         if (!file_exists('setup/initial/uploads')) {
             mkdir('setup/initial/uploads');
         }
         $model = \Kwf_Model_Abstract::getInstance('Kwf_Uploads_Model');
         $select = new \Kwf_Model_Select();
         $it = new \Kwf_Model_Iterator_Packages(new \Kwf_Model_Iterator_Rows($model, $select));
         foreach ($it as $row) {
             $fileSource = $row->getFileSource();
             copy($fileSource, 'setup/initial/uploads/' . basename($fileSource));
         }
     }
     $excludes = ExcludeFinder::findExcludes('.');
     $excludeArgs = '';
     foreach ($excludes as $i) {
         $excludeArgs .= " -x " . escapeshellarg('./' . $i . '*');
     }
     $cmd = "zip deploy.zip . --quiet -r {$excludeArgs}";
     $output->writeln("creating deploy.zip archive...");
     $this->_systemCheckRet($cmd, $input, $output);
     $output->writeln("deploy.zip successfully created.");
 }
开发者ID:koala-framework,项目名称:kwf-deploy,代码行数:60,代码来源:CreateArchiveCommand.php

示例14: testIt

 public function testIt()
 {
     $m = $this->_model;
     $r = $m->getRow(1);
     $this->assertEquals('aaabbbccc', $r->foo);
     $this->assertEquals('abcd', $r->bar);
     $this->assertEquals('aha', $r->baz);
     $r = $m->getRow(2);
     $this->assertEquals('bam', $r->foo);
     $this->assertEquals('bum', $r->bar);
     $this->assertEquals(null, $r->baz);
     $r = $m->getRow($m->select()->whereEquals('baz', 'aha'));
     $this->assertNotNull($r);
     $this->assertEquals(1, $r->id);
     $r = $m->getRow($m->select()->whereNull('baz'));
     $this->assertNotNull($r);
     $this->assertEquals(2, $r->id);
     $r = $m->getRows($m->select()->order('baz'));
     $this->assertEquals(2, count($r));
     $r = $m->createRow();
     $r->foo = 'xxy';
     $r->baz = 'xxz';
     $r->save();
     $tableName = Kwf_Model_Abstract::getInstance('Kwf_Model_DbWithConnection_DbSiblingProxy_DbModel')->getTable()->info(Zend_Db_Table_Abstract::NAME);
     $m = new Kwf_Model_Db(array('table' => $tableName));
     $r = $m->getRow(3);
     $this->assertEquals('xxy', $r->foo);
     $this->assertEquals(null, $r->bar);
     $tableName = Kwf_Model_Abstract::getInstance('Kwf_Model_DbWithConnection_DbSiblingProxy_SiblingModel')->getTable()->info(Zend_Db_Table_Abstract::NAME);
     $m = new Kwf_Model_Db(array('table' => $tableName));
     $r = $m->getRow(3);
     $this->assertEquals('xxz', $r->baz);
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:33,代码来源:Test.php

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


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