Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

<head>
<style>
table, th, td {
    border: 1px solid black;
}
</style>
</head>
<?php echo $_SESSION["group_id"];?>
<div class="notificationCampaigns index">
        
        <h2><?php echo __('Notification Campaigns'); ?></h2>
        
        <table cellpadding="0" cellspacing="0" border="1" class="table table-striped" >
        <tr>
                        <th style="text-align:center"><?php echo $this->Paginator->sort('id'); ?></th>
                        <th style="text-align:center"><?php echo $this->Paginator->sort('name'); ?></th>
                        <th style="text-align:center"><?php echo $this->Paginator->sort('title'); ?></th>
                        <th style="text-align:center"><?php echo $this->Paginator->sort('created'); ?></th>
                        <th style="text-align:center"><?php echo $this->Paginator->sort('expiresat'); ?></th>
                        <th style="text-align:center">Total</th>
                        <th style="text-align:center">Failed</th>
                        <th style="text-align:center">Success</th>
                        <th style="text-align:center">Recieved</th>
                        <th style="text-align:center">Expired</th>
                        <th style="text-align:center">Gap</th>
                        <th style="text-align:center">Opened</th>
                        <th style="text-align:center">Referrer</th>
                        <th style="text-align:center">Login</th>                
                        <th style="text-align:center">Total Sms</th>
                        <th style="text-align:center">Failed Sms</th>
                        <th style="text-align:center">Success Sms</th>
                        <th style="text-align:center">Received Sms</th>
                        <th style="text-align:center">Expired Sms</th>
                        <th style="text-align:center">Sent To Operator</th>
                        <th style="text-align:center">Gap Sms</th>
                        <th style="text-align:center" class="actions"><?php echo __('Actions'); ?></th>
        
        </tr>

        <?php foreach ($notificationCampaigns as $key=> $notificationCampaign): ?>
        <?php 
        if(isset($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['sent']) && !empty($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['sent'])){

                $successSent=$notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['sent'];}
        else{
                $successSent=0;
        }
        if(isset($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['0']) && !empty($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['0'])){
                $successFailed=$notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['0'];
        }else{
                $successFailed=0;
        }
        ?>      
        <tr>

                <td align="center" width="4%"><?php echo h($notificationCampaign['NotificationCampaign']['id']); ?>&nbsp;</td>
                <td align="center"><?php echo h($notificationCampaign['NotificationCampaign']['name']); ?>&nbsp;</td>
                <td align="center"><?php echo h($notificationCampaign['NotificationCampaign']['title']); ?>&nbsp;</td>
                <!-- <td align="center"><?php //echo h($notificationCampaign['NotificationCampaign']['message']); ?>&nbsp;</td> -->
                <td align="center"><?php echo h($notificationCampaign['NotificationCampaign']['created']); ?>&nbsp;</td>
                <td align="center"><?php echo h($notificationCampaign['NotificationCampaign']['expiresat']); ?>&nbsp;</td>
                <td> 
                        <?php 
                                if(isset($result[$notificationCampaign['NotificationCampaign']['id']]['total'])){
                                        echo $result[$notificationCampaign['NotificationCampaign']['id']]['total'];
                                        $total = $result[$notificationCampaign['NotificationCampaign']['id']]['total'];
                                }else {echo '0';
                                        $total = 0;
                        }
                        ?>
                        &nbsp;

                </td>
                
                <td align="center">
                        <?php 
                                if(isset($result[$notificationCampaign['NotificationCampaign']['id']]['failed'])){
                                        //echo $this->Html->link(__(h($result[$notificationCampaign['NotificationCampaign']['id']]['failed'])), array('action' => 'show', $notificationCampaign['NotificationCampaign']['id'], 'sent',0));
                                        echo h($result[$notificationCampaign['NotificationCampaign']['id']]['failed']);
                                }else {echo h('0');}
                        ?>
                        &nbsp;
                </td>

                <td align="center" width="15%">
                        <?php //if(isset($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['sent']) && !empty($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['sent'])){echo $this->Html->link(__(h($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['sent'])), array('action' => 'show', $notificationCampaign['NotificationCampaign']['id'], 'sent',1)); } else {echo h('0');}?>
                        <?php 
                                if(isset($result[$notificationCampaign['NotificationCampaign']['id']]['success'])){
                                        echo h($result[$notificationCampaign['NotificationCampaign']['id']]['success']); 
                                        $success = $result[$notificationCampaign['NotificationCampaign']['id']]['success'];
                                }else {echo h('0');
                                $success = 0;
                        }
                        ?>
                <br>
                <?php //echo h('Trackable= '.$notificationWithVersionCode[$key]);?>
                <br>
                <?php //echo h('%= '.round((($notificationWithVersionCode[$key])/($successSent+$successFailed))*100));?>
                <?php echo h('Success %= '.round((($success)/($total))*100));?>
                </td>

                <td align="center">
                        <?php //if(isset($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['recieved']) && !empty($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['recieved'])){echo $this->Html->link(__(h($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['recieved'])), array('action' => 'show', $notificationCampaign['NotificationCampaign']['id'], 'recieved',1)); } else {echo h('0');}?>
                        <?php 
                                if(isset($result[$notificationCampaign['NotificationCampaign']['id']]['recieved'])){
                                        echo h($result[$notificationCampaign['NotificationCampaign']['id']]['recieved']); 
                                }else {echo h('0');}
                        ?>
                        &nbsp;
                </td>
                
                <td align="center">
                        <?php //if(isset($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['expired']) && !empty($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['expired'])){echo $this->Html->link(__(h($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['expired'])), array('action' => 'show', $notificationCampaign['NotificationCampaign']['id'], 'expired',1)); } else {echo h('0');}?>
                        <?php 
                                if(isset($result[$notificationCampaign['NotificationCampaign']['id']]['expired'])){
                                        echo h($result[$notificationCampaign['NotificationCampaign']['id']]['expired']); 
                                }else {echo h('0');}
                        ?>&nbsp;
                </td>
                
                <?php //if(isset($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['recieved']) && !empty($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['recieved'])){$recieved = $notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['recieved']; } else {$recieved =0;}?>
<?php //if(isset($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['expired']) && !empty($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['expired'])){$expired = $notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['expired']; } else {$expired=0;}?>
<?php 
                                if(isset($result[$notificationCampaign['NotificationCampaign']['id']]['recieved'])){
                                        $recieved = $result[$notificationCampaign['NotificationCampaign']['id']]['recieved'];  
                                }else {$recieved =0;}
                                if(isset($result[$notificationCampaign['NotificationCampaign']['id']]['expired'])){
                                        $expired = $result[$notificationCampaign['NotificationCampaign']['id']]['expired'];  
                                }else {$expired =0;}
                                if(isset($result[$notificationCampaign['NotificationCampaign']['id']]['1'])){
                                        $sent = $result[$notificationCampaign['NotificationCampaign']['id']]['1'];  
                                }else {$sent =0;}
        ?>
<td align="center" width="10%">
        <?php //echo($sent - ($recieved+$expired));?>
        <?php echo($success - ($recieved+$expired));?>
        
<br>
<?php //if($notificationWithVersionCode[$key]!=0){ echo('%= '.round((($notificationWithVersionCode[$key] - ($recieved+$expired))/$notificationWithVersionCode[$key])*100));}else {echo('%= 0');}?>
<?php if($success!=0){ echo('%= '.round((($success - ($recieved+$expired))/$success)*100));}else {echo('%= 0');}?>
</td>
                <td align="center">
                        <?php //if(isset($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['opened']) && !empty($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['opened'])){echo $this->Html->link(__(h($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['opened'])), array('action' => 'show', $notificationCampaign['NotificationCampaign']['id'], 'opened',1));  } else {echo h('0');}?>
                        <?php 
                                if(isset($result[$notificationCampaign['NotificationCampaign']['id']]['opened'])){
                                        echo h($result[$notificationCampaign['NotificationCampaign']['id']]['opened']); 
                                }else {echo h('0');}
                        ?>
                        &nbsp;
                </td>
                <td align="center">
                        <?php //if(isset($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['referrer']) && !empty($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['referrer'])){echo $this->Html->link(__(h($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['referrer'])), array('action' => 'show', $notificationCampaign['NotificationCampaign']['id'], 'referrer',1));  } else {echo h('0');}?>
                        <?php 
                                if(isset($result[$notificationCampaign['NotificationCampaign']['id']]['referrer'])){
                                        echo h($result[$notificationCampaign['NotificationCampaign']['id']]['referrer']); 
                                }else {echo h('0');}
                        ?>&nbsp;
                </td>
                <td align="center">
                        <?php //if(isset($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['login']) && !empty($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['login'])){echo $this->Html->link(__(h($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['login'])), array('action' => 'show', $notificationCampaign['NotificationCampaign']['id'], 'login',1)); } else {echo h('0');}?>
                        <?php 
                                if(isset($result[$notificationCampaign['NotificationCampaign']['id']]['login'])){
                                        echo h($result[$notificationCampaign['NotificationCampaign']['id']]['login']); 
                                }else {echo h('0');}
                        ?>&nbsp;
                </td>
                
                <td align="center">
                        <?php //if(isset($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['login']) && !empty($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['login'])){echo $this->Html->link(__(h($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['login'])), array('action' => 'show', $notificationCampaign['NotificationCampaign']['id'], 'login',1)); } else {echo h('0');}?>
                        <?php 
                                if(isset($result[$notificationCampaign['NotificationCampaign']['id']]['smssent'])){
                                        echo $result[$notificationCampaign['NotificationCampaign']['id']]['smssent']; 
                                        $smstotal = $result[$notificationCampaign['NotificationCampaign']['id']]['smssent'];
                                }else {echo h('0');
                                        $smstotal=0;
                                        }
                        ?>&nbsp;
                </td>
                
                <td align="center">
                        <?php //if(isset($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['smsrejected']) && !empty($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['smsrejected'])){echo $this->Html->link(__(h($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['smsrejected'])), array('action' => 'show', $notificationCampaign['NotificationCampaign']['id'], 'smsrejected',1)); } else {echo h('0');}?>
                        <?php 
                                if(isset($result[$notificationCampaign['NotificationCampaign']['id']]['smsrejected'])){
                                        echo $this->Html->link(__(h($result[$notificationCampaign['NotificationCampaign']['id']]['smsrejected'])), array('action' => 'show', $notificationCampaign['NotificationCampaign']['id'], 'smsrejected',1)); 
                                }else {echo h('0');}
                        ?>&nbsp;
                </td>
                <td align="center">
                        <?php //if(isset($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['smsrejected']) && !empty($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['smsrejected'])){echo $this->Html->link(__(h($notificationCampaignsCount[$notificationCampaign['NotificationCampaign']['id']]['smsrejected'])), array('action' => 'show', $notificationCampaign['NotificationCampaign']['id'], 'smsrejected',1)); } else {echo h('0');}?>
                        <?php 
                                if(isset($result[$notificationCampaign['NotificationCampaign']['id']]['smsprocessed'])){
                                        echo $this->Html->link(__(h($result[$notificationCampaign['NotificationCampaign']['id']]['smsprocessed'])), array('action' => 'show', $notificationCampaign['NotificationCampaign']['id'], 'smsprocessed',1)); 
                                        $smssuccess=$result[$notificationCampaign['NotificationCampaign']['id']]['smsprocessed'];
                                }else {echo h('0');
                                        $smssuccess=0;
                                        }
                                if($smstotal==0){
                                        $successpert = 0;
                                }else{
                                        $successpert = round(($smssuccess)/($smstotal)*100);
                                }
                        ?>&nbsp;
                        <br>
                        <br>
                        <?php echo h('Success %= '.$successpert);?>
                </td>
                <td align="center">
                        <?php 
                                if(isset($result[$notificationCampaign['NotificationCampaign']['id']]['SMS_DELIVRD'])){
                                        echo $this->Html->link(__(h($result[$notificationCampaign['NotificationCampaign']['id']]['SMS_DELIVRD'])), array('action' => 'show', $notificationCampaign['NotificationCampaign']['id'], 'SMS_DELIVRD',1)); 
                                        $receivedsms=$result[$notificationCampaign['NotificationCampaign']['id']]['SMS_DELIVRD'];
                                }else {echo h('0');
                                        $receivedsms = 0;
                                }
                        ?>&nbsp;
                </td>
                <td align="center">
                        <?php 
                                if(isset($result[$notificationCampaign['NotificationCampaign']['id']]['SMS_EXPIRED'])){
                                        echo $this->Html->link(__(h($result[$notificationCampaign['NotificationCampaign']['id']]['SMS_EXPIRED'])), array('action' => 'show', $notificationCampaign['NotificationCampaign']['id'], 'SMS_EXPIRED',1)); 
                                        $expiredsms = $result[$notificationCampaign['NotificationCampaign']['id']]['SMS_EXPIRED'];
                                }else {echo h('0');
                                        $expiredsms = 0;
                                        }
                        ?>&nbsp;
                </td>
                <td align="center">
                        <?php 
                                if(isset($result[$notificationCampaign['NotificationCampaign']['id']]['SMS_SENT_OPERATOR'])){
                                        echo $this->Html->link(__(h($result[$notificationCampaign['NotificationCampaign']['id']]['SMS_SENT_OPERATOR'])), array('action' => 'show', $notificationCampaign['NotificationCampaign']['id'], 'SMS_SENT_OPERATOR',1)); 
                                        $sentoperator = $result[$notificationCampaign['NotificationCampaign']['id']]['SMS_SENT_OPERATOR'];
                                }else {echo h('0');
                                        $sentoperator = 0;
                                }
                        ?>&nbsp;
                </td>

                <td align="center">
                        
                        <?php echo($smssuccess - ($receivedsms+$expiredsms+$sentoperator));?>
        
                        <br>

                        <?php if($smssuccess!=0){ echo('%= '.round((($smssuccess - ($receivedsms+$expiredsms+$sentoperator))/$smssuccess)*100));}else {echo('%= 0');}?>
                        <br>
                </td>
                
                <td align="center" width="15%" class="actions">

                        <?php echo $this->Html->link(__('View'), array('action' => 'view', $notificationCampaign['NotificationCampaign']['id'])); ?>
                        &nbsp;
                        
                </td>
        </tr>
<?php endforeach; ?>
        </table>

        <ul class="pager">
                <?php if($page>1):?>
                <li><a href="?page=<?php echo $page-1;?>">Previous</a></li>
                <?php endif;?>
                
                <li><a href="?page=<?php echo $page+1;?>">Next</a></li>
                
        </ul>
        </div>
</div>