<?php
/********************************************************************************* 
 *  This file is part of Sentrifugo.
 *  Copyright (C) 2014 Sapplica
 *   
 *  Sentrifugo is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Sentrifugo is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Sentrifugo.  If not, see <http://www.gnu.org/licenses/>.
 *
 *  Sentrifugo Support <support@sentrifugo.com>
 ********************************************************************************/
?>
 <?php  $msgtitle = $this->controllername.'_delete';
        sapp_Helper::editdeleteForView(ANNOUNCEMENTS,$this->controllername,$this->id,$msgtitle);?>  
<?php 

if($this->nodata != '')
{
?>
<div class="ml-alert-1-info m1-info-set-2">
    <div class="style-1-icon info"></div>
       No data found.
</div>
<?php 
}
else 
{
$data = $this->data;
$id = $this->id;
$previ_data = $this->previ_data;

?>
<script type="text/javascript" src="<?php echo MEDIA_PATH;?>js/jquery.prettyPhoto.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo MEDIA_PATH; ?>css/prettyPhoto.css" />
<?php 
if($this->ermsg == '')  { ?>
<div class="total-form-controller cancel-set data-view-details">
    <div class="position_rel">
       
   </div>
   
   <div class="cofig_title" style="margin-left: 0px; padding-top: 0px; margin-bottom:20px;">
   <div class="fltleft">Announcements</div>
   <?php
		$auth = Zend_Auth::getInstance();
     	if($auth->hasIdentity()){
			$loginuserRole = $auth->getStorage()->read()->emprole;
		}
    if(($previ_data == 'Yes' && $data['status']==1) || $loginuserRole == SUPERADMINROLE)
    {
    ?>
	  <!--       <div class="new-form-ui-submit "  style="float: right; width: auto; clear:none;">
	            <input type="button" class="fltright" onclick="changeeditscreen('<?php echo $this->controllername;?>',<?php echo $this->id;?>);" value="Edit" />        
	        </div> -->
	   
    <?php 
    }
    ?>
	</div>
	
<?php 
sapp_Helper::viewHeader();
?>
		
<!--        <div class="width_20_left"><label>Business Units</label></div>
        <div class="width_80_right">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</div>-->
        
	  <div class="main_view_child">	
      <div class="width_20_left"><label>Business Units</label></div>
      <div class="width_80_right"><label><?php echo isset($this->data['busi_names'])?$this->data['busi_names']:"...";?></label></div>
      </div>
      <div class="main_view_child">
       <div class="width_20_left"><label>Departments</label></div>
       <div class="width_80_right"><label><?php echo isset($this->data['dept_names'])?$this->data['dept_names']:"...";?></label></div>
       </div>
       <div class="main_view_child">
      <div class="width_20_left"><label>Title</label></div>
      <div class="width_80_right"><label><?php echo isset($this->data['title'])?$this->data['title']:"...";?></label></div>
      </div>
      <div class="main_view_child">
       <?php 
      //if($data['attachments']){
	?>
                    <div class="width_20_left"><label>Attachments</label></div>
                    <div class="width_80_right">
                    <label><?php 
                   if(isset($data['attachments'])) {
                    if($data['status']==2){
                    	$path = CA_FILES_PATH; 
                    } else {
                    	$path = CA_FILES_TEMP_PATH; 
                    }				
            		$attachments = json_decode($data['attachments'],true); $i=0;
                    foreach ($attachments as $k => $v){
                        if(in_array(strtolower(sapp_Htmlhelper::getExtension($v["new_name"])), array('jpg','png','gif','jpeg'))) {?>
                        <a href="<?php echo $path.$v["new_name"];?>" rel="prettyPhoto[pp_gal]" title="<?php echo $v["original_name"];?>" class="link">
                        <?php if($i == 0){ ?>Click to view<?php }?>
                        </a>
                    <?php } else {?>
                        <a href="<?php echo $path.$v["new_name"];?>?iframe=true&width=80%&height=90%" rel="prettyPhoto[pp_gal]" title="<?php echo $v["original_name"];?>" class="link">
                        <?php if($i == 0){ ?>Click to view<?php }?>
                        </a>
                <?php }$i++;}?> </label> 
                </div>
      
			<?php //}
                     }else{
                     	echo "no attachment";
                     }
                     
       }
			?>
			 </div>
			  <div class="main_view_child">
       <div class="width_20_left"><label>Description</label></div>
       <div class="width_80_right"><label><?php echo isset($this->data['description'])?$this->data['description']:"...";?></label></div>
       </div>
       <?php 
       if($data['status']==2){
       	?>
       	<div class="main_view_child">
       <div class="width_20_left"><label>Posted Date</label></div>
       <div class="width_80_right"><label><?php echo isset($this->data['modifieddate'])?$this->data['modifieddate']:"...";?></label></div>
       </div>
       	<?php } ?>
		<?php 
			sapp_Helper::viewFooter();
          ?>

</div></div>
<script type="text/javascript">
$(document).ready(function(){
	$("a[rel^='prettyPhoto']").prettyPhoto({social_tools : '', deeplinking: false});
});
</script>
<?php } ?>