Example #1
0
    public function px_gcm_display_view($id, $regId, $os, $model, $date, $num, $total)
    {
        $set_date = get_option('date_format');
        $set_time = get_option('time_format');
        $set = $set_date . ' ' . $set_time;
        $old_date_timestamp = strtotime($date);
        $new_date = date($set, $old_date_timestamp);
        ?>
		<style type="text/css">
		.table-content {
			font-style: italic;
			background-color: #CCC;
		}
		</style>

		<div class="wrap">
			<h2 class=""><?php 
        _e('Single Device', 'px_gcm');
        ?>
</h2>
			<div id="poststuff">		
				<div id="post-body" class="metabox-holder columns-1"> 
				<!-- Content starts here -->
					<div id="post-body-content">
						<div class="postbox">
							<h3><?php 
        _e('Information', 'px_gcm');
        ?>
</h3>
							<div class="inside">
								<table width="100%" border="0">
									<td>
										<table width="77%" border="0">
											<tr>
												<td><?php 
        _e('Database ID', 'px_gcm');
        ?>
</td>
												<td><input type="text" name="db_id" value="<?php 
        echo $id;
        ?>
" readonly /></td>
											</tr>
											<tr>
												<td><?php 
        _e('GCM ID', 'px_gcm');
        ?>
</td>
												<td><textarea type="text" name="gcm_id" cols="77" rows="5" readonly ><?php 
        echo $regId;
        ?>
</textarea></td>
											</tr>
											<tr>
												<td><?php 
        _e('Device OS', 'px_gcm');
        ?>
</td>
												<td><input type="text" name="os" value="<?php 
        echo $os;
        ?>
" readonly /></td>
											</tr>
											<tr>
												<td><?php 
        _e('Device Model', 'px_gcm');
        ?>
</td>
												<td><input type="text" name="model" value="<?php 
        echo $model;
        ?>
" readonly /></td>
											</tr>
											<tr>
												<td><?php 
        _e('Registration Date', 'px_gcm');
        ?>
</td>
												<td><input type="text" name="date" value="<?php 
        echo $new_date;
        ?>
" readonly /></td>
											</tr>
										</table>
									</td>
									<td>
										<canvas id="msgChart" width="250" height="250"></canvas>
									</td>
								</table>
							</div> 
						</div>
					</div>
					
					<div id="postbox-container-1" class="postbox-container">
						<div class="postbox">
								<h3><?php 
        _e('Write a Message to this Device', 'px_gcm');
        ?>
</h3>
								<div class="inside">
									<form method="post" action="#">
										<p><?php 
        _e('Enter here your message', 'px_gcm');
        ?>
</p>
										<textarea id="msg" name="msg" type="text" cols="50" rows="5" ></textarea>
										<p><?php 
        _e('*Please don\'t use HTML', 'px_gcm');
        ?>
</p>
										<?php 
        submit_button(__('Send', 'px_gcm'));
        ?>
									</form>
								</div> 
						</div>
					</div>
				
					
				</div> 
				<br class="clear">				
			</div>
		</div>
		<script type="text/javascript">
			var ctx = document.getElementById("msgChart").getContext("2d");
			var options = { animationEasing: "easeOutQuart" };
			var data = [
				{
					value: <?php 
        echo $num;
        ?>
,
					color:"#2980b9",
					highlight: "#3498db",
					label: "<?php 
        _e('Messages sent to this device', 'px_gcm');
        ?>
"
				},
				{
					value: <?php 
        echo $total;
        ?>
,
					color: "#bdc3c7",
					highlight: "#ecf0f1",
					label: "<?php 
        _e('Total Messages sent', 'px_gcm');
        ?>
"
				}];
			var msgChart = new Chart(ctx).Doughnut(data, options);			
		</script>
		<?php 
        if (isset($_POST['msg'])) {
            $message = $_POST["msg"];
            $arr = array();
            array_push($arr, $regId);
            print_r(px_sendGCM($message, "message", $arr));
        }
    }
Example #2
0
</p>
					           <textarea id="message" name="message" type="text" cols="20" rows="5" ></textarea>
							   <p><?php 
    _e('*Please don\'t use HTML', 'px_gcm');
    ?>
</p>
	                              <?php 
    submit_button(__('Send', 'px_gcm'));
    ?>
	                         </form>
						</div> 
					</div>
					<p><b><?php 
    _e('Info', 'px_gcm');
    ?>
 &nbsp;&nbsp;</b> <?php 
    echo $info;
    ?>
</p>
					<p></p>
			</div>
		</div>
		<br class="clear">
	</div>
</div> 
<?php 
}
if (isset($_POST['message'])) {
    $message = $_POST["message"];
    px_sendGCM($message, "message");
}
Example #3
0
function px_new_notification($new_status, $old_status, $post)
{
    $options = get_option('gcm_setting');
    if ($options['snpi'] != false) {
        if ($old_status != 'publish' && $new_status == 'publish' && 'post' == get_post_type($post)) {
            $post_title = get_the_title($post);
            $post_url = get_permalink($post);
            $post_id = get_the_ID($post);
            $post_author = get_the_author_meta('display_name', $post->post_author);
            $message = $post_title . ";" . $post_url . ";" . $post_id . ";" . $post_author . ";";
            // Send notification
            $np = "new_post";
            px_sendGCM($message, $np, 010);
        }
    }
}
Example #4
0
</p>
					           <textarea id="message" name="message" type="text" cols="50" rows="5" ></textarea>
							   <p><?php 
    _e('*Please don\'t use HTML', 'px_gcm');
    ?>
</p>
	                              <?php 
    submit_button(__('Send', 'px_gcm'));
    ?>
	                         </form>
						</div> 
					</div>
					<p><b><?php 
    _e('Info', 'px_gcm');
    ?>
 &nbsp;&nbsp;</b> <?php 
    echo $info;
    ?>
</p>
					<p></p>
			</div>
		</div> 
		<br class="clear">
	</div>
</div> 
<?php 
}
if (isset($_POST['message'])) {
    $message = $_POST["message"];
    print_r(px_sendGCM($message, "message", 010));
}