Beispiel #1
0
 /**
  * Erstellt einen Link auf die aktuelle Location mit zusätzlichen Parametern
  */
 public function createLink($urlParams, $pid, $label, $options = array())
 {
     if ($options['icon']) {
         $label = "<img " . Tx_Rnbase_Backend_Utility_Icons::skinImg($GLOBALS['BACK_PATH'], 'gfx/' . $options['icon']) . ' title="' . $label . '\\" alt="" >';
     }
     if ($options['sprite']) {
         tx_rnbase::load('tx_rnbase_mod_Util');
         $label = tx_rnbase_mod_Util::getSpriteIcon($options['sprite']);
     }
     $jsCode = "window.location.href='index.php?id=" . $pid . $urlParams . "'; return false;";
     if (isset($options['confirm']) && strlen($options['confirm']) > 0) {
         $jsCode = 'if(confirm(' . tx_rnbase_util_Strings::quoteJSvalue($options['confirm']) . ')) {' . $jsCode . '} else {return false;}';
     }
     $title = '';
     if ($options['hover']) {
         $title = ' title="' . $options['hover'] . '" ';
     }
     return '<a href="#" onclick="' . htmlspecialchars($jsCode) . '" ' . $title . ">" . $label . '</a>';
 }
 /**
  * returns the sprite icon for the given sys language record.
  *
  * @param array|int $recordOrUid
  * @return Ambigous <string, multitype:>
  */
 public static function getLangSpriteIcon($recordOrUid, $options = NULL)
 {
     tx_rnbase::load('tx_rnbase_model_data');
     $options = tx_rnbase_model_data::getInstance($options);
     if (!is_array($recordOrUid)) {
         $langUid = (int) $recordOrUid;
         $record = self::getLangRecord($recordOrUid);
     } else {
         $langUid = (int) $recordOrUid['uid'];
         $record = $recordOrUid;
     }
     $spriteIconName = 'flags-multiple';
     if (!empty($record)) {
         $spriteIconName = t3lib_iconWorks::mapRecordTypeToSpriteIconName('sys_language', $record);
     }
     $out = tx_rnbase_mod_Util::getSpriteIcon($spriteIconName);
     // add title per default (typo3 equivalent)!
     if ($options->getShowTitle() !== FALSE) {
         $langTitle = 'N/A';
         if ($langUid === -1) {
             $langTitle = 'LLL:EXT:lang/locallang_general.xml:LGL.allLanguages';
         } elseif ($langUid === 0) {
             $langTitle = 'LLL:EXT:lang/locallang_general.xml:LGL.default_value';
         } elseif (!empty($record['title'])) {
             $langTitle = $record['title'];
         }
         $out .= '&nbsp;' . htmlspecialchars($GLOBALS['LANG']->sL($langTitle));
     }
     return $out;
 }
 /**
  *
  * @param array $entry
  * @param array $columns
  * @param tx_rnbase_util_FormTool $formTool
  * @param Tx_Rnbase_Domain_Model_DataInterface $options
  * @return array
  */
 protected static function prepareRow($entry, $columns, $formTool, $options)
 {
     $record = $entry;
     if ($entry instanceof Tx_Rnbase_Domain_Model_DataInterface) {
         $record = $entry->getProperty();
     }
     if ($entry instanceof Tx_Rnbase_Domain_Model_RecordInterface) {
         $record = $entry->getRecord();
     }
     $row = array();
     if ($options->getCheckbox() !== NULL) {
         $checkName = $options->getCheckboxname() ? $options->getCheckboxname() : 'checkEntry';
         $dontcheck = is_array($options->getDontcheck()) ? $options->getDontcheck() : array();
         // Check if entry is checkable
         if (!array_key_exists($record['uid'], $dontcheck)) {
             $row[] = $formTool->createCheckbox($checkName . '[]', $record['uid']);
         } else {
             $row[] = '<img' . Tx_Rnbase_Backend_Utility_Icons::skinImg($GLOBALS['BACK_PATH'], 'gfx/zoom2.gif', 'width="11" height="12"') . ' title="Info: ' . $dontcheck[$record['uid']] . '" border="0" alt="" />';
         }
     }
     if ($options->getAddRecordSprite()) {
         $spriteIconName = 'mimetypes-other-other';
         if ($entry instanceof Tx_Rnbase_Domain_Model_RecordInterface && $entry->getTableName()) {
             $spriteIconName = Tx_Rnbase_Backend_Utility_Icons::mapRecordTypeToSpriteIconName($entry->getTableName(), $record);
         }
         $row[] = tx_rnbase_mod_Util::getSpriteIcon($spriteIconName);
     }
     reset($columns);
     foreach ($columns as $column => $data) {
         // Hier erfolgt die Ausgabe der Daten für die Tabelle. Wenn eine method angegeben
         // wurde, dann muss das Entry als Objekt vorliegen. Es wird dann die entsprechende
         // Methode aufgerufen. Es kann auch ein Decorator-Objekt gesetzt werden. Dann wird
         // von diesem die Methode format aufgerufen und der Wert, sowie der Name der aktuellen
         // Spalte übergeben. Ist nichts gesetzt wird einfach der aktuelle Wert verwendet.
         if (isset($data['method'])) {
             $row[] = call_user_func(array($entry, $data['method']));
         } elseif (isset($data['decorator'])) {
             $decor = $data['decorator'];
             $row[] = $decor->format($record[$column], $column, $record, $entry);
         } else {
             $row[] = $record[$column];
         }
     }
     if ($options->getLinker()) {
         $row[] = self::addLinker($options, $entry, $formTool);
     }
     return $row;
 }
 /**
  * Renders the severity column.
  *
  * @param DevlogEntryModel $entry
  *
  * @return string
  */
 protected function formatSeverityColumn(DevlogEntryModel $entry)
 {
     $severityId = $entry->getSeverity();
     $severityName = SeverityUtility::getName($severityId);
     $icon = '';
     switch ($severityId) {
         case SeverityUtility::DEBUG:
             $icon = 'status-dialog-ok';
             break;
         case SeverityUtility::INFO:
             $icon = 'status-dialog-information';
             break;
         case SeverityUtility::NOTICE:
             $icon = 'status-dialog-notification';
             break;
         case SeverityUtility::WARNING:
             $icon = 'status-dialog-warning';
             break;
         case SeverityUtility::ERROR:
         case SeverityUtility::CRITICAL:
         case SeverityUtility::ALERT:
         case SeverityUtility::EMERGENCY:
             $icon = 'status-dialog-error';
             break;
     }
     if (!empty($icon)) {
         \tx_rnbase::load('tx_rnbase_mod_Util');
         $icon = \tx_rnbase_mod_Util::getSpriteIcon($icon);
     }
     return sprintf('<button ' . 'type="submit" ' . 'class="button button-severity severity severity-%2$s" ' . 'name="SET[mklogDevlogEntrySeverity]" ' . 'value="%1$s" ' . 'title="Filter %3$s (%1$s)"' . '>%4$s<span>%3$s</span></button>', $severityId, strtolower($severityName), ucfirst(strtolower($severityName)), $icon);
 }
 protected function showHiddenSelector(&$marker, $options = array())
 {
     $items = array(0 => $GLOBALS['LANG']->getLL('label_select_hide_hidden'), 1 => $GLOBALS['LANG']->getLL('label_select_show_hidden'));
     tx_rnbase::load('tx_rnbase_mod_Util');
     $selectedItem = tx_rnbase_mod_Util::getModuleValue('showhidden', $this->getModule(), array('changed' => tx_rnbase_parameters::getPostOrGetParameter('SET')));
     $options['label'] = $options['label'] ? $options['label'] : $GLOBALS['LANG']->getLL('label_hidden');
     return tx_rnbase_mod_Util::showSelectorByArray($items, $selectedItem, 'showhidden', $marker, $options);
 }
 /**
  * Rendert einen einzelnen Button inklusive Icons und Beschreibungs-Tooltip.
  * @param string $type
  * @return string
  */
 protected function renderButton($type)
 {
     static $infoSprite = FALSE;
     if ($infoSprite == FALSE) {
         $infoSprite = tx_rnbase_mod_Util::getSpriteIcon('status-dialog-information');
     }
     $configuration = $this->getConfigurations();
     $confId = $this->getConfId() . 'types.';
     $label = $configuration->get($confId . $type . '.label');
     $sprite = $configuration->get($confId . $type . '.spriteIcon');
     $button = $this->getModule()->getFormTool()->createSubmit('mklib[export][' . $type . ']', $label);
     if ($sprite) {
         $sprite = tx_rnbase_mod_Util::getSpriteIcon($sprite);
     }
     $description = $configuration->get($confId . $type . '.description');
     if ($description) {
         $description = '<span class="bgColor2 info">' . $infoSprite . '<strong>' . $label . '</strong><br />' . $description . '</span>';
     }
     $button = '<span class="imgbtn">' . $sprite . $button . '</span>';
     return '<span class="mklibexport">' . $button . $description . '</span>';
 }