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


PHP CRM_Utils_Date::customFormat方法代码示例

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


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

示例1: event

 /**
  * Function for building Event combo box
  */
 function event()
 {
     $name = trim(CRM_Utils_Type::escape($_GET['s'], 'String'));
     if (!$name) {
         $name = '%';
     }
     $whereClause = " title LIKE '{$name}%' AND ( civicrm_event.is_template IS NULL OR civicrm_event.is_template = 0 )";
     $includeOld = CRM_Utils_Request::retrieve('includeOld', 'Boolean', CRM_Core_DAO::$_nullObject, FALSE, TRUE);
     if (!$includeOld) {
         $whereClause .= " AND ( end_date IS NULL OR end_date >= NOW() )";
     }
     $query = "\n      SELECT civicrm_event.title AS title,\n        civicrm_event.id AS id,\n        civicrm_address.city AS city,\n        civicrm_event.start_date\n      FROM civicrm_event\n        LEFT JOIN civicrm_loc_block ON\n          civicrm_event.loc_block_id = civicrm_loc_block.id\n        LEFT JOIN civicrm_address ON\n          civicrm_loc_block.address_id = civicrm_address.id\n      WHERE\n        {$whereClause}\n      ORDER BY\n        civicrm_event.title\n";
     $dao = CRM_Core_DAO::executeQuery($query);
     $results = array();
     while ($dao->fetch()) {
         $fields = array();
         foreach (array('title', 'city') as $field) {
             if (isset($dao->{$field})) {
                 array_push($fields, $dao->{$field});
             }
         }
         if (isset($dao->start_date)) {
             array_push($fields, CRM_Utils_Date::customFormat($dao->start_date));
         }
         $results[$dao->id] = implode(' - ', $fields);
     }
     CRM_Core_Page_AJAX::autocompleteResults($results);
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:31,代码来源:AJAX.php

示例2: smarty_modifier_crmDate

/**
 * Convert the date string "YYYY-MM-DD" to "MM<long> DD, YYYY".
 *
 * @param string $dateString date which needs to converted to human readable format
 *
 * @return string human readable date format | invalid date message
 * @access public
 */
function smarty_modifier_crmDate($dateString, $dateFormat = null)
{
    if ($dateString) {
        return CRM_Utils_Date::customFormat($dateString, $dateFormat);
    }
    return '';
}
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:15,代码来源:modifier.crmDate.php

示例3: getEventFilterOptions

 /**
  * Get a standardized array of <select> options for "Event Title"
  * filter values.
  * @return Array
  */
 function getEventFilterOptions()
 {
     $events = array();
     $query = "\n        select id, start_date, title from civicrm_event\n        where (is_template IS NULL OR is_template = 0) AND is_active\n        order by title ASC, start_date\n    ";
     $dao = CRM_Core_DAO::executeQuery($query);
     while ($dao->fetch()) {
         $events[$dao->id] = "{$dao->title} - " . CRM_Utils_Date::customFormat(substr($dao->start_date, 0, 10)) . " (ID {$dao->id})";
     }
     return $events;
 }
开发者ID:hguru,项目名称:224Civi,代码行数:15,代码来源:Event.php

示例4: evaluateToken

 /**
  * Evaluate the content of a single token.
  *
  * @param \Civi\Token\TokenRow $row
  *   The record for which we want token values.
  * @param string $entity
  * @param string $field
  *   The name of the token field.
  * @param mixed $prefetch
  *   Any data that was returned by the prefetch().
  *
  * @return mixed
  */
 public function evaluateToken(\Civi\Token\TokenRow $row, $entity, $field, $prefetch = NULL)
 {
     $actionSearchResult = $row->context['actionSearchResult'];
     if (in_array($field, array('start_date', 'end_date', 'join_date'))) {
         $row->tokens($entity, $field, \CRM_Utils_Date::customFormat($actionSearchResult->{$field}));
     } elseif (isset($actionSearchResult->{$field})) {
         $row->tokens($entity, $field, $actionSearchResult->{$field});
     } else {
         $row->tokens($entity, $field, '');
     }
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:24,代码来源:Tokens.php

示例5: testGetFinancialTransactionsList

 /**
  * Test the ajax function to get financial transactions.
  *
  * Test focus is on ensuring changes to how labels are retrieved does not cause regression.
  */
 public function testGetFinancialTransactionsList()
 {
     $individualID = $this->individualCreate();
     $this->contributionCreate($individualID);
     $batch = $this->callAPISuccess('Batch', 'create', array('title' => 'test', 'status_id' => 'Open'));
     CRM_Core_DAO::executeQuery("\n     INSERT INTO civicrm_entity_batch (entity_table, entity_id, batch_id)\n     values('civicrm_financial_trxn', 1, 1)\n   ");
     $_REQUEST['sEcho'] = 1;
     $_REQUEST['entityID'] = $batch['id'];
     $json = CRM_Financial_Page_AJAX::getFinancialTransactionsList(TRUE);
     $this->assertEquals($json, '{"sEcho": 1, "iTotalRecords": 1, "iTotalDisplayRecords": 1, "aaData": [ ["","<a href=\\"/index.php?q=civicrm/profile/view&amp;reset=1&amp;gid=7&amp;id=3&amp;snippet=4\\" class=\\"crm-summary-link\\"><div' . ' class=\\"icon crm-icon Individual-icon\\"></div></a>","<a href=/index.php?q=civicrm/contact/view&amp;reset=1&amp;cid=3>Anderson, Anthony</a>","$ 100.00","12345","' . CRM_Utils_Date::customFormat(date('Ymd')) . ' 12:00 AM",' . '"Credit Card","Completed","Donation","<span><a href=\\"http://FIX ME/index.php?q=civicrm/contact/view/contribution&amp;reset=1&amp;id=1&amp;cid=3&amp;action=view&amp;context=contribution&amp;' . 'selectedChild=contribute\\" class=\\"action-item crm-hover-button\\" title=\'View Contribution\' >View</a></span>"]] }');
 }
开发者ID:rollox,项目名称:civicrm-core,代码行数:16,代码来源:AjaxTest.php

示例6: preProcess

 /**
  * build all the data structures needed to build the form
  *
  * @return void
  * @access public
  */
 function preProcess()
 {
     parent::preProcess();
     $rows = array();
     // display name and pledge details of all selected contacts
     $pledgeIDs = implode(',', $this->_pledgeIds);
     $query = "\n    SELECT plg.amount      as amount,\n           plg.create_date as create_date,\n           ct.display_name as display_name\n      FROM civicrm_pledge plg\nINNER JOIN civicrm_contact ct ON ( plg.contact_id = ct.id )       \n     WHERE plg.id IN ( {$pledgeIDs} )";
     $dao = CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
     while ($dao->fetch()) {
         $rows[] = array('display_name' => $dao->display_name, 'amount' => $dao->amount, 'create_date' => CRM_Utils_Date::customFormat($dao->create_date));
     }
     $this->assign('rows', $rows);
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:19,代码来源:SearchTaskHookSample.php

示例7: preProcess

 /**
  * Build all the data structures needed to build the form.
  *
  * @return void
  */
 public function preProcess()
 {
     parent::preProcess();
     $rows = array();
     // display name and participation details of participants
     $participantIDs = implode(',', $this->_participantIds);
     $query = "\n     SELECT p.fee_amount as amount,\n            p.register_date as register_date,\n            p.source as source,\n            ct.display_name as display_name\n       FROM civicrm_participant p\n INNER JOIN civicrm_contact ct ON ( p.contact_id = ct.id )\n      WHERE p.id IN ( {$participantIDs} )";
     $dao = CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
     while ($dao->fetch()) {
         $rows[] = array('display_name' => $dao->display_name, 'amount' => $dao->amount, 'register_date' => CRM_Utils_Date::customFormat($dao->register_date), 'source' => $dao->source);
     }
     $this->assign('rows', $rows);
 }
开发者ID:JSProffitt,项目名称:civicrm-website-org,代码行数:18,代码来源:SearchTaskHookSample.php

示例8: preProcess

 /**
  * build all the data structures needed to build the form
  *
  * @return void
  * @access public
  */
 function preProcess()
 {
     parent::preProcess();
     $rows = array();
     // display name and membership details of all selected contacts
     $memberIDs = implode(',', $this->_memberIds);
     $query = "\n    SELECT mem.start_date  as start_date,\n           mem.end_date    as end_date,\n           mem.source      as source,  \n           ct.display_name as display_name    \nFROM       civicrm_membership mem\nINNER JOIN civicrm_contact ct ON ( mem.contact_id = ct.id )     \nWHERE      mem.id IN ( {$memberIDs} )";
     $dao = CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
     while ($dao->fetch()) {
         $rows[] = array('display_name' => $dao->display_name, 'start_date' => CRM_Utils_Date::customFormat($dao->start_date), 'end_date' => CRM_Utils_Date::customFormat($dao->end_date), 'source' => $dao->source);
     }
     $this->assign('rows', $rows);
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:19,代码来源:SearchTaskHookSample.php

示例9: preProcess

 /**
  * Build all the data structures needed to build the form.
  *
  * @return void
  */
 public function preProcess()
 {
     parent::preProcess();
     $rows = array();
     // display name and email of all contact ids
     $caseIDs = implode(',', $this->_caseIds);
     $statusId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'case_status', 'id', 'name');
     $query = "\nSELECT ct.display_name as display_name,\n       cs.start_date   as start_date,\n       ov.label as status\n\nFROM  civicrm_case cs\nINNER JOIN civicrm_case_contact cc ON ( cs.id = cc.case_id)\nINNER JOIN civicrm_contact ct ON ( cc.contact_id = ct.id)\nLEFT  JOIN civicrm_option_value ov ON (cs.status_id = ov.value AND ov.option_group_id = {$statusId} )\nWHERE cs.id IN ( {$caseIDs} )";
     $dao = CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
     while ($dao->fetch()) {
         $rows[] = array('display_name' => $dao->display_name, 'start_date' => CRM_Utils_Date::customFormat($dao->start_date), 'status' => $dao->status);
     }
     $this->assign('rows', $rows);
 }
开发者ID:kidaa30,项目名称:yes,代码行数:19,代码来源:SearchTaskHookSample.php

示例10: generateLabel

 public function generateLabel($participant)
 {
     $x = $this->pdf->GetAbsX();
     $y = $this->pdf->GetY();
     $this->printBackground(TRUE);
     $this->pdf->SetLineStyle(array('width' => 0.1, 'cap' => 'round', 'join' => 'round', 'dash' => '2,2', 'color' => array(0, 0, 200)));
     $this->pdf->SetFontSize(8);
     $this->pdf->MultiCell($this->pdf->width - $this->lMarginLogo, 0, $participant['event_title'], $this->border, "L", 0, 1, $x + $this->lMarginLogo, $y);
     $this->pdf->SetXY($x, $y + $this->pdf->height - 5);
     $date = CRM_Utils_Date::customFormat($participant['event_start_date'], "%e %b");
     $this->pdf->Cell($this->pdf->width, 0, $date, $this->border, 2, "R");
     $this->pdf->SetFontSize(15);
     $this->pdf->MultiCell($this->pdf->width, 10, $participant['display_name'], $this->border, "C", 0, 1, $x, $y + $this->tMarginName);
     $this->pdf->SetFontSize(10);
     $this->pdf->MultiCell($this->pdf->width, 0, $participant['current_employer'], $this->border, "C", 0, 1, $x, $this->pdf->getY());
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:16,代码来源:Logo.php

示例11: smarty_modifier_crmDate

/**
 * Convert the date string "YYYY-MM-DD" to "MM<long> DD, YYYY".
 *
 * @param string $dateString date which needs to converted to human readable format
 *
 * @return string human readable date format | invalid date message
 * @access public
 */
function smarty_modifier_crmDate($dateString, $dateFormat = null, $onlyTime = false)
{
    if ($dateString) {
        // this check needs to be type sensitive
        // CRM-3689, CRM-2441
        if ($dateFormat === 0) {
            $dateFormat = null;
        }
        if ($onlyTime) {
            $config = CRM_Core_Config::singleton();
            $dateFormat = $config->dateformatTime;
        }
        return CRM_Utils_Date::customFormat($dateString, $dateFormat);
    }
    return '';
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:24,代码来源:modifier.crmDate.php

示例12: testGetAllRows

 function testGetAllRows()
 {
     $mailchimp_sync_log = CRM_CiviMailchimp_BAO_SyncLogTest::createTestLogMessage('This is a test error message');
     $details = unserialize($mailchimp_sync_log->details);
     $details = print_r($details, TRUE);
     $timestamp = date('c', $mailchimp_sync_log->timestamp);
     $timestamp = CRM_Utils_Date::customFormat($timestamp);
     $rows = CRM_CiviMailchimp_Page_SyncLog::getAllRows();
     $this->assertCount(1, $rows);
     $this->assertEquals($mailchimp_sync_log->id, $rows[0]['id']);
     $this->assertEquals('Error', $rows[0]['type']);
     $this->assertEquals('CiviCRM to Mailchimp', $rows[0]['direction']);
     $this->assertEquals($mailchimp_sync_log->message, $rows[0]['message']);
     $this->assertEquals($details, $rows[0]['details']);
     $this->assertEquals($timestamp, $rows[0]['timestamp']);
 }
开发者ID:jaapjansma,项目名称:com.giantrabbit.civimailchimp,代码行数:16,代码来源:SyncLogTest.php

示例13: generateLabel

 /**
  * @param $participant
  */
 public function generateLabel($participant)
 {
     $date = CRM_Utils_Date::customFormat($participant['event_start_date'], "%e %b");
     $this->pdf->SetFontSize(8);
     $y = $this->pdf->GetY();
     $x = $this->pdf->GetAbsX();
     $this->pdf->Cell($this->pdf->width, $this->pdf->lineHeight, $participant['event_title'], 0, 1, "L");
     $this->pdf->SetXY($x, $y + 4);
     $this->pdf->Cell($this->pdf->width, $this->pdf->lineHeight, $date, 0, 2, "R");
     $this->pdf->SetFontSize(12);
     $this->pdf->SetXY($x, $this->pdf->GetY() + 5);
     $this->pdf->Cell($this->pdf->width, $this->pdf->lineHeight, $participant['display_name'], 0, 2, "C");
     $this->pdf->SetFontSize(10);
     $this->pdf->SetXY($x, $this->pdf->GetY() + 2);
     $this->pdf->Cell($this->pdf->width, $this->pdf->lineHeight, $participant['current_employer'], 0, 2, "C");
     //$this->pdf->MultiCell ($this->pdf->width, $this->pdf->lineHeight, $txt,1,"L");
 }
开发者ID:agloa,项目名称:tournament,代码行数:20,代码来源:Simple.php

示例14: getAllRows

 static function getAllRows()
 {
     $query = "\n      SELECT\n        *\n      FROM \n        civimailchimp_sync_log\n      ORDER BY id DESC;\n    ";
     $mailchimp_sync_log = CRM_Core_DAO::executeQuery($query);
     $rows = array();
     while ($mailchimp_sync_log->fetch()) {
         if ($mailchimp_sync_log->direction === 'civicrm_to_mailchimp') {
             $direction = 'CiviCRM to Mailchimp';
         } elseif ($mailchimp_sync_log->direction === 'mailchimp_to_civicrm') {
             $direction = 'Mailchimp to CiviCRM';
         }
         $details = unserialize($mailchimp_sync_log->details);
         $details = print_r($details, TRUE);
         $timestamp = date('c', $mailchimp_sync_log->timestamp);
         $timestamp = CRM_Utils_Date::customFormat($timestamp);
         $rows[] = array('id' => $mailchimp_sync_log->id, 'type' => ucfirst($mailchimp_sync_log->type), 'direction' => $direction, 'message' => $mailchimp_sync_log->message, 'details' => $details, 'timestamp' => $timestamp);
     }
     return $rows;
 }
开发者ID:jaapjansma,项目名称:com.giantrabbit.civimailchimp,代码行数:19,代码来源:SyncLog.php

示例15: preProcess

 /** 
  * Heart of the viewing process. The runner gets all the meta data for 
  * the contact and calls the appropriate type of page to view. 
  * 
  * @return void 
  * @access public 
  * 
  */
 function preProcess()
 {
     CRM_Utils_System::setTitle(ts('CiviPledge'));
     $startToDate = array();
     $yearToDate = array();
     $monthToDate = array();
     $previousToDate = array();
     $prefixes = array('start', 'month', 'year', 'previous');
     $status = array('Completed', 'Cancelled', 'Pending', 'In Progress', 'Overdue');
     // cumulative (since inception) - prefix = 'start'
     $startDate = null;
     $startDateEnd = null;
     // current year - prefix = 'year'
     $config =& CRM_Core_Config::singleton();
     $yearDate = $config->fiscalYearStart;
     $year = array('Y' => date('Y'));
     $this->assign('curYear', $year['Y']);
     $yearDate = array_merge($year, $yearDate);
     $yearDate = CRM_Utils_Date::format($yearDate);
     $yearDate = $yearDate . '000000';
     $yearDateEnd = $year['Y'] . '1231235959';
     // current month - prefix = 'month'
     $currentMonth = date("F Y", mktime(0, 0, 0, date("m"), 01, date("Y")));
     $this->assign('currentMonthYear', $currentMonth);
     $monthDate = date('Ym') . '01000000';
     $monthDateEnd = CRM_Utils_Date::customFormat(date("Y-m-t", mktime(0, 0, 0, date("m"), 01, date("Y"))), '%Y%m%d') . '235959';
     // previous month - prefix = 'previous'
     $previousDate = CRM_Utils_Date::customFormat(date("Y-m-d", mktime(0, 0, 0, date("m") - 1, 01, date("Y"))), '%Y%m%d') . '000000';
     $previousDateEnd = CRM_Utils_Date::customFormat(date("Y-m-t", mktime(0, 0, 0, date("m") - 1, 01, date("Y"))), '%Y%m%d') . '235959';
     $previousMonth = date("F Y", mktime(0, 0, 0, date("m") - 1, 01, date("Y")));
     $this->assign('previousMonthYear', $previousMonth);
     require_once 'CRM/Pledge/BAO/Pledge.php';
     foreach ($prefixes as $prefix) {
         $aName = $prefix . 'ToDate';
         $startName = $prefix . 'Date';
         $endName = $prefix . 'DateEnd';
         foreach ($status as $s) {
             ${$aName}[str_replace(" ", "", $s)] = CRM_Pledge_BAO_Pledge::getTotalAmountAndCount($s, ${$startName}, ${$endName});
         }
         $this->assign($aName, ${$aName});
     }
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:50,代码来源:DashBoard.php


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