Campustream 1.0
A social network MQP for WPI
application/tasks/notify.php
Go to the documentation of this file.
00001 <?php
00002 
00003 group('notify');
00004 desc('Gets all notifications for a user');
00005 
00006 task( 'get', function( $args ) {
00007         
00008         force_execution_on( any_web_server );
00009 
00010         $username = array_shift($args);
00011         
00012         $user = ActiveRecord::find('User_Model', "SELECT * FROM users WHERE username = '$username' LIMIT 1");
00013         if (!$user->is_loaded()) {
00014                 echo "Could not find user.\n";
00015                 return false;
00016         }
00017         
00018         $n = new notifications($user);
00019         $msgs = $n->get();
00020         
00021         foreach ($msgs as $msg) {
00022                 echo $msg->message . "\n";
00023         }
00024 });