本文整理汇总了PHP中sugarArrayMerge函数的典型用法代码示例。如果您正苦于以下问题:PHP sugarArrayMerge函数的具体用法?PHP sugarArrayMerge怎么用?PHP sugarArrayMerge使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sugarArrayMerge函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgradeLocaleNameFormat
protected function upgradeLocaleNameFormat($name_format)
{
if (!in_array($name_format, $this->config['name_formats'])) {
$new_config = sugarArrayMerge($this->config['name_formats'], array($name_format => $name_format));
$this->upgrader->config['name_formats'] = $new_config;
}
}
示例2: handleOverride
function handleOverride()
{
global $sugar_config, $sugar_version;
$sc = SugarConfig::getInstance();
$overrideArray = $this->readOverride();
$this->previous_sugar_override_config_array = $overrideArray;
$diffArray = deepArrayDiff($this->config, $sugar_config);
$overrideArray = sugarArrayMerge($overrideArray, $diffArray);
$overideString = "<?php\n/***CONFIGURATOR***/\n";
sugar_cache_put('sugar_config', $this->config);
$GLOBALS['sugar_config'] = $this->config;
foreach ($overrideArray as $key => $val) {
if (in_array($key, $this->allow_undefined) || isset($sugar_config[$key])) {
if (strcmp("{$val}", 'true') == 0) {
$val = true;
$this->config[$key] = $val;
}
if (strcmp("{$val}", 'false') == 0) {
$val = false;
$this->config[$key] = false;
}
}
$overideString .= override_value_to_string_recursive2('sugar_config', $key, $val);
}
$overideString .= '/***CONFIGURATOR***/';
$this->saveOverride($overideString);
if (isset($this->config['logger']['level']) && $this->logger) {
$this->logger->setLevel($this->config['logger']['level']);
}
}
示例3: display
function display()
{
$this->parser = ParserFactory::getParser(MB_PORTAL . strtolower($this->editLayout), $this->editModule, null, null, MB_PORTAL);
$smarty = new Sugar_Smarty();
//Add in the module we are viewing to our current mod strings
global $mod_strings, $current_language;
$editModStrings = return_module_language($current_language, $this->editModule);
$mod_strings = sugarArrayMerge($editModStrings, $mod_strings);
$smarty->assign('mod', $mod_strings);
$smarty->assign('MOD', $mod_strings);
// assign buttons
$images = array('icon_save' => 'studio_save', 'icon_publish' => 'studio_publish', 'icon_address' => 'icon_Address', 'icon_emailaddress' => 'icon_EmailAddress', 'icon_phone' => 'icon_Phone');
foreach ($images as $image => $file) {
$smarty->assign($image, SugarThemeRegistry::current()->getImage($file, '', null, null, '.gif', $file));
}
$smarty->assign('icon_delete', SugarThemeRegistry::current()->getImage('icon_Delete', '', 48, 48, '.gif', $mod_strings['LBL_MB_DELETE']));
$buttons = array();
$buttons[] = array('id' => 'saveBtn', 'image' => SugarThemeRegistry::current()->getImage($images['icon_save'], '', null, null, '.gif', $mod_strings['LBL_BTN_SAVE']), 'text' => $GLOBALS['mod_strings']['LBL_BTN_SAVE'], 'actionScript' => "onclick='if(Studio2.checkCalcFields(\"{$_REQUEST['view']}\", \"ERROR_CALCULATED_PORTAL_FIELDS\"))Studio2.handleSave();'");
$buttons[] = array('id' => 'publishBtn', 'image' => SugarThemeRegistry::current()->getImage($images['icon_publish'], '', null, null, '.gif', $mod_strings['LBL_BTN_PUBLISH']), 'text' => $GLOBALS['mod_strings']['LBL_BTN_SAVEPUBLISH'], 'actionScript' => "onclick='if(Studio2.checkCalcFields(\"{$_REQUEST['view']}\", \"ERROR_CALCULATED_PORTAL_FIELDS\"))Studio2.handlePublish();'");
$html = "";
foreach ($buttons as $button) {
if ($button['id'] == "spacer") {
$html .= "<td style='width:{$button['width']}'> </td>";
} else {
$html .= "<td><input id='{$button['id']}' type='button' valign='center' class='button' style='cursor:pointer' " . "onmousedown='this.className=\"buttonOn\";return false;' onmouseup='this.className=\"button\"' " . "onmouseout='this.className=\"button\"' {$button['actionScript']} value = '{$button['text']}' ></td>";
}
}
$smarty->assign('buttons', $html);
// assign fields and layout
$smarty->assign('available_fields', $this->parser->getAvailableFields());
$smarty->assign('field_defs', $this->parser->getFieldDefs());
$smarty->assign('layout', $this->parser->getLayout());
$smarty->assign('view_module', $this->editModule);
$smarty->assign('calc_field_list', json_encode($this->parser->getCalculatedFields()));
$smarty->assign('view', $this->editLayout);
$smarty->assign('maxColumns', $this->parser->getMaxColumns());
$smarty->assign('fieldwidth', '150px');
$smarty->assign('translate', true);
$smarty->assign('fromPortal', true);
// flag for form submittal - when the layout is submitted the actions are the same for layouts and portal layouts, but the parsers must be different...
if (!empty($this->parser->usingWorkingFile)) {
$smarty->assign('layouttitle', $GLOBALS['mod_strings']['LBL_LAYOUT_PREVIEW']);
} else {
$smarty->assign('layouttitle', $GLOBALS['mod_strings']['LBL_CURRENT_LAYOUT']);
}
$ajax = new AjaxCompose();
$ajax->addCrumb(translate('LBL_SUGARPORTAL', 'ModuleBuilder'), 'ModuleBuilder.main("sugarportal")');
$ajax->addCrumb(translate('LBL_LAYOUTS', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&portal=1&layout=1")');
$ajax->addCrumb(ucwords(translate('LBL_MODULE_NAME', $this->editModule)), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&portal=1&view_module=' . $this->editModule . '")');
$ajax->addCrumb(ucwords($this->editLayout), '');
// set up language files
$smarty->assign('language', $this->parser->getLanguage());
// for sugar_translate in the smarty template
//navjeet- assistant logic has changed
//include('modules/ModuleBuilder/language/en_us.lang.php');
//$smarty->assign('assistantBody', $mod_strings['assistantHelp']['module']['editView'] );
$ajax->addSection('center', $GLOBALS['mod_strings']['LBL_EDIT_LAYOUT'], $smarty->fetch('modules/ModuleBuilder/tpls/layoutView.tpl'));
echo $ajax->getJavascript();
}
示例4: testSugarArrayMergeMergesTwoArraysWithLikeKeysOverwritingExistingKeys
public function testSugarArrayMergeMergesTwoArraysWithLikeKeysOverwritingExistingKeys()
{
$foo = array('one' => 123, 'two' => 123, 'foo' => array('int' => 123, 'foo' => 'bar'));
$bar = array('one' => 123, 'two' => 321, 'foo' => array('int' => 123, 'bar' => 'foo'));
$expected = array('one' => 123, 'two' => 321, 'foo' => array('int' => 123, 'foo' => 'bar', 'bar' => 'foo'));
$this->assertEquals(sugarArrayMerge($foo, $bar), $expected);
// insure that internal functions can't duplicate behavior
$this->assertNotEquals(array_merge($foo, $bar), $expected);
$this->assertNotEquals(array_merge_recursive($foo, $bar), $expected);
}
示例5: getDuplicateCheckIndexes
/**
* Returns an array with an element for each index
*
* @return array
*/
public function getDuplicateCheckIndexes()
{
$super_language_pack = sugarArrayMerge(return_module_language($GLOBALS['current_language'], $this->_focus->module_dir), $GLOBALS['app_strings']);
$index_array = array();
foreach ($this->_getIndexVardefs() as $index) {
if ($index['type'] == "index") {
$labelsArray = array();
foreach ($index['fields'] as $field) {
if ($field == 'deleted') {
continue;
}
$fieldDef = $this->_focus->getFieldDefinition($field);
if (isset($fieldDef['vname']) && isset($super_language_pack[$fieldDef['vname']])) {
$labelsArray[$fieldDef['name']] = $super_language_pack[$fieldDef['vname']];
} else {
$labelsArray[$fieldDef['name']] = $fieldDef['name'];
}
}
$index_array[$index['name']] = str_replace(":", "", implode(", ", $labelsArray));
}
}
return $index_array;
}
示例6: foreach
foreach ($config['languages'] as $k => $v) {
$sugar_config['languages'][$k] = $v;
}
} else {
writeLog('*** ERROR: install/lang.config.php was not found and writen to config.php!!');
}
if (isset($sugar_config['sugarbeet'])) {
//$sugar_config['sugarbeet'] is only set in COMM
unset($sugar_config['sugarbeet']);
}
if (isset($sugar_config['disable_team_access_check'])) {
//no need to write to config.php
unset($sugar_config['disable_team_access_check']);
}
$passwordsetting_defaults = array('passwordsetting' => array('minpwdlength' => '', 'maxpwdlength' => '', 'oneupper' => '', 'onelower' => '', 'onenumber' => '', 'onespecial' => '', 'SystemGeneratedPasswordON' => '', 'generatepasswordtmpl' => '', 'lostpasswordtmpl' => '', 'customregex' => '', 'regexcomment' => '', 'forgotpasswordON' => false, 'linkexpiration' => '1', 'linkexpirationtime' => '30', 'linkexpirationtype' => '1', 'userexpiration' => '0', 'userexpirationtime' => '', 'userexpirationtype' => '1', 'userexpirationlogin' => '', 'systexpiration' => '0', 'systexpirationtime' => '', 'systexpirationtype' => '0', 'systexpirationlogin' => '', 'lockoutexpiration' => '0', 'lockoutexpirationtime' => '', 'lockoutexpirationtype' => '1', 'lockoutexpirationlogin' => ''));
$sugar_config = sugarArrayMerge($passwordsetting_defaults, $sugar_config);
writeLog('Set default_max_tabs to 7');
$sugar_config['default_max_tabs'] = '7';
writeLog('Set default_theme to Sugar');
$sugar_config['default_theme'] = 'Sugar';
writeLog('Upgrading tracker dashlets for sales and marketing start.');
upgradeDashletsForSalesAndMarketing();
writeLog('Done upgrading tracker dashlets.');
// Update admin values
writeLog("Updating license values");
$admin = new Administration();
$admin->saveSetting('license', 'users', 0);
$key = array('num_lic_oc', 'key', 'expire_date');
foreach ($key as $k) {
$admin->saveSetting('license', $k, '');
}
示例7: merge_passwordsetting
/**
* This function will merge password default settings into config file
* @param $sugar_config
* @param $sugar_version
* @return bool true if successful
*/
function merge_passwordsetting($sugar_config, $sugar_version)
{
$passwordsetting_defaults = array('passwordsetting' => array('minpwdlength' => '', 'maxpwdlength' => '', 'oneupper' => '', 'onelower' => '', 'onenumber' => '', 'onespecial' => '', 'SystemGeneratedPasswordON' => '', 'generatepasswordtmpl' => '', 'lostpasswordtmpl' => '', 'customregex' => '', 'regexcomment' => '', 'forgotpasswordON' => false, 'linkexpiration' => '1', 'linkexpirationtime' => '30', 'linkexpirationtype' => '1', 'userexpiration' => '0', 'userexpirationtime' => '', 'userexpirationtype' => '1', 'userexpirationlogin' => '', 'systexpiration' => '0', 'systexpirationtime' => '', 'systexpirationtype' => '0', 'systexpirationlogin' => '', 'lockoutexpiration' => '0', 'lockoutexpirationtime' => '', 'lockoutexpirationtype' => '1', 'lockoutexpirationlogin' => ''));
$sugar_config = sugarArrayMerge($passwordsetting_defaults, $sugar_config);
// need to override version with default no matter what
$sugar_config['sugar_version'] = $sugar_version;
ksort($sugar_config);
if (write_array_to_file("sugar_config", $sugar_config, "config.php")) {
return true;
} else {
return false;
}
}
示例8: initElement
/**
* Initializes an element for processing
* @param array $element Element metadata
* @return array
*/
function initElement($element, $alwaysMerge)
{
if ($this->isValidElement($element)) {
$mergedElement = sugarArrayMerge($this->defaults, $element);
foreach ($alwaysMerge as $key => $val) {
if (!isset($mergedElement[$key])) {
$mergedElement[$key] = $val;
}
}
if ($this->debugMode) {
foreach ($this->elementRequired as $k => $v) {
if (!array_key_exists($v, $mergedElement) && !isset($mergedElement['handlers'])) {
$this->debugOutput("Element is missing required field after initialization: [ {$v} ].");
}
}
}
// iterate through "handlers - mini-elements"
if (isset($mergedElement['handlers'])) {
if (is_array($mergedElement['handlers']) && !empty($mergedElement['handlers'])) {
foreach ($mergedElement['handlers'] as $miniKey => $miniElement) {
// apply parent element's properties to mini-element
foreach ($mergedElement as $key => $el) {
if ($key != 'handlers' && !isset($miniElement[$key])) {
// || empty($miniElement[$key])
$miniElement[$key] = $mergedElement[$key];
}
}
$miniElement = $this->initElement($miniElement, $alwaysMerge);
$mergedElement['handlers'][$miniKey] = $miniElement;
}
} else {
if ($this->debugMode) {
$this->debugOutput("SugarRouting: element contains 'handlers' but is not an array:");
$this->debugOutput($mergedElement);
}
}
}
return $mergedElement;
} else {
if ($this->debugMode) {
$this->debugOutput("SugarRouting is trying to initialize a non-element:");
$this->debugOutput($element);
}
}
}
示例9: upgradeLocaleNameFormat
/**
* Checks if a locale name format is part of the default list, if not adds it to the config
* @param $name_format string a local name format string such as 's f l'
* @return bool true on successful write to config file, false on failure;
*/
function upgradeLocaleNameFormat($name_format)
{
global $sugar_config, $sugar_version;
$localization = new Localization();
$localeConfigDefaults = $localization->getLocaleConfigDefaults();
$uw_strings = return_module_language($GLOBALS['current_language'], 'UpgradeWizard');
if (empty($sugar_config['name_formats'])) {
$sugar_config['name_formats'] = $localeConfigDefaults['name_formats'];
if (!rebuildConfigFile($sugar_config, $sugar_version)) {
$errors[] = $uw_strings['ERR_UW_CONFIG_WRITE'];
}
}
if (!in_array($name_format, $sugar_config['name_formats'])) {
$new_config = sugarArrayMerge($sugar_config['name_formats'], array($name_format => $name_format));
$sugar_config['name_formats'] = $new_config;
if (!rebuildConfigFile($sugar_config, $sugar_version)) {
$errors[] = $uw_strings['ERR_UW_CONFIG_WRITE'];
return false;
}
}
return true;
}
示例10: process_page
/**
*
*/
function process_page()
{
global $focus;
global $mod_strings;
global $app_strings;
global $app_list_strings;
global $currentModule;
global $odd_bg;
global $even_bg;
global $timedate;
$history_list = array();
if (!empty($_REQUEST['record'])) {
$result = $focus->retrieve($_REQUEST['record']);
if ($result == null) {
sugar_die($app_strings['ERROR_NO_RECORD']);
}
}
$activitiesRels = array('tasks' => 'Task', 'meetings' => 'Meeting', 'calls' => 'Call', 'emails' => 'Email', 'notes' => 'Note');
//Setup the arrays to store the linked records.
foreach ($activitiesRels as $relMod => $beanName) {
$varname = "focus_" . $relMod . "_list";
${$varname} = array();
}
foreach ($focus->get_linked_fields() as $field => $def) {
if ($focus->load_relationship($field)) {
$relTable = $focus->{$field}->getRelatedTableName();
if (in_array($relTable, array_keys($activitiesRels))) {
$varname = "focus_" . $relTable . "_list";
${$varname} = sugarArrayMerge(${$varname}, $focus->get_linked_beans($field, $activitiesRels[$relTable]));
}
}
}
foreach ($focus_tasks_list as $task) {
$sort_date_time = '';
if (empty($task->date_due) || $task->date_due == '0000-00-00') {
$date_due = '';
} else {
$date_due = $task->date_due;
}
if ($task->status != "Not Started" && $task->status != "In Progress" && $task->status != "Pending Input") {
$history_list[] = array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_modified' => $date_due, 'description' => $this->getTaskDetails($task), 'date_type' => $app_strings['DATA_TYPE_DUE'], 'sort_value' => strtotime($task->fetched_row['date_due'] . ' GMT'));
} else {
$open_activity_list[] = array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_due' => $date_due, 'description' => $this->getTaskDetails($task), 'date_type' => $app_strings['DATA_TYPE_DUE']);
}
}
// end Tasks
foreach ($focus_meetings_list as $meeting) {
if (empty($meeting->contact_id) && empty($meeting->contact_name)) {
$meeting_contacts = $meeting->get_linked_beans('contacts', 'Contact');
if (!empty($meeting_contacts[0]->id) && !empty($meeting_contacts[0]->name)) {
$meeting->contact_id = $meeting_contacts[0]->id;
$meeting->contact_name = $meeting_contacts[0]->name;
}
}
if ($meeting->status != "Planned") {
$history_list[] = array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_modified' => $meeting->date_start, 'description' => $this->formatDescription($meeting->description), 'date_type' => $app_strings['DATA_TYPE_START'], 'sort_value' => strtotime($meeting->fetched_row['date_start'] . ' GMT'));
} else {
$open_activity_list[] = array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_due' => $meeting->date_start, 'description' => $this->formatDescription($meeting->description), 'date_type' => $app_strings['DATA_TYPE_START']);
}
}
// end Meetings
foreach ($focus_calls_list as $call) {
if (empty($call->contact_id) && empty($call->contact_name)) {
$call_contacts = $call->get_linked_beans('contacts', 'Contact');
if (!empty($call_contacts[0]->id) && !empty($call_contacts[0]->name)) {
$call->contact_id = $call_contacts[0]->id;
$call->contact_name = $call_contacts[0]->name;
}
}
if ($call->status != "Planned") {
$history_list[] = array('name' => $call->name, 'id' => $call->id, 'type' => "Call", 'direction' => $call->direction, 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_modified' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => $app_strings['DATA_TYPE_START'], 'sort_value' => strtotime($call->fetched_row['date_start'] . ' GMT'));
} else {
$open_activity_list[] = array('name' => $call->name, 'id' => $call->id, 'direction' => $call->direction, 'type' => "Call", 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_due' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => $app_strings['DATA_TYPE_START']);
}
}
// end Calls
foreach ($focus_emails_list as $email) {
if (empty($email->contact_id) && empty($email->contact_name)) {
$email_contacts = $email->get_linked_beans('contacts', 'Contact');
if (!empty($email_contacts[0]->id) && !empty($email_contacts[0]->name)) {
$email->contact_id = $email_contacts[0]->id;
$email->contact_name = $email_contacts[0]->name;
}
}
$history_list[] = array('name' => $email->name, 'id' => $email->id, 'type' => "Email", 'direction' => '', 'module' => "Emails", 'status' => '', 'parent_id' => $email->parent_id, 'parent_type' => $email->parent_type, 'parent_name' => $email->parent_name, 'contact_id' => $email->contact_id, 'contact_name' => $email->contact_name, 'date_modified' => $email->date_start . " " . $email->time_start, 'description' => $this->getEmailDetails($email), 'date_type' => $app_strings['DATA_TYPE_SENT'], 'sort_value' => strtotime($email->fetched_row['date_sent'] . ' GMT'));
}
//end Emails
// Bug 46439 'No email archived when clicking on View Summary' (All condition)
if (method_exists($focus, 'get_unlinked_email_query')) {
$queryArray = $focus->get_unlinked_email_query(array('return_as_array' => 'true'));
$query = $queryArray['select'];
$query .= $queryArray['from'];
if (!empty($queryArray['join_tables'])) {
foreach ($queryArray['join_tables'] as $join_table) {
if ($join_table != '') {
$query .= ', ' . $join_table . ' ';
}
//.........这里部分代码省略.........
示例11: widgetDisplay
function widgetDisplay($widget_def, $use_default = false)
{
$theclass = $this->getClassFromWidgetDef($widget_def, $use_default);
$label = isset($widget_def['module']) ? $widget_def['module'] : '';
if (is_subclass_of($theclass, 'SugarWidgetSubPanelTopButton')) {
$label = $theclass->get_subpanel_relationship_name($widget_def);
}
$theclass->setWidgetId($label);
//#27426
$fieldDef = $this->getFieldDef($widget_def);
if (!empty($fieldDef) && !empty($fieldDef['type']) && strtolower(trim($fieldDef['type'])) == 'multienum') {
$widget_def['fields'] = sugarArrayMerge($widget_def['fields'], $fieldDef);
$widget_def['fields']['module'] = $label;
}
//end
return $theclass->display($widget_def);
}
示例12: display
function display($preview = false)
{
global $mod_strings;
$parser = ParserFactory::getParser($this->editLayout, $this->editModule, $this->package);
$history = $parser->getHistory();
$smarty = new Sugar_Smarty();
//Add in the module we are viewing to our current mod strings
if (!$this->fromModuleBuilder) {
global $current_language;
$editModStrings = return_module_language($current_language, $this->editModule);
$mod_strings = sugarArrayMerge($editModStrings, $mod_strings);
}
$smarty->assign('mod', $mod_strings);
$smarty->assign('MOD', $mod_strings);
// assign buttons
$images = array('icon_save' => 'studio_save', 'icon_publish' => 'studio_publish', 'icon_address' => 'icon_Address', 'icon_emailaddress' => 'icon_EmailAddress', 'icon_phone' => 'icon_Phone');
foreach ($images as $image => $file) {
$smarty->assign($image, SugarThemeRegistry::current()->getImage($file));
}
$buttons = array();
if ($preview) {
$smarty->assign('layouttitle', translate('LBL_LAYOUT_PREVIEW', 'ModuleBuilder'));
} else {
$smarty->assign('layouttitle', translate('LBL_CURRENT_LAYOUT', 'ModuleBuilder'));
if (!$this->fromModuleBuilder) {
$buttons[] = array('id' => 'saveBtn', 'text' => translate('LBL_BTN_SAVE'), 'actionScript' => "onclick='if (countGridFields()==0) ModuleBuilder.layoutValidation.popup() ; else Studio2.handleSave();'");
$buttons[] = array('id' => 'publishBtn', 'text' => translate('LBL_BTN_SAVEPUBLISH'), 'actionScript' => "onclick='if (countGridFields()==0) ModuleBuilder.layoutValidation.popup() ; else Studio2.handlePublish();'");
$buttons[] = array('id' => 'spacer', 'width' => '50px');
$buttons[] = array('id' => 'historyBtn', 'text' => translate('LBL_HISTORY'), 'actionScript' => "onclick='ModuleBuilder.history.browse(\"{$this->editModule}\", \"{$this->editLayout}\")'");
$buttons[] = array('id' => 'historyDefault', 'text' => translate('LBL_RESTORE_DEFAULT'), 'actionScript' => "onclick='ModuleBuilder.history.revert(\"{$this->editModule}\", \"{$this->editLayout}\", \"{$history->getLast()}\", \"\")'");
} else {
$buttons[] = array('id' => 'saveBtn', 'text' => $GLOBALS['mod_strings']['LBL_BTN_SAVE'], 'actionScript' => "onclick='if (countGridFields()==0) ModuleBuilder.layoutValidation.popup() ; else Studio2.handlePublish();'");
$buttons[] = array('id' => 'spacer', 'width' => '50px');
$buttons[] = array('id' => 'historyBtn', 'text' => translate('LBL_HISTORY'), 'actionScript' => "onclick='ModuleBuilder.history.browse(\"{$this->editModule}\", \"{$this->editLayout}\")'");
$buttons[] = array('id' => 'historyDefault', 'text' => translate('LBL_RESTORE_DEFAULT'), 'actionScript' => "onclick='ModuleBuilder.history.revert(\"{$this->editModule}\", \"{$this->editLayout}\", \"{$history->getLast()}\", \"\")'");
}
}
$html = "";
foreach ($buttons as $button) {
if ($button['id'] == "spacer") {
$html .= "<td style='width:{$button['width']}'> </td>";
} else {
$html .= "<td><input id='{$button['id']}' type='button' valign='center' class='button' style='cursor:pointer' " . "onmousedown='this.className=\"buttonOn\";return false;' onmouseup='this.className=\"button\"' " . "onmouseout='this.className=\"button\"' {$button['actionScript']} value = '{$button['text']}' ></td>";
}
}
$smarty->assign('buttons', $html);
// assign fields and layout
$smarty->assign('available_fields', $parser->getAvailableFields());
$smarty->assign('layout', $parser->getLayout());
$smarty->assign('view_module', $this->editModule);
$smarty->assign('view', $this->editLayout);
$smarty->assign('maxColumns', $parser->getMaxColumns());
$smarty->assign('nextPanelId', $parser->getFirstNewPanelId());
$smarty->assign('fieldwidth', 150);
$smarty->assign('translate', true);
if ($this->fromModuleBuilder) {
$smarty->assign('fromModuleBuilder', $this->fromModuleBuilder);
$smarty->assign('view_package', $this->package);
}
$labels = array(MB_EDITVIEW => 'LBL_EDITVIEW', MB_DETAILVIEW => 'LBL_DETAILVIEW', MB_QUICKCREATE => 'LBL_QUICKCREATE');
$layoutLabel = 'LBL_LAYOUTS';
$layoutView = 'layouts';
$ajax = new AjaxCompose();
$viewType;
$translatedViewType = '';
if (isset($labels[strtolower($this->editLayout)])) {
$translatedViewType = translate($labels[strtolower($this->editLayout)], 'ModuleBuilder');
}
if ($this->fromModuleBuilder) {
$ajax->addCrumb(translate('LBL_MODULEBUILDER', 'ModuleBuilder'), 'ModuleBuilder.main("mb")');
$ajax->addCrumb($this->package, 'ModuleBuilder.getContent("module=ModuleBuilder&action=package&package=' . $this->package . '")');
$ajax->addCrumb($this->editModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=module&view_package=' . $this->package . '&view_module=' . $this->editModule . '")');
$ajax->addCrumb(translate($layoutLabel, 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&MB=true&action=wizard&view=' . $layoutView . '&view_module=' . $this->editModule . '&view_package=' . $this->package . '")');
$ajax->addCrumb($translatedViewType, '');
} else {
$ajax->addCrumb(translate('LBL_STUDIO', 'ModuleBuilder'), 'ModuleBuilder.main("studio")');
$ajax->addCrumb($this->translatedEditModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view_module=' . $this->editModule . '")');
$ajax->addCrumb(translate($layoutLabel, 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view=' . $layoutView . '&view_module=' . $this->editModule . '")');
$ajax->addCrumb($translatedViewType, '');
}
// set up language files
$smarty->assign('language', $parser->getLanguage());
// for sugar_translate in the smarty template
$smarty->assign('from_mb', $this->fromModuleBuilder);
$ajax->addSection('center', $translatedViewType, $smarty->fetch('modules/ModuleBuilder/tpls/layoutView.tpl'));
if ($preview) {
echo $smarty->fetch('modules/ModuleBuilder/tpls/Preview/layoutView.tpl');
} else {
echo $ajax->getJavascript();
}
}
示例13: getHistory
/**
* Returns the history.
*
* @param $api
* @param $args
* @return array|mixed
*/
public function getHistory($api, $args)
{
global $app_strings;
global $app_list_strings;
global $timedate;
$history_list = array();
$focus = BeanFactory::getBean($args['module'], $args['id']);
$activitiesRels = array('tasks' => 'Task', 'meetings' => 'Meeting', 'calls' => 'Call', 'emails' => 'Email', 'notes' => 'Note');
//Setup the arrays to store the linked records.
foreach ($activitiesRels as $relMod => $beanName) {
$varname = "focus_" . $relMod . "_list";
${$varname} = array();
}
foreach ($focus->get_linked_fields() as $field => $def) {
if ($focus->load_relationship($field)) {
$relTable = $focus->{$field}->getRelatedTableName();
if (in_array($relTable, array_keys($activitiesRels))) {
$varname = "focus_" . $relTable . "_list";
${$varname} = sugarArrayMerge(${$varname}, $focus->get_linked_beans($field, $activitiesRels[$relTable], array(), 0, 100));
}
}
}
foreach ($focus_tasks_list as $task) {
$sort_date_time = '';
if (empty($task->date_due) || $task->date_due == '0000-00-00') {
$date_due = '';
} else {
$date_due = $task->date_due;
}
if ($task->status != "Not Started" && $task->status != "In Progress" && $task->status != "Pending Input") {
$ts = '';
if (!empty($task->fetched_row['date_due'])) {
//tasks can have an empty date due field
$ts = $timedate->fromDb($task->fetched_row['date_due'])->ts;
}
$history_list[] = array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_modified' => $date_due, 'description' => $this->getTaskDetails($task), 'date_type' => $app_strings['DATA_TYPE_DUE'], 'sort_value' => $ts);
} else {
$open_activity_list[] = array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_due' => $date_due, 'description' => $this->getTaskDetails($task), 'date_type' => $app_strings['DATA_TYPE_DUE']);
}
}
// end Tasks
foreach ($focus_meetings_list as $meeting) {
if (empty($meeting->contact_id) && empty($meeting->contact_name)) {
$meeting_contacts = $meeting->get_linked_beans('contacts', 'Contact', array(), 0, 100);
if (!empty($meeting_contacts[0]->id) && !empty($meeting_contacts[0]->name)) {
$meeting->contact_id = $meeting_contacts[0]->id;
$meeting->contact_name = $meeting_contacts[0]->name;
}
}
if ($meeting->status != "Planned") {
$history_list[] = array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_modified' => $meeting->date_start, 'description' => $this->formatDescription($meeting->description), 'date_type' => $app_strings['DATA_TYPE_START'], 'sort_value' => $timedate->fromDb($meeting->fetched_row['date_start'])->ts);
} else {
$open_activity_list[] = array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_due' => $meeting->date_start, 'description' => $this->formatDescription($meeting->description), 'date_type' => $app_strings['DATA_TYPE_START']);
}
}
// end Meetings
foreach ($focus_calls_list as $call) {
if (empty($call->contact_id) && empty($call->contact_name)) {
$call_contacts = $call->get_linked_beans('contacts', 'Contact', array(), 0, 100);
if (!empty($call_contacts[0]->id) && !empty($call_contacts[0]->name)) {
$call->contact_id = $call_contacts[0]->id;
$call->contact_name = $call_contacts[0]->name;
}
}
if ($call->status != "Planned") {
$history_list[] = array('name' => $call->name, 'id' => $call->id, 'type' => "Call", 'direction' => $call->direction, 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_modified' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => $app_strings['DATA_TYPE_START'], 'sort_value' => $timedate->fromDb($call->fetched_row['date_start'])->ts);
} else {
$open_activity_list[] = array('name' => $call->name, 'id' => $call->id, 'direction' => $call->direction, 'type' => "Call", 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_due' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => $app_strings['DATA_TYPE_START']);
}
}
// end Calls
foreach ($focus_emails_list as $email) {
if (empty($email->contact_id) && empty($email->contact_name)) {
$email_contacts = $email->get_linked_beans('contacts', 'Contact', array(), 0, 100);
if (!empty($email_contacts[0]->id) && !empty($email_contacts[0]->name)) {
$email->contact_id = $email_contacts[0]->id;
$email->contact_name = $email_contacts[0]->name;
}
}
$ts = '';
if (!empty($email->fetched_row['date_sent'])) {
//emails can have an empty date sent field
$ts = $timedate->fromDb($email->fetched_row['date_sent'])->ts;
}
$history_list[] = array('name' => $email->name, 'id' => $email->id, 'type' => "Email", 'direction' => '', 'module' => "Emails", 'status' => '', 'parent_id' => $email->parent_id, 'parent_type' => $email->parent_type, 'parent_name' => $email->parent_name, 'contact_id' => $email->contact_id, 'contact_name' => $email->contact_name, 'date_modified' => $email->date_start . " " . $email->time_start, 'description' => $this->getEmailDetails($email), 'date_type' => $app_strings['DATA_TYPE_SENT'], 'sort_value' => $ts);
}
//end Emails
// Bug 46439 'No email archived when clicking on View Summary' (All condition)
if (method_exists($focus, 'get_unlinked_email_query')) {
$queryArray = $focus->get_unlinked_email_query(array('return_as_array' => 'true'));
$query = $queryArray['select'];
$query .= $queryArray['from'];
if (!empty($queryArray['join_tables'])) {
//.........这里部分代码省略.........
示例14: SearchFormReports
$storeQuery->saveFromRequest($currentModule);
}
// setup for search form
$thisMod = 'Reports';
$searchForm = new SearchFormReports($thisMod, $savedReportsSeed);
$searchForm->tabs = array(array('title' => $app_strings['LNK_BASIC_SEARCH'], 'link' => $thisMod . '|basic_search', 'key' => $thisMod . '|basic_search'), array('title' => $app_strings['LNK_ADVANCED_SEARCH'], 'link' => $thisMod . '|advanced_search', 'key' => $thisMod . '|advanced_search'));
$searchForm->populateFromRequest();
$searchForm->searchFields['module'] = $searchForm->searchFields['report_module'];
unset($searchForm->searchFields['report_module']);
$where_clauses = $searchForm->generateSearchWhere();
include 'include/modules.php';
$ACLAllowedModules = getACLAllowedModules();
$ACLUnAllowedModules = getACLDisAllowedModules();
$ACLAllowedModulesKeys = array_keys($ACLAllowedModules);
$listViewDefsNewArray = array();
$listViewDefsNewArray = sugarArrayMerge($listViewDefsNewArray, $listViewDefs);
unset($listViewDefsNewArray['Reports']['IS_EDIT']);
unset($listViewDefsNewArray['Reports']['LAST_RUN_DATE']);
foreach ($ACLUnAllowedModules as $module => $class_name) {
array_push($where_clauses, "saved_reports.module != '{$module}'");
}
$reportModules = array();
foreach ($ACLAllowedModules as $key => $module) {
$reportModules[$key] = isset($app_list_strings['moduleList'][$key]) ? $app_list_strings['moduleList'][$key] : $key;
}
asort($reportModules);
if (!empty($_REQUEST['search_form_only']) && $_REQUEST['search_form_only']) {
// handle ajax requests for search forms only
switch ($_REQUEST['search_form_view']) {
case 'basic_search':
$searchForm->setup();
示例15: getAppListStrings
function getAppListStrings($language = 'en_us')
{
$language .= '.lang.php';
if (!empty($this->appListStrings[$language]) && $language != 'en_us.lang.php') {
return sugarArrayMerge($this->appListStrings['en_us.lang.php'], $this->appListStrings[$language]);
}
if (!empty($this->appListStrings['en_us.lang.php'])) {
return $this->appListStrings['en_us.lang.php'];
}
$empty = array();
return $empty;
}