本文整理汇总了PHP中Kwf_Component_Data_Root类的典型用法代码示例。如果您正苦于以下问题:PHP Kwf_Component_Data_Root类的具体用法?PHP Kwf_Component_Data_Root怎么用?PHP Kwf_Component_Data_Root使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Kwf_Component_Data_Root类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _process
protected final function _process()
{
$filename = $this->_root->filename;
Kwf_Events_ModelObserver::getInstance()->process();
Kwf_Component_Data_Root::reset();
$this->_root = Kwf_Component_Data_Root::getInstance();
$this->_root->setFilename($filename);
}
示例2: _getSelect
protected function _getSelect()
{
$ret = parent::_getSelect();
$component = Kwf_Component_Data_Root::getInstance()->getComponentByDbId($this->_getParam('componentId'), array('ignoreVisible' => true));
$ret->whereEquals('component_id', $component->chained->dbId);
return $ret;
}
示例3: output
/**
* Gibt den Komponenten-Baum aus (für CLI)
**/
public static function output()
{
$componentClass = Kwf_Component_Data_Root::getComponentClass();
$model = new self();
$maxComponentLength = self::_maxComponentLength($componentClass, $model);
self::_output(null, $model, $maxComponentLength);
}
示例4: getMediaOutput
public static function getMediaOutput($id, $type, $className)
{
$c = Kwf_Component_Data_Root::getInstance()->getComponentById($id, array('ignoreVisible' => true));
$cls = $c->chained->componentClass;
$cls = strpos($cls, '.') ? substr($cls, 0, strpos($cls, '.')) : $cls;
return call_user_func(array($cls, 'getMediaOutput'), $c->chained->componentId, $type, $c->chained->componentClass);
}
示例5: __construct
public function __construct()
{
$providers = array();
if (Kwf_Component_Data_Root::getComponentClass()) {
$providers[] = new Kwf_Assets_Components_Provider(Kwf_Component_Data_Root::getComponentClass());
} else {
$providers[] = new Kwf_Assets_Provider_NoComponents();
}
if (file_exists('dependencies.ini')) {
$providers[] = new Kwf_Assets_Provider_Ini('dependencies.ini');
}
$providers = array_merge($providers, self::getVendorProviders());
$providers[] = new Kwf_Assets_Provider_IniNoFiles();
$providers[] = new Kwf_Assets_Provider_Dynamic();
$providers[] = new Kwf_Assets_TinyMce_Provider();
$providers[] = new Kwf_Assets_Provider_JsClassKwf();
$providers[] = new Kwf_Assets_Provider_JsClass('./ext', 'web/ext', 'App');
$providers[] = new Kwf_Assets_Provider_CssByJs(array('web/ext', 'kwf/commonjs'));
$providers[] = new Kwf_Assets_Provider_ExtTrl();
$providers[] = new Kwf_Assets_Provider_ErrorHandler();
$providers[] = new Kwf_Assets_Provider_AtRequires();
$providers[] = new Kwf_Assets_Provider_ViewsUser();
$providers[] = new Kwf_Assets_Modernizr_Provider();
$providers[] = new Kwf_Assets_CommonJs_Provider();
$providers[] = new Kwf_Assets_Provider_KwfCommonJs();
$providers[] = new Kwf_Assets_CommonJs_JQueryPluginProvider();
$providers[] = new Kwf_Assets_ResponsiveEl_Provider();
parent::__construct($providers);
}
示例6: getAllChainedByMasterFromChainedStart
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::getChainedByMasterAndType($master, $chainedStart, $chainedType, $parentDataSelect);
if ($i) {
$ret[] = $i;
}
}
return $ret;
}
示例7: getIncludeCode
/**
* Puts a JavaScript Variable used in Kwf_js/Statistics.js
*
* @return string
*/
public function getIncludeCode()
{
$value = Kwf_Statistics::getDefaultOptValue($this->getData());
$optInShowBox = $this->getData()->getBaseProperty('statistics.optInShowBox');
$html = '';
if ($value == 'out' || $value == 'in' && $optInShowBox) {
$components = Kwf_Component_Data_Root::getInstance()->getComponentsByClass('Kwc_Statistics_Opt_Component', array('subroot' => $this->getData()));
$url = isset($components[0]) ? $components[0]->url : null;
$html = $this->_getOptBoxInnerHtml($url);
if (!$html) {
$exception = new Kwf_Exception('To disable optbox please change config.');
$exception->logOrThrow();
}
$html = '<div class="' . self::getRootElementClass($this) . '"><div class="inner">' . $html . '<div></div>';
$html = str_replace("'", "\\'", $html);
}
$ret = '<script type="text/javascript">';
//TODO commonjs
/*
$ret .= "if (typeof Kwf == 'undefined') Kwf = {};";
$ret .= "if (typeof Kwf.Statistics == 'undefined') Kwf.Statistics = {};";
$ret .= "Kwf.Statistics.defaultOptValue = '$value';";
$ret .= "Kwf.Statistics.optBoxHtml = '$html';";
*/
$ret .= $this->_getJavascriptIncludeCode();
$ret .= '</script>';
return $ret;
}
示例8: afterDuplicate
public function afterDuplicate($rootSource, $rootTarget)
{
parent::afterDuplicate($rootSource, $rootTarget);
foreach ($this->_duplicated as $d) {
//modify duplicated links so they point to duplicated page
//only IF link points to page below $rootSource
$source = Kwf_Component_Data_Root::getInstance()->getComponentById($d['source'], array('ignoreVisible' => true));
$sourceLinkedData = $source->getLinkedData();
if (!$sourceLinkedData) {
continue;
}
$linkTargetIsBelowRootSource = false;
$data = $sourceLinkedData;
do {
if ($data->componentId == $rootSource->componentId) {
$linkTargetIsBelowRootSource = true;
break;
}
} while ($data = $data->parent);
unset($data);
if ($linkTargetIsBelowRootSource) {
$target = Kwf_Component_Data_Root::getInstance()->getComponentById($d['target'], array('ignoreVisible' => true));
$targetRow = $target->getComponent()->getRow();
$this->_modifyOwnRowAfterDuplicate($targetRow, $sourceLinkedData);
$targetRow->save();
}
}
$this->_duplicated = array();
}
示例9: getLanguages
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);
}
示例10: setUp
public function setUp()
{
Kwf_Component_Data_Root::setComponentClass(false);
if (!`which rrdtool`) {
$this->markTestSkipped();
}
}
示例11: _initFields
protected function _initFields()
{
parent::_initFields();
$userEditForm = $this->fields->add(new $this->_userDataFormName('user'));
$userEditForm->setIdTemplate('{0}');
$root = Kwf_Component_Data_Root::getInstance();
if ($root) {
$userDirectory = $root->getComponentByClass('Kwc_User_Directory_Component');
}
if ($root && isset($userDirectory) && $userDirectory) {
$detailClass = Kwc_Abstract::getChildComponentClass($userDirectory->componentClass, 'detail');
$userEditForm->addUserForms($detailClass, array('general'));
$userEditForm->fields['firstname']->setAllowBlank(true);
$userEditForm->fields['lastname']->setAllowBlank(true);
} else {
$this->fields->add(new Kwc_User_Detail_General_Form('general', null))->setIdTemplate('{0}');
}
$config = Zend_Registry::get('config');
$authedUser = Kwf_Registry::get('userModel')->getAuthedUser();
if (isset($authedUser->language) && $config->languages) {
$data = array();
foreach ($config->languages as $key => $value) {
$data[$key] = $value;
}
$this->fields->add(new Kwf_Form_Field_Select('language', trlKwf('Language')))->setValues($data);
}
}
示例12: getUrl
/**
*
* @param string
* @param string
* @param string
* @param string
* @param int Kann gesetzt werden wenn wir in diesem web auf das bild nicht direkten zugriff haben
* sondern nur für ein anderes web die url generieren
*/
public static function getUrl($class, $id, $type, $filename, $time = null)
{
if ($filename instanceof Kwf_Uploads_Row) {
$filename = $filename->filename . '.' . $filename->extension;
}
if ($filename == '.') {
$filename = '';
}
//Replace Slashes and Backslashes with an underscore
//Otherwise we would get a wrong url
//e.g. $filename = foo/bar.png -> /media/FooModel/1/default/ab123/1234/foo/bar.png
$filename = str_replace('/', '_', $filename);
$filename = str_replace('\\', '_', $filename);
$checksumType = $type;
if (substr($type, 0, strlen(Kwf_Media::DONT_HASH_TYPE_PREFIX)) == Kwf_Media::DONT_HASH_TYPE_PREFIX) {
$checksumType = Kwf_Media::DONT_HASH_TYPE_PREFIX;
}
$class = rawurlencode($class);
$checksum = self::getChecksum($class, $id, $checksumType, rawurlencode($filename));
$prefix = Kwf_Setup::getBaseUrl();
if ($r = Kwf_Component_Data_Root::getInstance()) {
if ($r->filename) {
$prefix .= '/' . $r->filename;
}
}
if (is_null($time)) {
$cacheId = 'mtime-' . self::createCacheId($class, $id, $type);
$time = Kwf_Media_MemoryCache::getInstance()->load($cacheId);
if (!$time) {
$time = time();
Kwf_Media_MemoryCache::getInstance()->save($time, $cacheId);
}
}
return $prefix . '/media/' . $class . '/' . $id . '/' . $type . '/' . $checksum . '/' . $time . '/' . rawurlencode($filename);
}
示例13: testNodeConfig
public function testNodeConfig()
{
$user = 'test';
$c = Kwf_Component_Data_Root::getInstance();
$cfg = Kwf_Controller_Action_Component_PagesController::getComponentNodeConfig($c, $user, $this->_acl);
$this->assertFalse($cfg['actions']['add']);
$this->assertFalse($cfg['allowDrop']);
$this->assertFalse($cfg['actions']['delete']);
$this->assertFalse($cfg['actions']['makeHome']);
$this->assertFalse($cfg['allowDrag']);
$c = Kwf_Component_Data_Root::getInstance()->getComponentById('root-main');
$cfg = Kwf_Controller_Action_Component_PagesController::getComponentNodeConfig($c, $user, $this->_acl);
$this->assertFalse($cfg['actions']['delete']);
$this->assertFalse($cfg['actions']['makeHome']);
$this->assertTrue($cfg['actions']['add']);
$this->assertTrue($cfg['allowDrop']);
$this->assertFalse($cfg['allowDrag']);
$c = Kwf_Component_Data_Root::getInstance()->getComponentById('1');
$cfg = Kwf_Controller_Action_Component_PagesController::getComponentNodeConfig($c, $user, $this->_acl);
$this->assertTrue($cfg['actions']['delete']);
$this->assertTrue($cfg['actions']['makeHome']);
$this->assertTrue($cfg['actions']['add']);
$this->assertTrue($cfg['allowDrop']);
$this->assertTrue($cfg['allowDrag']);
$c = Kwf_Component_Data_Root::getInstance()->getComponentById('3');
$cfg = Kwf_Controller_Action_Component_PagesController::getComponentNodeConfig($c, $user, $this->_acl);
$this->assertTrue($cfg['actions']['delete']);
$this->assertTrue($cfg['actions']['makeHome']);
$this->assertTrue($cfg['actions']['add']);
$this->assertTrue($cfg['allowDrop']);
$this->assertTrue($cfg['allowDrag']);
}
示例14: load
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;
}
示例15: _getAllLanguages
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;
}