Пример #1
0
 public function getTemplateVars()
 {
     $ret = parent::getTemplateVars();
     $language = $this->getData()->getLanguage();
     $ret['dynamicPlaceholder'] = '{dynamicContent ' . $this->getData()->componentClass . ' ' . $language . '}';
     return $ret;
 }
Пример #2
0
 public function getTemplateVars(Kwf_Component_Renderer_Abstract $renderer = null)
 {
     $ret = parent::getTemplateVars($renderer);
     $ret['test2'] = $this->getData()->parent->getChildComponent('_test2');
     $ret['test3'] = $this->getData()->parent->getChildComponent('_test3');
     return $ret;
 }
Пример #3
0
 private function _getAllLanguages()
 {
     $config = Zend_Registry::get('config');
     $langs = array();
     if ($config->webCodeLanguage) {
         $langs[] = $config->webCodeLanguage;
     }
     if ($config->languages) {
         foreach ($config->languages as $lang => $name) {
             $langs[] = $lang;
         }
     }
     if (Kwf_Component_Data_Root::getComponentClass()) {
         foreach (Kwc_Abstract::getComponentClasses() as $c) {
             if (Kwc_Abstract::getFlag($c, 'hasAvailableLanguages')) {
                 foreach (call_user_func(array($c, 'getAvailableLanguages'), $c) as $i) {
                     if (!in_array($i, $langs)) {
                         $langs[] = $i;
                     }
                 }
             }
         }
     }
     $langs = array_unique($langs);
     return $langs;
 }
Пример #4
0
 public static function getAllChainedByMasterFromChainedStart($componentClass, $master, $chainedType, $parentDataSelect = array())
 {
     if (Kwc_Abstract::getFlag($componentClass, 'chainedType') != $chainedType) {
         return array();
     }
     $ret = array();
     foreach (Kwf_Component_Data_Root::getInstance()->getComponentsByClass($componentClass, $parentDataSelect) as $chainedStart) {
         //if additional subroots are above trl subroot (eg. domains)
         if ($sr = $chainedStart->parent->getSubroot()) {
             $masterSr = $master;
             while (Kwc_Abstract::getFlag($masterSr->componentClass, 'chainedType') != $chainedType) {
                 $masterSr = $masterSr->parent;
                 if (!$masterSr) {
                     continue 2;
                 }
             }
             if ($masterSr->parent && $sr != $masterSr->parent->getSubroot()) {
                 continue;
             }
         }
         $i = Kwc_Chained_Abstract_Component::getChainedByMaster($master, $chainedStart, $chainedType, $parentDataSelect);
         if ($i) {
             $ret[] = $i;
         }
     }
     return $ret;
 }
Пример #5
0
 public function getTemplateVars()
 {
     $ret = parent::getTemplateVars();
     $feeds = Kwf_Component_Data_Root::getInstance()->getComponentsByClass('Kwc_Abstract_Feed_Component', array('subroot' => $this->getData()));
     $ret['feeds'] = $feeds;
     return $ret;
 }
Пример #6
0
 public function componentWithMaster(array $componentWithMaster)
 {
     $last = array_pop($componentWithMaster);
     $component = $last['data'];
     if ($last['type'] == 'master') {
         $innerComponent = $componentWithMaster[0]['data'];
         $vars = $component->getComponent()->getMasterTemplateVars($innerComponent, $this->_getRenderer());
         $vars['componentWithMaster'] = $componentWithMaster;
         if (Kwc_Abstract::hasSetting($component->componentClass, 'masterTemplate')) {
             $masterTemplate = Kwc_Abstract::getSetting($component->componentClass, 'masterTemplate');
         } else {
             $masterTemplate = $this->_getRenderer()->getTemplate($component, 'Master');
         }
         if (substr($masterTemplate, -4) == '.tpl') {
             $view = new Kwf_Component_View($this->_getRenderer());
             $view->assign($vars);
             $ret = $view->render($masterTemplate);
         } else {
             $twig = new Kwf_Component_Renderer_Twig_Environment($this->_getRenderer());
             $ret = $twig->render($masterTemplate, $vars);
         }
         $ret = $this->_replaceKwfUp($ret);
         return $ret;
     } else {
         if ($last['type'] == 'component') {
             $helper = new Kwf_Component_View_Helper_Component();
             $helper->setRenderer($this->_getRenderer());
             return '<div class="kwfMainContent">' . "\n    " . $helper->component($component) . "\n" . '</div>' . "\n";
         } else {
             throw new Kwf_Exception("invalid type");
         }
     }
 }
 public function sendContent($includeMaster)
 {
     $data = $this->_data->getChildComponent('-child');
     $contentSender = Kwc_Abstract::getSetting($data->componentClass, 'contentSender');
     $contentSender = new $contentSender($data);
     $contentSender->sendContent($includeMaster);
 }
 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')));
 }
Пример #9
0
 protected function _initFields()
 {
     parent::_initFields();
     $showDirectoryClass = Kwc_Abstract::getSetting($this->getClass(), 'showDirectoryClass');
     $hideDirectoryClasses = Kwc_Abstract::getSetting($this->getClass(), 'hideDirectoryClasses');
     $cards = $this->add(new Kwf_Form_Container_Cards('source_component_id', trlKwf('Directory')));
     $defaultCard = null;
     $categories = Kwf_Component_Data_Root::getInstance()->getComponentsByClass('Kwc_Directories_Category_Directory_Component');
     foreach ($categories as $category) {
         $itemDirectory = $category->parent;
         if (is_instance_of($itemDirectory->componentClass, $showDirectoryClass)) {
             foreach ($hideDirectoryClasses as $c) {
                 if (is_instance_of($itemDirectory->componentClass, $c)) {
                     continue 2;
                 }
             }
             $categoriesModel = $category->getComponent()->getChildModel();
             $select = $categoriesModel->select()->whereEquals('component_id', $category->componentId);
             $values = array();
             foreach ($categoriesModel->getRows($select) as $row) {
                 $values[$row->id] = $row->name;
             }
             $card = $cards->add();
             $card->setTitle($category->parent->getTitle());
             $card->setName($category->componentId);
             if (!$defaultCard) {
                 $defaultCard = $category->componentId;
             }
             $model = Kwf_Model_Abstract::getInstance('Kwc_Directories_Category_ShowCategories_Model');
             $card->add(new Kwf_Form_Field_MultiCheckboxLegacy($model, trlKwf('Categories')))->setValues($values)->setReferences(array('columns' => array('component_id'), 'refColumns' => array('id')))->setColumnName('category_id');
         }
     }
     $cards->setDefaultValue($defaultCard);
 }
 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);
 }
Пример #11
0
 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;
 }
Пример #12
0
 public function getTemplateVars()
 {
     $ret = parent::getTemplateVars();
     $ret['componentClass'] = get_class($this);
     $ret['test2'] = $this->getData()->getChildComponent('_test2');
     return $ret;
 }
Пример #13
0
 public static function validateSettings($settings, $componentClass)
 {
     parent::validateSettings($settings, $componentClass);
     if (Kwc_Abstract::hasSetting($componentClass, 'dimensions')) {
         throw new Kwf_Exception("Setting 'dimensions' must NOT exist");
     }
 }
Пример #14
0
 public static function getSettings($param = null)
 {
     $ret = parent::getSettings($param);
     $ret['generators']['test'] = array('class' => 'Kwf_Component_Generator_Page_Static', 'component' => 'Kwc_Lightbox_Content_TestComponent_Component');
     $ret['viewCache'] = false;
     return $ret;
 }
Пример #15
0
 public static function getSettings()
 {
     $ret = parent::getSettings();
     $ret['generators']['test1'] = array('class' => 'Kwf_Component_Generator_Page_Static', 'component' => 'Kwc_Basic_None_Component', 'name' => 'test1');
     $ret['flags']['chainedType'] = 'Trl';
     return $ret;
 }
Пример #16
0
 public function getTemplateVars()
 {
     $ret = parent::getTemplateVars();
     $ret['sources'] = null;
     //mp3
     $url = Kwf_Media::getUrl($this->getData()->componentClass, $this->getData()->componentId, 'mp3', 'audio.mp3');
     if ($url) {
         $ret['source'] = array('src' => $url, 'type' => 'audio/mp3', 'title' => 'mp3');
     }
     $ret['config'] = Kwc_Abstract::getSetting($this->getData()->componentClass, 'audio');
     $row = $this->getRow();
     if ($row->audio_width) {
         $ret['config']['audioWidth'] = $row->audio_width;
     }
     if ($row->audio_height) {
         $ret['config']['audioHeight'] = $row->audio_height;
     }
     if ($row->auto_play) {
         $ret['config']['autoPlay'] = true;
     }
     if ($row->loop) {
         $ret['config']['loop'] = true;
     }
     return $ret;
 }
Пример #17
0
 public static function getSettings()
 {
     $ret = parent::getSettings();
     $ret['componentName'] = 'test component';
     $ret['ownModel'] = 'Kwc_Legacy_Columns_Basic_TestComponent_Column_Model';
     return $ret;
 }
Пример #18
0
 public static function getSettings($param = null)
 {
     $ret = parent::getSettings($param);
     $ret['rootElementClass'] = 'kwfUp-webStandard';
     $ret['flags']['noIndex'] = true;
     return $ret;
 }
Пример #19
0
 public function getTemplateVarsWithNetworks($currentPage)
 {
     $ret = parent::getTemplateVars();
     $ret['networks'] = $this->_getNetworks($currentPage);
     $ret['iconSet'] = $this->_getSetting('iconSet');
     return $ret;
 }
Пример #20
0
 public function getTemplateVars()
 {
     $ret = parent::getTemplateVars();
     $ret['requestUri'] = $_SERVER['REQUEST_URI'];
     // TODO
     return $ret;
 }
Пример #21
0
 public function getTemplateVars(Kwf_Component_Renderer_Abstract $renderer)
 {
     $ret = parent::getTemplateVars($renderer);
     $ret['componentClass'] = get_class($this);
     $ret['test2'] = $this->getData()->getChildComponent('_test2');
     return $ret;
 }
Пример #22
0
 public static function getSettings()
 {
     $ret = parent::getSettings();
     $ret['flags']['foo'] = true;
     $ret['generators']['test'] = array('class' => 'Kwf_Component_Generator_Static', 'component' => 'Kwf_Component_Generator_Indirect_Flag2');
     return $ret;
 }
Пример #23
0
 public static function getSettings()
 {
     $ret = parent::getSettings();
     $ret['generators']['child'] = array('class' => 'Kwf_Component_Generator_Static', 'component' => 'Kwf_Component_Cache_Chained_Master_Component');
     $ret['flags']['chainedType'] = 'Trl';
     return $ret;
 }
Пример #24
0
 public static function getSettings($param = null)
 {
     $ret = array_merge(parent::getSettings($param), array('componentName' => trlKwfStatic('Line')));
     $ret['componentCategory'] = 'content';
     $ret['componentPriority'] = 65;
     return $ret;
 }
Пример #25
0
 public static function getSettings($param = null)
 {
     $ret = parent::getSettings($param);
     $ret['componentName'] = 'Foo';
     $ret['ownModel'] = new Kwf_Model_FnF(array('primaryKey' => 'component_id'));
     return $ret;
 }
Пример #26
0
 public function getTemplateVars()
 {
     $ret = parent::getTemplateVars();
     $ret['separator'] = $this->_getSetting('separator');
     $ret['languages'] = $this->getLanguages($this->_getSetting('showCurrent'));
     return $ret;
 }
Пример #27
0
 /**
  * Returns Zend_Search_Lucene instance for given subroot
  *
  * every subroot has it's own instance
  *
  * @param Kwf_Component_Data for this index
  * @return Zend_Search_Lucene_Interface
  */
 public static function getInstance(Kwf_Component_Data $subroot)
 {
     while ($subroot) {
         if (Kwc_Abstract::getFlag($subroot->componentClass, 'subroot')) {
             break;
         }
         $subroot = $subroot->parent;
     }
     if (!$subroot) {
         $subroot = Kwf_Component_Data_Root::getInstance();
     }
     static $instance = array();
     if (!isset($instance[$subroot->componentId])) {
         $analyzer = new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive();
         $analyzer->addFilter(new Zend_Search_Lucene_Analysis_TokenFilter_ShortWords(2));
         //$stopWords = explode(' ', 'der dir das einer eine ein und oder doch ist sind an in vor nicht wir ihr sie es ich');
         //$analyzer->addFilter(new Zend_Search_Lucene_Analysis_TokenFilter_StopWords($stopWords));
         Zend_Search_Lucene_Analysis_Analyzer::setDefault($analyzer);
         Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('utf-8');
         Zend_Search_Lucene_Storage_Directory_Filesystem::setDefaultFilePermissions(0666);
         $path = 'cache/fulltext';
         $path .= '/' . $subroot->componentId;
         try {
             $instance[$subroot->componentId] = Zend_Search_Lucene::open($path);
         } catch (Zend_Search_Lucene_Exception $e) {
             $instance[$subroot->componentId] = Zend_Search_Lucene::create($path);
         }
     }
     return $instance[$subroot->componentId];
 }
Пример #28
0
 public static function getSettings()
 {
     $ret = parent::getSettings();
     $ret['generators']['composite'] = array('class' => 'Kwf_Component_Generator_Page_Static', 'component' => 'Kwc_Cc_Composite_Master_Composite_Component');
     $ret['flags']['chainedType'] = 'Cc';
     return $ret;
 }
Пример #29
0
 public static function getSettings($param = null)
 {
     $ret = parent::getSettings($param);
     $ret['viewCache'] = false;
     $ret['generators']['favourite'] = array('class' => 'Kwf_Component_Generator_Page_Static', 'component' => 'Kwc_Favourites_Favourite_Component', 'name' => 'Favourites');
     return $ret;
 }
Пример #30
-1
 public function getTemplateVars()
 {
     $ret = parent::getTemplateVars();
     $page = $this->getData()->getPage();
     $ret['childPages'] = $page->getChildPages();
     return $ret;
 }