public function filter($row) { $ret = ''; do { if ($ret != '') { $ret = $this->_separator . $ret; } $ret = Kwf_Filter::filterStatic($row->__toString(), $this->_filter) . $ret; $row = $row->getParentRow($this->_parentRule); } while ($row); return $ret; }
public function filter($row) { $ret = ''; do { if ($ret != '') { $ret = $this->_separator . $ret; } $ret = Kwf_Filter::filterStatic($row->__toString(), $this->_filter) . $ret; if ($row instanceof Kwf_Model_Row_Interface) { $row = $row->getParentRow($this->_parentRule); } else { $row = $row->findParentRow(get_class($row->getTable())); } } while ($row); return $ret; }
public function filter($row) { if (is_null($this->_sourceField)) { $value = $row->__toString(); } else { $f = $this->_sourceField; $value = $row->{$f}; } $value = Kwf_Filter::filterStatic($value, 'Ascii'); if ($row instanceof Kwf_Model_Row_Interface) { $select = new Kwf_Model_Select(); foreach ($this->_groupBy as $f) { $select->whereEquals($f, $row->{$f}); } $pk = $row->getModel()->getPrimaryKey(); if ($row->{$pk}) { $select->whereNotEquals($pk, $row->{$pk}); } $x = 0; $unique = $value; while (!$this->_isUnique($unique, $select, $row->getModel())) { $unique = $value . '_' . ++$x; } } else { $where = array(); foreach ($this->_groupBy as $f) { if (is_null($row->{$f})) { $where["ISNULL({$f})"] = ''; } else { $where["{$f} = ?"] = $row->{$f}; } } foreach ($row->getPrimaryKey() as $k => $i) { if (!is_null($i)) { $where["{$k} != ?"] = $i; } } $x = 0; $unique = $value; $where["{$this->_field} = ?"] = $unique; while ($row->getTable()->fetchAll($where)->count() > 0) { $unique = $value . '_' . ++$x; $where["{$this->_field} = ?"] = $unique; } } return $unique; }
protected function _formatConfig($parentData, $row) { $data = parent::_formatConfig($parentData, $row); if (!$this->_settings['uniqueFilename']) { $data['filename'] = $this->_getIdFromRow($row) . '-'; $data['filename'] .= Kwf_Filter::filterStatic($this->_getFilenameFromRow($row), 'Ascii'); if (strlen($data['filename']) > $this->_settings['maxFilenameLength']) { $data['filename'] = substr($data['filename'], 0, $this->_settings['maxFilenameLength']); } } else { //wenn uniqueFilename muss er exakt so belassen werden wie er ist //(weil danach ja die andere richtung gesucht wird) $data['filename'] = $this->_getFilenameFromRow($row); } $data['name'] = $this->_getNameFromRow($row); $data['rel'] = ''; $data['isPseudoPage'] = true; return $data; }
protected function _getFilenameFromRow($componentKey, $parentData) { $ret = false; $c = $this->_settings; if (isset($c['filename'])) { $ret = $c['filename']; } if (!$ret && isset($c['name'])) { $ret = $c['name']; if ($parentData) { $pData = is_array($parentData) ? $parentData[0] : $parentData; $ret = $pData->trlStaticExecute($ret); } } $ret = Kwf_Filter::filterStatic($ret, 'Ascii'); if (!$ret) { $ret = $componentKey; $ret = Kwf_Filter::filterStatic($ret, 'Ascii'); } return $ret; }
public function filter($row) { if ($row->custom_filename) { $value = $row->filename; } else { $value = $row->name; } $value = Kwf_Filter::filterStatic($value, 'Ascii'); $componentId = $this->_getComponentId($row); $parent = $this->_getParentPage($row); $values = array(); foreach ($parent->getChildPages(array('ignoreVisible' => true)) as $c) { if ($c->componentId == $componentId) { continue; } $values[] = $c->filename; } if ($parent instanceof Kwf_Component_Data_Root) { $values[] = 'admin'; $values[] = 'kwf'; $values[] = 'media'; $values[] = 'assets'; $values[] = 'api'; } $x = 0; $unique = $value; if (!$unique) { $unique = 1; } while (in_array($unique, $values)) { if ($value) { $unique = $value . '-' . ++$x; } else { $unique = ++$x; } } return (string) $unique; }
public function filter($row) { if (is_null($this->_sourceField)) { $value = $row->__toString(); } else { $f = $this->_sourceField; $value = $row->{$f}; } $value = Kwf_Filter::filterStatic($value, 'Ascii'); $select = new Kwf_Model_Select(); foreach ($this->_groupBy as $f) { $select->whereEquals($f, $row->{$f}); } $pk = $row->getModel()->getPrimaryKey(); if ($row->{$pk}) { $select->whereNotEquals($pk, $row->{$pk}); } $x = 0; $unique = $value; while (!$this->_isUnique($unique, $select, $row->getModel())) { $unique = $value . '_' . ++$x; } return $unique; }
protected function _formatConfig($parentData, $row) { $ret = parent::_formatConfig($parentData, $row); if ($this->_getChainedGenerator() instanceof Kwf_Component_Generator_PseudoPage_Static) { //get trlStatic setting from chained generator and execute trlStaticExecute again $c = $this->_getChainedGenerator()->_settings; if (isset($ret['name']) && isset($c['name'])) { $ret['name'] = $parentData->trlStaticExecute($c['name']); } if (isset($ret['filename'])) { if (isset($c['filename']) && $c['filename']) { $ret['filename'] = $c['filename']; } else { if (isset($c['name']) && $c['name']) { $ret['filename'] = $c['name']; } } $ret['filename'] = $parentData->trlStaticExecute($ret['filename']); $ret['filename'] = Kwf_Filter::filterStatic($ret['filename'], 'Ascii'); if (!$ret['filename']) { $ret['filename'] = $ret['chained']->id; $ret['filename'] = Kwf_Filter::filterStatic($ret['filename'], 'Ascii'); } } } return $ret; }
protected function _formatConfig($parentData, $row) { $ret = parent::_formatConfig($parentData, $row); $m = $this->getModel(); if ($m) { $id = $parentData->dbId . $this->getIdSeparator() . $this->_getIdFromRow($row); $ret['row'] = $this->_getRow($id); if (!$ret['row']) { $ret['row'] = $m->createRow(); $ret['row']->component_id = $id; } if (!$ret['row']->visible) { $ret['invisible'] = true; } } else { unset($ret['row']); } //TODO: nicht mit settings direkt arbeiten, besser das echte generator objekt holen $masterCC = Kwc_Abstract::getSetting($this->_class, 'masterComponentClass'); $masterGen = Kwc_Abstract::getSetting($masterCC, 'generators'); $detailGen = $masterGen['detail']; if (isset($ret['chained']->name)) { if ($this->hasSetting('nameColumn')) { $ret['name'] = $ret['row']->{$this->getSetting('nameColumn')}; } else { $ret['name'] = $ret['chained']->name; } } if (isset($ret['chained']->filename)) { if (isset($detailGen['filenameColumn']) && isset($ret['row'])) { $fn = $ret['row']->{$detailGen['filenameColumn']}; } else { if (isset($ret['name'])) { $fn = $ret['name']; } else { $fn = ''; } } if (!isset($detailGen['filenameColumn']) || !$detailGen['filenameColumn']) { $ret['filename'] = $row->id . '_'; } $ret['filename'] .= Kwf_Filter::filterStatic($fn, 'Ascii'); } return $ret; }