本文整理汇总了PHP中Kwf_Component_Data_Root类的典型用法代码示例。如果您正苦于以下问题:PHP Kwf_Component_Data_Root类的具体用法?PHP Kwf_Component_Data_Root怎么用?PHP Kwf_Component_Data_Root使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Kwf_Component_Data_Root类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:8,代码来源:TestCase.php
示例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;
}
开发者ID:nsams,项目名称:koala-framework,代码行数:7,代码来源:Controller.php
示例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);
}
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:10,代码来源:Model.php
示例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);
}
开发者ID:koala-framework,项目名称:koala-framework,代码行数:7,代码来源:Component.php
示例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);
}
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:29,代码来源:Default.php
示例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;
}
开发者ID:koala-framework,项目名称:koala-framework,代码行数:27,代码来源:Component.php
示例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;
}
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:33,代码来源:Component.php
示例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();
}
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:29,代码来源:Admin.php
示例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);
}
开发者ID:nsams,项目名称:koala-framework,代码行数:33,代码来源:KwfController.php
示例10: setUp
public function setUp()
{
Kwf_Component_Data_Root::setComponentClass(false);
if (!`which rrdtool`) {
$this->markTestSkipped();
}
}
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:7,代码来源:AbstractTest.php
示例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);
}
}
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:27,代码来源:Form.php
示例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);
}
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:44,代码来源:Media.php
示例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']);
}
开发者ID:koala-framework,项目名称:koala-framework,代码行数:32,代码来源:Test.php
示例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;
}
开发者ID:koala-framework,项目名称:koala-framework,代码行数:30,代码来源:ImageFile.php
示例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;
}
开发者ID:nsams,项目名称:koala-framework,代码行数:26,代码来源:Assets.php
示例16: findModels
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;
}
开发者ID:koala-framework,项目名称:koala-framework,代码行数:28,代码来源:Components.php
示例17: _initFields
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);
}
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:34,代码来源:Form.php
示例18: _getSelect
protected function _getSelect()
{
//$ret = parent::_getSelect(); what do we lose by not using that?
if ($this->_getParam('filterComponentId')) {
$filter = Kwf_Component_Data_Root::getInstance()->getComponentById($this->_getParam('filterComponentId'));
if (!is_instance_of($filter->componentClass, 'Kwc_Directories_List_Component')) {
$filter = $filter->getChildComponent('-list');
//TODO don't hardcode that here
}
$viewData = $filter->getChildComponent('-view');
//TODO don't hardcode that here
} else {
$viewData = $this->_component;
}
$view = $viewData->getComponent();
if ($view->hasSearchForm()) {
$sf = $view->getSearchForm();
$params = $this->getRequest()->getParams();
$params[$sf->componentId . '-post'] = true;
//post
$params[$sf->componentId] = true;
//submit
$sf->getComponent()->processInput($params);
//TODO don't do processInput here in _getSelect()
}
$ret = $view->getSelect();
return $ret;
}
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:28,代码来源:ViewController.php
示例19: getFavouriteComponentIds
/**
* returns a list of all visible favourite componentIds
*/
public static function getFavouriteComponentIds($favouritesModel)
{
$ret = array();
$userId = Kwf_Registry::get('userModel')->getAuthedUserId();
if ($userId) {
$cacheIdUser = 'favCIds' . $userId;
$ret = Kwf_Cache_Simple::fetch($cacheIdUser, $success);
if (!$success) {
// get all favourites related to user
$select = new Kwf_Model_Select();
$select->whereEquals('user_id', $userId);
$favouritesModel = Kwf_Model_Abstract::getInstance($favouritesModel);
$favourites = $favouritesModel->getRows($select);
$componentIds = array();
foreach ($favourites as $favourite) {
$component = Kwf_Component_Data_Root::getInstance()->getComponentById($favourite->component_id);
// check if component is visible and existent
if ($component) {
// if component is visible create list of users related to component
$componentIds[] = $component->componentId;
}
}
// cache relation of visible components to user
Kwf_Cache_Simple::add($cacheIdUser, $componentIds);
$ret = $componentIds;
}
}
return $ret;
}
开发者ID:koala-framework,项目名称:koala-framework,代码行数:32,代码来源:Component.php
示例20: onOwnRowEvent
public function onOwnRowEvent(Kwf_Events_Event_Row_Abstract $event)
{
$components = Kwf_Component_Data_Root::getInstance()->getComponentsByDbId($event->row->component_id, array('ignoreVisible' => true));
foreach ($components as $component) {
$this->fireEvent(new Kwf_Component_Event_Component_ContentChanged($this->_class, $component));
}
}
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:7,代码来源:Events.php
注:本文中的Kwf_Component_Data_Root类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论