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


PHP CRM_Utils_System::setHttpHeader方法代码示例

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


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

示例1: getBatchList

 /**
  * Retrieve records.
  */
 public static function getBatchList()
 {
     $sortMapper = array(0 => 'batch.title', 1 => 'batch.type_id', 2 => '', 3 => 'batch.total', 4 => 'batch.status_id', 5 => '');
     $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
     $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
     $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
     $sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL;
     $sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
     $context = isset($_REQUEST['context']) ? CRM_Utils_Type::escape($_REQUEST['context'], 'String') : NULL;
     $params = $_REQUEST;
     if ($sort && $sortOrder) {
         $params['sortBy'] = $sort . ' ' . $sortOrder;
     }
     $params['page'] = $offset / $rowCount + 1;
     $params['rp'] = $rowCount;
     if ($context != 'financialBatch') {
         // data entry status batches
         $params['status_id'] = CRM_Core_OptionGroup::getValue('batch_status', 'Data Entry', 'name');
     }
     $params['context'] = $context;
     // get batch list
     $batches = CRM_Batch_BAO_Batch::getBatchListSelector($params);
     $iFilteredTotal = $iTotal = $params['total'];
     if ($context == 'financialBatch') {
         $selectorElements = array('check', 'batch_name', 'payment_instrument', 'item_count', 'total', 'status', 'created_by', 'links');
     } else {
         $selectorElements = array('batch_name', 'type', 'item_count', 'total', 'status', 'created_by', 'links');
     }
     CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
     echo CRM_Utils_JSON::encodeDataTableSelector($batches, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
     CRM_Utils_System::civiExit();
 }
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:35,代码来源:AJAX.php

示例2: printDoc

 /**
  * @param object|string $phpWord
  * @param string $ext
  * @param string $fileName
  */
 public static function printDoc($phpWord, $ext, $fileName)
 {
     $formats = array('docx' => 'Word2007', 'odt' => 'ODText', 'html' => 'HTML', 'pdf' => 'PDF');
     if (realpath($phpWord)) {
         $phpWord = \PhpOffice\PhpWord\IOFactory::load($phpWord, $formats[$ext]);
     }
     $objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $formats[$ext]);
     CRM_Utils_System::setHttpHeader('Content-Type', "application/{$ext}");
     CRM_Utils_System::setHttpHeader('Content-Disposition', 'attachment; filename="' . $fileName . '"');
     $objWriter->save("php://output");
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:16,代码来源:Document.php

示例3: getOptionList

 /**
  * This function uses the deprecated v1 datatable api and needs updating. See CRM-16353.
  * @deprecated
  */
 public static function getOptionList()
 {
     $params = $_REQUEST;
     $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
     $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
     $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
     $params['page'] = $offset / $rowCount + 1;
     $params['rp'] = $rowCount;
     $options = CRM_Core_BAO_CustomOption::getOptionListSelector($params);
     $iFilteredTotal = $iTotal = $params['total'];
     $selectorElements = array('label', 'value', 'is_default', 'is_active', 'links', 'class');
     CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
     echo CRM_Utils_JSON::encodeDataTableSelector($options, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
     CRM_Utils_System::civiExit();
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:19,代码来源:AJAX.php

示例4: download

 /**
  * @param string $file
  *   Local file path.
  * @param string $mimeType
  * @param int $ttl
  *   Time to live (seconds).
  */
 protected function download($file, $mimeType, $ttl)
 {
     if (!file_exists($file)) {
         header("HTTP/1.0 404 Not Found");
         return;
     } elseif (!is_readable($file)) {
         header('HTTP/1.0 403 Forbidden');
         return;
     }
     CRM_Utils_System::setHttpHeader('Expires', gmdate('D, d M Y H:i:s \\G\\M\\T', CRM_Utils_Time::getTimeRaw() + $ttl));
     CRM_Utils_System::setHttpHeader("Content-Type", $mimeType);
     CRM_Utils_System::setHttpHeader("Content-Disposition", "inline; filename=\"" . basename($file) . "\"");
     CRM_Utils_System::setHttpHeader("Cache-Control", "max-age={$ttl}, public");
     CRM_Utils_System::setHttpHeader('Pragma', 'public');
     readfile($file);
 }
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:23,代码来源:ImageFile.php

示例5: run

 /**
  * Run this page (figure out the action needed and perform it).
  *
  * @return void
  */
 public function run()
 {
     $session = CRM_Core_Session::singleton();
     $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', CRM_Core_DAO::$_nullObject, FALSE, 'text');
     $type = CRM_Utils_Request::retrieve('type', 'String', CRM_Core_DAO::$_nullObject, FALSE, 'text');
     $options = array();
     $session->getVars($options, "CRM_Mailing_Controller_Send_{$qfKey}");
     //get the options if control come from search context, CRM-3711
     if (empty($options)) {
         $session->getVars($options, "CRM_Contact_Controller_Search_{$qfKey}");
     }
     // FIXME: the below and CRM_Mailing_Form_Test::testMail()
     // should be refactored
     $fromEmail = NULL;
     $mailing = new CRM_Mailing_BAO_Mailing();
     if (!empty($options)) {
         $mailing->id = $options['mailing_id'];
         $fromEmail = CRM_Utils_Array::value('from_email', $options);
     }
     $mailing->find(TRUE);
     CRM_Mailing_BAO_Mailing::tokenReplace($mailing);
     // get and format attachments
     $attachments = CRM_Core_BAO_File::getEntityFile('civicrm_mailing', $mailing->id);
     //get details of contact with token value including Custom Field Token Values.CRM-3734
     $returnProperties = $mailing->getReturnProperties();
     $params = array('contact_id' => $session->get('userID'));
     $details = CRM_Utils_Token::getTokenDetails($params, $returnProperties, TRUE, TRUE, NULL, $mailing->getFlattenedTokens(), get_class($this));
     $mime =& $mailing->compose(NULL, NULL, NULL, $session->get('userID'), $fromEmail, $fromEmail, TRUE, $details[0][$session->get('userID')], $attachments);
     if ($type == 'html') {
         CRM_Utils_System::setHttpHeader('Content-Type', 'text/html; charset=utf-8');
         print $mime->getHTMLBody();
     } else {
         CRM_Utils_System::setHttpHeader('Content-Type', 'text/plain; charset=utf-8');
         print $mime->getTXTBody();
     }
     CRM_Utils_System::civiExit();
 }
开发者ID:utkarshsharma,项目名称:civicrm-core,代码行数:42,代码来源:Preview.php

示例6: send

 /**
  * Send a response.
  *
  * @param string $type
  *   Content type.
  * @param string $data
  *   Content.
  */
 public function send($type, $data)
 {
     // Encourage browsers to cache for a long time - 1 year
     $ttl = 60 * 60 * 24 * 364;
     \CRM_Utils_System::setHttpHeader('Expires', gmdate('D, d M Y H:i:s \\G\\M\\T', time() + $ttl));
     \CRM_Utils_System::setHttpHeader("Content-Type", $type);
     \CRM_Utils_System::setHttpHeader("Cache-Control", "max-age={$ttl}, public");
     echo $data;
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:17,代码来源:Modules.php

示例7: endPostProcess

 /**
  * End post processing.
  *
  * @param array|null $rows
  */
 public function endPostProcess(&$rows = NULL)
 {
     if ($this->_storeResultSet) {
         $this->_resultSet = $rows;
     }
     if ($this->_outputMode == 'print' || $this->_outputMode == 'pdf' || $this->_sendmail) {
         $content = $this->compileContent();
         $url = CRM_Utils_System::url("civicrm/report/instance/{$this->_id}", "reset=1", TRUE);
         if ($this->_sendmail) {
             $config = CRM_Core_Config::singleton();
             $attachments = array();
             if ($this->_outputMode == 'csv') {
                 $content = $this->_formValues['report_header'] . '<p>' . ts('Report URL') . ": {$url}</p>" . '<p>' . ts('The report is attached as a CSV file.') . '</p>' . $this->_formValues['report_footer'];
                 $csvFullFilename = $config->templateCompileDir . CRM_Utils_File::makeFileName('CiviReport.csv');
                 $csvContent = CRM_Report_Utils_Report::makeCsv($this, $rows);
                 file_put_contents($csvFullFilename, $csvContent);
                 $attachments[] = array('fullPath' => $csvFullFilename, 'mime_type' => 'text/csv', 'cleanName' => 'CiviReport.csv');
             }
             if ($this->_outputMode == 'pdf') {
                 // generate PDF content
                 $pdfFullFilename = $config->templateCompileDir . CRM_Utils_File::makeFileName('CiviReport.pdf');
                 file_put_contents($pdfFullFilename, CRM_Utils_PDF_Utils::html2pdf($content, "CiviReport.pdf", TRUE, array('orientation' => 'landscape')));
                 // generate Email Content
                 $content = $this->_formValues['report_header'] . '<p>' . ts('Report URL') . ": {$url}</p>" . '<p>' . ts('The report is attached as a PDF file.') . '</p>' . $this->_formValues['report_footer'];
                 $attachments[] = array('fullPath' => $pdfFullFilename, 'mime_type' => 'application/pdf', 'cleanName' => 'CiviReport.pdf');
             }
             if (CRM_Report_Utils_Report::mailReport($content, $this->_id, $this->_outputMode, $attachments)) {
                 CRM_Core_Session::setStatus(ts("Report mail has been sent."), ts('Sent'), 'success');
             } else {
                 CRM_Core_Session::setStatus(ts("Report mail could not be sent."), ts('Mail Error'), 'error');
             }
             return TRUE;
         } elseif ($this->_outputMode == 'print') {
             echo $content;
         } else {
             if ($chartType = CRM_Utils_Array::value('charts', $this->_params)) {
                 $config = CRM_Core_Config::singleton();
                 //get chart image name
                 $chartImg = $this->_chartId . '.png';
                 //get image url path
                 $uploadUrl = str_replace('/persist/contribute/', '/persist/', $config->imageUploadURL) . 'openFlashChart/';
                 $uploadUrl .= $chartImg;
                 //get image doc path to overwrite
                 $uploadImg = str_replace('/persist/contribute/', '/persist/', $config->imageUploadDir) . 'openFlashChart/' . $chartImg;
                 //Load the image
                 $chart = imagecreatefrompng($uploadUrl);
                 //convert it into formatted png
                 CRM_Utils_System::setHttpHeader('Content-type', 'image/png');
                 //overwrite with same image
                 imagepng($chart, $uploadImg);
                 //delete the object
                 imagedestroy($chart);
             }
             CRM_Utils_PDF_Utils::html2pdf($content, "CiviReport.pdf", FALSE, array('orientation' => 'landscape'));
         }
         CRM_Utils_System::civiExit();
     } elseif ($this->_outputMode == 'csv') {
         CRM_Report_Utils_Report::export2csv($this, $rows);
     } elseif ($this->_outputMode == 'group') {
         $group = $this->_params['groups'];
         $this->add2group($group);
     }
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:68,代码来源:Form.php

示例8: getGroupList

 /**
  * Get list of groups.
  *
  * @return array
  */
 public static function getGroupList()
 {
     $params = $_REQUEST;
     if (isset($params['parent_id'])) {
         // requesting child groups for a given parent
         $params['page'] = 1;
         $params['rp'] = 0;
         $groups = CRM_Contact_BAO_Group::getGroupListSelector($params);
         CRM_Utils_JSON::output($groups);
     } else {
         $sortMapper = array(0 => 'groups.title', 1 => 'count', 2 => 'createdBy.sort_name', 3 => '', 4 => 'groups.group_type', 5 => 'groups.visibility');
         $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
         $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
         $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
         $sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL;
         $sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
         if ($sort && $sortOrder) {
             $params['sortBy'] = $sort . ' ' . $sortOrder;
         }
         $params['page'] = $offset / $rowCount + 1;
         $params['rp'] = $rowCount;
         // get group list
         $groups = CRM_Contact_BAO_Group::getGroupListSelector($params);
         // if no groups found with parent-child hierarchy and logged in user say can view child groups only (an ACL case),
         // go ahead with flat hierarchy, CRM-12225
         if (empty($groups)) {
             $groupsAccessible = CRM_Core_PseudoConstant::group();
             $parentsOnly = CRM_Utils_Array::value('parentsOnly', $params);
             if (!empty($groupsAccessible) && $parentsOnly) {
                 // recompute group list with flat hierarchy
                 $params['parentsOnly'] = 0;
                 $groups = CRM_Contact_BAO_Group::getGroupListSelector($params);
             }
         }
         $iFilteredTotal = $iTotal = $params['total'];
         $selectorElements = array('group_name', 'count', 'created_by', 'group_description', 'group_type', 'visibility', 'org_info', 'links', 'class');
         if (empty($params['showOrgInfo'])) {
             unset($selectorElements[6]);
         }
         //add setting so this can be tested by unit test
         //@todo - ideally the portion of this that retrieves the groups should be extracted into a function separate
         // from the one which deals with web inputs & outputs so we have a properly testable & re-usable function
         if (!empty($params['is_unit_test'])) {
             return array($groups, $iFilteredTotal);
         }
         CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
         echo CRM_Utils_JSON::encodeDataTableSelector($groups, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
         CRM_Utils_System::civiExit();
     }
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:55,代码来源:AJAX.php

示例9: send

 /**
  * Send the ICalendar to the browser with the specified content type
  * - 'text/calendar' : used for downloaded ics file
  * - 'text/plain'    : used for iCal formatted feed
  * - 'text/xml'      : used for gData or rss formatted feeds
  *
  *
  * @param string $calendar
  *   The calendar data to be published.
  * @param string $content_type
  * @param string $charset
  *   The character set to use, defaults to 'us-ascii'.
  * @param string $fileName
  *   The file name (for downloads).
  * @param string $disposition
  *   How the file should be sent ('attachment' for downloads).
  */
 public static function send($calendar, $content_type = 'text/calendar', $charset = 'us-ascii', $fileName = NULL, $disposition = NULL)
 {
     $config = CRM_Core_Config::singleton();
     $lang = $config->lcMessages;
     CRM_Utils_System::setHttpHeader("Content-Language", $lang);
     CRM_Utils_System::setHttpHeader("Content-Type", "{$content_type}; charset={$charset}");
     if ($content_type == 'text/calendar') {
         CRM_Utils_System::setHttpHeader('Content-Length', strlen($calendar));
         CRM_Utils_System::setHttpHeader("Content-Disposition", "{$disposition}; filename=\"{$fileName}\"");
         CRM_Utils_System::setHttpHeader("Pragma", "no-cache");
         CRM_Utils_System::setHttpHeader("Expires", "0");
         CRM_Utils_System::setHttpHeader("Cache-Control", "no-cache, must-revalidate");
     }
     echo $calendar;
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:32,代码来源:ICalendar.php

示例10: logout

 /**
  * @inheritDoc
  */
 public function logout()
 {
     session_destroy();
     CRM_Utils_System::setHttpHeader("Location", "index.php");
 }
开发者ID:nyimbi,项目名称:civicrm-core,代码行数:8,代码来源:Joomla.php

示例11: export2csv

 /**
  * @param CRM_Core_Form $form
  * @param $rows
  */
 public static function export2csv(&$form, &$rows)
 {
     //Mark as a CSV file.
     CRM_Utils_System::setHttpHeader('Content-Type', 'text/csv');
     //Force a download and name the file using the current timestamp.
     $datetime = date('Ymd-Gi', $_SERVER['REQUEST_TIME']);
     CRM_Utils_System::setHttpHeader('Content-Disposition', 'attachment; filename=Report_' . $datetime . '.csv');
     echo self::makeCsv($form, $rows);
     CRM_Utils_System::civiExit();
 }
开发者ID:nyimbi,项目名称:civicrm-core,代码行数:14,代码来源:Report.php

示例12: run

 /**
  * Run this page (figure out the action needed and perform it).
  *
  * @param int $id
  * @param int $contactID
  * @param bool $print
  * @param bool $allowID
  */
 public function run($id = NULL, $contactID = NULL, $print = TRUE, $allowID = FALSE)
 {
     if (is_numeric($id)) {
         $this->_mailingID = $id;
     } else {
         $print = TRUE;
         $this->_mailingID = CRM_Utils_Request::retrieve('id', 'String', CRM_Core_DAO::$_nullObject, TRUE);
     }
     // # CRM-7651
     // override contactID from the function level if passed in
     if (isset($contactID) && is_numeric($contactID)) {
         $this->_contactID = $contactID;
     } else {
         $session = CRM_Core_Session::singleton();
         $this->_contactID = $session->get('userID');
     }
     // mailing key check
     if (Civi::settings()->get('hash_mailing_url')) {
         $this->_mailing = new CRM_Mailing_BAO_Mailing();
         if (!is_numeric($this->_mailingID)) {
             $this->_mailing->hash = $this->_mailingID;
         } elseif (is_numeric($this->_mailingID)) {
             $this->_mailing->id = $this->_mailingID;
             // if mailing is present and associated hash is present
             // while 'hash' is not been used for mailing view : throw 'permissionDenied'
             if ($this->_mailing->find() && CRM_Core_DAO::getFieldValue('CRM_Mailing_BAO_Mailing', $this->_mailingID, 'hash', 'id') && !$allowID) {
                 CRM_Utils_System::permissionDenied();
                 return;
             }
         }
     } else {
         $this->_mailing = new CRM_Mailing_BAO_Mailing();
         $this->_mailing->id = $this->_mailingID;
     }
     if (!$this->_mailing->find(TRUE) || !$this->checkPermission()) {
         CRM_Utils_System::permissionDenied();
         return;
     }
     CRM_Mailing_BAO_Mailing::tokenReplace($this->_mailing);
     // get and format attachments
     $attachments = CRM_Core_BAO_File::getEntityFile('civicrm_mailing', $this->_mailing->id);
     // get contact detail and compose if contact id exists
     $returnProperties = $this->_mailing->getReturnProperties();
     if (isset($this->_contactID)) {
         // get details of contact with token value including Custom Field Token Values.CRM-3734
         $params = array('contact_id' => $this->_contactID);
         $details = CRM_Utils_Token::getTokenDetails($params, $returnProperties, FALSE, TRUE, NULL, $this->_mailing->getFlattenedTokens(), get_class($this));
         $details = $details[0][$this->_contactID];
         $contactId = $this->_contactID;
     } else {
         // get tokens that are not contact specific resolved
         $params = array('contact_id' => 0);
         $details = CRM_Utils_Token::getAnonymousTokenDetails($params, $returnProperties, TRUE, TRUE, NULL, $this->_mailing->getFlattenedTokens(), get_class($this));
         $details = CRM_Utils_Array::value(0, $details[0]);
         $contactId = 0;
     }
     $mime =& $this->_mailing->compose(NULL, NULL, NULL, $contactId, $this->_mailing->from_email, $this->_mailing->from_email, TRUE, $details, $attachments);
     $title = NULL;
     if (isset($this->_mailing->body_html) && empty($_GET['text'])) {
         $header = 'text/html; charset=utf-8';
         $content = $mime->getHTMLBody();
         if (strpos($content, '<head>') === FALSE && strpos($content, '<title>') === FALSE) {
             $title = '<head><title>' . $this->_mailing->subject . '</title></head>';
         }
     } else {
         $header = 'text/plain; charset=utf-8';
         $content = $mime->getTXTBody();
     }
     CRM_Utils_System::setTitle($this->_mailing->subject);
     if (CRM_Utils_Array::value('snippet', $_GET) === 'json') {
         CRM_Core_Page_AJAX::returnJsonResponse($content);
     }
     if ($print) {
         CRM_Utils_System::setHttpHeader('Content-Type', $header);
         print $title;
         print $content;
         CRM_Utils_System::civiExit();
     } else {
         return $content;
     }
 }
开发者ID:scardinius,项目名称:civicrm-core,代码行数:89,代码来源:View.php

示例13: getContactEmail

 /**
  *  Function to get email address of a contact.
  */
 public static function getContactEmail()
 {
     if (!empty($_REQUEST['contact_id'])) {
         $contactID = CRM_Utils_Type::escape($_REQUEST['contact_id'], 'Positive');
         if (!CRM_Contact_BAO_Contact_Permission::allow($contactID, CRM_Core_Permission::EDIT)) {
             return;
         }
         list($displayName, $userEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($contactID);
         CRM_Utils_System::setHttpHeader('Content-Type', 'text/plain');
         if ($userEmail) {
             echo $userEmail;
         }
     } else {
         $noemail = CRM_Utils_Array::value('noemail', $_GET);
         $queryString = NULL;
         $name = CRM_Utils_Array::value('name', $_GET);
         if ($name) {
             $name = CRM_Utils_Type::escape($name, 'String');
             if ($noemail) {
                 $queryString = " cc.sort_name LIKE '%{$name}%'";
             } else {
                 $queryString = " ( cc.sort_name LIKE '%{$name}%' OR ce.email LIKE '%{$name}%' ) ";
             }
         } else {
             $cid = CRM_Utils_Array::value('cid', $_GET);
             if ($cid) {
                 //check cid for integer
                 $contIDS = explode(',', $cid);
                 foreach ($contIDS as $contID) {
                     CRM_Utils_Type::escape($contID, 'Integer');
                 }
                 $queryString = " cc.id IN ( {$cid} )";
             }
         }
         if ($queryString) {
             $offset = CRM_Utils_Array::value('offset', $_GET, 0);
             $rowCount = Civi::settings()->get('search_autocomplete_count');
             $offset = CRM_Utils_Type::escape($offset, 'Int');
             // add acl clause here
             list($aclFrom, $aclWhere) = CRM_Contact_BAO_Contact_Permission::cacheClause('cc');
             if ($aclWhere) {
                 $aclWhere = " AND {$aclWhere}";
             }
             if ($noemail) {
                 $query = "\nSELECT sort_name name, cc.id\nFROM civicrm_contact cc\n     {$aclFrom}\nWHERE cc.is_deceased = 0 AND {$queryString}\n      {$aclWhere}\nLIMIT {$offset}, {$rowCount}\n";
                 // send query to hook to be modified if needed
                 CRM_Utils_Hook::contactListQuery($query, $name, CRM_Utils_Request::retrieve('context', 'String', CRM_Core_DAO::$_nullObject), CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject));
                 $dao = CRM_Core_DAO::executeQuery($query);
                 while ($dao->fetch()) {
                     $result[] = array('id' => $dao->id, 'text' => $dao->name);
                 }
             } else {
                 $query = "\nSELECT sort_name name, ce.email, cc.id\nFROM   civicrm_email ce INNER JOIN civicrm_contact cc ON cc.id = ce.contact_id\n       {$aclFrom}\nWHERE  ce.on_hold = 0 AND cc.is_deceased = 0 AND cc.do_not_email = 0 AND {$queryString}\n       {$aclWhere}\nLIMIT {$offset}, {$rowCount}\n";
                 // send query to hook to be modified if needed
                 CRM_Utils_Hook::contactListQuery($query, $name, CRM_Utils_Request::retrieve('context', 'String', CRM_Core_DAO::$_nullObject), CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject));
                 $dao = CRM_Core_DAO::executeQuery($query);
                 while ($dao->fetch()) {
                     //working here
                     $result[] = array('text' => '"' . $dao->name . '" <' . $dao->email . '>', 'id' => CRM_Utils_Array::value('id', $_GET) ? "{$dao->id}::{$dao->email}" : '"' . $dao->name . '" <' . $dao->email . '>');
                 }
             }
             if ($result) {
                 CRM_Utils_JSON::output($result);
             }
         }
     }
     CRM_Utils_System::civiExit();
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:71,代码来源:AJAX.php

示例14: sendResponse

 /**
  * @param array $result
  *   List of API responses, keyed by file.
  */
 public static function sendResponse($result)
 {
     $isError = FALSE;
     foreach ($result as $item) {
         $isError = $isError || $item['is_error'];
     }
     if ($isError) {
         $sapi_type = php_sapi_name();
         if (substr($sapi_type, 0, 3) == 'cgi') {
             CRM_Utils_System::setHttpHeader("Status", "500 Internal Server Error");
         } else {
             header("HTTP/1.1 500 Internal Server Error");
         }
     }
     CRM_Utils_JSON::output(array_merge($result));
 }
开发者ID:utkarshsharma,项目名称:civicrm-core,代码行数:20,代码来源:Attachment.php

示例15: setExcel

 /**
  * @param null $fileName
  */
 public function setExcel($fileName = NULL)
 {
     //Mark as an excel file.
     CRM_Utils_System::setHttpHeader('Content-Type', 'application/vnd.ms-excel');
     //Force a download and name the file using the current timestamp.
     if (!$fileName) {
         $fileName = 'Contacts_' . $_SERVER['REQUEST_TIME'] . '.xls';
     }
     CRM_Utils_System::setHttpHeader("Content-Disposition", "attachment; filename=Contacts_{$fileName}");
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:13,代码来源:Controller.php


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