Пример #1
0
 public function getTemplateVars()
 {
     $ret = parent::getTemplateVars();
     $ret['image'] = $this->getData();
     $imageCaptionSetting = Kwc_Abstract::getSetting($this->_getSetting('masterComponentClass'), 'imageCaption');
     if ($imageCaptionSetting) {
         $ret['image_caption'] = $this->getRow()->image_caption;
     }
     $ret['baseUrl'] = $this->getBaseImageUrl();
     if ($this->getRow()->own_image) {
         $imageData = $this->getImageData();
         if ($imageData) {
             $steps = Kwf_Media_Image::getResponsiveWidthSteps($this->getImageDimensions(), $imageData['file']);
             $ret['minWidth'] = $steps[0];
             $ret['maxWidth'] = end($steps);
         }
     }
     if (Kwc_Abstract::getSetting($this->_getSetting('masterComponentClass'), 'altText')) {
         $ret['altText'] = $this->_getRow()->alt_text;
     }
     if (Kwc_Abstract::getSetting($this->_getSetting('masterComponentClass'), 'titleText')) {
         $ret['imgAttributes']['title'] = $this->_getRow()->title_text;
     }
     return $ret;
 }
Пример #2
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");
         }
     }
 }
Пример #3
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;
 }
 private function _graphData($class, $parent = '')
 {
     if (is_instance_of($class, 'Kwc_Paragraphs_Component')) {
         return;
     }
     static $processed = array();
     $ret = '';
     $last = $class . $parent;
     foreach (Kwc_Abstract::getSetting($class, 'generators') as $generatorKey => $generator) {
         $g = $this->_getGenerator($class, $generatorKey);
         $shape = $this->_getShape($g);
         foreach ($this->_getChildren($generator) as $child) {
             $color = $this->_getColor($child);
             $fontcolor = in_array($child, $processed) ? 'grey40' : 'black';
             $classname = $this->_getClassName($child, $class);
             $label = '';
             if ($g->getGeneratorFlag('table')) {
                 $label = 'headlabel = "*"';
             }
             $name = $child . $class;
             $node = "Node_{$name}";
             $ret .= "{ {$name} [label=\"{$classname}\" shape={$shape} color={$color} fontcolor=\"{$fontcolor}\" fontsize=12] } \n";
             $ret .= "{ {$node} [shape=point] }\n";
             $ret .= "{ {$node} -> {$name} [arrowhead=none {$label}] }\n";
             $ret .= "{ {$last} -> {$node} [arrowhead=none] rank=same }\n";
             $ret .= "\n";
             $last = $node;
             if (!in_array($child, $processed)) {
                 $processed[] = $child;
                 $ret .= $this->_graphData($child, $class);
             }
         }
     }
     return $ret;
 }
 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')));
 }
Пример #6
0
 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');
 }
Пример #7
0
 protected function _initColumns()
 {
     parent::_initColumns();
     $this->_columns->add(new Kwf_Grid_Column('id'));
     //shows editDialog
     $this->_columns->add(new Kwf_Grid_Column_Button('properties', ' ', 20))->setButtonIcon('/assets/silkicons/newspaper.png')->setTooltip(trlKwf('Properties'));
     if (is_instance_of(Kwc_Abstract::getSetting($this->_getParam('class'), 'extConfig'), 'Kwc_Directories_Item_Directory_ExtConfigEditButtons')) {
         $extConfigType = 'extConfig';
     } else {
         if (is_instance_of(Kwc_Abstract::getSetting($this->_getParam('class'), 'extConfigControllerIndex'), 'Kwc_Directories_Item_Directory_ExtConfigEditButtons')) {
             $extConfigType = 'extConfigControllerIndex';
         }
     }
     $extConfig = Kwf_Component_Abstract_ExtConfig_Abstract::getInstance($this->_getParam('class'), $extConfigType)->getConfig(Kwf_Component_Abstract_ExtConfig_Abstract::TYPE_DEFAULT);
     $extConfig = $extConfig['items'];
     if (count($extConfig['countDetailClasses']) > 1 && !$this->_getModel()->hasColumn('component')) {
         throw new Kwf_Exception('If you have more than one detail-component your table has to have a column named "component"');
     }
     $i = 0;
     foreach ($extConfig['contentEditComponents'] as $ec) {
         $name = Kwf_Trl::getInstance()->trlStaticExecute(Kwc_Abstract::getSetting($ec['componentClass'], 'componentName'));
         $icon = Kwc_Abstract::getSetting($ec['componentClass'], 'componentIcon');
         $icon = new Kwf_Asset($icon);
         $this->_columns->add(new Kwc_Directories_Item_Directory_Trl_ControllerEditButton('edit_' . $i, ' ', 20))->setColumnType('editContent')->setEditComponentClass($ec['componentClass'])->setEditComponent($ec['component'])->setEditType($ec['type'])->setEditIdTemplate($ec['idTemplate'])->setEditComponentIdSuffix($ec['componentIdSuffix'])->setButtonIcon($icon->toString(array('arrow')))->setTooltip(trlKwf('Edit {0}', $name));
         $i++;
     }
 }
Пример #8
0
 protected function _render($includeMaster, &$hasDynamicParts)
 {
     $lightboxContent = $this->_data->render(null, false, $hasDynamicParts);
     $kwfUniquePrefix = Kwf_Config::getValue('application.uniquePrefix');
     if ($kwfUniquePrefix) {
         $kwfUniquePrefix = $kwfUniquePrefix . '-';
     }
     if ($includeMaster) {
         $parent = $this->_getParent();
         $parentContentSender = Kwc_Abstract::getSetting($parent->componentClass, 'contentSender');
         $parentContentSender = new $parentContentSender($parent);
         $parentContent = $parentContentSender->_render($includeMaster, $hasDynamicParts);
         //remove main content to avoid duplicate content for search engines
         //content will be loaded using ajax
         $startPos = strpos($parentContent, '<main class="' . $kwfUniquePrefix . 'kwfMainContent">');
         $endPos = strpos($parentContent, '</main><!--/' . $kwfUniquePrefix . 'kwfMainContent-->');
         $parentContent = substr($parentContent, 0, $startPos) . '<main class="' . $kwfUniquePrefix . 'kwfMainContent" data-kwc-component-id="' . $parent->componentId . '">' . substr($parentContent, $endPos);
         foreach ($this->_data->getRecursiveChildComponents(array('flag' => 'hasInjectIntoRenderedHtml')) as $component) {
             $box = $component;
             $isInBox = false;
             while (!$isInBox && $box) {
                 if (isset($box->box)) {
                     $isInBox = true;
                 }
                 $box = $box->parent;
             }
             if ($isInBox) {
                 $parentContent = $component->getComponent()->injectIntoRenderedHtml($parentContent);
             }
         }
         //append lightbox after <body> in parent
         $options = $this->_getOptions();
         $style = '';
         if (isset($options['width'])) {
             $style .= "width: {$options['width']}px;";
         }
         if (isset($options['height'])) {
             $style .= "height: {$options['height']}px";
         }
         $class = $kwfUniquePrefix . 'kwfLightbox';
         $class .= " " . $kwfUniquePrefix . "kwfLightbox{$options['style']}";
         if (isset($options['cssClass'])) {
             $class .= " {$options['cssClass']}";
         }
         if (isset($options['adaptHeight']) && $options['adaptHeight']) {
             $class .= " adaptHeight";
         }
         $options = htmlspecialchars(json_encode($options));
         $lightboxContent = "<div class=\"{$class} " . $kwfUniquePrefix . "kwfLightboxOpen\">\n" . "    <div class=\"" . $kwfUniquePrefix . "kwfLightboxScrollOuter\">\n" . "        <div class=\"" . $kwfUniquePrefix . "kwfLightboxScroll\">\n" . "            <div class=\"" . $kwfUniquePrefix . "kwfLightboxBetween\">\n" . "               <div class=\"" . $kwfUniquePrefix . "kwfLightboxBetweenInner\">\n" . "                   <div class=\"" . $kwfUniquePrefix . "kwfLightboxInner\" style=\"{$style}\">\n" . "                       <input type=\"hidden\" class=\"options\" value=\"{$options}\" />\n" . "                       <div class=\"" . $kwfUniquePrefix . "kwfLightboxContent\">\n" . "                           {$lightboxContent}\n" . "                       </div>\n" . "                       <a class=\"" . $kwfUniquePrefix . "closeButton\" href=\"{$parent->url}\"><span class=\"" . $kwfUniquePrefix . "innerCloseButton\">" . $this->_data->trlKwf('Close') . "</span></a>\n" . "                   </div>\n" . "               </div>\n" . "            </div>\n" . "        </div>\n" . "        <div class=\"" . $kwfUniquePrefix . "kwfLightboxMask " . $kwfUniquePrefix . "kwfLightboxMaskOpen\"></div>\n" . "    </div>\n" . "</div>\n";
         $ret = preg_replace('#(<body[^>]*>)#', "\\1\n" . $lightboxContent, $parentContent);
         if (preg_match('#<html[^>]* class#', $ret)) {
             $ret = preg_replace('#(<html[^>]*?)( class="([^"]*)")#', "\\1 class=\"\\3 " . $kwfUniquePrefix . "kwfLightboxActive\"", $ret);
         } else {
             $ret = preg_replace('#(<html[^>]*)#', "\\1 class=\"\\3" . $kwfUniquePrefix . "kwfLightboxActive\"", $ret);
         }
         return $ret;
     } else {
         return $lightboxContent;
     }
 }
Пример #9
0
 public static function getSettings($menuComponentClass = null)
 {
     $ret = parent::getSettings($menuComponentClass);
     $ret['menuComponentClass'] = $menuComponentClass;
     $ret['viewCache'] = Kwc_Abstract::getSetting($menuComponentClass, 'viewCache');
     return $ret;
 }
 public function onRowUpdate(Kwf_Events_Event_Row_Updated $event)
 {
     parent::onRowUpdate($event);
     $value = $event->row->publish_date;
     $cleanValue = $event->row->getCleanValue('publish_date');
     $date = date('Y-m-d');
     if ($value > $date && $cleanValue <= $date) {
         $this->_fireAddedRemovedEvents($event->row, 'Added');
     } else {
         if ($value <= $date && $cleanValue > $date) {
             $this->_fireAddedRemovedEvents($event->row, 'Removed');
         }
     }
     if (Kwc_Abstract::getSetting($this->_class, 'enableExpireDate')) {
         $value = $event->row->expiry_date;
         $cleanValue = $event->row->getCleanValue('expiry_date');
         $date = date('Y-m-d');
         if ($value <= $date && $cleanValue > $date) {
             $this->_fireAddedRemovedEvents($event->row, 'Added');
         } else {
             if ($value >= $date && $cleanValue < $date) {
                 $this->_fireAddedRemovedEvents($event->row, 'Removed');
             }
         }
     }
 }
Пример #11
0
 protected function _initFields()
 {
     parent::_initFields();
     $this->setCreateMissingRow(true);
     if (!$this->getClass()) {
         return;
     }
     $generators = Kwc_Abstract::getSetting($this->getClass(), 'generators');
     $classes = $generators['child']['component'];
     foreach ($classes as $key => $class) {
         if (!$class) {
             continue;
         }
         $form = Kwc_Abstract_Form::createChildComponentForm($this->getClass(), "-{$key}", $key);
         if ($form && count($form->fields)) {
             if ($this->_getIdTemplateForChild($key)) {
                 $form->setIdTemplate($this->_getIdTemplateForChild($key));
             }
             if (!$this->_createFieldsets || !Kwc_Abstract::hasSetting($class, 'componentName')) {
                 $this->add($form);
             } else {
                 $name = Kwf_Trl::getInstance()->trlStaticExecute(Kwc_Abstract::getSetting($class, 'componentName'));
                 $name = str_replace('.', ' ', $name);
                 $this->add(new Kwf_Form_Container_FieldSet($name))->setName($key)->add($form);
             }
         }
     }
 }
Пример #12
0
 protected function _initSettings()
 {
     $masterComponentClass = Kwc_Abstract::getSetting($this->_class, 'masterComponentClass');
     $masterMenuComponentClass = Kwc_Abstract::getSetting($masterComponentClass, 'menuComponentClass');
     $trlMenuComponentClass = Kwc_Chained_Abstract_Component::getChainedComponentClass($masterMenuComponentClass, 'Trl');
     $this->_menuComponentClass = $trlMenuComponentClass;
 }
Пример #13
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');
 }
Пример #14
0
 protected function _initFields()
 {
     parent::_initFields();
     $masterCC = Kwc_Abstract::getSetting($this->getClass(), 'masterComponentClass');
     if (Kwc_Abstract::getSetting($masterCC, 'imageCaption')) {
         $this->add(new Kwf_Form_Field_ShowField('original_image_caption', trlKwf('Original Image caption')))->setData(new Kwf_Data_Trl_OriginalComponent('image_caption'));
         $this->add(new Kwf_Form_Field_TextField('image_caption', trlKwf('Image caption')))->setWidth(300);
     }
     if (Kwc_Abstract::getSetting($masterCC, 'editFilename') || Kwc_Abstract::getSetting($masterCC, 'altText') || Kwc_Abstract::getSetting($masterCC, 'titleText')) {
         $fs = $this->add(new Kwf_Form_Container_FieldSet('SEO'));
         $fs->setCollapsible(true);
         $fs->setCollapsed(true);
     }
     if (Kwc_Abstract::getSetting($masterCC, 'editFilename')) {
         $fs->add(new Kwf_Form_Field_ShowField('original_filename', trlKwf('Original {0}', trlKwf('Filename'))))->setData(new Kwf_Data_Trl_OriginalComponent('filename'));
         $fs->add(new Kwf_Form_Field_TextField('filename', trlKwf('Filename')))->setWidth(300)->setHelpText(trlKwf('Talking filename ("lorem-ipsum-2015"), hyphens and underscores are allowed.'));
     }
     if (Kwc_Abstract::getSetting($masterCC, 'altText')) {
         $fs->add(new Kwf_Form_Field_ShowField('original_alt_text', trlKwf('Original {0}', 'ALT Text')))->setData(new Kwf_Data_Trl_OriginalComponent('alt_text'));
         $fs->add(new Kwf_Form_Field_TextField('alt_text', 'ALT Text'))->setWidth(300)->setHelpText(trlKwf('Short, meaningful description of the image content.'));
     }
     if (Kwc_Abstract::getSetting($masterCC, 'titleText')) {
         $fs->add(new Kwf_Form_Field_ShowField('original_title_text', trlKwf('Original {0}', 'ALT Text')))->setData(new Kwf_Data_Trl_OriginalComponent('title_text'));
         $fs->add(new Kwf_Form_Field_TextField('title_text', 'IMG Title'))->setWidth(300)->setHelpText(trlKwf('Some browsers show the text as a tooltip when the mouse pointer is hovering the image.'));
     }
     $this->add(new Kwf_Form_Field_ShowField('image', trlKwf('Original Image')))->setData(new Kwc_Abstract_Image_Trl_Form_ImageData());
     $fs = $this->add(new Kwf_Form_Container_FieldSet(trlKwf('Own Image')));
     $fs->setCheckboxToggle(true);
     $fs->setCheckboxName('own_image');
     $fs->add(Kwc_Abstract_Form::createChildComponentForm($this->getClass(), '-image', 'image'));
 }
Пример #15
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     $generators = Kwc_Abstract::getSetting($this->_class, 'generators');
     $ret[] = array('class' => $generators['child']['component'], 'event' => 'Kwf_Component_Event_Component_HasContentChanged', 'callback' => 'onChildHasContentChange');
     return $ret;
 }
Пример #16
0
 public function load($row, $postData = array())
 {
     $ret = parent::load($row, $postData);
     $component = Kwf_Component_Data_Root::getInstance()->getComponentByDbId($row->component_id, array('ignoreVisible' => true, 'limit' => 1));
     if ($component) {
         //component can be non-existent if it's in a not selected card
         if (is_instance_of($component->componentClass, 'Kwc_Abstract_Image_Component')) {
             $contentWidth = null;
             $usesContentWidth = false;
             foreach (Kwc_Abstract::getSetting($component->componentClass, 'dimensions') as $dim) {
                 if (isset($dim['width'])) {
                     if ($dim['width'] == Kwc_Abstract_Image_Component::CONTENT_WIDTH) {
                         $usesContentWidth = true;
                     } else {
                         if ($dim['width'] > $contentWidth) {
                             $contentWidth = $dim['width'];
                         }
                     }
                 }
             }
             if ($usesContentWidth) {
                 $contentWidth = $component->getComponent()->getMaxContentWidth();
             }
         } else {
             $contentWidth = $component->getComponent()->getContentWidth();
         }
         $ret[$this->getFieldName()]['contentWidth'] = $contentWidth;
     }
     return $ret;
 }
Пример #17
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     $masterComponentClass = Kwc_Abstract::getSetting($this->_class, 'masterComponentClass');
     $ret[] = array('class' => $masterComponentClass, 'event' => 'Kwf_Component_Event_Component_RowUpdated', 'callback' => 'onGeneratorRowUpdate');
     return $ret;
 }
 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();
 }
Пример #19
0
 public function findModels()
 {
     $ret = array();
     foreach (Kwc_Abstract::getComponentClasses() as $componentClass) {
         $cls = strpos($componentClass, '.') ? substr($componentClass, 0, strpos($componentClass, '.')) : $componentClass;
         $m = call_user_func(array($cls, 'createOwnModel'), $componentClass);
         if ($m) {
             self::_findAllInstancesProcessModel($ret, $m);
         }
         $m = call_user_func(array($cls, 'createChildModel'), $componentClass);
         if ($m) {
             self::_findAllInstancesProcessModel($ret, $m);
         }
         foreach (Kwc_Abstract::getSetting($componentClass, 'generators') as $g) {
             if (isset($g['model'])) {
                 self::_findAllInstancesProcessModel($ret, $g['model']);
             }
         }
     }
     if ($root = Kwf_Component_Data_Root::getInstance()) {
         foreach ($root->getPlugins('Kwf_Component_PluginRoot_Interface_Models') as $plugin) {
             foreach ($plugin->getModels() as $model) {
                 self::_findAllInstancesProcessModel($ret, $model);
             }
         }
     }
     return $ret;
 }
Пример #20
0
 public function getChildModel()
 {
     $chained = $this->getData()->chained;
     $tableModelClass = Kwc_Abstract::getSetting($chained->componentClass, 'childModel');
     $trlModelClass = $this->_getSetting('childModel');
     return new Kwc_Basic_Table_Trl_Model(array('proxyModel' => Kwf_Model_Abstract::getInstance($tableModelClass), 'trlModel' => Kwf_Model_Abstract::getInstance($trlModelClass)));
 }
Пример #21
0
 public function getSelect()
 {
     $select = parent::getSelect();
     $dateColumn = Kwc_Abstract::getSetting($this->getData()->parent->componentClass, 'dateColumn');
     $select = $this->_getDateSelect($select, $dateColumn);
     return $select;
 }
Пример #22
0
 public function getTemplateVars(Kwf_Component_Renderer_Abstract $renderer)
 {
     $ret = parent::getTemplateVars($renderer);
     $ret['sources'] = null;
     //mp3
     $url = Kwf_Media::getUrl($this->getData()->componentClass, $this->getData()->componentId, 'mp3', 'audio.mp3');
     $ev = new Kwf_Component_Event_CreateMediaUrl($this->getData()->componentClass, $this->getData(), $url);
     Kwf_Events_Dispatcher::fireEvent($ev);
     $url = $ev->url;
     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;
 }
Пример #23
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     $ret[] = array('class' => null, 'event' => 'Kwf_Component_Event_Page_ParentChanged', 'callback' => 'onPageParentChanged');
     foreach (Kwc_Abstract::getComponentClasses() as $class) {
         $classWithoutPoint = $class;
         if (($pos = strpos($class, '.')) !== false) {
             $classWithoutPoint = substr($class, 0, $pos);
         }
         if (Kwc_Abstract::getFlag($class, 'hasAlternativeComponent') && in_array($this->_class, call_user_func(array($classWithoutPoint, 'getAlternativeComponents'), $class))) {
             $ret[] = array('class' => $class, 'event' => 'Kwf_Component_Event_Component_HasContentChanged', 'callback' => 'onParentHasContentChanged');
             $ret[] = array('class' => $class, 'event' => 'Kwf_Component_Event_Component_RecursiveHasContentChanged', 'callback' => 'onParentRecursiveHasContentChanged');
         }
         foreach (Kwc_Abstract::getSetting($class, 'generators') as $generator) {
             if ($generator['class'] == 'Kwf_Component_Generator_Box_StaticSelect' && is_array($generator['component']) && in_array($this->_class, $generator['component'])) {
                 foreach ($generator['component'] as $componentClass) {
                     if ($componentClass == $this->_class) {
                         continue;
                     }
                     $ret[] = array('class' => $componentClass, 'event' => 'Kwf_Component_Event_Component_HasContentChanged', 'callback' => 'onParentHasContentChanged');
                     $ret[] = array('class' => $componentClass, 'event' => 'Kwf_Component_Event_Component_RecursiveHasContentChanged', 'callback' => 'onParentRecursiveHasContentChanged');
                 }
             }
         }
     }
     return $ret;
 }
 public function getLinkClass()
 {
     $data = $this->_data->getChildComponent('-child');
     $contentSender = Kwc_Abstract::getSetting($data->componentClass, 'contentSender');
     $contentSender = new $contentSender($data);
     return $contentSender->getLinkClass();
 }
 public function sendContent($includeMaster)
 {
     $data = $this->_data->getChildComponent('-child');
     $contentSender = Kwc_Abstract::getSetting($data->componentClass, 'contentSender');
     $contentSender = new $contentSender($data);
     $contentSender->sendContent($includeMaster);
 }
Пример #26
0
 public static function getLanguages()
 {
     $config = Zend_Registry::get('config');
     $langs = array();
     if ($config->webCodeLanguage) {
         $langs[] = $config->webCodeLanguage;
     }
     $possibleUserLanguages = array();
     if ($config->languages) {
         foreach ($config->languages as $lang => $name) {
             $possibleUserLanguages[] = $lang;
         }
     }
     $userModel = Kwf_Registry::get('userModel');
     if (isset($userModel->getAuthedUser()->language) && $userModel->getAuthedUser()->language && in_array($userModel->getAuthedUser()->language, $possibleUserLanguages)) {
         $langs[] = $userModel->getAuthedUser()->language;
     }
     if (Kwf_Component_Data_Root::getComponentClass()) {
         $lngClasses = array();
         foreach (Kwc_Abstract::getComponentClasses() as $c) {
             if (Kwc_Abstract::hasSetting($c, 'baseProperties') && in_array('language', Kwc_Abstract::getSetting($c, 'baseProperties'))) {
                 $lngClasses[] = $c;
             }
         }
         $lngs = Kwf_Component_Data_Root::getInstance()->getComponentsBySameClass($lngClasses, array('ignoreVisible' => true));
         foreach ($lngs as $c) {
             if (Kwf_Registry::get('acl')->getComponentAcl()->isAllowed($userModel->getAuthedUser(), $c)) {
                 $langs[] = $c->getLanguage();
             }
         }
     }
     return array_unique($langs);
 }
Пример #27
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);
 }
Пример #28
0
 public function testIt()
 {
     $gen = Kwc_Abstract::getSetting('Kwf_Component_ChildSettings_SingleStatic_Root', 'generators');
     $c = $gen['empty']['component'];
     $this->assertTrue(is_instance_of($c, 'Kwc_Basic_None_Component'));
     $this->assertEquals(Kwc_Abstract::getSetting($c, 'componentName'), 'test123');
 }
Пример #29
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;
 }
Пример #30
0
 protected function _render($includeMaster, &$hasDynamicParts)
 {
     $lightboxContent = $this->_data->render(null, false, $hasDynamicParts);
     if ($includeMaster) {
         $parent = $this->_getParent();
         $parentContentSender = Kwc_Abstract::getSetting($parent->componentClass, 'contentSender');
         $parentContentSender = new $parentContentSender($parent);
         $parentContent = $parentContentSender->_render($includeMaster, $hasDynamicParts);
         //append lightbox after <body> in parent
         $options = $this->_getOptions();
         $style = '';
         if (isset($options['width'])) {
             $style .= "width: {$options['width']}px;";
         }
         if (isset($options['height'])) {
             $style .= "height: {$options['height']}px";
         }
         $class = 'kwfLightbox';
         if (isset($options['style'])) {
             $class .= " kwfLightbox{$options['style']}";
         }
         if (isset($options['cssClass'])) {
             $class .= " {$options['cssClass']}";
         }
         if (isset($options['adaptHeight']) && $options['adaptHeight']) {
             $class .= " adaptHeight";
         }
         $options = htmlspecialchars(json_encode($options));
         $lightboxContent = "<div class=\"{$class}\">\n" . "<div class=\"kwfLightboxInner\" style=\"{$style}\">\n" . "    <input type=\"hidden\" class=\"options\" value=\"{$options}\" />\n" . "    <a class=\"closeButton\" href=\"{$parent->url}\"></a>\n" . "    <div class=\"kwfLightboxContent\">\n" . "        {$lightboxContent}\n" . "    </div>\n" . "</div>\n</div>\n";
         return preg_replace('#(<body[^>]*>)#', "\\1\n" . $lightboxContent, $parentContent);
     } else {
         return $lightboxContent;
     }
 }