本文整理汇总了PHP中CRM_Core_DAO_Note::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_DAO_Note::orderBy方法的具体用法?PHP CRM_Core_DAO_Note::orderBy怎么用?PHP CRM_Core_DAO_Note::orderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_DAO_Note
的用法示例。
在下文中一共展示了CRM_Core_DAO_Note::orderBy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: browse
/**
* called when action is browse.
*/
public function browse()
{
$note = new CRM_Core_DAO_Note();
$note->entity_table = 'civicrm_contact';
$note->entity_id = $this->_contactId;
$note->orderBy('modified_date desc');
//CRM-4418, handling edit and delete separately.
$permissions = array($this->_permission);
if ($this->_permission == CRM_Core_Permission::EDIT) {
//previously delete was subset of edit
//so for consistency lets grant delete also.
$permissions[] = CRM_Core_Permission::DELETE;
}
$mask = CRM_Core_Action::mask($permissions);
$values = array();
$links = self::links();
$action = array_sum(array_keys($links)) & $mask;
$note->find();
while ($note->fetch()) {
if (!CRM_Core_BAO_Note::getNotePrivacyHidden($note)) {
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), ts('more'), FALSE, 'note.selector.row', 'Note', $note->id);
$contact = new CRM_Contact_DAO_Contact();
$contact->id = $note->contact_id;
$contact->find();
$contact->fetch();
$values[$note->id]['createdBy'] = $contact->display_name;
$values[$note->id]['comment_count'] = CRM_Core_BAO_Note::getChildCount($note->id);
// paper icon view for attachments part
$paperIconAttachmentInfo = CRM_Core_BAO_File::paperIconAttachment('civicrm_note', $note->id);
$values[$note->id]['attachment'] = $paperIconAttachmentInfo;
}
}
$this->assign('notes', $values);
$commentLinks = self::commentLinks();
$action = array_sum(array_keys($commentLinks)) & $mask;
$commentAction = CRM_Core_Action::formLink($commentLinks, $action, array('id' => $note->id, 'pid' => $note->entity_id, 'cid' => $note->entity_id), ts('more'), FALSE, 'note.comment.action', 'Note', $note->id);
$this->assign('commentAction', $commentAction);
$this->ajaxResponse['tabCount'] = CRM_Contact_BAO_Contact::getCountComponent('note', $this->_contactId);
}
示例2: buildNoteTree
/**
* Recursive function to get all descendent notes of the note with given ID.
*
* @param int $parentId
* ID of the note to start from.
* @param int $maxDepth
* Maximum number of levels to descend into the tree; if not given, will include all descendents.
* @param bool $snippet
* If TRUE, returned values will be pre-formatted for display in a table of notes.
* @param array $tree
* (Reference) Variable to store all found descendents.
* @param int $depth
* Depth of current iteration within the descendent tree (used for comparison against maxDepth).
*
* @return array
* Nested associative array beginning with direct children of given note.
*/
private static function buildNoteTree($parentId, $maxDepth = 0, $snippet = FALSE, &$tree = array(), $depth = 0)
{
if ($maxDepth && $depth > $maxDepth) {
return FALSE;
}
// get direct children of given parentId note
$note = new CRM_Core_DAO_Note();
$note->entity_table = 'civicrm_note';
$note->entity_id = $parentId;
$note->orderBy('modified_date asc');
$note->find();
while ($note->fetch()) {
// foreach child, call this function, unless the child is private/hidden
if (!self::getNotePrivacyHidden($note)) {
CRM_Core_DAO::storeValues($note, $tree[$note->id]);
// get name of user that created this note
$contact = new CRM_Contact_DAO_Contact();
$createdById = $note->contact_id;
$contact->id = $createdById;
$contact->find();
$contact->fetch();
$tree[$note->id]['createdBy'] = $contact->display_name;
$tree[$note->id]['createdById'] = $createdById;
$tree[$note->id]['modified_date'] = CRM_Utils_Date::customFormat($tree[$note->id]['modified_date']);
// paper icon view for attachments part
$paperIconAttachmentInfo = CRM_Core_BAO_File::paperIconAttachment('civicrm_note', $note->id);
$tree[$note->id]['attachment'] = $paperIconAttachmentInfo ? implode('', $paperIconAttachmentInfo) : '';
if ($snippet) {
$tree[$note->id]['note'] = nl2br($tree[$note->id]['note']);
$tree[$note->id]['note'] = smarty_modifier_mb_truncate($tree[$note->id]['note'], 80, '...', TRUE);
CRM_Utils_Date::customFormat($tree[$note->id]['modified_date']);
}
self::buildNoteTree($note->id, $maxDepth, $snippet, $tree[$note->id]['child'], $depth + 1);
}
}
return $tree;
}
示例3: buildNoteTree
/**
* Recursive function to get all descendent notes of the note with given ID
* @param int $parentId ID of the note to start from
* @param int $maxDepth Maximum number of levels to descend into the tree; if not given, will include all descendents.
* @param bool $snippet If TRUE, returned values will be pre-formatted for display in a table of notes.
* @param array $tree (Reference) Variable to store all found descendents
* @param int $depth Depth of current iteration within the descendent tree (used for comparison against maxDepth)
* @return array Nested associative array beginning with direct children of given note.
*/
private static function buildNoteTree($parentId, $maxDepth = 0, $snippet = FALSE, &$tree = array(), $depth = 0)
{
if ($maxDepth && $depth > $maxDepth) {
return;
}
// get direct children of given parentId note
$note = new CRM_Core_DAO_Note();
$note->entity_table = 'civicrm_note';
$note->entity_id = $parentId;
$note->orderBy('modified_date asc');
$note->find();
while ($note->fetch()) {
// foreach child, call this function, unless the child is private/hidden
if (!self::getNotePrivacyHidden($note)) {
CRM_Core_DAO::storeValues($note, $tree[$note->id]);
// get name of user that created this note
require_once 'CRM/Contact/DAO/Contact.php';
require_once 'CRM/Core/Smarty/plugins/modifier.mb_truncate.php';
$contact = new CRM_Contact_DAO_Contact();
$createdById = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Note', $parentId, 'entity_id');
$contact->id = $createdById;
$contact->find();
$contact->fetch();
$tree[$note->id]['createdBy'] = $contact->display_name;
$tree[$note->id]['createdById'] = $createdById;
$tree[$note->id]['modified_date'] = CRM_Utils_Date::customFormat($tree[$note->id]['modified_date']);
if ($snippet) {
$tree[$note->id]['note'] = nl2br($tree[$note->id]['note']);
$tree[$note->id]['note'] = smarty_modifier_mb_truncate($tree[$note->id]['note'], 80, '...', TRUE);
CRM_Utils_Date::customFormat($tree[$note->id]['modified_date']);
}
self::buildNoteTree($note->id, $maxDepth, $snippet, $tree[$note->id]['child'], $depth + 1);
}
}
return $tree;
}