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


PHP CRM_Contact_Form_Task::_searchFormValues方法代码示例

本文整理汇总了PHP中CRM_Contact_Form_Task::_searchFormValues方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_Form_Task::_searchFormValues方法的具体用法?PHP CRM_Contact_Form_Task::_searchFormValues怎么用?PHP CRM_Contact_Form_Task::_searchFormValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Contact_Form_Task的用法示例。


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

示例1: preProcessCommon

 /**
  * Common pre-processing function.
  *
  * @param CRM_Core_Form $form
  * @param bool $useTable
  */
 public static function preProcessCommon(&$form, $useTable = FALSE)
 {
     $form->_contactIds = array();
     $form->_contactTypes = array();
     // get the submitted values of the search form
     // we'll need to get fv from either search or adv search in the future
     $fragment = 'search';
     if ($form->_action == CRM_Core_Action::ADVANCED) {
         self::$_searchFormValues = $form->controller->exportValues('Advanced');
         $fragment .= '/advanced';
     } elseif ($form->_action == CRM_Core_Action::PROFILE) {
         self::$_searchFormValues = $form->controller->exportValues('Builder');
         $fragment .= '/builder';
     } elseif ($form->_action == CRM_Core_Action::COPY) {
         self::$_searchFormValues = $form->controller->exportValues('Custom');
         $fragment .= '/custom';
     } else {
         self::$_searchFormValues = $form->controller->exportValues('Basic');
     }
     //set the user context for redirection of task actions
     $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $form);
     $urlParams = 'force=1';
     if (CRM_Utils_Rule::qfKey($qfKey)) {
         $urlParams .= "&qfKey={$qfKey}";
     }
     $cacheKey = "civicrm search {$qfKey}";
     $url = CRM_Utils_System::url('civicrm/contact/' . $fragment, $urlParams);
     $session = CRM_Core_Session::singleton();
     $session->replaceUserContext($url);
     $form->_task = CRM_Utils_Array::value('task', self::$_searchFormValues);
     $crmContactTaskTasks = CRM_Contact_Task::taskTitles();
     $form->assign('taskName', CRM_Utils_Array::value($form->_task, $crmContactTaskTasks));
     if ($useTable) {
         $form->_componentTable = CRM_Core_DAO::createTempTableName('civicrm_task_action', TRUE, $qfKey);
         $sql = " DROP TABLE IF EXISTS {$form->_componentTable}";
         CRM_Core_DAO::executeQuery($sql);
         $sql = "CREATE TABLE {$form->_componentTable} ( contact_id int primary key) ENGINE=MyISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci";
         CRM_Core_DAO::executeQuery($sql);
     }
     // all contacts or action = save a search
     if (CRM_Utils_Array::value('radio_ts', self::$_searchFormValues) == 'ts_all' || $form->_task == CRM_Contact_Task::SAVE_SEARCH) {
         $sortByCharacter = $form->get('sortByCharacter');
         $cacheKey = $sortByCharacter && $sortByCharacter != 'all' ? "{$cacheKey}_alphabet" : $cacheKey;
         // since we don't store all contacts in prevnextcache, when user selects "all" use query to retrieve contacts
         // rather than prevnext cache table for most of the task actions except export where we rebuild query to fetch
         // final result set
         if ($useTable) {
             $allCids = CRM_Core_BAO_PrevNextCache::getSelection($cacheKey, "getall");
         } else {
             $allCids[$cacheKey] = $form->getContactIds();
         }
         $form->_contactIds = array();
         if ($useTable) {
             $count = 0;
             $insertString = array();
             foreach ($allCids[$cacheKey] as $cid => $ignore) {
                 $count++;
                 $insertString[] = " ( {$cid} ) ";
                 if ($count % 200 == 0) {
                     $string = implode(',', $insertString);
                     $sql = "REPLACE INTO {$form->_componentTable} ( contact_id ) VALUES {$string}";
                     CRM_Core_DAO::executeQuery($sql);
                     $insertString = array();
                 }
             }
             if (!empty($insertString)) {
                 $string = implode(',', $insertString);
                 $sql = "REPLACE INTO {$form->_componentTable} ( contact_id ) VALUES {$string}";
                 CRM_Core_DAO::executeQuery($sql);
             }
         } else {
             // filter duplicates here
             // CRM-7058
             // might be better to do this in the query, but that logic is a bit complex
             // and it decides when to use distinct based on input criteria, which needs
             // to be fixed and optimized.
             foreach ($allCids[$cacheKey] as $cid => $ignore) {
                 $form->_contactIds[] = $cid;
             }
         }
     } elseif (CRM_Utils_Array::value('radio_ts', self::$_searchFormValues) == 'ts_sel') {
         // selected contacts only
         // need to perform action on only selected contacts
         $insertString = array();
         // refire sql in case of custom seach
         if ($form->_action == CRM_Core_Action::COPY) {
             // selected contacts only
             // need to perform action on only selected contacts
             foreach (self::$_searchFormValues as $name => $value) {
                 if (substr($name, 0, CRM_Core_Form::CB_PREFIX_LEN) == CRM_Core_Form::CB_PREFIX) {
                     $contactID = substr($name, CRM_Core_Form::CB_PREFIX_LEN);
                     if ($useTable) {
                         $insertString[] = " ( {$contactID} ) ";
                     } else {
//.........这里部分代码省略.........
开发者ID:kidaa30,项目名称:yes,代码行数:101,代码来源:Task.php


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