Exemplo n.º 1
0
 public function itClearsContent()
 {
     $data_line = array('Data', 'Data', 'Data');
     $statistics_formatter = new Statistics_Formatter('', '', ',');
     $statistics_formatter->addHeader('Title');
     $statistics_formatter->addLine($data_line);
     $statistics_formatter->addEmptyLine();
     $statistics_formatter->clearContent();
     $this->assertEqual($statistics_formatter->getCsvContent(), '');
 }
Exemplo n.º 2
0
 /**
  * Obtain statistics about backend format for CSV export
  *
  * @param Statistics_Formatter $formatter instance of statistics formatter class
  *
  * @return String
  */
 public function getBackendStatistics(Statistics_Formatter $formatter)
 {
     $dao = $this->getDao();
     $formatter->clearContent();
     $formatter->addEmptyLine();
     $formatter->addHeader('Git');
     $gitShellIndex[] = $GLOBALS['Language']->getText('plugin_statistics', 'scm_month');
     $gitShell[] = "Git shell created repositories";
     $gitShellActiveIndex[] = $GLOBALS['Language']->getText('plugin_statistics', 'scm_month');
     $gitShellActive[] = "Git shell created repositories (still active)";
     $gitoliteIndex[] = $GLOBALS['Language']->getText('plugin_statistics', 'scm_month');
     $gitolite[] = "Gitolite created repositories";
     $gitoliteActiveIndex[] = $GLOBALS['Language']->getText('plugin_statistics', 'scm_month');
     $gitoliteActive[] = "Gitolite created repositories (still active)";
     $this->fillBackendStatisticsByType($formatter, 'gitshell', $gitShellIndex, $gitShell, false);
     $this->fillBackendStatisticsByType($formatter, 'gitshell', $gitShellActiveIndex, $gitShellActive, true);
     $this->fillBackendStatisticsByType($formatter, 'gitolite', $gitoliteIndex, $gitolite, false);
     $this->fillBackendStatisticsByType($formatter, 'gitolite', $gitoliteActiveIndex, $gitoliteActive, true);
     $this->retrieveLoggedPushesStatistics($formatter);
     $content = $formatter->getCsvContent();
     $formatter->clearContent();
     return $content;
 }
Exemplo n.º 3
0
 /**
  * Obtain statistics about backend format for CSV export
  *
  * @param Statistics_Formatter $formatter instance of statistics formatter class
  *
  * @return String
  */
 public function getBackendStatistics(Statistics_Formatter $formatter)
 {
     $dao = $this->getDao();
     $formatter->clearContent();
     $formatter->addEmptyLine();
     $formatter->addHeader('Git');
     $gitShellIndex[] = $GLOBALS['Language']->getText('plugin_statistics', 'scm_month');
     $gitShell[] = "Git shell";
     $gitoliteIndex[] = $GLOBALS['Language']->getText('plugin_statistics', 'scm_month');
     $gitolite[] = "Gitolite";
     $dar = $dao->getBackendStatistics('gitshell', $formatter->startDate, $formatter->endDate, $formatter->groupId);
     if ($dar && !$dar->isError() && $dar->rowCount() > 0) {
         foreach ($dar as $row) {
             $gitShellIndex[] = $row['month'] . " " . $row['year'];
             $gitShell[] = intval($row['count']);
         }
         $formatter->addLine($gitShellIndex);
         $formatter->addLine($gitShell);
     }
     $dar = $dao->getBackendStatistics('gitolite', $formatter->startDate, $formatter->endDate, $formatter->groupId);
     if ($dar && !$dar->isError() && $dar->rowCount() > 0) {
         foreach ($dar as $row) {
             $gitoliteIndex[] = $row['month'] . " " . $row['year'];
             $gitolite[] = intval($row['count']);
         }
         $formatter->addLine($gitoliteIndex);
         $formatter->addLine($gitolite);
     }
     $this->retrieveLoggedPushesStatistics($formatter);
     $content = $formatter->getCsvContent();
     $formatter->clearContent();
     return $content;
 }