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


PHP CRM_Utils_System::isNull方法代码示例

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


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

示例1: format

 /**
  * format a monetary string
  *
  * Format a monetary string basing on the amount provided,
  * ISO currency code provided and a format string consisting of:
  *
  * %a - the formatted amount
  * %C - the currency ISO code (e.g., 'USD') if provided
  * %c - the currency symbol (e.g., '$') if available
  *
  * @param float  $amount    the monetary amount to display (1234.56)
  * @param string $currency  the three-letter ISO currency code ('USD')
  * @param string $format    the desired currency format
  *
  * @return string  formatted monetary string
  *
  * @static
  */
 static function format($amount, $currency = null, $format = null)
 {
     if (CRM_Utils_System::isNull($amount)) {
         return '';
     }
     $config =& CRM_Core_Config::singleton();
     if (!self::$_currencySymbols) {
         require_once "CRM/Core/PseudoConstant.php";
         $currencySymbolName = CRM_Core_PseudoConstant::currencySymbols('name');
         $currencySymbol = CRM_Core_PseudoConstant::currencySymbols();
         self::$_currencySymbols = array_combine($currencySymbolName, $currencySymbol);
     }
     if (!$currency) {
         $currency = $config->defaultCurrency;
     }
     if (!$format) {
         $format = $config->moneyformat;
     }
     // money_format() exists only in certain PHP install (CRM-650)
     if (is_numeric($amount) and function_exists('money_format')) {
         $amount = money_format($config->moneyvalueformat, $amount);
     }
     $replacements = array('%a' => $amount, '%C' => $currency, '%c' => CRM_Utils_Array::value($currency, self::$_currencySymbols, $currency));
     return strtr($format, $replacements);
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:43,代码来源:Money.php

示例2: format

 /**
  * format a monetary string
  *
  * Format a monetary string basing on the amount provided,
  * ISO currency code provided and a format string consisting of:
  *
  * %a - the formatted amount
  * %C - the currency ISO code (e.g., 'USD') if provided
  * %c - the currency symbol (e.g., '$') if available
  *
  * @param float  $amount    the monetary amount to display (1234.56)
  * @param string $currency  the three-letter ISO currency code ('USD')
  * @param string $format    the desired currency format
  *
  * @return string  formatted monetary string
  *
  * @static
  */
 function format($amount, $currency = null, $format = null)
 {
     if (CRM_Utils_System::isNull($amount)) {
         return '';
     }
     if (!$GLOBALS['_CRM_UTILS_MONEY']['currencySymbols']) {
         $GLOBALS['_CRM_UTILS_MONEY']['currencySymbols'] = array('EUR' => '€', 'GBP' => '£', 'ILS' => '₪', 'JPY' => '¥', 'KRW' => '₩', 'LAK' => '₭', 'MNT' => '₮', 'NGN' => '₦', 'PLN' => 'zł', 'THB' => '฿', 'USD' => '$', 'VND' => '₫');
     }
     if (!$currency) {
         if (!$GLOBALS['_CRM_UTILS_MONEY']['config']) {
             $GLOBALS['_CRM_UTILS_MONEY']['config'] =& CRM_Core_Config::singleton();
         }
         $currency = $GLOBALS['_CRM_UTILS_MONEY']['config']->defaultCurrency;
     }
     if (!$format) {
         if (!$GLOBALS['_CRM_UTILS_MONEY']['config']) {
             $GLOBALS['_CRM_UTILS_MONEY']['config'] =& CRM_Core_Config::singleton();
         }
         $format = $GLOBALS['_CRM_UTILS_MONEY']['config']->moneyformat;
     }
     $money = $amount;
     // this function exists only in certain php install (CRM-650)
     if (function_exists('money_format')) {
         $money = money_format('%!i', $amount);
     }
     $replacements = array('%a' => $money, '%C' => $currency, '%c' => CRM_Utils_Array::value($currency, $GLOBALS['_CRM_UTILS_MONEY']['currencySymbols'], $currency));
     return strtr($format, $replacements);
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:46,代码来源:Money.php

示例3: browse

 /**
  * Browse all saved searches.
  *
  * @return mixed
  *   content of the parents run method
  */
 public function browse()
 {
     $rows = array();
     $savedSearch = new CRM_Contact_DAO_SavedSearch();
     $savedSearch->is_active = 1;
     $savedSearch->selectAdd();
     $savedSearch->selectAdd('id, form_values');
     $savedSearch->find();
     $properties = array('id', 'name', 'description');
     while ($savedSearch->fetch()) {
         // get name and description from group object
         $group = new CRM_Contact_DAO_Group();
         $group->saved_search_id = $savedSearch->id;
         if ($group->find(TRUE)) {
             $permissions = CRM_Group_Page_Group::checkPermission($group->id, $group->title);
             if (!CRM_Utils_System::isNull($permissions)) {
                 $row = array();
                 $row['name'] = $group->title;
                 $row['description'] = $group->description;
                 $row['id'] = $savedSearch->id;
                 $formValues = unserialize($savedSearch->form_values);
                 $query = new CRM_Contact_BAO_Query($formValues);
                 $row['query_detail'] = $query->qill();
                 $action = array_sum(array_keys(self::links()));
                 $action = $action & CRM_Core_Action::mask($permissions);
                 $row['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $row['id']), ts('more'), FALSE, 'savedSearch.manage.action', 'SavedSearch', $row['id']);
                 $rows[] = $row;
             }
         }
     }
     $this->assign('rows', $rows);
     return parent::run();
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:39,代码来源:SavedSearch.php

示例4: postProcess

 public function postProcess()
 {
     $params = $this->controller->exportValues($this->_name);
     $parent = $this->controller->getParent();
     $parent->set('searchResult', 1);
     if (!empty($params)) {
         $fields = array('id', 'title', 'event_type_id', 'start_date', 'end_date', 'eventsByDates', 'campaign_id');
         $sql = "SELECT f.column_name\n        FROM civicrm_custom_field f\n        LEFT JOIN civicrm_custom_group g ON g.id = f.custom_group_id\n        WHERE g.name = 'Courses'";
         $dao = CRM_Core_DAO::executeQuery($sql);
         while ($dao->fetch()) {
             $courses[] = $dao->column_name;
         }
         $fields = array_merge($fields, $courses);
         foreach ($fields as $field) {
             if (isset($params[$field]) && !CRM_Utils_System::isNull($params[$field])) {
                 if (substr($field, -4) == 'date') {
                     $time = $field == 'end_date' ? '235959' : NULL;
                     $parent->set($field, CRM_Utils_Date::processDate($params[$field], $time));
                 } else {
                     $parent->set($field, $params[$field]);
                 }
             } else {
                 $parent->set($field, NULL);
             }
         }
     }
 }
开发者ID:JMAConsulting,项目名称:biz.jmaconsulting.pca,代码行数:27,代码来源:SearchEvent.php

示例5: validate

 function validate()
 {
     if (CRM_Utils_System::isNull($this->_value)) {
         return true;
     }
     switch ($this->_name) {
         case 'contact_id':
             // note: we validate extistence of the contact in API, upon
             // insert (it would be too costlty to do a db call here)
             return CRM_Utils_Rule::integer($this->_value);
             break;
         case 'register_date':
             return CRM_Utils_Rule::date($this->_value);
             break;
             /*
                     case 'event_id':
             static $events = null;
             if (!$events) {
                 $events =& CRM_Event_PseudoConstant::event();
             }
             if (in_array($this->_value, $events)) {
                 return true;
             } else {
                 return false;
             }
             break;
             */
         /*
                 case 'event_id':
         static $events = null;
         if (!$events) {
             $events =& CRM_Event_PseudoConstant::event();
         }
         if (in_array($this->_value, $events)) {
             return true;
         } else {
             return false;
         }
         break;
         */
         default:
             break;
     }
     // check whether that's a valid custom field id
     // and if so, check the contents' validity
     if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($this->_name)) {
         static $customFields = null;
         if (!$customFields) {
             $customFields =& CRM_Core_BAO_CustomField::getFields('Membership');
         }
         if (!array_key_exists($customFieldID, $customFields)) {
             return false;
         }
         return CRM_Core_BAO_CustomValue::typecheck($customFields[$customFieldID]['data_type'], $this->_value);
     }
     return true;
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:57,代码来源:Field.php

示例6: preProcess

 /**  
  * Function to set variables up before form is built  
  *                                                            
  * @return void  
  * @access public  
  */
 public function preProcess()
 {
     require_once 'CRM/Event/BAO/Participant.php';
     $values = $ids = array();
     $participantID = CRM_Utils_Request::retrieve('id', 'Positive', $this, true);
     $contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this, true);
     $params = array('id' => $participantID);
     CRM_Event_BAO_Participant::getValues($params, $values, $ids);
     if (empty($values)) {
         require_once 'CRM/Core/Error.php';
         CRM_Core_Error::statusBounce(ts('The requested participant record does not exist (possibly the record was deleted).'));
     }
     CRM_Event_BAO_Participant::resolveDefaults($values[$participantID]);
     if (CRM_Utils_Array::value('fee_level', $values[$participantID])) {
         CRM_Event_BAO_Participant::fixEventLevel($values[$participantID]['fee_level']);
     }
     if ($values[$participantID]['is_test']) {
         $values[$participantID]['status'] .= ' (test) ';
     }
     // Get Note
     $noteValue = CRM_Core_BAO_Note::getNote($participantID, 'civicrm_participant');
     $values[$participantID]['note'] = array_values($noteValue);
     require_once 'CRM/Price/BAO/LineItem.php';
     // Get Line Items
     $lineItem = CRM_Price_BAO_LineItem::getLineItems($participantID);
     if (!CRM_Utils_System::isNull($lineItem)) {
         $values[$participantID]['lineItem'][] = $lineItem;
     }
     $values[$participantID]['totalAmount'] = $values[$participantID]['fee_amount'];
     // get the option value for custom data type
     $roleCustomDataTypeID = CRM_Core_OptionGroup::getValue('custom_data_type', 'ParticipantRole', 'name');
     $eventNameCustomDataTypeID = CRM_Core_OptionGroup::getValue('custom_data_type', 'ParticipantEventName', 'name');
     $eventTypeCustomDataTypeID = CRM_Core_OptionGroup::getValue('custom_data_type', 'ParticipantEventType', 'name');
     $roleGroupTree =& CRM_Core_BAO_CustomGroup::getTree('Participant', $this, $participantID, null, $values[$participantID]['role_id'], $roleCustomDataTypeID);
     $eventGroupTree =& CRM_Core_BAO_CustomGroup::getTree('Participant', $this, $participantID, null, $values[$participantID]['event_id'], $eventNameCustomDataTypeID);
     $eventTypeID = CRM_Core_DAO::getFieldValue("CRM_Event_DAO_Event", $values[$participantID]['event_id'], 'event_type_id', 'id');
     $eventTypeGroupTree =& CRM_Core_BAO_CustomGroup::getTree('Participant', $this, $participantID, null, $eventTypeID, $eventTypeCustomDataTypeID);
     $groupTree = CRM_Utils_Array::crmArrayMerge($roleGroupTree, $eventGroupTree);
     $groupTree = CRM_Utils_Array::crmArrayMerge($groupTree, $eventTypeGroupTree);
     $groupTree = CRM_Utils_Array::crmArrayMerge($groupTree, CRM_Core_BAO_CustomGroup::getTree('Participant', $this, $participantID));
     CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree);
     $this->assign($values[$participantID]);
     // add viewed participant to recent items list
     require_once 'CRM/Utils/Recent.php';
     require_once 'CRM/Contact/BAO/Contact.php';
     $url = CRM_Utils_System::url('civicrm/contact/view/participant', "action=view&reset=1&id={$values[$participantID]['id']}&cid={$values[$participantID]['contact_id']}&context=home");
     $participantRoles = CRM_Event_PseudoConstant::participantRole();
     $eventTitle = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $values[$participantID]['event_id'], 'title');
     $displayName = CRM_Contact_BAO_Contact::displayName($contactID);
     $this->assign('displayName', $displayName);
     $title = $displayName . ' (' . $participantRoles[$values[$participantID]['role_id']] . ' - ' . $eventTitle . ')';
     // add Participant to Recent Items
     CRM_Utils_Recent::add($title, $url, $values[$participantID]['id'], 'Participant', $values[$participantID]['contact_id'], null);
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:60,代码来源:ParticipantView.php

示例7: validateSchedule

 /**
  * Determine whether a schedule based on this mapping is sufficiently
  * complete.
  *
  * @param \CRM_Core_DAO_ActionSchedule $schedule
  * @return array
  *   Array (string $code => string $message).
  *   List of error messages.
  */
 public function validateSchedule($schedule)
 {
     $errors = array();
     if (CRM_Utils_System::isNull($schedule->entity_value) || $schedule->entity_value === '0') {
         $errors['entity'] = ts('Please select a specific date field.');
     } elseif (count(CRM_Utils_Array::explodePadded($schedule->entity_value)) > 1) {
         $errors['entity'] = ts('You may only select one contact field per reminder');
     } elseif (CRM_Utils_System::isNull($schedule->entity_status) || $schedule->entity_status === '0') {
         $errors['entity'] = ts('Please select whether the reminder is sent each year.');
     }
     return $errors;
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:21,代码来源:ActionMapping.php

示例8: validate

 function validate()
 {
     if (CRM_Utils_System::isNull($this->_value)) {
         return TRUE;
     }
     switch ($this->_name) {
         case 'contact_id':
             // note: we validate extistence of the contact in API, upon
             // insert (it would be too costlty to do a db call here)
             return CRM_Utils_Rule::integer($this->_value);
         default:
             break;
     }
 }
开发者ID:JoeMurray,项目名称:civihr,代码行数:14,代码来源:Field.php

示例9: postProcess

 public function postProcess()
 {
     $params = $this->controller->exportValues($this->_name);
     $parent = $this->controller->getParent();
     if (!empty($params)) {
         $fields = array('title', 'created_by', 'group_type', 'visibility', 'active_status', 'inactive_status');
         foreach ($fields as $field) {
             if (isset($params[$field]) && !CRM_Utils_System::isNull($params[$field])) {
                 $parent->set($field, $params[$field]);
             } else {
                 $parent->set($field, NULL);
             }
         }
     }
 }
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:15,代码来源:Search.php

示例10: postProcess

 function postProcess()
 {
     $params = $this->controller->exportValues($this->_name);
     $parent = $this->controller->getParent();
     $parent->set('searchResult', 1);
     if (!empty($params)) {
         $fields = array('title', 'event_type_id', 'start_date', 'end_date', 'auctionsByDates');
         foreach ($fields as $field) {
             if (isset($params[$field]) && !CRM_Utils_System::isNull($params[$field])) {
                 $parent->set($field, $params[$field]);
             } else {
                 $parent->set($field, null);
             }
         }
     }
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:16,代码来源:SearchAuction.php

示例11: postProcess

 public function postProcess()
 {
     $params = $this->controller->exportValues($this->_name);
     $parent = $this->controller->getParent();
     $parent->set('searchResult', 1);
     if (!empty($params)) {
         $fields = array('title', 'financial_type_id', 'campaign_id');
         foreach ($fields as $field) {
             if (isset($params[$field]) && !CRM_Utils_System::isNull($params[$field])) {
                 $parent->set($field, $params[$field]);
             } else {
                 $parent->set($field, NULL);
             }
         }
     }
 }
开发者ID:kidaa30,项目名称:yes,代码行数:16,代码来源:SearchContribution.php

示例12: format

 /**
  * format a monetary string
  *
  * Format a monetary string basing on the amount provided,
  * ISO currency code provided and a format string consisting of:
  *
  * %a - the formatted amount
  * %C - the currency ISO code (e.g., 'USD') if provided
  * %c - the currency symbol (e.g., '$') if available
  *
  * @param float  $amount    the monetary amount to display (1234.56)
  * @param string $currency  the three-letter ISO currency code ('USD')
  * @param string $format    the desired currency format
  *
  * @return string  formatted monetary string
  *
  * @static
  */
 static function format($amount, $currency = NULL, $format = NULL, $onlyNumber = FALSE)
 {
     if (CRM_Utils_System::isNull($amount)) {
         return '';
     }
     $config = CRM_Core_Config::singleton();
     if (!$format) {
         $format = $config->moneyformat;
     }
     if ($onlyNumber) {
         // money_format() exists only in certain PHP install (CRM-650)
         if (is_numeric($amount) and function_exists('money_format')) {
             $amount = money_format($config->moneyvalueformat, $amount);
         }
         return $amount;
     }
     if (!self::$_currencySymbols) {
         $currencySymbolName = CRM_Core_PseudoConstant::currencySymbols('name');
         $currencySymbol = CRM_Core_PseudoConstant::currencySymbols();
         self::$_currencySymbols = array_combine($currencySymbolName, $currencySymbol);
     }
     if (!$currency) {
         $currency = $config->defaultCurrency;
     }
     if (!$format) {
         $format = $config->moneyformat;
     }
     // money_format() exists only in certain PHP install (CRM-650)
     // setlocale() affects native gettext (CRM-11054, CRM-9976)
     if (is_numeric($amount) && function_exists('money_format')) {
         $lc = setlocale(LC_MONETARY, 0);
         setlocale(LC_MONETARY, 'en_US.utf8', 'en_US', 'en_US.utf8', 'en_US', 'C');
         $amount = money_format($config->moneyvalueformat, $amount);
         setlocale(LC_MONETARY, $lc);
     }
     $rep = array(',' => $config->monetaryThousandSeparator, '.' => $config->monetaryDecimalPoint);
     // If it contains tags, means that HTML was passed and the
     // amount is already converted properly,
     // so don't mess with it again.
     if (strip_tags($amount) === $amount) {
         $money = strtr($amount, $rep);
     } else {
         $money = $amount;
     }
     $replacements = array('%a' => $money, '%C' => $currency, '%c' => CRM_Utils_Array::value($currency, self::$_currencySymbols, $currency));
     return strtr($format, $replacements);
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:65,代码来源:Money.php

示例13: postProcess

 function postProcess()
 {
     $params = $this->controller->exportValues($this->_name);
     $parent = $this->controller->getParent();
     if (!empty($params)) {
         $fields = array('mailing_name', 'mailing_from', 'mailing_to', 'sort_name');
         foreach ($fields as $field) {
             if (isset($params[$field]) && !CRM_Utils_System::isNull($params[$field])) {
                 if (substr($field, 7) != 'name') {
                     $parent->set($field, CRM_Utils_Date::unformat(CRM_Utils_Date::processDate($params[$field]), ''));
                 } else {
                     $parent->set($field, $params[$field]);
                 }
             } else {
                 $parent->set($field, null);
             }
         }
     }
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:19,代码来源:Search.php

示例14: postProcess

 function postProcess()
 {
     $params = $this->controller->exportValues($this->_name);
     $parent = $this->controller->getParent();
     $parent->set('searchResult', 1);
     if (!empty($params)) {
         $fields = array('title', 'event_type_id', 'start_date', 'end_date', 'eventsByDates', 'campaign_id');
         foreach ($fields as $field) {
             if (isset($params[$field]) && !CRM_Utils_System::isNull($params[$field])) {
                 if (substr($field, -4) == 'date') {
                     $time = $field == 'end_date' ? '235959' : NULL;
                     $parent->set($field, CRM_Utils_Date::processDate($params[$field], $time));
                 } else {
                     $parent->set($field, $params[$field]);
                 }
             } else {
                 $parent->set($field, NULL);
             }
         }
     }
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:21,代码来源:SearchEvent.php

示例15: postProcess

 function postProcess()
 {
     $params = $this->controller->exportValues($this->_name);
     CRM_Contact_BAO_Query::fixDateValues($params["mailing_relative"], $params['mailing_from'], $params['mailing_to']);
     $parent = $this->controller->getParent();
     if (!empty($params)) {
         $fields = array('mailing_name', 'mailing_from', 'mailing_to', 'sort_name', 'campaign_id', 'mailing_status', 'sms');
         foreach ($fields as $field) {
             if (isset($params[$field]) && !CRM_Utils_System::isNull($params[$field])) {
                 if (in_array($field, array('mailing_from', 'mailing_to')) && !$params["mailing_relative"]) {
                     $time = $field == 'mailing_to' ? '235959' : NULL;
                     $parent->set($field, CRM_Utils_Date::processDate($params[$field], $time));
                 } else {
                     $parent->set($field, $params[$field]);
                 }
             } else {
                 $parent->set($field, NULL);
             }
         }
     }
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:21,代码来源:Search.php


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