Example #1
0
 /**
  * Return if there are no files
  *
  * @return string
  */
 public function generate()
 {
     if ($this->playerSRC == '') {
         return '';
     }
     $source = \StringUtil::deserialize($this->playerSRC);
     if (!is_array($source) || empty($source)) {
         return '';
     }
     $objFiles = \FilesModel::findMultipleByUuidsAndExtensions($source, array('mp4', 'm4v', 'mov', 'wmv', 'webm', 'ogv', 'm4a', 'mp3', 'wma', 'mpeg', 'wav', 'ogg'));
     if ($objFiles === null) {
         return '';
     }
     // Display a list of files in the back end
     if (TL_MODE == 'BE') {
         $return = '<ul>';
         while ($objFiles->next()) {
             $objFile = new \File($objFiles->path);
             $return .= '<li>' . \Image::getHtml($objFile->icon, '', 'class="mime_icon"') . ' <span>' . $objFile->name . '</span> <span class="size">(' . $this->getReadableSize($objFile->size) . ')</span></li>';
         }
         return $return . '</ul>';
     }
     $this->objFiles = $objFiles;
     return parent::generate();
 }
Example #2
0
 /**
  * Generate the module
  *
  * @return string
  */
 public function run()
 {
     /** @var \BackendTemplate|object $objTemplate */
     $objTemplate = new \BackendTemplate('be_live_update');
     $objTemplate->updateClass = 'tl_confirm';
     $objTemplate->updateHeadline = $GLOBALS['TL_LANG']['tl_maintenance']['liveUpdate'];
     $objTemplate->isActive = $this->isActive();
     $strMessage = ' <a href="contao/changelog.php" onclick="Backend.openModalIframe({\'width\':860,\'title\':\'CHANGELOG\',\'url\':this.href});return false" title="' . specialchars($GLOBALS['TL_LANG']['tl_maintenance']['changelog']) . '">' . \Image::getHtml('changelog.gif', '', 'style="vertical-align:text-bottom;padding-left:3px"') . '</a>';
     // Newer version available
     if (\Config::get('latestVersion') && version_compare(VERSION . '.' . BUILD, \Config::get('latestVersion'), '<')) {
         $objTemplate->updateClass = 'tl_info';
         $objTemplate->updateMessage = sprintf($GLOBALS['TL_LANG']['tl_maintenance']['newVersion'], \Config::get('latestVersion')) . $strMessage;
     } else {
         $objTemplate->updateClass = 'tl_confirm';
         $objTemplate->updateMessage = sprintf($GLOBALS['TL_LANG']['tl_maintenance']['upToDate'], VERSION . '.' . BUILD) . $strMessage;
     }
     // Automatically switch to SSL
     if (\Environment::get('ssl')) {
         \Config::set('liveUpdateBase', str_replace('http://', 'https://', \Config::get('liveUpdateBase')));
     }
     $objTemplate->uid = \Config::get('liveUpdateId');
     $objTemplate->updateServer = \Config::get('liveUpdateBase') . 'index.php';
     // Run the update
     if (\Input::get('token') != '') {
         $this->runLiveUpdate($objTemplate);
     }
     $objTemplate->version = VERSION . '.' . BUILD;
     $objTemplate->liveUpdateId = $GLOBALS['TL_LANG']['tl_maintenance']['liveUpdateId'];
     $objTemplate->runLiveUpdate = specialchars($GLOBALS['TL_LANG']['tl_maintenance']['runLiveUpdate']);
     $objTemplate->referer = base64_encode(\Environment::get('base') . \Environment::get('request') . '|' . \Environment::get('server'));
     $objTemplate->updateHelp = sprintf($GLOBALS['TL_LANG']['tl_maintenance']['updateHelp'], '<a href="https://update.contao.org" target="_blank">Live Update ID</a>');
     $objTemplate->phar = file_exists(TL_ROOT . '/contao/update.phar.php');
     $objTemplate->toLiveUpdate = $GLOBALS['TL_LANG']['tl_maintenance']['toLiveUpdate'];
     return $objTemplate->parse();
 }
 /**
  * Generate the module
  */
 protected function compile()
 {
     $intList = $this->athletes_group;
     $objMembers = $this->Database->prepare("SELECT * FROM tl_athlete WHERE published=1 AND pid=? ORDER BY sorting")->execute($intList);
     //$objMembers = \MembersModel;
     // Return if no Members were found
     if (!$objMembers->numRows) {
         return;
     }
     $strLink = '';
     // Generate a jumpTo link
     if ($this->jumpTo > 0) {
         $objJump = \PageModel::findByPk($this->jumpTo);
         if ($objJump !== null) {
             $strLink = $this->generateFrontendUrl($objJump->row(), $GLOBALS['TL_CONFIG']['useAutoItem'] ? '/%s' : '/items/%s');
         }
     }
     $arrMembers = array();
     // Generate Members
     while ($objMembers->next()) {
         $strPhoto = '';
         $objPhoto = \FilesModel::findByPk($objMembers->photo);
         // Add photo image
         if ($objPhoto !== null) {
             $strPhoto = \Image::getHtml(\Image::get($objPhoto->path, '140', '187', 'center_center'));
         }
         $arrMembers[] = array('name' => $objMembers->name, 'family' => $objMembers->family, 'post' => $objMembers->post, 'joined' => $objMembers->joined, 'photo' => $strPhoto, 'link' => strlen($strLink) ? sprintf($strLink, $objMembers->alias) : '');
     }
     $this->Template->members = $arrMembers;
 }
Example #4
0
 public function editArticles($row, $href, $label, $title, $icon)
 {
     if (!$this->User->hasAccess('article', 'modules')) {
         return '';
     }
     return $row['type'] == 'regular' || $row['type'] == 'login' || $row['type'] == 'error_403' || $row['type'] == 'error_404' ? '<a href="' . $this->addToUrl($href . '&amp;pn=' . $row['id']) . '" title="' . specialchars($title) . '">' . Image::getHtml($icon, $label) . '</a> ' : Image::getHtml(preg_replace('/\\.gif$/i', '_.gif', $icon)) . ' ';
 }
 /**
  * @param \Database_Result $records
  * @param string           $id
  * @param \DcaWizard       $dcaWizard
  *
  * @return string
  */
 public function generateWizardList($records, $id, $dcaWizard)
 {
     $return = '';
     $rows = $dcaWizard->getRows($records);
     // Alter the rows
     \System::loadLanguageFile('tl_iso_product_collection');
     $rows = array_map(function ($row) {
         // Force an algebraic sign for quantity
         $row['quantity'] = sprintf('%+d', $row['quantity']);
         // Make referenced product collection editable in a popup
         $row['product_collection_id'] = $row['product_collection_id'] ? sprintf('<a href="contao/main.php?do=iso_orders&amp;act=edit&amp;id=%1$u&amp;popup=1&amp;nb=1&amp;rt=%4$s" title="%3$s" onclick="Backend.openModalIframe({\'width\':768,\'title\':\'%3$s\',\'url\':this.href});return false">%2$s</a>', $row['product_collection_id'], \Image::getHtml('edit.gif') . $row['product_collection_id'], sprintf($GLOBALS['TL_LANG']['tl_iso_product_collection']['edit'][1], $row['product_collection_id']), REQUEST_TOKEN) : '-';
         return $row;
     }, $rows);
     if ($rows) {
         $template = new \BackendTemplate('be_widget_dcawizard');
         $template->headerFields = $dcaWizard->getHeaderFields();
         $template->hasRows = !empty($rows);
         $template->rows = $rows;
         $template->fields = $dcaWizard->fields;
         $template->showOperations = $dcaWizard->showOperations;
         if ($dcaWizard->showOperations) {
             $template->operations = $dcaWizard->getActiveRowOperations();
         }
         $template->generateOperation = function ($operation, $row) use($dcaWizard) {
             return $dcaWizard->generateRowOperation($operation, $row);
         };
         $dom = new \DOMDocument('1.0', 'utf-8');
         $dom->loadHTML($template->parse());
         $return = $dom->saveHTML($dom->getElementsByTagName('table')->item(0));
     }
     // Add the member's total bonus points
     $return .= sprintf('<strong style="display: inline-block; margin: 4px 0 2px 6px; border-bottom: 3px double">%s</strong>', Stock::getStockForProduct($dcaWizard->currentRecord));
     return $return;
 }
Example #6
0
 /**
  * Generate the page picker.
  *
  * @param \DataContainer $dataContainer The data container driver.
  *
  * @return string
  *
  * @SuppressWarnings(PHPMD.Superglobals)
  */
 public function pagePicker(\DataContainer $dataContainer)
 {
     $template = ' <a href="contao/page.php?do=%s&amp;table=%s&amp;field=%s&amp;value=%s" title="%s"';
     $template .= ' onclick="Backend.getScrollOffset();Backend.openModalSelector({\'width\':765,\'title\':\'%s\'';
     $template .= ',\'url\':this.href,\'id\':\'%s\',\'tag\':\'ctrl_%s\',\'self\':this});return false">%s</a>';
     return sprintf($template, \Input::get('do'), $dataContainer->table, $dataContainer->field, str_replace(array('{{link_url::', '}}'), '', $dataContainer->value), specialchars($GLOBALS['TL_LANG']['MSC']['pagepicker']), specialchars(str_replace("'", "\\'", $GLOBALS['TL_LANG']['MOD']['page'][0])), $dataContainer->field, $dataContainer->field . (\Input::get('act') == 'editAll' ? '_' . $dataContainer->id : ''), \Image::getHtml('pickpage.gif', $GLOBALS['TL_LANG']['MSC']['pagepicker'], 'style="vertical-align:top;cursor:pointer"'));
 }
 /**
  * Generate the label.
  *
  * @param array  $row   The current row.
  * @param string $label The default label.
  *
  * @return string
  * @SuppressWarnings(PHPMD.Superglobals)
  */
 public function getLabel($row, $label)
 {
     if ($row['backend'] && $row['frontend']) {
         $label = 'BE+FE ' . $label;
     } elseif ($row['backend']) {
         $label = 'BE ' . $label;
     } elseif ($row['frontend']) {
         $label = 'FE ' . $label;
     } else {
         $label = \Image::getHtml('system/themes/' . $this->getTheme() . '/images/invisible.gif', '');
     }
     list($group, $path) = explode('::', $row['langvar'], 2);
     $path = $this->formatPath($group, $path);
     if (empty($GLOBALS['TL_TRANSLATION'][$group][$path]['label'])) {
         $label .= ' <strong>' . $path . '</strong>';
     } else {
         $label .= ' <strong>' . $GLOBALS['TL_TRANSLATION'][$group][$path]['label'] . '</strong>';
     }
     $varContent = deserialize($row['content']);
     if (!$varContent) {
         $varContent = $row['content'];
     }
     if (is_array($varContent)) {
         $label .= '<pre class="translation_content">&ndash; ';
         $label .= implode('<br>&ndash; ', array_map(array($this->languageEditor, 'plainEncode'), $varContent));
         $label .= '</pre>';
         return $label;
     } else {
         $label .= '<pre class="translation_content">' . $this->languageEditor->plainEncode($varContent) . '</pre>';
     }
     return $label;
 }
Example #8
0
 public static function staticPagePicker(array $arrData)
 {
     $strTitle = specialchars($GLOBALS['TL_LANG']['MSC']['pagepicker']);
     $onClick = "Backend.getScrollOffset();Backend.openModalSelector({'width':765,'title':'" . specialchars(str_replace("'", "\\'", $GLOBALS['TL_LANG']['MOD']['page'][0])) . "','url':this.href,'id':'" . $arrData['field'] . "','tag':'ctrl_" . $arrData['field'] . (\Input::get('act') == 'editAll' ? '_' . $arrData['id'] : '') . "','self':this});return false";
     $strImage = \Image::getHtml('pickpage.gif', $GLOBALS['TL_LANG']['MSC']['pagepicker'], 'style="vertical-align:top;cursor:pointer"');
     return ' <a href="contao/page.php?do=' . \Input::get('do') . '&amp;table=' . $arrData['table'] . '&amp;field=' . $arrData['field'] . '&amp;value=' . str_replace(array('{{link_url::', '}}'), '', $arrData['value']) . '" title="' . $strTitle . '" onclick="' . $onClick . '">' . $strImage . '</a>';
 }
 /**
  * Generate the metamodels renderer button.
  *
  * @param array  $row        Current row.
  * @param string $href       The button href.
  * @param string $label      The button label.
  * @param string $title      The button title.
  * @param string $icon       The button icon.
  * @param string $attributes Optional attributes.
  *
  * @return string
  */
 public function generateRendererButton($row, $href, $label, $title, $icon, $attributes)
 {
     if (empty($this->layers[$row['type']]['metamodels'])) {
         return '';
     }
     return sprintf('<a href="%s" title="%s">%s</a> ', \Backend::addToUrl($href . '&amp;id=' . $row['id']), $title, \Image::getHtml($icon, $label, $attributes));
 }
Example #10
0
   /**
    * Generate the widget and return it as string
    *
    * @return string
    */
   public function generate()
   {
       $arrButtons = array('copy', 'delete', 'drag');
       // Make sure there is at least an empty array
       if (!is_array($this->varValue) || empty($this->varValue)) {
           $this->varValue = array('');
       }
       // Initialize the tab index
       if (!\Cache::has('tabindex')) {
           \Cache::set('tabindex', 1);
       }
       $return = '<ul id="ctrl_' . $this->strId . '" class="tl_listwizard">';
       // Add input fields
       for ($i = 0, $c = count($this->varValue); $i < $c; $i++) {
           $return .= '
   <li><input type="text" name="' . $this->strId . '[]" class="tl_text" value="' . \StringUtil::specialchars($this->varValue[$i]) . '"' . $this->getAttributes() . '> ';
           // Add buttons
           foreach ($arrButtons as $button) {
               if ($button == 'drag') {
                   $return .= ' <button type="button" class="drag-handle" title="' . \StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['move']) . '">' . \Image::getHtml('drag.svg') . '</button>';
               } else {
                   $return .= ' <button type="button" data-command="' . $button . '" title="' . \StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['lw_' . $button]) . '">' . \Image::getHtml($button . '.svg') . '</button>';
               }
           }
           $return .= '</li>';
       }
       return $return . '
 </ul>
 <script>Backend.listWizard("ctrl_' . $this->strId . '")</script>';
   }
 public function generate($row, $href, $label, $title, $icon, $attributes)
 {
     $href .= '&id=' . $row['id'];
     if ($row['type'] == 'module') {
         return '<a href="' . $this->addToUrl($href) . '" title="' . specialchars($title) . '"' . $attributes . '>' . Image::getHtml($icon, $label) . '</a> ';
     }
 }
 /**
  * Generate a song row and return it as HTML string
  * @param array
  * @return string
  */
 public function generateItemRow($arrRow)
 {
     $objImage = \FilesModel::findByPk($arrRow['singleSRC']);
     if ($objImage !== null) {
         $strImage = \Image::getHtml(\Image::get($objImage->path, '30', '30', 'center_center'));
     }
     return '<div><div style="float:left; margin-right:10px;">' . $strImage . '</div>' . $arrRow['title'] . '</div>';
 }
Example #13
0
 public function generateActRow($arrRow)
 {
     $objImage = \FilesModel::findByPk($arrRow['singleSRC']);
     if ($objImage !== null) {
         $strImage = \Image::getHtml(\Image::get($objImage->path, '25', '33', 'center_center'));
     }
     return '<div><div style="float:left; margin-right:10px;">' . $strImage . '</div>' . $arrRow['title'] . ' <br /><span style="padding-left:3px;color:#b3b3b3;">[' . $arrRow['post'] . ']</span></div>';
 }
Example #14
0
 public function addTypeIcon($row, $label, DataContainer $dc, $args = null)
 {
     $args[0] = \Image::getHtml(\Image::get('system/modules/mail_to/assets/mail-open-image.png', 16, 16));
     $objFile = FilesModel::findByUuid($row['folder']);
     $args[2] = $objFile !== null ? $objFile->path : '-';
     $args[5] = Date::parse(Date::getFormatFromRgxp('datim'), $row['lastrun']);
     return $args;
 }
 /**
  * Generate the clear cache button.
  *
  * @param array  $row        The data row.
  * @param string $href       The link.
  * @param string $label      The label.
  * @param string $title      The title.
  * @param string $icon       The icon.
  * @param string $attributes The attributes.
  *
  * @return string
  */
 public function generateButton($row, $href, $label, $title, $icon, $attributes)
 {
     $count = $this->service()->countPageCacheEntries($row['id']);
     if (!$count) {
         return \Image::getHtml($icon, $label, 'style="opacity:0.5;filter: gray;-webkit-filter: grayscale(100%);"');
     }
     return sprintf('<a href="%s" title="%s"%s>%s</a> ', \Backend::addToUrl($href . '&amp;id=' . $row['id']), $title . sprintf($GLOBALS['TL_LANG']['tl_page']['clearCacheCount'], $count), $attributes, \Image::getHtml($icon, $label));
 }
Example #16
0
 /**
  * Generate the widget and return it as string
  * @param array
  * @return string
  */
 public function parse($arrAttributes = null)
 {
     if ($this->varValue != '') {
         $blnTemporaryFile = $this->isTemporaryFile($this->varValue);
         if ($blnTemporaryFile) {
             $strNew = $this->getThumbnailPath($this->varValue);
             // Auto-resize the user avatar
             if (\Config::get('avatar_user_autoresize')) {
                 $this->varValue = \Image::get($this->varValue, $this->arrAvatarSize[0], $this->arrAvatarSize[1], 'center_center');
                 // Copy the file
                 if (\Files::getInstance()->rename($this->varValue, $strNew)) {
                     $this->varValue = $strNew;
                     $blnTemporaryFile = false;
                 }
             } else {
                 // If the file is temporary but has the exact avatar dimensions
                 // there is no need to crop it just treat it as a ready avatar
                 $arrSize = @getimagesize(TL_ROOT . '/' . $this->varValue);
                 if ($arrSize[0] == $this->arrAvatarSize[0] && $arrSize[1] == $this->arrAvatarSize[1] && \Files::getInstance()->rename($this->varValue, $strNew)) {
                     $this->varValue = $strNew;
                     $blnTemporaryFile = false;
                 }
             }
         }
         // Temporary file
         if ($blnTemporaryFile) {
             // Crop the file
             if (\Input::post('crop') != '') {
                 list($intPositionX, $intPositionY) = explode(',', \Input::post('crop'));
                 $this->varValue = $this->cropImage($this->varValue, $intPositionX, $intPositionY);
                 $this->thumbnail = \Image::getHtml($this->varValue);
                 $this->imgSize = @getimagesize(TL_ROOT . '/' . $this->varValue);
                 $this->set = $this->varValue;
                 $this->noCrop = true;
             } else {
                 // Crop mode
                 $strThumbnail = $this->getThumbnail($this->varValue);
                 $this->thumbnail = \Image::getHtml($strThumbnail);
                 $this->imgSize = @getimagesize(TL_ROOT . '/' . $strThumbnail);
             }
         } else {
             // Avatar
             $this->avatar = \Image::getHtml(\Image::get($this->varValue, $this->arrAvatarSize[0], $this->arrAvatarSize[1], 'center_center'));
             $this->set = $this->varValue;
         }
     }
     $this->ajax = \Environment::get('isAjaxRequest');
     $this->delete = $GLOBALS['TL_LANG']['MSC']['delete'];
     $this->deleteTitle = specialchars($GLOBALS['TL_LANG']['MSC']['delete']);
     $this->crop = $GLOBALS['TL_LANG']['MSC']['avatar_crop'];
     $this->cropTitle = specialchars($GLOBALS['TL_LANG']['MSC']['avatar_crop']);
     $this->extensions = json_encode(trimsplit(',', $this->getAllowedExtensions()));
     $this->sizeLimit = $this->getMaximumFileSize();
     $this->avatarSize = json_encode($this->arrAvatarSize);
     $this->texts = json_encode(array('text' => array('formatProgress' => $GLOBALS['TL_LANG']['MSC']['avatar_fineuploader_formatProgress'], 'failUpload' => $GLOBALS['TL_LANG']['MSC']['avatar_fineuploader_failUpload'], 'waitingForResponse' => $GLOBALS['TL_LANG']['MSC']['avatar_fineuploader_waitingForResponse'], 'paused' => $GLOBALS['TL_LANG']['MSC']['avatar_fineuploader_paused']), 'messages' => array('tooManyFilesError' => $GLOBALS['TL_LANG']['MSC']['avatar_fineuploader_tooManyFilesError'], 'unsupportedBrowser' => $GLOBALS['TL_LANG']['MSC']['avatar_fineuploader_unsupportedBrowser']), 'retry' => array('autoRetryNote' => $GLOBALS['TL_LANG']['MSC']['avatar_fineuploader_autoRetryNote']), 'deleteFile' => array('confirmMessage' => $GLOBALS['TL_LANG']['MSC']['avatar_fineuploader_confirmMessage'], 'deletingStatusText' => $GLOBALS['TL_LANG']['MSC']['avatar_fineuploader_deletingStatusText'], 'deletingFailedText' => $GLOBALS['TL_LANG']['MSC']['avatar_fineuploader_deletingFailedText']), 'paste' => array('namePromptMessage' => $GLOBALS['TL_LANG']['MSC']['avatar_fineuploader_namePromptMessage'])));
     $this->labels = array('drop' => $GLOBALS['TL_LANG']['MSC']['avatar_drop'], 'upload' => $GLOBALS['TL_LANG']['MSC']['avatar_upload'], 'processing' => $GLOBALS['TL_LANG']['MSC']['avatar_processing']);
     return parent::parse($arrAttributes);
 }
Example #17
0
 /**
  * Add an image to each record
  * @param array         $row
  * @param string        $label
  * @param DataContainer $dc
  * @param array         $args
  *
  * @return array
  */
 public function addImage($row, $label, DataContainer $dc, $args)
 {
     $objImage = \FilesModel::findByPk($row['singleSRC']);
     if ($objImage !== null) {
         $strImage = \Image::getHtml(\Image::get($objImage->path, '80', '60', 'center_center'));
     }
     $args[0] = $strImage;
     return $args;
 }
Example #18
0
 /**
  * Return the paste button
  * @param object
  * @param array
  * @param string
  * @param boolean
  * @param array
  * @return string
  */
 public function pasteButton(\DataContainer $dc, $row, $table, $cr, $arrClipboard = false)
 {
     if ($row['id'] == 0) {
         $imagePasteInto = \Image::getHtml('pasteinto.gif', sprintf($GLOBALS['TL_LANG'][$dc->table]['pasteinto'][1], $row['id']));
         return $cr ? \Image::getHtml('pasteinto_.gif') . ' ' : '<a href="' . $this->addToUrl('act=' . $arrClipboard['mode'] . '&mode=2&pid=' . $row['id'] . '&id=' . $arrClipboard['id']) . '" title="' . specialchars(sprintf($GLOBALS['TL_LANG'][$dc->table]['pasteinto'][1], $row['id'])) . '" onclick="Backend.getScrollOffset();">' . $imagePasteInto . '</a> ';
     }
     $imagePasteAfter = \Image::getHtml('pasteafter.gif', sprintf($GLOBALS['TL_LANG'][$dc->table]['pasteafter'][1], $row['id']));
     return $arrClipboard['mode'] == 'cut' && $arrClipboard['id'] == $row['id'] || $cr ? \Image::getHtml('pasteafter_.gif') . ' ' : '<a href="' . $this->addToUrl('act=' . $arrClipboard['mode'] . '&mode=1&pid=' . $row['id'] . '&id=' . $arrClipboard['id']) . '" title="' . specialchars(sprintf($GLOBALS['TL_LANG'][$dc->table]['pasteafter'][1], $row['id'])) . '" onclick="Backend.getScrollOffset();">' . $imagePasteAfter . '</a> ';
 }
 /**
  * Get edit map link wizard.
  *
  * @param \DataContainer $dataContainer The dataContainer driver.
  *
  * @return string
  *
  * @SuppressWarnings(PHPMD.Superglobals)
  */
 public function getEditMapLink($dataContainer)
 {
     if ($dataContainer->value < 1) {
         return '';
     }
     $pattern = 'title="%s" style="padding-left: 3px" onclick="Backend.openModalIframe(';
     $pattern .= '{\'width\':768,\'title\':\'%s\',\'url\':this.href});return false"';
     return sprintf('<a href="%s%s&amp;popup=1&amp;rt=%s" %s>%s</a>', 'contao/main.php?do=leaflet&amp;table=tl_leaflet_map&amp;act=edit&amp;id=', $dataContainer->value, \RequestToken::get(), sprintf($pattern, specialchars(sprintf($GLOBALS['TL_LANG']['tl_content']['editalias'][1], $dataContainer->value)), specialchars(str_replace("'", "\\'", sprintf($GLOBALS['TL_LANG']['tl_content']['editalias'][1], $dataContainer->value)))), \Image::getHtml('alias.gif', $GLOBALS['TL_LANG']['tl_content']['editalias'][0], 'style="vertical-align:top"'));
 }
Example #20
0
 /**
  * Callback edit button
  * @return string
  */
 public function callbackEditButton($row, $href, $label, $title, $icon, $attributes, $strTable, $arrRootIds, $arrChildRecordIds, $blnCircularReference, $strPrevious, $strNext)
 {
     $return = '';
     $strDcaKey = array_search($row['form'], $this->Formdata->arrFormsDcaKey);
     if ($strDcaKey) {
         $return .= '<a href="' . \Backend::addToUrl($href . '&amp;do=fd_' . $strDcaKey . '&amp;id=' . $row['id']) . '" title="' . specialchars($title) . '"' . $attributes . '>' . \Image::getHtml($icon, $label) . '</a> ';
     }
     return $return;
 }
Example #21
0
    /**
     * Generate icon to open the page picker for manual sorting
     */
    public function generateSortingIcon()
    {
        if (\Input::get('id') > 0) {
            return '';
        }
        return '
<div class="tl_sorting tl_subpanel" style="padding:3px 0 0 8px">
<a href="#" onclick="Backend.getScrollOffset();Isotope.openModalPageSelector({\'width\':765,\'title\':\'' . specialchars($GLOBALS['TL_LANG']['MOD']['page'][0]) . '\',\'url\':\'contao/page.php?do=' . \Input::get('do') . '&amp;table=tl_iso_product_category&amp;field=page_id&amp;value=0\',\'action\':\'sortByPage\'});return false" title="' . $GLOBALS['TL_LANG']['tl_iso_product']['sorting'] . '">' . \Image::getHtml('page.gif', $GLOBALS['TL_LANG']['tl_iso_product']['sorting']) . '</a>
</div>';
    }
 public function editModule(DataContainer $dc)
 {
     if ($dc->value < 1) {
         return '';
     }
     $objModule = $this->Database->prepare("SELECT * FROM tl_module WHERE id = ? AND type = 'block'")->execute($dc->value);
     if ($objModule->numRows) {
         $this->loadLanguageFile('tl_block');
         return ' <a href="contao/main.php?do=themes&amp;table=tl_block_module&amp;id=' . $objModule->block . '&amp;popup=1&amp;nb=1&amp;rt=' . REQUEST_TOKEN . '" title="' . sprintf(specialchars($GLOBALS['TL_LANG']['tl_block']['edit'][1]), $objModule->block) . '" style="padding-left:3px" onclick="Backend.openModalIframe({\'width\':768,\'title\':\'' . specialchars(str_replace("'", "\\'", sprintf($GLOBALS['TL_LANG']['tl_block']['edit'][1], $objModule->block))) . '\',\'url\':this.href});return false">' . Image::getHtml('alias.gif', $GLOBALS['TL_LANG']['tl_content']['editalias'][0], 'style="vertical-align:top"') . '</a>';
     }
     return $dc->value < 1 ? '' : ' <a href="contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $dc->value . '&amp;popup=1&amp;nb=1&amp;rt=' . REQUEST_TOKEN . '" title="' . sprintf(specialchars($GLOBALS['TL_LANG']['tl_content']['editalias'][1]), $dc->value) . '" style="padding-left:3px" onclick="Backend.openModalIframe({\'width\':768,\'title\':\'' . specialchars(str_replace("'", "\\'", sprintf($GLOBALS['TL_LANG']['tl_content']['editalias'][1], $dc->value))) . '\',\'url\':this.href});return false">' . Image::getHtml('alias.gif', $GLOBALS['TL_LANG']['tl_content']['editalias'][0], 'style="vertical-align:top"') . '</a>';
 }
 public function getPickerLink(\DataContainer $dc)
 {
     $strField = 'ctrl_' . $dc->field . ($this->Input->get('act') == 'editAll' ? '_' . $dc->id : '');
     if (substr($strField, -1, 1) == 'y') {
         $strFieldX = substr($strField, 0, -1) . 'x';
         $strFieldY = $strField;
     } else {
         $strFieldX = $strField;
         $strFieldY = substr($strField, 0, -1) . 'y';
     }
     return ' <a href="system/modules/con4gis_maps3/assets/be/geopicker.php?rt=' . REQUEST_TOKEN . '" title="' . $GLOBALS['TL_LANG']['c4g_maps']['geopicker'] . '" style="padding-left:3px" onclick="c4g.maps.backend.showGeoPicker(this.href,' . $strFieldX . ',' . $strFieldY . ', {title:\'' . $GLOBALS['TL_LANG']['c4g_maps']['geopicker'] . '\'});return false">' . \Image::getHtml('system/modules/con4gis_maps3/assets/images/be-icons/geopicker.png', $GLOBALS['TL_LANG']['tl_content']['editalias'][0], 'style="vertical-align:top"') . '</a>';
 }
 /**
  * Return the "toggle visibility" button
  * @param array
  * @param string
  * @param string
  * @param string
  * @param string
  * @param string
  * @return string
  */
 public function toggleIcon($row, $href, $label, $title, $icon, $attributes)
 {
     if (strlen(\Input::get('tid'))) {
         $this->toggleVisibility(\Input::get('tid'), \Input::get('state') == 1, @func_get_arg(12) ?: null);
         \Backend::redirect(\Controller::getReferer());
     }
     $href .= '&amp;tid=' . $row['id'] . '&amp;state=' . ($row['published'] ? '' : 1);
     if (!$row['published']) {
         $icon = 'invisible.gif';
     }
     return '<a href="' . \Backend::addToUrl($href) . '" title="' . specialchars($title) . '"' . $attributes . '>' . \Image::getHtml($icon, $label) . '</a> ';
 }
 /**
  * Generate item label and return it as HTML string
  * @param object
  * @param string
  * @param object
  * @param string
  * @param mixed
  * @return string
  */
 public static function generateItemLabel($objItem, $strForeignTable, $objDca = null, $strTitleField = '', $varCallback = null)
 {
     $args = array();
     $label = '';
     $blnSimple = false;
     $showFields = $GLOBALS['TL_DCA'][$strForeignTable]['list']['label']['fields'];
     // Generate simple label, e.g. for breadcrumb
     if ($strTitleField != '') {
         $blnSimple = true;
         $showFields['titleField'] = $strTitleField;
     }
     foreach ($showFields as $k => $v) {
         // Decrypt the value
         if ($GLOBALS['TL_DCA'][$strForeignTable]['fields'][$v]['eval']['encrypt']) {
             $objItem->{$v} = \Encryption::decrypt(deserialize($objItem->{$v}));
         }
         if (strpos($v, ':') !== false) {
             list($strKey, $strTable) = explode(':', $v);
             list($strTable, $strField) = explode('.', $strTable);
             $objRef = \Database::getInstance()->prepare("SELECT " . $strField . " FROM " . $strTable . " WHERE id=?")->limit(1)->execute($objItem->{$strKey});
             $args[$k] = $objRef->numRows ? $objRef->{$strField} : '';
         } elseif (in_array($GLOBALS['TL_DCA'][$strForeignTable]['fields'][$v]['flag'], array(5, 6, 7, 8, 9, 10))) {
             $args[$k] = \Date::parse($GLOBALS['TL_CONFIG']['datimFormat'], $objItem->{$v});
         } elseif ($GLOBALS['TL_DCA'][$strForeignTable]['fields'][$v]['inputType'] == 'checkbox' && !$GLOBALS['TL_DCA'][$strForeignTable]['fields'][$v]['eval']['multiple']) {
             $args[$k] = $objItem->{$v} != '' ? isset($GLOBALS['TL_DCA'][$strForeignTable]['fields'][$v]['label'][0]) ? $GLOBALS['TL_DCA'][$strForeignTable]['fields'][$v]['label'][0] : $v : '';
         } else {
             $args[$k] = $GLOBALS['TL_DCA'][$strForeignTable]['fields'][$v]['reference'][$objItem->{$v}] ?: $objItem->{$v};
         }
     }
     $label = vsprintf(strlen($GLOBALS['TL_DCA'][$strForeignTable]['list']['label']['format']) ? $GLOBALS['TL_DCA'][$strForeignTable]['list']['label']['format'] : '%s', $args);
     // Shorten the label if it is too long
     if ($GLOBALS['TL_DCA'][$strForeignTable]['list']['label']['maxCharacters'] > 0 && $GLOBALS['TL_DCA'][$strForeignTable]['list']['label']['maxCharacters'] < utf8_strlen(strip_tags($label))) {
         $label = trim(\String::substrHtml($label, $GLOBALS['TL_DCA'][$strForeignTable]['list']['label']['maxCharacters'])) . ' …';
     }
     $label = preg_replace('/\\(\\) ?|\\[\\] ?|\\{\\} ?|<> ?/', '', $label);
     // Use the default callback if none provided
     if ($varCallback === null) {
         $varCallback = $GLOBALS['TL_DCA'][$strForeignTable]['list']['label']['label_callback'];
     }
     // Call the label_callback ($row, $label, $this)
     if (is_array($varCallback)) {
         $strClass = $varCallback[0];
         $strMethod = $varCallback[1];
         $label = \System::importStatic($strClass)->{$strMethod}($objItem->row(), $label, $objDca, '', $blnSimple, false);
     } elseif (is_callable($varCallback)) {
         $label = $varCallback($objItem->row(), $label, $objDca, '', $blnSimple, false);
     } else {
         $label = \Image::getHtml('iconPLAIN.gif') . ' ' . ($blnSimple ? $args['titleField'] : $label);
     }
     return $label;
 }
   /**
    * Generate the widget and return it as string
    *
    * @return string
    */
   public function generate()
   {
       $count = 0;
       $languages = $this->getLanguages();
       $return = '';
       $taken = array();
       $this->import('Database');
       // Only show the root page languages (see #7112, #7667)
       $objRootLangs = $this->Database->query("SELECT REPLACE(language, '-', '_') AS language FROM tl_page WHERE type='root'");
       $languages = array_intersect_key($languages, array_flip($objRootLangs->fetchEach('language')));
       // Make sure there is at least an empty array
       if (!is_array($this->varValue) || empty($this->varValue)) {
           if (count($languages) > 0) {
               $this->varValue = array(key($languages) => array());
               // see #4188
           } else {
               return '<p class="tl_info">' . $GLOBALS['TL_LANG']['MSC']['metaNoLanguages'] . '</p>';
           }
       }
       // Add the existing entries
       if (!empty($this->varValue)) {
           $return = '<ul id="ctrl_' . $this->strId . '" class="tl_metawizard">';
           // Add the input fields
           foreach ($this->varValue as $lang => $meta) {
               $return .= '
   <li class="' . ($count % 2 == 0 ? 'even' : 'odd') . '" data-language="' . $lang . '">';
               $return .= '<span class="lang">' . (isset($languages[$lang]) ? $languages[$lang] : $lang) . ' ' . \Image::getHtml('delete.gif', '', 'class="tl_metawizard_img" onclick="Backend.metaDelete(this)"') . '</span>';
               // Take the fields from the DCA (see #4327)
               foreach ($this->metaFields as $field) {
                   $return .= '<label for="ctrl_' . $field . '_' . $count . '">' . $GLOBALS['TL_LANG']['MSC']['aw_' . $field] . '</label> <input type="text" name="' . $this->strId . '[' . $lang . '][' . $field . ']" id="ctrl_' . $field . '_' . $count . '" class="tl_text" value="' . specialchars($meta[$field]) . '"><br>';
               }
               $return .= '
   </li>';
               $taken[] = $lang;
               ++$count;
           }
           $return .= '
 </ul>';
       }
       $options = array('<option value="">-</option>');
       // Add the remaining languages
       foreach ($languages as $k => $v) {
           $options[] = '<option value="' . $k . '"' . (in_array($k, $taken) ? ' disabled' : '') . '>' . $v . '</option>';
       }
       $return .= '
 <div class="tl_metawizard_new">
   <select name="' . $this->strId . '[language]" class="tl_select tl_chosen" onchange="Backend.toggleAddLanguageButton(this)">' . implode('', $options) . '</select> <input type="button" class="tl_submit" disabled value="' . specialchars($GLOBALS['TL_LANG']['MSC']['aw_new']) . '" onclick="Backend.metaWizard(this,\'ctrl_' . $this->strId . '\')">
 </div>';
       return $return;
   }
 public function checkLinkButton($row, $href, $label, $title, $icon, $attributes)
 {
     $return = '';
     $objData = \Database::getInstance()->prepare('SELECT SUM(be_warning) as be_warning, SUM(be_error) as be_error FROM tl_link_data WHERE pid = ?')->execute($row['id']);
     if ($objData->be_warning > 0) {
         $warning = ' <span class="linkliste_orange" title="Warning">&nbsp;' . $objData->be_warning . '&nbsp;</span>';
     }
     if ($objData->be_error > 0) {
         $error = ' <span class="linkliste_red" title="Error">&nbsp;' . $objData->be_error . '&nbsp;</span>';
     }
     $image = 'system/modules/delirius_linkliste/html/check.png';
     $return .= '<a class="be_button" href="/contao/main.php?do=delirius_linkliste&amp;table=tl_link_data&amp;id=' . $row['id'] . '&key=checklink' . '" title="' . $GLOBALS['TL_LANG']['MSC']['checklinkscategorie'] . '"' . $attributes . '>' . $warning . $error . '&nbsp;' . Image::getHtml($image) . '</a>&nbsp;&nbsp;';
     return $return;
 }
 /**
  * Return the "toggle visibility" button
  * @param array
  * @param string
  * @param string
  * @param string
  * @param string
  * @param string
  * @return string
  */
 public function toggleIcon($row, $href, $label, $title, $icon, $attributes)
 {
     if (strlen(Input::get('tid'))) {
         $this->toggleVisibility(Input::get('tid'), Input::get('state') == 1, @func_get_arg(12) ?: null);
         $this->redirect($this->getReferer());
     }
     // Check permissions AFTER checking the tid, so hacking attempts are logged
     if (!$this->User->hasAccess('tl_product_price::published', 'alexf')) {
         return '';
     }
     $href .= '&amp;tid=' . $row['id'] . '&amp;state=' . ($row['published'] ? '' : 1);
     if (!$row['published']) {
         $icon = 'invisible.gif';
     }
     return '<a href="' . $this->addToUrl($href) . '" title="' . specialchars($title) . '"' . $attributes . '>' . Image::getHtml($icon, $label) . '</a> ';
 }
Example #29
0
 /**
  * Generate the module
  */
 protected function parseLink($objLink, $strClass = '', $intCount = 0)
 {
     $objTemplate = new \FrontendTemplate($this->links_template);
     $objTemplate->setData($objLink->row());
     $strImage = '';
     $objImage = \FilesModel::findByPk($objLink->singleSRC);
     $size = deserialize($this->imgSize);
     // Add image
     if ($objImage !== null) {
         $strImage = \Image::getHtml(\Image::get($objImage->path, $size[0], $size[1], $size[2]));
     }
     $objTemplate->class = $strClass;
     $objTemplate->linkTitle = $objLink->linkTitle ? $objLink->linkTitle : $objLink->title;
     $objTemplate->image = $strImage;
     return $objTemplate->parse();
 }
Example #30
0
 public function compressImage($row, $href, $label, $title, $icon, $attributes)
 {
     if (!$this->User->hasAccess('f5', 'fop')) {
         return '';
     }
     $strDecoded = rawurldecode($row['id']);
     if (is_dir(TL_ROOT . '/' . $strDecoded)) {
         return '';
     }
     $objFile = new File($strDecoded, true);
     $compressableFiles = array('jpg', 'jpeg', 'png');
     if (!in_array($objFile->extension, $compressableFiles)) {
         return '';
     }
     return '<a href="' . $this->addToUrl($href . '&amp;id=' . $row['id']) . '" title="' . specialchars($title) . '"' . $attributes . '>' . Image::getHtml($icon, $label) . '</a> ';
 }