+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
* $Id$
*
*/
class CRM_Core_BAO_Note extends CRM_Core_DAO_Note {
/**
- * Const the max number of notes we display at any given time
+ * Const the max number of notes we display at any given time.
* @var int
*/
const MAX_NOTES = 3;
* @return string
* the note text or NULL if note not found
*
- * @static
*/
public static function getNoteText($id) {
return CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Note', $id, 'note');
* @return string
* the note subject or NULL if note not found
*
- * @static
*/
public static function getNoteSubject($id) {
return CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Note', $id, 'subject');
* @param object $note
* Either the id of the note to retrieve, or the CRM_Core_DAO_Note object itself.
*
- * @return boolean
+ * @return bool
* TRUE if the note should be displayed, otherwise FALSE
*
- * @static
*/
public static function getNotePrivacyHidden($note) {
if (CRM_Core_Permission::check('view all notes')) {
}
/**
- * Takes an associative array and creates a note object
+ * Takes an associative array and creates a note object.
*
* the function extract all the params it needs to initialize the create a
* note object. the params array could contain additional unused name/value
*
* @return object
* $note CRM_Core_BAO_Note object
- * @static
*/
- public static function &add(&$params, $ids = array()) {
+ public static function add(&$params, $ids = array()) {
$dataExists = self::dataExists($params);
if (!$dataExists) {
return CRM_Core_DAO::$_nullObject;
}
/**
- * 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
*
* @return object
* $notes Object of CRM_Core_BAO_Note
- * @static
*/
public static function &getValues(&$params, &$values, $numNotes = self::MAX_NOTES) {
if (empty($params)) {
}
/**
- * Delete the notes
+ * Delete the notes.
*
* @param int $id
* Note id.
* @param bool $showStatus
* Do we need to set status or not.
*
- * @return mixed|NULL $return no of deleted notes on success, FALSE otherwise
- * @access public
- * @static
+ * @return int|NULL
+ * no of deleted notes on success, null otherwise
*/
public static function del($id, $showStatus = TRUE) {
$return = NULL;
}
/**
- * Delete all records for this contact id
+ * Delete all records for this contact id.
*
* @param int $id
* ID of the contact for which note needs to be deleted.
*
* @return void
*
- * @static
*/
public static function deleteContact($id) {
// need to delete for both entity_id
* @return array
* array of note properties
*
- * @static
*/
public static function &getNote($id, $entityTable = 'civicrm_relationship') {
$viewNote = array();
}
/**
- * Get log record count for a Contact
+ * Get log record count for a Contact.
*
* @param int $contactID
*
* @return int
* $count count of log records
*
- * @static
*/
public static function getContactNoteCount($contactID) {
$note = new CRM_Core_DAO_Note();
}
/**
- * Get all descendent notes of the note with given ID
+ * Get all descendent notes of the note with given ID.
*
* @param int $parentId
* ID of the note to start from.
* @return array
* Nested associative array beginning with direct children of given note.
*
- * @static
*/
public static function getNoteTree($parentId, $maxDepth = 0, $snippet = FALSE) {
return self::buildNoteTree($parentId, $maxDepth, $snippet);
}
/**
- * Get total count of direct children visible to the current user
+ * Get total count of direct children visible to the current user.
*
* @param int $id
* Note ID.
* @return int
* $count Number of notes having the give note as parent
*
- * @static
*/
public static function getChildCount($id) {
$note = new CRM_Core_DAO_Note();
}
/**
- * Recursive function to get all descendent notes of the note with given ID
+ * Recursive function to get all descendent notes of the note with given ID.
*
* @param int $parentId
* ID of the note to start from.
*
* @return array
* Nested associative array beginning with direct children of given note.
- * @static
*/
private static function buildNoteTree($parentId, $maxDepth = 0, $snippet = FALSE, &$tree = array(), $depth = 0) {
if ($maxDepth && $depth > $maxDepth) {
}
/**
- * Delete all note related to contact when contact is deleted
+ * Delete all note related to contact when contact is deleted.
*
* @param int $contactID
* Contact id whose notes to be deleted.
*
* @return void
- * @static
*/
public static function cleanContactNotes($contactID) {
$params = array(1 => array($contactID, 'Integer'));
self::del($contactNoteId->id, FALSE);
}
}
+
}