コード例 #1
0
ファイル: notifications.php プロジェクト: niekbosch/BeeHub
<?php

defined('APPLICATION_ENV') || define('APPLICATION_ENV', getenv('APPLICATION_ENV') ? strtolower(getenv('APPLICATION_ENV')) : 'production');
defined('ENT_HTML5') || define('ENT_HTML5', 0);
require_once dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'beehub_bootstrap.php';
$auth = BeeHub_Auth::inst();
$auth->handle_authentication(false);
header('Content-type: application/json');
header('Cache-Control: no-cache, must-revalidate');
$notifications = BeeHub::notifications(BeeHub_Auth::inst());
print json_encode($notifications);
コード例 #2
0
ファイル: beehubTest.php プロジェクト: niekbosch/BeeHub
 public function testNotifications()
 {
     // First check the notifications for John
     $authJohn = $this->getMock('\\BeeHub\\tests\\BeeHub_Auth', array('is_authenticated', 'current_user'), array(new \SimpleSAML_Auth_Simple('BeeHub')));
     $authJohn->expects($this->any())->method('is_authenticated')->will($this->returnValue(true));
     $authJohn->expects($this->any())->method('current_user')->will($this->returnValue(new \BeeHub_User('/system/users/john')));
     $expectedJohn = array(array('type' => 'group_request', 'data' => array('group' => '/system/groups/bar', 'group_displayname' => 'Bar', 'user' => '/system/users/jane', 'user_displayname' => 'Jane Doe', 'user_email' => '*****@*****.**')), array('type' => 'sponsor_request', 'data' => array('sponsor' => '/system/sponsors/sponsor_b', 'sponsor_displayname' => 'Company B', 'user' => '/system/users/jane', 'user_displayname' => 'Jane Doe', 'user_email' => '*****@*****.**')));
     $this->assertSame(\BeeHub::notifications($authJohn), $expectedJohn, 'BeeHub::notifications() should return an array with the correct notifications for John Doe');
     // And check the notifications for Jane
     $authJane = $this->getMock('\\BeeHub\\tests\\BeeHub_Auth', array('is_authenticated', 'current_user'), array(new \SimpleSAML_Auth_Simple('BeeHub')));
     $authJane->expects($this->any())->method('is_authenticated')->will($this->returnValue(true));
     $authJane->expects($this->any())->method('current_user')->will($this->returnValue(new \BeeHub_User('/system/users/jane')));
     $expectedJane = array(array('type' => 'group_invitation', 'data' => array('group' => '/system/groups/foo', 'displayname' => 'Foo')), array('type' => 'no_sponsor', 'data' => array()));
     $this->assertSame(\BeeHub::notifications($authJane), $expectedJane, 'BeeHub::notifications() should return an array with the correct notifications for Jane Doe');
 }
コード例 #3
0
ファイル: footer.php プロジェクト: niekbosch/BeeHub
      <script src="/system/tests/resources/mock.js"></script>
    <?php 
}
?>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
    <script type="text/javascript" src="/system/js/jquery-ui.js"></script>
    <script type="text/javascript" src="/system/bootstrap/js/bootstrap.js"></script>
    <script type="text/javascript" src="/system/js/webdavlib.js"></script>
    <script type="text/javascript" src="/system/js/beehub.js"></script>
    <script type="text/javascript">
    	nl.sara.beehub.postAuth = '<?php 
echo BeeHub::getAuth()->getPostAuthCode();
?>
';
    </script>
    <script type="text/javascript" src="/system/js/server/principals.js"></script>
    <script type="text/javascript">
      nl.sara.beehub.show_notifications(<?php 
echo json_encode(BeeHub::notifications(BeeHub_Auth::inst()));
?>
);
      <?php 
echo intval(@$_GET['show_notifications']) === 1 ? '$("#notification_button").dropdown("toggle");' : '';
?>
    </script>
    <?php 
echo isset($footer) ? $footer : '';
?>
  </body>
</html>