本文整理汇总了PHP中Administration::get_config_prefix方法的典型用法代码示例。如果您正苦于以下问题:PHP Administration::get_config_prefix方法的具体用法?PHP Administration::get_config_prefix怎么用?PHP Administration::get_config_prefix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Administration
的用法示例。
在下文中一共展示了Administration::get_config_prefix方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testget_config_prefix
public function testget_config_prefix()
{
$admin = new Administration();
//test with empty string
$expected = array(false, false);
$actual = $admin->get_config_prefix('');
$this->assertSame($expected, $actual);
//test with a valid string
$expected = array('category', 'test');
$actual = $admin->get_config_prefix('category_test');
$this->assertSame($expected, $actual);
}
示例2: display
/**
* @see SugarView::display()
*/
public function display()
{
global $mod_strings, $app_strings, $app_list_strings;
require_once "modules/Configurator/metadata/SugarpdfSettingsdefs.php";
if (file_exists('custom/modules/Configurator/metadata/SugarpdfSettingsdefs.php')) {
require_once 'custom/modules/Configurator/metadata/SugarpdfSettingsdefs.php';
}
if (!empty($_POST['save'])) {
// Save the logos
$error = $this->checkUploadImage();
if (empty($error)) {
$focus = new Administration();
foreach ($SugarpdfSettings as $k => $v) {
if ($v['type'] == 'password') {
if (isset($_POST[$k])) {
$_POST[$k] = blowfishEncode(blowfishGetKey($k), $_POST[$k]);
}
}
}
if (!empty($_POST["sugarpdf_pdf_class"]) && $_POST["sugarpdf_pdf_class"] != PDF_CLASS) {
// clear the cache for quotes detailview in order to switch the pdf class.
if (is_file($cachedfile = sugar_cached('modules/Quotes/DetailView.tpl'))) {
unlink($cachedfile);
}
}
$focus->saveConfig();
header('Location: index.php?module=Administration&action=index');
}
}
if (!empty($_POST['restore'])) {
$focus = new Administration();
foreach ($_POST as $key => $val) {
$prefix = $focus->get_config_prefix($key);
if (in_array($prefix[0], $focus->config_categories)) {
$result = $focus->db->query("SELECT count(*) AS the_count FROM config WHERE category = '{$prefix[0]}' AND name = '{$prefix[1]}'");
$row = $focus->db->fetchByAssoc($result);
if ($row['the_count'] != 0) {
$focus->db->query("DELETE FROM config WHERE category = '{$prefix[0]}' AND name = '{$prefix[1]}'");
}
}
}
header('Location: index.php?module=Configurator&action=SugarpdfSettings');
}
echo getClassicModuleTitle("Administration", array("<a href='index.php?module=Administration&action=index'>" . translate('LBL_MODULE_NAME', 'Administration') . "</a>", $mod_strings['LBL_PDFMODULE_NAME']), false);
$pdf_class = array("TCPDF" => "TCPDF", "EZPDF" => "EZPDF");
$this->ss->assign('APP_LIST', $app_list_strings);
$this->ss->assign("JAVASCRIPT", get_set_focus_js());
$this->ss->assign("SugarpdfSettings", $SugarpdfSettings);
$this->ss->assign("pdf_enable_ezpdf", PDF_ENABLE_EZPDF);
if (PDF_ENABLE_EZPDF == "0" && PDF_CLASS == "EZPDF") {
$error = "ERR_EZPDF_DISABLE";
$this->ss->assign("selected_pdf_class", "TCPDF");
} else {
$this->ss->assign("selected_pdf_class", PDF_CLASS);
}
$this->ss->assign("pdf_class", $pdf_class);
if (!empty($error)) {
$this->ss->assign("error", $mod_strings[$error]);
}
if (!function_exists('imagecreatefrompng')) {
$this->ss->assign("GD_WARNING", 1);
} else {
$this->ss->assign("GD_WARNING", 0);
}
$this->ss->display('modules/Configurator/tpls/SugarpdfSettings.tpl');
require_once "include/javascript/javascript.php";
$javascript = new javascript();
$javascript->setFormName("ConfigureSugarpdfSettings");
foreach ($SugarpdfSettings as $k => $v) {
if (isset($v["required"]) && $v["required"] == true) {
$javascript->addFieldGeneric($k, "varchar", $v['label'], TRUE, "");
}
}
echo $javascript->getScript();
}
示例3: Administration
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
global $current_user;
if (!is_admin($current_user)) {
sugar_die("Unauthorized access to administration.");
}
$focus = new Administration();
// filter for relevant POST data and update config table
foreach ($_POST as $key => $val) {
$prefix = $focus->get_config_prefix($key);
if (in_array($prefix[0], $focus->config_categories)) {
if ($prefix[0] == "license") {
if ($prefix[1] == "expire_date") {
global $timedate;
$val = $timedate->swap_formats($val, $timedate->get_date_format(), $timedate->dbDayFormat);
} else {
if ($prefix[1] == "key") {
$val = trim($val);
// bug 16860 tyoung - trim whitespace from the start and end of the licence key value
}
}
}
$focus->saveSetting($prefix[0], $prefix[1], $val);
}
}