/**
  * Short description of method getValue
  *
  * @access public
  * @author Joel Bout, <*****@*****.**>
  * @param  Resource resource
  * @param  Column column
  * @return string
  */
 public function getValue(core_kernel_classes_Resource $resource, tao_models_classes_table_Column $column)
 {
     $returnValue = (string) '';
     $result = $resource->getOnePropertyValue($column->getProperty());
     $returnValue = $result instanceof core_kernel_classes_Resource ? $result->getLabel() : (string) $result;
     return (string) $returnValue;
 }
 /**
  * Short description of method toArray
  *
  * @access public
  * @author Joel Bout, <*****@*****.**>
  * @return array
  */
 public function toArray()
 {
     $returnValue = array();
     $returnValue = parent::toArray();
     $returnValue['val'] = $this->value;
     return (array) $returnValue;
 }
 /**
  * @return array
  */
 private function getData()
 {
     $delivery = new \core_kernel_classes_Resource($this->params[0]);
     $resultsService = ResultsService::singleton();
     $filter = 'lastSubmitted';
     $columns = [];
     $testtaker = new \tao_models_classes_table_PropertyColumn(new \core_kernel_classes_Property(PROPERTY_RESULT_OF_SUBJECT));
     $testTakerColumn[] = $testtaker->toArray();
     $cols = array_merge($testTakerColumn, $resultsService->getVariableColumns($delivery, CLASS_OUTCOME_VARIABLE, $filter), $resultsService->getVariableColumns($delivery, CLASS_RESPONSE_VARIABLE, $filter));
     $dataProvider = new VariableDataProvider();
     foreach ($cols as $col) {
         $column = \tao_models_classes_table_Column::buildColumnFromArray($col);
         if (!is_null($column)) {
             if ($column instanceof VariableColumn) {
                 $column->setDataProvider($dataProvider);
             }
             $columns[] = $column;
         }
     }
     $columns[0]->label = __("Test taker");
     $rows = $resultsService->getResultsByDelivery($delivery, $columns, $filter);
     $columnNames = array_reduce($columns, function ($carry, $item) {
         $carry[] = $item->label;
         return $carry;
     });
     $result = [];
     foreach ($rows as $row) {
         $rowResult = [];
         foreach ($row['cell'] as $rowKey => $rowVal) {
             $rowResult[$columnNames[$rowKey]] = $rowVal[0];
         }
         $result[] = $rowResult;
     }
     //If there are no executions yet, the file is exported but contains only the header
     if (empty($result)) {
         $result = [array_fill_keys($columnNames, '')];
     }
     return $result;
 }
 /**
  * Short description of method toArray
  *
  * @access public
  * @author Joel Bout, <*****@*****.**>
  * @return array
  */
 public function toArray()
 {
     $returnValue = array();
     $returnValue = parent::toArray();
     $returnValue['prop'] = $this->property->getUri();
     return (array) $returnValue;
 }
 protected function getColumns($identifier)
 {
     if (!$this->hasRequestParameter($identifier)) {
         throw new common_Exception('Missing parameter "' . $identifier . '" for getColumns()');
     }
     $columns = array();
     foreach ($this->getRequestParameter($identifier) as $array) {
         $column = tao_models_classes_table_Column::buildColumnFromArray($array);
         if (!is_null($column)) {
             $columns[] = $column;
         }
     }
     return $columns;
 }
 /**
  * Short description of method toArray
  *
  * @access public
  * @author Joel Bout, <*****@*****.**>
  * @return array
  */
 public function toArray()
 {
     $returnValue = array();
     $returnValue = parent::toArray();
     //$returnValue['ca'] = "deprecated";
     $returnValue['contextId'] = $this->contextIdentifier;
     $returnValue['contextLabel'] = $this->contextLabel;
     $returnValue['variableIdentifier'] = $this->identifier;
     return (array) $returnValue;
 }
 /**
  * Short description of method getValue
  *
  * @access public
  * @author Joel Bout, <*****@*****.**>
  * @param  Resource resource
  * @param  Column column
  * @return string
  */
 public function getValue(core_kernel_classes_Resource $resource, tao_models_classes_table_Column $column)
 {
     $returnValue = array();
     $vcUri = $column->getVariableClass()->getUri();
     if (isset($this->cache[$vcUri][$resource->getUri()][$column->getContextIdentifier() . $column->getIdentifier()])) {
         $returnValue = $this->cache[$vcUri][$resource->getUri()][$column->getContextIdentifier() . $column->getIdentifier()];
     } else {
         common_Logger::d('no data for resource: ' . $resource->getUri() . ' column: ' . $column->getIdentifier());
     }
     return $returnValue;
 }