Ejemplo n.º 1
0
 /**
  * Return an SMWDataValue object for the next SMWDataItem object or
  * false if no further object exists.
  *
  * @since 1.6
  *
  * @return SMWDataValue|false
  */
 public function getNextDataValue()
 {
     $dataItem = $this->getNextDataItem();
     if ($dataItem === false) {
         return false;
     }
     if ($this->mPrintRequest->getMode() == PrintRequest::PRINT_PROP && strpos($this->mPrintRequest->getTypeID(), '_rec') !== false && $this->mPrintRequest->getParameter('index') !== false) {
         $recordValue = DataValueFactory::getInstance()->newDataValueByItem($dataItem, $this->mPrintRequest->getData()->getDataItem());
         $diProperty = $recordValue->getPropertyDataItemByIndex($this->mPrintRequest->getParameter('index'));
     } elseif ($this->mPrintRequest->isMode(PrintRequest::PRINT_PROP)) {
         $diProperty = $this->mPrintRequest->getData()->getDataItem();
     } elseif ($this->mPrintRequest->isMode(PrintRequest::PRINT_CHAIN)) {
         $diProperty = $this->mPrintRequest->getData()->getLastPropertyChainValue()->getDataItem();
     } else {
         $diProperty = null;
     }
     // refs #1314
     if ($this->mPrintRequest->getMode() == PrintRequest::PRINT_PROP && strpos($this->mPrintRequest->getTypeID(), '_txt') !== false && $dataItem instanceof DIBlob) {
         $dataItem = new DIBlob(InTextAnnotationParser::removeAnnotation($dataItem->getString()));
     }
     $dataValue = DataValueFactory::getInstance()->newDataValueByItem($dataItem, $diProperty);
     $dataValue->setContextPage($this->mResult);
     if ($this->mPrintRequest->getOutputFormat()) {
         $dataValue->setOutputFormat($this->mPrintRequest->getOutputFormat());
     }
     if ($this->entityListAccumulator !== null && $dataItem instanceof DataItem) {
         $this->entityListAccumulator->addToEntityList($dataItem, $diProperty);
     }
     return $dataValue;
 }
 /**
  * Make a request option object based on the given parameters, and
  * return NULL if no such object is required. The parameter defines
  * if the limit should be taken into account, which is not always desired
  * (especially if results are to be cached for future use).
  *
  * @param boolean $useLimit
  *
  * @return SMWRequestOptions|null
  */
 protected function getRequestOptions($useLimit = true)
 {
     $limit = $useLimit ? $this->mPrintRequest->getParameter('limit') : false;
     $order = trim($this->mPrintRequest->getParameter('order'));
     // Important: use "!=" for order, since trim() above does never return "false", use "!==" for limit since "0" is meaningful here.
     if ($limit !== false || $order != false) {
         $options = new SMWRequestOptions();
         if ($limit !== false) {
             $options->limit = trim($limit);
         }
         if ($order == 'descending' || $order == 'reverse' || $order == 'desc') {
             $options->sort = true;
             $options->ascending = false;
         } elseif ($order == 'ascending' || $order == 'asc') {
             $options->sort = true;
             $options->ascending = true;
         }
     } else {
         $options = null;
     }
     return $options;
 }
 private function isMultiValueWithParameter($parameter)
 {
     return strpos($this->printRequest->getTypeID(), '_rec') !== false && $this->printRequest->getParameter($parameter) !== false;
 }