本文整理汇总了PHP中CRM_Utils_Date类的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_Date类的具体用法?PHP CRM_Utils_Date怎么用?PHP CRM_Utils_Date使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRM_Utils_Date类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: postProcess
public function postProcess()
{
$params = $this->_submitValues;
$batchDetailsSql = " UPDATE civicrm_batch SET ";
$batchDetailsSql .= " title = %1 ";
$batchDetailsSql .= " , description = %2 ";
$batchDetailsSql .= " , banking_account = %3 ";
$batchDetailsSql .= " , banking_date = %4 ";
$batchDetailsSql .= " , exclude_from_posting = %5 ";
$batchDetailsSql .= " , contribution_type_id = %6 ";
$batchDetailsSql .= " , payment_instrument_id = %7 ";
$batchDetailsSql .= " WHERE id = %8 ";
$bankingDate = CRM_Utils_Date::processDate($params['banking_date']);
$sqlParams = array();
$sqlParams[1] = array((string) $params['batch_title'], 'String');
$sqlParams[2] = array((string) $params['description'], 'String');
$sqlParams[3] = array((string) $params['banking_account'], 'String');
$sqlParams[4] = array((string) $bankingDate, 'String');
$sqlParams[5] = array((string) $params['exclude_from_posting'], 'String');
$sqlParams[6] = array((string) $params['contribution_type_id'], 'String');
$sqlParams[7] = array((string) $params['payment_instrument_id'], 'String');
$sqlParams[8] = array((int) $params['id'], 'Integer');
CRM_Core_DAO::executeQuery($batchDetailsSql, $sqlParams);
drupal_goto('civicrm/batch/process', array('query' => array('bid' => $params['id'], 'reset' => '1')));
CRM_Utils_System::civiExit();
}
开发者ID:hoegrammer,项目名称:uk.co.vedaconsulting.module.justgivingImports,代码行数:26,代码来源:Batch.php
示例2: setDefaultValues
/**
* Set the default form values.
*
* @return array
* the default array reference
*/
public function setDefaultValues()
{
$defaults = array();
// note we intentionally overwrite value since we use it as defaults
// and its all pass by value
// we need to figure out the type, so we can either set an array element
// or a scalar -- FIX ME sometime please
foreach ($_GET as $key => $value) {
if (substr($key, 0, 7) == 'custom_' || $key == "preferred_communication_method") {
if (strpos($value, CRM_Core_DAO::VALUE_SEPARATOR) !== FALSE) {
$v = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
$value = array();
foreach ($v as $item) {
if ($item) {
$value[$item] = $item;
}
}
}
} elseif ($key == 'group' || $key == 'tag') {
$v = explode(',', $value);
$value = array();
foreach ($v as $item) {
$value[$item] = 1;
}
} elseif (in_array($key, array('birth_date', 'deceased_date'))) {
list($value) = CRM_Utils_Date::setDateDefaults($value);
}
$defaults[$key] = $value;
}
return $defaults;
}
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:37,代码来源:Search.php
示例3: postProcessStudent
static function postProcessStudent($pickupName, $studentID, $atSchoolMeeting = false)
{
static $_now = null;
static $_date = null;
if (!$_now) {
$_now = CRM_Utils_Date::getToday(null, 'YmdHis');
}
if (!$_date) {
$_date = CRM_Utils_Date::getToday(null, 'Y-m-d');
}
$atSchoolMeeting = $atSchoolMeeting ? '1' : '0';
$sql = "\nSELECT e.id, e.class\nFROM civicrm_value_extended_care_signout e\nWHERE entity_id = %1\nAND DATE(signin_time) = %2\nAND ( is_morning = 0 OR is_morning IS NULL )\n";
$params = array(1 => array($studentID, 'Integer'), 2 => array($_date, 'String'));
$dao = CRM_Core_DAO::executeQuery($sql, $params);
$params = array(1 => array($studentID, 'Integer'), 2 => array($pickupName, 'String'), 3 => array($_now, 'Timestamp'), 4 => array($atSchoolMeeting, 'Integer'));
$class = null;
if ($dao->fetch()) {
$class = $dao->class;
$sql = "\nUPDATE civicrm_value_extended_care_signout\nSET pickup_person_name = %2,\n signout_time = %3,\n at_school_meeting = %4\nWHERE id = %5\n";
$params[5] = array($dao->id, 'Integer');
} else {
$sql = "\nINSERT INTO civicrm_value_extended_care_signout\n( entity_id, pickup_person_name, signout_time, at_school_meeting, is_morning )\nVALUES\n( %1, %2, %3, %4, 0 )\n";
}
CRM_Core_DAO::executeQuery($sql, $params);
return $class;
}
开发者ID:pzingg,项目名称:sfschool,代码行数:26,代码来源:SignOut.php
示例4: 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
示例5: 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
示例6: dateParam
/**
* @param string $fieldName
* @param $field
* @param $defaults
*
* @return bool
*/
public static function dateParam($fieldName, &$field, &$defaults)
{
// type = 12 (datetime) is not recognized by Utils_Type::escape() method,
// and therefore the below hack
$type = 4;
$from = self::getTypedValue("{$fieldName}_from", $type);
$to = self::getTypedValue("{$fieldName}_to", $type);
$relative = CRM_Utils_Array::value("{$fieldName}_relative", $_GET);
if ($relative) {
list($from, $to) = CRM_Report_Form::getFromTo($relative, NULL, NULL);
$from = substr($from, 0, 8);
$to = substr($to, 0, 8);
}
if (!($from || $to)) {
return FALSE;
}
if ($from !== NULL) {
$dateFrom = CRM_Utils_Date::setDateDefaults($from);
if ($dateFrom !== NULL && !empty($dateFrom[0])) {
$defaults["{$fieldName}_from"] = $dateFrom[0];
}
}
if ($to !== NULL) {
$dateTo = CRM_Utils_Date::setDateDefaults($to);
if ($dateTo !== NULL && !empty($dateTo[0])) {
$defaults["{$fieldName}_to"] = $dateTo[0];
}
}
}
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:36,代码来源:Get.php
示例7: setDefaultValues
/**
* Set default values for the form. For edit/view mode
* the default values are retrieved from the database
*
*
* @return array
*/
public function setDefaultValues()
{
$defaults = array();
//Always pass current event's start date by default
$currentEventStartDate = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_id, 'start_date', 'id');
list($defaults['repetition_start_date'], $defaults['repetition_start_date_time']) = CRM_Utils_Date::setDateDefaults($currentEventStartDate, 'activityDateTime');
$recurringEntityDefaults = CRM_Core_Form_RecurringEntity::setDefaultValues();
return array_merge($defaults, $recurringEntityDefaults);
}
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:16,代码来源:Repeat.php
示例8: 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
示例9: formRule
/**
* Enforce valid date ranges.
*
* Borrowed from CRM_Report_Form_Contribute_Repeat::formRule().
*
* @param array $fields
* Fields from the form.
* @param array $files
* Not used.
* @param object $self
* Not used.
*
* @return array
* Array of errors.
*/
public static function formRule($fields, $files, $self)
{
$errors = $checkDate = $errorCount = array();
if ($fields['event_start_date1_relative'] == '0') {
$checkDate['event_start_date1']['event_start_date1_from'] = $fields['event_start_date1_from'];
$checkDate['event_start_date1']['event_start_date1_to'] = $fields['event_start_date1_to'];
}
if ($fields['event_start_date2_relative'] == '0') {
$checkDate['event_start_date2']['event_start_date2_from'] = $fields['event_start_date2_from'];
$checkDate['event_start_date2']['event_start_date2_to'] = $fields['event_start_date2_to'];
}
foreach ($checkDate as $date_range => $range_data) {
foreach ($range_data as $key => $value) {
if (CRM_Utils_Date::isDate($value)) {
$errorCount[$date_range][$key]['valid'] = 'true';
$errorCount[$date_range][$key]['is_empty'] = 'false';
} else {
$errorCount[$date_range][$key]['valid'] = 'false';
$errorCount[$date_range][$key]['is_empty'] = 'true';
if (is_array($value)) {
foreach ($value as $v) {
if ($v) {
$errorCount[$date_range][$key]['is_empty'] = 'false';
}
}
} elseif (!isset($value)) {
$errorCount[$date_range][$key]['is_empty'] = 'false';
}
}
}
}
$errorText = ts("Select valid date range");
foreach ($errorCount as $date_range => $error_data) {
if ($error_data[$date_range . '_from']['valid'] == 'false' && $error_data[$date_range . '_to']['valid'] == 'false') {
if ($error_data[$date_range . '_from']['is_empty'] == 'true' && $error_data[$date_range . '_to']['is_empty'] == 'true') {
$errors[$date_range . '_relative'] = $errorText;
}
if ($error_data[$date_range . '_from']['is_empty'] == 'false') {
$errors[$date_range . '_from'] = $errorText;
}
if ($error_data[$date_range . '_to']['is_empty'] == 'false') {
$errors[$date_range . '_to'] = $errorText;
}
} elseif ($error_data[$date_range . '_from']['valid'] == 'true' && $error_data[$date_range . '_to']['valid'] == 'false') {
if ($error_data[$date_range . '_to']['is_empty'] == 'false') {
$errors[$date_range . '_to'] = $errorText;
}
} elseif ($error_data[$date_range . '_from']['valid'] == 'false' && $error_data[$date_range . '_to']['valid'] == 'true') {
if ($error_data[$date_range . '_from']['is_empty'] == 'false') {
$errors[$date_range . '_from'] = $errorText;
}
}
}
return $errors;
}
开发者ID:aghstrategies,项目名称:com.aghstrategies.orgeventattendees,代码行数:70,代码来源:OrgSummary.php
示例10: 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
示例11: 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&reset=1&gid=7&id=3&snippet=4\\" class=\\"crm-summary-link\\"><div' . ' class=\\"icon crm-icon Individual-icon\\"></div></a>","<a href=/index.php?q=civicrm/contact/view&reset=1&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&reset=1&id=1&cid=3&action=view&context=contribution&' . 'selectedChild=contribute\\" class=\\"action-item crm-hover-button\\" title=\'View Contribution\' >View</a></span>"]] }');
}
开发者ID:rollox,项目名称:civicrm-core,代码行数:16,代码来源:AjaxTest.php
示例12: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
public function preProcess()
{
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0);
$this->assign('bookingId', $this->_id);
$config = CRM_Core_Config::singleton();
/**
* [dateformatDatetime] => %B %E%f, %Y %l:%M %P
* [dateformatFull] => %B %E%f, %Y
* [dateformatPartial] => %B %Y
* [dateformatYear] => %Y
* [dateformatTime] => %l:%M %P
*/
$this->crmDateFormat = $config->dateformatDatetime;
//retrieve crmDateFormat
$this->assign('dateFormat', $this->crmDateFormat);
$days = CRM_Booking_Utils_DateTime::getDays();
$months = CRM_Utils_Date::getFullMonthNames();
$years = CRM_Booking_Utils_DateTime::getYears();
$this->assign('days', $days);
$this->assign('months', $months);
$this->assign('years', $years);
$config = CRM_Core_Config::singleton();
$currencySymbols = "";
if (!empty($config->currencySymbols)) {
$currencySymbols = $config->currencySymbols;
} else {
$currencySymbols = $config->defaultCurrencySymbol;
}
$resourceTypes = CRM_Booking_BAO_Resource::getResourceTypes();
$resources = array();
foreach ($resourceTypes as $key => $type) {
$result = CRM_Booking_BAO_Resource::getResourcesByType($key);
$rTypekey = trim(strtolower($key . '_' . $type['label']));
$resources[$rTypekey]['label'] = $type['label'];
$resources[$rTypekey]['child'] = $result;
}
$this->assign('resources', $resources);
$this->assign('currencySymbols', $currencySymbols);
$config = CRM_Booking_BAO_BookingConfig::getConfig();
$this->assign('colour', CRM_Utils_Array::value('slot_new_colour', $config));
list($xStart, $xSize, $xStep) = CRM_Booking_Utils_DateTime::getCalendarTime();
$this->assign('xStart', $xStart);
$this->assign('xSize', $xSize);
$this->assign('xStep', $xStep);
$this->assign('timeOptions', CRM_Booking_Utils_DateTime::getTimeRange());
if ($this->_id && $this->_action == CRM_Core_Action::UPDATE) {
$title = CRM_Core_DAO::getFieldValue('CRM_Booking_BAO_Booking', $this->_id, 'title', 'id');
CRM_Utils_System::setTitle(ts('Edit Booking') . " - {$title}");
} else {
CRM_Utils_System::setTitle(ts('New Booking'));
}
self::registerScripts();
}
开发者ID:pmevertsen,项目名称:civibooking,代码行数:59,代码来源:SelectResource.php
示例13: testSetGetValuesDate
/**
* Test setValues() and GetValues() methods with custom Date field
*/
public function testSetGetValuesDate()
{
$params = array();
$contactID = $this->individualCreate();
//create Custom Group
$customGroup = $this->customGroupCreate(array('is_multiple' => 1));
//create Custom Field of data type Date
$fields = array('custom_group_id' => $customGroup['id'], 'data_type' => 'Date', 'html_type' => 'Select Date', 'default_value' => '');
$customField = $this->customFieldCreate($fields);
// Retrieve the field ID for sample custom field 'test_Date'
$params = array('label' => 'test_Date');
$field = array();
CRM_Core_BAO_CustomField::retrieve($params, $field);
$fieldID = $customField['id'];
// Set test_Date to a valid date value
$date = '20080608000000';
$params = array('entityID' => $contactID, 'custom_' . $fieldID => $date);
$result = CRM_Core_BAO_CustomValueTable::setValues($params);
$this->assertEquals($result['is_error'], 0, 'Verify that is_error = 0 (success).');
// Check that the date value is stored
$values = array();
$params = array('entityID' => $contactID, 'custom_' . $fieldID => 1);
$values = CRM_Core_BAO_CustomValueTable::getValues($params);
$this->assertEquals($values['is_error'], 0, 'Verify that is_error = 0 (success).');
$this->assertEquals($values['custom_' . $fieldID . '_1'], CRM_Utils_Date::mysqlToIso($date), 'Verify that the date value is stored for contact ' . $contactID);
// Now set test_Date to an invalid date value and try to reset
$badDate = '20080631000000';
$params = array('entityID' => $contactID, 'custom_' . $fieldID => $badDate);
CRM_Core_TemporaryErrorScope::useException();
$message = NULL;
try {
CRM_Core_BAO_CustomValueTable::setValues($params);
} catch (Exception $e) {
$message = $e->getMessage();
}
$errorScope = NULL;
// Check that an exception has been thrown
$this->assertNotNull($message, 'Verify than an exception is thrown when bad date is passed');
$params = array('entityID' => $contactID, 'custom_' . $fieldID => 1);
$values = CRM_Core_BAO_CustomValueTable::getValues($params);
$this->assertEquals($values['custom_' . $fieldID . '_1'], CRM_Utils_Date::mysqlToIso($date), 'Verify that the date value has NOT been updated for contact ' . $contactID);
// Test setting test_Date to null
$params = array('entityID' => $contactID, 'custom_' . $fieldID => NULL);
$result = CRM_Core_BAO_CustomValueTable::setValues($params);
// Check that the date value is empty
$params = array('entityID' => $contactID, 'custom_' . $fieldID => 1);
$values = CRM_Core_BAO_CustomValueTable::getValues($params);
$this->assertEquals($values['is_error'], 0, 'Verify that is_error = 0 (success).');
// Cleanup
$this->customFieldDelete($customField);
$this->customGroupDelete($customGroup['id']);
$this->contactDelete($contactID);
}
开发者ID:nielosz,项目名称:civicrm-core,代码行数:56,代码来源:CustomValueTableSetGetTest.php
示例14: array
/**
* Form rule to validate the date selector and/or if we should deliver
* immediately.
*
* Warning: if you make changes here, be sure to also make them in
* Retry.php
*
* @param array $params The form values
* @return boolean True if either we deliver immediately, or the
* date is properly set.
* @static
*/
function &formRule(&$params)
{
if ($params['now']) {
return true;
}
if (!CRM_Utils_Rule::qfDate($params['start_date'])) {
return array('start_date' => ts('Start date is not valid.'));
}
if (CRM_Utils_Date::format($params['start_date']) < date('YmdHi00')) {
return array('start_date' => ts('Start date cannot be earlier than the current time.'));
}
return true;
}
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:25,代码来源:Schedule.php
示例15: 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
示例16: 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
示例17: setDefaultValues
/**
* This function is called prior to building and submitting the form and after the preProcess
*/
function setDefaultValues()
{
$defaults = array();
$defaults = $this->_values;
// current employer id
$defaults['current_employer_id'] = trim($defaults['employer_id']);
// datum in dienst
if (isset($defaults['Datum_in_dienst'])) {
list($defaults['Datum_in_dienst']) = CRM_Utils_Date::setDateDefaults($defaults['Datum_in_dienst']);
// list is needed or else it does not work
}
return $defaults;
}
开发者ID:jvos,项目名称:nl.vnv.lidmaatschapwijziging_old,代码行数:16,代码来源:LidmaatschapWijzigingContact.php
示例18: 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
示例19: testSetGetValuesDate
function testSetGetValuesDate()
{
$params = array();
$contactID = Contact::createIndividual();
//create Custom Group
$customGroup = Custom::createGroup($params, 'Individual', true);
//create Custom Field of data type Date
$fields = array('groupId' => $customGroup->id, 'dataType' => 'Date', 'htmlType' => 'Select Date');
$customField = Custom::createField($params, $fields);
// Retrieve the field ID for sample custom field 'test_Date'
$params = array('label' => 'test_Date');
$field = array();
require_once 'CRM/Core/BAO/CustomField.php';
CRM_Core_BAO_CustomField::retrieve($params, $field);
$fieldID = $field['id'];
// Set test_Date to a valid date value
$date = '20080608000000';
$params = array('entityID' => $contactID, 'custom_' . $fieldID => $date);
require_once 'CRM/Core/BAO/CustomValueTable.php';
$result = CRM_Core_BAO_CustomValueTable::setValues($params);
$this->assertEquals($result['is_error'], 0, 'Verify that is_error = 0 (success).');
// Check that the date value is stored
$values = array();
$params = array('entityID' => $contactID, 'custom_' . $fieldID => 1);
$values = CRM_Core_BAO_CustomValueTable::getValues($params);
$this->assertEquals($values['is_error'], 0, 'Verify that is_error = 0 (success).');
require_once 'CRM/Utils/Date.php';
$this->assertEquals($values['custom_' . $fieldID . '_1'], CRM_Utils_Date::mysqlToIso($date), 'Verify that the date value is stored for contact ' . $contactID);
// Now set test_Date to an invalid date value and try to reset
$badDate = '20080631000000';
$params = array('entityID' => $contactID, 'custom_' . $fieldID => $badDate);
require_once 'CRM/Core/BAO/CustomValueTable.php';
$result = CRM_Core_BAO_CustomValueTable::setValues($params);
// Check that the error flag is set AND that custom date value has not been modified
$this->assertEquals($result['is_error'], 1, 'Verify that is_error = 1 when bad date is passed.');
$params = array('entityID' => $contactID, 'custom_' . $fieldID => 1);
$values = CRM_Core_BAO_CustomValueTable::getValues($params);
$this->assertEquals($values['custom_' . $fieldID . '_1'], CRM_Utils_Date::mysqlToIso($date), 'Verify that the date value has NOT been updated for contact ' . $contactID);
// Test setting test_Date to null
$params = array('entityID' => $contactID, 'custom_' . $fieldID => null);
require_once 'CRM/Core/BAO/CustomValueTable.php';
$result = CRM_Core_BAO_CustomValueTable::setValues($params);
// Check that the date value is empty
$params = array('entityID' => $contactID, 'custom_' . $fieldID => 1);
$values = CRM_Core_BAO_CustomValueTable::getValues($params);
$this->assertEquals($values['is_error'], 0, 'Verify that is_error = 0 (success).');
// Cleanup
Custom::deleteField($customField);
Custom::deleteGroup($customGroup);
Contact::delete($contactID);
}
开发者ID:ksecor,项目名称:civicrm,代码行数:51,代码来源:CustomValueTableSetGetTest.php
示例20: buildQuickForm
/**
* Function to actually build the form
*
* @return void
* @access public
*/
function buildQuickForm()
{
$this->assignToTemplate();
$productID = $this->get('productID');
$option = $this->get('option');
if ($productID) {
require_once 'CRM/Contribute/BAO/Premium.php';
CRM_Contribute_BAO_Premium::buildPremiumBlock($this, $this->_id, false, $productID, $option);
}
$this->assign('trxn_id', $this->_params['trxn_id']);
$this->assign('receive_date', CRM_Utils_Date::mysqlToIso($this->_params['receive_date']));
// can we blow away the session now to prevent hackery
$this->controller->reset();
}
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:20,代码来源:ThankYou.php
注:本文中的CRM_Utils_Date类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论