本文整理汇总了PHP中SubPanel::saveSubPanelDefOverride方法的典型用法代码示例。如果您正苦于以下问题:PHP SubPanel::saveSubPanelDefOverride方法的具体用法?PHP SubPanel::saveSubPanelDefOverride怎么用?PHP SubPanel::saveSubPanelDefOverride使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SubPanel
的用法示例。
在下文中一共展示了SubPanel::saveSubPanelDefOverride方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSubpanelOverride
public function testSubpanelOverride()
{
// Create Subpanel 1
$subpanel_1 = array('order' => 100, 'module' => 'Cases', 'subpanel_name' => 'default', 'sort_order' => 'asc', 'sort_by' => 'id', 'title_key' => 'LBL_CONTACTS_CASES_1_FROM_CASES_TITLE', 'get_subpanel_data' => 'contacts_cases_1', 'top_buttons' => array(0 => array('widget_class' => 'SubPanelTopButtonQuickCreate'), 1 => array('widget_class' => 'SubPanelTopSelectButton', 'mode' => 'MultiSelect')));
$subpanel_list_fields_1['list_fields'] = array('priority' => array('type' => 'enum', 'vname' => 'LBL_PRIORITY', 'sortable' => false, 'width' => '10%', 'default' => true));
$subpanel_def_1 = new aSubPanel("contacts_cases_1", $subpanel_1, $this->bean);
$subpanel_1 = new SubPanel('Contacts', 'fab4', $subpanel_def_1->_instance_properties['subpanel_name'], $subpanel_def_1);
$subpanel_1->saveSubPanelDefOverride($subpanel_def_1, 'list_fields', $subpanel_list_fields_1);
$path_1 = 'custom/modules/' . $subpanel_def_1->_instance_properties['module'] . '/metadata/subpanels';
$filename_1 = $subpanel_def_1->parent_bean->object_name . "_subpanel_" . $subpanel_def_1->name;
$extname_1 = '_override' . $subpanel_def_1->parent_bean->object_name . "_subpanel_" . $subpanel_def_1->name;
// Create SubPane 2
$subpanel_2 = array('order' => 100, 'module' => 'Cases', 'subpanel_name' => 'default', 'sort_order' => 'asc', 'sort_by' => 'id', 'title_key' => 'LBL_CONTACTS_CASES_2_FROM_CASES_TITLE', 'get_subpanel_data' => 'contacts_cases_2', 'top_buttons' => array(0 => array('widget_class' => 'SubPanelTopButtonQuickCreate'), 1 => array('widget_class' => 'SubPanelTopSelectButton', 'mode' => 'MultiSelect')));
$subpanel_list_fields_2 = array('case_number' => array('vname' => 'LBL_LIST_NUMBER', 'width' => '6%', 'default' => true));
$subpanel_def_2 = new aSubPanel("contacts_cases_2", $subpanel_2, $this->bean);
$subpanel_2 = new SubPanel('Contacts', 'fab4', $subpanel_def_2->_instance_properties['subpanel_name'], $subpanel_def_2);
$subpanel_2->saveSubPanelDefOverride($subpanel_def_2, 'list_fields', $subpanel_list_fields_2);
$path_2 = 'custom/modules/' . $subpanel_def_2->_instance_properties['module'] . '/metadata/subpanels';
$filename_2 = $subpanel_def_1->parent_bean->object_name . "_subpanel_" . $subpanel_def_2->name;
$extname_2 = '_override' . $subpanel_def_1->parent_bean->object_name . "_subpanel_" . $subpanel_def_2->name;
// Check files genertaed by subpanel overriding : layout override and subpanel overire
$this->filename_check[] = 'custom/Extension/modules/' . $subpanel_def_1->parent_bean->module_dir . "/Ext/Layoutdefs/{$extname_1}.php";
$this->assertTrue(file_exists(end($this->filename_check)));
$this->filename_check[] = $path_1 . '/' . $filename_1 . '.php';
$this->assertTrue(file_exists(end($this->filename_check)));
$this->filename_check[] = 'custom/Extension/modules/' . $subpanel_def_2->parent_bean->module_dir . "/Ext/Layoutdefs/{$extname_2}.php";
$this->assertTrue(file_exists(end($this->filename_check)));
$this->filename_check[] = $path_2 . '/' . $filename_2 . '.php';
$this->assertTrue(file_exists(end($this->filename_check)));
// laout_defs are reloaded in saveSubPanelDefOverride method, we lauched it
global $layout_defs;
// Check override_subpanel_name are differents
$this->assertTrue(isset($layout_defs['Contacts']['subpanel_setup']['contacts_cases_1']['override_subpanel_name']));
$this->assertTrue(isset($layout_defs['Contacts']['subpanel_setup']['contacts_cases_2']['override_subpanel_name']));
$this->assertNotEquals($layout_defs['Contacts']['subpanel_setup']['contacts_cases_1']['override_subpanel_name'], $layout_defs['Contacts']['subpanel_setup']['contacts_cases_2']['override_subpanel_name']);
}
示例2: deploy
function deploy($defs)
{
// first sort out the historical record...
write_array_to_file(self::HISTORYVARIABLENAME, $this->_viewdefs, $this->historyPathname, 'w', '');
$this->_history->append($this->historyPathname);
$this->_viewdefs = $defs;
require_once 'include/SubPanel/SubPanel.php';
$subpanel = new SubPanel($this->_moduleName, 'fab4', $this->_subpanelName, $this->_aSubPanelObject);
$subpanel->saveSubPanelDefOverride($this->_aSubPanelObject, 'list_fields', $defs);
// now clear the cache so that the results are immediately visible
MetaDataFiles::clearModuleClientCache($this->_aSubPanelObject->template_instance->module_name, 'view');
MetaDataFiles::clearModuleClientCache($this->_moduleName, 'layout');
include_once 'include/TemplateHandler/TemplateHandler.php';
TemplateHandler::clearCache($this->_moduleName);
}
示例3: handleSave
function handleSave()
{
$GLOBALS['log']->debug("in ParserModifySubPanel->handleSave()");
require_once 'include/SubPanel/SubPanel.php';
$subpanel = new SubPanel($this->moduleName, 'fab4', $this->subPanelName, $this->panel);
$newFields = array();
foreach ($this->listViewDefs as $name => $field) {
if (!isset($field['usage']) || $field['usage'] != 'query_only') {
$existingFields[$name] = $field;
} else {
$newFields[$name] = $field;
}
}
// Loop through all of the fields defined in the 'Default' group of the ListView data in $_REQUEST
// Replace the field specification in the originalListViewDef with this new updated specification
foreach ($_REQUEST['group_0'] as $field) {
if (!empty($this->originalListViewDefs[$field])) {
$newFields[$field] = $this->originalListViewDefs[$field];
} else {
$vname = '';
if (isset($this->panel->template_instance->field_defs[$field])) {
$vname = $this->panel->template_instance->field_defs[$field]['vname'];
}
if ($this->subPanelParentModule != null && (isset($this->subPanelParentModule->field_name_map[$field]) && ($this->subPanelParentModule->field_name_map[$field]['type'] == 'bool' || isset($this->subPanelParentModule->field_name_map[$field]['custom_type']) && $this->subPanelParentModule->field_name_map[$field]['custom_type'] == 'bool'))) {
$newFields[$field] = array('name' => $field, 'vname' => $vname, 'widget_type' => 'checkbox');
} else {
$newFields[$field] = array('name' => $field, 'vname' => $vname);
}
}
// Now set the field width if specified in the $_REQUEST data
if (isset($_REQUEST[strtolower($field) . 'width'])) {
$width = substr($_REQUEST[strtolower($field) . 'width'], 6, 3);
if (strpos($width, "%") != false) {
$width = substr($width, 0, 2);
}
if ($width < 101 && $width > 0) {
$newFields[$field]['width'] = $width;
}
} else {
if (isset($this->listViewDefs[$field]['width'])) {
$newFields[$field]['width'] = $this->listViewDefs[$field]['width'];
}
}
}
$subpanel->saveSubPanelDefOverride($this->panel, 'list_fields', $newFields);
}