| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
class CRM_Core_BAO_Location extends CRM_Core_DAO {
/**
- * Location block element array
+ * Location block element array.
*/
static $blocks = array('phone', 'email', 'im', 'openid', 'address');
/**
- * Create various elements of location block
+ * Create various elements of location block.
*
* @param array $params
* (reference ) an assoc array of name/value pairs.
*
* @param null $entity
*
- * @return array $location
- * @static
+ * @return array
*/
public static function create(&$params, $fixAddress = TRUE, $entity = NULL) {
$location = array();
}
/**
- * Creates the entry in the civicrm_loc_block
- *
+ * Creates the entry in the civicrm_loc_block.
*/
public static function createLocBlock(&$location, &$entityElements) {
$locId = self::findExisting($entityElements);
}
foreach (array(
- 'phone', 'email', 'im', 'address') as $loc) {
+ 'phone',
+ 'email',
+ 'im',
+ 'address',
+ ) as $loc) {
$locBlock["{$loc}_id"] = !empty($location["$loc"][0]) ? $location["$loc"][0]->id : NULL;
$locBlock["{$loc}_2_id"] = !empty($location["$loc"][1]) ? $location["$loc"][1]->id : NULL;
}
}
/**
- * Takes an entity array and finds the existing location block
- * @static
+ * Takes an entity array and finds the existing location block.
*/
public static function findExisting($entityElements) {
- $eid = $entityElements['entity_id'];
+ $eid = $entityElements['entity_id'];
$etable = $entityElements['entity_table'];
- $query = "
+ $query = "
SELECT e.loc_block_id as locId
FROM {$etable} e
WHERE e.id = %1";
}
/**
- * Takes an associative array and adds location block
+ * Takes an associative array and adds location block.
*
* @param array $params
* (reference ) an assoc array of name/value pairs.
*
- * @return object CRM_Core_BAO_locBlock object on success, null otherwise
- * @static
+ * @return object
+ * CRM_Core_BAO_locBlock object on success, null otherwise
*/
public static function addLocBlock(&$params) {
$locBlock = new CRM_Core_DAO_LocBlock();
}
/**
- * Delete the Location Block
+ * Delete the Location Block.
*
* @param int $locBlockId
* Id of the Location Block.
*
* @return void
- * @static
*/
public static function deleteLocBlock($locBlockId) {
if (!$locBlockId) {
}
/**
- * Check if there is data to create the object
+ * Check if there is data to create the object.
*
* @param array $params
* (reference ) an assoc array of name/value pairs.
*
- * @return boolean
- * @static
+ * @return bool
*/
public static function dataExists(&$params) {
// return if no data present
* @param $entityBlock
* @param bool $microformat
*
- * @return array array of objects(CRM_Core_BAO_Location)
- * @static
+ * @return array
+ * array of objects(CRM_Core_BAO_Location)
*/
public static function &getValues($entityBlock, $microformat = FALSE) {
if (empty($entityBlock)) {
}
/**
- * Delete all the block associated with the location
+ * Delete all the block associated with the location.
*
* @param int $contactId
* Contact id.
* Id of the location to delete.
*
* @return void
- * @static
*/
public static function deleteLocationBlocks($contactId, $locationTypeId) {
// ensure that contactId has a value
* @param int $updateLocBlockId
* Update location block id.
*
- * @return int newly created/updated location block id.
+ * @return int
+ * newly created/updated location block id.
*/
public static function copyLocBlock($locBlockId, $updateLocBlockId = NULL) {
//get the location info.
//copy all location blocks (email, phone, address, etc)
foreach ($defaults as $key => $value) {
if ($key != 'id') {
- $tbl = explode("_", $key);
- $name = ucfirst($tbl[0]);
+ $tbl = explode("_", $key);
+ $name = ucfirst($tbl[0]);
$updateParams = NULL;
if ($updateId = CRM_Utils_Array::value($key, $updateValues)) {
$updateParams = array('id' => $updateId);
* @param int $contactId
* Contact id.
*
- * @static
*/
public static function checkPrimaryBlocks($contactId) {
if (!$contactId) {
$nonPrimaryBlockIds = CRM_Contact_BAO_Contact::getLocBlockIds($contactId, array('is_primary' => 0));
foreach (array(
- 'Email', 'IM', 'Phone', 'Address', 'OpenID') as $block) {
+ 'Email',
+ 'IM',
+ 'Phone',
+ 'Address',
+ 'OpenID',
+ ) as $block) {
$name = strtolower($block);
if (array_key_exists($name, $primaryLocBlockIds) &&
!CRM_Utils_System::isNull($primaryLocBlockIds[$name])
// Format for js
else {
- // Option-groups for multiple categories
+ // Option-groups for multiple categories
if ($result && count($values) > 1) {
$elements[] = array(
'value' => CRM_Core_PseudoConstant::$valueType($val, FALSE),
'children' => array(),
);
- $list = & $elements[count($elements) - 1]['children'];
+ $list = &$elements[count($elements) - 1]['children'];
}
foreach ($result as $id => $name) {
$list[] = array(
}
return $elements;
}
+
}