Recommend this page to a friend! |
Download .zip |
Info | Documentation | View files (49) | Download .zip | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2021-09-16 (8 days ago) | Not yet rated by the users | Total: 20 This week: 10 | All time: 10,367 This week: 20 |
Version | License | PHP version | Categories | |||
d3system 1.0 | Freeware | 5 | HTML, PHP 5, Databases, Libraries, De... |
Description | Author | ||||||||||||||
This package provides a framework to edit model data using CRUD interfaces. |
|
composer require d3yii2/d3system dev-master
add translation
$config = [
'components' => [
'i18n' => [
'translations' => [
'd3system*' => [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@d3yii2/d3system/messages',
'sourceLanguage' => 'en-US',
],
'crud' => [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@d3yii2/d3system/messages',
'sourceLanguage' => 'en-US',
],
]
]
]
];
Configuration:
'components' => [
'ModelsList' => [
'class' => 'd3system\compnents\ModelsList',
'cacheKey' => 'd3system\modeList',
'cacheDuration' => 3600
]
Usage:
$modelId = \Yii::$app->ModelsList->getId($model);
Dependency https://github.com/d3yii2/yii2-datetime
Conversion works only for the model attributes suffixed vith "_local" A example, instead
$model->YOUR_ATTRIBUTE
use
$model->YOUR_ATTRIBUTE_local
Add the behavior to your model and list the attributes need to be converted Important: do NOT add the "_local" suffix here!
public function behaviors(): array
{
return D3DateTimeBehavior::getConfig(['YOUR_ATTRIBUTE']);
}
Or if You need custom options (see the https://github.com/d3yii2/yii2-datetime)
public function behaviors()
{
return [
'datetime' => [
'class' => D3DateTimeBehavior::className(), // Our behavior
'attributes' => [
'YOUR_ATTRIBUTE', // List all editable date/time attributes
],
// Date formats or other options
'originalFormat' => ['datetime', 'yyyy-MM-dd HH:mm:ss'],
'targetFormat' => 'date',
]
];
}
<?= $model->YOUR_ATTRIBUTE_local ?>
$model->load(Yii::$app->request->post());
or
$model->YOUR_ATTRIBUTE_local = $value;
or
$model->setAttribute('YOUR_ATTRIBUTE_local', $value);
By multiple assignment via load() ensure the local attributes have 'safe' rules:
// Virtual params for DateTimeBehavior
public function rules(): array
{
return [
[...],
[['YOUR_ATTRIBUTE_local'], 'safe'],
];
}
D3EditableAction Initial Setup in Controller
editAbleFields: must match real attributes
editAbleFieldsForbbiden: must match real attributes
modelName: pass current controller model Name with full Namespace
/
* @var array
*/
public $editAbleFields = ['hasEditable', 'status'];
/
* @var array
*/
public $editAbleFieldsForbbiden = [];
Actions
public function actions()
{
return [
'editable' => [
'class' => D3EditableAction::class,
'modelName' => AudAuditor::class,
'editAbleFields' => ['status','notes'],
'editAbleFieldsForbbiden' => $this->editAbleFieldsForbbiden,
'preProcess' => static function (Inout $model) {
if ($model->isAttributeChanged('driver')) {
$model->driver = iconv('UTF-8', 'ASCII//TRANSLIT',$model->driver);
}
},
'outPreProcess' => static function (ContInout $model, array $output) {
if (isset($output['ediBookingId'])) {
$output['ediBookingId'] = DepoEdiBookingDictionary::getIdLabel($output['ediBookingId']);
}
return $output;
}
],
];
}
Files |
File | Role | Description | ||
---|---|---|---|---|
actions (4 files) | ||||
behaviors (1 file) | ||||
commands (1 file) | ||||
compnents (4 files, 1 directory) | ||||
dictionaries (1 file) | ||||
exceptions (3 files) | ||||
gii (1 file) | ||||
helpers (1 file) | ||||
messages (2 directories) | ||||
migrations (4 files) | ||||
models (5 files, 1 directory) | ||||
views (1 directory) | ||||
widgets (3 files) | ||||
yii2 (5 directories) | ||||
composer.json | Data | Auxiliary data | ||
Module.php | Class | Class source | ||
README.md | Doc. | Read me |
Files | / | actions |
File | Role | Description |
---|---|---|
D3EditableAction.php | Class | Class source |
D3EditableColumnAction.php | Class | Class source |
D3SettingAction.php | Class | Class source |
Yii2ModEditableAction.php | Class | Class source |
Files | / | compnents |
File | Role | Description | ||
---|---|---|---|---|
optional (2 files) | ||||
D3Ref.php | Class | Class source | ||
Expression.php | Class | Class source | ||
ModelsList.php | Class | Class source | ||
TryCatch.php | Class | Class source |
Files | / | compnents | / | optional |
File | Role | Description |
---|---|---|
Optional.php | Class | Class source |
readme.md | Doc. | Documentation |
Files | / | exceptions |
File | Role | Description |
---|---|---|
D3ActiveRecordException.php | Class | Class source |
D3Exception.php | Class | Class source |
D3UserAlertException.php | Class | Class source |
Files | / | messages | / | lv-LV |
File | Role | Description |
---|---|---|
crud.php | Aux. | Auxiliary script |
d3system.php | Aux. | Auxiliary script |
Files | / | messages | / | ru |
File | Role | Description |
---|---|---|
crud.php | Aux. | Auxiliary script |
d3system.php | Aux. | Auxiliary script |
Files | / | migrations |
File | Role | Description |
---|---|---|
m180821_114733_init.php | Class | Class source |
m190225_144643_alt..._add_unique_key.php | Class | Class source |
m190516_092701_cre...ron_final_point.php | Class | Class source |
m200513_160317_alt...final_point_key.php | Class | Class source |
Files | / | models |
File | Role | Description | ||
---|---|---|---|---|
base (1 file) | ||||
D3ActiveRecord.php | Class | Class source | ||
D3Attribute.php | Class | Class source | ||
ModelObjectAdditionalAttributes.php | Class | Class source | ||
SysCronFinalPoint.php | Class | Class source | ||
SysModels.php | Class | Class source |
Files | / | widgets |
File | Role | Description |
---|---|---|
D3Widget.php | Class | Class source |
ThBadge.php | Class | Class source |
ThBadgeList.php | Class | Class source |
Files | / | yii2 |
Files | / | yii2 | / | data |
File | Role | Description |
---|---|---|
D3ActiveDataProvider.php | Class | Class source |
D3Pagination.php | Class | Class source |
D3Sort.php | Class | Class source |
Files | / | yii2 | / | db |
File | Role | Description |
---|---|---|
D3ActiveQuery.php | Class | Class source |
D3Command.php | Class | Class source |
D3Db.php | Class | Class source |
Files | / | yii2 | / | web |
File | Role | Description |
---|---|---|
D3SystemMobView.php | Class | Class source |
D3SystemView.php | Class | Class source |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.