<?php $this->load->view("main/bot_users/header"); ?>
<?php $this->load->helper('smiley_helper.php'); ?>
<?php $this->load->helper('smiley'); ?>

<head>
<title>Smileys</title>

<?php echo smiley_js(); ?>

</head>
    
	<style>
		.folder{
	   width: 130px;
	   height: 130px;
	   padding: 10px;
	   border: 1px solid #ddd;
	   float: right;
	   margin-left:15px;
	   cursor: pointer;
	   border-radius: 5px;
	   margin-bottom:10px;
	   position: relative;
}
.folder:hover{
	   border: 1px solid rgb(112,146,190);
	   color: rgb(112,146,190) !important;
}
.add:hover,.back:hover{
	 border: 1px solid green;
	   color: green !important;   
}
.folder i {
	   font-size: 85px;
	   text-align: center;
	   margin-right:5px;
}
.add i
{
	   margin-right:20px !important;
}
.folder span{
	   width: 100%;
	   display: block;
	   text-align: center;
	   font-size: 12px;
}
.folder img{
	   width: 100%;
	   height: 90px;
}
.add_folder,.display_images,.change_name{
	   width: 100%;
	   height: 100%;
	   position: fixed;
	   top: 0;
	   left: 0;
	   z-index: 3000;
	   background: rgba(0,0,0,0.5);
}
#delete_sl{
	width: 100%;
	height: 100%;
	position: absolute;
	background: rgba(0,0,0,0.7);
	top: 0;
	left: 0;
	border-radius: 5px;
}
#delete_sl button{
	margin:67px 19px;
}
textarea{
		height: 100px !important;
		resize: none;
	}
	</style>

<div class="col-lg-12">
	<div class="add_folder" style="display: none;">
	   <div class="modal-dialog">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                                                <h4 class="modal-title">ذخیره ی تصویر</h4>
                                            </div>
                                            <div class="modal-body">

                                                <form role="form" action="<?php echo base_url(); ?>/botuser/set_galery_photo_galery" method="post" enctype="multipart/form-data" >
												 <input type="hidden" id="hidden_path" name="path" value="<?php echo $this->input->get("textid"); ?>" />
												 <input type="hidden" id="hidden_path" name="groupname" value="<?php echo $this->input->get("textid"); ?>" />
										   <div id="piture" >
                                                    <div class="form-group">
                                                        <label for="exampleInputFile">تصویر مورد نظر خود را بارگذاری کنید.</label>
                                                        <input type="file" class="form-control" name="uploadfile" id="exampleInputFile3">
                                                    </div>
													<div class="form-group">
													 <label for="exampleInputFile" style="margin-top:20px;">کپشن تصویر را وارد کنید</label>
														<input type="text" class="form-control" name="caption">
													</div>
                                            </div>       
                                                    <button type="submit" class="btn btn-default">ایجاد</button>
                                                </form>
                                            </div>
                                        </div>
                                    </div>
</div>
	<section class="panel">
        <header class="panel-heading"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><?php echo $this->input->get("name") ?></header>
		   <div class="panel-body">
			<form method="post" action="<?php echo base_url(); ?>botuser/set_imagetext_text" >
													<div class="form-group col-lg-1 left">
													</div>
													<input type="hidden" name="postid" value="<?php echo $this->input->get("textid") ?>">
														<div class="form-group col-lg-10 left">
															<div class="form-group col-lg-12">
                                        <label for="name">سرتیتر</label>
                                        <input type="text" class="form-control" name="title"  value="<?php echo @$result[0]->title ?>">
															</div>
														<div class="form-group col-lg-12">
										 <label for="name">متن</label>
                                        <textarea class="form-control" name="content"><?php echo @$result[0]->text ?></textarea>
                                        <!--<p>Click to insert a smiley!</p>-->
                                        <?php /*echo $smiley_table;*/ ?>
										<div class="form-group col-lg-12" style="margin-top:15px;">		
										<input type="submit" class="btn btn-info" value="ذخیره">
												</div>
														</div>
			</form>
														<hr/>
														<?php //die(count($images)) ?>
									<?php if(count($images) > 0){ ?>
									
									<?php foreach($images as $value){ ?>					
					<div class="folder"  data_name="<?php echo $value; ?>">
			<div id="delete_sl" style="display: none;">
				<button class="btn btn-danger">حذف کردن</button>
			</div>
			<img src="<?php echo base_url(); ?>/assets/telegrams/<?php echo $this->session->userdata("id"); ?>/<?php echo $this->input->get("textid"); ?>/<?php echo $value; ?>"><span></span>
														</div>
														<?php } ?>
														<?php } ?>
														<div class="folder add"><i class="icon-plus"></i><span>اضافه کردن</span></div>
												
                                    </div>
													
																						
													
												 </div>
	</section>
</div>
 <?php $this->load->view("main/bot_users/footer"); ?>
 <script>
	 $(".close").click(function(){
		  $(".add_folder").css({"display":"none"});
		});
	 $(".folder").mouseenter(function(){
		$(this).find("#delete_sl").css({"display":"block"});
		});
	 $(".folder").mouseleave(function(){
		$(this).find("#delete_sl").css({"display":"none"});
		
		});
	 $(".add").click(function(){
			  $(".add_folder").css({"display":"block"});
			  });
	 $(".btn-danger").click(function(){
		$image = $(this).parent().parent();
		$name = $(this).parent().parent().attr("data_name");
		$.post("<?php echo base_url(); ?>botuser/delete_image_control",{filename:$name,folderid:"<?php echo $this->input->get("textid"); ?>"},function(e){
			if (e == "done") {
				$image.remove();
			}
			
			});
		});
 </script>