当前位置: 首页>>代码示例>>PHP>>正文


PHP QuickSearchDefaults类代码示例

本文整理汇总了PHP中QuickSearchDefaults的典型用法代码示例。如果您正苦于以下问题:PHP QuickSearchDefaults类的具体用法?PHP QuickSearchDefaults怎么用?PHP QuickSearchDefaults使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QuickSearchDefaults类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: listViewProcess

 function listViewProcess()
 {
     $this->processSearchForm();
     $this->lv->searchColumns = $this->searchForm->searchColumns;
     if ($this->where != "") {
         $this->where .= ' and oqc_product.is_latest !=0';
         //			$this->where .= ' and oqc_product.is_option !=1';
     } else {
         $this->where .= 'oqc_product.is_latest !=0';
         //			$this->where .= ' and oqc_product.is_option !=1';
     }
     if (!$this->headers) {
         return;
     }
     global $sugar_version;
     if (empty($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] == false) {
         if (floatval(substr($sugar_version, 0, 3)) > 6.4) {
             $this->lv->setup($this->seed, 'modules/oqc_Product/views/ListView65.tpl', $this->where, $this->params);
         } elseif (floatval(substr($sugar_version, 0, 3)) > 6.3) {
             $this->lv->setup($this->seed, 'modules/oqc_Product/views/ListView64.tpl', $this->where, $this->params);
         } elseif (floatval(substr($sugar_version, 0, 3)) >= 6.0 && floatval(substr($sugar_version, 0, 3)) <= 6.3) {
             $this->lv->setup($this->seed, 'modules/oqc_Product/views/ListView62.tpl', $this->where, $this->params);
         } else {
             $this->lv->setup($this->seed, 'modules/oqc_Product/views/ListView52.tpl', $this->where, $this->params);
         }
         $savedSearchName = empty($_REQUEST['saved_search_select_name']) ? '' : ' - ' . $_REQUEST['saved_search_select_name'];
         //	echo get_form_header($GLOBALS['mod_strings']['LBL_LIST_FORM_TITLE'] . $savedSearchName, '', false);
         //Quick Search support
         $qsd = new QuickSearchDefaults();
         $sqsJavascript = $qsd->getQSScripts();
         $sqsJavascript .= '<script type="text/javascript" src="include/oqc/QuickSearch/oqcQS.js"></script>';
         echo $sqsJavascript;
         echo $this->lv->display();
     }
 }
开发者ID:santara12,项目名称:OpenQuotesAndContracts,代码行数:35,代码来源:view.list.php

示例2: getSVNumberQuicksearch

function getSVNumberQuicksearch($name, $idName)
{
    global $app_strings;
    $sqsObjects = array('svnumber' => array('method' => 'query', 'modules' => array('oqc_Contract'), 'field_list' => array('svnumber', 'id'), 'populate_list' => array($name, $idName), 'group' => 'or', 'conditions' => array(array('name' => 'svnumber', 'op' => 'like_custom', 'end' => '%', 'value' => '')), 'limit' => '30', 'order' => 'svnumber', 'no_match_text' => $app_strings['ERR_SQS_NO_MATCH']));
    $json = getJSONobj();
    $qsd = new QuickSearchDefaults();
    $sqsJavascript = $qsd->getQSScripts();
    //$sqsJavascript .= '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqsObjects) . ';';
    $sqsJavascript .= '<script type="text/javascript" language="javascript">sqs_objects = {};';
    $sqsJavascript .= '</script>';
    return $sqsJavascript;
}
开发者ID:santara12,项目名称:OpenQuotesAndContracts,代码行数:12,代码来源:ExternalContracts.php

示例3: display

 function display()
 {
     if (is_admin($GLOBALS['current_user'])) {
         $json = getJSONobj();
         require_once 'include/QuickSearchDefaults.php';
         $qsd = new QuickSearchDefaults();
         $sqs_objects = array('EditView_reports_to_name' => $qsd->getQSUser());
         $sqs_objects['EditView_reports_to_name']['populate_list'] = array('reports_to_name', 'reports_to_id');
         $quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '; enableQS();</script>';
         $this->ss->assign('REPORTS_TO_JS', $quicksearch_js);
         $this->ss->assign('EDIT_REPORTS_TO', true);
     }
     parent::display();
 }
开发者ID:klr2003,项目名称:sourceread,代码行数:14,代码来源:view.edit.php

示例4: display

 function display()
 {
     if (is_admin($GLOBALS['current_user'])) {
         $json = getJSONobj();
         require_once 'include/QuickSearchDefaults.php';
         $qsd = new QuickSearchDefaults();
         $sqs_objects = array('EditView_reports_to_name' => $qsd->getQSUser());
         $sqs_objects['EditView_reports_to_name']['populate_list'] = array('reports_to_name', 'reports_to_id');
         $quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '; enableQS();</script>';
         $this->ss->assign('REPORTS_TO_JS', $quicksearch_js);
         $this->ss->assign('EDIT_REPORTS_TO', true);
     }
     //retrieve employee bean if it is not already in focus
     if (empty($this->bean->id) && !empty($_REQUEST['record'])) {
         $this->bean->retrieve($_REQUEST['record']);
     }
     //populate values for non admin users
     if (!empty($this->bean->id)) {
         global $app_list_strings;
         if (!empty($this->bean->status)) {
             $this->ss->assign('STATUS_READONLY', $app_list_strings['user_status_dom'][$this->bean->status]);
         }
         if (!empty($this->bean->employee_status)) {
             $this->ss->assign('EMPLOYEE_STATUS_READONLY', $app_list_strings['employee_status_dom'][$this->bean->employee_status]);
         }
         if (!empty($this->bean->reports_to_id)) {
             $reportsToUser = get_assigned_user_name($this->bean->reports_to_id);
             $reportsToUserField = "<input type='text' name='reports_to_name' id='reports_to_name' value='{$reportsToUser}' disabled>\n";
             $reportsToUserField .= "<input type='hidden' name='reports_to_id' id='reports_to_id' value='{$this->bean->reports_to_id}'>";
             $this->ss->assign('REPORTS_TO_READONLY', $reportsToUserField);
         }
         if (!empty($this->bean->title)) {
             $this->ss->assign('TITLE_READONLY', $this->bean->title);
         }
         if (!empty($this->bean->department)) {
             $this->ss->assign('DEPT_READONLY', $this->bean->department);
         }
     }
     parent::display();
 }
开发者ID:netconstructor,项目名称:sugarcrm_dev,代码行数:40,代码来源:view.edit.php

示例5: get_new_record_form

function get_new_record_form()
{
    if (!ACLController::checkAccess('Press', 'edit', true)) {
        return '';
    }
    global $app_strings;
    global $mod_strings;
    global $currentModule;
    global $current_user;
    $the_form = get_left_form_header($mod_strings['LBL_QUICK_NEW_PRESS']);
    $form = new XTemplate('modules/Press/Forms.html');
    $module_select = empty($_REQUEST['module_select']) ? '' : $_REQUEST['module_select'];
    $form->assign('mod', $mod_strings);
    $form->assign('app', $app_strings);
    $form->assign('module', $currentModule);
    $json = getJSONobj();
    $popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'quick_save', 'field_to_name_array' => array('id' => 'assigned_user_id', 'user_name' => 'assigned_user_name'));
    $form->assign('encoded_users_popup_request_data', $json->encode($popup_request_data));
    $form->parse('main');
    $the_form .= $form->text('main');
    require_once 'modules/Press/Press.php';
    $focus = new Press();
    require_once 'include/QuickSearchDefaults.php';
    $qsd = new QuickSearchDefaults();
    $sqs_objects = array('assigned_user_name' => $qsd->getQSUser());
    $quicksearch_js = $qsd->getQSScripts();
    $quicksearch_js .= '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '</script>';
    echo $quicksearch_js;
    require_once 'include/javascript/javascript.php';
    $javascript = new javascript();
    $javascript->setFormName('quick_save');
    $javascript->setSugarBean($focus);
    $javascript->addRequiredFields('');
    $javascript->addToValidateBinaryDependency('assigned_user_name', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'] . $app_strings['LBL_ASSIGNED_TO'], 'false', '', 'assigned_user_id');
    $jscript = $javascript->getScript();
    $the_form .= $jscript . get_left_form_footer();
    return $the_form;
}
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:38,代码来源:Forms.php

示例6: js_setup

 function js_setup()
 {
     global $global_json;
     $global_json = getJSONobj();
     require_once 'include/QuickSearchDefaults.php';
     $qsd = new QuickSearchDefaults();
     if (isset($_REQUEST['parent_type'])) {
         $sqs_objects = array('parent_name' => $qsd->getQSParent($_REQUEST['parent_type']));
     } else {
         $sqs_objects = array('parent_name' => $qsd->getQSParent());
     }
     /*
     		if (isset($_REQUEST['parent_type']) && $_REQUEST['parent_type'] != 'Users') 
     $sqs_objects = array('parent_name' => $qsd->getQSParent($_REQUEST['parent_type']));
     		else if (isset($_REQUEST['parent_type']) && $_REQUEST['parent_type'] == 'Users') 
     $sqs_objects = array('parent_name' => $qsd->getQSUser());
     
     		else 
     $sqs_objects = array('parent_name' => $qsd->getQSParent());
     */
     $quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = ' . $global_json->encode($sqs_objects) . '</script>';
     return $quicksearch_js;
 }
开发者ID:nerdystudmuffin,项目名称:dashlet-subpanels,代码行数:23,代码来源:ActivitiesReports.php

示例7: fire

 /**
  * Applies the Action to the target.
  *
  * @param SugarBean $target
  */
 function fire(&$target)
 {
     require_once 'modules/Home/quicksearchQuery.php';
     require_once 'include/QuickSearchDefaults.php';
     $json = getJSONobj();
     $userName = Parser::evaluate($this . expr, $target) . evaluate();
     $qsd = QuickSearchDefaults::getQuickSearchDefaults();
     $data = $qsd->getQSUser();
     $data['modules'] = array("Users");
     $data['conditions'][0]['value'] = $userName;
     $qs = new quicksearchQuery();
     $result = $qs->query($data);
     $resultBean = $json->decodeReal($result);
     print_r($resultBean);
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:20,代码来源:AssignToUserAction.php

示例8: QuickSearchDefaults

}
if (isset($_REQUEST['return_id'])) {
    $xtpl->assign("RETURN_ID", $_REQUEST['return_id']);
}
// handle Create $module then Cancel
if (empty($_REQUEST['return_id'])) {
    $xtpl->assign("RETURN_ACTION", 'index');
}
if (isset($_REQUEST['campaign_id'])) {
    $xtpl->assign("CAMPAIGN_ID", $_REQUEST['campaign_id']);
}
$xtpl->assign("THEME", $theme);
$xtpl->assign("IMAGE_PATH", $image_path);
$xtpl->assign("PRINT_URL", "index.php?" . $GLOBALS['request_string']);
require_once 'include/QuickSearchDefaults.php';
$qsd = new QuickSearchDefaults();
$sqs_objects = array('assigned_user_name' => $qsd->getQSUser());
$quicksearch_js = $qsd->getQSScripts();
$quicksearch_js .= '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '</script>';
$xtpl->assign("JAVASCRIPT", get_set_focus_js() . get_validate_record_js() . $quicksearch_js);
if (empty($focus->assigned_user_id) && empty($focus->id)) {
    $focus->assigned_user_id = $current_user->id;
}
if (empty($focus->assigned_name) && empty($focus->id)) {
    $focus->assigned_user_name = $current_user->user_name;
}
$xtpl->assign("ASSIGNED_USER_OPTIONS", get_select_options_with_id(get_user_array(TRUE, "Active", $focus->assigned_user_id), $focus->assigned_user_id));
$xtpl->assign("ASSIGNED_USER_NAME", $focus->assigned_user_name);
$xtpl->assign("ASSIGNED_USER_ID", $focus->assigned_user_id);
$xtpl->assign("DATE_ENTERED", $focus->date_entered);
$xtpl->assign("DATE_MODIFIED", $focus->date_modified);
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:31,代码来源:EditView.php

示例9: array

	'form_name' => 'EditView',
	'field_to_name_array' => array(
		'id' => 'assigned_user_id',
		'user_name' => 'assigned_user_name',
		),
	);
$json = getJSONobj();
$xtpl->assign('encoded_assigned_users_popup_request_data', $json->encode($popup_request_data));
if(!empty($focus->assigned_user_name))
    $xtpl->assign("ASSIGNED_USER_NAME", $focus->assigned_user_name);

$xtpl->assign("assign_user_select", SugarThemeRegistry::current()->getImage('id-ff-select','',null,null,'.png',$mod_strings['LBL_SELECT']));
$xtpl->assign("assign_user_clear", SugarThemeRegistry::current()->getImage('id-ff-clear','',null,null,'.gif',$mod_strings['LBL_ID_FF_CLEAR']));
//Assign qsd script
require_once('include/QuickSearchDefaults.php');
$qsd = QuickSearchDefaults::getQuickSearchDefaults();
$sqs_objects = array( 'EditView_assigned_user_name' => $qsd->getQSUser());
$quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '; enableQS();</script>';

$xtpl->assign("CANCEL_SCRIPT", $cancel_script);
$xtpl->assign("PRINT_URL", "index.php?".$GLOBALS['request_string']);
$xtpl->assign("JAVASCRIPT", get_set_focus_js() . $quicksearch_js);

if(!is_file(sugar_cached('jsLanguage/') . $GLOBALS['current_language'] . '.js')) {
    require_once('include/language/jsLanguage.php');
	$jsLanguage = new jsLanguage();
	$jsLanguage->createAppStringsCache($GLOBALS['current_language']);
}
$jsLang = getVersionedScript("cache/jsLanguage/{$GLOBALS['current_language']}.js",  $GLOBALS['sugar_config']['js_lang_version']);
$xtpl->assign("JSLANG", $jsLang);
开发者ID:BilalArcher,项目名称:SuiteCRM,代码行数:30,代码来源:EditView.php

示例10: array_push

        $col_arr[1] = $field_def['name'];
        $col_arr[2] = true;
    } else {
        $cols_name = $field_def['vname'];
        $col_arr[0] = $cols_name;
        $col_arr[1] = $field_def['name'];
    }
    if (!in_array($cols_name, $fields)) {
        array_push($fields, $col_arr);
    }
    $count++;
}
$xtpl->assign("WEB_POST_URL", $web_post_url);
//$xtpl->assign("LEAD_SELECT_FIELDS",'MOD.LBL_SELECT_LEAD_FIELDS');
require_once 'include/QuickSearchDefaults.php';
$qsd = new QuickSearchDefaults();
$sqs_objects = array('account_name' => $qsd->getQSParent(), 'assigned_user_name' => $qsd->getQSUser(), 'campaign_name' => $qsd->getQSCampaigns());
$quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '</script>';
$xtpl->assign("JAVASCRIPT", $quicksearch_js);
if (empty($focus->assigned_user_id) && empty($focus->id)) {
    $focus->assigned_user_id = $current_user->id;
}
if (empty($focus->assigned_name) && empty($focus->id)) {
    $focus->assigned_user_name = $current_user->user_name;
}
$xtpl->assign("ASSIGNED_USER_OPTIONS", get_select_options_with_id(get_user_array(TRUE, "Active", $focus->assigned_user_id), $focus->assigned_user_id));
$xtpl->assign("ASSIGNED_USER_NAME", $focus->assigned_user_name);
$xtpl->assign("ASSIGNED_USER_ID", $focus->assigned_user_id);
$xtpl->assign("REDIRECT_URL_DEFAULT", 'http://');
//required fields on Webtolead form
$campaign = new Campaign();
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:31,代码来源:WebToLeadCreation.php

示例11: getImportForm

 /**
  * Renders the Import form from Smarty and returns HTML
  * @param array $vars request variable global
  * @param object $email Fetched email object
  * @param bool $addToAddressBook
  * @return array
  */
 function getImportForm($vars, $email, $formName = 'ImportEditView')
 {
     require_once "include/EditView/EditView2.php";
     require_once "include/TemplateHandler/TemplateHandler.php";
     require_once 'include/QuickSearchDefaults.php';
     $qsd = QuickSearchDefaults::getQuickSearchDefaults();
     $qsd->setFormName($formName);
     global $app_strings;
     global $current_user;
     global $app_list_strings;
     $sqs_objects = array("{$formName}_parent_name" => $qsd->getQSParent());
     $smarty = new Sugar_Smarty();
     $smarty->assign("APP", $app_strings);
     $smarty->assign('formName', $formName);
     $showAssignTo = false;
     if (!isset($vars['showAssignTo']) || $vars['showAssignTo'] == true) {
         $showAssignTo = true;
     }
     // if
     if ($showAssignTo) {
         if (empty($email->assigned_user_id) && empty($email->id)) {
             $email->assigned_user_id = $current_user->id;
         }
         if (empty($email->assigned_name) && empty($email->id)) {
             $email->assigned_user_name = $current_user->user_name;
         }
         $sqs_objects["{$formName}_assigned_user_name"] = $qsd->getQSUser();
     }
     $smarty->assign("showAssignedTo", $showAssignTo);
     $showDelete = false;
     if (!isset($vars['showDelete']) || $vars['showDelete'] == true) {
         $showDelete = true;
     }
     $smarty->assign("showDelete", $showDelete);
     $smarty->assign("userId", $email->assigned_user_id);
     $smarty->assign("userName", $email->assigned_user_name);
     $parent_types = $app_list_strings['record_type_display'];
     $smarty->assign('parentOptions', get_select_options_with_id($parent_types, $email->parent_type));
     $quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = ' . json_encode($sqs_objects) . '</script>';
     $smarty->assign('SQS', $quicksearch_js);
     $meta = array();
     $meta['html'] = $smarty->fetch("modules/Emails/templates/importRelate.tpl");
     return $meta;
 }
开发者ID:NALSS,项目名称:SuiteCRM,代码行数:51,代码来源:EmailUI.php

示例12: createQuickSearchCode

 function createQuickSearchCode($formName = 'EditView', $vardef)
 {
     require_once 'include/QuickSearchDefaults.php';
     $json = getJSONobj();
     $dynamicParentTypePlaceHolder = "**@**";
     //Placeholder for dynamic parent so smarty tags are not escaped in json encoding.
     $dynamicParentType = '{/literal}{if !empty($fields.parent_type.value)}{$fields.parent_type.value}{else}Accounts{/if}{literal}';
     //Get the parent sqs definition
     $qsd = new QuickSearchDefaults();
     $qsd->setFormName($formName);
     $sqsFieldArray = $qsd->getQSParent($dynamicParentTypePlaceHolder);
     $qsFieldName = $formName . "_" . $vardef['name'];
     //Build the javascript
     $quicksearch_js = '<script language="javascript">';
     $quicksearch_js .= "if(typeof sqs_objects == 'undefined'){var sqs_objects = new Array;}";
     $quicksearch_js .= "sqs_objects['{$qsFieldName}']=" . str_replace($dynamicParentTypePlaceHolder, $dynamicParentType, $json->encode($sqsFieldArray)) . ';';
     return $quicksearch_js .= '</script>';
 }
开发者ID:aldridged,项目名称:gtg-sugar,代码行数:18,代码来源:SugarFieldParent.php

示例13: display

 /**
  * @see SugarView::display()
  */
 public function display()
 {
     if (!empty($_REQUEST['handle']) && $_REQUEST['handle'] == 'save') {
         return $this->handleSave();
     }
     global $beanList;
     // get the EditView defs to check if opportunity_name exists, for a check below for populating data
     $opportunityNameInLayout = false;
     $editviewFile = 'modules/Leads/metadata/editviewdefs.php';
     $this->medataDataFile = $editviewFile;
     if (file_exists("custom/{$editviewFile}")) {
         $this->medataDataFile = "custom/{$editviewFile}";
     }
     include $this->medataDataFile;
     foreach ($viewdefs['Leads']['EditView']['panels'] as $panel_index => $section) {
         foreach ($section as $row_array) {
             foreach ($row_array as $cell) {
                 if (isset($cell['name']) && $cell['name'] == 'opportunity_name') {
                     $opportunityNameInLayout = true;
                 }
             }
         }
     }
     $this->medataDataFile = $this->fileName;
     if (file_exists("custom/{$this->fileName}")) {
         $this->medataDataFile = "custom/{$this->fileName}";
     }
     $this->loadDefs();
     $this->getRecord();
     $this->checkForDuplicates($this->focus);
     $smarty = new Sugar_Smarty();
     $ev = new EditView();
     $ev->ss = $smarty;
     $ev->view = "ConvertLead";
     echo $this->getModuleTitle();
     require_once "include/QuickSearchDefaults.php";
     $qsd = new QuickSearchDefaults();
     $qsd->setFormName("ConvertLead");
     $this->contact = new Contact();
     $smarty->assign("contact_def", $this->contact->field_defs);
     $smarty->assign("form_name", "ConvertLead");
     $smarty->assign("form_id", "ConvertLead");
     $smarty->assign("module", "Leads");
     $smarty->assign("view", "convertlead");
     $smarty->assign("bean", $this->focus);
     $smarty->assign("record_id", $this->focus->id);
     $smarty->display("modules/Leads/tpls/ConvertLeadHeader.tpl");
     echo "<div class='edit view' style='width:auto;'>";
     foreach ($this->defs as $module => $vdef) {
         if (!isset($beanList[$module])) {
             continue;
         }
         $bean = $beanList[$module];
         $focus = new $bean();
         $focus->fill_in_additional_detail_fields();
         foreach ($focus->field_defs as $field => $def) {
             if (isset($vdef[$ev->view]['copyData']) && $vdef[$ev->view]['copyData']) {
                 if ($module == "Accounts" && $field == 'name') {
                     $focus->name = $this->focus->account_name;
                 } else {
                     if ($module == "Opportunities" && $field == 'amount') {
                         $focus->amount = unformat_number($this->focus->opportunity_amount);
                     } else {
                         if ($module == "Opportunities" && $field == 'name') {
                             if ($opportunityNameInLayout && !empty($this->focus->opportunity_name)) {
                                 $focus->name = $this->focus->opportunity_name;
                             }
                         } else {
                             if ($field == "id") {
                                 //If it is not a contact, don't copy the ID from the lead
                                 if ($module == "Contacts") {
                                     $focus->{$field} = $this->focus->{$field};
                                 }
                             } else {
                                 if (is_a($focus, "Company") && $field == 'phone_office') {
                                     //Special case where company and person have the same field with a different name
                                     $focus->phone_office = $this->focus->phone_work;
                                 } else {
                                     if (isset($this->focus->{$field})) {
                                         $focus->{$field} = $this->focus->{$field};
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         //Copy over email data
         $ev->setup($module, $focus, $this->medataDataFile, "modules/Leads/tpls/ConvertLead.tpl", false);
         $ev->process();
         echo $ev->display(false);
         echo $this->getValidationJS($module, $focus, $vdef[$ev->view]);
     }
     echo "</div>";
     echo $qsd->getQSScriptsJSONAlreadyDefined();
     $smarty->display("modules/Leads/tpls/ConvertLeadFooter.tpl");
//.........这里部分代码省略.........
开发者ID:nickpro,项目名称:sugarcrm_dev,代码行数:101,代码来源:view.convertlead.php

示例14: createQuickSearchCode

 function createQuickSearchCode($returnAsJavascript = true)
 {
     $sqs_objects = array();
     require_once 'include/QuickSearchDefaults.php';
     $qsd = QuickSearchDefaults::getQuickSearchDefaults();
     $qsd->setFormName($this->form_name);
     for ($i = 0; $i < $this->numFields; $i++) {
         $name1 = "{$this->form_name}_{$this->name}_collection_{$i}";
         $sqs_objects[$name1] = $qsd->getQSParent($this->related_module);
         $sqs_objects[$name1]['populate_list'] = array("{$this->vardef['name']}_collection_{$i}", "id_{$this->vardef['name']}_collection_{$i}");
         $sqs_objects[$name1]['field_list'] = array('name', 'id');
         if (!empty($this->user_id)) {
             $sqs_objects[$name1]['conditions'][] = array('name' => 'user_id', 'value' => $this->user_id);
         }
         if (!empty($this->customMethod)) {
             $sqs_objects[$name1]['method'] = $this->customMethod;
         }
     }
     $id = "{$this->form_name}_{$this->name}_collection_0";
     if (!empty($sqs_objects) && count($sqs_objects) > 0) {
         foreach ($sqs_objects[$id]['field_list'] as $k => $v) {
             $this->field_to_name_array[$v] = $sqs_objects[$id]['populate_list'][$k];
         }
         if ($returnAsJavascript) {
             $quicksearch_js = '<script language="javascript">';
             $quicksearch_js .= "if(typeof sqs_objects == 'undefined'){var sqs_objects = new Array;}";
             foreach ($sqs_objects as $sqsfield => $sqsfieldArray) {
                 $quicksearch_js .= "sqs_objects['{$sqsfield}']={$this->json->encode($sqsfieldArray)};";
             }
             return $quicksearch_js .= '</script>';
         } else {
             return $sqs_objects;
         }
     }
     return '';
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:36,代码来源:EmailSugarFieldTeamsetCollection.php

示例15: createQuickSearchCode

 /**
  * createQuickSearchCode
  * This function creates the $sqs_objects array that will be used by the quicksearch Javascript
  * code.  The $sqs_objects array is wrapped in a $json->encode call.
  *
  * @param array $def The vardefs.php definitions
  * @param array $defs2 The Meta-Data file definitions
  * @param string $view
  * @param strign $module
  * @return string
  */
 public function createQuickSearchCode($defs, $defs2, $view = '', $module = '')
 {
     $sqs_objects = array();
     require_once 'include/QuickSearchDefaults.php';
     if (isset($this) && $this instanceof TemplateHandler) {
         $qsd = QuickSearchDefaults::getQuickSearchDefaults($this->getQSDLookup());
     } else {
         $qsd = QuickSearchDefaults::getQuickSearchDefaults(array());
     }
     $qsd->setFormName($view);
     if (preg_match('/^SearchForm_.+/', $view)) {
         if (strpos($view, 'popup_query_form')) {
             $qsd->setFormName('popup_query_form');
             $parsedView = 'advanced';
         } else {
             $qsd->setFormName('search_form');
             $parsedView = preg_replace("/^SearchForm_/", "", $view);
         }
         //Loop through the Meta-Data fields to see which ones need quick search support
         foreach ($defs as $f) {
             $field = $f;
             $name = $qsd->form_name . '_' . $field['name'];
             if ($field['type'] == 'relate' && isset($field['module']) && preg_match('/_name$|_c$/si', $name)) {
                 if (preg_match('/^(Campaigns|Teams|Users|Contacts|Accounts)$/si', $field['module'], $matches)) {
                     if ($matches[0] == 'Campaigns') {
                         $sqs_objects[$name . '_' . $parsedView] = $qsd->loadQSObject('Campaigns', 'Campaign', $field['name'], $field['id_name'], $field['id_name']);
                     } else {
                         if ($matches[0] == 'Users') {
                             if (!empty($f['name']) && !empty($f['id_name'])) {
                                 $sqs_objects[$name . '_' . $parsedView] = $qsd->getQSUser($f['name'], $f['id_name']);
                             } else {
                                 $sqs_objects[$name . '_' . $parsedView] = $qsd->getQSUser();
                             }
                         } else {
                             if ($matches[0] == 'Campaigns') {
                                 $sqs_objects[$name . '_' . $parsedView] = $qsd->loadQSObject('Campaigns', 'Campaign', $field['name'], $field['id_name'], $field['id_name']);
                             } else {
                                 if ($matches[0] == 'Accounts') {
                                     $nameKey = $name;
                                     $idKey = isset($field['id_name']) ? $field['id_name'] : 'account_id';
                                     //There are billingKey, shippingKey and additionalFields entries you can define in editviewdefs.php
                                     //entry to allow quick search to autocomplete fields with a suffix value of the
                                     //billing/shippingKey value (i.e. 'billingKey' => 'primary' in Contacts will populate
                                     //primary_XXX fields with the Account's billing address values).
                                     //addtionalFields are key/value pair of fields to fill from Accounts(key) to Contacts(value)
                                     $billingKey = isset($f['displayParams']['billingKey']) ? $f['displayParams']['billingKey'] : null;
                                     $shippingKey = isset($f['displayParams']['shippingKey']) ? $f['displayParams']['shippingKey'] : null;
                                     $additionalFields = isset($f['displayParams']['additionalFields']) ? $f['displayParams']['additionalFields'] : null;
                                     $sqs_objects[$name . '_' . $parsedView] = $qsd->getQSAccount($nameKey, $idKey, $billingKey, $shippingKey, $additionalFields);
                                 } else {
                                     if ($matches[0] == 'Contacts') {
                                         $sqs_objects[$name . '_' . $parsedView] = $qsd->getQSContact($field['name'], $field['id_name']);
                                     }
                                 }
                             }
                         }
                     }
                 } else {
                     $sqs_objects[$name . '_' . $parsedView] = $qsd->getQSParent($field['module']);
                     if (!isset($field['field_list']) && !isset($field['populate_list'])) {
                         $sqs_objects[$name . '_' . $parsedView]['populate_list'] = array($field['name'], $field['id_name']);
                         $sqs_objects[$name . '_' . $parsedView]['field_list'] = array('name', 'id');
                     } else {
                         $sqs_objects[$name . '_' . $parsedView]['populate_list'] = $field['field_list'];
                         $sqs_objects[$name . '_' . $parsedView]['field_list'] = $field['populate_list'];
                     }
                 }
             } else {
                 if ($field['type'] == 'parent') {
                     $sqs_objects[$name . '_' . $parsedView] = $qsd->getQSParent();
                 }
             }
             //if-else
         }
         //foreach
         foreach ($sqs_objects as $name => $field) {
             foreach ($field['populate_list'] as $key => $fieldname) {
                 $sqs_objects[$name]['populate_list'][$key] = $sqs_objects[$name]['populate_list'][$key] . '_' . $parsedView;
             }
         }
     } else {
         //Loop through the Meta-Data fields to see which ones need quick search support
         foreach ($defs2 as $f) {
             if (!isset($defs[$f['name']])) {
                 continue;
             }
             $field = $defs[$f['name']];
             if ($view == "ConvertLead") {
                 $field['name'] = $module . $field['name'];
//.........这里部分代码省略.........
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:101,代码来源:TemplateHandler.php


注:本文中的QuickSearchDefaults类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。