当前位置: 首页>>代码示例>>PHP>>正文


PHP ModuleBuilder::getPackageModule方法代码示例

本文整理汇总了PHP中ModuleBuilder::getPackageModule方法的典型用法代码示例。如果您正苦于以下问题:PHP ModuleBuilder::getPackageModule方法的具体用法?PHP ModuleBuilder::getPackageModule怎么用?PHP ModuleBuilder::getPackageModule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ModuleBuilder的用法示例。


在下文中一共展示了ModuleBuilder::getPackageModule方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: display

 function display()
 {
     global $app_strings, $current_user, $mod_strings, $app_list_strings;
     $smarty = new Sugar_Smarty();
     require_once 'include/JSON.php';
     //Load the field list from the target module
     $selected_lang = $_SESSION['authenticated_user_language'];
     $vardef = array();
     //Copy app strings
     $my_list_strings = array_merge($app_list_strings);
     $child = $_REQUEST['field'];
     //if we are using ModuleBuilder then process the following
     if (!empty($_REQUEST['package']) && $_REQUEST['package'] != 'studio') {
         require_once 'modules/ModuleBuilder/MB/ModuleBuilder.php';
         $mb = new ModuleBuilder();
         $this->module = $mb->getPackageModule($_REQUEST['package'], $_REQUEST['view_module']);
         $vardef = $this->module->getVardefs();
         $this->module->mblanguage->generateAppStrings(false);
         $my_list_strings = array_merge($my_list_strings, $this->module->mblanguage->appListStrings[$selected_lang . '.lang.php']);
     } else {
         $vardef = BeanFactory::getBean($_REQUEST['view_module'])->field_defs;
     }
     foreach ($my_list_strings as $key => $value) {
         if (!is_array($value)) {
             unset($my_list_strings[$key]);
         }
     }
     $parents = $this->getParentDDs($vardef, $child, $my_list_strings);
     $visibility_grid = !empty($vardef[$child]['visibility_grid']) ? $vardef[$child]['visibility_grid'] : array();
     $smarty->assign('app_strings', $app_strings);
     $smarty->assign('mod', $mod_strings);
     $smarty->assign('parents', JSON::encode($parents));
     $smarty->assign('visibility_grid', JSON::encode($visibility_grid));
     $smarty->display('modules/ExpressionEngine/tpls/ddEditor.tpl');
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:35,代码来源:view.editDepDropdown.php

示例2: saveDropDown

 /**
  * Takes in the request params from a save request and processes
  * them for the save.
  *
  * @param REQUEST params  $params
  */
 function saveDropDown($params)
 {
     require_once 'modules/Administration/Common.php';
     $emptyMarker = translate('LBL_BLANK');
     $selected_lang = !empty($params['dropdown_lang']) ? $params['dropdown_lang'] : $_SESSION['authenticated_user_language'];
     $type = $_REQUEST['view_package'];
     $dir = '';
     $dropdown_name = $params['dropdown_name'];
     $json = getJSONobj();
     $list_value = str_replace('"":""', '"__empty__":""', $params['list_value']);
     //Bug 21362 ENT_QUOTES- convert single quotes to escaped single quotes.
     $dropdown = $json->decode(html_entity_decode(rawurldecode($list_value), ENT_QUOTES));
     if (array_key_exists($emptyMarker, $dropdown)) {
         unset($dropdown[$emptyMarker]);
         $dropdown[''] = '';
     }
     if ($type != 'studio') {
         $mb = new ModuleBuilder();
         $module =& $mb->getPackageModule($params['view_package'], $params['view_module']);
         $this->synchMBDropDown($dropdown_name, $dropdown, $selected_lang, $module);
         //Can't use synch on selected lang as we want to overwrite values, not just keys
         $module->mblanguage->appListStrings[$selected_lang . '.lang.php'][$dropdown_name] = $dropdown;
         $module->mblanguage->save($module->key_name);
         // tyoung - key is required parameter as of
     } else {
         $contents = return_custom_app_list_strings_file_contents($selected_lang);
         $my_list_strings = return_app_list_strings_language($selected_lang);
         if ($selected_lang == $GLOBALS['current_language']) {
             $GLOBALS['app_list_strings'][$dropdown_name] = $dropdown;
         }
         //write to contents
         $contents = str_replace("?>", '', $contents);
         if (empty($contents)) {
             $contents = "<?php";
         }
         //add new drop down to the bottom
         if (!empty($params['use_push'])) {
             //this is for handling moduleList and such where nothing should be deleted or anything but they can be renamed
             foreach ($dropdown as $key => $value) {
                 //only if the value has changed or does not exist do we want to add it this way
                 if (!isset($my_list_strings[$dropdown_name][$key]) || strcmp($my_list_strings[$dropdown_name][$key], $value) != 0) {
                     //clear out the old value
                     $pattern_match = '/\\s*\\$app_list_strings\\s*\\[\\s*\'' . $dropdown_name . '\'\\s*\\]\\[\\s*\'' . $key . '\'\\s*\\]\\s*=\\s*[\'\\"]{1}.*?[\'\\"]{1};\\s*/ism';
                     $contents = preg_replace($pattern_match, "\n", $contents);
                     //add the new ones
                     $contents .= "\n\$GLOBALS['app_list_strings']['{$dropdown_name}']['{$key}']=" . var_export_helper($value) . ";";
                 }
             }
         } else {
             //Now synch up the keys in other langauges to ensure that removed/added Drop down values work properly under all langs.
             $this->synchDropDown($dropdown_name, $dropdown, $selected_lang, $dir);
             $contents = $this->getNewCustomContents($dropdown_name, $dropdown, $selected_lang);
         }
         if (!empty($dir) && !is_dir($dir)) {
             $continue = mkdir_recursive($dir);
         }
         save_custom_app_list_strings_contents($contents, $selected_lang, $dir);
     }
     sugar_cache_reset();
 }
开发者ID:nerdystudmuffin,项目名称:dashlet-subpanels,代码行数:66,代码来源:parser.dropdown.php

示例3: __construct

 /**
  * The constructor
  * @param string $subpanelName
  * @param string $moduleName
  * @param string $packageName
  * @param string $client
  */
 public function __construct($subpanelName, $moduleName, $packageName, $client = '')
 {
     $this->mdc = new MetaDataConverter();
     $this->_subpanelName = $subpanelName;
     $this->_moduleName = $moduleName;
     $this->client = empty($client) ? 'base' : $client;
     // TODO: history
     $this->historyPathname = "custom/history/modulebuilder/packages/{$packageName}/modules/{$moduleName}/metadata/" . self::HISTORYFILENAME;
     $this->_history = new History($this->historyPathname);
     //get the bean from ModuleBuilder
     $mb = new ModuleBuilder();
     $this->module = $mb->getPackageModule($packageName, $moduleName);
     $this->module->mbvardefs->updateVardefs();
     $templates = $this->module->config['templates'];
     $template_def = "";
     foreach ($templates as $template => $a) {
         if ($a === 1) {
             $template_def = $template;
         }
     }
     $template_subpanel_def = "include/SugarObjects/templates/{$template_def}/clients/{$this->client}/views/subpanel-list/subpanel-list.php";
     $viewdefs = array();
     if (file_exists($template_subpanel_def)) {
         include $template_subpanel_def;
         if (isset($viewdefs['<module_name>'])) {
             $viewdefs[$this->module->key_name] = $viewdefs['<module_name>'];
             unset($viewdefs['<module_name>']);
         }
     }
     if ($subpanelName != 'default' && !stristr($subpanelName, 'for')) {
         $subpanelName = 'For' . ucfirst($subpanelName);
     }
     $this->sidecarSubpanelName = $this->mdc->fromLegacySubpanelName($subpanelName);
     // Set the original view defs from the loaded file if there are any
     $this->_originalViewdefs = $this->getNewViewDefs($viewdefs);
     $this->sidecarFile = $this->module->getSubpanelFilePath($subpanelName, $this->client);
     if (file_exists($this->sidecarFile)) {
         include $this->sidecarFile;
     }
     $viewdefs = empty($viewdefs) ? array() : $viewdefs;
     $this->_viewdefs = $this->getNewViewDefs($viewdefs);
     $this->_fielddefs = $this->getFieldDefs();
     $this->_paneldefs = isset($this->_viewdefs['panels']) ? $this->_viewdefs['panels'] : array();
     // Set the global mod_strings directly as Sugar does not automatically load the
     // language files for undeployed modules (how could it?)
     $selected_lang = 'en_us';
     if (isset($GLOBALS['current_language']) && !empty($GLOBALS['current_language'])) {
         $selected_lang = $GLOBALS['current_language'];
     }
     $GLOBALS['mod_strings'] = array_merge($GLOBALS['mod_strings'], $this->module->getModStrings($selected_lang));
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:58,代码来源:UndeployedSidecarSubpanelImplementation.php

示例4: display

 function display()
 {
     $moduleName = !empty($_REQUEST['view_module']) ? $_REQUEST['view_module'] : $_REQUEST['edit_module'];
     $smarty = new Sugar_Smarty();
     // set the mod_strings as we can be called after doing a Repair and the mod_strings are set to Administration
     $GLOBALS['mod_strings'] = return_module_language($GLOBALS['current_language'], 'ModuleBuilder');
     $smarty->assign('mod_strings', $GLOBALS['mod_strings']);
     $smarty->assign('view_module', $moduleName);
     $ajax = new AjaxCompose();
     $json = getJSONobj();
     $this->fromModuleBuilder = !empty($_REQUEST['MB']) || !empty($_REQUEST['view_package']) && $_REQUEST['view_package'] != 'studio';
     $smarty->assign('fromModuleBuilder', $this->fromModuleBuilder);
     if (!$this->fromModuleBuilder) {
         $smarty->assign('view_package', '');
         $relationships = new DeployedRelationships($moduleName);
         $ajaxRelationships = $this->getAjaxRelationships($relationships);
         $smarty->assign('relationships', $json->encode($ajaxRelationships));
         $smarty->assign('empty', sizeof($ajaxRelationships) == 0);
         $smarty->assign('studio', true);
         //crumb
         global $app_list_strings;
         $moduleNames = array_change_key_case($app_list_strings['moduleList']);
         $translatedModule = $moduleNames[strtolower($moduleName)];
         $ajax->addCrumb(translate('LBL_STUDIO'), 'ModuleBuilder.main("studio")');
         $ajax->addCrumb($translatedModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view_module=' . $moduleName . '")');
         $ajax->addCrumb(translate('LBL_RELATIONSHIPS'), '');
         $ajax->addSection('center', $moduleName . ' ' . translate('LBL_RELATIONSHIPS'), $this->fetchTemplate($smarty, 'modules/ModuleBuilder/tpls/studioRelationships.tpl'));
     } else {
         $smarty->assign('view_package', $_REQUEST['view_package']);
         $mb = new ModuleBuilder();
         $module =& $mb->getPackageModule($_REQUEST['view_package'], $_REQUEST['view_module']);
         $package = $mb->packages[$_REQUEST['view_package']];
         $package->loadModuleTitles();
         $relationships = new UndeployedRelationships($module->getModuleDir());
         $ajaxRelationships = $this->getAjaxRelationships($relationships);
         $smarty->assign('relationships', $json->encode($ajaxRelationships));
         $smarty->assign('empty', sizeof($ajaxRelationships) == 0);
         $module->help['default'] = empty($_REQUEST['view_module']) ? 'create' : 'modify';
         $module->help['group'] = 'module';
         $ajax->addCrumb(translate('LBL_MODULEBUILDER'), 'ModuleBuilder.main("mb")');
         $ajax->addCrumb($package->name, 'ModuleBuilder.getContent("module=ModuleBuilder&action=package&package=' . $package->name . '")');
         $ajax->addCrumb($moduleName, 'ModuleBuilder.getContent("module=ModuleBuilder&action=module&view_package=' . $package->name . '&view_module=' . $moduleName . '")');
         $ajax->addCrumb(translate('LBL_RELATIONSHIPS'), '');
         $ajax->addSection('center', $moduleName . ' ' . translate('LBL_RELATIONSHIPS'), $this->fetchTemplate($smarty, 'modules/ModuleBuilder/tpls/studioRelationships.tpl'));
     }
     echo $ajax->getJavascript();
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:47,代码来源:view.relationships.php

示例5: History

 function __construct($subpanelName, $moduleName, $packageName)
 {
     // Needed to tap into the abstract for loading and saving
     $this->_view = 'subpanel_layout';
     $this->_fileVariables['subpanel_layout'] = 'subpanel_layout';
     $this->_subpanelName = $subpanelName;
     $this->_moduleName = $moduleName;
     // TODO: history
     $this->historyPathname = 'custom/history/modulebuilder/packages/' . $packageName . '/modules/' . $moduleName . '/metadata/' . self::HISTORYFILENAME;
     $this->_history = new History($this->historyPathname);
     //get the bean from ModuleBuilder
     $mb = new ModuleBuilder();
     $this->module =& $mb->getPackageModule($packageName, $moduleName);
     $this->module->mbvardefs->updateVardefs();
     $this->_fielddefs =& $this->module->mbvardefs->vardefs['fields'];
     $templates =& $this->module->config['templates'];
     $template_def = "";
     foreach ($templates as $template => $a) {
         if ($a === 1) {
             $template_def = $template;
         }
     }
     $templateFile = 'include/SugarObjects/templates/' . $template_def . '/metadata/subpanels/default.php';
     if (file_exists($templateFile)) {
         $subpanel_layout = $this->_loadFromFile($templateFile);
         if (!empty($subpanel_layout['list_fields'])) {
             $originalDef = $subpanel_layout['list_fields'];
             // This has to be done early because once they are in field defs
             // they won't be picked up
             $this->setNonFields($originalDef);
             $this->_mergeFielddefs($this->_fielddefs, $originalDef);
         }
     }
     $filename = $this->module->getSubpanelFilePath($this->_subpanelName, '', true);
     $subpanel_layout = $this->_loadFromFile($filename);
     $this->_originalViewdefs = $subpanel_layout['list_fields'];
     $this->_viewdefs =& $subpanel_layout['list_fields'];
     $this->_mergeFielddefs($this->_fielddefs, $this->_viewdefs);
     // Set the global mod_strings directly as Sugar does not automatically load the language files for undeployed modules (how could it?)
     $selected_lang = 'en_us';
     if (isset($GLOBALS['current_language']) && !empty($GLOBALS['current_language'])) {
         $selected_lang = $GLOBALS['current_language'];
     }
     $GLOBALS['mod_strings'] = array_merge($GLOBALS['mod_strings'], $this->module->getModStrings($selected_lang));
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:45,代码来源:UndeployedSubpanelImplementation.php

示例6: display

 function display()
 {
     $this->ss = new Sugar_Smarty();
     foreach ($this->vars as $var) {
         if (isset($_REQUEST[$var])) {
             $this->{$var} = $_REQUEST[$var];
             $this->ss->assign($var, $_REQUEST[$var]);
         }
     }
     $mapping = empty($_REQUEST['mapping']) ? array() : json_decode(html_entity_decode($_REQUEST['mapping']), true);
     $this->ss->assign("mapping", $mapping);
     if (empty($_REQUEST['package']) || $_REQUEST['package'] == 'studio') {
         $sm = StudioModuleFactory::getStudioModule($_REQUEST['targetModule']);
         $fields = $sm->getFields();
         if (!empty($fields[$this->parentList]) && !empty($fields[$this->parentList]['options'])) {
             $this->parentList = $fields[$this->parentList]['options'];
         }
         $parentOptions = translate($this->parentList);
         $childOptions = translate($this->childList);
     } else {
         $mb = new ModuleBuilder();
         $moduleName = $_REQUEST['targetModule'];
         $sm = $mb->getPackageModule($_REQUEST['package'], $moduleName);
         $sm->getVardefs();
         $fields = $sm->mbvardefs->vardefs['fields'];
         if (!empty($fields[$this->parentList]) && !empty($fields[$this->parentList]['options'])) {
             $this->parentList = $fields[$this->parentList]['options'];
         }
         $parentOptions = $this->getMBOptions($this->parentList, $sm);
         $childOptions = $this->getMBOptions($this->childList, $sm);
     }
     $this->ss->assign("parent_list_options", $parentOptions);
     $parentOptionsArray = array();
     foreach ($parentOptions as $value => $label) {
         $parentOptionsArray[] = array("value" => $value, "label" => $label);
     }
     $this->ss->assign("parentOptions", json_encode($parentOptions));
     $this->ss->assign("child_list_options", $childOptions);
     $childOptionsArray = array();
     foreach ($childOptions as $value => $label) {
         $childOptionsArray[] = array("value" => $value, "label" => $label);
     }
     $this->ss->assign("childOptions", json_encode($childOptionsArray));
     $this->ss->display("modules/ModuleBuilder/tpls/depdropdown.tpl");
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:45,代码来源:view.depdropdown.php

示例7: getPath

 /** {@inheritDoc} */
 public function getPath()
 {
     $path = $this->file->getPath();
     switch ($this->location) {
         case MB_HISTORYMETADATALOCATION:
             $path = array_merge(explode('/', trim(MetaDataFiles::$paths[MB_WORKINGMETADATALOCATION], '/')), array('modulebuilder', 'packages', $this->package), $path);
             break;
         default:
             // get the module again, all so we can call this method statically without relying
             // on the module stored in the class variables
             require_once 'modules/ModuleBuilder/MB/ModuleBuilder.php';
             $mb = new ModuleBuilder();
             array_shift($path);
             $module = array_shift($path);
             $path = array_merge(explode('/', trim($mb->getPackageModule($this->package, $module)->getModuleDir(), '/')), $path);
     }
     return $path;
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:19,代码来源:MetaDataFileUndeployed.php

示例8: History

 function __construct($subpanelName, $moduleName, $packageName)
 {
     $this->_subpanelName = $subpanelName;
     $this->_moduleName = $moduleName;
     // TODO: history
     $this->historyPathname = 'custom/history/modulebuilder/packages/' . $packageName . '/modules/' . $moduleName . '/metadata/' . self::HISTORYFILENAME;
     $this->_history = new History($this->historyPathname);
     //get the bean from ModuleBuilder
     $mb = new ModuleBuilder();
     $this->module =& $mb->getPackageModule($packageName, $moduleName);
     $this->module->mbvardefs->updateVardefs();
     $this->_fielddefs =& $this->module->mbvardefs->vardefs['fields'];
     $subpanel_layout = $this->module->getAvailibleSubpanelDef($this->_subpanelName);
     $this->_viewdefs =& $subpanel_layout['list_fields'];
     $this->_mergeFielddefs($this->_fielddefs, $this->_viewdefs);
     // Set the global mod_strings directly as Sugar does not automatically load the language files for undeployed modules (how could it?)
     $GLOBALS['mod_strings'] = array_merge($GLOBALS['mod_strings'], $this->module->getModStrings());
 }
开发者ID:klr2003,项目名称:sourceread,代码行数:18,代码来源:UndeployedSubpanelImplementation.php

示例9: display

 function display()
 {
     $this->fromModuleBuilder = isset($_REQUEST['MB']) || !empty($_REQUEST['view_package']) && $_REQUEST['view_package'] != 'studio';
     if ($this->fromModuleBuilder) {
         return;
         //no support for MB
     }
     global $current_user;
     global $mod_strings;
     $smarty = new Sugar_Smarty();
     $smarty->assign('title', $mod_strings['LBL_DEVELOPER_TOOLS']);
     $smarty->assign('question', $mod_strings['LBL_REMOVE_LAYOUT']);
     $smarty->assign('mod_strings', $mod_strings);
     $module_name = $_REQUEST['view_module'];
     $smarty->assign('view_module', $module_name);
     $groupLayout = $_REQUEST['grpLayout'];
     $smarty->assign('groupLayout', $groupLayout);
     require_once 'modules/SecurityGroups/SecurityGroup.php';
     $groupFocus = new SecurityGroup();
     $groupFocus->retrieve($groupLayout);
     $groupName = $groupFocus->name;
     // set up language files
     //$smarty->assign ( 'language', $parser->getLanguage() ) ; // for sugar_translate in the smarty template
     //$smarty->assign('from_mb',$this->fromModuleBuilder);
     $mb = new ModuleBuilder();
     if (!isset($_REQUEST['view_package'])) {
         $_REQUEST['view_package'] = 'studio';
     }
     $module =& $mb->getPackageModule($_REQUEST['view_package'], $_REQUEST['view_module']);
     $package = $mb->packages[$_REQUEST['view_package']];
     $package->loadModuleTitles();
     $ajax = new AjaxCompose();
     $ajax->addCrumb(translate('LBL_STUDIO', 'ModuleBuilder'), 'ModuleBuilder.main("studio")');
     $ajax->addCrumb(translate($module_name), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view_module=' . $module_name . '")');
     $ajax->addCrumb(translate('LBL_LAYOUTS', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=addlayout&layouts=1&view_module=' . $module_name . '")');
     $ajax->addCrumb(translate($groupName), '');
     $ajax->addCrumb($mod_strings['LBL_REMOVE_LAYOUT'], '');
     //$ajax->addSection ( 'center', $moduleName . ' ' . translate('LBL_ADD_LAYOUT'),
     $ajax->addSection('center', $mod_strings['LBL_ADD_LAYOUT'], $smarty->fetch('modules/ModuleBuilder/tpls/removegrouplayoutprompt.tpl'));
     echo $ajax->getJavascript();
 }
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:41,代码来源:view.removegrouplayoutprompt.php

示例10: __construct

 /**
  * The constructor
  * @param string $moduleName
  * @param string $packageName
  * @param string $client
  */
 public function __construct($moduleName, $packageName, $client = '')
 {
     $this->_moduleName = $moduleName;
     $this->client = empty($client) ? 'base' : $client;
     // TODO: history
     $this->historyPathname = "custom/history/modulebuilder/packages/{$packageName}/modules/{$moduleName}/clients/{$client}/filters/default/" . self::HISTORYFILENAME;
     $this->_history = new History($this->historyPathname);
     //get the bean from ModuleBuilder
     $mb = new ModuleBuilder();
     $this->module = $mb->getPackageModule($packageName, $moduleName);
     $this->module->mbvardefs->updateVardefs();
     $templates = $this->module->config['templates'];
     $template_def = "";
     foreach ($templates as $template => $a) {
         if ($a === 1) {
             $template_def = $template;
         }
     }
     $template_filter_def = "include/SugarObjects/templates/{$template_def}/clients/{$this->client}/filters/default/default.php";
     if (file_exists($template_filter_def)) {
         include $template_filter_def;
     }
     $this->sidecarFile = "{$this->module->getModuleDir()}/clients/{$client}/filters/default/default.php";
     if (file_exists($this->sidecarFile)) {
         include $this->sidecarFile;
     }
     $viewdefs = empty($viewdefs) ? array('fields' => array()) : $viewdefs;
     $this->_viewdefs = $this->getNewViewDefs($viewdefs);
     $this->_fielddefs = $this->getFieldDefs();
     $this->_paneldefs = $this->_viewdefs;
     // Set the global mod_strings directly as Sugar does not automatically load the
     // language files for undeployed modules (how could it?)
     $selected_lang = 'en_us';
     if (isset($GLOBALS['current_language']) && !empty($GLOBALS['current_language'])) {
         $selected_lang = $GLOBALS['current_language'];
     }
     $GLOBALS['mod_strings'] = array_merge($GLOBALS['mod_strings'], $this->module->getModStrings($selected_lang));
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:44,代码来源:UndeployedSidecarFilterImplementation.php

示例11: History

 function __construct($subpanelName, $moduleName, $packageName)
 {
     $this->_subpanelName = $subpanelName;
     $this->_moduleName = $moduleName;
     // TODO: history
     $this->historyPathname = 'custom/history/modulebuilder/packages/' . $packageName . '/modules/' . $moduleName . '/metadata/' . self::HISTORYFILENAME;
     $this->_history = new History($this->historyPathname);
     //get the bean from ModuleBuilder
     $mb = new ModuleBuilder();
     $this->module =& $mb->getPackageModule($packageName, $moduleName);
     $this->module->mbvardefs->updateVardefs();
     $this->_fielddefs =& $this->module->mbvardefs->vardefs['fields'];
     $templates =& $this->module->config['templates'];
     $template_def = "";
     foreach ($templates as $template => $a) {
         if ($a === 1) {
             $template_def = $template;
         }
     }
     $template_subpanel_def = 'include/SugarObjects/templates/' . $template_def . '/metadata/subpanels/default.php';
     if (file_exists($template_subpanel_def)) {
         include $template_subpanel_def;
         if (!empty($subpanel_layout['list_fields'])) {
             $this->_mergeFielddefs($this->_fielddefs, $subpanel_layout['list_fields']);
         }
     }
     $subpanel_layout = $this->module->getAvailibleSubpanelDef($this->_subpanelName);
     $this->_viewdefs =& $subpanel_layout['list_fields'];
     $this->_mergeFielddefs($this->_fielddefs, $this->_viewdefs);
     // Set the global mod_strings directly as Sugar does not automatically load the language files for undeployed modules (how could it?)
     $selected_lang = 'en_us';
     if (isset($GLOBALS['current_language']) && !empty($GLOBALS['current_language'])) {
         $selected_lang = $GLOBALS['current_language'];
     }
     $GLOBALS['mod_strings'] = array_merge($GLOBALS['mod_strings'], $this->module->getModStrings($selected_lang));
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:36,代码来源:UndeployedSubpanelImplementation.php

示例12: generateSmarty

 function generateSmarty()
 {
     //get the selected language
     $selected_lang = !empty($_REQUEST['dropdown_lang']) ? $_REQUEST['dropdown_lang'] : $_SESSION['authenticated_user_language'];
     $vardef = array();
     $package_name = 'studio';
     $package_strings = array();
     $new = false;
     $my_list_strings = return_app_list_strings_language($selected_lang);
     //		$my_list_strings = $GLOBALS['app_list_strings'];
     //if we are using ModuleBuilder then process the following
     if (!empty($_REQUEST['view_package']) && $_REQUEST['view_package'] != 'studio') {
         require_once 'modules/ModuleBuilder/MB/ModuleBuilder.php';
         $mb = new ModuleBuilder();
         $this->module =& $mb->getPackageModule($_REQUEST['view_package'], $_REQUEST['view_module']);
         $package =& $mb->packages[$_REQUEST['view_package']];
         $package_name = $package->name;
         $this->module->getVardefs();
         if (empty($_REQUEST['dropdown_name']) && !empty($_REQUEST['field'])) {
             $new = true;
             $_REQUEST['dropdown_name'] = $_REQUEST['field'] . '_list';
         }
         $vardef = !empty($this->module->mbvardefs->fields[$_REQUEST['dropdown_name']]) ? $this->module->mbvardefs->fields[$_REQUEST['dropdown_name']] : array();
         $this->module->mblanguage->generateAppStrings(false);
         $my_list_strings = array_merge($my_list_strings, $this->module->mblanguage->appListStrings[$selected_lang . '.lang.php']);
     }
     foreach ($my_list_strings as $key => $value) {
         if (!is_array($value)) {
             unset($my_list_strings[$key]);
         }
     }
     $dropdowns = array_keys($my_list_strings);
     asort($dropdowns);
     $keys = array_keys($dropdowns);
     $first_string = $my_list_strings[$dropdowns[$keys[0]]];
     if (!empty($cf)) {
         $smarty->assign('cf', $cf);
     }
     $name = '';
     $selected_dropdown = array();
     $smarty = new Sugar_Smarty();
     $json = getJSONobj();
     if (!empty($_REQUEST['dropdown_name']) && !$new) {
         $name = $_REQUEST['dropdown_name'];
         // handle the case where we've saved a dropdown in one language, and now attempt to edit it for another language. The $name exists, but $my_list_strings[$name] doesn't
         // for now, we just treat it as if it was new. A better approach might be to use the first language version as a template for future languages
         if (!isset($my_list_strings[$name])) {
             $my_list_strings[$name] = array();
         }
         $selected_dropdown = !empty($vardef['options']) && !empty($my_list_strings[$vardef['options']]) ? $my_list_strings[$vardef['options']] : $my_list_strings[$name];
         $smarty->assign('ul_list', 'list = ' . $json->encode(array_keys($selected_dropdown)));
         $smarty->assign('dropdown_name', !empty($vardef['options']) ? $vardef['options'] : $_REQUEST['dropdown_name']);
         $smarty->assign('name', $_REQUEST['dropdown_name']);
         $smarty->assign('options', $selected_dropdown);
     } else {
         $smarty->assign('ul_list', 'list = {}');
         //we should try to find a name for this dropdown based on the field name.
         $pre_pop_name = '';
         if (!empty($_REQUEST['field'])) {
             $pre_pop_name = $_REQUEST['field'];
         }
         //ensure this dropdown name does not already exist
         $use_name = $pre_pop_name . '_list';
         for ($i = 0; $i < 100; $i++) {
             if (empty($my_list_strings[$use_name])) {
                 break;
             } else {
                 $use_name = $pre_pop_name . '_' . $i;
             }
         }
         $smarty->assign('prepopulated_name', $use_name);
     }
     $smarty->assign('module', $this->module);
     $smarty->assign('APP', $GLOBALS['app_strings']);
     $smarty->assign('MOD', $GLOBALS['mod_strings']);
     $smarty->assign('selected_lang', $selected_lang);
     $smarty->assign('available_languages', get_languages());
     $smarty->assign('package_name', $package_name);
     return $smarty;
 }
开发者ID:klr2003,项目名称:sourceread,代码行数:80,代码来源:view.dropdown.php

示例13: display


//.........这里部分代码省略.........
         if (!$this->fromModuleBuilder) {
             $buttons[] = array('id' => 'saveBtn', 'text' => translate('LBL_BTN_SAVE'), 'actionScript' => "onclick='if(Studio2.checkGridLayout(\"{$this->editLayout}\")) Studio2.handleSave();'", 'disabled' => $disableLayout);
             $buttons[] = array('id' => 'publishBtn', 'text' => translate('LBL_BTN_SAVEPUBLISH'), 'actionScript' => "onclick='if(Studio2.checkGridLayout(\"{$this->editLayout}\")) Studio2.handlePublish();'", 'disabled' => $disableLayout);
             $buttons[] = array('id' => 'spacer', 'width' => '33px');
             $buttons[] = array('id' => 'historyBtn', 'text' => translate('LBL_HISTORY'), 'actionScript' => "onclick='ModuleBuilder.history.browse(\"{$this->editModule}\", \"{$this->editLayout}\")'", 'disabled' => $disableLayout);
             $buttons[] = array('id' => 'historyDefault', 'text' => translate('LBL_RESTORE_DEFAULT'), 'actionScript' => "onclick='ModuleBuilder.history.revert(\"{$this->editModule}\", \"{$this->editLayout}\", \"{$history->getLast()}\", \"\")'", 'disabled' => $disableLayout);
         } else {
             $buttons[] = array('id' => 'saveBtn', 'text' => $GLOBALS['mod_strings']['LBL_BTN_SAVE'], 'actionScript' => "onclick='if(Studio2.checkGridLayout(\"{$this->editLayout}\")) Studio2.handlePublish();'", 'disabled' => $disableLayout);
             $buttons[] = array('id' => 'spacer', 'width' => '33px');
             $buttons[] = array('id' => 'historyBtn', 'text' => translate('LBL_HISTORY'), 'actionScript' => "onclick='ModuleBuilder.history.browse(\"{$this->editModule}\", \"{$this->editLayout}\")'", 'disabled' => $disableLayout);
             $buttons[] = array('id' => 'historyDefault', 'text' => translate('LBL_RESTORE_DEFAULT'), 'actionScript' => "onclick='ModuleBuilder.history.revert(\"{$this->editModule}\", \"{$this->editLayout}\", \"{$history->getLast()}\", \"\")'", 'disabled' => $disableLayout);
         }
         if ($this->editLayout == MB_DETAILVIEW || $this->editLayout == MB_QUICKCREATE) {
             $buttons[] = array('id' => 'copyFromEditView', 'text' => translate('LBL_COPY_FROM_EDITVIEW'), 'actionScript' => "onclick='ModuleBuilder.copyFromView(\"{$this->editModule}\", \"{$this->editLayout}\")'", 'disabled' => $disableLayout);
         }
     }
     $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']}'";
             if (!empty($button['disabled'])) {
                 $html .= " disabled";
             }
             $html .= "></td>";
         }
     }
     $smarty->assign('buttons', $html);
     // assign fields and layout
     $smarty->assign('available_fields', $parser->getAvailableFields());
     $smarty->assign('disable_layout', $disableLayout);
     $smarty->assign('required_fields', $requiredFields);
     $smarty->assign('layout', $parser->getLayout());
     $smarty->assign('field_defs', $parser->getFieldDefs());
     $smarty->assign('view_module', $this->editModule);
     $smarty->assign('view', $this->editLayout);
     $smarty->assign('maxColumns', $parser->getMaxColumns());
     $smarty->assign('nextPanelId', $parser->getFirstNewPanelId());
     $smarty->assign('displayAsTabs', $parser->getUseTabs());
     $smarty->assign('tabDefs', $parser->getTabDefs());
     $smarty->assign('syncDetailEditViews', $parser->getSyncDetailEditViews());
     $smarty->assign('fieldwidth', 150);
     $smarty->assign('translate', $this->fromModuleBuilder ? false : 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();
     $translatedViewType = '';
     if (isset($labels[strtolower($this->editLayout)])) {
         $translatedViewType = translate($labels[strtolower($this->editLayout)], 'ModuleBuilder');
     } else {
         if (isset($this->sm)) {
             foreach ($this->sm->sources as $file => $def) {
                 if (!empty($def['view']) && $def['view'] == $this->editLayout && !empty($def['name'])) {
                     $translatedViewType = $def['name'];
                 }
             }
             if (empty($translatedViewType)) {
                 $label = "LBL_" . strtoupper($this->editLayout);
                 $translated = translate($label, $this->editModule);
                 if ($translated != $label) {
                     $translatedViewType = $translated;
                 }
             }
         }
     }
     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);
     $smarty->assign('calc_field_list', json_encode($parser->getCalculatedFields()));
     if ($this->fromModuleBuilder) {
         $mb = new ModuleBuilder();
         $module =& $mb->getPackageModule($this->package, $this->editModule);
         $smarty->assign('current_mod_strings', $module->getModStrings());
     }
     $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();
     }
 }
开发者ID:MexinaD,项目名称:SuiteCRM,代码行数:101,代码来源:view.layoutview.php

示例14: fetch


//.........这里部分代码省略.........
         //Check if autoincrement fields are allowed
         $allowAutoInc = true;
         $enumFields = array();
         foreach ($module->field_defs as $field => $def) {
             if (!empty($def['type']) && $def['type'] == "int" && !empty($def['auto_increment'])) {
                 $allowAutoInc = false;
                 continue;
             }
             if (!empty($def['type']) && $def['type'] == "enum" && $field != $vardef['name']) {
                 if (!empty($def['studio']) && $def['studio'] == "false") {
                     continue;
                 }
                 //bug51866
                 $enumFields[$field] = translate($def['vname'], $moduleName);
                 if (substr($enumFields[$field], -1) == ":") {
                     $enumFields[$field] = substr($enumFields[$field], 0, strlen($enumFields[$field]) - 1);
                 }
             }
         }
         $fv->ss->assign('allowAutoInc', $allowAutoInc);
         $GLOBALS['log']->warn('view.modulefield: hidelevel ' . $fv->ss->get_template_vars('hideLevel') . " " . print_r($vardef, true));
         if (!empty($vardef['vname'])) {
             $fv->ss->assign('lbl_value', htmlentities(translate($vardef['vname'], $moduleName), ENT_QUOTES, 'UTF-8'));
         }
         $fv->ss->assign('module', $module);
         if (empty($module->mbvardefs->vardefs['fields']['parent_name']) || isset($vardef['type']) && $vardef['type'] == 'parent') {
             $field_types['parent'] = $GLOBALS['mod_strings']['parent'];
         }
         $edit_or_add = 'editField';
     } else {
         require_once 'modules/ModuleBuilder/MB/ModuleBuilder.php';
         $mb = new ModuleBuilder();
         $moduleName = $_REQUEST['view_module'];
         $module =& $mb->getPackageModule($_REQUEST['view_package'], $moduleName);
         $package =& $mb->packages[$_REQUEST['view_package']];
         $module->getVardefs();
         if (!$ac) {
             $ac = new AjaxCompose();
         }
         $vardef = !empty($module->mbvardefs->vardefs['fields'][$field_name]) ? $module->mbvardefs->vardefs['fields'][$field_name] : array();
         if ($isClone) {
             unset($vardef['name']);
         }
         if (empty($vardef['name'])) {
             if (!empty($_REQUEST['type'])) {
                 $vardef['type'] = $_REQUEST['type'];
             }
             $fv->ss->assign('hideLevel', 0);
         } else {
             if (!empty($module->mbvardefs->vardef['fields'][$vardef['name']])) {
                 $fv->ss->assign('hideLevel', 1);
             } elseif (isset($vardef['custom_module'])) {
                 $fv->ss->assign('hideLevel', 2);
             } else {
                 $fv->ss->assign('hideLevel', 3);
                 // tyoung bug 17350 - effectively mark template derived fields as readonly
             }
         }
         require_once 'modules/DynamicFields/FieldCases.php';
         $tf = get_widget(empty($vardef['type']) ? "" : $vardef['type']);
         $tf->module = $module;
         $tf->populateFromRow($vardef);
         $vardef = array_merge($vardef, $tf->get_field_def());
         $fv->ss->assign('module', $module);
         $fv->ss->assign('package', $package);
         $fv->ss->assign('MB', '1');
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:67,代码来源:view.modulefield.php

示例15: get_body

function get_body(&$ss, $vardef)
{
    $multi = false;
    $radio = false;
    if (isset($vardef['type']) && $vardef['type'] == 'multienum') {
        $multi = true;
    }
    $selected_options = "";
    if ($multi && !empty($vardef['default'])) {
        $selected_options = unencodeMultienum($vardef['default']);
    } else {
        if (isset($vardef['default'])) {
            $selected_options = $vardef['default'];
        }
    }
    $edit_mod_strings = return_module_language($GLOBALS['current_language'], 'EditCustomFields');
    if (!empty($_REQUEST['type']) && $_REQUEST['type'] == 'radioenum') {
        $edit_mod_strings['LBL_DROP_DOWN_LIST'] = $edit_mod_strings['LBL_RADIO_FIELDS'];
        $radio = true;
    }
    $package_strings = array();
    if (!empty($_REQUEST['view_package'])) {
        $view_package = $_REQUEST['view_package'];
        if ($view_package != 'studio') {
            require_once 'modules/ModuleBuilder/MB/ModuleBuilder.php';
            $mb = new ModuleBuilder();
            $module =& $mb->getPackageModule($view_package, $_REQUEST['view_module']);
            $lang = $GLOBALS['current_language'];
            //require_once($package->getPackageDir()."/include/language/$lang.lang.php");
            $module->mblanguage->generateAppStrings(false);
            $package_strings = $module->mblanguage->appListStrings[$lang . '.lang.php'];
        }
    }
    global $app_list_strings;
    $my_list_strings = $app_list_strings;
    $my_list_strings = array_merge($my_list_strings, $package_strings);
    foreach ($my_list_strings as $key => $value) {
        if (!is_array($value)) {
            unset($my_list_strings[$key]);
        }
    }
    $dropdowns = array_keys($my_list_strings);
    sort($dropdowns);
    $default_dropdowns = array();
    if (!empty($vardef['options']) && !empty($my_list_strings[$vardef['options']])) {
        $default_dropdowns = $my_list_strings[$vardef['options']];
    } else {
        //since we do not have a default value then we should assign the first one.
        $key = $dropdowns[0];
        $default_dropdowns = $my_list_strings[$key];
    }
    $selected_dropdown = '';
    if (!empty($vardef['options'])) {
        $selected_dropdown = $vardef['options'];
    }
    $show = true;
    if (!empty($_REQUEST['refresh_dropdown'])) {
        $show = false;
    }
    $ss->assign('dropdowns', $dropdowns);
    $ss->assign('default_dropdowns', $default_dropdowns);
    $ss->assign('selected_dropdown', $selected_dropdown);
    $ss->assign('show', $show);
    $ss->assign('selected_options', $selected_options);
    $ss->assign('multi', isset($multi) ? $multi : false);
    $ss->assign('radio', isset($radio) ? $radio : false);
    $ss->assign('dropdown_name', !empty($vardef['options']) ? $vardef['options'] : '');
    require_once 'include/JSON.php';
    $json = new JSON(JSON_LOOSE_TYPE);
    $ss->assign('app_list_strings', "''");
    return $ss->fetch('custom/modules/DynamicFields/templates/Fields/Forms/dynamicenum.tpl');
}
开发者ID:isrealconsulting,项目名称:ic-suite,代码行数:72,代码来源:dynamicenum.php


注:本文中的ModuleBuilder::getPackageModule方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。