Source for file Activityrule.php

Documentation is available at Activityrule.php

  1. <?php if defined('BASEPATH')) exit('No direct script access allowed');
  2. /** 
  3.  * Activityrule.php
  4.  * @author Greg Swindle <greg@swindle.net>
  5.  * @version 0.2
  6.  * @package Phprules
  7.  */
  8.  
  9. /**
  10.  * An ActivityRule represents a type of Rule that automatically executes an
  11.  * activity when it evaluates to TRUE.
  12.  */
  13. abstract class ActivityRule extends Rule {
  14.     
  15.     abstract public function execute()
  16.  
  17. /**
  18. /**
  19.  * Evaluates a RuleContext. The RuleContext contains Propositions and Variables that have
  20.  * specific values. To apply the context, simply copy these values
  21.  * into the corresponding Propositions and Variables in the Rule. If the result of
  22.  * evaluation is TRUE, then the activity is executed.
  23.  * @access public
  24.  * @param RuleContext $ruleContext 
  25.  * @return Proposition 
  26.  */        
  27.     function evaluate$ruleContext {
  28.         // The context contains Propositions and Variables that have
  29.         // specific values. To apply the context, simply copy these values
  30.         // into the corresponding Propositions and Variables in the Rule
  31.         $this->stack array();
  32.         foreach$this->elements as $e {
  33.             if$e->getType(== "Proposition" or $e->getType(== "Variable" {
  34.                 $element $ruleContext->findElement$e->name );
  35.                 if$element {
  36.                     $e->value $element->value;
  37.                 }
  38.                 else {
  39.                     $e->value NULL;
  40.                 }
  41.             }
  42.         }
  43.         $proposition $this->process();
  44.         if ($proposition->value == TRUE){
  45.             $this->execute();
  46.         }
  47.         return $proposition;
  48.     }
  49. }
  50.  
  51.  
  52. /* End of file Activityrule.php */
  53. /* Location: ./system/application/libraries/php-rules/Activityrule.php */

Documentation generated on Thu, 24 Mar 2011 21:27:37 -0500 by phpDocumentor 1.4.1