/** * This function is called when action is browse * * return null * @access public */ function browse() { $note =& new CRM_Core_DAO_Note(); $note->entity_table = 'civicrm_contact'; $note->entity_id = $this->_contactId; $note->orderBy('modified_date desc'); $values = array(); $links =& CRM_Contact_Page_View_Note::links(); $action = array_sum(array_keys($links)) & CRM_Core_Action::mask($this->_permission); $note->find(); while ($note->fetch()) { $values[$note->id] = array(); CRM_Core_DAO::storeValues($note, $values[$note->id]); $values[$note->id]['action'] = CRM_Core_Action::formLink($links, $action, array('id' => $note->id, 'cid' => $this->_contactId)); $contact = new CRM_Contact_DAO_Contact(); $contact->id = $note->contact_id; $contact->find(); $contact->fetch(); $values[$note->id]['createdBy'] = $contact->display_name; } $this->assign('notes', $values); }
/** * Get action links for comments * * @return array (reference) of action links * @static */ static function &commentLinks() { if (!self::$_commentLinks) { $deleteExtra = ts('Are you sure you want to delete this comment?'); self::$_commentLinks = array(CRM_Core_Action::VIEW => array('name' => ts('View'), 'url' => 'civicrm/contact/view/note', 'qs' => 'action=view&reset=1&cid=%%cid%%&id={id}&selectedChild=note', 'title' => ts('View Comment')), CRM_Core_Action::UPDATE => array('name' => ts('Edit'), 'url' => 'civicrm/contact/view/note', 'qs' => 'action=update&reset=1&cid=%%cid%%&id={id}&parentId=%%pid%%&selectedChild=note', 'title' => ts('Edit Comment')), CRM_Core_Action::DELETE => array('name' => ts('Delete'), 'url' => 'civicrm/contact/view/note', 'qs' => 'action=delete&reset=1&cid=%%cid%%&id={id}&selectedChild=note', 'extra' => 'onclick = "if (confirm(\'' . $deleteExtra . '\') ) this.href+=\'&confirmed=1\'; else return false;"', 'title' => ts('Delete Comment'))); } return self::$_commentLinks; }
/** * Get action links for comments. * * @return array * (reference) of action links */ public static function &commentLinks() { if (!self::$_commentLinks) { self::$_commentLinks = array(CRM_Core_Action::VIEW => array('name' => ts('View'), 'url' => 'civicrm/contact/view/note', 'qs' => 'action=view&reset=1&cid=%%cid%%&id={id}&selectedChild=note', 'title' => ts('View Comment')), CRM_Core_Action::UPDATE => array('name' => ts('Edit'), 'url' => 'civicrm/contact/view/note', 'qs' => 'action=update&reset=1&cid=%%cid%%&id={id}&parentId=%%pid%%&selectedChild=note', 'title' => ts('Edit Comment')), CRM_Core_Action::DELETE => array('name' => ts('Delete'), 'url' => 'civicrm/contact/view/note', 'qs' => 'action=delete&reset=1&cid=%%cid%%&id={id}&selectedChild=note', 'title' => ts('Delete Comment'))); } return self::$_commentLinks; }