本文整理汇总了PHP中Kwc_Chained_Trl_Component::getChainedByMaster方法的典型用法代码示例。如果您正苦于以下问题:PHP Kwc_Chained_Trl_Component::getChainedByMaster方法的具体用法?PHP Kwc_Chained_Trl_Component::getChainedByMaster怎么用?PHP Kwc_Chained_Trl_Component::getChainedByMaster使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kwc_Chained_Trl_Component
的用法示例。
在下文中一共展示了Kwc_Chained_Trl_Component::getChainedByMaster方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getContentChild
private function _getContentChild()
{
$model = $this->getOwnModel();
$masterChild = $this->getData()->chained->getComponent()->getContentChild();
$c = Kwc_Chained_Trl_Component::getChainedByMaster($masterChild, $this->getData());
$page = $this->getData();
while ($c && (!$c->hasContent() || $this->_getSetting('hasVisible') && $c->parent->getComponent()->getRow() && !$c->parent->getComponent()->getRow()->visible)) {
while ($page && !$page->inherits) {
$page = $page->parent;
if ($page instanceof Kwf_Component_Data_Root) {
break;
}
}
if (!isset($page->chained)) {
$c = null;
break;
}
$masterChild = $page->chained->getChildComponent('-' . $this->getData()->id)->getChildComponent(array('generator' => 'child'));
$c = Kwc_Chained_Trl_Component::getChainedByMaster($masterChild, $this->getData());
if ($page instanceof Kwf_Component_Data_Root) {
break;
}
$page = $page->parent;
}
return $c;
}
示例2: getLinkedData
public final function getLinkedData()
{
if (!isset($this->_data)) {
$masterLinkData = $this->chained->getLinkedData(array('ignoreVisible' => true));
if (!$masterLinkData) {
$this->_data = false;
}
if ($masterLinkData) {
if (is_null($this->_type)) {
throw new Kwf_Exception("_type may not be null");
}
if ($this->_type == 'Trl') {
$linkComponent = Kwc_Chained_Trl_Component::getChainedByMaster($masterLinkData, $this);
} else {
if ($this->_type == 'Cc') {
$linkComponent = Kwc_Chained_Cc_Component::getChainedByMaster($masterLinkData, $this);
}
}
if (!$linkComponent) {
$this->_data = false;
//kann offline sein
} else {
$this->_data = $linkComponent;
}
}
}
$m = Kwc_Abstract::createModel($this->chained->componentClass);
$result = $m->fetchColumnsByPrimaryId(array('anchor'), $this->chained->dbId);
if ($result['anchor']) {
$this->_anchor = $result['anchor'];
}
return $this->_data;
}
示例3: getTemplateVars
public function getTemplateVars()
{
$ret = parent::getTemplateVars();
$menu = array();
$masterMenu = $this->getData()->chained->getComponent()->getMenuData(null, array('ignoreVisible' => true));
foreach ($masterMenu as $m) {
$component = Kwc_Chained_Trl_Component::getChainedByMaster($m['data'], $this->getData());
if ($component) {
$m['submenu'] = array();
$masterSubMenu = $this->getData()->chained->getComponent()->getMenuData($m['data'], array('ignoreVisible' => true), 'Kwc_Menu_Expanded_EditableItems_Component');
foreach ($masterSubMenu as $sm) {
$sComponent = Kwc_Chained_Trl_Component::getChainedByMaster($sm['data'], $this->getData());
if ($sComponent) {
$sm['data'] = $sComponent;
$sm['text'] = $sComponent->name;
$m['submenu'][] = $sm;
}
}
$this->_attachEditableToMenuData($m['submenu']);
$m['data'] = $component;
$m['text'] = $component->name;
$menu[] = $m;
}
}
$ret['menu'] = $menu;
return $ret;
}
示例4: getLinkedData
public final function getLinkedData()
{
if (!isset($this->_data)) {
$masterLinkData = $this->chained->getLinkedData(array('ignoreVisible' => true));
if (!$masterLinkData) {
$this->_data = false;
}
if ($masterLinkData) {
if (is_null($this->_type)) {
throw new Kwf_Exception("_type may not be null");
}
if ($this->_type == 'Trl') {
$linkComponent = Kwc_Chained_Trl_Component::getChainedByMaster($masterLinkData, $this);
} else {
if ($this->_type == 'Cc') {
$linkComponent = Kwc_Chained_Cc_Component::getChainedByMaster($masterLinkData, $this);
}
}
if (!$linkComponent) {
$this->_data = false;
//kann offline sein
} else {
$this->_data = $linkComponent;
}
}
}
return $this->_data;
}
示例5: getTemplateVars
public function getTemplateVars(Kwf_Component_Renderer_Abstract $renderer)
{
$ret = parent::getTemplateVars($renderer);
$ret['link1'] = Kwc_Chained_Trl_Component::getChainedByMaster($ret['link1'], $this->getData());
$ret['link4'] = Kwc_Chained_Trl_Component::getChainedByMaster($ret['link4'], $this->getData());
$ret['link5'] = Kwc_Chained_Trl_Component::getChainedByMaster($ret['link5'], $this->getData());
return $ret;
}
示例6: getTemplateVars
public function getTemplateVars()
{
$ret = parent::getTemplateVars();
$ret['link1'] = Kwc_Chained_Trl_Component::getChainedByMaster($ret['link1'], $this->getData());
$ret['link4'] = Kwc_Chained_Trl_Component::getChainedByMaster($ret['link4'], $this->getData());
$ret['link5'] = Kwc_Chained_Trl_Component::getChainedByMaster($ret['link5'], $this->getData());
return $ret;
}
示例7: attachEditableToMenuData
public function attachEditableToMenuData(&$menuData)
{
foreach ($menuData as $k => &$m) {
if (isset($m['editable']) && $m['editable']) {
$m['editable'] = Kwc_Chained_Trl_Component::getChainedByMaster($m['editable'], $this->getData());
}
}
}
示例8: duplicated
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);
}
}
示例9: _createData
protected function _createData($parentData, $row, $select)
{
$ret = parent::_createData($parentData, $row, $select);
$ret->targetPage = Kwc_Chained_Trl_Component::getChainedByMaster($row->targetPage, $parentData, array('ignoreVisible' => $select->getPart(Kwf_Component_Select::IGNORE_VISIBLE)));
if (!$ret->targetPage) {
return null;
}
return $ret;
}
示例10: _getChainedId
private function _getChainedId($masterId, $select = array())
{
$root = Kwf_Component_Data_Root::getInstance();
$masterData = $root->getComponentById($masterId);
$chainedData = $root->getComponentById('root-en');
$component = Kwc_Chained_Trl_Component::getChainedByMaster($masterData, $chainedData, $select);
if ($component) {
return $component->componentId;
}
return null;
}
示例11: getTemplateVars
public function getTemplateVars(Kwf_Component_Renderer_Abstract $renderer)
{
$ret = parent::getTemplateVars($renderer);
foreach ($ret['links'] as $k => $i) {
$chained = Kwc_Chained_Trl_Component::getChainedByMaster($i['component'], $this->getData());
if ($chained) {
$ret['links'][$k]['component'] = $chained;
} else {
unset($ret['links'][$k]);
}
}
return $ret;
}
示例12: getMenuData
public function getMenuData()
{
$menu = array();
$masterMenu = $this->getData()->chained->getComponent()->getMenuData(null, array('ignoreVisible' => true));
foreach ($masterMenu as $m) {
$component = Kwc_Chained_Trl_Component::getChainedByMaster($m['data'], $this->getData());
if ($component) {
$m['data'] = $component;
$m['text'] = '{name}';
$menu[] = $m;
}
}
$this->_attachEditableToMenuData($menu);
return $menu;
}
示例13: onPageRemovedAdded
public function onPageRemovedAdded(Kwf_Component_Event_Component_AbstractFlag $event)
{
if (!isset($event->component->chained)) {
return;
}
$masterDatas = Kwc_Basic_LinkTag_Intern_Events::getComponentsForTarget(Kwc_Abstract::getSetting($this->_class, 'masterComponentClass'), array((string) $event->component->chained->dbId), false);
foreach ($masterDatas as $c) {
$c = Kwc_Chained_Trl_Component::getChainedByMaster($c, $event->component);
if ($c) {
$this->fireEvent(new Kwf_Component_Event_Component_ContentChanged($this->_class, $c));
if ($c->isPage) {
$this->fireEvent(new Kwf_Component_Event_Page_UrlChanged($this->_class, $c));
}
}
}
}
示例14: getLanguages
public function getLanguages($showCurrent, $fallbackToHome)
{
$ret = array();
foreach ($this->_getLanguages() as $l) {
if (!$showCurrent) {
if ($this->getData()->getLanguage() == $l->getLanguage()) {
continue;
}
}
$masterPage = $this->getData()->getPage();
if (isset($masterPage->chained)) {
$masterPage = $masterPage->chained;
//TODO: nicht sauber
}
$page = null;
if ($masterPage) {
if (is_instance_of($l->componentClass, 'Kwc_Root_TrlRoot_Chained_Component')) {
$page = Kwc_Chained_Trl_Component::getChainedByMaster($masterPage, $l);
} else {
if (is_instance_of($l->componentClass, 'Kwc_Root_TrlRoot_Master_Component')) {
$page = $masterPage;
}
}
$p = $page;
while ($p && $page) {
//TODO dafür müsste es eine bessere methode geben
if (isset($p->row) && isset($p->row->visible) && !$p->row->visible) {
$page = null;
}
$p = $p->parent;
}
}
$home = $l->getChildPage(array('home' => true));
if ($home) {
if (!$fallbackToHome && !$page) {
continue;
}
$ret[] = array('language' => $l->id, 'home' => $home, 'page' => $page ? $page : $home, 'flag' => $l->getChildComponent('-flag'), 'name' => $l->name, 'current' => $this->getData()->getLanguage() == $l->getLanguage());
}
}
if ($showCurrent && $fallbackToHome && count($ret) == 1) {
$ret = array();
}
return $ret;
}
示例15: getTemplateVars
public function getTemplateVars(Kwf_Component_Renderer_Abstract $renderer)
{
$ret = parent::getTemplateVars($renderer);
foreach ($ret['menu'] as $k => $m) {
$ret['menu'][$k]['submenu'] = array();
$masterSubMenu = $this->getData()->chained->getComponent()->getMenuData($m['data']->chained, array('ignoreVisible' => true), 'Kwc_Menu_Expanded_EditableItems_Component');
foreach ($masterSubMenu as $sm) {
$sComponent = Kwc_Chained_Trl_Component::getChainedByMaster($sm['data'], $this->getData());
if ($sComponent) {
$sm['data'] = $sComponent;
$sm['text'] = $sComponent->name;
$ret['menu'][$k]['submenu'][] = $sm;
}
}
$this->_attachEditableToMenuData($ret['menu'][$k]['submenu']);
}
return $ret;
}