function get_xtpl_search() { $searchable = array(); $def = $this->bean->field_name_map[$this->name]; $searchable = array('team_id'); $returnXTPL = array(); if (!empty($def['id_name']) && in_array($def['id_name'], $searchable)) { $name = $def['id_name']; $team_list = ''; foreach (get_team_array() as $id => $team) { $selected = ''; if (!empty($_REQUEST[$name]) && is_array($_REQUEST[$name]) && in_array($id, $_REQUEST[$name])) { $selected = 'selected'; } $team_list .= "<option {$selected} value='{$id}'>{$team}</option>"; } $returnXTPL[strtoupper($name) . '_FILTER'] = $team_list; } else { $id = $this->name; $name = $this->name . '_name'; $module = $this->ext2; $popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'search_form', 'field_to_name_array' => array('id' => $this->name, $this->ext1 => $name)); $json = getJSONobj(); $encoded_popup_request_data = $json->encode($popup_request_data); $returnXTPL['ENCODED_' . strtoupper($id) . '_POPUP_REQUEST_DATA'] = $encoded_popup_request_data; $returnXTPL[strtoupper($id) . '_MODULE'] = $module; if (isset($_REQUEST[$name])) { $returnXTPL[strtoupper($name)] = $_REQUEST[$name]; } if (isset($_REQUEST[$id])) { $returnXTPL[strtoupper($id)] = $_REQUEST[$id]; } } return $returnXTPL; }
function xtplGetTeamSelection($xtpl, $focus) { global $app_strings; global $current_language; global $current_user; $mod_strings = return_module_language($current_language, "ZuckerReports"); $xtpl_teams = new XTemplate('modules/ZuckerReports/SimpleTeams.html'); $xtpl_teams->assign("MOD", $mod_strings); $xtpl_teams->assign("APP", $app_strings); $impl = SimpleTeams::getImplementationType(); if ($impl == "sugar") { $json = getJSONobj(); $team_array = get_team_array(); asort($team_array); if (empty($focus->id)) { $xtpl_teams->assign("TEAM_OPTIONS", get_select_options_with_id(get_team_array(), $current_user->default_team)); $xtpl_teams->assign("TEAM_NAME", $current_user->default_team_name); $xtpl_teams->assign("TEAM_ID", $current_user->default_team); } else { $xtpl_teams->assign("TEAM_OPTIONS", get_select_options_with_id(get_team_array(), $focus->team_id)); $xtpl_teams->assign("TEAM_NAME", $focus->team_name); $xtpl_teams->assign("TEAM_ID", $focus->team_id); } $popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'EditView', 'field_to_name_array' => array('id' => 'team_id', 'name' => 'team_name')); $xtpl_teams->assign('encoded_team_popup_request_data', $json->encode($popup_request_data)); $xtpl_teams->parse("sugarpro"); return $xtpl_teams->text("sugarpro"); } else { if ($impl == "simple") { $team_options = SimpleTeams::getTeamOptions(); asort($team_options); $xtpl_teams->assign("TEAM_OPTIONS", get_select_options_with_id($team_options, $focus->team_id)); $xtpl_teams->parse("simpleteams"); return $xtpl_teams->text("simpleteams"); } else { return ""; } } }
function template_calendar(&$args) { global $timedate; if (isset($args['size']) && ($args['size'] = 'small')) { $args['calendar']->show_activities = false; $args['calendar']->show_week_on_month_view = false; } $newargs = array(); $newargs['view'] = $args['view']; $newargs['calendar'] = $args['calendar']; if (!isset($args['size']) || $args['size'] != 'small') { template_cal_tabs($newargs); } if (isset($_REQUEST['view']) && $_REQUEST['view'] == 'shared') { global $ids; global $current_user; global $mod_strings; global $app_list_strings, $current_language, $currentModule, $action, $app_strings; $current_module_strings = return_module_language($current_language, 'Calendar'); $ids = array(); $user_ids = $current_user->getPreference('shared_ids'); //get list of user ids for which to display data if (!empty($user_ids) && count($user_ids) != 0 && !isset($_REQUEST['shared_ids'])) { $ids = $user_ids; } elseif (isset($_REQUEST['shared_ids']) && count($_REQUEST['shared_ids']) > 0) { $ids = $_REQUEST['shared_ids']; $current_user->setPreference('shared_ids', $_REQUEST['shared_ids']); } else { //$ids = get_user_array(false); //$ids = array_keys($ids); $ids = array($current_user->id); } //get team id for which to display user list $team = $current_user->getPreference('team_id'); if (!empty($team) && !isset($_REQUEST['team_id'])) { $team_id = $team; } elseif (isset($_REQUEST['team_id'])) { $team_id = $_REQUEST['team_id']; $current_user->setPreference('team_id', $_REQUEST['team_id']); } else { $team_id = ''; } if (empty($_SESSION['team_id'])) { $_SESSION['team_id'] = ""; } $tools = '<div align="right"><a href="index.php?module=' . $currentModule . '&action=' . $action . '&view=shared" class="tabFormAdvLink"> <a href="javascript: toggleDisplay(\'shared_cal_edit\');" class="tabFormAdvLink">' . SugarThemeRegistry::current()->getImage('edit', 'alt="' . $current_module_strings['LBL_EDIT'] . '" border="0" align="absmiddle"') . ' ' . $current_module_strings['LBL_EDIT'] . '</a></div>'; echo get_form_header($mod_strings['LBL_SHARED_CAL_TITLE'], $tools, false); if (empty($_SESSION['shared_ids'])) { $_SESSION['shared_ids'] = ""; } echo "\n\t\t\t<script language=\"javascript\">\n\t\t\tfunction up(name) {\n\t\t\t\tvar td = document.getElementById(name+'_td');\n\t\t\t\tvar obj = td.getElementsByTagName('select')[0];\n\t\t\t\tobj =(typeof obj == \"string\") ? document.getElementById(obj) : obj;\n\t\t\t\tif(obj.tagName.toLowerCase() != \"select\" && obj.length < 2)\n\t\t\t\t\treturn false;\n\t\t\t\tvar sel = new Array();\n\t\t\t\n\t\t\t\tfor(i=0; i<obj.length; i++) {\n\t\t\t\t\tif(obj[i].selected == true) {\n\t\t\t\t\t\tsel[sel.length] = i;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor(i in sel) {\n\t\t\t\t\tif(sel[i] != 0 && !obj[sel[i]-1].selected) {\n\t\t\t\t\t\tvar tmp = new Array(obj[sel[i]-1].text, obj[sel[i]-1].value);\n\t\t\t\t\t\tobj[sel[i]-1].text = obj[sel[i]].text;\n\t\t\t\t\t\tobj[sel[i]-1].value = obj[sel[i]].value;\n\t\t\t\t\t\tobj[sel[i]].text = tmp[0];\n\t\t\t\t\t\tobj[sel[i]].value = tmp[1];\n\t\t\t\t\t\tobj[sel[i]-1].selected = true;\n\t\t\t\t\t\tobj[sel[i]].selected = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tfunction down(name) {\n\t\t\t\tvar td = document.getElementById(name+'_td');\n\t\t\t\tvar obj = td.getElementsByTagName('select')[0];\n\t\t\t\tif(obj.tagName.toLowerCase() != \"select\" && obj.length < 2)\n\t\t\t\t\treturn false;\n\t\t\t\tvar sel = new Array();\n\t\t\t\tfor(i=obj.length-1; i>-1; i--) {\n\t\t\t\t\tif(obj[i].selected == true) {\n\t\t\t\t\t\tsel[sel.length] = i;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor(i in sel) {\n\t\t\t\t\tif(sel[i] != obj.length-1 && !obj[sel[i]+1].selected) {\n\t\t\t\t\t\tvar tmp = new Array(obj[sel[i]+1].text, obj[sel[i]+1].value);\n\t\t\t\t\t\tobj[sel[i]+1].text = obj[sel[i]].text;\n\t\t\t\t\t\tobj[sel[i]+1].value = obj[sel[i]].value;\n\t\t\t\t\t\tobj[sel[i]].text = tmp[0];\n\t\t\t\t\t\tobj[sel[i]].value = tmp[1];\n\t\t\t\t\t\tobj[sel[i]+1].selected = true;\n\t\t\t\t\t\tobj[sel[i]].selected = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t</script>\n\t\t\t\n\t\t\t<div id='shared_cal_edit' style='display: none;'>\n\t\t\t<form name='shared_cal' action=\"index.php\" method=\"post\" >\n\t\t\t<input type=\"hidden\" name=\"module\" value=\"" . $currentModule . "\">\n\t\t\t<input type=\"hidden\" name=\"action\" value=\"" . $action . "\">\n\t\t\t<input type=\"hidden\" name=\"view\" value=\"shared\">\n\t\t\t<input type=\"hidden\" name=\"edit\" value=\"0\">\n\t\t\t<table cellpadding=\"0\" cellspacing=\"3\" border=\"0\" align=\"center\">\n\t\t\t<tr><th valign=\"top\" align=\"center\" colspan=\"2\">\n\t\t\t"; echo $current_module_strings['LBL_SELECT_USERS']; echo "\n\t\t\t</th>\n\t\t\t</tr>\n\t\t\t<tr><td valign=\"top\">"; echo "\n\t\t\t<table cellpadding=\"1\" cellspacing=\"1\" border=\"0\" class=\"edit view\" align=\"center\">\n\n\t\t\t<tr>\n\t\t\t\t<td valign='top' nowrap><b>" . $current_module_strings['LBL_FILTER_BY_TEAM'] . "</b></td>\n\t\t\t\t<td valign='top' id=\"teams\"><select id=\"team_id\" onchange='this.form.edit.value=1; this.form.submit();' name=\"team_id\">"; $teams = get_team_array(false); array_unshift($teams, ''); echo get_select_options_with_id($teams, $team_id); echo "</select></td>\n\t\t\t</tr>\n\t\t\t</table>"; echo "\n </td><td valign=\"top\">\n\n\t\t\t<table cellpadding=\"1\" cellspacing=\"1\" border=\"0\" class=\"edit view\" align=\"center\">\n\t\t\t<tr>\n\t\t\t\t<td valign='top' nowrap><b>" . $current_module_strings['LBL_USERS'] . "</b></td>\n\t\t\t\t<td valign='top' id=\"shared_ids_td\"><select id=\"shared_ids\" name=\"shared_ids[]\" multiple size='3'>"; if (!empty($team_id)) { $team = new Team(); $team->retrieve($team_id); $users = $team->get_team_members(); $user_ids = array(); foreach ($users as $user) { $user_ids[$user->id] = $user->user_name; } echo get_select_options_with_id($user_ids, $ids); } else { echo get_select_options_with_id(get_user_array(false), $ids); } echo "\t</select></td>\n\t\t\t\t<td><a onclick=\"up('shared_ids');\">" . SugarThemeRegistry::current()->getImage('uparrow_big', 'border="0" style="margin-bottom: 1px;" alt="' . $app_strings['LBL_SORT'] . '"') . "</a><br>\n\t\t\t\t<a onclick=\"down('shared_ids');\">" . SugarThemeRegistry::current()->getImage('downarrow_big', 'border="0" style="margin-top: 1px;" alt="' . $app_strings['LBL_SORT'] . '"') . "</a></td>\n\t\t\t</tr>\n\t\t\t<tr>"; echo "<td align=\"right\" colspan=\"2\"><input class=\"button\" type=\"submit\" title=\"" . $app_strings['LBL_SELECT_BUTTON_TITLE'] . "\" accessKey=\"" . $app_strings['LBL_SELECT_BUTTON_KEY'] . "\" value=\"" . $app_strings['LBL_SELECT_BUTTON_LABEL'] . "\" /><input class=\"button\" onClick=\"javascript: toggleDisplay('shared_cal_edit');\" type=\"button\" title=\"" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "\" accessKey=\"" . $app_strings['LBL_CANCEL_BUTTON_KEY'] . "\" value=\"" . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . "\"/></td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t</td></tr>\n\t\t\t</table>\n\t\t\t</form>"; } // end "shared" view echo "</div></p>\n\t\t<script language=\"javascript\">"; if (isset($_REQUEST['edit']) && $_REQUEST['edit']) { echo "toggleDisplay('shared_cal_edit');"; } if (isset($_REQUEST['view']) && !empty($_REQUEST['month'])) { if ($_REQUEST['view'] == 'day') { if (ACLController::checkAccess('Calls', 'edit', true)) { echo "\n\t\t\t\tdocument.CallSave.date_start.value = \"" . $timedate->to_display_date($args['calendar']->date_time->get_mysql_date(), false) . "\"\n\t\t\t\tdocument.CallSave.time_start.value = \"" . $timedate->to_display_time($args['calendar']->date_time->get_mysql_time() . ':00', false) . "\""; } } } echo "\n\t\tfunction set_dates(date,time)\n\t\t{\n\t\tdocument.CallSave.date_start.value = date;\n\t\tdocument.CallSave.time_start.value = time;\n\t\t\n\t\t}\n\t\t</script>\n\t\t<table id=\"daily_cal_table_outside\" width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"monthBox\">\n\t\t<tr>\n\t\t<td>\n\t\t <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"monthHeader\">\n\t\t <tr>\n\t\t <td width=\"1%\" nowrap>"; if (!isset($args['size']) || $args['size'] != 'small') { template_get_previous_calendar($args); } echo "\n\t\t </td>\n\t\t <td width=\" 98 % \" align=center scope='row'>"; if (isset($args['size']) && ($args['size'] = 'small')) { ?> <a style="text-decoration: none;" href="index.php?module=ECalendar&action=index&view=month&<?php echo $args['calendar']->date_time->get_date_str(); ?> "> <?php } ?> <h3> <?php template_echo_date_info($args['view'], $args['calendar']->date_time); ?> </h3> <?php if (isset($args['size']) && ($args['size'] = 'small')) { echo "</a>"; } ?> </td> <td align="right" width="1%" nowrap><?php if (!isset($args['size']) || $args['size'] != 'small') { template_get_next_calendar($args); } ?> </td> </tr> </table> </td> </tr> <tr> <td class="monthCalBody"> <?php if ($args['calendar']->view == 'month') { template_calendar_month($args); } else { if ($args['calendar']->view == 'year') { template_calendar_year($args); } else { if ($args['calendar']->view == 'shared') { global $current_user, $shared_user; $shared_args = array(); foreach ($args as $key => $val) { $shared_args[$key] = $val; } $shared_args['calendar'] = $args['calendar']; $shared_user = new User(); foreach ($ids as $member) { $shared_user->retrieve($member); $shared_args['calendar']->show_tasks = true; $shared_args['calendar']->add_activities($shared_user); $shared_args['show_link'] = 'off'; if ($shared_user->id == $current_user->id) { $shared_args['show_link'] = 'on'; } echo '<h5 class="calSharedUser">' . $shared_user->full_name . '</h5>'; template_calendar_horizontal($shared_args); } } else { template_calendar_vertical($args); } } } ?> </td> </tr> <tr> <td> <table width="100%" cellspacing="0" cellpadding="0" class="monthFooter"> <tr> <td width="50%"><?php template_get_previous_calendar($args); ?> </td> <td align="right" width="50%"><?php template_get_next_calendar($args); ?> </td> </tr> </table> </td> </tr> </table> <?php }
$xtpl->assign("RETURN_ID", $_REQUEST['return_id']); } $xtpl->assign("PRINT_URL", "index.php?" . $GLOBALS['request_string']); $xtpl->assign("JAVASCRIPT", get_set_focus_js()); $xtpl->assign("ID", $focus->id); $xtpl->assign('NAME', $focus->name); $xtpl->assign('DESCRIPTION', $focus->description); $xtpl->assign('CUSTOM_QUERY', $focus->custom_query); if ($focus->query_locked == 'on' or $focus->query_locked == '1') { $xtpl->assign("QUERY_LOCKED", "checked"); $xtpl->assign("QUERY_DISABLED", "disabled"); } if (empty($focus->id) && !isset($_REQUEST['isDuplicate'])) { $xtpl->assign("TEAM_OPTIONS", get_select_options_with_id(get_team_array(), $current_user->default_team)); } else { $xtpl->assign("TEAM_OPTIONS", get_select_options_with_id(get_team_array(), $focus->team_id)); } // adding custom fields: require_once 'modules/DynamicFields/templates/Files/EditView.php'; require_once 'include/SugarFields/Fields/Teamset/SugarFieldTeamset.php'; $teamSetField = new SugarFieldTeamset('Teamset'); $teamSetField->initClassicView($focus->field_defs); $code = $teamSetField->getClassicView($focus->field_defs, 'EditView'); $xtpl->assign("TEAM_SET_FIELD", $code); $xtpl->parse("main"); $xtpl->out("main"); $javascript = new javascript(); $javascript->setFormName('EditView'); $javascript->setSugarBean($focus); $javascript->addAllFields(''); echo $javascript->getScript();
function get_selector_array($type, $value, $dom_name, $text_only_array = false, $meta_filter_name = "", $only_related_modules = false, $trigger_type = "", $only_plural = false) { global $app_list_strings; global $current_language; if ($type == 'assigned_user_id' || $type == 'assigned_user_name') { $select_array = get_user_array(TRUE, "Active", "", true, null, ' AND is_group=0 '); } if ($type == 'team_list') { $select_array = get_team_array(); } if ($type == 'role') { $select_array = get_bean_select_array(true, 'ACLRole', 'name'); } if ($type == 'dom_array') { if (!empty($app_list_strings[$dom_name])) { $select_array = $app_list_strings[$dom_name]; } ksort($select_array); } if ($type == 'field') { $temp_module = BeanFactory::getBean($dom_name); if (!is_object($temp_module)) { //var_dump($dom_name); //display_stack_trace(true); $GLOBALS['log']->fatal("get_selector_array: Unknown module: {$dom_name}"); return null; } if (isset($trigger_type) && !empty($trigger_type)) { global $process_dictionary; include_once 'modules/WorkFlowTriggerShells/MetaArray.php'; if (array_key_exists("trigger_type_override", $process_dictionary['TriggersCreateStep1']['elements'][$trigger_type])) { //we have found an override $meta_filter_name = $process_dictionary['TriggersCreateStep1']['elements'][$trigger_type]['trigger_type_override']; } } $temp_module->call_vardef_handler($meta_filter_name); if ($_GET['opener_id'] == 'rel_module') { $temp_select_array = $temp_module->vardef_handler->get_vardef_array(false, false, true, false, true); $select_array = getDuplicateRelationListWithTitle($temp_select_array, $temp_module->vardef_handler->module_object->field_defs, $temp_module->vardef_handler->module_object->module_dir); } else { $select_array = $temp_module->vardef_handler->get_vardef_array(true, false, false, false, true); $select_array = array_unique($select_array); asort($select_array); } //end if type is field } if ($type == 'module_list') { if ($only_related_modules) { global $beanList; $temp_module = BeanFactory::getBean($dom_name); $temp_module->call_vardef_handler("rel_filter"); $select_array = $temp_module->vardef_handler->get_vardef_array(true, true, true, true); } else { if ($meta_filter_name == "singular") { $select_array = convert_module_to_singular(get_module_map(false)); } else { $select_array = get_module_map(); } } unset($select_array["Forecasts"]); unset($select_array["Products"]); unset($select_array["Documents"]); asort($select_array); //end if type is module_list } if (!empty($select_array)) { if ($text_only_array == true) { return $select_array; } else { return get_select_options_with_id($select_array, $value); } } else { return null; } //end get_selector_array }
function get_assigned_team_name($assigned_team_id) { if (!empty($GLOBALS['sugar_config']['disable_user_cache'])) { return Team::getTeamName($assigned_team_id); } static $team_list = null; if (empty($team_list)) { $team_list = get_team_array(false, ""); } if (isset($team_list[$assigned_team_id])) { return $team_list[$assigned_team_id]; } return ""; }
function displayInput(&$layout_def) { $selected_teams = empty($layout_def['input_name0']) ? '' : $layout_def['input_name0']; $str = '<select multiple="true" size="3" name="' . $layout_def['name'] . '[]">' . get_select_options_with_id(get_team_array(false), $selected_teams) . '</select>'; return $str; }
$displayColumns[$col] = $p; } } } if (!isset($displayColumns['LAST_RUN_DATE'])) { $displayColumns['LAST_RUN_DATE'] = $listViewDefs['Reports']['LAST_RUN_DATE']; } // if $lv->export = false; $lv->displayColumns = $displayColumns; //if(empty($_REQUEST['favorite'])) { // display search form for non-favorite views if (!isset($_REQUEST['search_form']) || $_REQUEST['search_form'] != 'false') { $searchForm->setup(); if (isset($_REQUEST['searchFormTab']) && $_REQUEST['searchFormTab'] == 'advanced_search') { $searchForm->xtpl->assign('MODULES', get_select_options_with_id($reportModules, empty($_REQUEST['report_module']) ? isset($saved_search->contents['report_module']) && $saved_search->contents['report_module'] != '_none' ? $saved_search->contents['report_module'] : '' : $_REQUEST['report_module'])); $searchForm->xtpl->assign('TEAM_FILTER', get_select_options_with_id(get_team_array(FALSE), empty($_REQUEST['team_id']) ? isset($saved_search->contents['team_id']) && $saved_search->contents['team_id'] != '_none' ? $saved_search->contents['team_id'] : '' : $_REQUEST['team_id'])); $searchForm->xtpl->assign('USER_FILTER', get_select_options_with_id(get_user_array(FALSE), empty($_REQUEST['assigned_user_id']) ? isset($saved_search->contents['assigned_user_id']) && $saved_search->contents['assigned_user_id'] != '_none' ? $saved_search->contents['assigned_user_id'] : '' : $_REQUEST['assigned_user_id'])); $searchForm->xtpl->assign('REPORT_TYPES', get_select_options_with_id($app_list_strings['dom_report_types'], empty($_REQUEST['report_type']) ? isset($saved_search->contents['report_type']) && $saved_search->contents['report_type'] != '_none' ? $saved_search->contents['report_type'] : '' : $_REQUEST['report_type'])); $searchForm->xtpl->assign('FAVORITE', isset($_REQUEST['favorite']) ? 'checked' : ''); $searchForm->displayAdvanced(true, false, $listViewDefsNewArray, $lv); echo "<script>if(typeof(loadSSL_Scripts)=='function'){\n\t\tloadSSL_Scripts();\n\t}</script>"; } else { $searchForm->xtpl->assign('MODULES', get_select_options_with_id($reportModules, empty($_REQUEST['report_module_basic']) ? isset($saved_search->contents['report_module_basic']) && $saved_search->contents['report_module_basic'] != '_none' ? $saved_search->contents['report_module_basic'] : '' : $_REQUEST['report_module_basic'])); $searchForm->xtpl->assign('USER_FILTER', get_select_options_with_id(get_user_array(FALSE), empty($_REQUEST['assigned_user_id_basic']) ? isset($saved_search->contents['assigned_user_id_basic']) && $saved_search->contents['assigned_user_id_basic'] != '_none' ? $saved_search->contents['assigned_user_id_basic'] : '' : $_REQUEST['assigned_user_id_basic'])); $searchForm->xtpl->assign('REPORT_TYPES', get_select_options_with_id($app_list_strings['dom_report_types'], empty($_REQUEST['report_type_basic']) ? isset($saved_search->contents['report_type_basic']) && $saved_search->contents['report_type_basic'] != '_none' ? $saved_search->contents['report_type_basic'] : '' : $_REQUEST['report_type_basic'])); $searchForm->xtpl->assign('FAVORITE', isset($_REQUEST['favorite']) ? 'checked' : ''); $searchForm->displayBasic(); } } //} $params = array('massupdate' => true, 'handleMassupdate' => false);
/** * display html used in shared view */ public function display_shared_html() { global $app_strings, $cal_strings, $action; $ss = new Sugar_Smarty(); $ss->assign("APP", $app_strings); $ss->assign("MOD", $cal_strings); $ss->assign("UP", SugarThemeRegistry::current()->getImage('uparrow_big', 'border="0" style="margin-bottom: 1px;"', null, null, '.gif', $app_strings['LBL_SORT'])); $ss->assign("DOWN", SugarThemeRegistry::current()->getImage('downarrow_big', 'border="0" style="margin-top: 1px;"', null, null, '.gif', $app_strings['LBL_SORT'])); if (!empty($_REQUEST['edit_shared'])) { $ss->assign("edit_shared", true); } $teams = get_team_array(false); array_unshift($teams, ''); $ss->assign("teams_options", get_select_options_with_id($teams, $this->cal->shared_team_id)); if (!empty($this->cal->shared_team_id)) { $team = BeanFactory::getBean('Teams', $this->cal->shared_team_id); $users = $team->get_team_members(true); $user_ids = array(); $use_real_names = $GLOBALS['current_user']->getPreference('use_real_names'); $showLastNameFirst = $GLOBALS['current_user']->showLastNameFirst(); foreach ($users as $user) { if ($use_real_names) { if ($showLastNameFirst) { $user_ids[$user->id] = trim($user->last_name . ' ' . $user->first_name); } else { $user_ids[$user->id] = trim($user->first_name . ' ' . $user->last_name); } } else { $user_ids[$user->id] = $user->user_name; } } $ss->assign("users_options", get_select_options_with_id($user_ids, $this->cal->shared_ids)); } else { $ss->assign("users_options", get_select_options_with_id(get_user_array(false), $this->cal->shared_ids)); } $tpl = "modules/Calendar/tpls/shared_users.tpl"; echo $ss->fetch($tpl); }
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'])) { $funcBean = BeanFactory::getBean($target_field_array['function_bean']); if (method_exists($funcBean, $function)) { $function = array($funcBean, $function); } } $sorted_fields = call_user_func($function); } else { //get list of strings if sorted fields has not already been populated if (count($sorted_fields) == 0) { $sorted_fields = $app_list_strings[$target_field_array['options']]; } } if (isset($sorted_fields)) { asort($sorted_fields); } $column_select = get_select_options_with_id($sorted_fields, $selected_value); //if(!empty($target_field_array['isMultiSelect']) && $target_field_array['isMultiSelect'] == true){ // $selected_operator = "in"; // $enum_multi = true; //} $isMultiSelect = false; $value_select = "<select id='" . $meta_array['parent_type'] . "__field_value' name='" . $meta_array['parent_type'] . "_field_value' tabindex='2'>" . $column_select . "</select>"; if ($enum_multi === true) { $value_select .= " <select id='" . $meta_array['parent_type'] . "__field_value_multi' tabindex='1' name='" . $meta_array['parent_type'] . "__field_value_multi[]' multiple size='5'>" . $column_select . "</select>"; } else { if (!empty($target_field_array['isMultiSelect']) && $target_field_array['isMultiSelect'] == true) { //$value_select = "<select id='".$meta_array['parent_type']."__field_value' name='".$meta_array['parent_type']."_field_value[]' tabindex='2' multiple size='5'>".$column_select."</select>"; $value_select = " <select id='" . $meta_array['parent_type'] . "__field_value_multi' tabindex='1' name='" . $meta_array['parent_type'] . "__field_value_multi[]' multiple size='5'>" . $column_select . "</select>"; $isMultiSelect = true; } } $output_array['value_select']['display'] = $value_select; //Set the Operator variables if ($enum_multi === true) { $operator_select_javascript = "onchange=\"toggleFieldDisplay('" . $meta_array['parent_type'] . "__operator', '" . $meta_array['parent_type'] . "__field_value', '" . $meta_array['parent_type'] . "__field_value_multi', 'Equals');\""; $javascript_start = "toggleFieldDisplay('" . $meta_array['parent_type'] . "__operator', '" . $meta_array['parent_type'] . "__field_value', '" . $meta_array['parent_type'] . "__field_value_multi', 'Equals'); \n"; } else { $operator_select_javascript = ""; $javascript_start = ""; } if ($enum_multi === true) { $operator = get_select_options_with_id($app_list_strings['mselect_type_dom'], $selected_operator); } else { if ($isMultiSelect) { $operator = get_select_options_with_id($app_list_strings['mselect_multi_type_dom'], $selected_operator); } else { $operator = get_select_options_with_id($app_list_strings['cselect_type_dom'], $selected_operator); } } $output_array['operator']['display'] = $operator; $output_array['operator']['jscript'] = $operator_select_javascript; $output_array['operator']['jscriptstart'] = $javascript_start; $time_select = get_select_options_with_id($app_list_strings['tselect_type_dom'], $selected_time); $output_array['time_select']['display'] = $mod_strings['LBL_TIME_INT'] . " <select id='time_int' name='time_int' tabindex='2'>" . $time_select . "</select>"; if ($actions == true) { $ext1_select = get_select_options_with_id($app_list_strings['wflow_adv_enum_type_dom'], $selected_ext1); $ext1_select = "<select id='" . $meta_array['parent_type'] . "__ext1' id='" . $meta_array['parent_type'] . "__ext1' tabindex='2'>" . $ext1_select . "</select>"; $output_array['adv_value']['display'] = $ext1_select; $value_select = " <input id='" . $meta_array['parent_type'] . "__adv_value' name='" . $meta_array['parent_type'] . "__adv_value' tabindex='1' size='2' maxlength='2' type='text' value='" . $selected_value . "'> step(s)"; $adv_select = $value_select; $output_array['adv_value']['display'] .= $adv_select; $output_array['adv_type']['display'] = "enum_step"; //exception handler for some advanced options not valid if this is a new record if (!empty($meta_array['action_type'])) { if ($meta_array['action_type'] == "new" || $meta_array['action_type'] == "new_rel") { $output_array['set_type']['disabled'] = "Disabled"; } } } //end type enum } if ($field_type == "char" || $field_type == "varchar" || $field_type == "encrypt" || $field_type == "name" || $field_type == "phone" || $field_type == "email" || $field_type == "url") { $output_array['real_type'] = $field_type; if (!empty($target_field_array['len'])) { $max_length = $target_field_array['len']; } else { $max_length = "50"; } $value_select = "<input id='" . $meta_array['parent_type'] . "__field_value' name='" . $meta_array['parent_type'] . "__field_value' tabindex='1' size='25' maxlength='" . $max_length . "' type='text' value='" . $selected_value . "'>"; $output_array['value_select']['display'] = $value_select; $operator = get_select_options_with_id($app_list_strings['cselect_type_dom'], $selected_operator); $output_array['operator']['display'] = $operator; $time_select = get_select_options_with_id($app_list_strings['tselect_type_dom'], $selected_time); $output_array['time_select']['display'] = $mod_strings['LBL_TIME_INT'] . " <select id='time_int' name='time_int' tabindex='2'>" . $time_select . "</select>"; $output_array['operator']['jscript'] = ""; $output_array['operator']['jscriptstart'] = ""; $output_array['set_type']['disabled'] = "Disabled"; if ($actions == true) { $output_array['adv_type']['display'] = ""; $output_array['adv_value']['display'] = ""; } //end if type char, varchar, or float } if ($field_type == "text") { $output_array['real_type'] = $field_type; $value_select = "<textarea id='" . $meta_array['parent_type'] . "__field_value' name='" . $meta_array['parent_type'] . "__field_value' tabindex='1' cols=\"40\" rows=\"3\">" . $selected_value . "</textarea>"; //$value_select = "<input id='".$meta_array['parent_type']."__field_value' name='".$meta_array['parent_type']."__field_value' tabindex='1' size='25' maxlength='".$max_length."' type='text' value='".$selected_value."'>"; $output_array['value_select']['display'] = $value_select; $operator = get_select_options_with_id($app_list_strings['cselect_type_dom'], $selected_operator); $output_array['operator']['display'] = $operator; $time_select = get_select_options_with_id($app_list_strings['tselect_type_dom'], $selected_time); $output_array['time_select']['display'] = $mod_strings['LBL_TIME_INT'] . " <select id='time_int' name='time_int' tabindex='2'>" . $time_select . "</select>"; $output_array['operator']['jscript'] = ""; $output_array['operator']['jscriptstart'] = ""; $output_array['set_type']['disabled'] = "Disabled"; if ($actions == true) { $output_array['adv_type']['display'] = ""; $output_array['adv_value']['display'] = ""; } //end field_type == text } if ($field_type == "datetimecombo" || $field_type == "datetime" || $field_type == "date" || $field_type == "time") { //coming here via actions or triggers? if ($actions == true) { $column_select = get_select_options_with_id($app_list_strings['tselect_type_dom'], $selected_value); $value_select = "<select id='" . $meta_array['parent_type'] . "__field_value' name='" . $meta_array['parent_type'] . "_field_value' tabindex='2'>" . $column_select . "</select>"; //current date or existing //check if this is action new or new_rel and if so, remove the Existing Value optino //since it is not applicable $temp_dom = $app_list_strings['wflow_action_datetime_type_dom']; if ($meta_array['action_type'] == "new" || $meta_array['action_type'] == "new_rel") { unset($temp_dom['Existing Value']); } $ext1_select = get_select_options_with_id($temp_dom, $selected_ext1); $ext1_select = " from <select id='" . $meta_array['parent_type'] . "__ext1' id='" . $meta_array['parent_type'] . "__ext1' tabindex='2'>" . $ext1_select . "</select>"; $value_select .= $ext1_select; $output_array['value_select']['display'] = $value_select; $output_array['set_type']['disabled'] = "Disabled"; $output_array['adv_type']['display'] = "datetime"; $output_array['adv_value']['display'] = ""; $output_array['real_type'] = $field_type; } else { $operator = get_select_options_with_id($app_list_strings['dtselect_type_dom'], $selected_operator); $output_array['operator']['display'] = $operator; $operator_select_javascript = "onchange=\"toggleFieldDisplay('" . $meta_array['parent_type'] . "__operator', '" . $meta_array['parent_type'] . "__time_past', '" . $meta_array['parent_type'] . "__time_future', 'More Than');\""; $javascript_start = "toggleFieldDisplay('" . $meta_array['parent_type'] . "__operator', '" . $meta_array['parent_type'] . "__time_past', '" . $meta_array['parent_type'] . "__time_future', 'More Than'); \n"; $time_select = get_select_options_with_id($app_list_strings['tselect_type_dom'], $selected_time); $output_array['time_select']['display'] = "<select id='time_int' name='time_int' tabindex='2'>" . $time_select . "</select> "; $output_array['time_select']['display'] .= "<span id='" . $meta_array['parent_type'] . "__time_past'>" . $mod_strings['LBL_TIME_PAST'] . "</span>"; $output_array['time_select']['display'] .= "<span id='" . $meta_array['parent_type'] . "__time_future'>" . $mod_strings['LBL_TIME_FUTURE'] . "</span>"; $output_array['operator']['jscript'] = $operator_select_javascript; $output_array['operator']['jscriptstart'] = $javascript_start; $output_array['set_type']['disabled'] = "Disabled"; $output_array['value_select']['display'] = ""; $output_array['real_type'] = $field_type; } //end if type datetime } if ($field_type == "assigned_user_name" || $field_name == 'assigned_user_id') { //Real type is just a surface variable used by javascript to determine dual type actions //in the javascript $output_array['real_type'] = "enum"; //check for multi_select and that this is the same dropdown as previous; //Set the value select $user_array = get_user_array(TRUE, "Active", "", true, null, ' AND is_group=0 '); //$column_select = get_select_options_with_id($app_list_strings[$target_field_array['options']], $selected_value); $column_select = get_select_options_with_id($user_array, $selected_value); $value_select = "<select id='" . $meta_array['parent_type'] . "__field_value' name='" . $meta_array['parent_type'] . "_field_value' tabindex='2'>" . $column_select . "</select>"; if ($enum_multi === true) { $value_select .= " <select id='" . $meta_array['parent_type'] . "__field_value_multi' tabindex='1' name='" . $meta_array['parent_type'] . "__field_value_multi[]' multiple size='5'>" . $column_select . "</select>"; } $output_array['value_select']['display'] = $value_select; //Set the Operator variables if ($enum_multi === true) { $operator_select_javascript = "onchange=\"toggleFieldDisplay('" . $meta_array['parent_type'] . "__operator', '" . $meta_array['parent_type'] . "__field_value', '" . $meta_array['parent_type'] . "__field_value_multi', 'Equals');\""; $javascript_start = "toggleFieldDisplay('" . $meta_array['parent_type'] . "__operator', '" . $meta_array['parent_type'] . "__field_value', '" . $meta_array['parent_type'] . "__field_value_multi', 'Equals'); \n"; } else { $operator_select_javascript = ""; $javascript_start = ""; } if ($enum_multi === true) { $operator = get_select_options_with_id($app_list_strings['mselect_type_dom'], $selected_operator); } else { $operator = get_select_options_with_id($app_list_strings['cselect_type_dom'], $selected_operator); } $output_array['operator']['display'] = $operator; $output_array['operator']['jscript'] = $operator_select_javascript; $output_array['operator']['jscriptstart'] = $javascript_start; $time_select = get_select_options_with_id($app_list_strings['tselect_type_dom'], $selected_time); $output_array['time_select']['display'] = $mod_strings['LBL_TIME_INT'] . " <select id='time_int' name='time_int' tabindex='2'>" . $time_select . "</select>"; ///If we are coming here for actions if ($actions == true) { ////This below is an exception handler flow statement //if this is time based, then don't include the logged in user, since it doesn't really apply if (!empty($meta_array['workflow_type']) && $meta_array['workflow_type'] == "Time") { $adv_user_array = $app_list_strings['wflow_adv_user_type_dom']; unset($adv_user_array['current_user']); //end if this is a time based object } else { $adv_user_array = $app_list_strings['wflow_adv_user_type_dom']; } $adv_select = get_select_options_with_id($adv_user_array, $selected_value); $adv_select = "<select id='" . $meta_array['parent_type'] . "__adv_value' id='" . $meta_array['parent_type'] . "__adv_value' tabindex='2'>" . $adv_select . "</select>"; $output_array['adv_value']['display'] = $adv_select; $ext1_select = get_select_options_with_id($app_list_strings['wflow_relate_type_dom'], $selected_ext1); $ext1_select = " <select id='" . $meta_array['parent_type'] . "__ext1' id='" . $meta_array['parent_type'] . "__ext1' tabindex='2'>" . $ext1_select . "</select>"; $output_array['adv_value']['display'] .= $ext1_select; $output_array['adv_type']['display'] = "exist_user"; } //end if type assigned_user_id } if ($field_type == "team_list") { //Real type is just a surface variable used by javascript to determine dual type actions //in the javascript $output_array['real_type'] = "enum"; //check for multi_select and that this is the same dropdown as previous; //Set the value select $column_select = get_select_options_with_id(get_team_array(), $selected_value); $value_select = "<select id='" . $meta_array['parent_type'] . "__field_value' name='" . $meta_array['parent_type'] . "_field_value' tabindex='2'>" . $column_select . "</select>"; if ($enum_multi === true) { $value_select .= " <select id='" . $meta_array['parent_type'] . "__field_value_multi' tabindex='1' name='" . $meta_array['parent_type'] . "__field_value_multi[]' multiple size='5'>" . $column_select . "</select>"; } $output_array['value_select']['display'] = $value_select; //Set the Operator variables if ($enum_multi === true) { $operator_select_javascript = "onchange=\"toggleFieldDisplay('" . $meta_array['parent_type'] . "__operator', '" . $meta_array['parent_type'] . "__field_value', '" . $meta_array['parent_type'] . "__field_value_multi', 'Equals');\""; $javascript_start = "toggleFieldDisplay('" . $meta_array['parent_type'] . "__operator', '" . $meta_array['parent_type'] . "__field_value', '" . $meta_array['parent_type'] . "__field_value_multi', 'Equals'); \n"; } else { $operator_select_javascript = ""; $javascript_start = ""; } if ($enum_multi === true) { $operator = get_select_options_with_id($app_list_strings['mselect_type_dom'], $selected_operator); } else { $operator = get_select_options_with_id($app_list_strings['cselect_type_dom'], $selected_operator); } $output_array['operator']['display'] = $operator; $output_array['operator']['jscript'] = $operator_select_javascript; $output_array['operator']['jscriptstart'] = $javascript_start; $time_select = get_select_options_with_id($app_list_strings['tselect_type_dom'], $selected_time); $output_array['time_select']['display'] = $mod_strings['LBL_TIME_INT'] . " <select id='time_int' name='time_int' tabindex='2'>" . $time_select . "</select>"; //if we are coming here to get actions if ($actions == true) { //exception handler. if the workflow type is time, then don't allow logged in user's team to be picked if (!empty($meta_array['workflow_type']) && $meta_array['workflow_type'] == "Time") { $adv_team_array = $app_list_strings['wflow_adv_team_type_dom']; unset($adv_team_array['current_team']); //end if this is a time based object } else { $adv_team_array = $app_list_strings['wflow_adv_team_type_dom']; } $adv_select = get_select_options_with_id($adv_team_array, $selected_value); $adv_select = "<select id='" . $meta_array['parent_type'] . "__adv_value' id='" . $meta_array['parent_type'] . "__adv_value' tabindex='2'>" . $adv_select . "</select>"; $output_array['adv_value']['display'] = $adv_select; $output_array['adv_type']['display'] = "exist_team"; } //end if type team_list } if ($field_type == "bool") { //Real type is just a surface variable used by javascript to determine dual type actions //in the javascript $output_array['real_type'] = $field_type; $column_select = get_select_options_with_id($app_list_strings['bselect_type_dom'], $selected_value); $value_select = "<select id='" . $meta_array['parent_type'] . "__field_value' name='" . $meta_array['parent_type'] . "__field_value' tabindex='2'>" . $column_select . "</select>"; $output_array['value_select']['display'] = $value_select; $operator = get_select_options_with_id($app_list_strings['bopselect_type_dom'], $selected_operator); $output_array['operator']['display'] = $operator; $time_select = get_select_options_with_id($app_list_strings['tselect_type_dom'], $selected_time); $output_array['time_select']['display'] = $mod_strings['LBL_TIME_INT'] . " <select id='time_int' name='time_int' tabindex='2'>" . $time_select . "</select>"; $output_array['operator']['jscript'] = ""; $output_array['operator']['jscriptstart'] = ""; $output_array['set_type']['disabled'] = "Disabled"; if ($actions == true) { $output_array['adv_type']['display'] = ""; $output_array['adv_value']['display'] = ""; } //end if type datetime } if ($field_type == "float" || $field_type == "int" || $field_type == "num" || $field_type == "decimal" || $field_type == "double" || $field_type == "currency") { //Real type is just a surface variable used by javascript to determine dual type actions //in the javascript $output_array['real_type'] = $field_type; if ($field_type == "int") { $length = 11; } else { $length = 25; } $value_select = "<input id='" . $meta_array['parent_type'] . "__field_value' name='" . $meta_array['parent_type'] . "__field_value' tabindex='1' size='" . $length . "' maxlength='" . $length . "' type='text' value='" . $selected_value . "'>"; $output_array['value_select']['display'] = $value_select; $operator = get_select_options_with_id($app_list_strings['dselect_type_dom'], $selected_operator); $output_array['operator']['display'] = $operator; $time_select = get_select_options_with_id($app_list_strings['tselect_type_dom'], $selected_time); $output_array['time_select']['display'] = $mod_strings['LBL_TIME_INT'] . " <select id='time_int' name='time_int' tabindex='2'>" . $time_select . "</select>"; $output_array['operator']['jscript'] = ""; $output_array['operator']['jscriptstart'] = ""; ///If we are coming here for actions if ($actions == true) { $ext1_select = get_select_options_with_id($app_list_strings['query_calc_oper_dom'], $selected_ext1); $ext1_select = "existing value <select id='" . $meta_array['parent_type'] . "__ext1' id='" . $meta_array['parent_type'] . "__ext1' tabindex='2'>" . $ext1_select . "</select>"; $output_array['adv_value']['display'] = $ext1_select; $value_select = " <input id='" . $meta_array['parent_type'] . "__adv_value' name='" . $meta_array['parent_type'] . "__adv_value' tabindex='1' size='5' maxlength='5' type='text' value='" . $selected_value . "'>"; $adv_select = $value_select; $output_array['adv_value']['display'] .= $adv_select; $output_array['adv_type']['display'] = "value_calc"; //exception handler for some advanced options not valid if this is a new record if (!empty($meta_array['action_type'])) { if ($meta_array['action_type'] == "new" || $meta_array['action_type'] == "new_rel") { $output_array['set_type']['disabled'] = "Disabled"; } } //end if actions is true } //end if type float } //end if type is set } $output_array['type'] = $field_type; $output_array['name'] = $label_name; return $output_array; //end function get_output_array }