method setRecentFile documentation in bbn\Appui\Ide
Create or update bit recent file preference
function(string $file)
{
$bit = false;
$id_recent_file = $this->options->fromCode(self::RECENT_FILE, self::IDE_PATH, self::BBN_APPUI);
if (!empty($id_recent_file)) {
//search preference and if not exsist preference add a new
$pref = $this->pref->getByOption($id_recent_file);
$id_pref = !empty($pref) ? $pref['id'] : $this->pref->add($id_recent_file, []);
}
if (!empty($id_pref)) {
//search bit in relation at user preference
$bit_data = $this->_get_bit_by_file($file, $id_pref);
}
$date = date('Y-m-d H:i:s');
$cfg = [];
//set bit
if (($bit_data !== null)) {
$info = json_decode($bit_data['cfg'], true);
$cfg = [
'id_option' => null,
'text' => $file,
'cfg' => [
'bit_creation' => $info['bit_creation'],
'last_date' => $date,
'number' => $info['number'] + 1,
]
];
if (!empty($this->pref->updateBit($bit_data['id'], $cfg, true))) {
$bit = true;
}
}
//add bit
else {
$cfg = [
'bit_creation' => $date,
'last_date' => $date,
'number' => 0,
];
if (
!empty($id_pref) && $this->pref->addBit(
$id_pref,
[
//'id_option' => $id_link,
'id_option' => null,
'cfg' => json_encode($cfg),
'text' => $file,
]
)
) {
$bit = true;
}
}
return !empty($bit) && !empty($id_pref);
}
Create or update bit recent file preference 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