コード例 #1
0
ファイル: build.php プロジェクト: raigons/bureauinteligencia
function fillParams($param, &$subgroup, &$font, &$type, &$variety, &$origin, &$destiny, &$array_group = null){
        $subgroup = $param['subgrupo']; 
        $font = $param['fonte'];
        $type = $param['tipo'];
        $variety = $param['variedade']; 
        $origin = $param['origem'];
        $destiny = $param['destino'];         
        $array = array("subgroup"=>$subgroup,"font"=>$font,"type"=>$type,"variety"=>$variety,"origin"=>$origin,"destiny"=>$destiny);
        $dataParam = new DataParam();
        $dataParam->setParams($array);
        return $dataParam;
}
コード例 #2
0
 /**
  *
  * @param type $params
  * @param type $sql
  * @return PDOStatement
  */
 private function query(DataParam $params, $sql)
 {
     $query = $this->session->prepare($sql);
     $query->bindParam(":subgroup", $params->getSubgroup());
     $query->bindParam(":variety", $params->getVariety());
     $query->bindParam(":type", $params->getType());
     $query->bindParam(":origin", $params->getOrigin());
     $query->bindParam(":destiny", $params->getDestiny());
     $query->bindParam(":font", $params->getFont());
     return $query;
 }
コード例 #3
0
 /**
  *
  * @param DataParam $params    
  * @param array $years
  * @return ArrayIterator
  */
 public function getValuesFilteringWithMultipleParams(DataParam $params, array $years)
 {
     if (is_array($params->getSubgroup())) {
         $subgroup = $params->getSubgroup();
         $paramsForList1 = $params;
         $paramsForList1->setSubgroup($subgroup[0]);
         $listValues1 = $this->repository->getValuesWithMultipleParamsSelected($paramsForList1, $years);
         $paramsForList2 = $params;
         $paramsForList2->setSubgroup($subgroup[1]);
         $listValues2 = $this->repository->getValuesWithMultipleParamsSelected($paramsForList2, $years);
         $map = new HashMap();
         $map->put(0, $listValues1);
         $map->put(1, $listValues2);
         return $map;
     } else {
         if ($params->theOptionAllHasBeenSelected()) {
             $listValues = $this->repository->getValuesWhenTheOptionAllWasSelected($params->getSubgroup(), $params->getVariety(), $params->getType(), $params->getOrigin(), $params->getDestiny(), $params->getFont(), $years);
         } else {
             $listValues = $this->repository->getValuesWithMultipleParamsSelected($params, $years);
         }
         return $listValues;
     }
 }
コード例 #4
0
 public function getValues(DataParam $params, array $years = null)
 {
     if (Session::isLogged()) {
         if (!$params->anyValueIsArray()) {
             return $this->getValuesWithSimpleParams($params, $years);
         } else {
             return $this->getValuesWithMultipleParams($params, $years);
         }
     } else {
         throw new LoginException();
     }
 }
コード例 #5
0
 /**
  * @test
  */
 public function distincGroupsTestStatisticTable()
 {
     $tableJson = "";
     $years = array(1990, 1991);
     $paramsGroup1 = array("subgroup" => 8, "font" => 1, "type" => 1, "variety" => 1, "origin" => 1, "destiny" => 1);
     $paramsGroup2 = array("subgroup" => 9, "font" => 2, "type" => 1, "variety" => 1, "origin" => 1, "destiny" => 1);
     $dataParam1 = new DataParam();
     $dataParam1->setParams($paramsGroup1);
     $dataParam2 = new DataParam();
     $dataParam2->setParams($paramsGroup2);
     $tableJson = $this->controller->buildStatisticTableSearchingDistinctGroups($dataParam1, $dataParam2, $years);
     $this->assertEquals($this->tableAlternative(true), $tableJson);
 }