コード例 #1
0
ファイル: UtilTest.php プロジェクト: Apen/additional_reports
 /**
  * @test
  */
 public function writePopUp()
 {
     $msg = tx_additionalreports_util::writePopUp('foo', 'bar', 'foo');
     $this->assertTrue(!empty($msg));
 }
コード例 #2
0
 /**
  * Get all necessary informations about an ext
  *
  * @param array $itemValue
  * @return array
  */
 public static function getExtensionInformations($itemValue)
 {
     $extKey = $itemValue['extkey'];
     $listExtensionsTerItem = array();
     $listExtensionsTerItem['icon'] = $itemValue['icon'];
     $listExtensionsTerItem['extension'] = $extKey;
     $listExtensionsTerItem['extensionlink'] = '<a href="#" onclick="' . tx_additionalreports_util::goToModuleEm($extKey) . '">' . tx_additionalreports_util::getIconZoom() . '</a>';
     $listExtensionsTerItem['version'] = $itemValue['EM_CONF']['version'];
     $listExtensionsTerItem['versioncheck'] = tx_additionalreports_util::versionCompare($itemValue['EM_CONF']['constraints']['depends']['typo3']);
     // version compare
     $compareUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL');
     $compareUrl .= 'typo3/ajax.php?ajaxID=additional_reports::compareFiles';
     $compareUrl .= '&extKey=' . $extKey . '&mode=compareExtension&extVersion=' . $itemValue['EM_CONF']['version'];
     $compareLabem = $extKey . ' : ' . $itemValue['EM_CONF']['version'] . ' <--> TER ' . $itemValue['EM_CONF']['version'];
     $js = 'Shadowbox.open({content:\'' . $compareUrl . '\',player:\'iframe\',title:\'' . $compareLabem . '\',height:600,width:800});';
     $listExtensionsTerItem['versioncompare'] = '<input type="button" onclick="' . $js . '" value="' . self::getLl('comparesame') . '" title="' . $compareLabem . '"/>';
     // need extension update ?
     if (version_compare($itemValue['EM_CONF']['version'], $itemValue['lastversion']['version'], '<')) {
         $listExtensionsTerItem['versionlast'] = '<span style="color:green;font-weight:bold;">' . $itemValue['lastversion']['version'] . '&nbsp;(' . $itemValue['lastversion']['updatedate'] . ')</span>';
         $compareUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL');
         $compareUrl .= 'typo3/ajax.php?ajaxID=additional_reports::compareFiles';
         $compareUrl .= '&extKey=' . $extKey . '&mode=compareExtension&extVersion=' . $itemValue['lastversion']['version'];
         $compareLabem = $extKey . ' : ' . $itemValue['EM_CONF']['version'] . ' <--> TER ' . $itemValue['lastversion']['version'];
         $js = 'Shadowbox.open({content:\'' . $compareUrl . '\',player:\'iframe\',title:\'' . $compareLabem . '\',height:600,width:800});';
         $listExtensionsTerItem['versioncompare'] .= ' <input type="button" onclick="' . $js . '" value="' . self::getLl('comparelast') . '" title="' . $compareLabem . '"/>';
     } else {
         $listExtensionsTerItem['versionlast'] = $itemValue['lastversion']['version'] . '&nbsp;(' . $itemValue['lastversion']['updatedate'] . ')';
     }
     $listExtensionsTerItem['downloads'] = $itemValue['lastversion']['alldownloadcounter'];
     // show db
     $dumpTf1 = '';
     $dumpTf2 = '';
     if (count($itemValue['fdfile']) > 0) {
         $id = 'sql' . $extKey;
         $dumpTf1 = count($itemValue['fdfile']) . ' ' . self::getLl('extensions_tablesmodified');
         $dumpTf2 = tx_additionalreports_util::writePopUp($id, $extKey, tx_additionalreports_util::viewArray($itemValue['fdfile']));
     }
     $listExtensionsTerItem['tables'] = $dumpTf1;
     $listExtensionsTerItem['tableslink'] = $dumpTf2;
     // need db update
     if (count($itemValue['updatestatements']) > 0) {
         $listExtensionsTerItem['tablesintegrity'] = self::getLl('yes');
     } else {
         $listExtensionsTerItem['tablesintegrity'] = self::getLl('no');
     }
     // need extconf update
     $absPath = tx_additionalreports_util::getExtPath($extKey, $itemValue['type']);
     if (is_file($absPath . 'ext_conf_template.txt')) {
         $configTemplate = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($absPath . 'ext_conf_template.txt');
         /** @var $tsparserObj \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser */
         $tsparserObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser');
         $tsparserObj->parse($configTemplate);
         $arr = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$extKey]);
         $arr = is_array($arr) ? $arr : array();
         $diffConf = array_diff_key($tsparserObj->setup, $arr);
         if (isset($diffConf['updateMessage'])) {
             unset($diffConf['updateMessage']);
         }
         if (count($diffConf) > 0) {
             $id = 'extconf' . $extKey;
             $datas = '<span style="color:white;">Diff : </span>' . tx_additionalreports_util::viewArray($diffConf);
             $datas .= '<span style="color:white;">$GLOBALS[\'TYPO3_CONF_VARS\'][\'EXT\'][\'extConf\'][\'' . $extKey . '\'] : </span>';
             $datas .= tx_additionalreports_util::viewArray($arr);
             $datas .= '<span style="color:white;">ext_conf_template.txt : </span>';
             $datas .= tx_additionalreports_util::viewArray($tsparserObj->setup);
             $dumpExtConf = tx_additionalreports_util::writePopUp($id, $extKey, $datas);
             $listExtensionsTerItem['confintegrity'] = self::getLl('yes') . '&nbsp;&nbsp;' . $dumpExtConf;
         } else {
             $listExtensionsTerItem['confintegrity'] = self::getLl('no');
         }
     } else {
         $listExtensionsTerItem['confintegrity'] = self::getLl('no');
     }
     // modified files
     if (count($itemValue['affectedfiles']) > 0) {
         $id = 'files' . $extKey;
         $contentUl = '<div style="display:none;" id="' . $id . '"><ul>';
         foreach ($itemValue['affectedfiles'] as $affectedFile) {
             $compareUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL');
             $compareUrl .= 'typo3/ajax.php?ajaxID=additional_reports::compareFiles';
             $compareUrl .= '&extKey=' . $extKey . '&extFile=' . $affectedFile . '&extVersion=' . $itemValue['EM_CONF']['version'];
             $contentUl .= '<li><a rel="shadowbox;height=600;width=800;" href = "' . $compareUrl . '" target = "_blank"';
             $contentUl .= 'title="' . $affectedFile . ' : ' . $extKey . ' ' . $itemValue['EM_CONF']['version'] . '" > ';
             $contentUl .= $affectedFile . '</a></li>';
         }
         $contentUl .= '</ul>';
         $contentUl .= '</div>';
         $listExtensionsTerItem['files'] = count($itemValue['affectedfiles']) . ' ' . self::getLl('extensions_filesmodified') . $contentUl;
         $listExtensionsTerItem['fileslink'] = '<input type="button" onclick="$(\'' . $id . '\').toggle();" value="+"/>';
     } else {
         $listExtensionsTerItem['files'] = '&nbsp;';
         $listExtensionsTerItem['fileslink'] = '&nbsp;';
     }
     return $listExtensionsTerItem;
 }