method insert documentation in bbn\Appui\Note

Creates a new note in the database

function($title, string $content = '', string $id_type = NULL, bool $private = false, bool $locked = false, string $id_parent = NULL, string $id_alias = NULL, string $mime = '', string $lang = '', string $id_option = NULL, string $excerpt = '', bool $pinned = false) { string $content = '', string $id_type = null, bool $private = false, bool $locked = false, string $id_parent = null, string $id_alias = null, string $mime = '', string $lang = '', string $id_option = null, string $excerpt = '', bool $pinned = false ): ?string { $props = [ 'title', 'content', 'id_type', 'private', 'locked', 'id_parent', 'id_alias', 'mime', 'lang', 'id_option', 'excerpt', 'pinned' ]; if (is_array($title)) { $cfg = $title; } else { $cfg = []; } foreach ($props as $prop) { if (!array_key_exists($prop, $cfg)) { $cfg[$prop] = $$prop; } } if (empty($cfg['content']) && empty($cfg['title'])) { return null; } if (empty($cfg['lang']) && defined('BBN_LANG')) { $cfg['lang'] = BBN_LANG; } $cf = &$this->class_cfg; if (is_null($cfg['id_type'])) { $cfg['id_type'] = self::getOptionId('personal', 'types'); } if (!$cfg['excerpt']) { $cfg['excerpt'] = $this->getExcerpt($cfg['title'], $cfg['content']); } $id_note = null; if (($usr = bbn\User::getInstance()) && $this->db->insert( $cf['table'], [ $cf['arch']['notes']['id_parent'] => $cfg['id_parent'], $cf['arch']['notes']['id_alias'] => $cfg['id_alias'], $cf['arch']['notes']['id_type'] => $cfg['id_type'], $cf['arch']['notes']['id_option'] => $cfg['id_option'], $cf['arch']['notes']['private'] => !empty($cfg['private']) ? 1 : 0, $cf['arch']['notes']['locked'] => !empty($cfg['locked']) ? 1 : 0, $cf['arch']['notes']['creator'] => $usr->getId(), $cf['arch']['notes']['mime'] => $cfg['mime'], $cf['arch']['notes']['lang'] => $cfg['lang'], $cf['arch']['notes']['pinned'] => !empty($cfg['pinned']) ? 1 : 0 ] ) && ($id_note = $this->db->lastId()) ) { $this->insertVersion($id_note, $cfg['title'], $cfg['content'], $cfg['excerpt']); } return $id_note; }

Creates a new note in the database BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.