本文整理汇总了PHP中Relationship::load_relationship_meta方法的典型用法代码示例。如果您正苦于以下问题:PHP Relationship::load_relationship_meta方法的具体用法?PHP Relationship::load_relationship_meta怎么用?PHP Relationship::load_relationship_meta使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Relationship
的用法示例。
在下文中一共展示了Relationship::load_relationship_meta方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testload_relationship_meta
public function testload_relationship_meta()
{
//unset and reconnect Db to resolve mysqli fetch exeception
global $db;
unset($db->database);
$db->checkConnection();
$relationship = new Relationship();
$relationship->load_relationship_meta();
$this->assertTrue(isset($GLOBALS['relationships']));
}
示例2: display
function display($showContainer = true, $forceTabless = false)
{
global $layout_edit_mode, $sugar_version, $sugar_config, $current_user, $app_strings;
if (isset($layout_edit_mode) && $layout_edit_mode) {
return;
}
global $modListHeader;
ob_start();
echo '<script type="text/javascript" src="' . getJSPath('include/SubPanel/SubPanelTiles.js') . '"></script>';
?>
<script>
if(document.DetailView != null &&
document.DetailView.elements != null &&
document.DetailView.elements.layout_def_key != null &&
typeof document.DetailView.elements['layout_def_key'] != 'undefined'){
document.DetailView.elements['layout_def_key'].value = '<?php
echo $this->layout_def_key;
?>
';
}
</script>
<?php
$tabs = array();
$default_div_display = 'inline';
if (!empty($sugar_config['hide_subpanels_on_login'])) {
if (!isset($_SESSION['visited_details'][$this->focus->module_dir])) {
setcookie($this->focus->module_dir . '_divs', '');
unset($_COOKIE[$this->focus->module_dir . '_divs']);
$_SESSION['visited_details'][$this->focus->module_dir] = true;
}
$default_div_display = 'none';
}
$div_cookies = get_sub_cookies($this->focus->module_dir . '_divs');
//Display the group header. this section is executed only if the tabbed interface is being used.
$current_key = '';
if (!empty($this->show_tabs)) {
require_once 'include/tabs.php';
$tab_panel = new SugarWidgetTabs($tabs, $current_key, 'showSubPanel');
echo get_form_header('Related', '', false);
echo "<br />" . $tab_panel->display();
}
if (empty($_REQUEST['subpanels'])) {
$selected_group = $forceTabless ? '' : $this->getSelectedGroup();
$usersLayout = $current_user->getPreference('subpanelLayout', $this->focus->module_dir);
// we need to use some intelligence here when restoring the user's layout, as new modules with new subpanels might have been installed since the user's layout was recorded
// this means that we can't just restore the old layout verbatim as the new subpanels would then go walkabout
// so we need to do a merge while attempting as best we can to preserve the sense of the specified order
// this is complicated by the different ordering schemes used in the two sources for the panels: the user's layout uses an ordinal layout, the panels from getTabs have an explicit ordering driven by the 'order' parameter
// it's not clear how to best reconcile these two schemes; so we punt on it, and add all new panels to the end of the user's layout. At least this will give them a clue that something has changed...
// we also now check for tabs that have been removed since the user saved his or her preferences.
$tabs = $this->getTabs($showContainer, $selected_group);
if (!empty($usersLayout)) {
$availableTabs = $tabs;
$tabs = array_intersect($usersLayout, $availableTabs);
// remove any tabs that have been removed since the user's layout was saved
foreach (array_diff($availableTabs, $usersLayout) as $tab) {
$tabs[] = $tab;
}
}
} else {
$tabs = explode(',', $_REQUEST['subpanels']);
}
$tab_names = array();
if ($showContainer) {
echo '<ul class="noBullet" id="subpanel_list">';
}
//echo "<li id='hidden_0' style='height: 5px' class='noBullet'> </li>";
if (empty($GLOBALS['relationships'])) {
if (!class_exists('Relationship')) {
require 'modules/Relationships/Relationship.php';
}
$rel = new Relationship();
$rel->load_relationship_meta();
}
// this array will store names of sub-panels that can contain items
// of each module
$module_sub_panels = array();
foreach ($tabs as $tab) {
//load meta definition of the sub-panel.
$thisPanel = $this->subpanel_definitions->load_subpanel($tab);
if ($thisPanel === false) {
continue;
}
//this if-block will try to skip over ophaned subpanels. Studio/MB are being delete unloaded modules completely.
//this check will ignore subpanels that are collections (activities, history, etc)
if (!isset($thisPanel->_instance_properties['collection_list']) and isset($thisPanel->_instance_properties['get_subpanel_data'])) {
//ignore when data source is a function
if (!isset($this->focus->field_defs[$thisPanel->_instance_properties['get_subpanel_data']])) {
if (stripos($thisPanel->_instance_properties['get_subpanel_data'], 'function:') === false) {
Log::fatal("Bad subpanel definition, it has incorrect value for get_subpanel_data property " . $tab);
continue;
}
} else {
$rel_name = '';
if (isset($this->focus->field_defs[$thisPanel->_instance_properties['get_subpanel_data']]['relationship'])) {
$rel_name = $this->focus->field_defs[$thisPanel->_instance_properties['get_subpanel_data']]['relationship'];
}
if (empty($rel_name) or !isset($GLOBALS['relationships'][$rel_name])) {
Log::fatal("Missing relationship definition " . $rel_name . ". skipping " . $tab . " subpanel");
continue;
//.........这里部分代码省略.........
示例3: display
function display($showContainer = true, $forceTabless = false)
{
global $layout_edit_mode, $sugar_version, $sugar_config, $current_user, $app_strings, $modListHeader;
if (isset($layout_edit_mode) && $layout_edit_mode) {
return;
}
$template = new Sugar_Smarty();
$template_header = "";
$template_body = "";
$template_footer = "";
$tabs = array();
$tabs_properties = array();
$tab_names = array();
$default_div_display = 'inline';
if (!empty($sugar_config['hide_subpanels_on_login'])) {
if (!isset($_SESSION['visited_details'][$this->focus->module_dir])) {
setcookie($this->focus->module_dir . '_divs', '', 0, null, null, false, true);
unset($_COOKIE[$this->focus->module_dir . '_divs']);
$_SESSION['visited_details'][$this->focus->module_dir] = true;
}
$default_div_display = 'none';
}
$div_cookies = get_sub_cookies($this->focus->module_dir . '_divs');
if (empty($_REQUEST['subpanels'])) {
$selected_group = $forceTabless ? '' : $this->getSelectedGroup();
$usersLayout = $current_user->getPreference('subpanelLayout', $this->focus->module_dir);
// we need to use some intelligence here when restoring the user's layout, as new modules with new subpanels might have been installed since the user's layout was recorded
// this means that we can't just restore the old layout verbatim as the new subpanels would then go walkabout
// so we need to do a merge while attempting as best we can to preserve the sense of the specified order
// this is complicated by the different ordering schemes used in the two sources for the panels: the user's layout uses an ordinal layout, the panels from getTabs have an explicit ordering driven by the 'order' parameter
// it's not clear how to best reconcile these two schemes; so we punt on it, and add all new panels to the end of the user's layout. At least this will give them a clue that something has changed...
// we also now check for tabs that have been removed since the user saved his or her preferences.
$tabs = $this->getTabs($showContainer, $selected_group);
if (!empty($usersLayout)) {
$availableTabs = $tabs;
$tabs = array_intersect($usersLayout, $availableTabs);
// remove any tabs that have been removed since the user's layout was saved
foreach (array_diff($availableTabs, $usersLayout) as $tab) {
$tabs[] = $tab;
}
}
} else {
$tabs = explode(',', $_REQUEST['subpanels']);
}
// Display the group header. this section is executed only if the tabbed interface is being used.
$current_key = '';
if (!empty($this->show_tabs)) {
require_once 'include/tabs.php';
$tab_panel = new SugarWidgetTabs($tabs, $current_key, 'showSubPanel');
$template_header .= get_form_header('Related', '', false);
$template_header .= $tab_panel->display();
}
if (empty($GLOBALS['relationships'])) {
if (!class_exists('Relationship')) {
require 'modules/Relationships/Relationship.php';
}
$rel = new Relationship();
$rel->load_relationship_meta();
}
foreach ($tabs as $t => $tab) {
// load meta definition of the sub-panel.
$thisPanel = $this->subpanel_definitions->load_subpanel($tab);
if ($thisPanel === false) {
continue;
}
// this if-block will try to skip over ophaned subpanels. Studio/MB are being delete unloaded modules completely.
// this check will ignore subpanels that are collections (activities, history, etc)
if (!isset($thisPanel->_instance_properties['collection_list']) and isset($thisPanel->_instance_properties['get_subpanel_data'])) {
// ignore when data source is a function
if (!isset($this->focus->field_defs[$thisPanel->_instance_properties['get_subpanel_data']])) {
if (stripos($thisPanel->_instance_properties['get_subpanel_data'], 'function:') === false) {
$GLOBALS['log']->fatal("Bad subpanel definition, it has incorrect value for get_subpanel_data property " . $tab);
continue;
}
} else {
$rel_name = '';
if (isset($this->focus->field_defs[$thisPanel->_instance_properties['get_subpanel_data']]['relationship'])) {
$rel_name = $this->focus->field_defs[$thisPanel->_instance_properties['get_subpanel_data']]['relationship'];
}
if (empty($rel_name) or !isset($GLOBALS['relationships'][$rel_name])) {
$GLOBALS['log']->fatal("Missing relationship definition " . $rel_name . ". skipping " . $tab . " subpanel");
continue;
}
}
}
if ($thisPanel->isCollection()) {
// collect names of sub-panels that may contain items of each module
$collection_list = $thisPanel->get_inst_prop_value('collection_list');
if (is_array($collection_list)) {
foreach ($collection_list as $data) {
if (!empty($data['module'])) {
$module_sub_panels[$data['module']][$tab] = true;
}
}
}
} else {
$module = $thisPanel->get_module_name();
if (!empty($module)) {
$module_sub_panels[$module][$tab] = true;
}
//.........这里部分代码省略.........