<script src="<?php echo BASE_URL; ?>public/js/ckeditor/ckeditor.js" type="text/javascript"></script>
<script type="text/javascript" >
    $(document).ready(function(){
        loadCKEditor('vDescription', 600);
        
    })
</script>
<div class="comm_div">
    <div class="comm_content_block">
        <h3>Content Management</h3>
        <div class="comm_content_block_items">
            <div  style="color:green;" ><?php echo $this->message; ?></div>
           
            <table width="100%" cellspacing="1" cellpadding="0" border="0" class="list_table">
                <tbody>
                    
                    <tr>
                        <th width="3%" valign="top" align="center">#</th>
                        <th width="31%" valign="top" align="left">Title</th>                        
                        <th width="5%" valign="top" align="center">Action</th>
                    </tr>
                    <?php
                    if(sizeof($this->cmsContent)>0) {
                        $i=0;
                        foreach($this->cmsContent as $row) {
                            $i++;
                            ?>
                <div id="listMsg<?php echo $row->nBusId;?>" style="color: red"></div>
                <div>
                    <tr class="row_color1" id="rate<?php echo $row->nContentId	;?>">
                        <td valign="top" align="center"><?php echo ($this->page-1)*$this->pageMaxCount +$i//$i; ?></td>
                        <td valign="top" align="left"><?php echo stripslashes($row->vTitle); ?></td>                        
                        <td valign="top" align="center"><a href="<?php echo ConfigUrl::base() ?>index/contentmanagement/<?php echo $row->nContentId?>" id="<?php echo $row->nContentId?>">Edit</a> </td>
                    </tr>
                </div>
                        <?php
                    }
                } else {
                    echo '<tr class="row_color1">
                      <td colspan="6">No Record Found</td></tr>';
                }
                ?>

                </tbody></table>


    <table border="0" id="cmseditcontent" cellpadding="0" cellspacing="0" class="form_tbls" <?php if(isset($this->cmsContentRecord->vTitle)){?>style="display: block;"<?php } else { ?>style="display: none;" <?php } ?> width="100%">
     <form name="frmCms" id="frmUsers" method="post" action="<?php echo ConfigUrl::base();?>index/contentmanagement" onsubmit="return valiadtion();" >
    <input type="hidden" value="<?php echo $this->cmsContentRecord->nContentId;?>" name="nContentId"/>      
    <tr>
        <td width="30%" style="text-align: right;">Title<span style="color: red">*</span> : </td>
        <td width="70%" ><input type="text" class="txt_area" id="vTitle"  name="vTitle" value="<?php echo stripslashes($this->cmsContentRecord->vTitle);?>"/></td>
    </tr> 
    <tr>
        <td width="30%" style="text-align: right;">Page Content<span style="color: red">*</span> : </td>
        <td width="70%"><textarea id="vDescription"  name="vDescription" cols="80" rows="5" class="textbox1"><?php echo stripslashes($this->cmsContentRecord->vDescription);?></textarea> </td>
    </tr>
    <tr>
        <td></td>
         <td>
         <input type="submit" name="saveContent" value="Save" class="btn_styles">&nbsp;
         <input type="reset" name="cancel" value="Cancel" class="btn_styles" onclick="hide()">
         </td>
    </tr>
    </form>
    </table>


            <div class="clear"></div>
        </div>
    </div>
</div>


<div id="divComm" style="top: 100px;left: 300px;position: absolute;background-color: gray"></div>
<script type="text/javascript">
   function valiadtion()

{
		if(document.frmCms.vTitle.value=="")
		{
		
			alert("Please enter title");
			document.frmCms.vTitle.focus();
			return false;
		
		}
                if(document.frmCms.vDescription.value=="")
		{
		
			alert("Please enter page content");
			document.frmCms.vDescription.focus();
			return false;
		
		}
                else
		{
		
		return true;
		
	}	

}
 function hide(){
      document.getElementById("cmseditcontent").style.display = "none";
 }
 
 function loadCKEditor(container, width){
CKEDITOR.replace( container,
{

filebrowserBrowseUrl : '<?php echo BASE_URL; ?>public/js/ckeditor/ckfinder/ckfinder.html',
filebrowserImageBrowseUrl : '<?php echo BASE_URL; ?>public/js/ckeditor/ckfinder/ckfinder.html?type=Images',
filebrowserFlashBrowseUrl : '<?php echo BASE_URL; ?>public/js/ckeditor/ckfinder/ckfinder.html?type=Flash',
filebrowserUploadUrl :
'<?php echo BASE_URL; ?>public/js/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files&currentFolder=/archive/',
filebrowserImageUploadUrl :
'<?php echo BASE_URL; ?>public/js/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images&currentFolder=/cars/',
filebrowserFlashUploadUrl : '<?php echo BASE_URL; ?>public/js/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'

});

CKEDITOR.config.width = width;
CKEDITOR.config.height = 150;
CKEDITOR.editorConfig = function( config )
{
	config.toolbar = 'Basic';
 
config.toolbar_Basic =
[
	['Bold', 'Italic','Underline', '-', 'NumberedList', 'BulletedList', '-', '-','About']
];
};

}
 
</script>
