Example #1
0
 public function addDiffData(array $data, array $diffs, $labelA, $labelB, $idPrefix = '')
 {
     $htmlTableRenderer = new HtmlTableRenderer();
     if (array_key_exists(Compare::FILE_MISSING_IN_A, $data)) {
         $this->addHeadline("Additional files in {$labelB}", 3, array('id' => $idPrefix . Compare::FILE_MISSING_IN_A));
         $this->addTag('p', 'Since this would also include extra modules and themes this is currently skipped');
     }
     if (array_key_exists(Compare::FILE_MISSING_IN_B, $data)) {
         $this->addHeadline("Missing files in {$labelB}", 3, array('id' => $idPrefix . Compare::FILE_MISSING_IN_B));
         $missingFiles = array();
         foreach ($data[Compare::FILE_MISSING_IN_B] as $file) {
             $missingFiles[] = array('File' => $file);
         }
         $this->addBody($htmlTableRenderer->render($missingFiles, array('File')));
     }
     if (array_key_exists(Compare::IDENTICAL_FILES, $data)) {
         if (count($data[Compare::IDENTICAL_FILES]) > 0) {
             $this->addHeadline("Identical files in both locations", 3, array('id' => $idPrefix . Compare::IDENTICAL_FILES));
             $identicalFiles = array();
             foreach ($data[Compare::IDENTICAL_FILES] as $files) {
                 $identicalFiles[] = array('File' => $files);
             }
             $this->addBody($htmlTableRenderer->render($identicalFiles, array('File')));
         }
     }
     foreach (array(Compare::DIFFERENT_FILE_CONTENT, Compare::SAME_FILE_BUT_COMMENTS) as $section) {
         if (array_key_exists($section, $data)) {
             if (count($data[$section]) > 0) {
                 $this->addHeadline("Changed files ({$section})", 3, array('id' => $idPrefix . $section));
                 $this->addBody($htmlTableRenderer->render($diffs[$section], array('File', 'Diff')));
             }
         }
     }
 }
 /**
  * Gets a table cell for all values of a property of a subject.
  *
  * @since 1.6.1
  *
  * @param SMWResultArray $resultArray
  * @param int $outputMode
  * @param string $columnClass
  *
  * @return string
  */
 protected function getCellForPropVals(SMWResultArray $resultArray, $outputMode, $columnClass)
 {
     $dataValues = array();
     while (($dv = $resultArray->getNextDataValue()) !== false) {
         $dataValues[] = $dv;
     }
     $attributes = array();
     $content = null;
     if (count($dataValues) > 0) {
         $sortKey = $dataValues[0]->getDataItem()->getSortKey();
         $dataValueType = $dataValues[0]->getTypeID();
         if (is_numeric($sortKey)) {
             $attributes['data-sort-value'] = $sortKey;
         }
         $alignment = trim($resultArray->getPrintRequest()->getParameter('align'));
         if (in_array($alignment, array('right', 'left', 'center'))) {
             $attributes['style'] = "text-align:' . {$alignment} . ';";
         }
         $attributes['class'] = $columnClass . ($dataValueType !== '' ? ' smwtype' . $dataValueType : '');
         $content = $this->getCellContent($dataValues, $outputMode, $resultArray->getPrintRequest()->getMode() == PrintRequest::PRINT_THIS);
     }
     $this->htmlTableRenderer->addCell($content, $attributes);
 }