Example #1
0
File: upload.php Project: anqh/core
    /**
     * 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($this->action, array('enctype' => 'multipart/form-data'));
        ?>

		<fieldset>
			<?php 
        echo Form::file('file');
        ?>
		</fieldset>

		<fieldset>
			<?php 
        echo Form::csrf();
        ?>
			<?php 
        echo Form::button('save', '<i class="icon-upload icon-white"></i> ' . __('Upload'), array('type' => 'submit', 'class' => 'btn btn-primary btn-small'));
        ?>
			<?php 
        echo $this->cancel ? HTML::anchor($this->cancel, __('Cancel'), $cancel_attributes) : '';
        ?>
		</fieldset>

<?php 
        echo Form::close();
        return ob_get_clean();
    }
Example #2
0
 public function input($name, $value, array $attr = NULL)
 {
     $input = Form::file($name, $attr);
     if ($value) {
         $input .= HTML::image($this->verbose($value));
     }
     return $input;
 }
/**
 * @param array                    $params
 * @param Smarty_Internal_Template $smarty
 *
 * @throws SmartyException
 * @return string
 *
 * @author Kovács Vince
 */
function smarty_function_form_file($params, Smarty_Internal_Template &$smarty)
{
    if (!isset($params['_name'])) {
        throw new SmartyException('Missing _name attribute for form_text tag');
    }
    $name = $params['_name'];
    unset($params['_name']);
    return Form::file($name, $params);
}
Example #4
0
 public static function li_file($fieldname, $text, array $attributes = array(), $error = "")
 {
    $atts = array_merge($attributes, array('id'=>$fieldname));
    echo "<li class=\"input_field input_file\">";
    echo Form::label($fieldname, $text);
    echo Form::file($fieldname, $atts);
    echo "<span class=\"error\">$error</span>";
    echo "</li>";
 }
Example #5
0
 public function demo_account_update_profile_image()
 {
     if ($this->request->method() === 'POST') {
         $params = array('image' => Upload::save($_FILES['image'], NULL, '/tmp'));
         $api = Twitter::factory('account');
         $response = $api->update_profile_image($this->consumer, $this->token, $params);
         $this->content = Debug::vars($response);
     } else {
         $this->content = View::factory('demo/form')->set('uploads', TRUE)->set('message', 'Update your profile image.')->set('inputs', array('Image File' => Form::file('image')));
     }
 }
Example #6
0
 protected function _media_type($input, $attributes)
 {
     $type = Facebook_Attachment::$input_prefix . 'media-type' . Facebook_Attachment::$input_suffix;
     $src = Facebook_Attachment::$input_prefix . 'media-src' . Facebook_Attachment::$input_suffix;
     $upload = Facebook_Attachment::$input_prefix . 'upload' . Facebook_Attachment::$input_suffix;
     $href = Facebook_Attachment::$input_prefix . 'media-href' . Facebook_Attachment::$input_suffix;
     $out = array();
     $out[] = Form::hidden($type, 'image');
     $out[] = strtr(Facebook_Stream::$form_template, array(':label' => Form::label($src, 'Image Location URL', $attributes), ':description' => 'Each record must contain a src key, which maps to the photo URL', ':input' => Form::input($src, NULL, $attributes)));
     $out[] = strtr(Facebook_Stream::$form_template, array(':label' => Form::label($upload, 'Image Upload', $attributes), ':description' => 'Upload a file to use as the image src', ':input' => Form::file($upload, $attributes)));
     $out[] = strtr(Facebook_Stream::$form_template, array(':label' => Form::label($href, 'Image Hyperlink Destination', $attributes), ':description' => 'Maps to the URL where a user should be taken if he or she clicks the photo.', ':input' => Form::input($href, NULL, $attributes)));
     return implode("\n", $out);
 }
Example #7
0
 public static function ajaxFileUpload($label = null, $target = null, $albumId = 0)
 {
     $content = Form::open("ajaxFileUpload", Config::$kikiPrefix . "/file-upload.php", 'POST', null, "multipart/form-data", "ajaxFileUploadTarget");
     $content .= Form::hidden("target", $target);
     $content .= Form::hidden("albumId", $albumId);
     $content .= Form::file("attachment", $label, $albumId ? "album_{$albumId}" : null);
     $content .= Form::button("submitAttachment", "submit", "Upload file");
     $content .= "<iframe id=\"ajaxFileUploadTarget\" name=\"ajaxFileUploadTarget\" src=\"\"></iframe>\n";
     $content .= Form::close();
     return $content;
 }
Example #8
0
<h1 class="page-header">Thêm logo chính</h1>
<?php 
echo Form::open(array("class" => "form-horizontal", 'enctype' => 'multipart/form-data'));
?>
    <div class="form-group">
        <label class="col-sm-3 control-label required">Chọn hình</label>
        <span class="img-size-helper glyphicon glyphicon-question-sign" data-tooltip-content="#tooltip_content" style="cursor: pointer; float: left;"></span>
        <div class="col-sm-4">
        <?php 
echo Form::file('thumbnail', array('class' => ''));
?>
        <?php 
echo Form::error('thumbnail', $err);
?>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label required">Hiển thị</label>
        <div class="col-sm-4">
            <input name="active" value="1" type="checkbox" class="checkbox">
        </div>
    </div>

    <div class="form-group">
        <div class="col-sm-offset-3 col-sm-10">
            <button type="submit" class="btn btn-success">Đăng ký</button>
            <a href="<?php 
echo \Fuel\Core\Uri::base() . 'admin/mainlogo';
?>
" class="btn btn-default">Quay lại</a>
        </div>
Example #9
0
?>
                        <div class="form-group">
                            <label class="col-md-3 control-label">詳細情報</label>
                            <div class="col-md-9">
                                <textarea class="form-control" name="detail" placeholder="詳細情報を入力" rows="5"><?php 
echo $detail;
?>
</textarea>
                            </div>
                        </div>
                        	
                        <div class="form-group">
                            <label class="col-md-3 control-label">メイン写真</label>
                            <div class="col-md-9">
							  <?php 
echo Form::file('image_path');
?>
							    <p class="help-block">※ 一覧や詳細に表示される写真です</p>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-md-12 text-right">
		                         <?php 
echo Form::submit('submit', '登録内容を確認する', array('class' => 'btn btn-warning btn-lg'));
?>
                            </div>
                        </div>
                    </fieldset>
                </form>
            </div>
        </div>
					                                                    </tr>
					                                                    <tr>
					                                                        <td class="noresize">Video Title</td>
					                                                        <td colspan="2">
					                                                        	<div class="input_holder">
					                                                        		<?php 
        echo \Form::input('video_title_new_1', \Input::post('video_title_new_1'), array('class' => 'video_title'));
        ?>
					                                                        	</div>
					                                                        </td>
					                                                    </tr>
					                                                    <tr>
					                                                        <td class="noresize">Thumbnail Image</td>
					                                                        <td>
					                                                        	<?php 
        echo \Form::file('video_file_new_1');
        ?>
					                                                        </td>
					                                                    </tr>                                                    
					                                                </table>
					                                            </td>
					                                            <?php 
        if (count($product->videos) > 1) {
            ?>
						                                            <td class="icon center"></td>
						                                        <?php 
        }
        ?>
						                                        <?php 
        if (!\Config::get('details.video.required', false) && !empty($product->videos) || count($product->videos) > 1) {
            ?>
Example #11
0
 private static function generateFile($id, $attributes_input, $model)
 {
     $field = array();
     unset($attributes_input["name"]);
     $field[] = Form::file($id, $attributes_input);
     $field[] = '<span class="error"> ' . $model->first_error(strtolower($id)) . '</span>';
     return join($field);
 }
 public function actionEditProfile()
 {
     $message_avatar_name = "avatar";
     $message_name_name = "name";
     $message_password_name = "password";
     if ($this->request->change_avatar) {
         $img = $this->fp->uploadIMG($message_avatar_name, $_FILES["avatar"], Config::MAX_SIZE_AVATAR, Config::DIR_AVATAR);
         if ($img) {
             $tmp = $this->auth_user->getAvatar();
             $obj = $this->fp->process($message_avatar_name, $this->auth_user, array(array("avatar", $img)), array(), "SUCCESS_AVATAR_CHANGE");
             if ($obj instanceof UserDB) {
                 if ($tmp) {
                     File::delete(Config::DIR_AVATAR . $tmp);
                 }
                 $this->redirect(URL::current());
             }
         }
     } elseif ($this->request->change_name) {
         $checks = array(array($this->auth_user->checkPassword($this->request->password_current_name), true, "ERROR_PASSWORD_CURRENT"));
         $user_temp = $this->fp->process($message_name_name, $this->auth_user, array("name"), $checks, "SUCCESS_NAME_CHANGE");
         if ($user_temp instanceof UserDB) {
             $this->redirect(URL::current());
         }
     } elseif ($this->request->change_password) {
         $checks = array(array($this->auth_user->checkPassword($this->request->password_current), true, "ERROR_PASSWORD_CURRENT"));
         $checks[] = array($this->request->password, $this->request->password_conf, "ERROR_PASSWORD_CONF");
         $user_temp = $this->fp->process($message_password_name, $this->auth_user, array(array("setPassword()", $this->request->password)), $checks, "SUCCESS_PASSWORD_CHANGE");
         if ($user_temp instanceof UserDB) {
             $this->auth_user->login();
             $this->redirect(URL::current());
         }
     }
     $this->title = "Редактирование профиля";
     $this->meta_desc = "Редактирование профиля пользователя.";
     $this->meta_key = "редактирование профиля, редактирование профиля пользователя, редактирование профиля пользователя сайт";
     $form_avatar = new Form();
     $form_avatar->name = "change_avatar";
     $form_avatar->action = URL::current();
     $form_avatar->enctype = "multipart/form-data";
     $form_avatar->message = $this->fp->getSessionMessage($message_avatar_name);
     $form_avatar->file("avatar", "Аватар:");
     $form_avatar->submit("Сохранить");
     $form_avatar->addJSV("avatar", $this->jsv->avatar());
     $form_name = new Form();
     $form_name->name = "change_name";
     $form_name->header = "Изменить имя";
     $form_name->action = URL::current();
     $form_name->message = $this->fp->getSessionMessage($message_name_name);
     $form_name->text("name", "Ваше имя:", $this->auth_user->name);
     $form_name->password("password_current_name", "Текущий пароль:");
     $form_name->submit("Сохранить");
     $form_name->addJSV("name", $this->jsv->name());
     $form_name->addJSV("password_current_name", $this->jsv->password(false, false, "ERROR_PASSWORD_CURRENT_EMPTY"));
     $form_password = new Form();
     $form_password->name = "change_password";
     $form_password->header = "Изменить пароль";
     $form_password->action = URL::current();
     $form_password->message = $this->fp->getSessionMessage($message_password_name);
     $form_password->password("password", "Новый пароль:");
     $form_password->password("password_conf", "Повторите пароль:");
     $form_password->password("password_current", "Текущий пароль:");
     $form_password->submit("Сохранить");
     $form_name->addJSV("password", $this->jsv->password("password_conf"));
     $form_name->addJSV("password_current", $this->jsv->password(false, false, "ERROR_PASSWORD_CURRENT_EMPTY"));
     $hornav = $this->getHornav();
     $hornav->addData("Редактирование профиля");
     $this->render($this->renderData(array("hornav" => $hornav, "form_avatar" => $form_avatar, "form_name" => $form_name, "form_password" => $form_password), "profile", array("avatar" => $this->auth_user->avatar, "max_size" => Config::MAX_SIZE_AVATAR / KB_B)));
 }
Example #13
0
				                                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
				                                            	<tr>
				                                                    <td class="noresize">Alt Text</td>
				                                                    <td>
				                                                    	<div class="input_holder">
					                                                    	<?php 
echo \Form::input('alt_text', \Input::post('alt_text'));
?>
				                                                    	</div>
				                                                    </td>
				                                                </tr>
				                                                <tr>
				                                                    <td class="noresize">Replace Image</td>
				                                                    <td>
																		<?php 
echo \Form::file('image');
?>
																	</td>
				                                                </tr>                                                    
				                                            </table>
				                                        </td>
				                                    </tr>
				                                </table>
				                            	
				                            </div>
				                        </div><!-- EOF Images Panel -->
				                        
	                        			<div class="save_button_holder">
                                            <?php 
echo \Form::button('save', '<i class="icon-ok icon-white"></i>Save', array('type' => 'submit', 'class' => 'btn btn-success right', 'value' => '1'));
?>
Example #14
0
if ($showField) {
    ?>
    <div class="image-field">
        <div class="image-field-row">
            <div class="image-field-input">
                <?php 
    if (!empty($options['value'])) {
        ?>
                    <?php 
        echo Form::hidden($name, $options['value'], ['id' => 'image-field-hidden-' . $name]);
        ?>
                <?php 
    }
    ?>
                <?php 
    echo Form::file($name, $options['attr']);
    ?>
            </div>
            <?php 
    if (!empty($options['value'])) {
        ?>
                <div id="image-field-thumbnail-<?php 
        echo $name;
        ?>
">
                    <div class="image-field-cell">
                        <button type="button" data-name="<?php 
        echo $name;
        ?>
" data-required="<?php 
        echo (int) $options['required'];
Example #15
0
                    <img src="/imagefly/h130/images/logo.<?php 
    echo Arr::get($values, "logo_ext");
    ?>
" height="130" alt="" /><br />
                    <label><?php 
    echo Form::checkbox('delete_logo');
    ?>
 <?php 
    echo __('Delete image');
    ?>
</label>
                <?php 
}
?>
                <?php 
echo Form::file('logo', array("class" => "form-control"));
?>
        
            </div>
        </div>        
        
        <div class="form-item">
            <label class="col-sm-2 col-md-2 col-lg-2"><?php 
echo __('Your site title');
?>
</label>
            <div class="col-sm-10 col-md-10 col-lg-10">        
                <?php 
echo Form::input('title', isset($values['title']) ? $values['title'] : NULL, array("class" => "form-control", "placeholder" => __('Your site title')));
?>
            </div>
Example #16
0
		<div class="form-group">
			<?php 
echo Form::label('Данные', 'data', array('class' => 'control-label'));
?>
                        <?php 
echo Form::textarea('data', Input::post('data', isset($staff) ? $staff->data : ''), array('class' => 'col-md-8 form-control textarea_tinymce', 'rows' => 8, 'placeholder' => 'Данные об игроке'));
?>

		</div>
            
		<div class="form-group">
			<?php 
echo Form::label('Фотография', 'userfile', array('class' => 'control-label'));
?>
			<?php 
echo Form::file('userfile', array('class' => 'col-md-4 form-control', 'placeholder' => 'Фотография', 'style' => 'border:none;box-shadow:none'));
?>

		</div>
		<div class="form-group">
			<label class='control-label'>&nbsp;</label>
			<?php 
echo Form::submit('submit', 'Сохранить', array('class' => 'btn btn-primary'));
?>
		
                </div>
	</fieldset>
<?php 
echo Form::close();
?>
Example #17
0
 name="title" id="title" type="text" class="form-control">
</div>

<div class="form-group">
    <label> Time (in minutes) </label>
    <input value=<?php 
echo '"' . $activity->time . '"';
?>
 name="time" id="time" type="number" min="1" max="120" class="form-control"></textarea>
</div>

<div class="form-group">
    <label> Activity Box </label>
    <?php 
echo Form::file('description', ['id' => 'description', 'class' => 'form-control', 'accept' => '.php']);
?>
</div>

<div class="form-group">
    <label> Activity Page </label>
    <?php 
echo Form::file('activity', ['id' => 'activity', 'class' => 'form-control', 'accept' => '.php']);
?>
</div>

<?php 
echo Form::submit('Upload', ['class' => 'btn btn-info']);
echo Form::close();
?>
@stop
Example #18
0
<div class="form-group <?php 
echo isset($errors['image']) ? 'has-error' : '';
?>
">
	<?php 
echo Form::label('image', __('Image'), array('class' => 'col-sm-3 control-label'));
?>
	<div class="col-sm-5">
		<div class="thumbnail">
			<?php 
echo HTML::resize($post->image, array('alt' => $post->name, 'width' => 144, 'height' => 144, 'type' => 'resize'));
?>
		</div>
		<?php 
echo Form::file('image', array('class' => 'form-control'));
?>
		<span class="help-block"><?php 
echo __('Allowed image formats: :formats', array(':formats' => '<strong>' . implode('</strong>, <strong>', $allowed_types) . '</strong>'));
?>
</span>
	</div>
</div>

<div class="form-group <?php 
echo isset($errors['description']) ? 'has-error' : '';
?>
">
	<?php 
echo Form::label('description', __('Description'), array('class' => 'control-label col-md-3'));
?>
Example #19
0
File: file.php Project: raku/MorCMS
 /**
  * Input for create item
  * @return string Form::input
  */
 public function input_create($value)
 {
     return $value . ' ' . Form::file($this->item['name']) . Form::hidden($this->item['name'], $value);
 }
Example #20
0
?>

                            <div class="col-md-6">
                                <?php 
echo Form::select('country_id', $countrySelect, null, ['class' => 'form-control']);
?>
                            </div>
                        </div>

                        <div class="form-group">
                            <?php 
echo Form::label('image', 'Photo', ['class' => 'col-md-4 control-label']);
?>
                            <div class="col-md-6">
                                <?php 
echo Form::file('image', null);
?>
                            </div>
                        </div>

                        <div class="form-group">
                            <?php 
echo Form::label('password', 'Password', ['class' => 'col-md-4 control-label']);
?>
                            <div class="col-md-6">
                                <?php 
echo Form::input('password', 'password', null, ['class' => 'form-control']);
?>
                            </div>
                        </div>
Example #21
0
    $element = Form::textarea($name, $value, ['placeholder' => $placeholder, 'class' => 'form-control', 'id' => $name]);
    return "<div class='form-group " . errorClass($name) . "'>\n            <label class='control-label' for='{$name}'>{$label}</label>\n            {$element}" . errorMessage($name) . "</div>";
});
Form::macro('selectField', function ($name, $options, $value, $label) {
    $element = Form::select($name, $options, $value, ['class' => 'form-control']);
    return "<div class='form-group " . errorClass($name) . "'>\n            <label class='control-label' for='{$name}'>{$label}</label>\n            {$element}" . errorMessage($name) . "</div>";
});
Form::macro('multiSelectField', function ($name, $options, $value = null, $label) {
    $element = Form::select($name, $options, $value, ['class' => 'form-control multiselect', 'multiple']);
    return "<div class='form-group " . errorClass($name) . "'>\n            <label class='control-label' for='{$name}'>{$label}</label>\n            {$element}" . errorMessage($name) . "</div>";
});
Form::macro('selectTag', function ($name, $id, $label) {
    return "<div class='form-group " . errorClass($name) . "'>\n            <label class='control-label' for='{$name}'>{$label}</label>\n            <input id='{$id}' class='form-control' name='{$name}'/>" . errorMessage($name) . "</div>";
});
Form::macro('fileField', function ($name, $label) {
    return "<div class='form-group " . errorClass($name) . "'>\n            <label class='control-label' for='{$name}'>{$label}</label>" . Form::file($name) . errorMessage($name) . "</div>";
});
Form::macro('submitField', function ($value = 'Submit', $btn_style = 'btn btn-primary') {
    return "<div class='form-group'>\n            <button type='submit' class='{$btn_style}'>{$value}</button>\n            </div>";
});
if (!function_exists('errorMessage')) {
    function errorMessage($name)
    {
        if ($errors = Session::get('errors')) {
            return $errors->first($name, '<p class="help-block">:message</p>');
        }
        return "<p class='help-block' id='{$name}'></p>";
    }
}
if (!function_exists('errorClass')) {
    function errorClass($name)
Example #22
0
        @include('devise::admin.media._categories')

        <div id="dvs-media-mngr-gallery">
            <div id="dvs-media-upload">
                <?php 
echo Form::open(array('route' => 'dvs-media-upload', 'files' => true));
?>
                <?php 
echo Form::hidden('category', isset($input['category']) ? $input['category'] : '');
?>
                <?php 
echo Form::label('Upload File');
?>
                <?php 
echo Form::file('file');
?>
                <?php 
echo Form::submit('Upload', array('class' => 'dvs-button dvs-button-small'));
?>
                <?php 
echo Form::close();
?>
            </div>

            @include('devise::admin.media._items')
        </div>
    </div>

    @include('devise::admin.media.dropzone-preview-item')
Example #23
0
    echo Form::open(array('url' => '/assessment/submit/', 'method' => 'POST', 'class' => 'form-horizontal', 'files' => 'true'));
    echo Form::label('id', 'ID', array('class' => 'pull-left', 'style' => 'margin:10px;'));
    echo Form::text('id', 0, array('class' => 'pull-right disabled uneditable-input', 'style' => 'margin:5px;'));
    echo Form::label('title', 'Title', array('class' => 'pull-left', 'style' => 'clear:left;margin:10px;'));
    echo Form::text('title', '', array('class' => 'pull-right', 'placeholder' => 'Title of the Assessment', 'style' => 'clear:right;margin:5px;'));
    echo Form::label('description', 'Description', array('class' => 'pull-left', 'style' => 'margin:10px;clear:left;'));
    echo Form::text('description', '', array('class' => 'pull-right', 'placeholder' => 'Small Description of the Assessment', 'style' => 'clear:right;margin:5px;'));
    $tutorial = Tutorials::findOrFail($tutorialid);
    $tutoriallist[$tutorial->id] = $tutorial->name;
    $teacher = User::findOrFail($tutorial->createdby);
    echo Form::label('related_tutorial', 'Related Tutorial', array('class' => 'pull-left', 'style' => 'clear:left;margin:10px'));
    echo Form::select('related_tutorial', $tutoriallist, Session::get('tutorialid'), array('class' => 'pull-right uneditable-input', 'style' => 'clear:right;margin:5px;height:30px;'));
    echo Form::label('submitted_to', "Submitted To", array('class' => 'pull-left', 'style' => 'clear:left;margin:10px;'));
    $teacherlist = [$teacher->id => $teacher->first_name . ' ' . $teacher->last_name];
    echo Form::select('submitted_to', $teacherlist, $teacher->id, array('class' => 'pull-right disabled uneditable-input', 'style' => 'clear:right;margin:5px;height:30px;'));
    echo Form::label('subject', 'Subject', array('class' => 'pull-left', 'style' => 'clear:left;margin:10px;'));
    $subjectid = $tutorial->subjectid;
    $subject = Subject::findOrFail($subjectid);
    $subjectlist = [$subjectid => $subject->subjectname];
    echo Form::select('subject', $subjectlist, $subjectid, array('class' => 'pull-right disabled uneditable-input', 'style' => 'clear:right;margin:5px;height:30px;'));
    echo Form::label('assessment_type', 'Assessment Type', array('class' => 'pull-left', 'style' => 'clear:left;margin:10px;'));
    $assessment_types = ['presentation' => "Presentation", 'document' => 'Documentation'];
    echo Form::select('assessment_type', $assessment_types, 'presentation', array('class' => 'pull-right', 'style' => 'clear:right;margin:5px;'));
    echo Form::label('attachments', 'Attachments', array('class' => 'pull-left', 'style' => 'clear:left;margin:10px;'));
    echo Form::file('attachments[]', array('multiple' => 'true', 'class' => 'pull-right', 'style' => 'clear:right;margin:5px;'));
    echo Form::submit('Submit', array('class' => ' pull-left btn btn-success', 'value' => 'submit', 'style' => 'clear:both;'));
    echo Form::close();
}
?>
    </div>
</div>
Example #24
0
 /**
  * Tests Form::file()
  *
  * @test
  * @dataProvider provider_file
  * @param boolean $input  Input for Form::file
  * @param boolean $expected Output for Form::file
  */
 public function test_file($name, $attributes, $expected)
 {
     $this->assertSame($expected, Form::file($name, $attributes));
 }
Example #25
0
					<label for="image" style="margin-left:24px; margin-top:10px;"><?php 
echo Lang::get('lang.update_avatar');
?>
</label>
		            <img src="<?php 
echo Config::get('site.uploads_dir');
?>
/avatars/<?php 
echo Auth::user()->avatar;
?>
" alt="<?php 
echo $user->username;
?>
" class="img-circle user-avatar-medium pull-left" style="width:75px">
		            <?php 
echo Form::file('file', array('name' => 'avatar', 'style' => 'line-height:15px; margin-left:100px;'));
?>
		            <div style="clear:both"></div>
		        </li>
		        <li>
					<lable for="password"><?php 
echo Lang::get('lang.password_edit');
?>
:</label>
					<input type="password" name="password" id="password" class="form-control" />


			<input type="hidden" id="id" name="id" value="<?php 
echo Auth::user()->id;
?>
" />
Example #26
0
 public function render($errors = false)
 {
     $params = array('method' => $this->method);
     if ($this->has_files) {
         $params['enctype'] = 'multipart/form-data';
     }
     $params['class'] = 'modal-form';
     $form = Form::open($this->action, $params);
     if (!$errors) {
         $values = array();
         foreach ($this->elements as $value) {
             $values[$value['name']] = $value['type'] == Form::SELECT ? Arr::path($value, 'attr.value') : $value['value'];
         }
         $errors = $this->validate($values);
     } else {
         $form .= '<div class="alert alert-danger">' . (is_array($errors) ? implode("\n", $errors) : $errors) . '</div>';
     }
     foreach ($this->elements as $element) {
         if (Arr::get($element, 'type') == self::BOOL && Arr::path($element, 'attr.default')) {
             $form .= Form::input($element['name'], 0, array('type' => 'hidden'));
             unset($element['attr']['default']);
         }
         if (strpos(Arr::path($element, 'attr.class', ''), 'has-success') !== false) {
             $element['attr']['class'] = str_replace('has-success', '', $element['attr']['class']);
             $warning = ' has-success';
         } else {
             $warning = '';
         }
         $form .= '<div class="' . Arr::path($element, 'attr.parent', '') . ($element['type'] == Form::BOOL ? 'checkbox' : 'form-group') . (Arr::get($errors, $element['name']) ? ' required' : $warning) . '">';
         //$element['descr'] .= Arr::path($element, 'attr.parent', '');
         if (!isset($element['attr']['id'])) {
             $element['attr']['id'] = 'form-' . $element['name'];
         }
         if ($element['type'] != Form::BOOL) {
             $element['descr'] = $element['descr'] . (in_array('not_empty', Arr::get($this->validator, $element['name'], array())) ? '*' : '') . ': ';
             $form .= Form::label('form-' . $element['name'], $element['descr'], array('class' => 'control-label'));
             if ($element['type'] != Form::FILE) {
                 if (isset($element['attr']['class'])) {
                     $element['attr']['class'] .= ' form-control';
                 } else {
                     $element['attr']['class'] = 'form-control';
                 }
             }
         }
         if (!isset($element['attr']['placeholder']) && !$element['descr']) {
             $element['attr']['placeholder'] = $element['descr'];
         }
         switch ($element['type']) {
             case self::DATE:
                 $element['attr']['class'] = Arr::get($element['attr'], 'class') . ' datepicker';
                 $element['attr']['placeholder'] = "DD-MM-YYYY";
                 $form .= Form::input($element['name'], $element['value'] ? date('d-m-Y', $element['value']) : '', $element['attr']);
                 break;
             case self::IMAGE:
                 $form .= '<div class="custom-canvas-logo">';
                 $form .= Form::hidden($element['name'], $element['value'], array('id' => 'image-src'));
                 $form .= Form::file(NULL, array('class' => 'hiddenfile dynamic-file', 'id' => 'file-' . $element['name'], 'accept' => "image/*"));
                 $form .= '<a class=" btn btn-info dynamic-file-btn" id="dynamic-file-btn" data-id="' . $element['name'] . '" src="' . $element['value'] . '">No image selected</a>';
                 $form .= '<img class="form-image" data-id="' . $element['name'] . '" src="' . $element['value'] . '"/>';
                 $form .= '</div>';
                 break;
             case self::STRING:
                 $form .= Form::input($element['name'], $element['value'], $element['attr']);
                 break;
             case self::NUMBER:
                 $form .= Form::input($element['name'], $element['value'], $element['attr']);
                 break;
             case self::TEXT:
                 $form .= Form::textarea($element['name'], $element['value'], $element['attr']);
                 break;
             case self::SELECT:
                 $selected = Arr::get($element['attr'], 'value', NULL);
                 if ($selected) {
                     unset($element['attr']['value']);
                 }
                 $form .= Form::select($element['name'], $element['value'], $selected, $element['attr']);
                 break;
             case self::BOOL:
                 $form .= Form::label(NULL, Form::checkbox($element['name'], Arr::get($element['attr'], 'value'), (bool) $element['value'], $element['attr']) . ' ' . $element['descr']);
                 break;
             case self::FILE:
                 $form .= Form::file($element['name'], $element['attr']);
                 break;
             case self::PASSWORD:
                 $form .= Form::password($element['name'], NULL, $element['attr']);
                 break;
             case self::INFO:
                 $form .= '<p class="form-control-static">' . HTML::chars($element['value']) . '</p>';
                 break;
             case self::URL:
                 $value = HTML::chars($element['value']);
                 $form .= '<a href="' . $value . '">' . $value . '</a>';
                 break;
         }
         $form .= '</div>';
     }
     $form .= '<div class="form-group buttons-group">' . Form::submit(NULL, 'Save', array('class' => 'btn btn-primary ajax-submit'));
     if ($this->back_button) {
         $form .= '&nbsp;' . Form::button(NULL, 'Back', array('class' => 'btn btn-danger back-button', 'type' => 'button', 'data-dismiss' => "modal"));
     }
     $form .= '</div>';
     $form .= Form::close();
     return $form;
 }
Example #27
0
                             <td>
                                 <div class="input_holder">
                                     <?php 
 //echo \Form::input('alt_text_new_1', \Input::post('alt_text_new_1'));
 ?>
                                     <?php 
 echo \Form::input('alt_text_new_' . $item->id, \Input::post('alt_text_new_' . $item->id));
 ?>
                                 </div>
                             </td>
                         </tr>
                         <tr>
                             <td class="noresize">Choose Image</td>
                             <td>
                                 <?php 
 echo \Form::file('image_new_' . $item->id);
 ?>
                             </td>
                         </tr>
                     </table>
                 </td>
                <?php 
 if (count($item->images) > 1) {
     ?>
                     <td class="icon center"></td>
                 <?php 
 }
 ?>
                 <?php 
 if (!\Config::get('details.image.required', false) && !empty($item->images) || count($item->images) > 1) {
     ?>
Example #28
0
 public function input($name, $value, array $attr = NULL)
 {
     return Form::file($name, $attr);
 }
     $field = '';
     foreach ($element->options as $value => $label) {
         if ($assoc == false) {
             // only values given: value is $label, get label from textfile
             $value = $label;
             $label = text('option.' . $element->key . '.' . $value);
         }
         $checked = $value == $element->value;
         $field .= Form::radio($element->name, $value, $checked, $element->attributes) . '<span class="radioLabel">' . $label . '</span>' . ($element->spacer ? $element->spacer : '&nbsp;');
     }
     break;
 case 'button':
     $field = Form::button($element->name, $element->label, $element->attributes);
     break;
 case 'file':
     $field = Form::file($element->name, $element->attributes);
     break;
 case 'image':
     $field = Form::image($element->name, $element->value, $element->attributes, false);
     break;
 case 'text':
 case 'text_small':
 case 'input':
 case 'input_small':
 case 'email':
     $field = Form::input($element->name, $element->value, $element->attributes);
     break;
 case 'password':
     $field = Form::password($element->name, $element->value, $element->attributes);
     break;
 case 'submit':
Example #30
0
 * Created by PhpStorm.
 * User: oleg
 * Date: 26.11.15
 * Time: 16:07
 */
?>

<?php 
echo Form::open(['url' => action('AdminController@test'), 'method' => 'POST', 'files' => true]);
?>
{{ Form::text('first_name', null, ['class' => 'form-control', 'id' => 'first_name']) }}
{{ Form::text('last_name', null, ['class' => 'form-control', 'id' => 'last_name']) }}


<?php 
echo Form::file('avatar');
echo Form::submit('save');
echo Form::close();
?>

<img src="<?php 
echo $user->avatar->url();
?>
" >
<img src="<?php 
echo $user->avatar->url('medium');
?>
" >
<img src="<?php 
echo $user->avatar->url('thumb');
?>