first commit
This commit is contained in:
54
libraries/grid/grid-upload.php
Normal file
54
libraries/grid/grid-upload.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
class gridUpload
|
||||
{
|
||||
protected $dir;
|
||||
|
||||
public $allowed_extensions = [ 'jpg',' jpeg', 'gif', 'bmp', 'zip', 'rar', 'pdf', 'doc', 'docx', 'xls', 'xlsx', 'odt', 'psd' ];
|
||||
|
||||
public $id = 'grid-upload';
|
||||
public $params = null;
|
||||
public $buttons = null;
|
||||
public $dir_upload = null;
|
||||
public $db = null;
|
||||
public $after_send_js = null;
|
||||
public $include_plugins = false;
|
||||
|
||||
public $title = 'Wyślij pliki';
|
||||
|
||||
public $gdb_opt = array(
|
||||
'database_type' => 'mysql',
|
||||
'database_name' => 'db_name',
|
||||
'server' => 'db_host',
|
||||
'username' => 'db_user',
|
||||
'password' => 'db_pass',
|
||||
'port' => 'db_port'
|
||||
);
|
||||
|
||||
function __construct() {
|
||||
$this -> dir = dirname( __FILE__ );
|
||||
}
|
||||
|
||||
public function connectToDb()
|
||||
{
|
||||
return new gdb( [
|
||||
'database_type' => $this -> gdb_opt['database_type'],
|
||||
'database_name' => $this -> gdb_opt['database_name'],
|
||||
'server' => $this -> gdb_opt['server'],
|
||||
'username' => $this -> gdb_opt['username'],
|
||||
'password' => $this -> gdb_opt['password'],
|
||||
'port' => $this -> gdb_opt['port'],
|
||||
'charset' => 'utf8'
|
||||
] );
|
||||
}
|
||||
|
||||
public function draw()
|
||||
{
|
||||
$_SESSION[ 'g-upload-' . $this -> id ] = $this;
|
||||
|
||||
$values = get_object_vars( $this );
|
||||
|
||||
$view = new gridView( $this -> dir . '/templates/' );
|
||||
$view -> values = $values;
|
||||
return $view -> render( 'upload' );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user