method comment documentation in bbn\Appui\Task
function($id_task, array $cfg)
{
$note = new \bbn\Appui\Note($this->db);
$r = $note->insert(
(empty($cfg['title']) ? '' : $cfg['title']),
(empty($cfg['text']) ? '' : $cfg['text']),
\bbn\Appui\Note::getAppuiOptionId('tasks', 'types')
);
if ( $r ){
$this->db->insert('bbn_tasks_notes', [
'id_note' => $r,
'id_task' => $id_task
]);
if ( !empty($cfg['files']) ){
$filename = '';
$extension = '';
$length = 0;
foreach ( $cfg['files'] as $f ){
$ext = \bbn\Str::fileExt($f, true);
if (
(\strlen($ext[0]) < $length) ||
($ext[1] !== $extension) ||
(strpos($ext[0], $filename) !== 0) ||
!preg_match('/_h[\d]+/i', substr($ext[0], $length))
){
$filename = $ext[0];
$extension = $ext[1];
$length = \strlen($filename);
$note->addMedia($r, $f);
}
}
}
if ( !empty($cfg['links']) ){
foreach ( $cfg['links'] as $f ){
$ext = \bbn\Str::fileExt($f['image'], true);
if ( !preg_match('/_h[\d]+/i', substr($ext[0], 0)) ){
$note->addMedia(
$r,
$f['image'],
['url' => $f['url'], 'description' => $f['desc']],
$f['title'],
'link'
);
}
}
}
$this->addLog($id_task, 'comment_insert', [$this->id_user, empty($cfg['title']) ? $cfg['text'] : $cfg['title']]);
}
return $r;
}
return false;
}
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.
© 2011-2023
BBN Solutions