コード例 #1
0
 /**
  * torna il numero di interventi sugli atti con un certo tag 
  * tutti gli atti degli argomenti
  *
  * @return void
  * @author Guglielmo Celata
  */
 public function executeQuantodiscusso()
 {
     $interventi_max = sfSupra::getVariable('numero_interventi_max');
     $c = new Criteria();
     $c->addJoin(OppInterventoPeer::ATTO_ID, OppAttoPeer::ID);
     $c->addJoin(TaggingPeer::TAGGABLE_ID, OppAttoPeer::ID);
     $c->add(TaggingPeer::TAGGABLE_MODEL, 'OppAtto');
     $c->add(TaggingPeer::TAG_ID, $this->tag->getId());
     $this->interventi = OppInterventoPeer::doCount($c);
     $this->interventi_perc = 100 * $this->interventi / $interventi_max;
     $this->interventi_avg = sfSupra::getVariable('numero_interventi_avg');
     $this->interventi_avg_perc = 100 * $this->interventi_avg / $interventi_max;
 }
コード例 #2
0
sfContext::getInstance();
$t = new lime_test(11, new lime_output_color());
$t->diag('unit test to verify the SupraVariables plugin');
$t->diag('Test a string');
sfSupra::setVariable('prova', 'pippo');
$prova = sfSupra::getVariable('prova');
$t->ok(is_string($prova), 'a string was stored');
$t->ok($prova == 'pippo', 'the correct value was retrieved');
$t->diag('Test an integer');
sfSupra::setVariable('a', 123);
$a = sfSupra::getVariable('a');
$t->ok(is_int($a), 'an integer was stored');
$t->ok($a == 123, 'the correct value was retrieved');
$t->diag('Test a float and overwriting');
sfSupra::setVariable('a', 123.5);
$a = sfSupra::getVariable('a');
$t->ok(is_float($a), 'a float was stored');
$t->ok($a == 123.5, 'the correct value was retrieved');
$t->diag('Test booleans');
sfSupra::setVariable('b', true);
sfSupra::setVariable('c', false);
$b = sfSupra::getVariable('b');
$c = sfSupra::getVariable('c');
$t->ok(is_bool($b) && is_bool($c), 'boolean s were stored');
$t->ok($b == true && $c == false, 'the correct values were retrieved');
$t->diag('Test complex variables');
sfSupra::setVariable('o', array("one" => 5, "two" => 7));
$o = sfSupra::getVariable('o');
$t->ok(is_array($o), 'an array was stored');
$t->ok(count($o) == 2, 'the length of the array is 2');
$t->ok($o['one'] == 5 && $o['two'] == 7, 'the corrected values were retrieved');