Completed
Push — master ( c7b167...faaa80 )
by Wanderson
02:08
created

InputImage   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 2
cbo 0
dl 0
loc 39
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getInput() 0 4 1
A getButtons() 0 6 1
A getJs() 0 3 1
1
<?php
2
3
/**
4
 * Input Imagem
5
 * Input type="file" personalizado, (apenas Imagens)
6
 * Esta classe irá adicionar um Plugin personalizado para Upload de Imagens
7
 * @author WebCorpore
8
 */
9
10
namespace Win\Html\Form;
11
12
use Win\File\Image;
13
14
class InputImage {
15
16
	public $inputName = '';
17
	public $thumbElement = '';
18
	public $currentImage = null;
19
	public $linkRemove = '';
20
21
	/**
22
	 * Gera o input file (que ficará oculto
23
	 * @param string $inputName name="" do INPUT
24
	 */
25
	public function getInput($inputName = '') {
26
		$this->inputName = $inputName;
27
		include 'public/plugins/jquery-file-upload/custom/input.phtml';
28
	}
29
30
	/**
31
	 * Gera os botões, barra de progresso, etc
32
	 * OBS: Lembre-se de chamar o "getPlugin()"
33
	 * @param Image $currentImage
34
	 * @param string $thumbElement Seletor jQuery da Imagem Atual
35
	 * @param string $linkRemove Link para excluir imagem
36
	 */
37
	public function getButtons($currentImage, $thumbElement = '#file_thumb', $linkRemove = '') {
38
		$this->currentImage = $currentImage;
39
		$this->thumbElement = $thumbElement;
40
		$this->linkRemove = $linkRemove;
41
		include 'public/plugins/jquery-file-upload/custom/buttons.phtml';
42
	}
43
44
	/**
45
	 * Inclui os arquivos javascript do plugin
46
	 * E define as funcionalidades
47
	 */
48
	public function getJs() {
49
		include 'public/plugins/jquery-file-upload/custom/javascript.phtml';
50
	}
51
52
}
53