public function getListeners() { $ret = array(); $processedDirectories = array(); $processedDetails = array(); foreach (Kwc_Abstract::getComponentClasses() as $class) { if (in_array('Kwc_Directories_List_Component', Kwc_Abstract::getParentClasses($class)) || in_array('Kwc_Directories_List_Trl_Component', Kwc_Abstract::getParentClasses($class)) || in_array('Kwc_Directories_List_Cc_Component', Kwc_Abstract::getParentClasses($class))) { if (Kwc_Abstract::hasChildComponentClass($class, 'child', 'view') && $this->_class == Kwc_Abstract::getChildComponentClass($class, 'child', 'view')) { $directoryClasses = call_user_func(array(strpos($class, '.') ? substr($class, 0, strpos($class, '.')) : $class, 'getItemDirectoryClasses'), $class); foreach ($directoryClasses as $directoryClass) { if (in_array($directoryClass, $processedDirectories)) { //add only once continue; } $processedDirectories[] = $directoryClass; foreach (Kwc_Abstract::getChildComponentClasses($directoryClass, 'detail') as $detailClass) { if (in_array($detailClass, $processedDetails)) { //add only once continue; } $processedDetails[] = $detailClass; $ret[] = array('class' => $detailClass, 'event' => 'Kwf_Component_Event_Component_Added', 'callback' => 'onDirectoryDetailAdded'); $ret[] = array('class' => $detailClass, 'event' => 'Kwf_Component_Event_Component_Removed', 'callback' => 'onDirectoryDetailRemoved'); $ret[] = array('class' => $detailClass, 'event' => 'Kwf_Component_Event_Component_HasContentChanged', 'callback' => 'onDirectoryDetailHasContentChanged'); } $ret[] = array('class' => $directoryClass, 'event' => 'Kwc_Directories_List_EventItemUpdated', 'callback' => 'onDirectoryRowUpdate'); $ret[] = array('class' => $directoryClass, 'event' => 'Kwc_Directories_List_EventItemsUpdated', 'callback' => 'onDirectoryModelUpdate'); } } } } return $ret; }
protected function _delete() { $classes = Kwc_Abstract::getChildComponentClasses($this->getTable()->getComponentClass(), 'child'); foreach ($classes as $k => $i) { Kwc_Admin::getInstance($i)->delete($this->component_id . '-' . $k); } }
public function testSlave() { $cc = Kwc_Abstract::getChildComponentClasses('Kwf_Component_ChainedNeedsParentCc_Chained_Component.Kwf_Component_ChainedNeedsParentCc_Master_Component'); $m = Kwc_Abstract::getSetting($cc[0], 'masterComponentClass'); $pc = Kwc_Abstract::getSetting($m, 'parentComponentClass'); $this->assertEquals($pc, 'Kwf_Component_ChainedNeedsParentCc_Master_Component'); }
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); }
protected function _getConfig() { $classes = Kwc_Abstract::getChildComponentClasses($this->_class, 'child'); $config = $this->_getStandardConfig('kwf.tabpanel', null); $config['activeTab'] = 0; $titles = array(); foreach ($classes as $id => $cls) { $c = array_values(Kwc_Admin::getInstance($cls)->getExtConfig()); foreach ($c as $i) { //TODO: hier nicht den titel als index verwenden, das stinkt $componentIdSuffix = '-' . $id; if (isset($i['componentIdSuffix'])) { $componentIdSuffix .= $i['componentIdSuffix']; } $i['componentIdSuffix'] = $componentIdSuffix; if (!isset($titles[$i['title']])) { $titles[$i['title']] = 0; } if ($titles[$i['title']]++ > 0) { $i['title'] .= ' ' . $titles[$i['title']]; } $config['tabs'][$i['title']] = $i; } } return array('tabs' => $config); }
protected function _initColumns() { $this->_model = Kwf_Model_Abstract::getInstance(Kwc_Abstract::getSetting(Kwf_Component_Data_Root::getInstance()->getComponentByDbId($this->_getParam('componentId'))->parent->componentClass, 'childModel'))->getReferencedModel('Order'); $cc = Kwc_Abstract::getChildComponentClasses($this->_getParam('class'), 'payment'); $paymentsFilterData = array(); $payments = array(); foreach ($cc as $k => $c) { $payments[$k] = Kwf_Trl::getInstance()->trlStaticExecute(Kwc_Abstract::getSetting($c, 'componentName')); $paymentsFilterData[] = array($k, $payments[$k]); } $this->_filters['text'] = true; if (count($payments) > 1) { $this->_filters['payment'] = array('type' => 'ComboBox', 'text' => trlKwf('Payment'), 'data' => $paymentsFilterData, 'width' => 100); } $this->_filters['canceled'] = array('type' => 'Button', 'skipWhere' => true, 'cls' => 'x2-btn-text-icon', 'icon' => '/assets/silkicons/stop.png', 'text' => trlKwf('canceled'), 'tooltip' => trlKwf('Show canceled orders')); $this->_filters['shipped'] = array('type' => 'Button', 'skipWhere' => true, 'cls' => 'x2-btn-text-icon', 'icon' => '/assets/silkicons/package.png', 'text' => trlKwf('shipped'), 'tooltip' => trlKwf('Show shipped orders')); $this->_columns->add(new Kwf_Grid_Column('order_number', trlKwf('Order Nr'), 50)); $this->_columns->add(new Kwf_Grid_Column('invoice_number', trlKwf('Invoice Nr'), 50))->setHidden(true); $this->_columns->add(new Kwf_Grid_Column_Datetime('date', trlKwf('Date'))); $this->_columns->add(new Kwf_Grid_Column('firstname', trlKwf('Firstname'), 90)); $this->_columns->add(new Kwf_Grid_Column('lastname', trlKwf('Lastname'), 90)); $this->_columns->add(new Kwf_Grid_Column('country', trlKwf('Country'), 15)); // TODO: Pfusch $this->_columns->add(new Kwf_Grid_Column('sum_amount', trlKwf('Amt'), 30))->setData(new Kwc_Shop_Cart_Checkout_OrdersController_SumAmount())->setSortable(false); $this->_columns->add(new Kwf_Grid_Column('sum_price', trlKwf('Sum'), 50))->setData(new Kwc_Shop_Cart_Checkout_OrdersController_SumPrice())->setSortable(false)->setRenderer('euroMoney'); if (count($payments) > 1) { $this->_columns->add(new Kwf_Grid_Column('payment', trlKwf('Payment'), 80))->setData(new Kwc_Shop_Cart_Checkout_OrdersController_Payment($payments))->setSortable(false); } $this->_columns->add(new Kwf_Grid_Column_Date('payed', trlKwf('Payed'))); if (Kwc_Abstract::getSetting($this->_getParam('class'), 'generateInvoices')) { $this->_columns->add(new Kwf_Grid_Column_Button('invoice', trlcKwf('Invoice', 'IN'))); } $this->_columns->add(new Kwf_Grid_Column_Button('shipped', trlcKwf('Shipped', 'SH')))->setButtonIcon('/assets/silkicons/package_go.png'); $this->_columns->add(new Kwf_Grid_Column('shipped')); }
public final function callModifyItemData(Kwf_Component_Data $item) { foreach (Kwc_Abstract::getChildComponentClasses($this->getData()->componentClass) as $c) { if (Kwc_Abstract::hasSetting($c, 'hasModifyItemData') && Kwc_Abstract::getSetting($c, 'hasModifyItemData')) { call_user_func(array(strpos($c, '.') ? substr($c, 0, strpos($c, '.')) : $c, 'modifyItemData'), $item, $c); } } }
protected function _getComponentClassByRow($row) { $classes = Kwc_Abstract::getChildComponentClasses($this->_componentClass, $this->_generatorKey); if (!$row->getModel()->hasColumn('component') || !$row->component) { return reset($classes); } return $classes[$row->component]; }
public function getListeners() { $ret = parent::getListeners(); foreach (Kwc_Abstract::getChildComponentClasses($this->_class, 'child') as $class) { $ret[] = array('class' => $class, 'event' => 'Kwf_Component_Event_Component_ContentChanged', 'callback' => 'onChildContentChanged'); } return $ret; }
public function testFilename() { $ccc = Kwc_Abstract::getChildComponentClasses('Kwf_Component_Generator_Page_Root', array('filename' => 'home')); $this->assertEquals(2, count($ccc)); $this->assertEquals('Kwc_Basic_None_Component', current($ccc)); $children = $this->_root->getChildComponents(array('filename' => 'home')); $this->assertEquals(1, count($children)); $child = $this->_root->getChildComponent(array('filename' => 'home')); $this->assertEquals('1', $child->componentId); $child = $child->getChildComponent(array('filename' => 'foo')); $this->assertEquals('2', $child->componentId); }
/** * Returns all component classes that can create $createdClass. Optionally filtering instances of $createClass. */ protected function _getCreatingClasses($createdClass, $createClass = null) { $ret = array(); foreach (Kwc_Abstract::getComponentClasses() as $c) { if (!$createClass || in_array($createClass, Kwc_Abstract::getParentClasses($c))) { if (Kwc_Abstract::getChildComponentClasses($c, array('componentClass' => $createdClass))) { $ret[] = $c; } } } return $ret; }
private function _canCreateUsIndirectly($class) { foreach (Kwc_Abstract::getChildComponentClasses($class, array('generatorFlags' => array('static' => true))) as $c) { if ($c == $this->_class) { return true; } if ($this->_canCreateUsIndirectly($c)) { return true; } } return false; }
public function getListeners() { $ret = parent::getListeners(); foreach (Kwc_Abstract::getComponentClasses() as $class) { foreach (Kwc_Abstract::getChildComponentClasses($class) as $childClass) { if ($childClass == $this->_class) { $ret[] = array('class' => $class, 'event' => 'Kwf_Component_Event_ComponentClass_ContentChanged', 'callback' => 'onParentContentChanged'); $ret[] = array('class' => $class, 'event' => 'Kwf_Component_Event_ComponentClass_AllPartialChanged', 'callback' => 'onParentPartialsChanged'); } } } return $ret; }
protected function _initFields() { $this->_form->setModel(Kwf_Model_Abstract::getInstance(Kwc_Abstract::getSetting(Kwf_Component_Data_Root::getInstance()->getComponentByDbId($this->_getParam('componentId'))->parent->componentClass, 'childModel'))->getReferencedModel('Order')); $this->_form->add(new Kwf_Form_Field_ComboBoxText('origin', trlKwf('Origin')))->setValues(array(trlKwf('Internet'), trlKwf('Phone'), trlKwf('Folder'), trlKwf('Fair')))->setShowNoSelection(true); $cc = Kwc_Abstract::getChildComponentClasses($this->_getParam('class'), 'payment'); $payments = array(); foreach ($cc as $k => $c) { $payments[$k] = Kwc_Abstract::getSetting($c, 'componentName'); } if (count($payments) > 1) { $this->_form->add(new Kwf_Form_Field_Select('payment', trlKwf('Payment')))->setValues($payments)->setAllowBlank(false); } $cols = $this->_form->add(new Kwf_Form_Container_Columns()); $col = $cols->add(); $col->add(new Kwf_Form_Field_ShowField('order_number', trlKwf('Order Nr'))); $col = $cols->add(); $col->add(new Kwf_Form_Field_ShowField('customer_number', trlKwf('Customer Nr'))); if (Kwc_Abstract::getSetting($this->_getParam('class'), 'generateInvoices')) { $this->_form->add(new Kwf_Form_Field_ShowField('invoice_number', trlKwf('Invoice Nr'))); $this->_form->add(new Kwf_Form_Field_DateField('invoice_date', trlKwf('Invoice Date'))); } $this->_form->add(new Kwf_Form_Field_DateField('payed', trlKwf('Payed'))); $this->_form->add(new Kwf_Form_Field_ShowField('shipped', trlKwf('Shipped')))->setTpl('{value:localizedDate}'); $this->_form->add(new Kwf_Form_Field_Checkbox('canceled', trlKwf('Canceled'))); $fs = $this->_form->add(new Kwf_Form_Container_FieldSet(trlKwf('Customer'))); $formComponent = Kwc_Abstract::getChildComponentClass($this->_getParam('class'), 'child', 'form'); $formClass = Kwc_Admin::getComponentClass($formComponent, 'FrontendForm'); $customerForm = new $formClass('form', $formComponent); $customerForm->setIdTemplate('{0}'); $customerForm->setModel($this->_form->getModel()); $fs->add($customerForm); unset($customerForm->fields['payment']); foreach ($customerForm->fields as $f) { if ($f->getHideFieldInBackend()) { $customerForm->fields->remove($f); } } $customerForm->fields['email']->setAllowBlank(true); $customerForm->setAllowEmptyCart(true); foreach (Kwc_Abstract::getComponentClasses() as $c) { $g = Kwc_Abstract::getSetting($c, 'generators'); if (isset($g['checkout']) && $g['checkout']['component'] == $this->_getParam('class')) { foreach (Kwc_Abstract::getSetting($c, 'plugins') as $p) { if (is_instance_of($p, 'Kwc_Shop_Cart_Plugins_Interface')) { $p = new $p(); $p->alterBackendOrderForm($this->_form); } } } } }
private static function _findDimensionByChildComponentClassRecursive($class) { $parents = Kwc_Abstract::getSetting($class, 'parentClasses'); if (in_array('Kwc_Basic_ImageEnlarge_EnlargeTag_Component', $parents)) { return Kwc_Abstract::getSetting($class, 'dimension'); } else { foreach (Kwc_Abstract::getChildComponentClasses($class) as $childClass) { $dimension = self::_findDimensionByChildComponentClassRecursive($childClass); if ($dimension) { return $dimension; } } } return false; }
private static function _validateHasNotChildWithStaticHome($cls, array &$validated = array()) { if (isset($validated[$cls])) { return; } $validated[$cls] = true; foreach (Kwf_Component_Generator_Abstract::getOwnInstances($cls) as $g) { if ($g instanceof Kwf_Component_Generator_Page_StaticHome) { throw new Kwf_Exception("'{$cls}' must not have StaticHome, either remove StaticHome, remove category generator or disable hasHome for Category/Generator"); } } foreach (Kwc_Abstract::getChildComponentClasses($cls) as $c) { self::_validateHasNotChildWithStaticHome($c, $validated); } }
protected function _getPluginAdmins() { $lookForPluginClasses = $this->_getPluginParentComponents(); $classes = array(); foreach ($lookForPluginClasses as $c) { $classes = array_merge($classes, Kwc_Abstract::getChildComponentClasses($c)); } $ret = array(); foreach ($classes as $class) { $admin = Kwc_Admin::getInstance($class); if ($admin instanceof Kwc_Directories_Item_Directory_PluginAdminInterface) { $ret[] = $admin; } } return $ret; }
protected function _getConfig($childComponentKey = 'child') { $classes = Kwc_Abstract::getChildComponentClasses($this->_class, 'child'); $ret = array(); foreach ($classes as $id => $cls) { $c = Kwf_Component_Abstract_ExtConfig_Abstract::getInstance($cls)->getConfig(Kwf_Component_Abstract_ExtConfig_Abstract::TYPE_DEFAULT); foreach ($c as $k => $i) { if (!isset($i['componentIdSuffix'])) { $i['componentIdSuffix'] = ''; } $i['componentIdSuffix'] = '-' . $id . $i['componentIdSuffix']; $ret[$id . '-' . $k] = $i; } } return $ret; }
private function _canCreateUsIndirectly($class) { static $cache = array(); if (isset($cache[$class])) { return $cache[$class]; } foreach (Kwc_Abstract::getChildComponentClasses($class) as $c) { if ($c == $this->_class) { $cache[$class] = true; return true; } if ($this->_canCreateUsIndirectly($c)) { return true; } } $cache[$class] = false; return false; }
public function gridColumns() { $ret = parent::gridColumns(); unset($ret['string']); $classes = Kwc_Abstract::getChildComponentClasses($this->_class, 'child'); foreach ($classes as $key => $class) { $columns = Kwc_Admin::getInstance($class)->gridColumns(); foreach ($columns as $k => $column) { $column->setDataIndex($key . '_' . $column->getDataIndex()); $childData = $column->getData(); if ($childData instanceof Kwf_Data_Kwc_ListInterface) { $childData->setSubComponent('-' . $key); $ret[$key . '_' . $k] = $column->setData(new Kwc_Abstract_Composite_ChildData($childData)); } } } return $ret; }
private function _canCreateUsIndirectly($class) { static $cache = array(); $cacheId = $this->_class . '-' . $class; if (isset($cache[$cacheId])) { return $cache[$cacheId]; } foreach (Kwc_Abstract::getChildComponentClasses($class, array('generatorFlags' => array('static' => true))) as $c) { if ($c == $this->_class) { $cache[$cacheId] = true; return true; } if ($this->_canCreateUsIndirectly($c)) { return true; } } $cache[$cacheId] = false; return false; }
public function getTemplateVars(Kwf_Component_Renderer_Abstract $renderer) { $ret = parent::getTemplateVars($renderer); $ret['categories'] = array(); $itemDirectory = $this->_getItemDirectory(); if ($itemDirectory) { $classes = Kwc_Abstract::getChildComponentClasses($itemDirectory->componentClass); foreach ($classes as $c) { if (Kwc_Abstract::hasSetting($c, 'categoryName')) { $name = Kwc_Abstract::getSetting($c, 'categoryName'); $parent = $itemDirectory->getChildComponent(array('componentClass' => $c)); if ($parent) { $ret['categories'][$name] = $this->_getMenuData($parent); } } } } return $ret; }
protected function _getConfig() { $config = $this->_getStandardConfig('kwf.tabpanel', null); $config['activeTab'] = 0; //Link Text $config['tabs']['Link'] = $this->_getStandardConfig('kwf.autoform'); $config['tabs']['Link']['title'] = trlKwf('Link'); $config['tabs']['Link']['componentIdSuffix'] = ''; $classes = Kwc_Abstract::getChildComponentClasses($this->_class, 'child'); $cls = $classes['content']; $c = array_values(Kwc_Admin::getInstance($cls)->getExtConfig()); foreach ($c as $i) { //TODO: hier nicht den titel als index verwenden, das stinkt $componentIdSuffix = '-content'; if (isset($i['componentIdSuffix'])) { $componentIdSuffix .= $i['componentIdSuffix']; } $config['tabs'][$i['title']] = $i; $config['tabs'][$i['title']]['componentIdSuffix'] = $componentIdSuffix; } return array('tabs' => $config); }
protected function _initFields() { $class = $this->_getParam('class'); $this->_form->setModel(Kwc_Abstract::createChildModel($class)); $this->_form->setIdTemplate(null); if (is_instance_of(Kwc_Abstract::getSetting($class, 'extConfig'), 'Kwc_Directories_Item_Directory_ExtConfigTabs') || is_instance_of(Kwc_Abstract::getSetting($class, 'extConfigControllerIndex'), 'Kwc_Directories_Item_Directory_ExtConfigTabs')) { $this->_buttons['save'] = true; } $detailClasses = Kwc_Abstract::getChildComponentClasses($class, 'detail'); $forms = array(); foreach ($detailClasses as $key => $detailClass) { $formClass = Kwc_Admin::getComponentClass($detailClass, 'Form'); $form = new $formClass($key, $detailClass, $class); $form->setIdTemplate('{0}'); $form->setModel(Kwc_Abstract::createChildModel($class)); $forms[$key] = $form; } if (count($forms) == 1) { $this->_form->add(reset($forms)); } else { $cards = $this->_form->add(new Kwf_Form_Container_Cards('component', trlKwf('Type')))->setDefaultValue(reset(array_keys($detailClasses))); $cards->getCombobox()->setWidth(250)->setListWidth(250)->setAllowBlank(false); foreach ($forms as $key => $form) { $card = $cards->add(); $card->add($form); $card->setTitle(Kwf_Trl::getInstance()->trlStaticExecute(Kwc_Abstract::getSetting($form->getClass(), 'componentName'))); $card->setName($key); $card->setNamePrefix($key); } $cards->getCombobox()->getData()->cards = $cards->fields; } $classes = Kwc_Abstract::getChildComponentClasses($class); foreach ($classes as $class) { $formName = Kwc_Admin::getComponentClass($class, 'ItemEditForm'); if ($formName) { $this->_form->add(new $formName('detail', $class, $this->_getParam('componentId'))); } } }
public function _initFields() { $class = $this->_getParam('class'); $this->_form->setModel(Kwc_Abstract::createChildModel($class)); $gen = Kwf_Component_Generator_Abstract::getInstance($this->_getParam('class'), 'detail'); $detailClasses = Kwc_Abstract::getChildComponentClasses($class, 'detail'); $forms = array(); foreach ($detailClasses as $key => $detailClass) { $formClass = Kwc_Admin::getComponentClass($detailClass, 'Form'); $form = new $formClass($key, $detailClass, $class); $form->setIdTemplate('{0}'); $form->setCreateMissingRow(true); $form->setModel($this->_form->getModel()); $forms[$key] = $form; } if (count($forms) == 1) { $this->_form->add(reset($forms)); } else { $cards = $this->_form->add(new Kwf_Form_Container_Cards('component', trlKwf('Type')))->setComboBox(new Kwf_Form_Field_Hidden('component')); $cards->getCombobox()->setWidth(250)->setListWidth(250)->setAllowBlank(false)->setData(new Kwc_Directories_Item_Directory_Trl_FormController_ComponentData('component')); foreach ($forms as $key => $form) { $card = $cards->add(); $card->add($form); $card->setTitle(Kwf_Trl::getInstance()->trlStaticExecute(Kwc_Abstract::getSetting($form->getClass(), 'componentName'))); $card->setName($key); $card->setNamePrefix($key); } $cards->getCombobox()->getData()->cards = $cards->fields; } $classes = Kwc_Abstract::getChildComponentClasses($class); foreach ($classes as $class) { $formName = Kwc_Admin::getComponentClass($class, 'ItemEditForm'); if ($formName) { $this->_form->add(new $formName('detail', $class, $this->_getParam('componentId'))); } } }
private static function _canHaveFulltext($class) { static $cache = array(); if (isset($cache[$class])) { return $cache[$class]; } $cache[$class] = false; if (Kwc_Abstract::getFlag($class, 'skipFulltext')) { return $cache[$class]; //false } if (Kwc_Abstract::getFlag($class, 'hasFulltext')) { $cache[$class] = true; return $cache[$class]; } foreach (Kwc_Abstract::getChildComponentClasses($class, array('pseudoPage' => false)) as $c) { if (self::_canHaveFulltext($c)) { $cache[$class] = true; return $cache[$class]; } } return $cache[$class]; //false }
protected function _getConfig() { $gen = Kwf_Component_Generator_Abstract::getInstance($this->_class, 'detail'); $generators = Kwc_Abstract::getSetting($this->_class, 'generators'); $idTemplate = null; if (isset($generators['detail']['dbIdShortcut'])) { $idTemplate = $generators['detail']['dbIdShortcut'] . '{0}'; } $componentPlugins = array(); foreach ($this->_getAdmin()->getPluginAdmins() as $a) { $plugin = $a->getPluginExtConfig(); if ($plugin) { $componentPlugins[] = $plugin; } } $config = $this->_getStandardConfig('kwc.directories.item.directory'); $detailClasses = Kwc_Abstract::getChildComponentClasses($this->_class, 'detail'); $componentConfigs = array(); $contentEditComponents = array(); foreach ($detailClasses as $type => $detailClass) { $edit = Kwf_Component_Abstract_ExtConfig_Abstract::getEditConfigs($detailClass, $gen, $idTemplate, ''); $componentConfigs = array_merge($componentConfigs, $edit['componentConfigs']); foreach ($edit['contentEditComponents'] as $ec) { $ec['component'] = $type; $contentEditComponents[] = $ec; } } $config['componentConfigs'] = $componentConfigs; $config['contentEditComponents'] = $contentEditComponents; $config['componentPlugins'] = $componentPlugins; $config['needsComponentPanel'] = true; $config['countDetailClasses'] = count($detailClasses); $config['idSeparator'] = $gen->getIdSeparator(); $config['multiFileUpload'] = Kwc_Abstract::getSetting($this->_class, 'multiFileUpload'); return array('items' => $config); }
private function _getPossibleIndirectDbIdShortcutsImpl($class) { if (isset($this->_getPossibleIndirectDbIdShortcutsCache[$class])) { return $this->_getPossibleIndirectDbIdShortcutsCache[$class]; } $ret = array(); $gens = Kwf_Component_Generator_Abstract::getInstances($class); foreach ($gens as $g) { // Do not return page generators // For Page generators the dbIdShortcut is only used for components below the current // page in models if (!$g->getGeneratorFlag('page') && $g->hasSetting('dbIdShortcut') && Kwc_Abstract::getIndirectChildComponentClasses($class, array('componentClass' => $this->_class))) { $ret[] = $g->getSetting('dbIdShortcut'); } } $this->_getPossibleIndirectDbIdShortcutsCache[$class] = $ret; foreach (Kwc_Abstract::getChildComponentClasses($class, array('page' => false)) as $c) { $ret = array_merge($ret, $this->_getPossibleIndirectDbIdShortcutsImpl($c)); } $this->_getPossibleIndirectDbIdShortcutsCache[$class] = $ret; return $ret; }
public function getPayments() { return Kwc_Abstract::getChildComponentClasses($this->getData()->componentClass, 'payment'); }
private static function _getIndirectChildComponentClasses($class, $select, $cacheId) { static $ccc = array(); $currentCacheId = 'iccc-' . md5($class . $cacheId); if (isset($ccc[$class . $cacheId])) { Kwf_Benchmark::count('iccc cache hit'); return $ccc[$class . $cacheId]; } $ret = Kwf_Cache_SimpleStatic::fetch($currentCacheId, $success); if ($success) { $ccc[$class . $cacheId] = $ret; Kwf_Benchmark::count('iccc cache semi-hit'); return $ret; } Kwf_Benchmark::count('iccc cache miss', $class . ' ' . print_r($select->getParts(), true)); $childConstraints = array('page' => false); $ccc[$class . $cacheId] = array(); foreach (Kwc_Abstract::getChildComponentClasses($class, $childConstraints) as $childClass) { if (Kwc_Abstract::getChildComponentClasses($childClass, $select, $cacheId)) { $ccc[$class . $cacheId][] = $childClass; continue; } $classes = Kwc_Abstract::_getIndirectChildComponentClasses($childClass, $select, $cacheId); if ($classes) { $ccc[$class . $cacheId][] = $childClass; } } $ccc[$class . $cacheId] = array_unique(array_values($ccc[$class . $cacheId])); Kwf_Cache_SimpleStatic::add($currentCacheId, $ccc[$class . $cacheId]); return $ccc[$class . $cacheId]; }