예제 #1
0
 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 indexAction()
 {
     Kwf_Util_MemoryLimit::set(1024);
     set_time_limit(0);
     $source = Kwf_Component_Data_Root::getInstance()->getComponentByDbId($this->_getParam('source'), array('ignoreVisible' => true));
     if (!$source) {
         throw new Kwf_Exception_Client("source not found");
     }
     $target = Kwf_Component_Data_Root::getInstance()->getComponentByDbId($this->_getParam('target'), array('ignoreVisible' => true));
     if (!$target) {
         throw new Kwf_Exception_Client("target not found");
     }
     Kwf_Events_ModelObserver::getInstance()->disable();
     //This would be slow as hell. But luckily we can be sure that for the new (duplicated) components there will be no view cache to clear.
     Kwf_Registry::get('db')->beginTransaction();
     echo "counting pages...";
     $steps = Kwc_Admin::getInstance($source->componentClass)->getDuplicateProgressSteps($source);
     echo " " . $steps . "\n";
     $ad = new Zend_ProgressBar_Adapter_Console();
     $ad->setElements(array(Zend_ProgressBar_Adapter_Console::ELEMENT_BAR, Zend_ProgressBar_Adapter_Console::ELEMENT_TEXT, Zend_ProgressBar_Adapter_Console::ELEMENT_ETA));
     $progressBar = new Zend_ProgressBar($ad, 0, $steps);
     Kwc_Admin::getInstance($source->componentClass)->duplicate($source, $target, $progressBar);
     Kwf_Util_Component::afterDuplicate($source, $target);
     $progressBar->finish();
     Kwf_Registry::get('db')->commit();
     exit;
 }
예제 #3
0
 public function __construct($resourceId, $menuConfig = null, $menuUrl = null, Kwf_Component_Data $component = null)
 {
     if ($resourceId instanceof Kwf_Component_Data) {
         $component = $resourceId;
         $resourceId = 'kwc_' . $component->dbId;
     } else {
         if (!$component) {
             throw new Kwf_Exception("component parameter is required");
         }
     }
     $this->_component = $component;
     if (!$menuConfig) {
         if (Kwc_Abstract::hasSetting($this->_class, 'componentNameShort')) {
             $name = Kwc_Abstract::getSetting($this->_class, 'componentNameShort');
         } else {
             $name = Kwc_Abstract::getSetting($this->_class, 'componentName');
         }
         $icon = Kwc_Abstract::getSetting($component->componentClass, 'componentIcon');
         $menuConfig = array('text' => trlKwfStatic('Edit {0}', $name), 'icon' => $icon);
     }
     if (!$menuUrl) {
         $menuUrl = Kwc_Admin::getInstance($component->componentClass)->getControllerUrl() . '?componentId=' . $component->dbId;
     }
     parent::__construct($resourceId, $menuConfig, $menuUrl);
 }
 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);
 }
예제 #5
0
 public function addResources(Kwf_Acl $acl)
 {
     parent::addResources($acl);
     $name = Kwc_Abstract::getSetting($this->_class, 'componentName');
     $icon = Kwc_Abstract::getSetting($this->_class, 'componentIcon');
     $acl->add(new Kwf_Acl_Resource_ComponentClass_MenuUrl($this->_class, array('text' => $name, 'icon' => $icon), Kwc_Admin::getInstance($this->_class)->getControllerUrl()), 'kwf_component_root');
 }
 protected function _initColumns()
 {
     $this->_columns->add(new Kwf_Grid_Column('id'));
     $this->_columns->add(new Kwf_Grid_Column('name'));
     if ($this->_getParam('id')) {
         $subRootComponentId = $this->_getParam('id');
     } else {
         if ($this->_getParam('parent_id')) {
             $subRootComponentId = $this->_getParam('parent_id');
         } else {
             if ($this->_getParam('componentId')) {
                 $subRootComponentId = $this->_getParam('componentId');
             } else {
                 throw new Kwf_Exception("componentId, id or parent_id required");
             }
         }
     }
     $data = array();
     $gen = Kwc_Abstract::getSetting($this->_getParam('class'), 'generators');
     foreach ($gen['child']['component'] as $name => $class) {
         if (!$class) {
             continue;
         }
         $admin = Kwc_Admin::getInstance($class);
         $forms = $admin->getCardForms();
         foreach ($admin->getVisibleCardForms($subRootComponentId) as $k) {
             $id = count($forms) == 1 ? $name : $name . '_' . $k;
             $data[] = array('id' => $id, 'name' => $forms[$k]['title']);
         }
     }
     $this->_model = new Kwf_Model_FnF(array('data' => $data));
     parent::_initColumns();
 }
예제 #7
0
 protected function _delete()
 {
     $componentClass = $this->getTable()->getComponentClass();
     $class = Kwc_Abstract::getChildComponentClass($componentClass, 'child');
     $admin = Kwc_Admin::getInstance($class);
     $admin->delete($this->component_id . '-' . $this->id);
 }
 public function indexAction()
 {
     parent::indexAction();
     $cfg = Kwc_Admin::getInstance($this->_getParam('class'))->getExtConfig();
     $this->view->assign($cfg['grid']);
     unset($this->view->title);
 }
예제 #9
0
 public function getTemplateVars(Kwf_Component_Renderer_Abstract $renderer)
 {
     $ret = parent::getTemplateVars($renderer);
     $ret['paypalButton'] = $this->_getPaypalButton();
     $ret['options'] = array('controllerUrl' => Kwc_Admin::getInstance($this->getData()->componentClass)->getControllerUrl() . '/json-confirm-order', 'params' => array('paymentComponentId' => $this->getData()->parent->componentId));
     return $ret;
 }
예제 #10
0
 public function addResources(Kwf_Acl $acl)
 {
     if (!$acl->has('kwc_shop')) {
         $acl->add(new Kwf_Acl_Resource_MenuDropdown('kwc_shop', array('text' => trlKwfStatic('Shop'), 'icon' => 'cart.png')), 'kwf_component_root');
     }
     $acl->add(new Kwf_Acl_Resource_ComponentClass_MenuUrl($this->_class, array('text' => trlKwfStatic('Vouchers'), 'icon' => 'application_view_list.png'), Kwc_Admin::getInstance($this->_class)->getControllerUrl('Vouchers')), 'kwc_shop');
 }
 public function load($row, array $info = array())
 {
     $gen = Kwf_Component_Generator_Abstract::getInstance($this->_componentClass, $this->_generatorKey);
     $edit = Kwf_Component_Abstract_ExtConfig_Abstract::getEditConfigs($this->_getComponentClassByRow($row), $gen, '{componentId}-{0}', '');
     $this->_componentConfigs = array_merge($this->_componentConfigs, $edit['componentConfigs']);
     $ret = $edit['contentEditComponents'];
     $g = Kwc_Abstract::getSetting($this->_componentClass, 'generators');
     if (isset($g['detail']['dbIdShortcut'])) {
         $dbId = $g['detail']['dbIdShortcut'] . $row->id;
     } else {
         $dbId = $row->component_id . $gen->getIdSeparator() . $row->id;
     }
     $components = Kwf_Component_Data_Root::getInstance()->getComponentsByDbId($dbId, array('ignoreVisible' => true));
     if (isset($components[0])) {
         foreach (Kwf_Controller_Action_Component_PagesController::getSharedComponents($components[0]) as $cls => $cmp) {
             $cfg = Kwc_Admin::getInstance($cls)->getExtConfig(Kwf_Component_Abstract_ExtConfig_Abstract::TYPE_SHARED);
             foreach ($cfg as $k => $c) {
                 if (!isset($this->_componentConfigs[$cls . '-' . $k])) {
                     $this->_componentConfigs[$cls . '-' . $k] = $c;
                 }
                 $ret[] = array('componentClass' => $cls, 'type' => $k, 'idTemplate' => '{componentId}-{0}', 'componentIdSuffix' => '');
             }
         }
     }
     return $ret;
 }
예제 #12
0
 public function getTemplateVars()
 {
     $ret = parent::getTemplateVars();
     $ret['wirecardButton'] = $this->_getWirecardButton();
     $ret['options'] = array('controllerUrl' => Kwc_Admin::getInstance(get_class($this))->getControllerUrl() . '/json-confirm-order', 'params' => array('paymentComponentId' => $this->getData()->parent->componentId));
     return $ret;
 }
예제 #13
0
 public function preDispatch()
 {
     $this->setModel(new Kwc_Directories_Item_Directory_Trl_AdminModel(array('proxyModel' => Kwc_Abstract::createChildModel(Kwc_Abstract::getSetting($this->_getParam('class'), 'masterComponentClass')), 'trlModel' => Kwc_Abstract::createChildModel($this->_getParam('class')))));
     parent::preDispatch();
     $url = Kwc_Admin::getInstance($this->_getParam('class'))->getControllerUrl('Form');
     $this->_editDialog['controllerUrl'] = $url;
 }
 protected function _initColumns()
 {
     $this->_editDialog = array('controllerUrl' => Kwc_Admin::getInstance($this->_getParam('class'))->getControllerUrl('OrderProduct'), 'width' => 400, 'height' => 250);
     $this->_columns->add(new Kwf_Grid_Column('product', trlKwf('Product')))->setData(new Kwc_Shop_Cart_Checkout_ProductData_ProductText());
     $this->_columns->add(new Kwf_Grid_Column('amount', trlKwf('Amount'), 50))->setData(new Kwc_Shop_Cart_Checkout_ProductData_Amount());
     $this->_columns->add(new Kwf_Grid_Column('info', trlKwf('Info'), 150))->setData(new Kwc_Shop_Cart_Checkout_ProductData_Info());
     $this->_columns->add(new Kwf_Grid_Column('price', trlKwf('Price'), 50))->setData(new Kwc_Shop_Cart_Checkout_ProductData_Price())->setRenderer('money');
 }
예제 #15
0
 protected function _initColumns()
 {
     $c = Kwc_Abstract::getChildComponentClass($this->_getParam('class'), 'child');
     foreach (Kwc_Admin::getInstance($c)->gridColumns() as $i) {
         $this->_columns->add($i);
     }
     $this->_columns->add(new Kwf_Grid_Column_Visible());
 }
예제 #16
0
 public function indexAction()
 {
     $config = Kwc_Admin::getInstance($this->_getParam('class'))->getExtConfig();
     $config = $config['customerarea'];
     $config['baseParams']['componentId'] = $this->_getParam('componentId');
     $this->view->assign($config);
     $this->view->baseParams = array('componentId' => $this->_getParam('componentId'));
 }
예제 #17
0
 public function componentToString(Kwf_Component_Data $data)
 {
     $data = $data->getChildComponent('-child');
     if (!$data) {
         return '';
     }
     return Kwc_Admin::getInstance($data->componentClass)->componentToString($data);
 }
예제 #18
0
 protected function _delete()
 {
     $class = Kwc_Abstract::getChildComponentClass($this->getTable()->getComponentClass(), null, $this->component);
     $admin = Kwc_Admin::getInstance($class);
     if ($admin) {
         $admin->delete($this->component_id . '-child');
     }
 }
예제 #19
0
 protected function _getConfig()
 {
     $config = $this->_getStandardConfig('kwc.advanced.downloadstree');
     $config['projectsUrl'] = Kwc_Admin::getInstance($this->_class)->getControllerUrl('Projects');
     $config['projectUrl'] = Kwc_Admin::getInstance($this->_class)->getControllerUrl('Project');
     $config['downloadsUrl'] = Kwc_Admin::getInstance($this->_class)->getControllerUrl('Downloads');
     return array('customerarea' => $config);
 }
예제 #20
0
 public static function duplicated(Kwf_Component_Data $source, Kwf_Component_Data $new)
 {
     $chained = Kwf_Component_Data_Root::getInstance()->getComponentsByClass('Kwc_Root_TrlRoot_Chained_Component', array('ignoreVisible' => true));
     //bySameClass wenn fkt nicht mehr static (todo oben erledigt)
     $sourceChained = array();
     foreach ($chained as $c) {
         $subRootAboveTrl = $c;
         //eg. domain
         while ($subRootAboveTrl = $subRootAboveTrl->parent) {
             if (Kwc_Abstract::getFlag($subRootAboveTrl->componentClass, 'subroot')) {
                 break;
             }
         }
         if (!$subRootAboveTrl) {
             $subRootAboveTrl = Kwf_Component_Data_Root::getInstance();
         }
         $d = $source;
         while ($d = $d->parent) {
             if ($d->componentId == $subRootAboveTrl->componentId) {
                 $sourceChained[$c->getLanguage()] = $c;
             }
         }
     }
     $targetChained = array();
     foreach ($chained as $c) {
         $subRootAboveTrl = $c;
         //eg. domain
         while ($subRootAboveTrl = $subRootAboveTrl->parent) {
             if (Kwc_Abstract::getFlag($subRootAboveTrl->componentClass, 'subroot')) {
                 break;
             }
         }
         if (!$subRootAboveTrl) {
             $subRootAboveTrl = Kwf_Component_Data_Root::getInstance();
         }
         $d = $new;
         while ($d = $d->parent) {
             if ($d->componentId == $subRootAboveTrl->componentId) {
                 if (isset($sourceChained[$c->getLanguage()])) {
                     //only if there is a source language
                     $targetChained[] = array('targetChained' => $c, 'sourceChained' => $sourceChained[$c->getLanguage()]);
                 }
             }
         }
     }
     foreach ($targetChained as $c) {
         $sourceChained = Kwc_Chained_Trl_Component::getChainedByMaster($source, $c['sourceChained'], array('ignoreVisible' => true));
         $newChained = Kwc_Chained_Trl_Component::getChainedByMaster($new, $c['targetChained'], array('ignoreVisible' => true));
         if (!$sourceChained || $source->componentId == $sourceChained->componentId) {
             continue;
             //wenn sourceChained nicht gefunden handelt es sich zB um ein MasterAsChild - was ignoriert werden muss
         }
         if (!$newChained) {
             throw new Kwf_Exception("can't find chained components");
         }
         Kwc_Admin::getInstance($newChained->componentClass)->duplicate($sourceChained, $newChained);
     }
 }
 public function indexAction()
 {
     parent::indexAction();
     $formControllerUrl = Kwc_Admin::getInstance($this->_getParam('class'))->getControllerUrl('Recipient');
     $this->view->formControllerUrl = $formControllerUrl;
     $this->view->xtype = 'kwc.newsletter.subscribe.recipients';
     $this->view->model = get_class($this->_model);
     $this->view->baseParams = array('newsletterComponentId' => $this->_getParam('newsletterComponentId'));
 }
예제 #22
0
 public function indexAction()
 {
     parent::indexAction();
     $this->view->assign(Kwc_Admin::getInstance($this->_getParam('class'))->getExtConfig());
     $this->view->baseParams = array('id' => $this->_getParam('componentId'), 'componentId' => $this->_getParam('componentId'));
     if ($this->getRequest()->module == 'component_test' && isset($this->view->controllerUrl)) {
         $this->view->controllerUrl = str_replace('/admin/component/edit/', '/kwf/componentedittest/' . Kwf_Component_Data_Root::getComponentClass() . '/', $this->view->controllerUrl);
     }
 }
예제 #23
0
 protected function _getOptions()
 {
     $ret['componentId'] = $this->getData()->dbId;
     $ret['projectsUrl'] = Kwc_Admin::getInstance(get_class($this))->getControllerUrl('ViewProjects');
     $ret['downloadsUrl'] = Kwc_Admin::getInstance(get_class($this))->getControllerUrl('ViewDownloads');
     $ret['width'] = $this->_getSetting('panelWidth');
     $ret['height'] = $this->_getSetting('panelHeight');
     return $ret;
 }
 public function preDispatch()
 {
     if (!isset($this->_model) && !isset($this->_tableName)) {
         $this->setModel(Kwc_Abstract::createChildModel($this->_getParam('class')));
     }
     parent::preDispatch();
     $url = Kwc_Admin::getInstance($this->_getParam('class'))->getControllerUrl('Comment');
     $this->_editDialog['controllerUrl'] = $url;
 }
예제 #25
0
 public function testDependsOnRow()
 {
     $delRow = $this->_root->getGenerator('page')->getModel()->getRow(1310);
     $a = Kwc_Admin::getInstance('Kwc_Basic_LinkTagIntern_TestComponent');
     $depends = $a->getComponentsDependingOnRow($delRow);
     $this->assertEquals(1, count($depends));
     $depend = current($depends);
     $this->assertEquals($this->_root->getComponentById(1300)->componentId, $depend->componentId);
 }
 public function load($row)
 {
     $admin = Kwc_Admin::getInstance($row->content_component_class);
     $ret = array();
     foreach ($admin->getExtConfig() as $k => $cfg) {
         $ret[] = array('componentClass' => $row->content_component_class, 'type' => $k);
     }
     return $ret;
 }
예제 #27
0
 protected function _beforeDelete()
 {
     parent::_beforeDelete();
     // Dranhängende Komponente löschen
     $generators = Kwf_Component_Data_Root::getInstance()->getPageGenerators();
     foreach ($generators as $generator) {
         $class = Kwc_Abstract::getChildComponentClass($generator->getClass(), null, $this->component);
         Kwc_Admin::getInstance($class)->delete($this->id);
     }
 }
예제 #28
0
 public function setAssetsPackage(Kwf_Assets_Package $package)
 {
     $t = Kwf_Model_Abstract::getInstance(Kwc_Abstract::getSetting($this->getClass(), 'stylesModel'));
     $urls = $package->getPackageUrls('text/css', Kwf_Trl::getInstance()->getTargetLanguage());
     $styleEditorUrl = Kwc_Admin::getInstance($this->getClass())->getControllerUrl() . '/styles-content';
     $styleEditorUrl .= '?t=' . $t->getMTime();
     $urls[] = $styleEditorUrl;
     $this->fields['content']->setStylesCssFile($styleEditorUrl);
     $this->fields['content']->setCssFiles($urls);
 }
예제 #29
0
 public function testDependsOnRow()
 {
     $eventsComponent = $this->_root->getComponentById(3100);
     $eventsModel = $eventsComponent->getGenerator('detail')->getModel();
     $delRow = $eventsModel->getRow(601);
     $a = Kwc_Admin::getInstance('Kwc_Basic_LinkTagEvent_TestComponent');
     $depends = $a->getComponentsDependingOnRow($delRow);
     $this->assertEquals(1, count($depends));
     $depend = current($depends);
     $this->assertEquals($this->_root->getComponentById(6100)->componentId, $depend->componentId);
 }
예제 #30
0
 public function getTemplateVars(Kwf_Component_Renderer_Abstract $renderer)
 {
     $ret = parent::getTemplateVars($renderer);
     $ret['favouriteText'] = $this->_getPlaceholder('saveFavourite');
     $ret['config'] = array('componentId' => $this->getData()->componentId, 'controllerUrl' => Kwc_Admin::getInstance($this->getData()->componentClass)->getControllerUrl(), 'deleteFavourite' => $this->_getPlaceholder('deleteFavourite'), 'saveFavourite' => $this->_getPlaceholder('saveFavourite'));
     $ret['linkType'] = $this->_getSetting('linkType');
     if ($ret['linkType'] == self::LINK_TYPE_GRAPHICAL) {
         $ret['rootElementClass'] .= ' kwfSwitchHoverFade';
     }
     return $ret;
 }