コード例 #1
0
 /**
  * @access private
  * @return string
  */
 function _InlineMenuHomePage($PageID)
 {
     $image = 'Noch kein Bild gesetzt';
     $thumbPath = $this->_PageStructure->GetInlineMenuData($PageID, 'imageThumb');
     $imagePath = $this->_PageStructure->GetInlineMenuData($PageID, 'image');
     $imageTitle = $this->_PageStructure->GetInlineMenuData($PageID, 'imageTitle');
     if (file_exists($thumbPath)) {
         $image = "<img alt=\"{$imageTitle}\" src=\"" . generateUrl($thumbPath) . "\"/>";
     } else {
         if (file_exists($imagePath)) {
             // maximum width
             $imgmax2 = 200;
             // if it isn't "wide" enough
             $imgmax3 = 350;
             $inlinemenuFolder = 'data/thumbnails/';
             $imageResizer = new ImageConverter($imagePath);
             $sizes = array();
             // it is "wide" enough??
             if ($imageResizer->Size[0] > $imgmax2) {
                 $sizes = $imageResizer->CalcSizeByMaxWidth($imgmax2);
             } else {
                 if ($imageResizer->Size[1] > $imgmax3) {
                     $sizes = $imageResizer->CalcSizeByMax($imgmax2);
                 }
             }
             $thumbnail = $imagePath;
             // is there something to resize?
             if (count($sizes) == 2) {
                 $thumbnail = $imageResizer->SaveResizedTo($sizes[0], $sizes[1], $inlinemenuFolder, $sizes[0] . 'x' . $sizes[1] . '_');
             }
             if ($thumbnail !== false) {
                 $image = "<img alt=\"{$imageTitle}\" src=\"" . generateUrl($thumbnail) . "\"/>";
             }
         }
     }
     $out = "\r\n\t\t\t\t<fieldset>\r\n\t\t\t\t\t<legend>" . $this->_Translation->GetTranslation('inlinemenu') . "</legend>\r\n\t\t\t\t<div class=\"row\">\r\n\t\t\t\t\t\t<label class=\"row\">\r\n\t\t\t\t\t\t\t" . $this->_Translation->GetTranslation('inlinemenu_image') . ":\r\n\t\t\t\t\t\t\t<span class=\"info\">Das ist der Pfad zu dem Bild, das dem Zusatzmen&uuml; zugeordnet wird, es kann der Einfachheit halber aus den bereits hochgeladenen Bildern ausgew&auml;hlt werden.</span>\r\n\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t{$image}\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"row\">\r\n\t\t\t\t\t<a href=\"{$this->LinkUrl}page=pagestructure&amp;action=pageInlineMenu&amp;pageID={$PageID}&amp;action2=selectImage\" class=\"button\">Bild ausw&auml;hlen/ver&auml;ndern</a>\r\n\t\t\t\t\t" . (file_exists($thumbPath) ? "<a href=\"{$this->LinkUrl}page=pagestructure&amp;action=pageInlineMenu&amp;pageID={$PageID}&amp;action2=removeImage\" class=\"button\">Bild entfernen</a>" : '') . "\r\n\t\t\t\t</div>\r\n\t\t\t\t<form action=\"{$this->FormUrl}\" method=\"post\">\r\n\t\t\t\t<input type=\"hidden\" name=\"{$this->FormPage}\" value=\"pagestructure\" />\r\n\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"pageInlineMenu\" />\r\n\t\t\t\t<input type=\"hidden\" name=\"pageID\" value=\"{$PageID}\" />\r\n\t\t\t\t<input type=\"hidden\" name=\"action2\" value=\"setImageTitle\" />\r\n\t\t\t\t<div class=\"row\">\r\n\t\t\t\t\t<label for=\"inlinemenuThumbTitle\"class=\"row\">\r\n\t\t\t\t\t\tBildunterschrift:\r\n\t\t\t\t\t\t<span class=\"info\">Die Bildunterschrift kann das Bild noch ein wenig erl&auml;utern.</span>\r\n\t\t\t\t\t</label>\r\n\t\t\t\t\t<input id=\"inlinemenuThumbTitle\" name=\"imageTitle\" type=\"text\" value=\"{$imageTitle}\" />\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"row\">\r\n\t\t\t\t\t<input type=\"submit\" class=\"button\" value=\"" . $this->_Translation->GetTranslation('save') . "\" />\r\n\t\t\t\t</div>\r\n\t\t\t\t</form>";
     $sql = "SELECT *\r\n\t\t\t\tFROM " . DB_PREFIX . "inlinemenu_entries\r\n\t\t\t\tWHERE inlineentry_page_id = {$PageID}\r\n\t\t\t\tORDER BY inlineentry_sortid ASC";
     $entries_result = $this->_SqlConnection->SqlQuery($sql);
     $out .= "<h3 id=\"entries\">Eintr&auml;ge</h3>\r\n\t\t\t\t<div class=\"row\"><table class=\"text_table full_width\">\r\n\t\t\t\t\t<thead><tr><th>Text</th><th class=\"small_width\">Typ</th><th class=\"actions\">Aktion</th></tr></thead>";
     while ($entry = mysql_fetch_object($entries_result)) {
         $typeImage = '';
         switch ($entry->inlineentry_type) {
             case 'download':
                 $typeImage = "<img alt=\"\" src=\"img/download.png\"/>Download";
                 break;
             case 'link':
                 $typeImage = "<img alt=\"\" src=\"img/extern.png\"/>Externer-Link";
                 break;
             case 'intern':
                 $typeImage = "<img alt=\"\" src=\"img/view.png\"/>Interner-Link";
                 break;
             default:
                 $typeImage = "Text";
                 break;
         }
         $out .= "<tr>\r\n\t\t\t\t\t<td>" . nl2br($entry->inlineentry_text) . "</td>\r\n\t\t\t\t\t<td>" . $typeImage . "</td>\r\n\t\t\t\t\t<td>\r\n\t\t\t\t\t\t<a href=\"{$this->LinkUrl}page=pagestructure&amp;action=pageInlineMenu&amp;pageID={$PageID}&amp;entrySortID={$entry->inlineentry_sortid}&amp;action2=moveEntryUp#entries\"><img src=\"./img/up.png\" alt=\"" . $this->_Translation->GetTranslation('move_up') . "\" title=\"" . $this->_Translation->GetTranslation('move_up') . "\" /></a>\r\n\t\t\t\t\t\t<a href=\"{$this->LinkUrl}page=pagestructure&amp;action=pageInlineMenu&amp;pageID={$PageID}&amp;entrySortID={$entry->inlineentry_sortid}&amp;action2=moveEntryDown#entries\"><img src=\"./img/down.png\" alt=\"" . $this->_Translation->GetTranslation('move_down') . "\" title=\"" . $this->_Translation->GetTranslation('move_down') . "\" /></a>\r\n\t\t\t\t\t\t<a href=\"{$this->LinkUrl}page=pagestructure&amp;action=pageInlineMenu&amp;pageID={$PageID}&amp;entryID={$entry->inlineentry_id}&amp;action2=editEntry\"><img src=\"./img/edit.png\" alt=\"" . $this->_Translation->GetTranslation('edit') . "\" title=\"" . $this->_Translation->GetTranslation('edit') . "\" /></a>\r\n\t\t\t\t\t\t<a href=\"{$this->LinkUrl}page=pagestructure&amp;action=pageInlineMenu&amp;pageID={$PageID}&amp;entryID={$entry->inlineentry_id}&amp;action2=removeEntry\"><img src=\"./img/del.png\" alt=\"" . $this->_Translation->GetTranslation('delete') . "\" title=\"" . $this->_Translation->GetTranslation('delete') . "\" /></a>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>";
     }
     $out .= "</table>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"row\"><a href=\"{$this->LinkUrl}page=pagestructure&amp;action=pageInlineMenu&amp;pageID={$PageID}&amp;action2=addNewEntryDialog\" class=\"button\">Einen Eintrag hinzuf&uuml;gen</a></div>\r\n\t\t\t\t\t</fieldset>";
     return $out;
 }