Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
15403 manish.sha 1
<?php
2
   require_once('loader.php');
3
 
4
    $resultUsers =  getAllUsers();
5
    if ($resultUsers != false)
6
        $NumOfUsers = mysql_num_rows($resultUsers);
7
    else
8
        $NumOfUsers = 0;
9
?>
10
<!DOCTYPE html>
11
<html>
12
    <head>
13
        <title></title>
14
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
15
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
16
        <script type="text/javascript">
17
            $(document).ready(function(){
18
 
19
            });
20
            function sendPushNotification(id){
21
                var data = $('form#'+id).serialize();
22
                $('form#'+id).unbind('submit');                
23
                $.ajax({
24
                    url: "send_push_notification_message.php",
25
                    type: 'GET',
26
                    data: data,
27
                    beforeSend: function() {
28
 
29
                    },
30
                    success: function(data, textStatus, xhr) {
31
                          $('.push_message').val("");
32
                    },
33
                    error: function(xhr, textStatus, errorThrown) {
34
 
35
                    }
36
                });
37
                return false;
38
            }
39
        </script>
40
        <style type="text/css">
41
 
42
            h1{
43
                font-family:Helvetica, Arial, sans-serif;
44
                font-size: 24px;
45
                color: #777;
46
            }
47
            div.clear{
48
                clear: both;
49
            }
50
 
51
            textarea{
52
                float: left;
53
                resize: none;
54
            }
55
 
56
        </style>
57
    </head>
58
    <body>
59
 
60
 
61
        <table  width="910" cellpadding="1" cellspacing="1" style="padding-left:10px;">
62
         <tr>
63
           <td align="left">
64
              <h1>No of Devices Registered: <?php echo $NumOfUsers; ?></h1>
65
              <hr/>
66
           </td>
67
          </tr> 
68
          <tr>
69
            <td align="center">
70
              <table width="100%" cellpadding="1"
71
                        cellspacing="1"
72
                        style="border:1px solid #CCC;" bgcolor="#f4f4f4">
73
                <tr>
74
 
75
       <?php
76
        if ($NumOfUsers > 0) {
77
            $i=1;
78
            while ($rowUsers = mysql_fetch_array($resultUsers)) {
79
                if($i%3==0)
80
                  print "</tr><tr><td colspan='2'> </td></tr><tr>";
81
         ?>
82
                <td align="left">
83
                     <form id="<?php echo $rowUsers["id"] ?>"
84
                           name="" method="post"
85
                           onSubmit="return sendPushNotification('<?php echo $rowUsers["id"] ?>')">
86
                        <label><b>Name:</b> </label> <span><?php echo $rowUsers["name"] ?></span>
87
                        <div class="clear"></div>
88
                        <label><b>Email:</b></label> <span><?php echo $rowUsers["email"] ?></span>
89
                        <div class="clear"></div>
90
                        <div class="send_container">                                
91
                            <textarea rows="3"
92
                                   name="message"
93
                                   cols="25" class="push_message"
94
                                   placeholder="Type push message here"></textarea>
95
                            <input type="hidden" name="regId"
96
                                      value="<?php echo $rowUsers["gcm_regid"] ?>"/>
97
                            <input type="submit" 
98
                                      value="Send Push Notification" onClick=""/>
99
                        </div>
100
                    </form>
101
                 </td>
102
            <?php }
103
        } else { ?> 
104
              <td>
105
                User not exist.
106
               </td>
107
        <?php } ?>
108
 
109
                </tr>
110
                </table>
111
            </td>
112
          </tr>  
113
        </table>
114
 
115
 
116
    </body>
117
</html>