本文整理汇总了PHP中QuickSearchDefaults::getQSCampaigns方法的典型用法代码示例。如果您正苦于以下问题:PHP QuickSearchDefaults::getQSCampaigns方法的具体用法?PHP QuickSearchDefaults::getQSCampaigns怎么用?PHP QuickSearchDefaults::getQSCampaigns使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QuickSearchDefaults
的用法示例。
在下文中一共展示了QuickSearchDefaults::getQSCampaigns方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createQuickSearchCode
function createQuickSearchCode($returnAsJavascript = true)
{
$sqs_objects = array();
require_once 'include/QuickSearchDefaults.php';
$qsd = new QuickSearchDefaults();
$qsd->setFormName($this->form_name);
for ($i = 0; $i < $this->numFields; $i++) {
$name1 = "{$this->form_name}_{$this->name}_collection_{$i}";
if (!$this->skipModuleQuickSearch && preg_match('/(Campaigns|Teams|Users|Accounts)/si', $this->related_module, $matches)) {
if ($matches[0] == 'Users') {
$sqs_objects[$name1] = $qsd->getQSUser();
} else {
if ($matches[0] == 'Campaigns') {
$sqs_objects[$name1] = $qsd->getQSCampaigns();
} else {
if ($matches[0] == 'Users') {
$sqs_objects[$name1] = $qsd->getQSUser();
} else {
if ($matches[0] == 'Accounts') {
$nameKey = "{$this->name}_collection_{$i}";
$idKey = "id_{$this->name}_collection_{$i}";
//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($this->displayParams['billingKey']) ? $this->displayParams['billingKey'] : null;
$shippingKey = isset($this->displayParams['shippingKey']) ? $this->displayParams['shippingKey'] : null;
$additionalFields = isset($this->displayParams['additionalFields']) ? $this->displayParams['additionalFields'] : null;
$sqs_objects[$name1] = $qsd->getQSAccount($nameKey, $idKey, $billingKey, $shippingKey, $additionalFields);
} else {
if ($matches[0] == 'Contacts') {
$sqs_objects[$name1] = $qsd->getQSContact($name1, "id_" . $name1);
}
}
}
}
}
$temp_array = array('field_list' => array(), 'populate_list' => array());
foreach ($sqs_objects[$name1]['field_list'] as $k => $v) {
if (!in_array($v, array('name', 'id'))) {
$sqs_objects[$name1]['primary_field_list'][] = $v;
$sqs_objects[$name1]['primary_populate_list'][] = $sqs_objects[$name1]['populate_list'][$k];
} else {
$temp_array['field_list'][] = $v;
$temp_array['populate_list'][] = $sqs_objects[$name1]['populate_list'][$k];
}
}
$sqs_objects[$name1]['field_list'] = $temp_array['field_list'];
$sqs_objects[$name1]['populate_list'] = $temp_array['populate_list'];
if (isset($this->displayParams['collection_field_list'])) {
foreach ($this->displayParams['collection_field_list'] as $v) {
$sqs_objects[$name1]['populate_list'][] = $v['vardefName'] . "_" . $this->name . "_collection_extra_" . $i;
$sqs_objects[$name1]['field_list'][] = $v['vardefName'];
}
}
} else {
$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 (isset($this->displayParams['collection_field_list'])) {
foreach ($this->displayParams['collection_field_list'] as $v) {
$sqs_objects[$name1]['populate_list'][] = $v['vardefName'] . "_" . $this->name . "_collection_extra_" . $i;
$sqs_objects[$name1]['field_list'][] = $v['vardefName'];
}
}
if (isset($this->displayParams['field_to_name_array'])) {
foreach ($this->displayParams['field_to_name_array'] as $k => $v) {
/*
* "primary_populate_list" and "primary_field_list" are used when the field is selected as a primary.
* At this time the JS function changePrimary() will copy "primary_populate_list" and "primary_field_list"
* into "populate_list" and "field_list" and remove the values from all the others which are secondaries.
* "primary_populate_list" and "primary_field_list" contain the fields which has to be populated outside of
* the collection field. For example the "Address Information" are populated with the "billing address" of the
* selected account in a contact editview.
*/
$sqs_objects[$name1]['primary_populate_list'][] = $v;
$sqs_objects[$name1]['primary_field_list'][] = $k;
}
} else {
if (isset($field['field_list']) && isset($field['populate_list'])) {
$sqs_objects[$name1]['primary_populate_list'] = array_merge($sqs_objects[$name1]['populate_list'], $field['field_list']);
$sqs_objects[$name1]['primary_field_list'] = array_merge($sqs_objects[$name1]['field_list'], $field['populate_list']);
} else {
$sqs_objects[$name1]['primary_populate_list'] = array();
$sqs_objects[$name1]['primary_field_list'] = array();
}
}
}
}
$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)};";
//.........这里部分代码省略.........
示例2: QuickSearchDefaults
$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();
$javascript = new javascript();
示例3: 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 $def The vardefs.php definitions
* @param $defs2 The Meta-Data file definitions
*
*/
function createQuickSearchCode($defs, $defs2, $view = '')
{
$sqs_objects = array();
require_once 'include/QuickSearchDefaults.php';
$qsd = new QuickSearchDefaults();
$qsd->setFormName($view);
if (preg_match("/^SearchForm_.+/", $view)) {
$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->getQSCampaigns();
} 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] == '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
//_pp($sqs_objects);
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']];
$name = $qsd->form_name . '_' . $field['name'];
if ($field['type'] == 'relate' && isset($field['module']) && (preg_match('/_name$|_c$/si', $name) || !empty($field['quicksearch']))) {
if (!preg_match('/_c$/si', $name) && preg_match('/^(Campaigns|Teams|Users|Contacts|Accounts)$/si', $field['module'], $matches)) {
if ($matches[0] == 'Campaigns') {
$sqs_objects[$name] = $qsd->getQSCampaigns();
} else {
if ($matches[0] == 'Users') {
if ($field['name'] == 'reports_to_name') {
$sqs_objects[$name] = $qsd->getQSUser('reports_to_name', 'reports_to_id');
} else {
$sqs_objects[$name] = $qsd->getQSUser();
}
} else {
if ($matches[0] == 'Accounts') {
$nameKey = $name;
$idKey = isset($field['id_name']) ? $field['id_name'] : 'account_id';
//.........这里部分代码省略.........