| Recommend this page to a friend! | 
|  Download | 
| Info | Documentation |  Files |  Install with Composer |  Download | Reputation | Support forum | Blog | Links | 
| Ratings | Unique User Downloads | Download Rankings | ||||
| Not yet rated by the users | Total: 17 | All time:  11,405 This week: 455  | ||||
| Version | License | PHP version | Categories | |||
| d3notification 1.0 | Freeware | 5 | PHP 5, Libraries, Design Patterns | 
| Description | Author | |||||||||||||||||||||||
| This package can register the handler for change events in the model object. | 
 | |||||||||||||||||||||||
For active records register events (time,status, notification class, user). Status can be changed. Collect status history.
The preferred way to install this extension is through composer.
Either run
$ composer require d3yii2/d3notification "*"
or add
"d3yii2/d3notification": "*"
to the require section of your composer.json file.
return [
    'controllerMap' => [
        'migrate' => [
            'class' => 'yii\console\controllers\MigrateController',
            'migrationPath' => [
                '@vendor/d3yii2/d3notification/migrations',
            ]
        ],
    ]
];   

Extend regular model and implement Notification interface
class KpsSmgsNotification extends KpsSmgs implements Notification
{
    public const NOTIFICATION_NEW_ID = 1;
    public const NOTIFICATION_RESOLVED_ID = 2;
    public const NOTIFICATION_IGNORED_ID = 3;
    public const NOTIFICATION_TYPE_NO_DELIVERY = 1;
    public const NOTIFICATION_TYPE_MISMATCH_LOAD_STATION = 2;
    public const NOTIFICATION_TYPE_MISMATCH_END_STATION = 3;
    public const NOTIFICATION_TYPE_KPS_EXTRA_CAR = 4;
    public const NOTIFICATION_TYPE_DELIVERY_EXTRA_CAR = 5;
    public const NOTIFICATION_TYPE_DIFF_WEIGHT = 6;
    / @var CmdDelivery */
    public $delivery;
    / @var CmdDCar */
    public $deliveryCar;
    / @var KpsSmgs */
    public $smgs;
    / @var KpsSmgsWagon */
    public $smgsWagon;
    / @var CmdStatus */
    public $deliveryStatus;
    /
     * @var mixed|null
     */
    public $statusId;
    /
     * @var mixed|null
     */
    public $typeId;
    public function getNotificationData(): array
    {
        $data = [];
        if($this->deliveryCar){
            $data['deliveryCarNumber'] = $this->deliveryCar->number;
        }
        if($this->deliveryStatus){
            $data['deliveryStatusType'] = $this->deliveryStatus->type;
            $data['deliveryStatusStation'] = TtStation::findOne($this->deliveryStatus->station_id)->name_ru;
        }
        if($this->delivery){
            $data['deliveryWeight'] = $this->delivery->weight;
            $data['deliverySmgsNumber'] = $this->delivery->delivery_note;
        }
        if($this->smgs){
            $data['kpsSmgsNumber'] = $this->smgs->number;
        }
        if($this->smgsWagon){
            $data['kpsCarNumber'] = $this->smgsWagon->number;
            $data['kpsCarWeight'] = $this->smgsWagon->weight;
        }
        return $data;
    }
    public function getNotificationKey(): int
    {
        if($this->delivery){
            return $this->delivery->id;
        }
        return 0;
    }
    public function getNotificationRecordId(): int
    {
        return $this->id;
    }
    public function getNotificationStatusList(): array
    {
        return [
            self::NOTIFICATION_NEW_ID => 'New',
            self::NOTIFICATION_RESOLVED_ID => 'Resolved',
            self::NOTIFICATION_IGNORED_ID => 'Ignored'
        ];
    }
    public function getNotificationTypeList(): array
    {
        return [
            self::NOTIFICATION_TYPE_NO_DELIVERY => 'Not Found Delivery record',
            self::NOTIFICATION_TYPE_MISMATCH_LOAD_STATION => 'Mismatch load station',
            self::NOTIFICATION_TYPE_MISMATCH_END_STATION => 'Mismatch end station',
            self::NOTIFICATION_TYPE_KPS_EXTRA_CAR => 'KPS Extra car',
            self::NOTIFICATION_TYPE_DELIVERY_EXTRA_CAR => 'Delivery Extra Car',
            self::NOTIFICATION_TYPE_DIFF_WEIGHT => 'Different weight',
        ];
    }
    public function getStatusId(): int
    {
        return $this->statusId;
    }
    public function getTypeId(): int
    {
        return $this->typeId;
    }
}
$logic = new NotificationLogic($companyId,$userId);
$notification = new KpsSmgsNotification();
$notification->attributes = $smgs->attributes;
$notification->typeId = KpsSmgsNotification::NOTIFICATION_TYPE_MISMATCH_END_STATION;
$notification->statusId = KpsSmgsNotification::NOTIFICATION_NEW_ID;
$notification->smgs = $smgs;
$notification->delivery = $delivery;
$notification->deliveryStatus = $statusEndStation;
$logic->register($notification);
|  Files (38) | 
| File | Role | Description | ||
|---|---|---|---|---|
|  accessRights (1 file) | ||||
|  controllers (2 files) | ||||
|  dictionaries (2 files) | ||||
|  doc (2 files) | ||||
|  gii (6 files) | ||||
|  interfaces (1 file) | ||||
|  logic (2 files) | ||||
|  messages (1 directory) | ||||
|  migrations (2 files) | ||||
|  models (9 files, 1 directory) | ||||
|  views (2 directories) | ||||
|    composer.json | Data | Auxiliary data | ||
|  Module.php | Class | Class source | ||
|    README.md | Doc. | Documentation | ||
|  Files (38) | / | controllers | 
| File | Role | Description | 
|---|---|---|
|  NotificationController.php | Class | Class source | 
|  PanelController.php | Class | Class source | 
|  Files (38) | / | dictionaries | 
| File | Role | Description | 
|---|---|---|
|  D3nStatusDictionary.php | Class | Class source | 
|  D3nTypeDictionary.php | Class | Class source | 
|  Files (38) | / | doc | 
| File | Role | Description | 
|---|---|---|
|    DbSchema.png | Data | Auxiliary data | 
|    SqlYog_db_schema.schemaxml | Data | Auxiliary data | 
|  Files (38) | / | gii | 
| File | Role | Description | 
|---|---|---|
|    d3notificationGiiantNModule.json | Data | Auxiliary data | 
|    d3n_notificationGiiantModel.json | Data | Auxiliary data | 
|    d3n_statusGiiantModel.json | Data | Auxiliary data | 
|    d3n_status_historyGiiantModel.json | Data | Auxiliary data | 
|    d3n_typeGiiantModel.json | Data | Auxiliary data | 
|    NotificationGiiantCRUD.json | Data | Auxiliary data | 
|  Files (38) | / | logic | 
| File | Role | Description | 
|---|---|---|
|  DashboardLogic.php | Class | Class source | 
|  NotificationLogic.php | Class | Class source | 
|  Files (38) | / | migrations | 
| File | Role | Description | 
|---|---|---|
|  m200414_110707_init.php | Class | Class source | 
|  m200422_210707_cre...roleD3NotesFull.php | Class | Class source | 
|  Files (38) | / | models | 
| File | Role | Description | ||
|---|---|---|---|---|
|  base (4 files) | ||||
|  D3cCompany.php | Class | Class source | ||
|  D3nNotification.php | Class | Class source | ||
|  D3nNotificationQuery.php | Class | Class source | ||
|  D3nNotificationSearch.php | Class | Class source | ||
|  D3nStatus.php | Class | Class source | ||
|  D3nStatusHistory.php | Class | Class source | ||
|  D3nStatusHistoryQuery.php | Class | Class source | ||
|  D3nType.php | Class | Class source | ||
|  SysModels.php | Class | Class source | ||
|  Files (38) | / | models | / | base | 
| File | Role | Description | 
|---|---|---|
|  D3nNotification.php | Class | Class source | 
|  D3nStatus.php | Class | Class source | 
|  D3nStatusHistory.php | Class | Class source | 
|  D3nType.php | Class | Class source | 
|  Files (38) | / | views | / | notification | 
| The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. | 
|  Install with Composer | 
| 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.
 If you know an application of this package, send a message to the author to add a link here.