Get notes.

@return NoteEntity[]
@VirtualProperty
@SerializedName("notes")
@Groups({"fullAccount"})
546005
public function getNotes()
    {
        $notes = [];
        if ($this->entity->getNotes()) {
            foreach ($this->entity->getNotes() as $note) {
                $notes[] = $note;
            }
        }

        return $notes;
    }
216322
private function totalNotes(): Collection
    {
        return DB::table('gedcom')
            ->leftJoin('other', static function (JoinClause $join): void {
                $join
                    ->on('o_file', '=', 'gedcom_id')
                    ->where('o_type', '=', 'NOTE');
            })
            ->groupBy('gedcom_id')
            ->pluck(DB::raw('COUNT(o_id)'), 'gedcom_id')
            ->map(static function (string $count) {
                return (int) $count;
            });
    }
255515
private function getParentAndChildrenEntities() {
        $parentEntities = array();
        $childrenEntities = array();
        foreach($this->getModelBuilder()->getRelationships() as $relationship) {
            if($relationship->isPlural()) {
                $parentEntities[] = $relationship->getAlias() . '.*';
            } else {
                $childrenEntities[] = $relationship->getAlias() . '.*';
            }
        }

        return array($parentEntities, $childrenEntities);
    }
807871
public function getReferences(): array
    {
        if (empty($this->parent)) {
            throw new NodeException("Unable to aggregate reference values, parent is missing");
        }

        if (empty($this->parent->references[$this->outerKey])) {
            return [];
        }

        return array_keys($this->parent->references[$this->outerKey]);
    }
559730
protected static function get_note_structure() {
        return array(
                     'id'           => new external_value(PARAM_INT, 'id of this note'),
                     'courseid'     => new external_value(PARAM_INT, 'id of the course'),
                     'userid'       => new external_value(PARAM_INT, 'user id'),
                     'content'      => new external_value(PARAM_RAW, 'the content text formated'),
                     'format'       => new external_format_value('content'),
                     'created'      => new external_value(PARAM_INT, 'time created (timestamp)'),
                     'lastmodified' => new external_value(PARAM_INT, 'time of last modification (timestamp)'),
                     'usermodified' => new external_value(PARAM_INT, 'user id of the creator of this note'),
                     'publishstate' => new external_value(PARAM_ALPHA, "state of the note (i.e. draft, public, site) ")
        );
    }
848653
public String getNotes()
   {
      String notes = (String) getCachedValue(AssignmentField.NOTES);
      return (notes == null ? "" : notes);
   }
1051213
public Note[] getNotesBeginningTie() {
	  Vector notesBT = new Vector(m_notes.size());
	  for (int i=0; i<m_notes.size(); i++)
		  if (((Note)m_notes.elementAt(i)).isBeginningTie())
			  notesBT.addElement(m_notes.elementAt(i));
	  if (notesBT.size()>0) {
		  Note[] notesBTasArray = new Note[notesBT.size()];
		  notesBT.toArray(notesBTasArray);
		  return notesBTasArray;
	  }
	  else
		  return null;
  }
1338058
public function getNotes()
    {
        $plugin = Eresus_Kernel::app()->getLegacyKernel()->plugins->load('html');
        $table = ORM::getTable($plugin, 'Page');
        /** @var Html_Entity_Page $page */
        $page = $table->find($this->raw['id']);
        if (is_null($page))
        {
            return '';
        }
        return $page->notes;
    }
1187296
public function showNotes()
    {
        if ($this->showNotes === null) {
            $prop = $this->property();
            $show = $prop['show_notes'];
            if ($show !== null) {
                $this->showNotes = $show;
            } else {
                $this->showNotes = true;
            }
        }

        if ($this->showNotes !== false) {
            return !!strval($this->property()->notes());
        } else {
            return false;
        }
    }
1102060
public function getIngestManifestAssetList()
    {
        $propertyList = $this->_getEntityList('IngestManifestAssets');
        $result = [];

        foreach ($propertyList as $properties) {
            $result[] = IngestManifestAsset::createFromOptions($properties);
        }

        return $result;
    }
152184
public function jobPopulateNotesTeamUser()
    {
        $aclManager = $this->getInjection('container')->get('aclManager');

        $sql = $this->getEntityManager()->getQuery()->createSelectQuery('Note', [
            'whereClause' => [
                'parentId!=' => null,
                'type=' => ['Relate', 'CreateRelated', 'EmailReceived', 'EmailSent', 'Assign', 'Create'],
            ],
            'limit' => 100000,
            'orderBy' => [['number', 'DESC']]
        ]);
        $sth = $this->getEntityManager()->getPdo()->prepare($sql);
        $sth->execute();

        $i = 0;
        while ($dataRow = $sth->fetch(\PDO::FETCH_ASSOC)) {
            $i++;
            $note = $this->getEntityManager()->getEntityFactory()->create('Note');
            $note->set($dataRow);
            $note->setAsFetched();

            if ($note->get('relatedId') && $note->get('relatedType')) {
                $targetType = $note->get('relatedType');
                $targetId = $note->get('relatedId');
            } else if ($note->get('parentId') && $note->get('parentType')) {
                $targetType = $note->get('parentType');
                $targetId = $note->get('parentId');
            } else {
                continue;
            }

            if (!$this->getEntityManager()->hasRepository($targetType)) continue;

            try {
                $entity = $this->getEntityManager()->getEntity($targetType, $targetId);
                if (!$entity) continue;
                $ownerUserIdAttribute = $aclManager->getImplementation($targetType)->getOwnerUserIdAttribute($entity);
                $toSave = false;
                if ($ownerUserIdAttribute) {
                    if ($entity->getAttributeParam($ownerUserIdAttribute, 'isLinkMultipleIdList')) {
                        $link = $entity->getAttributeParam($ownerUserIdAttribute, 'relation');
                        $userIdList = $entity->getLinkMultipleIdList($link);
                    } else {
                        $userId = $entity->get($ownerUserIdAttribute);
                        if ($userId) {
                            $userIdList = [$userId];
                        } else {
                            $userIdList = [];
                        }
                    }
                    if (!empty($userIdList)) {
                        $note->set('usersIds', $userIdList);
                        $toSave = true;
                    }
                }
                if ($entity->hasLinkMultipleField('teams')) {
                    $teamIdList = $entity->getLinkMultipleIdList('teams');
                    if (!empty($teamIdList)) {
                        $note->set('teamsIds', $teamIdList);
                        $toSave = true;
                    }
                }
                if ($toSave) {
                    $this->getEntityManager()->saveEntity($note);
                }
            } catch (\Exception $e) {}
        }
    }
1367940
protected function displayNotes()
    {
        $notes = array();

        if ($this->note !== null) {
            $note = new SwatMessage($this->note);
            $note->content_type = $this->note_content_type;
            $notes[] = $note;
        }

        $control = $this->getFirstDescendant('SwatControl');
        if ($control !== null) {
            $note = $control->getNote();
            if ($note !== null) {
                $notes[] = $note;
            }
        }

        if (count($notes) === 1) {
            $note = reset($notes);
            $note_div = new SwatHtmlTag('div');
            $note_div->class = 'swat-note';
            $note_div->setContent($note->primary_content, $note->content_type);
            $note_div->display();
        } elseif (count($notes) > 1) {
            $note_list = new SwatHtmlTag('ul');
            $note_list->class = 'swat-note';
            $note_list->open();

            $li_tag = new SwatHtmlTag('li');
            foreach ($notes as $note) {
                $li_tag->setContent(
                    $note->primary_content,
                    $note->content_type
                );

                $li_tag->display();
            }

            $note_list->close();
        }
    }
1370691
public function toArray($notEmptyValues = false)
    {
        $props = $this->getReflection()->getProperties();
        if ($this->getReflection()->getParentClass()) {
            $temp = $this->getReflection()->getParentClass()->getProperties();
            $props = array_merge($props, $temp);
        }

        if (strpos($this->getReflection()->getName(), '__CG__') !== FALSE) {
            $props = $this->getReflection()->getParentClass()->getProperties();
        }

        $array = array();
        foreach ($props as $prop) {
            $getter = 'get'.ucfirst($prop->getName());

            if (method_exists($this, $getter)) {
                $empty = $this->$getter();
                $empty = is_null($empty) || empty($empty);

                if (!is_object($this->$getter())) {
                    if (($notEmptyValues && !$empty) || !$empty) {
                        $array[$prop->getName()] = $this->$getter();
                    }
                } elseif (is_object($this->$getter())) {
                    if (method_exists($this->$getter(), 'getId')) {
                        $array[$prop->getName()] = $this->$getter()->getId();
                    } elseif ($this->$getter() instanceof \DateTime) {
                        $array[$prop->getName()] = $this->$getter()->format('d.m.Y');
                    } elseif ($this->$getter() instanceof \Doctrine\Common\Collections\Collection) {
                        $tmp = array();
                        foreach ($this->$getter() as $item) {
                            $tmp[] = $item->getId();
                        }

                        $array[$prop->getName()] = $tmp;
                    }
                }
            }
        }

        return $array;
    }
75952
public function GetReadOnlyProperties()
    {
        $properties = parent::GetReadOnlyProperties();
        array_push($properties, 'AccessKey');
        array_push($properties, 'PreregistrationData');
        array_push($properties, 'CardRegistrationURL');
        array_push($properties, 'CardId');
        array_push($properties, 'ResultCode');
        array_push($properties, 'ResultMessage');
        array_push($properties, 'Status');
        return $properties;
    }
213514
public static function get_notes_returns() {
        return new external_single_structure(
            array(
                'notes' => new external_multiple_structure(
                    new external_single_structure(
                        array(
                            'noteid' => new external_value(PARAM_INT, 'id of the note', VALUE_OPTIONAL),
                            'userid' => new external_value(PARAM_INT, 'id of the user the note is about', VALUE_OPTIONAL),
                            'publishstate' => new external_value(PARAM_ALPHA, '\'personal\', \'course\' or \'site\'', VALUE_OPTIONAL),
                            'courseid' => new external_value(PARAM_INT, 'course id of the note', VALUE_OPTIONAL),
                            'text' => new external_value(PARAM_RAW, 'the text of the message - text or HTML', VALUE_OPTIONAL),
                            'format' => new external_format_value('text', VALUE_OPTIONAL),
                        ), 'note'
                    )
                 ),
                 'warnings' => new external_warnings('item is always \'note\'',
                        'When errorcode is savedfailed the note could not be modified.' .
                        'When errorcode is badparam, an incorrect parameter was provided.' .
                        'When errorcode is badid, the note does not exist',
                        'errorcode can be badparam (incorrect parameter), savedfailed (could not be modified), or badid (note does not exist)')
            )
        );
    }
52000
private function getColor(array $notes, $noteIndex)
    {
        if (!is_integer($noteIndex) || !array_key_exists($noteIndex, $notes)) {
            return null;
        }

        $noteObj = $notes[$noteIndex];
        if (!is_object($noteObj) || !property_exists($noteObj, 'color')) {
            return null;
        }

        return $noteObj->color;
    }
68768
private function note() {return dfc($this, function() {return
		!($n = $this->e()->getNote()) ? '' : df_tag('p', 'note', df_tag('span', [], $n))
	;});}