<?php

	$fileresourceArray =  Dap_FileResource::loadAllAvailableFileResources();
  
?>
 <link rel='stylesheet' id='dap_pay_per_post_settings_dataTables.css-css'  href='//cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css?ver=1.0.0' media='all' />
<div id="postmeta_outer">
<div class="live-links-outer pp-post-inner post-inner">
 	<h3 class="pp--post-title"><i class="fa fa-cogs" aria-hidden="true"></i> Content Thumbnail</h3>
 	
 	<div class="text-with-sideborder with_redborder">
		<p>You can add a thumbnail image for your content (pages/posts) here. You can also add a brief description for your content here.
This will be used in the "My Content" template (if you select the template that supports thumbnail image for content)</p>
	</div>
 	
 	
<table id="dap_manage_pay_per_post_table" class="table table-striped table-bordered dap-data-table-style" cellspacing="0" width="100%">
    <thead>
        <tr>
            
            <th class="Title-th">Post/Page Title</th>
            <th class="url-th">Post/Page URL</th>
            <th class="image-th" >Image Thumbnail</th>
            <th class="teaser-th">Post Description</th>
            <th class="action-th">Action</th>
        </tr>
    </thead> 
    <tbody style="display:none"> 
		<?php 
			if (isset($fileresourceArray) ){ 
				
				$image_url = "";
				$excerpt = "";
				
				foreach ($fileresourceArray as $resource){
					//echo "<pre>"; print_r($resource);			
					$loadResourceArray = Dap_CourseLessonsMeta::loadByResourceId($resource['id']);
					if (isset($loadResourceArray) ){   
						 
						if (isset($loadResourceArray[0]) ){   	
							$image_url = $loadResourceArray[0]->getImageURL();
							$excerpt = $loadResourceArray[0]->getExcerpt();
							 
						}else{								
							$image_url = "";
							$excerpt = "";
						} 
						
				    }
			?>
				<tr id="row_<?php echo $resource['id'];?>">
					
					<td class="Title-th resource_name"><?php echo $resource['name'];?></td>
					<td class="url-th"><a target="_blank" href="<?php echo $resource['url'];?>"><?php echo $resource['url'];?></a></td>
					<td class="dap-data-table-align-center image-th"> 
						
						<?php if($image_url !=""){ ?>
							<img class="image_data" src="<?php  echo $image_url;?>" width="60"/>
						<?php }else { ?>  
							<a href="javascript:void(0);" data-id="<?php echo $resource['id'];?>" class="clicktoaddimage image_btn_<?php echo $resource['id'];?>">Click here to Add Image</a>
							<img class="image_data"  src="" width="60" style="display:none"/>
						<?php } ?>
						
						</td>
					 
						<?php if($excerpt !=""){
								$excerpt_length =  strlen($excerpt);
								$excerpt1 = $excerpt;
								$excerpt_tool_trip = '';
								/*if($excerpt_length >= 50){
									$excerpt = substr($excerpt,0,50).'...';
									
									$excerpt_tool_trip ='<span class="tool-tip">
														<span class="tool-tip-outer">
														<i aria-hidden="true" class="fa fa-info-circle"></i>
														<span class="toll-tip-desc">'.$excerpt1.'
														</span>
														</span>
														</span>';
									
									
								}*/

							 ?>
							<td class= "teaser_cls teaser-th" >
								
								
							<div class="teaser_data" > <?php  echo $excerpt; //echo $excerpt_tool_trip;?></div>
						<?php }else { ?>
							<td class= "teaser_cls text-center"> 
							<a href="javascript:void(0);" data-id="<?php echo $resource['id'];?>" class="clicktoaddimage1 teaser_btn_<?php echo $resource['id'];?>">Click here to Add Description</a>
							<div class="teaser_data" style="display:none"></div>
						<?php } ?>
					</td>             
					<td class="dap-data-table-align-center action-th"><a data-id="<?php echo $resource['id'];?>"  class="btn btn-info btn-sm clicktoaddimage2" title="Edit Post" href="javascript:void(0);"><i class="fa fa-pencil"></i></a></td>
				</tr>
 
         <?php 
				}
			}
         ?>
        
    </tbody>
</table>

<div>
<div>

 <button  id="getImagesettingpoup" data-toggle="modal" data-target="#modalImageSetting" style="display:none"></button>
 <button  id="getImagesettingpoup1" data-toggle="modal" data-target="#modalImageSetting" style="display:none"></button>
 <button  id="getImagesettingpoup2" data-toggle="modal" data-target="#modalImageSetting" style="display:none"></button>
<!-- Modal -->
<div id="modalImageSetting" class="modal dap-modal-style " role="dialog">
	<div class="modal-dialog modal-dialog-centered ">
		<!-- Modal content-->
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal">&times;</button>
				<h4 class="modal-title">Image Settings</h4>
			</div>
			<div class="modal-body">
				<div class="warning_cls" style="display:none">Saved Successfully</div>
				
				<div class="postmeta-content-card align-items-top product_image_cont noborder title_content_outer">
					<label for="" class="postmeta_label">Content Title</label>
					<div class="postmeta_right-content">						  
						 <input type="text" id="post_title" name="post_title"  value="" placeholder="Enter Content Title">
					</div>
				</div>
				
				<div class="postmeta-content-card align-items-top product_image_cont noborder teaser_content_outer">
					<label for="" class="postmeta_label">Content Description</label>
					<div class="postmeta_right-content">
						  
						<div class="dap_member_tiny_editor1 teaser_content1 " id="teaser_content"><div></div></div>
					</div>
				</div>
				
				<div class="postmeta-content-card align-items-top product_image_cont image_url_outer">
					<label for="" class="postmeta_label">Upload an image</label>
					<div class="postmeta_right-content">
						<input type="button"  class="dap_postmeta_img_upload" value="Choose File">
						<div class="or_div">
							<span>Or</span>
						</div>
						<input name="image_url" id="image_url" type="text" value="" placeholder="Enter Image URL">
						<input name="resource_id" id="resource_id" type="hidden" value="">						 
						<input name="attr_checked" id="attr_checked" type="hidden" value="">						 
					</div>
				</div>
				
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default savedata"  >Save</button>
			</div>
		</div>
	</div>
</div>
  
  
<div style="display:none" id="teaser_content_clone">
 

</div>   
