function getBaseURL($html_varName) { static $cache = array(); if (!empty($cache[$html_varName])) { return $cache[$html_varName]; } $blockVariables = array('mass', 'uid', 'massupdate', 'delete', 'merge', 'selectCount', 'current_query_by_page'); if (!empty($this->base_URL)) { return $this->base_URL; } $baseurl = $_SERVER['PHP_SELF']; if (empty($baseurl)) { $baseurl = 'index.php'; } /*fixes an issue with deletes when doing a search*/ foreach (array_merge($_GET, $_POST) as $name => $value) { //echo ("$name = $value <br/>"); if (!empty($value) && $name != 'sort_order' && $name != ListView::getSessionVariableName($html_varName, "offset") && !in_array($name, $blockVariables)) { if (is_array($value)) { foreach ($value as $valuename => $valuevalue) { if (substr_count($baseurl, '?') > 0) { $baseurl .= "&{$name}[]=" . $valuevalue; } else { $baseurl .= "?{$name}[]=" . $valuevalue; } } } else { $value = urlencode($value); if (substr_count($baseurl, '?') > 0) { $baseurl .= "&{$name}={$value}"; } else { $baseurl .= "?{$name}={$value}"; } } } } if ($_SERVER['REQUEST_METHOD'] == 'POST') { // at this point it is possible that the above foreach already executed resulting in double ?'s in the url if (substr_count($baseurl, '?') == 0) { $baseurl .= '?'; } if (isset($_REQUEST['action'])) { $baseurl .= '&action=' . $_REQUEST['action']; } if (isset($_REQUEST['record'])) { $baseurl .= '&record=' . $_REQUEST['record']; } if (isset($_REQUEST['module'])) { $baseurl .= '&module=' . $_REQUEST['module']; } } $baseurl .= "&" . ListView::getSessionVariableName($html_varName, "offset") . "="; $cache[$html_varName] = $baseurl; return $baseurl; }
function getBaseURL($html_varName) { $blockVariables = array('mass', 'uid', 'massupdate', 'delete', 'merge', 'selectCount'); if (!empty($this->base_URL)) { return $this->base_URL; } $baseurl = $_SERVER['PHP_SELF']; if (empty($baseurl)) { $baseurl = 'index.php'; } /*fixes an issue with deletes when doing a search*/ foreach (array_merge($_GET, $_POST) as $name => $value) { if (!empty($value)) { if ($name != 'sort_order' && $name != ListView::getSessionVariableName($html_varName, "ORDER_BY") && $name != ListView::getSessionVariableName($html_varName, "offset") && substr_count($name, "ORDER_BY") == 0 && !in_array($name, $blockVariables)) { if (is_array($value)) { foreach ($value as $valuename => $valuevalue) { if (substr_count($baseurl, '?') > 0) { $baseurl .= "&{$name}[]=" . $valuevalue; } else { $baseurl .= "?{$name}[]=" . $valuevalue; } } } else { if ($name == 'request_data') { //this condition fixes an issues with popups that are invoked from the select button of a sub-panel, after performing a search the navigation buttons were behaving incorrectly. $value = urlencode($value); } if (substr_count($baseurl, '?') > 0) { $baseurl .= "&{$name}={$value}"; } else { $baseurl .= "?{$name}={$value}"; } } } } } //had an issue with deletes when doing searches /*if(isset($_SERVER['QUERY_STRING'])){ $this->base_URL = ereg_replace("\&".$this->getSessionVariableName($html_varName,"ORDER_BY")."=[0-9a-zA-Z\_\.]*","",$this->base_URL .'?'.$_SERVER['QUERY_STRING']); $this->base_URL = ereg_replace("\&".$this->getSessionVariableName($html_varName,"offset")."=[0-9]*","",$this->base_URL); }*/ if ($_SERVER['REQUEST_METHOD'] == 'POST') { // at this point it is possible that the above foreach already executed resulting in double ?'s in the url if (substr_count($baseurl, '?') == 0) { $baseurl .= '?'; } if (isset($_REQUEST['action'])) { $baseurl .= '&action=' . $_REQUEST['action']; } if (isset($_REQUEST['record'])) { $baseurl .= '&record=' . $_REQUEST['record']; } if (isset($_REQUEST['module'])) { $baseurl .= '&module=' . $_REQUEST['module']; } } $baseurl .= "&" . ListView::getSessionVariableName($html_varName, "offset") . "="; return $baseurl; }
function displayHeaderCell($layout_def) { $module_name = $this->layout_manager->getAttribute('module_name'); $this->local_current_module = $_REQUEST['module']; $this->is_dynamic = true; // don't show sort links if name isn't defined if (empty($layout_def['name'])) { return $layout_def['label']; } if (isset($layout_def['sortable']) && !$layout_def['sortable']) { return $this->displayHeaderCellPlain($layout_def); } $header_cell_text = ''; $key = ''; if (!empty($layout_def['vname'])) { $key = $layout_def['vname']; } if (empty($key)) { $header_cell_text = $layout_def['name']; } else { $header_cell_text = translate($key, $module_name); } $subpanel_module = $layout_def['subpanel_module']; if (empty($this->base_URL)) { $this->base_URL = ListView::getBaseURL('CELL'); $split_url = explode('&to_pdf=true&action=SubPanelViewer&subpanel=', $this->base_URL); $this->base_URL = $split_url[0]; $this->base_URL .= '&inline=true&to_pdf=true&action=SubPanelViewer&subpanel='; } $sort_by_name = $layout_def['name']; if (isset($layout_def['sort_by'])) { $sort_by_name = $layout_def['sort_by']; } $sort_by = ListView::getSessionVariableName('CELL', "ORDER_BY") . '=' . $sort_by_name; $start = empty($layout_def['start_link_wrapper']) ? '' : $layout_def['start_link_wrapper']; $end = empty($layout_def['end_link_wrapper']) ? '' : $layout_def['end_link_wrapper']; $header_cell = "<a class=\"listViewThLinkS1\" href=\"" . $start . $this->base_URL . $subpanel_module . '&' . $sort_by . $end . "\">"; $header_cell .= $header_cell_text; $header_cell .= "</a>"; $imgArrow = ''; if (isset($layout_def['sort'])) { $imgArrow = $layout_def['sort']; } $arrow_start = ListView::getArrowUpDownStart($imgArrow); $header_cell .= " " . $arrow_start; return $header_cell; }
} } $GLOBALS['log']->info("Here is the where clause for the list view: {$where}"); } $display_title = $mod_strings['LBL_LIST_FORM_TITLE']; if ($title) { $display_title = $title; } $ListView = new ListView(); if (is_admin($current_user) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])) { $header_text = " <a href='index.php?action=index&module=DynamicLayout&from_action=ListView&from_module=" . $_REQUEST['module'] . "'>" . SugarThemeRegistry::current()->getImage("EditLayout", "border='0' alt='Edit Layout' align='bottom'") . "</a>"; } $ListView->initNewXTemplate('modules/EmailTemplates/ListView.html', $mod_strings); $ListView->setHeaderTitle($display_title . $header_text); $ListView->setQuery($where, "", "email_templates.date_entered DESC", "EMAIL_TEMPLATE"); if ($db->dbType == 'mysql') { $ListView->createXTemplate(); $sortURLBase = $ListView->getBaseURL("EMAIL_TEMPLATE") . "&" . $ListView->getSessionVariableName("EMAIL_TEMPLATE", "ORDER_BY") . "="; $ListView->xTemplate->assign("ET_ORDER_BY", '<a href="' . $sortURLBase . 'description" class="listViewThLinkS1">'); $ListView->xTemplateAssign("et_arrow_start", $ListView->getArrowStart($ListView->local_image_path)); $arrowInfo = $ListView->getOrderByInfo('EMAIL_TEMPLATE'); if ($arrowInfo[0] == 'description') { $imgArrow = "_down"; if ($arrowInfo[1]) { $imgArrow = "_up"; } $ListView->xTemplateAssign('et_description_arrow', $imgArrow); } $ListView->xTemplateAssign('et_arrow_end', $ListView->getArrowEnd($ListView->local_image_path) . '</a>'); } $ListView->processListView($seedEmailTemplate, "main", "EMAIL_TEMPLATE");