Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Generic file upload form

  • Loading branch information...
commit deb06db2c64fd48e8edffa1a1baac4e172ebcbbe 1 parent 86c0e61
@anqqa anqqa authored
Showing with 58 additions and 0 deletions.
  1. +58 −0 classes/view/generic/upload.php
View
58 classes/view/generic/upload.php
@@ -0,0 +1,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();
+ }
+
+}
Please sign in to comment.
Something went wrong with that request. Please try again.