Ejemplo n.º 1
0
 /**
  * Disable/enable a user group
  *
  * @param integer       $intId
  * @param boolean       $blnVisible
  * @param DataContainer $dc
  */
 public function toggleVisibility($intId, $blnVisible, DataContainer $dc = null)
 {
     // Set the ID and action
     Input::setGet('id', $intId);
     Input::setGet('act', 'toggle');
     if ($dc) {
         $dc->id = $intId;
         // see #8043
     }
     // Check the field access
     if (!$this->User->hasAccess('tl_member_group::disable', 'alexf')) {
         $this->log('Not enough permissions to activate/deactivate member group ID "' . $intId . '"', __METHOD__, TL_ERROR);
         $this->redirect('contao/main.php?act=error');
     }
     $objVersions = new Versions('tl_member_group', $intId);
     $objVersions->initialize();
     // Trigger the save_callback
     if (is_array($GLOBALS['TL_DCA']['tl_member_group']['fields']['disable']['save_callback'])) {
         foreach ($GLOBALS['TL_DCA']['tl_member_group']['fields']['disable']['save_callback'] as $callback) {
             if (is_array($callback)) {
                 $this->import($callback[0]);
                 $blnVisible = $this->{$callback[0]}->{$callback[1]}($blnVisible, $dc ?: $this);
             } elseif (is_callable($callback)) {
                 $blnVisible = $callback($blnVisible, $dc ?: $this);
             }
         }
     }
     // Update the database
     $this->Database->prepare("UPDATE tl_member_group SET tstamp=" . time() . ", disable='" . ($blnVisible ? '' : 1) . "' WHERE id=?")->execute($intId);
     $objVersions->create();
 }
 /**
  * Display a wildcard in the back end
  *
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         /** @var \BackendTemplate|object $objTemplate */
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['newsreader'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
         return $objTemplate->parse();
     }
     // Set the item from the auto_item parameter
     if (!isset($_GET['items']) && \Config::get('useAutoItem') && isset($_GET['auto_item'])) {
         \Input::setGet('items', \Input::get('auto_item'));
     }
     // Do not index or cache the page if no news item has been specified
     if (!\Input::get('items')) {
         /** @var \PageModel $objPage */
         global $objPage;
         $objPage->noSearch = 1;
         $objPage->cache = 0;
         return '';
     }
     $this->news_archives = $this->sortOutProtected(deserialize($this->news_archives));
     // Do not index or cache the page if there are no archives
     if (!is_array($this->news_archives) || empty($this->news_archives)) {
         /** @var \PageModel $objPage */
         global $objPage;
         $objPage->noSearch = 1;
         $objPage->cache = 0;
         return '';
     }
     return parent::generate();
 }
 /**
  * @return string
  */
 public function generate()
 {
     // Backend
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['member_rating'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
         return $objTemplate->parse();
     }
     // Set the item from the auto_item parameter
     if ($GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) {
         \Input::setGet('member', \Input::get('auto_item'));
     }
     // activate comment by token via url
     if (strlen(\Input::get('activation_token'))) {
         $this->activateOrDelete();
         exit;
     }
     // set the ratedUser var
     $this->ratedUser = \MemberModel::findByPk(\Input::get('member'));
     if ($this->ratedUser === null) {
         return '';
     }
     // overwrite default template
     if ($this->memberRatingDetailTemplate != '') {
         $this->strTemplate = $this->memberRatingDetailTemplate;
     }
     return parent::generate();
 }
Ejemplo n.º 4
0
 /**
  * @param $arrFragments
  * @return array
  */
 public function getPageIdFromUrlStr($arrFragments)
 {
     if (count($arrFragments) > 0 && !\Config::get('taxonomyDisable')) {
         $setTaxonomy = false;
         $arrFolderUrlFragments = array();
         $arrTempFragments = $arrFragments;
         if (\Config::get('folderUrl') && isset($arrFragments[0]) && !in_array('auto_item', $arrFragments)) {
             $arrFolderUrlFragments = explode('/', $arrFragments[0]);
         }
         $arrTempFragments = count($arrFolderUrlFragments) > 1 ? $arrFolderUrlFragments : $arrTempFragments;
         $setAutoItems = $this->setParameter($arrTempFragments);
         $arrCustomizedFragments = array();
         if ($setAutoItems['specie'] || $setAutoItems['auto_item']) {
             $rootTaxonomy = $this->Database->prepare('SELECT id FROM tl_taxonomies WHERE (alias = ? OR alias = ?) AND published = "1"')->limit(1)->execute($setAutoItems['specie'], $setAutoItems['auto_item']);
             if ($rootTaxonomy->numRows) {
                 $setTaxonomy = true;
             }
         }
         if ($setTaxonomy) {
             $arrCustomizedFragments[] = $arrFragments[0];
             foreach ($setAutoItems as $param => $value) {
                 if ($param === 'auto_item') {
                     $arrCustomizedFragments[] = $param;
                     $arrCustomizedFragments[] = $value;
                     continue;
                 }
                 \Input::setGet($param, $value);
             }
             // overwrite fragments
             $arrFragments = $arrCustomizedFragments;
         }
     }
     return array_unique($arrFragments);
 }
Ejemplo n.º 5
0
 /**
  * Display a wildcard in the back end
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### FAQ READER ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
         return $objTemplate->parse();
     }
     // Set the item from the auto_item parameter
     if ($GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) {
         \Input::setGet('items', \Input::get('auto_item'));
     }
     // Do not index or cache the page if no FAQ has been specified
     if (!\Input::get('items')) {
         global $objPage;
         $objPage->noSearch = 1;
         $objPage->cache = 0;
         return '';
     }
     $this->faq_categories = deserialize($this->faq_categories);
     // Do not index or cache the page if there are no categories
     if (!is_array($this->faq_categories) || empty($this->faq_categories)) {
         global $objPage;
         $objPage->noSearch = 1;
         $objPage->cache = 0;
         return '';
     }
     return parent::generate();
 }
 /**
  * Generate the module
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['mod_airquality_full'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
         return $objTemplate->parse();
     }
     // Set the item from the auto_item parameter
     if (!isset($_GET['items']) && $GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) {
         \Input::setGet('items', \Input::get('auto_item'));
     }
     // Return if there are no items
     if (!\Input::get('items')) {
         return '';
     }
     if (TL_MODE == 'FE') {
         $GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/airquality/assets/js/Chart.min.js|static';
         $GLOBALS['TL_CSS'][] = 'system/modules/airquality/assets/styles/style.css';
     }
     return parent::generate();
 }
 /**
  * Disable/enable
  *
  * @param integer       $intId
  * @param boolean       $blnVisible
  * @param DataContainer $dc
  */
 public function toggleVisibility($intId, $blnVisible, DataContainer $dc = null)
 {
     // Set the ID and action
     Input::setGet('id', $intId);
     Input::setGet('act', 'toggle');
     if ($dc) {
         $dc->id = $intId;
         // see #8043
     }
     // Check the field access
     if (!$this->User->hasAccess('tl_articlefilter_groups::published', 'alexf')) {
         $this->log('Not enough permissions to publish/unpublish articlefilter group ID "' . $intId . '"', __METHOD__, TL_ERROR);
         $this->redirect('contao/main.php?act=error');
     }
     // Trigger the save_callback
     if (is_array($GLOBALS['TL_DCA']['tl_articlefilter_groups']['fields']['published']['save_callback'])) {
         foreach ($GLOBALS['TL_DCA']['tl_articlefilter_groups']['fields']['published']['save_callback'] as $callback) {
             if (is_array($callback)) {
                 $this->import($callback[0]);
                 $blnVisible = $this->{$callback[0]}->{$callback[1]}($blnVisible, $dc ?: $this);
             } elseif (is_callable($callback)) {
                 $blnVisible = $callback($blnVisible, $dc ?: $this);
             }
         }
     }
     $time = time();
     // Update the database
     $this->Database->prepare("UPDATE tl_articlefilter_groups SET tstamp={$time}, published='" . ($blnVisible ? 1 : '') . "' WHERE id=?")->execute($intId);
 }
Ejemplo n.º 8
0
 /**
  * Disable/enable a user group
  * @param integer
  * @param boolean
  * @param \DataContainer
  */
 public function toggleVisibility($intId, $blnVisible, DataContainer $dc = null)
 {
     // Check permissions to edit
     Input::setGet('id', $intId);
     Input::setGet('act', 'toggle');
     $this->checkPermission();
     // Check permissions to publish
     if (!$this->User->hasAccess('tl_product_price::published', 'alexf')) {
         $this->log('Not enough permissions to publish/unpublish price item ID "' . $intId . '"', __METHOD__, TL_ERROR);
         $this->redirect('contao/main.php?act=error');
     }
     $objVersions = new Versions('tl_product_price', $intId);
     $objVersions->initialize();
     // Trigger the save_callback
     if (is_array($GLOBALS['TL_DCA']['tl_product_price']['fields']['published']['save_callback'])) {
         foreach ($GLOBALS['TL_DCA']['tl_product_price']['fields']['published']['save_callback'] as $callback) {
             if (is_array($callback)) {
                 $this->import($callback[0]);
                 $blnVisible = $this->{$callback}[0]->{$callback}[1]($blnVisible, $dc ?: $this);
             } elseif (is_callable($callback)) {
                 $blnVisible = $callback($blnVisible, $dc ?: $this);
             }
         }
     }
     // Update the database
     $this->Database->prepare("UPDATE tl_product_price SET tstamp=" . time() . ", published='" . ($blnVisible ? 1 : '') . "' WHERE id=?")->execute($intId);
     $objVersions->create();
     $this->log('A new version of record "tl_product_price.id=' . $intId . '" has been created' . $this->getParentEntries('tl_product_price', $intId), __METHOD__, TL_GENERAL);
 }
 /**
  * Generate the list in related categories mode
  *
  * Use the categories of the current news item. The module must be
  * on the same page as news reader module.
  *
  * @return string
  */
 protected function generateRelated()
 {
     // Set the item from the auto_item parameter
     if (!isset($_GET['items']) && $GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) {
         \Input::setGet('items', \Input::get('auto_item'));
     }
     // Return if there is no item specified
     if (!\Input::get('items')) {
         return '';
     }
     $this->news_archives = $this->sortOutProtected(deserialize($this->news_archives));
     // Return if there are no archives
     if (!is_array($this->news_archives) || empty($this->news_archives)) {
         return '';
     }
     $news = \NewsModel::findPublishedByParentAndIdOrAlias(\Input::get('items'), $this->news_archives);
     // Return if the news item was not found
     if ($news === null) {
         return '';
     }
     $GLOBALS['NEWS_FILTER_CATEGORIES'] = false;
     $GLOBALS['NEWS_FILTER_DEFAULT'] = deserialize($news->categories, true);
     $GLOBALS['NEWS_FILTER_EXCLUDE'] = array($news->id);
     return parent::generate();
 }
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['memberreader'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
         return $objTemplate->parse();
     }
     // logic for this is done in HeimrichHannot\Memberplus\Hooks::getPageIdFromUrlHook
     if (\Input::get('article_reader')) {
         \Input::setGet('items', \Input::get('article_reader'));
     } else {
         if (!isset($_GET['items']) && \Config::get('useAutoItem') && isset($_GET['auto_item'])) {
             \Input::setGet('items', \Input::get('auto_item'));
         }
     }
     if (!\Input::get('items')) {
         return '';
     }
     $this->mlGroups = deserialize($this->mlGroups);
     if (!is_array($this->mlGroups) || empty($this->mlGroups)) {
         return '';
     }
     return parent::generate();
 }
 /**
  * Display a wildcard in the back end
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['newslist_plus'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
         return $objTemplate->parse();
     }
     $this->news_archives = $this->sortOutProtected(deserialize($this->news_archives));
     // Return if there are no archives
     if (!is_array($this->news_archives) || empty($this->news_archives)) {
         return '';
     }
     $this->news_featured = 'featured';
     // unset search string for highlighted section
     \Input::setGet('searchKeywords', null);
     $this->objArticles = NewsPlusModel::findPublishedByPids($this->news_archives, array(), array(), $this->news_featured == 'featured', $this->numberOfItems, 0);
     if ($this->objArticles === null) {
         return '';
     }
     return parent::generate();
 }
 /**
  * Display a wildcard in the back end
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### Filial-REGION-SUCHE ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
         return $objTemplate->parse();
     }
     // Ajax Requests abfangen
     if (\Input::get('id') && $this->Environment->get('isAjaxRequest')) {
         $this->generateAjax();
         exit;
     }
     // template overwrite
     if (strlen($this->mod_bm_template)) {
         $this->strTemplate = $this->mod_bm_template;
     }
     // Set the item from the auto_item parameter
     if (!isset($_GET['s']) && $GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) {
         \Input::setGet('s', \Input::get('auto_item'));
     }
     return parent::generate();
 }
Ejemplo n.º 13
0
 /**
  * Disable/enable a user group
  *
  * @param integer       $intId
  * @param boolean       $blnVisible
  * @param DataContainer $dc
  *
  * @throws Contao\CoreBundle\Exception\AccessDeniedException
  */
 public function toggleVisibility($intId, $blnVisible, DataContainer $dc = null)
 {
     // Set the ID and action
     Input::setGet('id', $intId);
     Input::setGet('act', 'toggle');
     if ($dc) {
         $dc->id = $intId;
         // see #8043
     }
     // Check the field access
     if (!$this->User->hasAccess('tl_member_group::disable', 'alexf')) {
         throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to activate/deactivate member group ID ' . $intId . '.');
     }
     $objVersions = new Versions('tl_member_group', $intId);
     $objVersions->initialize();
     // Trigger the save_callback
     if (is_array($GLOBALS['TL_DCA']['tl_member_group']['fields']['disable']['save_callback'])) {
         foreach ($GLOBALS['TL_DCA']['tl_member_group']['fields']['disable']['save_callback'] as $callback) {
             if (is_array($callback)) {
                 $this->import($callback[0]);
                 $blnVisible = $this->{$callback[0]}->{$callback[1]}($blnVisible, $dc ?: $this);
             } elseif (is_callable($callback)) {
                 $blnVisible = $callback($blnVisible, $dc ?: $this);
             }
         }
     }
     // Update the database
     $this->Database->prepare("UPDATE tl_member_group SET tstamp=" . time() . ", disable='" . ($blnVisible ? '' : 1) . "' WHERE id=?")->execute($intId);
     $objVersions->create();
     $this->log('A new version of record "tl_member_group.id=' . $intId . '" has been created' . $this->getParentEntries('tl_member_group', $intId), __METHOD__, TL_GENERAL);
 }
Ejemplo n.º 14
0
 public function __construct()
 {
     // Set the item from the auto_item parameter
     if (!isset($_GET['store']) && $GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) {
         \Input::setGet('store', \Input::get('auto_item'));
     }
     parent::__construct();
 }
Ejemplo n.º 15
0
 public function searchGlossarTerms($strContent, $strTemplate)
 {
     global $objPage;
     if (!isset($_GET['items']) && $GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) {
         \Input::setGet('items', \Input::get('auto_item'));
     }
     $arrGlossar = array($objPage->glossar);
     if ($objPage->disableGlossar == 1) {
         return $strContent;
     }
     // HOOK: search for terms in Events, faq and news
     $arrGlossar = array($objPage->glossar);
     if (isset($GLOBALS['TL_HOOKS']['glossarContent']) && is_array($GLOBALS['TL_HOOKS']['glossarContent'])) {
         foreach ($GLOBALS['TL_HOOKS']['glossarContent'] as $type => $callback) {
             $this->import($callback[0]);
             $cb_output = $this->{$callback}[0]->{$callback}[1](\Input::get('items'), $strContent, $template, $objPage->language);
             if (!empty($cb_output)) {
                 $arrGlossar[] = $cb_output;
             }
         }
     }
     if (!empty($arrGlossar)) {
         $this->term = implode('|', $arrGlossar);
     }
     $this->term = str_replace('||', '|', $this->term);
     $Glossar = \GlossarModel::findByLanguage($objPage->language);
     if (empty($Glossar)) {
         $Glossar = \GlossarModel::findByFallback(1);
     }
     $arrGlossar = array();
     if (empty($Glossar)) {
         return $strContent;
     }
     while ($Glossar->next()) {
         $arrGlossar[] = $Glossar->id;
     }
     /* replace content with tags to stop glossary replacement */
     if (\Config::get('activateGlossarTags') == 1) {
         $GlossarTags = $this->replaceGlossarTags($strContent);
     }
     $Term = \SwGlossarModel::findBy(array("title IN ('" . str_replace('|', "','", $this->term) . "') AND pid IN ('" . implode("','", $arrGlossar) . "')"), array($Glossar->id), array('order' => ' CHAR_LENGTH(title) DESC'));
     $strContent = $this->replace($strContent, $Term, $Glossar);
     if (\Config::get('glossar_no_fallback') == 1 || $objPage->glossar_no_fallback == 1) {
         /* reinsert glossar hidden content */
         if (\Config::get('activateGlossarTags') == 1) {
             $strContent = $this->insertTagContent($strContent, $GlossarTags);
         }
         return $strContent;
     }
     /* Replace the fallback languages */
     $Term = \SwGlossarModel::findBy(array("title IN ('" . str_replace('|', "','", $objPage->fallback_glossar) . "')"), array(), array('order' => ' CHAR_LENGTH(title) DESC'));
     $strContent = $this->replace($strContent, $Term);
     /* reinsert glossar hidden content */
     if (\Config::get('activateGlossarTags') == 1) {
         $strContent = $this->insertTagContent($strContent, $GlossarTags);
     }
     return $strContent;
 }
Ejemplo n.º 16
0
 /**
  * Return if there are no files
  * @return string
  */
 public function generate()
 {
     if (!isset($_GET['items']) && $GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) {
         \Input::setGet('items', \Input::get('auto_item'));
     }
     if (!isset($_GET['alpha']) && $GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) {
         \Input::setGet('alpha', \Input::get('auto_item'));
     }
     return parent::generate();
 }
Ejemplo n.º 17
0
 /**
  * Generate the order details view when editing an order
  * @param   object
  * @param   string
  * @return  string
  */
 public function generateOrderDetails($dc)
 {
     $objOrder = \Database::getInstance()->execute("SELECT * FROM tl_iso_product_collection WHERE id=" . $dc->id);
     if (!$objOrder->numRows) {
         \Controller::redirect('contao/main.php?act=error');
     }
     $GLOBALS['TL_CSS'][] = \Haste\Util\Debug::uncompressedFile('system/modules/isotope/assets/css/print.min.css|print');
     // Generate a regular order details module
     \Input::setGet('uid', $objOrder->uniqid);
     $objModule = new \Isotope\Module\OrderDetails(\Database::getInstance()->execute("SELECT * FROM tl_module WHERE type='iso_orderdetails'"));
     return Haste::getInstance()->call('replaceInsertTags', $objModule->generate(true));
 }
Ejemplo n.º 18
0
 /**
  * Restore the GET and POST vars to Contao's Input class
  */
 public static function restore()
 {
     if (isset(static::$arrCache['getEncoded'])) {
         foreach (static::$arrCache['getEncoded'] as $strKey => $varValue) {
             \Input::setGet($strKey, $varValue);
         }
     }
     if (isset(static::$arrCache['postEncoded'])) {
         foreach (static::$arrCache['postEncoded'] as $strKey => $varValue) {
             \Input::setPost($strKey, $varValue);
         }
     }
 }
 /**
  * Get the submission relation entity from request
  * @param \ModuleModel $objModule
  * @param array                                       $arrRelation
  * @return \Model|null The related entity or null if none found.
  */
 public static function getRelationFromRequest(\ModuleModel $objModule, array $arrRelation)
 {
     $strParam = $arrRelation['request_parameter'] ?: $arrRelation['submissionField'];
     // Set the item from the auto_item parameter
     if (!isset($_GET[$strParam]) && \Config::get('useAutoItem') && isset($_GET['auto_item'])) {
         \Input::setGet($strParam, \Input::get('auto_item'));
     }
     if (!$strParam || !\Input::get($strParam)) {
         return;
     }
     $varId = \Input::get($strParam);
     return static::findRelatedEntity($varId, $arrRelation, $objModule);
 }
Ejemplo n.º 20
0
 /**
  * Disable/enable a user group
  * @param integer
  * @param boolean
  */
 public function toggleVisibility($intId, $blnVisible)
 {
     // Check permissions to edit
     Input::setGet('id', $intId);
     Input::setGet('act', 'toggle');
     // Trigger the save_callback
     if (is_array($GLOBALS['TL_DCA']['tl_page']['fields']['published']['save_callback'])) {
         foreach ($GLOBALS['TL_DCA']['tl_page']['fields']['published']['save_callback'] as $callback) {
             $this->import($callback[0]);
             $blnVisible = $this->{$callback}[0]->{$callback}[1]($blnVisible, $this);
         }
     }
     // Update the database
     $this->Database->prepare("UPDATE tl_link_data SET published='" . ($blnVisible ? 1 : '') . "' WHERE id=?")->execute($intId);
 }
Ejemplo n.º 21
0
 /**
  * Return if there are no files
  * @return string
  */
 public function generate()
 {
     global $objPage;
     $pageGlossar = explode('|', $objPage->glossar);
     $Page = \PageModel::findBy(array("glossar LIKE '%|" . implode("|%' OR glossar LIKE '%|", $pageGlossar) . "|%'"), array());
     if (empty($Page)) {
         return;
     }
     $countTerms = array();
     $arrPages = array();
     while ($Page->next()) {
         $ap = array('id' => $Page->id, 'weight' => 0, 'title' => $Page->title, 'description' => $Page->description, 'glossar' => explode('|', $Page->glossar), 'fallback_glossar' => explode('|', $Page->fallback_glossar), 'url' => $this->generateFrontendUrl($Page->row()));
         foreach ($ap['glossar'] as $term) {
             if ($term != '') {
                 $countTerms[$term] = !empty($term) ? $countTerms[$term] + 1 : 1;
             }
         }
         if ($ap['id'] != $objPage->id) {
             $arrPages[] = $ap;
         }
     }
     asort($countTerms);
     $this->countTerms = $countTerms;
     $max = 0;
     foreach ($arrPages as &$p_page) {
         foreach ($countTerms as $term => $count) {
             if (in_array($term, $p_page['glossar'])) {
                 $p_page['weight']++;
             }
         }
         if ($p_page['weight'] > $max) {
             $max = $p_page['weight'];
         }
     }
     $this->max = $max;
     foreach ($arrPages as &$p_page) {
         $x = $p_page['weight'] / $max;
         $p_page['weight'] = 1 + $x;
     }
     $this->pages = $arrPages;
     if (!isset($_GET['items']) && $GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) {
         \Input::setGet('items', \Input::get('auto_item'));
     }
     if (!isset($_GET['alpha']) && $GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) {
         \Input::setGet('alpha', \Input::get('auto_item'));
     }
     return parent::generate();
 }
Ejemplo n.º 22
0
 public function getPageIdFromUrlHook($arrFragments)
 {
     // source = article_reader -> unset unused GET parameters and store them in custom Get Variable, for ModuleMemberReader
     if ($arrFragments[1] == 'auto_item' && $arrFragments[2] == 'articles') {
         // article alias = 3rd & member alias = 4th item
         if (isset($arrFragments[3]) && isset($arrFragments[4])) {
             unset($arrFragments[1]);
             // unset auto_item
             \Input::setGet('article_reader', $arrFragments[4]);
             unset($arrFragments[4]);
             // unset member alias
         }
     }
     // restore array index order
     return array_values($arrFragments);
 }
Ejemplo n.º 23
0
 /**
  * Set the template
  * @return string
  */
 public function generate()
 {
     // set the item from the auto_item parameter
     if ($GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) {
         \Input::setGet('items', \Input::get('auto_item'));
     }
     if (\Input::get('items')) {
         // get the content element id from the $_GET - variable if multiple gallery_creator content elements are embeded on the current page
         $this->ContentElementId = $this->countGcContentElementsOnPage() > 1 ? \Input::get('ce') : $this->id;
         // only display the detail view of the selected album if multiple gallery_creator content elements are embeded on the current page
         if ($this->id != $this->ContentElementId && $this->countGcContentElementsOnPage() > 1) {
             return '';
         }
     }
     return parent::generate();
 }
 /**
  * Display a wildcard in the back end
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### Filial-SUCH-LISTE ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
         return $objTemplate->parse();
     }
     // Set the item from the auto_item parameter
     if (!isset($_GET['s']) && $GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) {
         \Input::setGet('s', \Input::get('auto_item'));
     }
     return parent::generate();
 }
Ejemplo n.º 25
0
 /**
  * Generate the order details view when editing an order
  *
  * @param object $dc
  *
  * @return string
  */
 public function generateOrderDetails($dc)
 {
     $objOrder = Order::findByPk($dc->id);
     if ($objOrder === null) {
         return '';
     }
     $GLOBALS['TL_CSS'][] = Debug::uncompressedFile('system/modules/isotope/assets/css/print.min.css|print');
     // Try to find a order details module or create a dummy FE module model
     if (($objModuleModel = \ModuleModel::findOneBy('type', 'iso_orderdetails')) === null) {
         $objModuleModel = new \ModuleModel();
         $objModuleModel->type = 'iso_orderdetails';
         $objModuleModel->iso_collectionTpl = 'iso_collection_default';
     }
     // Generate a regular order details module
     \Input::setGet('uid', $objOrder->uniqid);
     $objModule = new OrderDetails($objModuleModel);
     return Haste::getInstance()->call('replaceInsertTags', $objModule->generate(true));
 }
 /**
  * Display a wildcard in the back end
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['photogallery_detail'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
         return $objTemplate->parse();
     }
     // Set the item from the auto_item parameter
     if (!isset($_GET['items']) && $GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) {
         \Input::setGet('items', \Input::get('auto_item'));
     }
     $this->photogalleries = $this->sortOutProtected(deserialize($this->photogalleries));
     return parent::generate();
 }
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### FORMHYBRID READER ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
         return $objTemplate->parse();
     }
     \DataContainer::loadDataContainer($this->formHybridDataContainer);
     \System::loadLanguageFile($this->formHybridDataContainer);
     $this->strWrapperId .= $this->id;
     $this->dca = $GLOBALS['TL_DCA'][$this->formHybridDataContainer];
     // Set the item from the auto_item parameter
     if (!isset($_GET['items']) && \Config::get('useAutoItem') && isset($_GET['auto_item'])) {
         \Input::setGet('items', \Input::get('auto_item'));
     }
     $this->intId = $this->intId ?: (\Input::get('items') ?: \Input::get('id'));
     if ($this->addExistanceConditions) {
         $arrConditions = deserialize($this->existanceConditions, true);
         $strItemClass = \Model::getClassFromTable($this->formHybridDataContainer);
         if (!empty($arrConditions)) {
             $arrColumns = array();
             $arrValues = array();
             foreach ($arrConditions as $arrCondition) {
                 $arrColumns[] = $arrCondition['field'] . '=?';
                 $arrValues[] = $this->replaceInsertTags($arrCondition['value']);
             }
             if (($objItem = $strItemClass::findOneBy($arrColumns, $arrValues)) !== null) {
                 $this->intId = $objItem->id;
             }
         }
     }
     // Do not index or cache the page if no item has been specified
     if (!$this->intId) {
         /** @var \PageModel $objPage */
         global $objPage;
         $objPage->noSearch = 1;
         $objPage->cache = 0;
     }
     return parent::generate();
 }
Ejemplo n.º 28
0
 /**
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . $this->name . ' ###';
         $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
         return $objTemplate->parse();
     }
     $this->import('FrontendUser', 'User');
     if (!isset($_GET['auto_item']) && \Config::get('useAutoItem') && isset($_GET['auto_item'])) {
         \Input::setGet('auto_item', \Input::get('auto_item'));
     }
     if ($this->f_doNotSet_404 == '1' && !\Input::get('auto_item')) {
         global $objPage;
         $objPage->noSearch = 1;
         $objPage->cache = 0;
         return '';
     }
     return parent::generate();
 }
 /**
  * Display a wildcard in the back end
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### EVENT SUBSCRIBE FORM ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
         return $objTemplate->parse();
     }
     // Set the item from the auto_item parameter
     if ($GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) {
         \Input::setGet('events', \Input::get('auto_item'));
     }
     // Return if there is no logged user or no event provided
     if (!\Input::get('events')) {
         return '';
     }
     return parent::generate();
 }
 /**
  * Display a wildcard in the back end
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['member_reader'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
         return $objTemplate->parse();
     }
     // Set the item from the auto_item parameter
     if (!isset($_GET['items']) && $GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) {
         \Input::setGet('items', \Input::get('auto_item'));
     }
     // Return if there are no items
     if (!\Input::get('items')) {
         return '';
     }
     return parent::generate();
 }