本文整理汇总了PHP中Kwc_Admin::getComponentClass方法的典型用法代码示例。如果您正苦于以下问题:PHP Kwc_Admin::getComponentClass方法的具体用法?PHP Kwc_Admin::getComponentClass怎么用?PHP Kwc_Admin::getComponentClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kwc_Admin
的用法示例。
在下文中一共展示了Kwc_Admin::getComponentClass方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _initForm
protected function _initForm()
{
if (!isset($this->_form)) {
$formClass = Kwc_Admin::getComponentClass($this, 'FrontendForm');
$this->_form = new $formClass('form', $this->getData()->componentClass);
}
}
示例2: _initForm
protected function _initForm()
{
$formClass = Kwc_Admin::getComponentClass($this, 'FrontendForm');
$this->_form = new $formClass('form', $this->getData()->componentClass, null);
if ($this->_recipient) {
$this->_form->setId($this->_recipient->id);
}
}
示例3: _initFields
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);
}
}
}
}
}
示例4: createChainedGenerator
public static function createChainedGenerator($class, $key, $prefix)
{
$generators = Kwc_Abstract::getSetting($class, 'generators');
$g = $generators[$key];
if (!isset($g['class'])) {
throw new Kwf_Exception("generator class is not set for component '{$class}' generator '{$key}'");
}
if (!is_array($g['component'])) {
$g['component'] = array($key => $g['component']);
}
foreach ($g['component'] as &$c) {
if (!$c) {
continue;
}
$masterC = $c;
if (is_instance_of($c, 'Kwc_Chained_CopyPages_Component') || is_instance_of($c, 'Kwc_Chained_CopyPages_Cc_Component')) {
continue;
}
$c = self::getChainedComponentClass($c, $prefix);
$g['masterComponentsMap'][$masterC] = $c;
// Für jede Unterkomponente mit einer AlternativeComponent muss es auch einen Eintrag in der masterComponentsMap geben
if (Kwc_Abstract::getFlag($masterC, 'hasAlternativeComponent')) {
$masterCCls = strpos($masterC, '.') ? substr($masterC, 0, strpos($masterC, '.')) : $masterC;
$alternativeComponents = call_user_func(array($masterCCls, 'getAlternativeComponents'), $masterC);
foreach ($alternativeComponents as $alternativeComponent) {
$g['masterComponentsMap'][$alternativeComponent] = self::getChainedComponentClass($alternativeComponent, $prefix);
}
}
}
$g['chainedGenerator'] = $g['class'];
$g['class'] = "Kwc_Chained_{$prefix}_Generator";
if (isset($g['dbIdShortcut'])) {
unset($g['dbIdShortcut']);
}
if (isset($g['plugins'])) {
foreach ($g['plugins'] as $pKey => $plugin) {
$pc = Kwc_Admin::getComponentClass($plugin, "{$prefix}_Component");
if ($pc != $plugin) {
$g['plugins'][$pKey] = $pc;
} else {
unset($g['plugins'][$pKey]);
// generator-plugins in Translation only if there is an translated plugin available
}
}
}
if (isset($g['model'])) {
unset($g['model']);
}
return $g;
}
示例5: getControllerClass
public function getControllerClass(Zend_Controller_Request_Abstract $request)
{
$module = $request->getModuleName();
if ($module == 'component' && $request->getControllerName() == 'component' || $module == 'component_test' && $request->getControllerName() == 'component_test') {
if ($module == 'component_test') {
//FnF models setzen damit tests nicht in echte tabellen schreiben
Kwf_Component_Cache::setInstance(Kwf_Component_Cache::CACHE_BACKEND_FNF);
Kwf_Test_SeparateDb::setDbFromCookie();
// setzt es nur wenn es das cookie wirklich gibt
if (!Kwf_Loader::isValidClass($request->getParam('root'))) {
throw new Kwf_Exception_NotFound("Invalid root component");
}
Kwf_Component_Data_Root::setComponentClass($request->getParam('root'));
$root = Kwf_Component_Data_Root::getInstance();
$root->setFilename('kwf/kwctest/' . $request->getParam('root'));
Kwf_Registry::get('acl')->getComponentAcl()->allowComponent('guest', null);
//hick hack, für Kwf_Component_Abstract_Admin::getControllerUrl
Zend_Registry::set('testRootComponentClass', $request->getParam('root'));
}
$class = $request->getParam('class');
$controller = $request->getParam('componentController');
$controller .= 'Controller';
if ($controller == 'IndexController') {
$controller = 'Controller';
}
if (($pos = strpos($class, '!')) !== false) {
$controller = substr($class, $pos + 1) . 'Controller';
$class = substr($class, 0, $pos);
}
if (!in_array($class, Kwc_Abstract::getComponentClasses())) {
//unknown component class
return false;
}
$className = Kwc_Admin::getComponentClass($class, $controller);
if (!$className) {
return false;
}
class_exists($className);
//trigger autoloader
} else {
$className = parent::getControllerClass($request);
}
return $className;
}
示例6: createComponentForm
/**
* @return Kwc_Abstract_Form
**/
public static function createComponentForm($componentClass, $name = null)
{
// Es wurde ein dbIdTemplate angegeben
if (!in_array($componentClass, Kwc_Abstract::getComponentClasses())) {
return self::createComponentFormByDbIdTemplate($componentClass);
}
$formClass = Kwc_Admin::getComponentClass($componentClass, 'Form');
if (!$formClass || $formClass == 'Kwc_Abstract_Form') {
return null;
}
if (!$name) {
$name = $componentClass;
}
$form = new $formClass($name, $componentClass);
if ($form instanceof Kwc_Abstract_FormEmpty) {
return null;
}
return $form;
}
示例7: _initFields
protected function _initFields()
{
parent::_initFields();
$cards = $this->_form->add(new Kwf_Form_Container_Cards('add_component_class', trlKwf('Type')));
foreach (Kwc_Abstract::getComponentClasses() as $c) {
if (is_instance_of($c, 'Kwc_Shop_AddToCartAbstract_Component')) {
$card = $cards->add();
$card->setName($c);
$card->setTitle(Kwc_Abstract::getSetting($c, 'productTypeText'));
$formClass = Kwc_Admin::getComponentClass($c, 'FrontendForm');
$form = new $formClass($c, $c);
$form->setModel(Kwf_Model_Abstract::getInstance('Kwc_Shop_Cart_OrderProducts'));
$form->setIdTemplate('{0}');
Kwc_Shop_AddToCartAbstract_OrderProductData::getInstance($c)->alterBackendOrderForm($form);
$card->add($form);
}
}
$cards->setAllowBlank(false);
}
示例8: _getSubscribersFromComponent
private static function _getSubscribersFromComponent($componentClass)
{
$subscribers = array();
$eventsClass = Kwc_Admin::getComponentClass($componentClass, 'Events');
$subscribers[] = Kwf_Component_Abstract_Events::getInstance($eventsClass, array('componentClass' => $componentClass));
foreach (Kwc_Abstract::getSetting($componentClass, 'generators') as $generatorKey => $null) {
$generator = current(Kwf_Component_Generator_Abstract::getInstances($componentClass, array('generator' => $generatorKey)));
$eventsClass = $generator->getEventsClass();
if ($eventsClass) {
$subscribers[] = Kwf_Component_Generator_Events::getInstance($eventsClass, array('componentClass' => $componentClass, 'generatorKey' => $generatorKey));
}
}
if (Kwc_Abstract::hasSetting($componentClass, 'menuConfig')) {
$mc = Kwf_Component_Abstract_MenuConfig_Abstract::getInstance($componentClass);
$eventsClass = $mc->getEventsClass();
if ($eventsClass) {
$subscribers[] = Kwf_Component_Abstract_MenuConfig_Events::getInstance($eventsClass, array('componentClass' => $componentClass));
}
}
return $subscribers;
}
示例9: _initFields
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')));
}
}
}
示例10: _initFields
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')));
}
}
}
示例11: pdfAction
public function pdfAction()
{
$id = $this->_getParam('id');
if (!$id) {
throw new Kwf_Exception("No id given");
}
$order = $this->_model->getRow($id);
if (!$order->invoice_date) {
$order->invoice_date = date('Y-m-d');
}
if (!$order->invoice_number) {
$order->generateInvoiceNumber();
}
$order->save();
$cls = Kwc_Admin::getComponentClass($this->_getParam('class'), 'InvoicePdf');
$pdf = new $cls($order);
Kwf_Media_Output::output(array('contents' => $pdf->output('', 'S'), 'mimeType' => 'application/pdf', 'downloadFilename' => $order->order_number . '.pdf'));
}