/**
  * Create and output HTML including the complete factbox, based on the extracted
  * parameters in the execute comment.
  *
  * @return string  A HTML string with the factbox
  */
 private function doGenerateHtml()
 {
     global $wgContLang;
     $html = "\n";
     $leftside = !$wgContLang->isRTL();
     // For right to left languages, all is mirrored
     $modules = array();
     if ($this->subject->isValid()) {
         $semanticData = new SemanticData($this->subject->getDataItem());
         $html .= $this->displayHead();
         if ($this->showoutgoing) {
             $semanticData = $this->store->getSemanticData($this->subject->getDataItem());
             $html .= $this->displayData($semanticData, $leftside);
             $html .= $this->displayCenter();
         }
         if ($this->showincoming) {
             list($indata, $more) = $this->getInData();
             if (!$this->getOption('showInverse')) {
                 $leftside = !$leftside;
             }
             $html .= $this->displayData($indata, $leftside, true);
             $html .= $this->displayBottom($more);
         }
         $this->articletext = $this->subject->getWikiValue();
         \Hooks::run('SMW::Browse::AfterDataLookupComplete', array($this->store, $semanticData, &$html, &$this->extraModules));
     }
     if ($this->getOption('printable') !== 'yes') {
         $html .= $this->queryForm($this->articletext);
     }
     $html .= Html::element('div', array('class' => 'smwb-modules', 'data-modules' => json_encode($this->extraModules)));
     return $html;
 }
Exemplo n.º 2
0
 /**
  * Returns content found for a given ParserOutput object and if the required
  * custom data was not available then semantic data are retrieved from
  * the store for a given subject.
  *
  * The method checks whether the given setting of $showfactbox requires
  * displaying the given data at all.
  *
  * @since 1.9
  *
  * @return integer $showFactbox
  *
  * @return string|null
  */
 protected function fetchContent($showFactbox = SMW_FACTBOX_NONEMPTY)
 {
     if ($showFactbox === SMW_FACTBOX_HIDDEN) {
         return '';
     }
     $semanticData = $this->parserData->getSemanticData();
     if ($semanticData === null || $semanticData->stubObject || $this->isEmpty($semanticData)) {
         $semanticData = $this->store->getSemanticData($this->parserData->getSubject());
     }
     if ($showFactbox === SMW_FACTBOX_SPECIAL && !$semanticData->hasVisibleSpecialProperties()) {
         // show only if there are special properties
         return '';
     } elseif ($showFactbox === SMW_FACTBOX_NONEMPTY && !$semanticData->hasVisibleProperties()) {
         // show only if non-empty
         return '';
     }
     return $this->createTable($semanticData);
 }
Exemplo n.º 3
0
 /**
  * @see Store::getSemanticData()
  * @since 1.8
  */
 public function getSemanticData(DIWikiPage $subject, $filter = false)
 {
     return $this->baseStore->getSemanticData($subject, $filter);
 }