Define User Action
Agile UI Demo v5.0-dev
UI Integration
Arguments
Crud integration
Compared to 1.x versions Crud implementation has became much more lightweight, however you retain all the same functionality and more. Next example shows how you can disable user action (add) entirely, or on per-row basis (delete) and how you could add your own action with a custom trigger button and even a preview.
$country = new Country($owner->getApp()->db);
$country->getUserAction('add')->enabled = false;
$country->getUserAction('delete')->enabled = static function (Country $m) {
return $m->id % 2 === 0;
};
$country->addUserAction('mail', [
'appliesTo' => Model\UserAction::APPLIES_TO_SINGLE_RECORD,
'preview' => static function (Country $model) {
return 'Here is email preview for ' . $model->name;
},
'callback' => static function (Country $model) {
return 'Email sent to ' . $model->name;
},
'description' => 'Email testing',
]);
// register a trigger for mail action in Crud
$owner->getExecutorFactory()->registerTrigger(
ExecutorFactory::TABLE_BUTTON,
[Button::class, null, 'icon' => 'blue mail'],
$country->getUserAction('mail')
);
Crud::addTo($owner, ['ipp' => 5])
->setModel($country, [$country->fieldName()->name, $country->fieldName()->iso]);
Name | ISO | |
---|---|---|
Afghanistan | AF | |
Albania | AL | |
Algeria | DZ | |
American Samoa | AS | |
Andorra | AD |
Edit Country
Email testing
$model = new Stat($owner->getApp()->db);
$model->addUserAction('mail', [
'fields' => [$model->fieldName()->currency],
'appliesTo' => Model\UserAction::APPLIES_TO_SINGLE_RECORD,
'callback' => static function (Stat $model) {
return 'Email sent in ' . $model->currency . ' currency';
},
'description' => 'Email testing',
]);
CardDeck::addTo($owner)
->setModel(
$model,
[$model->fieldName()->description]
);
Agile DSQL
DSQL is a composable SQL query builder. You can write multi-vendor queries in PHP profiting from better security, clean syntax and avoid human errors.
Agile Core
Collection of PHP Traits for designing object-oriented frameworks.
Agile Data
Agile Data implements an entirely new pattern for data abstraction, that is specifically designed for remote databases such as RDS, Cloud SQL, BigQuery and other distributed data storage architectures. It focuses on reducing number of requests your App have to send to the Database by using more sophisticated queries while also offering full Domain Model mapping and Database vendor abstraction.
Agile UI
Web UI Component library.
Add Atk 4 Ui Demos Stat