/
upload.php
58 lines (45 loc) · 1.15 KB
/
upload.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* File upload.
*
* @package Events
* @author Antti Qvickström
* @copyright (c) 2012 Antti Qvickström
* @license http://www.opensource.org/licenses/mit-license.php MIT license
*/
class View_Generic_Upload extends View_Article {
/**
* @var string URL for cancel action
*/
public $cancel;
/**
* @var array
*/
public $errors;
/**
* Render view.
*
* @return string
*/
public function content() {
ob_start();
if (self::$_request_type == Controller::REQUEST_AJAX) {
$cancel_attributes = array('class' => 'ajaxify');
} else {
$cancel_attributes = null;
}
echo Form::open(null, array('enctype' => 'multipart/form-data'));
?>
<fieldset>
<?= Form::file('file') ?>
</fieldset>
<fieldset>
<?= Form::csrf(); ?>
<?= Form::button('save', '<i class="icon-upload icon-white"></i> ' . __('Upload'), array('type' => 'submit', 'class' => 'btn btn-primary btn-small')) ?>
<?= $this->cancel ? HTML::anchor($this->cancel, __('Cancel'), $cancel_attributes) : '' ?>
</fieldset>
<?php
echo Form::close();
return ob_get_clean();
}
}