本文整理汇总了PHP中SugarFieldHandler::displaySmarty方法的典型用法代码示例。如果您正苦于以下问题:PHP SugarFieldHandler::displaySmarty方法的具体用法?PHP SugarFieldHandler::displaySmarty怎么用?PHP SugarFieldHandler::displaySmarty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SugarFieldHandler
的用法示例。
在下文中一共展示了SugarFieldHandler::displaySmarty方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_sugar_teamset_list
function smarty_function_sugar_teamset_list($params, &$smarty)
{
if (!isset($params['row']) && !isset($params['col'])) {
$smarty->trigger_error("sugar_phone: missing parameters, cannot continue");
return '';
}
require_once 'include/SugarFields/SugarFieldHandler.php';
$sfh = new SugarFieldHandler();
return $sfh->displaySmarty($params['row'], $params['vardef'], 'ListView', array('col' => $params['col']));
}
示例2: smarty_function_sugar_field
function smarty_function_sugar_field($params, &$smarty)
{
if (!isset($params['vardef']) || !isset($params['displayType']) || !isset($params['parentFieldArray'])) {
if (!isset($params['vardef'])) {
$smarty->trigger_error("sugar_field: missing 'vardef' parameter");
}
if (!isset($params['displayType'])) {
$smarty->trigger_error("sugar_field: missing 'displayType' parameter");
}
if (!isset($params['parentFieldArray'])) {
$smarty->trigger_error("sugar_field: missing 'parentFieldArray' parameter");
}
return;
}
static $sfh;
if (!isset($sfh)) {
$sfh = new SugarFieldHandler();
}
if (!isset($params['displayParams'])) {
$displayParams = array();
} else {
$displayParams = $params['displayParams'];
}
if (isset($params['labelSpan'])) {
$displayParams['labelSpan'] = $params['labelSpan'];
} else {
$displayParams['labelSpan'] = null;
}
if (isset($params['fieldSpan'])) {
$displayParams['fieldSpan'] = $params['fieldSpan'];
} else {
$displayParams['fieldSpan'] = null;
}
if (isset($params['typeOverride'])) {
// override the type in the vardef?
$params['vardef']['type'] = $params['typeOverride'];
}
if (isset($params['formName'])) {
$displayParams['formName'] = $params['formName'];
}
$_contents = $sfh->displaySmarty($params['parentFieldArray'], $params['vardef'], $params['displayType'], $displayParams, $params['tabindex']);
return $_contents;
}
示例3: getModuleField
function getModuleField($module, $fieldname, $aow_field, $view = 'EditView', $value = '', $alt_type = '')
{
global $current_language, $app_strings, $app_list_strings, $current_user, $beanFiles, $beanList;
// use the mod_strings for this module
$mod_strings = return_module_language($current_language, $module);
// set the filename for this control
$file = create_cache_directory('modules/AOW_WorkFlow/') . $module . $view . $alt_type . $fieldname . '.tpl';
if (!is_file($file) || inDeveloperMode() || !empty($_SESSION['developerMode'])) {
if (!isset($vardef)) {
require_once $beanFiles[$beanList[$module]];
$focus = new $beanList[$module]();
$vardef = $focus->getFieldDefinition($fieldname);
}
$displayParams = array();
//$displayParams['formName'] = 'EditView';
// if this is the id relation field, then don't have a pop-up selector.
if ($vardef['type'] == 'relate' && $vardef['id_name'] == $vardef['name']) {
$vardef['type'] = 'varchar';
}
if (isset($vardef['precision'])) {
unset($vardef['precision']);
}
//$vardef['precision'] = $locale->getPrecedentPreference('default_currency_significant_digits', $current_user);
//TODO Fix datetimecomebo
//temp work around
if ($vardef['type'] == 'datetimecombo') {
$vardef['type'] = 'datetime';
}
// trim down textbox display
if ($vardef['type'] == 'text') {
$vardef['rows'] = 2;
$vardef['cols'] = 32;
}
// create the dropdowns for the parent type fields
if ($vardef['type'] == 'parent_type') {
$vardef['type'] = 'enum';
}
if ($vardef['type'] == 'link') {
$vardef['type'] = 'relate';
$vardef['rname'] = 'name';
$vardef['id_name'] = $vardef['name'] . '_id';
if ((!isset($vardef['module']) || $vardef['module'] == '') && $focus->load_relationship($vardef['name'])) {
$vardef['module'] = $focus->{$vardef}['name']->getRelatedModuleName();
}
}
//check for $alt_type
if ($alt_type != '') {
$vardef['type'] = $alt_type;
}
// remove the special text entry field function 'getEmailAddressWidget'
if (isset($vardef['function']) && ($vardef['function'] == 'getEmailAddressWidget' || $vardef['function']['name'] == 'getEmailAddressWidget')) {
unset($vardef['function']);
}
if (isset($vardef['name']) && ($vardef['name'] == 'date_entered' || $vardef['name'] == 'date_modified')) {
$vardef['name'] = 'aow_temp_date';
}
// load SugarFieldHandler to render the field tpl file
static $sfh;
if (!isset($sfh)) {
require_once 'include/SugarFields/SugarFieldHandler.php';
$sfh = new SugarFieldHandler();
}
$contents = $sfh->displaySmarty('fields', $vardef, $view, $displayParams);
// Remove all the copyright comments
$contents = preg_replace('/\\{\\*[^\\}]*?\\*\\}/', '', $contents);
if ($view == 'EditView' && ($vardef['type'] == 'relate' || $vardef['type'] == 'parent')) {
$contents = str_replace('"' . $vardef['id_name'] . '"', '{/literal}"{$fields.' . $vardef['name'] . '.id_name}"{literal}', $contents);
$contents = str_replace('"' . $vardef['name'] . '"', '{/literal}"{$fields.' . $vardef['name'] . '.name}"{literal}', $contents);
}
// hack to disable one of the js calls in this control
if (isset($vardef['function']) && ($vardef['function'] == 'getCurrencyDropDown' || $vardef['function']['name'] == 'getCurrencyDropDown')) {
$contents .= "{literal}<script>function CurrencyConvertAll() { return; }</script>{/literal}";
}
// Save it to the cache file
if ($fh = @sugar_fopen($file, 'w')) {
fputs($fh, $contents);
fclose($fh);
}
}
// Now render the template we received
$ss = new Sugar_Smarty();
// Create Smarty variables for the Calendar picker widget
global $timedate;
$time_format = $timedate->get_user_time_format();
$date_format = $timedate->get_cal_date_format();
$ss->assign('USER_DATEFORMAT', $timedate->get_user_date_format());
$ss->assign('TIME_FORMAT', $time_format);
$time_separator = ":";
$match = array();
if (preg_match('/\\d+([^\\d])\\d+([^\\d]*)/s', $time_format, $match)) {
$time_separator = $match[1];
}
$t23 = strpos($time_format, '23') !== false ? '%H' : '%I';
if (!isset($match[2]) || $match[2] == '') {
$ss->assign('CALENDAR_FORMAT', $date_format . ' ' . $t23 . $time_separator . "%M");
} else {
$pm = $match[2] == "pm" ? "%P" : "%p";
$ss->assign('CALENDAR_FORMAT', $date_format . ' ' . $t23 . $time_separator . "%M" . $pm);
}
$ss->assign('CALENDAR_FDOW', $current_user->get_first_day_of_week());
//.........这里部分代码省略.........
示例4: process_dynamic_listview_rows
//.........这里部分代码省略.........
//AG$subpanel_data = $this->list_field_defs;
//$bla = array_pop($subpanel_data);
//select which sub-panel to display here, the decision will be made based on the type of
//the sub-panel and panel in the bean being processed.
if ($subpanel_def->isCollection()) {
$thepanel = $subpanel_def->sub_subpanels[$aItem->panel_name];
} else {
$thepanel = $subpanel_def;
}
//get data source name
$linked_field = $thepanel->get_data_source_name();
$linked_field_set = $thepanel->get_data_source_name(true);
foreach ($thepanel->get_list_fields() as $field_name => $list_field) {
//add linked field attribute to the array.
$list_field['linked_field'] = $linked_field;
$list_field['linked_field_set'] = $linked_field_set;
$usage = empty($list_field['usage']) ? '' : $list_field['usage'];
if ($usage != 'query_only') {
$list_field['name'] = $field_name;
$module_field = $field_name . '_mod';
$owner_field = $field_name . '_owner';
if (!empty($aItem->{$module_field})) {
$list_field['owner_id'] = $aItem->{$owner_field};
$list_field['owner_module'] = $aItem->{$module_field};
} else {
$list_field['owner_id'] = false;
$list_field['owner_module'] = false;
}
if (isset($list_field['alias'])) {
$list_field['name'] = $list_field['alias'];
} else {
$list_field['name'] = $field_name;
}
$list_field['fields'] = $fields;
$list_field['module'] = $aItem->module_dir;
$list_field['start_link_wrapper'] = $this->start_link_wrapper;
$list_field['end_link_wrapper'] = $this->end_link_wrapper;
$list_field['subpanel_id'] = $this->subpanel_id;
$list_field['DetailView'] = $aItem->ACLAccess('DetailView');
$list_field['ListView'] = $aItem->ACLAccess('ListView');
$list_field['EditView'] = $aItem->ACLAccess('EditView');
$list_field['Delete'] = $aItem->ACLAccess('Delete');
if (isset($aItem->field_defs[strtolower($list_field['name'])])) {
require_once 'include/SugarFields/SugarFieldHandler.php';
// We need to see if a sugar field exists for this field type first,
// if it doesn't, toss it at the old sugarWidgets. This is for
// backwards compatibilty and will be removed in a future release
$vardef = $aItem->field_defs[strtolower($list_field['name'])];
if (isset($vardef['type'])) {
$fieldType = isset($vardef['custom_type']) ? $vardef['custom_type'] : $vardef['type'];
$tmpField = SugarFieldHandler::getSugarField($fieldType, true);
} else {
$tmpField = NULL;
}
if ($tmpField != NULL) {
$widget_contents = SugarFieldHandler::displaySmarty($list_field['fields'], $vardef, 'ListView', $list_field);
} else {
// No SugarField for this particular type
// Use the old, icky, SugarWidget for now
$widget_contents = $layout_manager->widgetDisplay($list_field);
}
if (isset($list_field['widget_class']) && $list_field['widget_class'] == 'SubPanelDetailViewLink') {
// We need to call into the old SugarWidgets for the time being, so it can generate a proper link with all the various corner-cases handled
// So we'll populate the field data with the pre-rendered display for the field
$list_field['fields'][$field_name] = $widget_contents;
if ('full_name' == $field_name) {
//bug #32465
$list_field['fields'][strtoupper($field_name)] = $widget_contents;
}
$widget_contents = $layout_manager->widgetDisplay($list_field);
} else {
if (isset($list_field['widget_class']) && $list_field['widget_class'] == 'SubPanelEmailLink') {
$widget_contents = $layout_manager->widgetDisplay($list_field);
}
}
} else {
// This handles the edit and remove buttons
$widget_contents = $layout_manager->widgetDisplay($list_field);
}
static $count;
if (!isset($count)) {
$count = 0;
} else {
$count++;
}
$this->xTemplate->assign('CELL_COUNT', $count);
if (empty($widget_contents)) {
$widget_contents = ' ';
}
$this->xTemplate->assign('CELL', $widget_contents);
$this->xTemplate->parse($xtemplateSection . ".row.cell");
}
}
$aItem->setupCustomFields($aItem->module_dir);
$aItem->custom_fields->populateAllXTPL($this->xTemplate, 'detail', $html_varName, $fields);
$count++;
$this->xTemplate->parse($xtemplateSection . ".row");
}
$this->xTemplate->parse($xtemplateSection);
}
示例5: getControl
/**
* Returns an input control for this fieldname given
*
* @param string $module
* @param string $fieldname
* @param string $vardef
* @param string $value
* @return string html for input element for this control
*/
function getControl($module, $fieldname, $vardef = null, $value = '')
{
global $current_language, $app_strings, $dictionary, $app_list_strings;
// use the mod_strings for this module
$mod_strings = return_module_language($current_language, $module);
// set the filename for this control
$file = create_cache_directory('modules/Import/') . $module . $fieldname . '.tpl';
if (!is_file($file) || !empty($GLOBALS['sugar_config']['developerMode']) || !empty($_SESSION['developerMode'])) {
if (!isset($vardef)) {
$focus = loadBean($module);
$vardef = $focus->getFieldDefinition($fieldname);
}
// if this is the id relation field, then don't have a pop-up selector.
if ($vardef['type'] == 'relate' && $vardef['id_name'] == $vardef['name']) {
$vardef['type'] = 'varchar';
}
// create the dropdowns for the parent type fields
if ($vardef['type'] == 'parent_type') {
$vardef['type'] = 'enum';
}
// remove the special text entry field function 'getEmailAddressWidget'
if (isset($vardef['function']) && ($vardef['function'] == 'getEmailAddressWidget' || $vardef['function']['name'] == 'getEmailAddressWidget')) {
unset($vardef['function']);
}
// load SugarFieldHandler to render the field tpl file
static $sfh;
if (!isset($sfh)) {
require_once 'include/SugarFields/SugarFieldHandler.php';
$sfh = new SugarFieldHandler();
}
$displayParams = array();
$displayParams['formName'] = 'importstep3';
$contents = $sfh->displaySmarty('fields', $vardef, 'ImportView', $displayParams);
// Remove all the copyright comments
$contents = preg_replace('/\\{\\*[^\\}]*?\\*\\}/', '', $contents);
// hack to disable one of the js calls in this control
if (isset($vardef['function']) && ($vardef['function'] == 'getCurrencyDropDown' || $vardef['function']['name'] == 'getCurrencyDropDown')) {
$contents .= "{literal}<script>function CurrencyConvertAll() { return; }</script>{/literal}";
}
// Save it to the cache file
if ($fh = @sugar_fopen($file, 'w')) {
fputs($fh, $contents);
fclose($fh);
}
}
// Now render the template we received
$ss = new Sugar_Smarty();
// Create Smarty variables for the Calendar picker widget
global $timedate;
$time_format = $timedate->get_user_time_format();
$date_format = $timedate->get_cal_date_format();
$ss->assign('USER_DATEFORMAT', $timedate->get_user_date_format());
$ss->assign('TIME_FORMAT', $time_format);
$time_separator = ":";
$match = array();
if (preg_match('/\\d+([^\\d])\\d+([^\\d]*)/s', $time_format, $match)) {
$time_separator = $match[1];
}
$t23 = strpos($time_format, '23') !== false ? '%H' : '%I';
if (!isset($match[2]) || $match[2] == '') {
$ss->assign('CALENDAR_FORMAT', $date_format . ' ' . $t23 . $time_separator . "%M");
} else {
$pm = $match[2] == "pm" ? "%P" : "%p";
$ss->assign('CALENDAR_FORMAT', $date_format . ' ' . $t23 . $time_separator . "%M" . $pm);
}
// populate the fieldlist from the vardefs
$fieldlist = array();
if (!isset($focus) || !$focus instanceof SugarBean) {
$focus = loadBean($module);
}
// create the dropdowns for the parent type fields
if ($vardef['type'] == 'parent_type') {
$focus->field_defs[$vardef['name']]['options'] = $focus->field_defs[$vardef['group']]['options'];
}
$vardefFields = $focus->getFieldDefinitions();
foreach ($vardefFields as $name => $properties) {
$fieldlist[$name] = $properties;
// fill in enums
if (isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($app_list_strings[$fieldlist[$name]['options']])) {
$fieldlist[$name]['options'] = $app_list_strings[$fieldlist[$name]['options']];
} elseif (isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($mod_strings[$fieldlist[$name]['options']])) {
$fieldlist[$name]['options'] = $mod_strings[$fieldlist[$name]['options']];
}
// Bug 22730: make sure all enums have the ability to select blank as the default value.
if (!isset($fieldlist[$name]['options'][''])) {
$fieldlist[$name]['options'][''] = '';
}
}
// fill in function return values
if (!in_array($fieldname, array('email1', 'email2'))) {
if (!empty($fieldlist[$fieldname]['function']['returns']) && $fieldlist[$fieldname]['function']['returns'] == 'html') {
//.........这里部分代码省略.........
示例6: process_dynamic_listview_rows
//.........这里部分代码省略.........
$module_field = $field_name . '_mod';
$owner_field = $field_name . '_owner';
if (!empty($aItem->{$module_field})) {
$list_field['owner_id'] = $aItem->{$owner_field};
$list_field['owner_module'] = $aItem->{$module_field};
} else {
$list_field['owner_id'] = false;
$list_field['owner_module'] = false;
}
if (isset($list_field['alias'])) {
$list_field['name'] = $list_field['alias'];
} else {
$list_field['name'] = $field_name;
}
$list_field['fields'] = $fields;
$list_field['module'] = $aItem->module_dir;
$list_field['start_link_wrapper'] = $this->start_link_wrapper;
$list_field['end_link_wrapper'] = $this->end_link_wrapper;
$list_field['subpanel_id'] = $this->subpanel_id;
$list_field += $field_acl;
if (isset($aItem->field_defs[strtolower($list_field['name'])])) {
require_once 'include/SugarFields/SugarFieldHandler.php';
// We need to see if a sugar field exists for this field type first,
// if it doesn't, toss it at the old sugarWidgets. This is for
// backwards compatibility and will be removed in a future release
$vardef = $aItem->field_defs[strtolower($list_field['name'])];
if (isset($vardef['type'])) {
$fieldType = isset($vardef['custom_type']) ? $vardef['custom_type'] : $vardef['type'];
$tmpField = SugarFieldHandler::getSugarField($fieldType, true);
} else {
$tmpField = NULL;
}
if ($tmpField != NULL) {
$widget_contents = SugarFieldHandler::displaySmarty($list_field['fields'], $vardef, 'ListView', $list_field);
} else {
// No SugarField for this particular type
// Use the old, icky, SugarWidget for now
$widget_contents = $layout_manager->widgetDisplay($list_field);
}
if (isset($list_field['widget_class']) && $list_field['widget_class'] == 'SubPanelDetailViewLink') {
// We need to call into the old SugarWidgets for the time being, so it can generate a proper link with all the various corner-cases handled
// So we'll populate the field data with the pre-rendered display for the field
$list_field['fields'][$field_name] = $widget_contents;
if ('full_name' == $field_name) {
//bug #32465
$list_field['fields'][strtoupper($field_name)] = $widget_contents;
}
//vardef source is non db, assign the field name to varname for processing of column.
if (!empty($vardef['source']) && $vardef['source'] == 'non-db') {
$list_field['varname'] = $field_name;
}
$widget_contents = $layout_manager->widgetDisplay($list_field);
} else {
if (isset($list_field['widget_class']) && $list_field['widget_class'] == 'SubPanelEmailLink') {
$widget_contents = $layout_manager->widgetDisplay($list_field);
}
}
$count++;
$this->xTemplate->assign('CELL_COUNT', $count);
$this->xTemplate->assign('CLASS', "");
if (empty($widget_contents)) {
$widget_contents = ' ';
}
$this->xTemplate->assign('CELL', $widget_contents);
$this->xTemplate->parse($xtemplateSection . ".row.cell");
} else {
示例7: count
function process_editview()
{
if (isset($this->bean->{$this->value_name}['secondaries'])) {
$this->numFields = count($this->bean->{$this->value_name}['secondaries']) + 1;
}
if (!isset($this->displayParams['readOnly'])) {
$this->displayParams['readOnly'] = '';
} else {
$this->displayParams['readOnly'] = $this->displayParams['readOnly'] == false ? '' : 'READONLY';
}
// If there is extra field to show.
if (isset($this->displayParams['collection_field_list'])) {
require_once 'include/SugarFields/SugarFieldHandler.php';
$sfh = new SugarFieldHandler();
vardefmanager::loadVardef($this->related_module, $GLOBALS['beanList'][$this->related_module]);
foreach ($this->displayParams['collection_field_list'] as $k => $v) {
$javascript = '';
$collection_field_vardef = $GLOBALS['dictionary'][$GLOBALS['beanList'][$this->related_module]]['fields'][$v['name']];
// For each extra field the params which are not displayParams will be consider as params to override the vardefs values.
foreach ($v as $k_override => $v_override) {
if ($k_override != 'displayParams') {
$collection_field_vardef[$k_override] = $v_override;
}
}
// If relate field : enable quick search by creating the sqs_object array.
if ($collection_field_vardef['type'] == 'relate') {
require_once 'include/TemplateHandler/TemplateHandler.php';
$tph = new TemplateHandler();
$javascript = $tph->createQuickSearchCode(array($collection_field_vardef['name'] => $collection_field_vardef), array($v), $this->form_name);
$javascript = str_replace('<script language="javascript">' . "if(typeof sqs_objects == 'undefined'){var sqs_objects = new Array;}sqs_objects['{$collection_field_vardef['name']}']=", "", $javascript);
$javascript = substr($javascript, 0, -10);
//remove ";</script>"
$javascriptPHP = $this->json->decode($javascript);
foreach ($javascriptPHP['populate_list'] as $kk => $vv) {
$javascriptPHP['populate_list'][$kk] .= "_" . $this->vardef['name'] . "_collection_extra_0";
}
foreach ($javascriptPHP['required_list'] as $kk => $vv) {
$javascriptPHP['required_list'][$kk] .= "_" . $this->vardef['name'] . "_collection_extra_0";
}
foreach ($javascriptPHP['field_list'] as $kk => $vv) {
if ($vv == 'id') {
$javascriptPHP['populate_list'][$kk];
}
}
$javascript = $this->json->encode($javascriptPHP);
$javascript = "<script language='javascript'>if(typeof sqs_objects == 'undefined'){var sqs_objects = new Array;}sqs_objects['{$collection_field_vardef['name']}_" . $this->vardef['name'] . "_collection_extra_0']=" . $javascript . ';</script>';
}
$collection_field_vardef['name'] .= "_" . $this->vardef['name'] . "_collection_extra_0";
if (isset($collection_field_vardef['id_name'])) {
$collection_field_vardef['id_name'] .= "_" . $this->vardef['name'] . "_collection_extra_0";
}
if (isset($this->displayParams['allow_update']) && ($this->displayParams['allow_update'] === false || $this->displayParams['allow_update'] === 'false')) {
$this->displayParams['allow_update'] = 'false';
$v['displayParams']['field']['disabled'] = '';
} else {
$this->displayParams['allow_update'] = 'true';
if (!isset($v['displayParams'])) {
$v['displayParams'] = array();
}
}
$viewtype = 'EditView';
$name = $collection_field_vardef['name'];
// Rearranging the array with name as key instaead of number. This is required for displaySmarty() to assign the good variable.
$this->displayParams['collection_field_list'][$name]['vardefName'] = $this->displayParams['collection_field_list'][$k]['name'];
$this->displayParams['collection_field_list'][$name]['name'] = $name;
if ($collection_field_vardef['type'] == 'relate') {
$this->displayParams['collection_field_list'][$name]['id_name'] = $collection_field_vardef['id_name'];
$this->displayParams['collection_field_list'][$name]['module'] = $collection_field_vardef['module'];
}
$this->displayParams['collection_field_list'][$name]['label'] = "{sugar_translate label='{$collection_field_vardef['vname']}' module='{$this->related_module}'}";
//translate($collection_field_vardef['vname'], $this->related_module);
$this->displayParams['collection_field_list'][$name]['field'] = $sfh->displaySmarty('displayParams.collection_field_list', $collection_field_vardef, $viewtype, $v['displayParams'], 1);
$this->displayParams['collection_field_list'][$name]['field'] .= '{literal}' . $javascript;
// Handle update_field array ONCHANGE
$this->displayParams['collection_field_list'][$name]['field'] .= <<<FRA
<script language='javascript'>
var oldonchange = '';
if(typeof(document.getElementById('{$collection_field_vardef['name']}').attributes.onchange) != 'undefined')
{
oldonchange=document.getElementById('{$collection_field_vardef['name']}').attributes.onchange.value;
}
FRA;
$this->displayParams['collection_field_list'][$name]['field'] .= "eval(\"document.getElementById('{$collection_field_vardef['name']}').onchange = function onchange(event){collection['{$this->vardef['name']}'].update_fields.{$collection_field_vardef['name']}=true;";
if ($collection_field_vardef['type'] == 'relate') {
// If relate add the ID field to the array
$this->displayParams['collection_field_list'][$name]['field'] .= "collection['{$this->vardef['name']}'].update_fields.{$collection_field_vardef['id_name']}=true;";
}
$this->displayParams['collection_field_list'][$name]['field'] .= "document.getElementById('update_fields_{$this->vardef['name']}_collection').value = YAHOO.lang.JSON.stringify(collection['{$this->vardef['name']}'].update_fields);\" + oldonchange + \"};\");</script>{/literal}";
//we need to get rid of the old value;
unset($this->displayParams['collection_field_list'][$k]);
}
}
if (!isset($this->displayParams['class'])) {
$this->displayParams['class'] = '';
}
if (isset($this->displayParams['allow_new']) && ($this->displayParams['allow_new'] === false || $this->displayParams['allow_new'] === 'false')) {
$this->displayParams['allow_new'] = 'false';
$this->displayParams['class'] = str_replace('sqsNoAutofill', '', $this->displayParams['class']);
} else {
$this->displayParams['allow_new'] = 'true';
//.........这里部分代码省略.........
示例8: getEditFieldHTML
function getEditFieldHTML($module, $fieldname, $aow_field, $view = 'EditView', $id = '', $alt_type = '', $currency_id = '')
{
global $current_language, $app_strings, $app_list_strings, $current_user, $beanFiles, $beanList;
$bean = BeanFactory::getBean($module, $id);
if (!checkAccess($bean)) {
return false;
}
$value = getFieldValueFromModule($fieldname, $module, $id);
// use the mod_strings for this module
$mod_strings = return_module_language($current_language, $module);
// set the filename for this control
$file = create_cache_directory('include/InlineEditing/') . $module . $view . $alt_type . $fieldname . '.tpl';
if (!is_file($file) || inDeveloperMode() || !empty($_SESSION['developerMode'])) {
if (!isset($vardef)) {
require_once $beanFiles[$beanList[$module]];
$focus = new $beanList[$module]();
$vardef = $focus->getFieldDefinition($fieldname);
}
$displayParams = array();
//$displayParams['formName'] = 'EditView';
// if this is the id relation field, then don't have a pop-up selector.
if ($vardef['type'] == 'relate' && $vardef['id_name'] == $vardef['name']) {
$vardef['type'] = 'varchar';
}
if (isset($vardef['precision'])) {
unset($vardef['precision']);
}
//$vardef['precision'] = $locale->getPrecedentPreference('default_currency_significant_digits', $current_user);
//TODO Fix datetimecomebo
//temp work around
if ($vardef['type'] == 'datetime') {
$vardef['type'] = 'datetimecombo';
}
// trim down textbox display
if ($vardef['type'] == 'text') {
$vardef['rows'] = 2;
$vardef['cols'] = 32;
}
// create the dropdowns for the parent type fields
if ($vardef['type'] == 'parent_type') {
$vardef['type'] = 'enum';
}
if ($vardef['type'] == 'link') {
$vardef['type'] = 'relate';
$vardef['rname'] = 'name';
$vardef['id_name'] = $vardef['name'] . '_id';
if ((!isset($vardef['module']) || $vardef['module'] == '') && $focus->load_relationship($vardef['name'])) {
$vardef['module'] = $focus->{$vardef['name']}->getRelatedModuleName();
}
}
//check for $alt_type
if ($alt_type != '') {
$vardef['type'] = $alt_type;
}
// remove the special text entry field function 'getEmailAddressWidget'
if (isset($vardef['function']) && ($vardef['function'] == 'getEmailAddressWidget' || $vardef['function']['name'] == 'getEmailAddressWidget')) {
unset($vardef['function']);
}
if (isset($vardef['name']) && $vardef['name'] == 'date_modified') {
$vardef['name'] = 'aow_temp_date';
}
// load SugarFieldHandler to render the field tpl file
static $sfh;
if (!isset($sfh)) {
require_once 'include/SugarFields/SugarFieldHandler.php';
$sfh = new SugarFieldHandler();
}
$contents = $sfh->displaySmarty('fields', $vardef, $view, $displayParams);
// Remove all the copyright comments
$contents = preg_replace('/\\{\\*[^\\}]*?\\*\\}/', '', $contents);
// remove extra wrong javascript which breaks auto complete on flexi relationship parent fields
$contents = preg_replace("/<script language=\"javascript\">if\\(typeof sqs_objects == \\'undefined\\'\\){var sqs_objects = new Array;}sqs_objects\\[\\'EditView_parent_name\\'\\].*?<\\/script>/", "", $contents);
if ($view == 'EditView' && ($vardef['type'] == 'relate' || $vardef['type'] == 'parent')) {
$contents = str_replace('"' . $vardef['id_name'] . '"', '{/literal}"{$fields.' . $vardef['name'] . '.id_name}"{literal}', $contents);
$contents = str_replace('"' . $vardef['name'] . '"', '{/literal}"{$fields.' . $vardef['name'] . '.name}"{literal}', $contents);
// regex below fixes button javascript for flexi relationship
if ($vardef['type'] == 'parent') {
$contents = str_replace("onclick='open_popup(document.{\$form_name}.parent_type.value, 600, 400, \"\", true, false, {literal}{\"call_back_function\":\"set_return\",\"form_name\":\"EditView\",\"field_to_name_array\":{\"id\":{/literal}\"{\$fields.parent_name.id_name}", "onclick='open_popup(document.{\$form_name}.parent_type.value, 600, 400, \"\", true, false, {literal}{\"call_back_function\":\"set_return\",\"form_name\":\"EditView\",\"field_to_name_array\":{\"id\":{/literal}\"parent_id", $contents);
}
}
// hack to disable one of the js calls in this control
if (isset($vardef['function']) && ($vardef['function'] == 'getCurrencyDropDown' || $vardef['function']['name'] == 'getCurrencyDropDown')) {
$contents .= "{literal}<script>function CurrencyConvertAll() { return; }</script>{/literal}";
}
// Save it to the cache file
if ($fh = @sugar_fopen($file, 'w')) {
fputs($fh, $contents);
fclose($fh);
}
}
// Now render the template we received
$ss = new Sugar_Smarty();
// Create Smarty variables for the Calendar picker widget
global $timedate;
$time_format = $timedate->get_user_time_format();
$date_format = $timedate->get_cal_date_format();
$ss->assign('USER_DATEFORMAT', $timedate->get_user_date_format());
$ss->assign('TIME_FORMAT', $time_format);
$time_separator = ":";
$match = array();
//.........这里部分代码省略.........
示例9: addTeamList
/**
* Add Team selection popup window HTML code
* @param displayname Name to display in the popup window
* @param varname name of the variable
*/
function addTeamList($displayname, $field)
{
require_once 'include/SugarFields/SugarFieldHandler.php';
$sfh = new SugarFieldHandler();
$field['custom_type'] = 'Teamset';
$field['name'] = 'team_name';
$html = "<td width='15%' scope='row'>{$displayname}</td>";
$html .= "<td>" . $sfh->displaySmarty('fields', $field, 'MassUpdateView') . "</td>";
return $html;
}