*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
- * Business object for managing custom data groups
- *
+ * Business object for managing custom data groups.
*/
class CRM_Core_BAO_CustomGroup extends CRM_Core_DAO_CustomGroup {
if ((!empty($params['is_multiple']) || $isMultiple) &&
($params['is_multiple'] != $isMultiple)
) {
- $oldTableName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup',
+ $oldTableName = CRM_Core_DAO::getFieldValue(
+ 'CRM_Core_DAO_CustomGroup',
$params['id'],
'table_name'
);
* (reference) the group tree being build.
* @param string $table
* Table name.
- * @param unknown_type $groupID
+ * @param int $groupID
* Custom group ID.
- * @param unknown_type $fieldID
+ * @param int $fieldID
* Custom field ID.
*/
static public function buildCustomFieldData($dao, &$groupTree, $table, $groupID, $fieldID) {
*
* @return string
* title
- *
*/
public static function getTitle($id) {
return CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $id, 'title');
*
* @return array
* array consisting of all group and field details
- *
- *
*/
public static function &getGroupDetail($groupId = NULL, $searchable = NULL, &$extends = NULL, $inSelector = NULL) {
// create a new tree
*
* @param int $entityID
* @param bool $allSubtypes
- *
- * @return void
- *
*/
private static function _addWhereAdd(&$customGroupDAO, $entityType, $entityID = NULL, $allSubtypes = FALSE) {
$addSubtypeClause = FALSE;
/**
* Delete the Custom Group.
*
- * @param $group
- * Object the DAO custom group object.
+ * @param CRM_Core_BAO_CustomGroup $group
+ * Custom group object.
* @param bool $force
* whether to force the deletion, even if there are custom fields.
*
* @return bool
- * false if field exists for this group, true if group gets deleted.
+ * False if field exists for this group, true if group gets deleted.
*/
public static function deleteGroup($group, $force = FALSE) {
- //check wheter this contain any custom fields
+ //check whether this contain any custom fields
$customField = new CRM_Core_DAO_CustomField();
$customField->custom_group_id = $group->id;
$customField->find();
}
/**
- * @param $groupTree
- * @param $defaults
+ * Set defaults.
+ *
+ * @param array $groupTree
+ * @param array $defaults
* @param bool $viewMode
* @param bool $inactiveNeeded
* @param int $action
}
/**
- * @param $groupTree
+ * PostProcess function.
+ *
+ * @param array $groupTree
* @param array $params
* @param bool $skipFile
*/
* Return inactive custom groups.
* @param string $prefix
* Prefix for custom grouptree assigned to template.
- *
- * @return void
*/
public static function buildQuickForm(&$form, &$groupTree, $inactiveNeeded = FALSE, $prefix = '') {
$form->assign_by_ref("{$prefix}groupTree", $groupTree);
}
/**
- * Extract the get params from the url, validate
- * and store it in session
+ * Extract the get params from the url, validate and store it in session.
*
* @param CRM_Core_Form $form
* The form object.
switch ($dataType) {
case 'Date':
- $customTimeFormat = '';
$customFormat = NULL;
- switch ($timeFormat) {
- case 1:
- $customTimeFormat = '%l:%M %P';
- break;
-
- case 2:
- $customTimeFormat = '%H:%M';
- break;
-
- default:
- // if time is not selected remove time from value
- $value = substr($value, 0, 10);
- }
-
- $supportableFormats = array(
- 'mm/dd' => "%B %E%f $customTimeFormat",
- 'dd-mm' => "%E%f %B $customTimeFormat",
- 'yy' => "%Y $customTimeFormat",
- 'M yy' => "%b %Y $customTimeFormat",
- 'yy-mm' => "%Y-%m $customTimeFormat",
- );
+ $actualPHPFormats = CRM_Core_SelectValues::datePluginToPHPFormats();
if ($format = CRM_Utils_Array::value('date_format', $field)) {
- if (array_key_exists($format, $supportableFormats)) {
- $customFormat = $supportableFormats["$format"];
+ if (array_key_exists($format, $actualPHPFormats)) {
+ $customTimeFormat = (array) CRM_Utils_Array::value($format, $actualPHPFormats);
+ switch ($timeFormat) {
+ case 1:
+ $customTimeFormat[] = 'g:iA';
+ break;
+
+ case 2:
+ $customTimeFormat[] = 'G:i';
+ break;
+
+ default:
+ // if time is not selected remove time from value
+ $value = substr($value, 0, 10);
+ }
+ $customFormat = implode(" ", $customTimeFormat);
}
}
-
- $retValue = CRM_Utils_Date::customFormat($value, $customFormat);
+ $retValue = CRM_Utils_Date::processDate($value, NULL, FALSE, $customFormat);
break;
case 'Boolean':