~alliancecsf-dev/authpuppy/apConnectionPoliciesPlugin

« back to all changes in this revision

Viewing changes to lib/model/doctrine/PluginapApplicablePoliciesTable.class.php

  • Committer: Geneviève Bastien
  • Date: 2010-07-16 15:22:01 UTC
  • Revision ID: gbastien@versatic.net-20100716152201-7raug5v8dp2a7vgx
 Added a way to manage and feedback to users their status on all applicable policies for a given connection, not just the limit of it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
/**
 
4
 * PluginapApplicablePoliciesTable
 
5
 * 
 
6
 * This class has been auto-generated by the Doctrine ORM Framework
 
7
 */
 
8
class PluginapApplicablePoliciesTable extends Doctrine_Table
 
9
{
 
10
    /**
 
11
     * Returns an instance of this class.
 
12
     *
 
13
     * @return object PluginapApplicablePoliciesTable
 
14
     */
 
15
    public static function getInstance()
 
16
    {
 
17
        return Doctrine_Core::getTable('PluginapApplicablePolicies');
 
18
    }
 
19
    
 
20
    public function getForIdentity($identity) {
 
21
      $lastconn = Doctrine::getTable('Connection')->getLastConnectionFor($identity);
 
22
      if ($lastconn) {
 
23
        $policies = $lastconn->getPolicies();
 
24
        foreach ($policies as $policy) {
 
25
          $policy->setThisTotalData($policy->getThisTotalData() - ($lastconn->getIncoming() + $lastconn->getOutgoing()));
 
26
        }
 
27
        return $policies;
 
28
 
 
29
      }
 
30
      else return null;
 
31
    }
 
32
    
 
33
    
 
34
}
 
 
b'\\ No newline at end of file'