本文整理汇总了PHP中Tinebase_Config::getAppConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP Tinebase_Config::getAppConfig方法的具体用法?PHP Tinebase_Config::getAppConfig怎么用?PHP Tinebase_Config::getAppConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tinebase_Config
的用法示例。
在下文中一共展示了Tinebase_Config::getAppConfig方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
/**
* get by id
*
* @param string $_id
* @return Tinebase_Record_RecordSet
* @throws Tinebase_Exception_AccessDenied
*/
public function get($_id)
{
$configRecord = $this->_configBackend->get($_id);
$app = Tinebase_Application::getInstance()->getApplicationById($configRecord->application_id);
if (!Tinebase_Core::getUser()->hasRight($app->name, 'admin')) {
throw new Tinebase_Exception_AccessDenied("You do not have admin rights for {$app->name}");
}
$appConfigObject = Tinebase_Config::getAppConfig($app->name);
$definition = $appConfigObject->getDefinition($configRecord->name);
$this->_mergeDefinition($configRecord, $definition);
$configRecord->source = Tinebase_Model_Config::SOURCE_DB;
return $configRecord;
}
示例2: update_14
/**
* update to 8.15
*
* move keyFieldConfig defaults to config files
*/
public function update_14()
{
// either put default to DB or delete form DB
$cb = new Tinebase_Backend_Sql(array('modelName' => 'Tinebase_Model_Config', 'tableName' => 'config'));
$configRecords = $cb->getAll();
// iterate installed apps
foreach (Tinebase_Application::getInstance()->getApplications() as $application) {
try {
// get config
$config = Tinebase_Config::getAppConfig($application->name);
if (!method_exists($config, 'getProperties')) {
continue;
}
foreach ($config->getProperties() as $name => $property) {
if ($property['type'] == Tinebase_Config_Abstract::TYPE_KEYFIELD_CONFIG) {
$dbConfig = $config->get($name);
$dbConfigRecords = $dbConfig['records']->toArray();
$defaultRecords = isset($property['default']['records']) ? $property['default']['records'] : null;
if ($defaultRecords && json_encode($dbConfigRecords) != json_encode($defaultRecords)) {
// set default value
if (array_key_exists('default', $property['default'])) {
$dbConfig->default = $property['default']['default'];
$config->set($name, $dbConfig->toArray());
}
} else {
// delete default config
$configRecord = $configRecords->filter('application_id', $application->getId())->filter('name', $name)->getFirstRecord();
if ($configRecord) {
$cb->delete($configRecord->getId());
}
}
}
}
} catch (Exception $e) {
Setup_Core::getLogger()->err(__METHOD__ . '::' . __LINE__ . ' could not migrate keyFieldConfig ' . $e);
}
}
$this->setApplicationVersion('Tinebase', '8.15');
}
示例3: saveConfigSettings
/**
* save settings
*
* @param array $_settings
* @return void
*/
public function saveConfigSettings($_settings)
{
// only admins are allowed to do this
$this->checkRight(Tinebase_Acl_Rights::ADMIN);
$appConfig = Tinebase_Config::getAppConfig($this->_applicationName);
if ($appConfig !== NULL) {
$appConfig->set(Tinebase_Config::APPDEFAULTS, $_settings);
}
}
示例4: _getResolvedKeyfield
/**
* return translated Keyfield string
*
* @param String $_property
* @param String $_keyfield
* @param String $_application
* @return string
*/
protected function _getResolvedKeyfield($_property, $_keyfield, $_application)
{
$i18nApplication = Tinebase_Translation::getTranslation($_application);
$config = Tinebase_Config::getAppConfig($_application);
$result = $config->get($_keyfield)->records->getById($_property);
return isset($result->value) ? $i18nApplication->translate($result->value) : $_property;
}