PHP code example of dbrisinajumi / d2files

1. Go to this page and download the library: Download dbrisinajumi/d2files library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dbrisinajumi / d2files example snippets


     'import' => array(
        'vendor.dbrisinajumi.d2files.models.*',
        'vendor.dbrisinajumi.d2files.widgets.*', // shared classes
    ),
    'modules' => array(
        'd2files' => array(
            'class' => 'vendor.dbrisinajumi.d2files.D2filesModule',
            'upload_dir' => 'root.upload',
            'accept_file_types' => '/\.(gif|pdf|dat|jpe?g|png|doc|docx|xls|xlsx|htm)$/i',
            
            //automaticly registre tasks, when upload files to model 
            // d2person.PprsPerson, if user role is Agent or Client
            'registre_tasks_to_models' => array(
                'd2person.PprsPerson' => array(
                    'new_project_status' => 1, //Not started
                    'task_init_status' => 1, //Active
                    'task_due_in_days' => 3,
                    'user_roles' => array('Agent','Client'),
                    ),
            ),
            'shareable_by_link' => [
                'my_module.my_model' => [
                    'allow_ip' => [
                        '127.0.0.1',
                        ],
                    'salt' => '1212133243243',
                ]
            ]
         ),  
	 ),

    $this->widget('d2FilesWidget',[
        'module'=>$this->module->id, 
        'model'=>$model,
        'title'=> 'Wiget Title',
        'icon' => false,
        'hideTitle' => false,
        'readOnly' => false,
        'showImagesTypes' => '/\.(gif|jpe?g|png)$/i'
        ]
        );