/**
  * 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();
 }
 /**
  * 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']['newsarchive'][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));
     // No news archives available
     if (!is_array($this->news_archives) || empty($this->news_archives)) {
         return '';
     }
     // Show the news reader if an item has been selected
     if ($this->news_readerModule > 0 && (isset($_GET['items']) || \Config::get('useAutoItem') && isset($_GET['auto_item']))) {
         return $this->getFrontendModule($this->news_readerModule, $this->strColumn);
     }
     // Hide the module if no period has been selected
     if ($this->news_jumpToCurrent == 'hide_module' && !isset($_GET['year']) && !isset($_GET['month']) && !isset($_GET['day'])) {
         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 = '### NEWS 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();
     }
     // Return if no news item has been specified
     if (!$this->Input->get('items')) {
         global $objPage;
         // Do not index the page
         $objPage->noSearch = 1;
         $objPage->cache = 0;
         return '';
     }
     $this->news_archives = $this->sortOutProtected(deserialize($this->news_archives));
     // Return if there are no archives
     if (!is_array($this->news_archives) || count($this->news_archives) < 1) {
         global $objPage;
         // Do not index the page
         $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 = '### NEWS CATEGORIES MENU ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;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 '';
     }
     $param = 'items';
     // Use the auto_item parameter if enabled
     if (!isset($_GET['items']) && $GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) {
         $param = 'auto_item';
     }
     $newsModel = \NewsModel::findPublishedByParentAndIdOrAlias(\Input::get($param), $this->news_archives);
     // Get the category IDs of the active news item
     if ($newsModel !== null) {
         $this->activeNewsCategories = deserialize($newsModel->categories, true);
     }
     return parent::generate();
 }
Example #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 = '### NEWS READER ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     // Set the item from the auto_item parameter
     if ($GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) {
         $this->Input->setGet('items', $this->Input->get('auto_item'));
     }
     // Do not index or cache the page if no news item has been specified
     if (!$this->Input->get('items')) {
         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)) {
         global $objPage;
         $objPage->noSearch = 1;
         $objPage->cache = 0;
         return '';
     }
     return parent::generate();
 }
Example #6
0
 /**
  * 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']['newsmenu'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     $this->news_archives = $this->sortOutProtected(deserialize($this->news_archives));
     if (!is_array($this->news_archives) || empty($this->news_archives)) {
         return '';
     }
     return parent::generate();
 }
Example #7
0
 /**
  * Display a wildcard in the back end
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### NEWS ARCHIVE MENU ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     $this->news_archives = $this->sortOutProtected(deserialize($this->news_archives));
     if (!is_array($this->news_archives) || empty($this->news_archives)) {
         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 = '### NEWS ARCHIVE ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     $this->news_archives = $this->sortOutProtected(deserialize($this->news_archives));
     if (!is_array($this->news_archives) || count($this->news_archives) < 1 || $this->news_jumpToCurrent == 'hide_module' && !isset($_GET['year']) && !isset($_GET['month']) && !isset($_GET['day'])) {
         return '';
     }
     return parent::generate();
 }
 /**
  * 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']['newsmenu'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     $this->news_archives = $this->sortOutProtected(deserialize($this->news_archives));
     if (!is_array($this->news_archives) || empty($this->news_archives)) {
         return '';
     }
     $this->strUrl = preg_replace('/\\?.*$/', '', \Environment::get('request'));
     if ($this->jumpTo && ($objTarget = $this->objModel->getRelated('jumpTo')) !== null) {
         $this->strUrl = $this->generateFrontendUrl($objTarget->row());
     }
     return parent::generate();
 }
 /**
  * Parse one or more items and return them as array
  * @param object
  * @param boolean
  * @return array
  */
 protected function parseArticles($objArticles, $blnAddArchive = false)
 {
     $arrArticles = parent::parseArticles($objArticles, $blnAddArchive);
     // HOOK: add custom logic
     if (isset($GLOBALS['TL_HOOKS']['parseAllArticles']) && is_array($GLOBALS['TL_HOOKS']['parseAllArticles'])) {
         foreach ($GLOBALS['TL_HOOKS']['parseAllArticles'] as $callback) {
             $this->import($callback[0]);
             $arrArticles = $this->{$callback}[0]->{$callback}[1]($arrArticles, $blnAddArchive, $this);
         }
     }
     return $arrArticles;
 }
Example #11
0
 protected function moduleNewsList2($data)
 {
     $pages = $data['pages'];
     $mpage_id_list2 = ModulesInPages::model()->getLink($data['doc_id_last'], 'list2');
     $mpage_id_news = ModulesInPages::model()->getLink($data['doc_id_last'], 'news');
     $records_on_page = 10;
     // количество новостей на странице
     $type = explode($pages->make_url($data['doc_id_last']), '/' . Yii::app()->request->pathInfo);
     $type = explode('/', $type[1]);
     $type = $type[0];
     if (substr($type, 0, 5) == 'show_') {
         // конкретная новость
         $lenta = new ModuleNews();
         $news_id = floor(substr($type, 5));
         if ($lenta->existsItem($mpage_id_news, $news_id, 1)) {
             $data['news_show'] = 1;
             $data['item_id'] = $news_id;
             $data['item'] = $lenta->getItem($news_id, $mpage_id_news);
             $data['lastNews'] = $lenta->getLastNewsList($mpage_id_news, $news_id, 2);
             $list2 = new ModuleList2();
             $data['list2'] = ModuleList2::model()->getList($mpage_id_list2, 0, 0, 1);
             $data['doc_id_list2'] = $data['doc_id_last'];
             if (count($data['item']) == 0) {
                 $this->redirect($pages->make_url($data['doc_id_last']));
             } else {
                 $data['title'] = $data['item']['title'] . ' — ' . $data['title'];
                 $this->render('news_list2_show', $data);
             }
         } else {
             // новость не найдена
             $this->redirect($pages->make_url($data['doc_id_last']));
         }
     } elseif (substr($type, 0, 7) == 'action_') {
         // конкретная акция
         $list2 = new ModuleList2();
         $lenta = new ModuleNews();
         $action_id = floor(substr($type, 7));
         if ($list2->existsItem($mpage_id_list2, $action_id, 1)) {
             $data['news_show'] = 0;
             $data['item_id'] = $action_id;
             $data['item'] = $list2->getItem($action_id, $mpage_id_list2);
             $data['doc_id_list2'] = $data['doc_id_last'];
             $data['list2'] = $list2->getOtherList($mpage_id_list2, $action_id, 0, 1);
             $data['lastNews'] = $lenta->getLastNewsList($mpage_id_news, 0, 2);
             if (count($data['item']) == 0) {
                 $this->redirect($pages->make_url($data['doc_id_last']));
             } else {
                 $data['title'] = $data['list2']['title'] . ' — ' . $data['title'];
                 $this->render('news_list2_show', $data);
             }
         } else {
             // акция не найдена
             $this->redirect($pages->make_url($data['doc_id_last']));
         }
     } elseif (substr($type, 0, 5) == 'page_' || empty($type)) {
         // выбор страницы
         $page = 1;
         $lenta = new ModuleNews();
         if (!empty($type)) {
             $page = floor(substr($type, 5));
         }
         if ($page < 1) {
             $page = 1;
         }
         $data['pagination'] = $this->pagination($pages->make_url($data['doc_id_last']) . 'page_', $lenta->getCount($mpage_id_news, 1), $page, $records_on_page);
         $offset = ($page - 1) * $records_on_page;
         $limit = $records_on_page;
         $data['newsList'] = ModuleNews::model()->getList($mpage_id_news, $offset, $limit, 1);
         $data['url_for_menu'] = substr(substr($data['pages']->make_url($data['doc_id_last']), 0, -1), 1);
         $data['list2'] = ModuleList2::model()->getList($mpage_id_list2, 0, 0, 1);
         $data['doc_id_list2'] = $data['doc_id_last'];
         $this->render('news_list2', $data);
     } else {
         // неизвестный тип отображения
         $this->redirect($pages->make_url($data['doc_id_last']));
     }
 }
Example #12
0
 public function run($page_id = null, $page = 1)
 {
     $page_id = $this->page_id;
     $page = $this->page;
     $controller = Yii::app()->getController();
     $model = new ModuleNews();
     if (!is_null($page_id) && Pages::model()->existsPage($page_id)) {
         $this->create_item($page_id, $model);
         $mpage_id = ModulesInPages::model()->getLink($page_id, $this->module_id);
         $records_on_page = 10;
         $count = ModuleNews::model()->getCount($mpage_id);
         $pagination = $this->pagination('/admin.php?r=pages/update&id=' . $page_id . '&page=', $count, $page, $records_on_page);
         $offset = ($page - 1) * $records_on_page;
         $limit = $records_on_page;
         $data = ModuleNews::model()->getList($mpage_id, $offset, $limit);
         $this->render('module_news', array('model' => $model, 'page_id' => $page_id, 'data' => $data, 'pagination' => $pagination));
     } else {
         $controller->redirect(Yii::app()->request->scriptUrl);
     }
 }
Example #13
0
  | License as published by the Free Software Foundation; either         |
  | version 2.1 of the License, or (at your option) any later version.   |
  +----------------------------------------------------------------------+
  | Author: John.meng(цот╤РШ)  Jan 17, 2006 1:01:50 PM                        
  +----------------------------------------------------------------------+
*/
/* $Id$ */
if (empty($__Version__)) {
    echo "Big error! ";
    exit;
}
include_once "ModuleConfig.php";
$class_path = INCLUDE_DIR . "editor/";
include_once $class_path . "class.rich.php";
include_once "ModuleNews.class.php";
$thisObj = new ModuleNews();
switch ($_REQUEST['Action']) {
    case 'Add':
        $thisObj->opAdd();
        break;
    case 'Detail':
        $thisObj->opDetail();
        if (!file_exists(CURRENT_HTML_DIR . "/news")) {
            mkdir(CURRENT_HTML_DIR . "/news", 0755);
        }
        $__this_publish_file_name = "/news/news" . $_GET['NewsID'] . ".htm";
        break;
    case 'Update':
        $thisObj->opAdd();
        break;
    case 'Cancel':
Example #14
0
 public function actionDeactivation($page_id = null)
 {
     $result = false;
     // доступно для пользователей первой роли (например, «Реактиву»)
     $role_id = Users::model()->findByPk(Yii::app()->user->id)->role_id;
     if ($role_id < 2 && !is_null($page_id) && Pages::model()->existsPage($page_id)) {
         $link_id = ModulesInPages::model()->getLink($page_id, $this->module->id);
         if ($link_id) {
             $result = ModuleNews::model()->deactivation($link_id, $this->module->id);
         }
     }
     if ($result) {
         $this->redirect(Yii::app()->baseUrl . '?r=pages/update&id=' . $page_id . '&/#!/tab_fourth');
     } else {
         $this->redirect(Yii::app()->request->baseUrl . '/admin.php');
     }
 }