本文整理汇总了PHP中unencodeMultienum函数的典型用法代码示例。如果您正苦于以下问题:PHP unencodeMultienum函数的具体用法?PHP unencodeMultienum怎么用?PHP unencodeMultienum使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了unencodeMultienum函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display()
{
$output = array();
$fields = unencodeMultienum($this->bean->report_vars);
foreach ($fields as $field) {
if (strpos($field, '.')) {
list($module_name, $field_name) = explode('.', $field, 2);
if (!isset($output[$module_name])) {
$output[$module_name] = array();
}
$output[$module_name][$field_name] = Reports_Utils::translateField($field, '', false);
} else {
$output[$field] = Reports_Utils::translateField($field, $this->bean->report_module);
}
$html = '<ul>';
//krsort($output);
foreach ($output as $key => $field) {
if (is_array($field)) {
$html .= "<li><b>{$key}</b></li><ul>";
foreach ($field as $rel_key => $rel_field) {
$html .= "<li>{$rel_field} <input type='text' size=25 value='[{$key}.{$rel_key}]'></li>";
}
$html .= '</ul>';
} else {
$html .= "<li>{$field} <input type='text' size=25 value='[{$key}]'></li>";
}
}
$html .= '</ul>';
}
$this->ss->assign('REPORT_VARS_TREE', $html);
$this->ss->assign('DOWNLOAD_TEMPLATE_LINK', $this->bean->getStoredFileName());
parent::display();
}
示例2: obtenerDatosBean
public static function obtenerDatosBean($plantilla_id, $registro)
{
$data = array();
$plantilla_bean = BeanFactory::getBean('opalo_plantillas', $plantilla_id);
$modulo = $plantilla_bean->pariente;
$relaciones = unencodeMultienum($plantilla_bean->relaciones);
///CARGA LOS VALORES DEL MODULO
if ($bean = BeanFactory::getBean($modulo, $registro)) {
foreach ($bean->field_name_map as $id => $garb) {
if (!is_array($bean->{$id}) && !is_object($bean->{$id})) {
$data[$id] = $bean->{$id};
}
}
//echo "<pre>", print_r($relaciones),"</pre>"; die();
foreach ($relaciones as $rel) {
if ($rel == '') {
continue;
}
$bean->load_relationship($rel);
$tmp = $bean->{$rel};
foreach ($tmp->getBeans() as $relBean) {
foreach ($relBean->field_name_map as $id => $garb) {
if (!is_array($relBean->{$id}) && !is_object($relBean->{$id})) {
$data[$rel . "::" . $id] = $relBean->{$id};
}
//$data[$id] = $bean->$id;
}
}
}
}
return $data;
}
示例3: smarty_function_multienum_to_array
/**
* Smarty modifier to convert multienum separated value to Array
*
* Type: function<br>
* Name: multienum_to_array<br>
* Purpose: Utility to transform multienum String to Array format
* @author Collin Lee <clee at sugarcrm dot com>
* @param string The multienum field's value(s) as a String
* @param default The multienum field's default value
* @return Array
*/
function smarty_function_multienum_to_array($params, &$smarty)
{
$ret = "";
if (empty($params['string'])) {
if (empty($params['default'])) {
$ret = array();
} else {
if (is_array($params['default'])) {
$ret = $params['default'];
} else {
$ret = unencodeMultienum($params['default']);
}
}
} else {
if (is_array($params['string'])) {
$ret = $params['string'];
} else {
$ret = unencodeMultienum($params['string']);
}
}
if (!empty($params['assign'])) {
$smarty->assign($params['assign'], $ret);
return "";
}
return $ret;
}
示例4: get_xtpl_detail
function get_xtpl_detail()
{
$name = $this->name;
$value = '';
if (isset($this->bean->{$name})) {
$value = $this->bean->{$name};
} else {
if (empty($this->bean->id)) {
$value = $this->default_value;
}
}
$returnXTPL = array();
if (empty($value)) {
return $returnXTPL;
}
global $app_list_strings;
$values = unencodeMultienum($value);
$translatedValues = array();
foreach ($values as $val) {
$translated = translate($this->options, '', $val);
if (is_string($translated)) {
$translatedValues[] = $translated;
}
}
$returnXTPL[strtoupper($this->name)] = implode(', ', $translatedValues);
return $returnXTPL;
}
示例5: 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;
}
$my_list_strings = enum_get_lists();
// should not display read only options
$excludedOptions = array('Elastic_boost_options');
foreach ($excludedOptions as $options) {
if (isset($my_list_strings[$options])) {
unset($my_list_strings[$options]);
}
}
$dropdowns = array_keys($my_list_strings);
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('modules/DynamicFields/templates/Fields/Forms/enum.tpl');
}
示例6: buildReport
/**
* @param string $record_id ID of Report
* @return Reports_Merge
*/
public function buildReport($record_id)
{
if (empty($this->id)) {
return;
}
global $beanList;
$focus = new Reports_Merge_Utils();
$filename = $this->getStoredFileName();
$officeDocx = $focus->getDocxObject();
$officeDocx->setTemplate($filename);
$seed = new $beanList[$this->report_module]();
$seed->retrieve($record_id);
$field_values = Reports_Utils::define_fields_value($seed, unencodeMultienum($this->report_vars));
unset($seed);
$officeDocx->assign($field_values);
$officeDocx->createDocument();
return $officeDocx;
}
示例7: display
function display()
{
global $app_list_strings;
$this->ev->process();
$modules = Reports_Utils::available_modules();
foreach ($modules as $key => &$val) {
if (isset($app_list_strings['moduleList'][$key])) {
$val = $app_list_strings['moduleList'][$key];
}
}
$this->ss->assign('AVAILABLE_MODULES', get_select_options_with_id($modules, $this->bean->report_module));
$options_fields = '';
$fields = unencodeMultienum($this->bean->report_vars);
foreach ($fields as $field) {
if (empty($field)) {
continue;
}
$options_fields .= '<option value="' . $field . '">' . Reports_Utils::translateField($field, $this->bean->report_module) . '</option>';
}
$this->ss->assign('REPORT_FIELDS', $options_fields);
echo $this->ev->display($this->showTitle);
}
示例8: mergeTemplate
/**
* Merge determined bean data into an determined text template, this could be
* an email template, expression template, or another type of text with
* bean variables in it.
*
* @global type $beanList
* @param type $bean
* @param type $template
* @param type $component_array
* @param type $evaluate
* @return type
*/
public function mergeTemplate($bean, $template, $component_array, $evaluate = false)
{
global $beanList;
$replace_array = array();
$replace_type_array = array();
foreach ($component_array as $module_name => $module_array) {
//base module
if ($module_name == $bean->module_dir) {
foreach ($module_array as $field => $field_array) {
if ($field_array['value_type'] == 'href_link') {
//Create href link to target record
$replacement_value = $this->get_href_link($bean);
}
if ($field_array['value_type'] == 'future') {
if ($evaluate) {
$replacement_value = bpminbox_check_special_fields($field_array['name'], $bean, false, array());
} else {
$replacement_value = bpminbox_check_special_fields($field_array['name'], $bean, false, array());
}
}
if ($field_array['value_type'] == 'past') {
$replacement_value = bpminbox_check_special_fields($field_array['name'], $bean, true, array());
}
$replace_type_array[$field_array['original']] = get_bean_field_type($field_array['name'], $bean);
$replace_array[$field_array['original']] = implode(', ', unencodeMultienum($replacement_value));
}
} else {
//Confirm this is an actual module in the beanlist
if (isset($beanList[$module_name]) || isset($bean->field_defs[$module_name])) {
///Build the relationship information using the Relationship handler
$rel_handler = $bean->call_relationship_handler("module_dir", true);
if (isset($bean->field_defs[$module_name])) {
$rel_handler->rel1_relationship_name = $bean->field_defs[$module_name]['relationship'];
$rel_module = get_rel_module_name($bean->module_dir, $rel_handler->rel1_relationship_name, $bean->db);
$rel_handler->rel1_module = $rel_module;
$rel_handler->rel1_bean = get_module_info($rel_module);
} else {
$rel_handler->process_by_rel_bean($module_name);
}
foreach ($bean->field_defs as $field => $attribute_array) {
if (!empty($attribute_array['relationship']) && $attribute_array['relationship'] == $rel_handler->rel1_relationship_name) {
$rel_handler->base_vardef_field = $field;
break;
}
}
//obtain the rel_module object
$rel_list = $rel_handler->build_related_list("base");
if (!empty($rel_list[0])) {
$rel_object = $rel_list[0];
$rel_module_present = true;
} else {
$rel_module_present = false;
}
foreach ($module_array as $field => $field_array) {
if ($rel_module_present == true) {
if ($field_array['value_type'] == 'href_link') {
//Create href link to target record
$replacement_value = $this->get_href_link($rel_object);
} else {
//use future always for rel because fetched should always be the same
$replacement_value = bpminbox_check_special_fields($field_array['name'], $rel_object, false, array());
}
} else {
$replacement_value = "Invalid Value";
}
$replace_array[$field_array['original']] = implode(', ', unencodeMultienum($replacement_value));
}
}
}
}
foreach ($replace_array as $name => $replacement_value) {
if ($evaluate) {
$replacement_value = str_replace("\n", ' ', $replacement_value);
$type = $replace_type_array[$name]['type'];
$dbtype = $replace_type_array[$name]['db_type'];
//TODO evaluate more types even Ids perhaps
$this->logger->info("Field : {$name} , type: '{$type}', DBtype: '{$dbtype}'");
if (($dbtype == 'double' || $dbtype == 'int') && $type != 'currency') {
$replacement_value = trim($replacement_value);
} elseif ($type == 'currency') {
//TODO hardcoded . , should use system currency format
$replacement_value = str_replace(",", '', $replacement_value);
$replacement_value = str_replace(".", ',', $replacement_value);
$replacement_value = floatval($replacement_value);
} else {
//here $replacement_value must be datatime, time, string datatype values
$replacement_value = "'" . $replacement_value . "'";
}
//.........这里部分代码省略.........
示例9: get_select_options_with_id
$lead1_options = get_select_options_with_id($app_list_strings[$field1_options], unencodeMultienum($lead->{$field1_name}));
} else {
$lead1_options = get_select_options_with_id($app_list_strings[$field1_options], '');
}
if ($field1_required) {
$Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>{$field1_label}</span sugar='slot'><span class='required' style='color: rgb(255, 0, 0);'>{$web_required_symbol}</span></td>";
} else {
$Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>{$field1_label}</span sugar='slot'></td>";
}
if (isset($lead->field_defs[$colsSecondField]['isMultiSelect']) && $lead->field_defs[$colsSecondField]['isMultiSelect'] == 1) {
$Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'><select id='{$field1_name}' name='{$field1_name}[]' multiple='true' tabindex='1'>{$lead1_options}</select></span sugar='slot'></td>";
} elseif (ifRadioButton($lead->field_defs[$colsSecondField]['name'])) {
$Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'>";
foreach ($app_list_strings[$field1_options] as $field_option_key => $field_option) {
if ($field_option != null) {
if (!empty($lead->{$field1_name}) && in_array($field_option_key, unencodeMultienum($lead->{$field1_name}))) {
$Web_To_Lead_Form_html .= "<input id='{$colsSecondField}" . "_{$field_option_key}' checked name='{$colsSecondField}' value='{$field_option_key}' type='radio'>";
} else {
$Web_To_Lead_Form_html .= "<input id='{$colsSecondField}" . "_{$field_option_key}' name='{$colsSecondField}' value='{$field_option_key}' type='radio'>";
}
$Web_To_Lead_Form_html .= "<span ='document.getElementById('" . $lead->field_defs[$colsSecondField] . "_{$field_option_key}').checked =true style='cursor:default'; onmousedown='return false;'>{$field_option}</span><br>";
}
}
$Web_To_Lead_Form_html .= "</span sugar='slot'></td>";
} else {
$Web_To_Lead_Form_html .= "<td width='35%' style='font-size: 12px; font-weight: normal;'><span sugar='slot'><select id={$field1_name} name={$field1_name} tabindex='1'>{$lead1_options}</select></span sugar='slot'></td>";
}
}
if ($field1_type == 'bool') {
if ($field1_required) {
$Web_To_Lead_Form_html .= "<td width='15%' style='text-align: left; font-size: 12px; font-weight: normal;'><span sugar='slot'>{$field1_label}</span sugar='slot'><span class='required' style='color: rgb(255, 0, 0);'>{$web_required_symbol}</span></td>";
示例10: get_flow_beans
/**
* Use the condition statements and processed table to build query to retrieve beans to be actioned
*/
function get_flow_beans()
{
global $beanList, $app_list_strings, $sugar_config;
if ($beanList[$this->flow_module]) {
$module = new $beanList[$this->flow_module]();
$where = '';
$sql = "SELECT id FROM aow_conditions WHERE aow_workflow_id = '" . $this->id . "' AND deleted = 0 ORDER BY condition_order ASC";
$result = $this->db->query($sql);
while ($row = $this->db->fetchByAssoc($result)) {
$condition = new AOW_Condition();
$condition->retrieve($row['id']);
if (isset($app_list_strings['aow_sql_operator_list'][$condition->operator])) {
$where_set = false;
if ($where != '') {
$where .= ' AND ';
}
$data = $module->field_defs[$condition->field];
if ($data['type'] == 'relate' && isset($data['id_name'])) {
$condition->field = $data['id_name'];
}
if (isset($data['source']) && $data['source'] == 'custom_fields') {
$field = $module->table_name . '_cstm.' . $condition->field;
} else {
$field = $module->table_name . '.' . $condition->field;
}
switch ($condition->value_type) {
case 'Field':
$data = $module->field_defs[$condition->value];
if ($data['type'] == 'relate' && isset($data['id_name'])) {
$condition->value = $data['id_name'];
}
if (isset($data['source']) && $data['source'] == 'custom_fields') {
$value = $module->table_name . '_cstm.' . $condition->value;
} else {
$value = $module->table_name . '.' . $condition->value;
}
break;
case 'Date':
$params = unserialize(base64_decode($condition->value));
if ($params[0] == 'now') {
if ($sugar_config['dbconfig']['db_type'] == 'mssql') {
$value = 'GetDate()';
} else {
$value = 'NOW()';
}
} else {
$data = $module->field_defs[$params[0]];
if (isset($data['source']) && $data['source'] == 'custom_fields') {
$value = $module->table_name . '_cstm.' . $params[0];
} else {
$value = $module->table_name . '.' . $params[0];
}
}
if ($params[1] != 'now') {
switch ($params[3]) {
case 'business_hours':
//business hours not implemented for query, default to hours
$params[3] = 'hours';
default:
if ($sugar_config['dbconfig']['db_type'] == 'mssql') {
$value = "DATEADD(" . $params[3] . ", " . $app_list_strings['aow_date_operator'][$params[1]] . " {$params['2']}, {$value})";
} else {
$value = "DATE_ADD({$value}, INTERVAL " . $app_list_strings['aow_date_operator'][$params[1]] . " {$params['2']} " . $params[3] . ")";
}
break;
}
}
break;
case 'Multi':
$sep = ' AND ';
if ($condition->operator == 'Equal_To') {
$sep = ' OR ';
}
$multi_values = unencodeMultienum($condition->value);
if (!empty($multi_values)) {
$value = '(';
foreach ($multi_values as $multi_value) {
if ($value != '(') {
$value .= $sep;
}
$value .= $field . ' ' . $app_list_strings['aow_sql_operator_list'][$condition->operator] . " '" . $multi_value . "'";
}
$value .= ')';
}
$where .= $value;
$where_set = true;
break;
case 'Value':
default:
$value = "'" . $condition->value . "'";
break;
}
if (!$where_set) {
$where .= $field . ' ' . $app_list_strings['aow_sql_operator_list'][$condition->operator] . ' ' . $value;
}
}
}
//.........这里部分代码省略.........
示例11: 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');
}
示例12: parse_template_bean
function parse_template_bean($string, $key, &$focus)
{
global $app_strings;
$repl_arr = array();
foreach ($focus->field_defs as $field_def) {
if ($field_def['type'] == 'currency') {
$repl_arr[$key . "_" . $field_def['name']] = currency_format_number($focus->{$field_def}['name'], $params = array('currency_symbol' => false));
} else {
if ($field_def['type'] == 'enum' && isset($field_def['options'])) {
$repl_arr[$key . "_" . $field_def['name']] = translate($field_def['options'], $focus->module_dir, $focus->{$field_def}['name']);
} else {
if ($field_def['type'] == 'multienum' && isset($field_def['options'])) {
$repl_arr[$key . "_" . $field_def['name']] = implode(', ', unencodeMultienum($focus->{$field_def}['name']));
} else {
$repl_arr[$key . "_" . $field_def['name']] = $focus->{$field_def}['name'];
}
}
}
}
// end foreach()
krsort($repl_arr);
reset($repl_arr);
foreach ($repl_arr as $name => $value) {
if (strpos($name, 'product_discount') > 0) {
if ($value != '' && $value != '0.00') {
if ($repl_arr['aos_products_quotes_discount'] == 'Percentage') {
$sep = get_number_seperators();
$value = rtrim(rtrim(format_number($value), '0'), $sep[1]);
//.$app_strings['LBL_PERCENTAGE_SYMBOL'];
} else {
$value = currency_format_number($value, $params = array('currency_symbol' => false));
}
} else {
$value = '';
}
}
if ($name === 'aos_products_product_image') {
$value = '<img src="' . $value . '"width="50" height="50"/>';
}
if ($name === 'aos_products_quotes_product_qty') {
$sep = get_number_seperators();
$value = rtrim(rtrim(format_number($value), '0'), $sep[1]);
}
if ($name === 'aos_products_quotes_vat' || strpos($name, 'pct') > 0 || strpos($name, 'percent') > 0 || strpos($name, 'percentage') > 0) {
$sep = get_number_seperators();
$value = rtrim(rtrim(format_number($value), '0'), $sep[1]) . $app_strings['LBL_PERCENTAGE_SYMBOL'];
}
if (strpos($name, 'date') > 0 || strpos($name, 'expiration') > 0) {
if ($value != '') {
$dt = explode(' ', $value);
$value = $dt[0];
}
}
if ($value != '' && is_string($value)) {
$string = str_replace("\${$name}", $value, $string);
} else {
if (strpos($name, 'address') > 0) {
$string = str_replace("\${$name}<br />", '', $string);
$string = str_replace("\${$name} <br />", '', $string);
$string = str_replace("\${$name}", '', $string);
} else {
$string = str_replace("\${$name}", ' ', $string);
}
}
}
return $string;
}
示例13: get_audit_list
/**
* @Deprecated
*/
public function get_audit_list()
{
global $focus, $genericAssocFieldsArray, $moduleAssocFieldsArray, $current_user, $timedate, $app_strings;
$audit_list = array();
if (!empty($_REQUEST['record'])) {
$result = $focus->retrieve($_REQUEST['record']);
if ($result == null || !$focus->ACLAccess('', $focus->isOwner($current_user->id))) {
sugar_die($app_strings['ERROR_NO_RECORD']);
}
}
if ($focus->is_AuditEnabled()) {
$order = ' order by ' . $focus->get_audit_table_name() . '.date_created desc';
//order by contacts_audit.date_created desc
$query = "SELECT " . $focus->get_audit_table_name() . ".*, users.user_name FROM " . $focus->get_audit_table_name() . ", users WHERE " . $focus->get_audit_table_name() . ".created_by = users.id AND " . $focus->get_audit_table_name() . ".parent_id = '{$focus->id}'" . $order;
$result = $focus->db->query($query);
// We have some data.
require 'metadata/audit_templateMetaData.php';
$fieldDefs = $dictionary['audit']['fields'];
while (($row = $focus->db->fetchByAssoc($result)) != null) {
if (!ACLField::hasAccess($row['field_name'], $focus->module_dir, $GLOBALS['current_user']->id, $focus->isOwner($GLOBALS['current_user']->id))) {
continue;
}
//If the team_set_id field has a log entry, we retrieve the list of teams to display
if ($row['field_name'] == 'team_set_id') {
$row['field_name'] = 'team_name';
require_once 'modules/Teams/TeamSetManager.php';
$row['before_value_string'] = TeamSetManager::getCommaDelimitedTeams($row['before_value_string']);
$row['after_value_string'] = TeamSetManager::getCommaDelimitedTeams($row['after_value_string']);
}
$temp_list = array();
foreach ($fieldDefs as $field) {
if (array_key_exists($field['name'], $row)) {
if (($field['name'] == 'before_value_string' || $field['name'] == 'after_value_string') && (array_key_exists($row['field_name'], $genericAssocFieldsArray) || !empty($moduleAssocFieldsArray[$focus->object_name]) && array_key_exists($row['field_name'], $moduleAssocFieldsArray[$focus->object_name]))) {
$temp_list[$field['name']] = Audit::getAssociatedFieldName($row['field_name'], $row[$field['name']]);
} else {
$temp_list[$field['name']] = $row[$field['name']];
}
if ($field['name'] == 'date_created') {
$date_created = '';
if (!empty($temp_list[$field['name']])) {
$date_created = $timedate->to_display_date_time($temp_list[$field['name']]);
$date_created = !empty($date_created) ? $date_created : $temp_list[$field['name']];
}
$temp_list[$field['name']] = $date_created;
}
if (($field['name'] == 'before_value_string' || $field['name'] == 'after_value_string') && ($row['data_type'] == "enum" || $row['data_type'] == "multienum")) {
global $app_list_strings;
$enum_keys = unencodeMultienum($temp_list[$field['name']]);
$enum_values = array();
foreach ($enum_keys as $enum_key) {
if (isset($focus->field_defs[$row['field_name']]['options'])) {
$domain = $focus->field_defs[$row['field_name']]['options'];
if (isset($app_list_strings[$domain][$enum_key])) {
$enum_values[] = $app_list_strings[$domain][$enum_key];
}
}
}
if (!empty($enum_values)) {
$temp_list[$field['name']] = implode(', ', $enum_values);
}
if ($temp_list['data_type'] === 'date') {
$temp_list[$field['name']] = $timedate->to_display_date($temp_list[$field['name']], false);
}
} elseif (($field['name'] == 'before_value_string' || $field['name'] == 'after_value_string') && $row['data_type'] == "datetimecombo") {
if (!empty($temp_list[$field['name']]) && $temp_list[$field['name']] != 'NULL') {
$temp_list[$field['name']] = $timedate->to_display_date_time($temp_list[$field['name']]);
} else {
$temp_list[$field['name']] = '';
}
} elseif ($field['name'] == 'field_name') {
global $mod_strings;
if (isset($focus->field_defs[$row['field_name']]['vname'])) {
$label = $focus->field_defs[$row['field_name']]['vname'];
$temp_list[$field['name']] = translate($label, $focus->module_dir);
}
}
}
}
$temp_list['created_by'] = $row['user_name'];
$audit_list[] = $temp_list;
}
}
return $audit_list;
}
示例14: decodeMultienumField
function decodeMultienumField($field)
{
return implode(', ', unencodeMultienum($field));
}
示例15: get_field_output
function get_field_output(&$temp_module, $selector_array, $meta_array, $actions = false)
{
global $current_language;
global $app_list_strings;
global $app_strings;
global $mod_strings;
$enum_multi = $meta_array['enum_multi'];
$temp_module_strings = return_module_language($current_language, $temp_module->module_dir);
$all_fields_array = $temp_module->getFieldDefinitions();
$target_field_array = $all_fields_array[$selector_array['field']];
if (!empty($target_field_array['vname'])) {
$target_vname = $target_field_array['vname'];
} else {
$target_vname = "";
}
$label_name = get_label($target_vname, $temp_module_strings);
$field_type = get_field_type($target_field_array);
$field_name = $target_field_array['name'];
//////Determine if this is called from an existing record or new and if it is enum multi
if ($selector_array['target_field'] == $field_name) {
if (($selector_array['operator'] == "in" || $selector_array['operator'] == "not_in") && $selector_array['target_field'] == $field_name || isset($target_field_array['isMultiSelect']) && $target_field_array['isMultiSelect'] == true) {
$selected_value = unencodeMultienum($selector_array['value']);
$selected_operator = $selector_array['operator'];
$selected_time = $selector_array['time'];
} else {
$selected_value = $selector_array['value'];
$selected_operator = $selector_array['operator'];
$selected_time = $selector_array['time'];
}
//Handle Advanced Actions Type
if ($actions == true) {
$selected_ext1 = $selector_array['ext1'];
$selected_ext2 = $selector_array['ext2'];
$selected_ext3 = $selector_array['ext3'];
}
} else {
$selected_value = "";
$selected_operator = "";
$selected_time = "";
//Handle Advanced Actions Type
if ($actions == true) {
$selected_ext1 = "";
$selected_ext2 = "";
$selected_ext3 = "";
}
}
///////////////////////////////////////////////////////////
//Get output array and return it
//////////////////////////////////////////////////////////
$output_array = array();
if ($actions == true) {
$output_array['ext1']['display'] = "";
$output_array['ext2']['display'] = "";
$output_array['ext3']['display'] = "";
}
if (!empty($field_type)) {
/*
One off check to see if this is duration_hours or duration_minutes
These two fields really should be enum, but they are chars. This is a problem,
since the UI for calls is really enum in 15 minute increments
*/
$sorted_fields = array();
if ($selector_array['target_field'] == "duration_minutes") {
$target_field_array['options'] = "duration_intervals";
$field_type = "enum";
//if the module is calls, then populate sorted_fields array with minute values
if (get_class($temp_module) == 'Call' && isset($temp_module->minutes_values)) {
$target_field_array['function'] = '';
$sorted_fields = $temp_module->minutes_values;
}
//end if target_field is duration_minutes or duration_hours
}
//Checking reminder time in meetings and calls
if ($selector_array['target_field'] == "reminder_time") {
$target_field_array['options'] = "reminder_time_options";
$field_type = "enum";
//end if target_field is reminder_time
}
// currency_id field should be enum
if ($field_type == 'currency_id') {
$target_field_array['function'] = 'getCurrencyDropDownList';
$field_type = "enum";
}
if ($field_type == "enum" || $field_type == "multienum" || $field_type == "radioenum") {
$output_array['real_type'] = $field_type;
//check for multi_select and that this is the same dropdown as previous;
//Set the value select
if (!empty($target_field_array['function'])) {
$function = $target_field_array['function'];
if (is_array($function) && isset($function['name'])) {
$function = $target_field_array['function']['name'];
} else {
$function = $target_field_array['function'];
}
if (!empty($target_field_array['function']['returns']) && $target_field_array['function']['returns'] == 'html') {
if (!empty($target_field_array['function']['include'])) {
require_once $target_field_array['function']['include'];
}
}
if (isset($target_field_array['function_bean'])) {
//.........这里部分代码省略.........