示例#1
0
 public function index($id = 0, $params = array())
 {
     $lang_code = $this->_safeGet($params, 'lang_code', DEFAULT_LANGUAGE);
     if (empty($id)) {
         list($news, $search) = fn_get_news($params, Registry::get('settings.Appearance.admin_elements_per_page'), $lang_code);
         $data['news'] = $news;
         $data['params'] = $search;
     } else {
         $data = fn_get_news_data($id, $lang_code);
     }
     if (empty($data)) {
         $status = Response::STATUS_NOT_FOUND;
     } else {
         $status = Response::STATUS_OK;
     }
     return array('status' => $status, 'data' => $data);
 }
示例#2
0
function fn_news_and_emails_generate_rss_feed(&$items_data, &$additional_data, &$block_data, &$lang_code)
{
    if (!empty($block_data['content']['filling']) && $block_data['content']['filling'] == 'news') {
        $params = array('sort_by' => 'timestamp', 'period' => 'A', 'limit' => !empty($block_data['properties']['max_item']) ? $block_data['properties']['max_item'] : 3);
        list($news, ) = fn_get_news($params, 0, $lang_code);
        $additional_data['title'] = !empty($block_data['properties']['feed_title']) ? $block_data['properties']['feed_title'] : __('news') . '::' . __('page_title', '', $lang_code);
        $additional_data['description'] = !empty($block_data['properties']['feed_description']) ? $block_data['properties']['feed_description'] : $additional_data['title'];
        $additional_data['link'] = fn_url('news.list', 'C', 'http', $lang_code);
        $additional_data['language'] = $lang_code;
        $additional_data['lastBuildDate'] = $news[0]['date'];
        //we can use first element because news sorting by data
        foreach ($news as $key => $data) {
            $items_data[$key] = array('title' => $data['news'], 'link' => fn_url('news.view?news_id=' . $data['news_id'], 'C', 'http', $lang_code, true), 'pubDate' => fn_format_rss_time($data['date']), 'description' => $data['description']);
        }
    }
}
示例#3
0
    // [Block manager]
    list($blocks) = fn_get_blocks(array('location' => 'news', 'block_type' => 'B', 'all' => true));
    if (!empty($blocks)) {
        $view->assign('blocks', $blocks);
        $view->assign('selected_block', fn_get_selected_block_data($_REQUEST, $blocks, $_REQUEST['news_id'], 'news'));
        $view->assign('block_properties', fn_get_block_properties());
    }
    // [/Block manager]
    // [Page sections]
    Registry::set('navigation.tabs', array('detailed' => array('title' => fn_get_lang_var('general'), 'js' => true), 'blocks' => array('title' => fn_get_lang_var('blocks'), 'js' => true), 'addons' => array('title' => fn_get_lang_var('addons'), 'js' => true)));
    // [/Page sections]
    $view->assign('news_data', $news_data);
} elseif ($mode == 'manage' || $mode == 'picker') {
    $params = $_REQUEST;
    $params['paginate'] = true;
    list($news, ) = fn_get_news($params, DESCR_SL);
    $view->assign('news', $news);
} elseif ($mode == 'delete') {
    if (!empty($_REQUEST['news_id'])) {
        fn_delete_news($_REQUEST['news_id']);
    }
    return array(CONTROLLER_STATUS_REDIRECT, "news.manage");
}
//
// News picker
//
if ($mode == 'picker') {
    $view->display('addons/news_and_emails/pickers/news_picker_contents.tpl');
    exit;
}
function fn_delete_news($news_id)
示例#4
0
/***************************************************************************
*                                                                          *
*   (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev    *
*                                                                          *
* This  is  commercial  software,  only  users  who have purchased a valid *
* license  and  accept  to the terms of the  License Agreement can install *
* and use this program.                                                    *
*                                                                          *
****************************************************************************
* PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
****************************************************************************/
use Tygh\Registry;
if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
$_REQUEST['news_id'] = empty($_REQUEST['news_id']) ? 0 : $_REQUEST['news_id'];
if ($mode == 'view') {
    fn_add_breadcrumb(__('news'), "news.list");
    $news_data = fn_get_news_data($_REQUEST['news_id']);
    if (empty($news_data)) {
        return array(CONTROLLER_STATUS_NO_PAGE);
    }
    fn_add_breadcrumb($news_data['news']);
    Registry::get('view')->assign('news', $news_data);
} elseif ($mode == 'list') {
    fn_add_breadcrumb(__('news'));
    list($news, $search) = fn_get_news($_REQUEST, Registry::get('settings.Appearance.elements_per_page'), CART_LANGUAGE);
    Registry::get('view')->assign('news', $news);
    Registry::get('view')->assign('search', $search);
}
示例#5
0
function fn_news_and_email_create_news_condition($params, $lang_code = CART_LANGUAGE)
{
    $params['get_conditions'] = true;
    list($fields, $join, $condition) = fn_get_news($params, $lang_code);
    $data = array('fields' => $fields, 'join' => $join, 'condition' => $condition, 'table' => '?:news', 'key' => 'news_id', 'sort' => 'descr.news', 'sort_table' => 'news_descriptions');
    return $data;
}
示例#6
0
*                                                                          *
* This  is  commercial  software,  only  users  who have purchased a valid *
* license  and  accept  to the terms of the  License Agreement can install *
* and use this program.                                                    *
*                                                                          *
****************************************************************************
* PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
****************************************************************************/
//
// $Id: news.php 10229 2010-07-27 14:21:39Z 2tl $
//
if (!defined('AREA')) {
    die('Access denied');
}
$_REQUEST['news_id'] = empty($_REQUEST['news_id']) ? 0 : $_REQUEST['news_id'];
if ($mode == 'view') {
    fn_add_breadcrumb(fn_get_lang_var('news'), "news.list");
    $news_data = fn_get_news_data($_REQUEST['news_id']);
    if (empty($news_data)) {
        return array(CONTROLLER_STATUS_NO_PAGE);
    }
    fn_add_breadcrumb($news_data['news']);
    $view->assign('news', $news_data);
} elseif ($mode == 'list') {
    fn_add_breadcrumb(fn_get_lang_var('news'));
    $params = $_REQUEST;
    $params['paginate'] = true;
    list($news, ) = fn_get_news($params, CART_LANGUAGE);
    $view->assign('news', $news);
}
示例#7
0
if ($mode == 'add') {
    // [Page sections]
    Registry::set('navigation.tabs', array('detailed' => array('title' => __('general'), 'js' => true), 'addons' => array('title' => __('addons'), 'js' => true)));
    // [/Page sections]
} elseif ($mode == 'update') {
    $news_data = fn_get_news_data($_REQUEST['news_id'], DESCR_SL);
    if (empty($news_data)) {
        return array(CONTROLLER_STATUS_NO_PAGE);
    }
    // [Page sections]
    $tabs = array('detailed' => array('title' => __('general'), 'js' => true), 'addons' => array('title' => __('addons'), 'js' => true));
    Registry::set('navigation.tabs', $tabs);
    // [/Page sections]
    Registry::get('view')->assign('news_data', $news_data);
} elseif ($mode == 'manage' || $mode == 'picker') {
    list($news, $search) = fn_get_news($_REQUEST, Registry::get('settings.Appearance.admin_elements_per_page'), DESCR_SL);
    Registry::get('view')->assign('news', $news);
    Registry::get('view')->assign('search', $search);
} elseif ($mode == 'delete') {
    if (!empty($_REQUEST['news_id'])) {
        fn_delete_news($_REQUEST['news_id']);
    }
    return array(CONTROLLER_STATUS_REDIRECT, "news.manage");
}
//
// News picker
//
if ($mode == 'picker') {
    Registry::get('view')->display('addons/news_and_emails/pickers/news/picker_contents.tpl');
    exit;
}