Ejemplo n.º 1
0
 public function getTemplateVars(Kwf_Component_Renderer_Abstract $renderer)
 {
     $ret = parent::getTemplateVars($renderer);
     $ret['product'] = $this->getData()->row;
     $ret['item'] = $ret['product']->getItem();
     $ret['similarProducts'] = array();
     if ($ret['item']->SimilarProducts) {
         foreach ($ret['item']->SimilarProducts as $p) {
             $p = $ret['product']->getModel()->getRow($p->ASIN);
             foreach ($p->getChildRows('ProductsToNodes') as $n) {
                 $s = new Kwf_Component_Select();
                 $s->whereEquals('node_id', $n->node_id);
                 $s->whereGenerator('detail');
                 if ($this->getData()->parent->parent->countChildComponents($s)) {
                     $ret['similarProducts'][] = $this->getData()->parent->getChildComponent('_' . $p->asin);
                     break;
                 }
             }
         }
     }
     $ret['nodes'] = array();
     $nodes = $ret['product']->getChildRows('ProductsToNodes');
     foreach ($nodes as $node) {
         $s = new Kwf_Component_Select();
         $s->whereEquals('node_id', $node->node_id);
         $s->whereGenerator('detail');
         $node = $this->getData()->parent->parent->getChildComponent($s);
         if ($node) {
             $ret['nodes'][] = $node;
         }
     }
     return $ret;
 }
Ejemplo n.º 2
0
 public function getPartialVars($partial, $nr, $info)
 {
     if (!$partial instanceof Kwf_Component_Partial_Random) {
         throw new Kwf_Exception('Only Kwf_Component_Partial_Random supported');
     }
     $select = new Kwf_Component_Select();
     $select->whereGenerator('child');
     $select->limit(1, $nr);
     return array('child' => $this->getData()->getChildComponent($select));
 }
Ejemplo n.º 3
0
 public function setComponentId($componentId)
 {
     $c = Kwf_Component_Data_Root::getInstance()->getComponentByDbId($componentId, array('ignoreVisible' => true));
     $s = new Kwf_Component_Select();
     $s->ignoreVisible();
     $s->whereGenerator('detail');
     foreach ($c->getChildComponents($s) as $c) {
         $this->_data[$c->componentId] = array('id' => $c->chained->row->id, 'component_id' => $componentId, 'original_name' => $c->chained->row->name, 'name' => $c->row->name, 'row' => $c->row, 'visible' => $c->row->visible);
     }
 }
Ejemplo n.º 4
0
 public function setComponentId($componentId)
 {
     $c = Kwf_Component_Data_Root::getInstance()->getComponentByDbId($componentId, array('ignoreVisible' => true));
     $s = new Kwf_Component_Select();
     $s->ignoreVisible();
     $s->whereGenerator('child');
     $i = 0;
     foreach ($c->getChildComponents($s) as $c) {
         $this->_data[$c->componentId] = array('id' => $c->chained->row->id, 'pos' => $i++, 'component_id' => $componentId, 'row' => $c->row, 'name' => $c->targetPage->name);
     }
 }
Ejemplo n.º 5
0
 public function setComponentId($componentId)
 {
     $c = Kwf_Component_Data_Root::getInstance()->getComponentByDbId($componentId, array('ignoreVisible' => true));
     $s = new Kwf_Component_Select();
     $s->ignoreVisible();
     $s->whereGenerator('child');
     foreach ($c->getChildComponents($s) as $c) {
         $row = $c->generator->getTrlRowByData($c);
         $this->_data[$c->componentId] = array('id' => $c->chained->row->id, 'component_id' => $componentId, 'row' => $row, 'pos' => isset($c->chained->row->pos) ? $c->chained->row->pos : null);
         foreach ($this->_translateFields as $tf) {
             $this->_data[$c->componentId][$tf] = $row->{$tf};
         }
     }
 }
Ejemplo n.º 6
0
 public function setComponentId($componentId)
 {
     $c = Kwf_Component_Data_Root::getInstance()->getComponentByDbId($componentId, array('ignoreVisible' => true));
     $s = new Kwf_Component_Select();
     $s->ignoreVisible();
     $s->whereGenerator('paragraphs');
     $chainedModel = Kwc_Abstract::createChildModel($c->componentClass);
     foreach ($c->getChildComponents($s) as $c) {
         $chainedRow = $chainedModel->getRow($c->dbId);
         if (!$chainedRow) {
             $chainedRow = $chainedModel->createRow(array('component_id' => $c->dbId, 'visible' => false));
         }
         $this->_data[$c->componentId] = array('id' => $c->chained->row->id, 'component_id' => $componentId, 'component_class' => $c->componentClass, 'component_name' => Kwf_Trl::getInstance()->trlStaticExecute(Kwc_Abstract::getSetting($c->componentClass, 'componentName')), 'component_icon' => (string) new Kwf_Asset(Kwc_Abstract::getSetting($c->componentClass, 'componentIcon')), 'row' => $chainedRow, 'visible' => $chainedRow->visible, 'pos' => $c->chained->row->pos);
     }
 }
Ejemplo n.º 7
0
 public function getSelect()
 {
     $select = parent::getSelect();
     if (!$select) {
         return null;
     }
     $s = new Kwf_Component_Select();
     $s->whereGenerator('categories');
     $tableName = Kwc_Abstract::getSetting($this->getItemDirectory()->getChildComponent($s)->componentClass, 'categoryToItemModelName');
     $refData = Kwc_Directories_Category_Detail_List_Component::getTableReferenceData($tableName, 'Item');
     $select->join($refData['tableName'], $refData['tableName'] . '.' . $refData['itemColumn'] . '=' . $refData['refTableName'] . '.' . $refData['refItemColumn'], array());
     $ids = $this->getCategoryIds();
     if (!$ids) {
         return null;
     }
     $select->where($refData['tableName'] . '.category_id IN (' . implode(',', $ids) . ')');
     return $select;
 }
Ejemplo n.º 8
0
 public function getTemplateVars()
 {
     $ret = parent::getTemplateVars();
     $ret['title'] = $this->getData()->row->title;
     $ret['publish_date'] = $this->getData()->row->publish_date;
     $ret['author'] = $this->getData()->row->author_firstname . ' ' . $this->getData()->row->author_lastname;
     if ($this->_getPlaceholder('nextLink')) {
         $s = new Kwf_Component_Select();
         $s->whereGenerator('detail');
         $s->order('publish_date', 'ASC');
         $s->where(new Kwf_Model_Select_Expr_Higher('publish_date', new Kwf_Date($this->getData()->row->publish_date)));
         $ret['nextPost'] = $this->getData()->parent->getChildComponent($s);
     }
     if ($this->_getPlaceholder('previousLink')) {
         $s = new Kwf_Component_Select();
         $s->whereGenerator('detail');
         $s->order('publish_date', 'DESC');
         $s->where(new Kwf_Model_Select_Expr_Lower('publish_date', new Kwf_Date($this->getData()->row->publish_date)));
         $ret['previousPost'] = $this->getData()->parent->getChildComponent($s);
     }
     return $ret;
 }
Ejemplo n.º 9
0
 /**
  * wennn man das select anpassen will _formatSelect überschreiben
  */
 public final function select($parentData, array $select = array())
 {
     $select = new Kwf_Component_Select($select);
     $select->whereGenerator($this->_settings['generator']);
     return $select;
 }
Ejemplo n.º 10
0
 protected function _getSelect()
 {
     $select = new Kwf_Component_Select();
     $select->whereGenerator('child');
     return $select;
 }