-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from JZechy/1.2
1.2
- Loading branch information
Showing
13 changed files
with
1,183 additions
and
620 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
|
||
namespace Zet\FileUpload; | ||
|
||
/** | ||
* Class FileUploadExtension | ||
* @author Zechy <[email protected]> | ||
* @package Zet\FileUpload | ||
*/ | ||
class FileUploadExtension extends \Nette\DI\CompilerExtension { | ||
|
||
/** | ||
* Výchozí konfigurační hodnoty. | ||
* @var array | ||
*/ | ||
private $defaults = [ | ||
"maxFiles" => 25, | ||
"maxFileSize" => NULL, | ||
"uploadModel" => NULL, | ||
"fileFilter" => NULL, | ||
"uiMode" => FileUploadControl::UI_FULL | ||
]; | ||
|
||
/** | ||
* Konfigurace nastavená uživatelem. | ||
* @var array | ||
*/ | ||
private $configuration = []; | ||
|
||
/** | ||
* | ||
*/ | ||
public function loadConfiguration() { | ||
$this->configuration = $this->getConfig($this->defaults); | ||
if(is_string($this->configuration["uiMode"])) { | ||
$value = $this->configuration["uiMode"]; | ||
|
||
switch($value) { | ||
case "full": | ||
$this->configuration["uiMode"] = FileUploadControl::UI_FULL; | ||
break; | ||
case "minimal": | ||
$this->configuration["uiMode"] = FileUploadControl::UI_MINIMAL; | ||
break; | ||
default: | ||
$this->configuration["uiMode"] = FileUploadControl::UI_FULL; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* @param \Nette\PhpGenerator\ClassType $class | ||
*/ | ||
public function afterCompile(\Nette\PhpGenerator\ClassType $class) { | ||
$init = $class->methods["initialize"]; | ||
|
||
$init->addBody('\Zet\FileUpload\FileUploadControl::register($this->getService(?), ?);', [ | ||
$this->getContainerBuilder()->getByType('\Nette\DI\Container'), $this->configuration | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<div class="panel panel-primary"> | ||
<div class="panel-heading clearfix"> | ||
<h3 class="panel-title pull-left">Nahrávání souborů</h3> | ||
<div class="btn-group pull-right"> | ||
{var $text = $maxFiles > 1 ? "Vybrat soubory" : "Vybrat soubor"} | ||
<span class="fileinput-button btn btn-warning btn-xs" title="{$text}" data-toggle="tooltip"> | ||
<span> | ||
<i class="glyphicon glyphicon-plus"></i> | ||
<span class="hidden-xs"> | ||
{$text} | ||
</span> | ||
</span> | ||
<input class="fileupload-input" type="file" name="{$htmlName}" id="{$htmlId}" multiple> | ||
</span> | ||
</div> | ||
</div> | ||
|
||
<div class="panel-body"> | ||
<div class="progress zet-fileupload-progress" id="{$htmlId}-progress"> | ||
<div id="{$htmlId}-progressbar" class="progress-bar progress-bar-success progress-bar-striped active" style="width: 0%"> | ||
<span id="{$htmlId}-progressbar-value">0</span>% | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<table class="table zet-fileupload-table" id="{$htmlId}-table"> | ||
<tbody id="{$htmlId}-table-tbody"> | ||
</tbody> | ||
</table> | ||
</div> |
Oops, something went wrong.