当前位置: 首页>>代码示例>>PHP>>正文


PHP ContentModel::findPublishedByPidAndTable方法代码示例

本文整理汇总了PHP中ContentModel::findPublishedByPidAndTable方法的典型用法代码示例。如果您正苦于以下问题:PHP ContentModel::findPublishedByPidAndTable方法的具体用法?PHP ContentModel::findPublishedByPidAndTable怎么用?PHP ContentModel::findPublishedByPidAndTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ContentModel的用法示例。


在下文中一共展示了ContentModel::findPublishedByPidAndTable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: compile

 protected function compile()
 {
     global $objPage;
     $arrElements = array();
     $objCte = \ContentModel::findPublishedByPidAndTable($objPage->id, 'tl_page');
     if ($objCte !== null) {
         $intCount = 0;
         $intLast = $objCte->count() - 1;
         while ($objCte->next()) {
             $arrCss = array();
             /** @var \ContentModel $objRow */
             $objRow = $objCte->current();
             // Add the "first" and "last" classes (see #2583)
             if ($intCount == 0 || $intCount == $intLast) {
                 if ($intCount == 0) {
                     $arrCss[] = 'first';
                 }
                 if ($intCount == $intLast) {
                     $arrCss[] = 'last';
                 }
             }
             $objRow->classes = $arrCss;
             $arrElements[] = $this->getContentElement($objRow, $this->strColumn);
             ++$intCount;
         }
     }
     $this->Template->elements = $arrElements;
     // HOOK: add custom logic
     if (isset($GLOBALS['TL_HOOKS']['compileArticle']) && is_array($GLOBALS['TL_HOOKS']['compileArticle'])) {
         foreach ($GLOBALS['TL_HOOKS']['compileArticle'] as $callback) {
             $this->import($callback[0]);
             $this->{$callback}[0]->{$callback}[1]($this->Template, $this->arrData, $this);
         }
     }
 }
开发者ID:alarstyle,项目名称:contao-no_more_articles,代码行数:35,代码来源:ModuleArticle.php

示例2: compile

 protected function compile()
 {
     if ($this->objConfig->header) {
         $this->Template->showHeader = true;
     }
     $id = $this->id;
     $this->Template->body = function () use($id) {
         $strText = '';
         $objElement = \ContentModel::findPublishedByPidAndTable($id, 'tl_modal');
         if ($objElement !== null) {
             while ($objElement->next()) {
                 $strContent = $this->getContentElement($objElement->current());
                 // HOOK: add custom logic
                 if (isset($GLOBALS['TL_HOOKS']['getModalContentElement']) && is_array($GLOBALS['TL_HOOKS']['getModalContentElement'])) {
                     foreach ($GLOBALS['TL_HOOKS']['getModalContentElement'] as $callback) {
                         $strContent = static::importStatic($callback[0])->{$callback[1]}($objElement->current(), $strContent, $this->Template, $this->objModel, $this->objConfig, $this);
                     }
                 }
                 $strText .= $strContent;
             }
         }
         return $strText;
     };
     $this->Template->hasBody = \ContentModel::countPublishedByPidAndTable($this->id, 'tl_modal') > 0;
     if ($this->objConfig->footer && $this->addFooter) {
         $this->Template->showFooter = true;
     }
 }
开发者ID:heimrichhannot,项目名称:contao-modal,代码行数:28,代码来源:Modal.php

示例3: getPlaceholder

 public static function getPlaceholder($placeholder)
 {
     $object = new self();
     $strContent = "";
     $addStmt = "";
     $db = \Database::getInstance();
     $placeholderId = is_numeric($placeholder) ? $placeholder : 0;
     $placeholderAlias = is_string($placeholder) ? $placeholder : 0;
     if (!BE_USER_LOGGED_IN) {
         $time = time();
         $addStmt = " AND (start='' OR start<{$time}) AND (stop='' OR stop>{$time}) AND published=1";
     }
     // TODO: make a Placeholder Model!!
     $objPlaceholder = $db->prepare("SELECT * FROM tl_dps_placeholder WHERE (id=? OR alias=?)" . $addStmt)->limit(1)->execute($placeholderId, $placeholderAlias);
     if ($objPlaceholder->numRows > 0) {
         $objPlaceholder = $objPlaceholder->first();
         $id = $objPlaceholder->id;
         $objContent = \ContentModel::findPublishedByPidAndTable($id, "tl_dps_placeholder");
         if ($objContent && $objContent->count() > 0) {
             while ($objContent->next()) {
                 $strContent .= $object->replaceInsertTags($object->getContentElement($objContent->id));
             }
         }
     }
     return $strContent;
 }
开发者ID:pressi,项目名称:zdps_customize,代码行数:26,代码来源:Placeholder.php

示例4: compile

 /**
  * Generate module
  */
 protected function compile()
 {
     // Get ID
     $strAlias = \Input::get('auto_item') ? \Input::get('auto_item') : \Input::get('store');
     // Find published store from ID
     if (($objStore = AnyStoresModel::findPublishedByIdOrAlias($strAlias)) !== null) {
         // load all details
         $objStore->loadDetails();
         // generate description
         $objDescription = \ContentModel::findPublishedByPidAndTable($objStore->id, $objStore->getTable());
         if ($objDescription !== null) {
             while ($objDescription->next()) {
                 $objStore->description .= \Controller::getContentElement($objDescription->current());
             }
         }
         // Get referer for back button
         $objStore->referer = $this->getReferer();
         // generate google map if template and geodata is set
         if ($this->anystores_mapTpl != '' && is_numeric($objStore->latitude) && is_numeric($objStore->longitude)) {
             $objMapTemplate = new \FrontendTemplate($this->anystores_mapTpl);
             $objMapTemplate->setData($objStore->row());
             $objStore->gMap = $objMapTemplate->parse();
         }
         // Template
         $objDetailTemplate = new \FrontendTemplate($this->anystores_detailTpl);
         $objDetailTemplate->setData($objStore->row());
         $this->Template->store = $objDetailTemplate->parse();
     } else {
         $this->_redirect404();
     }
 }
开发者ID:stefansl,项目名称:anyStores,代码行数:34,代码来源:ModuleAnyStoresDetails.php

示例5: listNewsletterArticles

    /**
     * Add the type of input field
     * @param array
     * @return string
     */
    public function listNewsletterArticles($arrRow)
    {
        $strStats = '';
        $strContents = '';
        $objContents = \ContentModel::findPublishedByPidAndTable($arrRow['id'], 'tl_newsletter');
        if (!is_null($objContents)) {
            foreach ($objContents as $objContent) {
                $strContents .= $this->getContentElement($objContent->id) . '<hr>';
            }
        }
        $intTotal = $arrRow['recipients'] + $arrRow['rejected'];
        //		$intTracked = NewsletterContent\Models\NewsletterTrackingModel::countTrackedByPid($arrRow['id']);
        $objTracked = NewsletterContent\Models\NewsletterTrackingModel::findTrackedInteractionsByPid($arrRow['id']);
        $intTracked = !is_null($objTracked) ? $objTracked->count() : 0;
        $intPercent = @round($intTracked / $intTotal * 100);
        $strStats = sprintf($GLOBALS['TL_LANG']['tl_newsletter']['sentTo'], $arrRow['recipients'], strval($intTotal), strval($intTracked), strval($intPercent));
        return '
<div class="cte_type ' . ($arrRow['sent'] && $arrRow['date'] ? 'published' : 'unpublished') . '"><strong>' . $arrRow['subject'] . '</strong> - ' . ($arrRow['sent'] && $arrRow['date'] ? sprintf($GLOBALS['TL_LANG']['tl_newsletter']['sentOn'], Date::parse($GLOBALS['TL_CONFIG']['datimFormat'], $arrRow['date'])) . '<br>' . $strStats : $GLOBALS['TL_LANG']['tl_newsletter']['notSent']) . '</div>
<div class="limit_height' . (!$GLOBALS['TL_CONFIG']['doNotCollapse'] ? ' h128' : '') . '">
' . (!$arrRow['sendText'] && strlen($strContents) ? '
' . $strContents : '') . '
' . nl2br_html5($arrRow['text']) . '
</div>' . "\n";
        return '<div class="tl_content_left">' . $arrRow['subject'] . ' <span style="color:#b3b3b3;padding-left:3px">[' . $arrRow['senderName'] . ' &lt;' . $arrRow['sender'] . '&gt;]</span></div>';
    }
开发者ID:davidenke,项目名称:newsletter_content,代码行数:30,代码来源:tl_newsletter.php

示例6: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     global $objPage;
     $this->Template->content = '';
     $this->Template->referer = 'javascript:history.go(-1)';
     $this->Template->back = $GLOBALS['TL_LANG']['MSC']['goBack'];
     if (TL_MODE == 'FE' && BE_USER_LOGGED_IN) {
         $objNewsletter = \NewsletterModel::findByIdOrAlias(\Input::get('items'));
     } else {
         $objNewsletter = \NewsletterModel::findSentByParentAndIdOrAlias(\Input::get('items'), $this->nl_channels);
     }
     if ($objNewsletter === null) {
         // Do not index or cache the page
         $objPage->noSearch = 1;
         $objPage->cache = 0;
         // Send a 404 header
         header('HTTP/1.1 404 Not Found');
         $this->Template->content = '<p class="error">' . sprintf($GLOBALS['TL_LANG']['MSC']['invalidPage'], \Input::get('items')) . '</p>';
         return;
     }
     // Overwrite the page title (see #2853 and #4955)
     if ($objNewsletter->subject != '') {
         $objPage->pageTitle = strip_tags(strip_insert_tags($objNewsletter->subject));
     }
     // Add enclosure
     if ($objNewsletter->addFile) {
         $this->addEnclosuresToTemplate($this->Template, $objNewsletter->row(), 'files');
     }
     if (!$objNewsletter->sendText) {
         $nl2br = $objPage->outputFormat == 'xhtml' ? 'nl2br_xhtml' : 'nl2br_html5';
         $strContent = '';
         $objContentElements = \ContentModel::findPublishedByPidAndTable($objNewsletter->id, 'tl_newsletter');
         if ($objContentElements !== null) {
             if (!defined('NEWSLETTER_CONTENT_PREVIEW')) {
                 define('NEWSLETTER_CONTENT_PREVIEW', true);
             }
             foreach ($objContentElements as $objContentElement) {
                 $strContent .= $this->getContentElement($objContentElement->id);
             }
         }
         // Parse simple tokens and insert tags
         $strContent = $this->replaceInsertTags($strContent);
         $strContent = \String::parseSimpleTokens($strContent, array());
         // Encode e-mail addresses
         $strContent = \String::encodeEmail($strContent);
         $this->Template->content = $strContent;
     } else {
         $strContent = str_ireplace(' align="center"', '', $objNewsletter->content);
     }
     // Convert relative URLs
     $strContent = $this->convertRelativeUrls($strContent);
     // Parse simple tokens and insert tags
     $strContent = $this->replaceInsertTags($strContent);
     $strContent = \String::parseSimpleTokens($strContent, array());
     // Encode e-mail addresses
     $strContent = \String::encodeEmail($strContent);
     $this->Template->content = $strContent;
     $this->Template->subject = $objNewsletter->subject;
 }
开发者ID:hojanssen,项目名称:newsletter_content,代码行数:62,代码来源:ModuleNewsletterReader.php

示例7: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     $this->Template->content = '';
     if (($objElement = \ContentModel::findPublishedByPidAndTable($this->User->id, 'tl_member')) !== null) {
         while ($objElement->next()) {
             $this->Template->content .= $this->getContentElement($objElement->id);
         }
     }
 }
开发者ID:codefog,项目名称:contao-member_content,代码行数:12,代码来源:ModuleMemberContent.php

示例8: getSearchablePages

 /**
  * Add product items to the indexer
  * @param array
  * @param integer
  * @param boolean
  * @return array
  */
 public function getSearchablePages($arrPages, $intRoot = 0, $blnIsSitemap = false)
 {
     $arrRoot = array();
     if ($intRoot > 0) {
         $arrRoot = $this->Database->getChildRecords($intRoot, 'tl_page');
     }
     $time = time();
     $arrProcessed = array();
     // Get all catalog categories
     $objCatalog = \ProductCatalogModel::findByProtected('');
     // Walk through each archive
     if ($objCatalog !== null) {
         while ($objCatalog->next()) {
             // Skip catalog categories without target page
             if (!$objCatalog->jumpTo) {
                 continue;
             }
             // Skip catalog categories outside the root nodes
             if (!empty($arrRoot) && !in_array($objCatalog->jumpTo, $arrRoot)) {
                 continue;
             }
             // Get the URL of the jumpTo page
             if (!isset($arrProcessed[$objCatalog->jumpTo])) {
                 $objParent = \PageModel::findWithDetails($objCatalog->jumpTo);
                 // The target page does not exist
                 if ($objParent === null) {
                     continue;
                 }
                 // The target page has not been published (see #5520)
                 if (!$objParent->published || $objParent->start != '' && $objParent->start > $time || $objParent->stop != '' && $objParent->stop < $time) {
                     continue;
                 }
                 // The target page is exempt from the sitemap (see #6418)
                 if ($blnIsSitemap && $objParent->sitemap == 'map_never') {
                     continue;
                 }
                 // Set the domain (see #6421)
                 $domain = ($objParent->rootUseSSL ? 'https://' : 'http://') . ($objParent->domain ?: \Environment::get('host')) . TL_PATH . '/';
                 // Generate the URL
                 $arrProcessed[$objCatalog->jumpTo] = $domain . $this->generateFrontendUrl($objParent->row(), \Config::get('useAutoItem') && !\Config::get('disableAlias') ? '/%s' : '/items/%s', $objParent->language);
             }
             $strUrl = $arrProcessed[$objCatalog->jumpTo];
             // Get the items
             $objProduct = \ProductModel::findPublishedByPid($objCatalog->id);
             if ($objProduct !== null) {
                 while ($objProduct->next()) {
                     $objElement = \ContentModel::findPublishedByPidAndTable($objProduct->id, 'tl_product');
                     if ($objElement !== null) {
                         $arrPages[] = $this->getLink($objProduct, $strUrl);
                     }
                 }
             }
         }
     }
     return $arrPages;
 }
开发者ID:respinar,项目名称:contao-product,代码行数:63,代码来源:Product.php

示例9: generateFields

 protected function generateFields($objItem)
 {
     $arrItem = parent::generateFields($objItem);
     global $objPage;
     $arrItem['fields']['newsHeadline'] = $objItem->headline;
     $arrItem['fields']['subHeadline'] = $objItem->subheadline;
     $arrItem['fields']['hasSubHeadline'] = $objItem->subheadline ? true : false;
     $arrItem['fields']['linkHeadline'] = ModuleNews::generateLink($this, $objItem->headline, $objItem, false);
     $arrItem['fields']['more'] = ModuleNews::generateLink($this, $GLOBALS['TL_LANG']['MSC']['more'], $objItem, false, true);
     $arrItem['fields']['link'] = ModuleNews::generateNewsUrl($this, $objItem, false);
     $arrItem['fields']['text'] = '';
     // Clean the RTE output
     if ($objItem->teaser != '') {
         if ($objPage->outputFormat == 'xhtml') {
             $arrItem['fields']['teaser'] = \StringUtil::toXhtml($objItem->teaser);
         } else {
             $arrItem['fields']['teaser'] = \StringUtil::toHtml5($objItem->teaser);
         }
         $arrItem['fields']['teaser'] = \StringUtil::encodeEmail($arrItem['fields']['teaser']);
     }
     // Display the "read more" button for external/article links
     if ($objItem->source != 'default') {
         $arrItem['fields']['text'] = true;
     } else {
         $objElement = \ContentModel::findPublishedByPidAndTable($objItem->id, 'tl_news');
         if ($objElement !== null) {
             while ($objElement->next()) {
                 $arrItem['fields']['text'] .= $this->getContentElement($objElement->current());
             }
         }
     }
     $arrMeta = ModuleNews::getMetaFields($this, $objItem);
     // Add the meta information
     $arrItem['fields']['date'] = $arrMeta['date'];
     $arrItem['fields']['hasMetaFields'] = !empty($arrMeta);
     $arrItem['fields']['numberOfComments'] = $arrMeta['ccount'];
     $arrItem['fields']['commentCount'] = $arrMeta['comments'];
     $arrItem['fields']['timestamp'] = $objItem->date;
     $arrItem['fields']['author'] = $arrMeta['author'];
     $arrItem['fields']['datetime'] = date('Y-m-d\\TH:i:sP', $objItem->date);
     $arrItem['fields']['addImage'] = false;
     // Add an image
     $this->addImage($objItem, 'singleSRC', $arrItem);
     // enclosures are added in runBeforeTemplateParsing
     return $arrItem;
 }
开发者ID:heimrichhannot,项目名称:contao-frontendedit,代码行数:46,代码来源:ModuleNewsList.php

示例10: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     // get content of article
     $objElements = \ContentModel::findPublishedByPidAndTable($this->dk_mmenuArticle, 'tl_article');
     if ($objElements !== null) {
         while ($objElements->next()) {
             $arrElements[] = $this->getContentElement($objElements->id);
         }
     }
     $this->Template->elements = $arrElements;
     // --- create FE template for javascript caller
     $objTemplateJs = new \FrontendTemplate($this->strTemplateJs);
     $objTemplateJs->id = $this->id;
     $objTemplateJs->cssIDonly = $this->cssID[0];
     $objMmenu = new Mmenu();
     $objMmenu->createTemplateData($this->Template, $objTemplateJs);
 }
开发者ID:dklemmt,项目名称:contao_dk_mmenu,代码行数:20,代码来源:ModuleMmenuArticle.php

示例11: parseMember

 public function parseMember($objMember)
 {
     global $objPage;
     $objT = new \FrontendTemplate($this->mlTemplate);
     $objT->setData($objMember->row());
     $arrSkipFields = deserialize($this->mlFields, true);
     if ($this->mlSkipFields) {
         $this->dropFieldsFromTemplate($objT, $arrSkipFields);
     }
     $strUrl = $this->generateMemberUrl($objMember);
     $objT->hasContent = false;
     $objElement = \ContentModel::findPublishedByPidAndTable($objMember->id, 'tl_member');
     if ($objElement !== null) {
         $objT->hasContent = true;
         if ($this->mlLoadContent) {
             while ($objElement->next()) {
                 $objT->text .= $this->getContentElement($objElement->current());
             }
         }
     }
     $objT->addImage = false;
     if (!$this->mlDisableImages) {
         $this->addMemberImageToTemplate($objT, $objMember);
     }
     $objT->titleCombined = $this->getCombinedTitle($objMember, $arrSkipFields);
     $arrLocation = array_filter(array($objMember->postal, $objMember->city));
     $objT->locationCombined = empty($arrLocation) ? '' : implode(' ', $arrLocation);
     $objT->websiteLink = $objMember->website;
     $objT->websiteTitle = $GLOBALS['TL_LANG']['MSC']['memberlist']['websiteTitle'];
     // Add http:// to the website
     if ($objMember->website != '' && !preg_match('@^(https?://|ftp://|mailto:|#)@i', $objMember->website)) {
         $objT->websiteLink = 'http://' . $objMember->website;
     }
     if ($this->mlSource == 'external') {
         // Encode e-mail addresses
         if (substr($this->mlUrl, 0, 7) == 'mailto:') {
             $strUrl = \String::encodeEmail($this->mlUrl);
         } else {
             $strUrl = ampersand($this->mlUrl);
         }
     }
     $objT->link = $strUrl;
     $objT->linkTarget = $this->mlTarget ? $objPage->outputFormat == 'xhtml' ? ' onclick="return !window.open(this.href)"' : ' target="_blank"' : '';
     $objT->linkTitle = specialchars(sprintf($GLOBALS['TL_LANG']['MSC']['openMember'], $objT->titleCombined));
     return $objT->parse();
 }
开发者ID:heimrichhannot,项目名称:contao-member_plus,代码行数:46,代码来源:MemberPlus.php

示例12: compile

 /**
  * Generate the content element
  */
 protected function compile()
 {
     $this->Template->image = \FilesModel::findByUuid($this->singleSRC);
     // for navigation: get list of content elements
     $nlContent = \ContentModel::findPublishedByPidAndTable($this->pid, "tl_newsletter");
     $content_items = array();
     $first = true;
     if ($nlContent) {
         foreach ($nlContent as $element) {
             if ($element->id != $this->id) {
                 if ($element->hoja_nl_headerlink_text) {
                     $content_items[] = array("id" => $element->id, "linktext" => $element->hoja_nl_headerlink_text);
                 }
             }
         }
     }
     $this->Template->nav_items = $content_items;
 }
开发者ID:hojanssen,项目名称:contao_hoja_newsletter_extended,代码行数:21,代码来源:ContentNLHeader.php

示例13: compile

 protected function compile()
 {
     parent::compile();
     $objNewsletter = \NewsletterModel::findSentByParentAndIdOrAlias(\Input::get('items'), $this->nl_channels);
     error_log("check");
     error_log($this->id);
     $html = '';
     $objContentElements = \ContentModel::findPublishedByPidAndTable($objNewsletter->id, 'tl_newsletter');
     error_log($objContentElements);
     if ($objContentElements !== null) {
         while ($objContentElements->next()) {
             $html .= $this->getContentElement($objContentElements->id);
         }
     }
     // Replace insert tags
     $html = $this->replaceInsertTags($html);
     $this->Template->htmlContent = $html;
 }
开发者ID:hojanssen,项目名称:contao_hoja_newsletter_extended,代码行数:18,代码来源:ModuleNewsletterReader.php

示例14: listNewsletterArticles

    /**
     * Add the type of input field
     * @param array
     * @return string
     */
    public function listNewsletterArticles($arrRow)
    {
        $strStats = '';
        $strContents = '';
        $objContents = \ContentModel::findPublishedByPidAndTable($arrRow['id'], 'tl_newsletter');
        if (!is_null($objContents)) {
            foreach ($objContents as $objContent) {
                $strContents .= $this->getContentElement($objContent->id) . '<hr>';
            }
        }
        $strStats = sprintf($GLOBALS['TL_LANG']['tl_newsletter']['hoja_status_string'], $arrRow['hoja_recipients'], $arrRow['hoja_rejected']);
        return '
<div class="cte_type ' . ($arrRow['sent'] && $arrRow['date'] ? 'published' : 'unpublished') . '"><strong>' . $arrRow['subject'] . '</strong> - ' . ($arrRow['sent'] && $arrRow['date'] ? sprintf($GLOBALS['TL_LANG']['tl_newsletter']['sentOn'], Date::parse($GLOBALS['TL_CONFIG']['datimFormat'], $arrRow['date'])) . '<br>' . $strStats : $GLOBALS['TL_LANG']['tl_newsletter']['notSent']) . '</div>
<div class="limit_height' . (!$GLOBALS['TL_CONFIG']['doNotCollapse'] ? ' h128' : '') . '">
' . (!$arrRow['sendText'] && strlen($strContents) ? '
' . $strContents : '') . '
' . nl2br_html5($arrRow['text']) . '
</div>' . "\n";
    }
开发者ID:hojanssen,项目名称:contao_hoja_newsletter_extended,代码行数:24,代码来源:tl_newsletter.php

示例15: compile

 /**
  * Generate the content element
  */
 protected function compile()
 {
     $arrContent = array();
     $objBlock = BlockModuleModel::findByPk($this->block);
     if ($objBlock === null) {
         return;
     }
     $objElement = \ContentModel::findPublishedByPidAndTable($this->block, 'tl_block_module');
     if ($objElement !== null) {
         while ($objElement->next()) {
             $arrContent[] = \Controller::getContentElement($objElement->current());
         }
     }
     $strReturn = implode('', $arrContent);
     if ($objBlock->addWrapper) {
         $strReturn = ModuleBlock::createBlockWrapper($objBlock, $strReturn);
     }
     $this->Template->content = $strReturn;
 }
开发者ID:heimrichhannot,项目名称:contao-blocks,代码行数:22,代码来源:ContentBlock.php


注:本文中的ContentModel::findPublishedByPidAndTable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。