Inheritance: extends YWebModule
Beispiel #1
0
 public function NewsModule()
 {
     NewsModule::$instance = $this;
     $this->version = "0.2.7";
     $this->name = "news";
     $this->takelink = "news";
     $this->permission = new NewsPermission($this);
 }
Beispiel #2
0
<div>
    <?php 
$this->widget('CTreeView', array('data' => $arrTrees, 'animated' => 'fast', 'htmlOptions' => array('class' => 'jlb_treeview treeview')));
?>
</div>
<script>
	var box = window.parent.getDialog();
	box.dialog("option", {
		title: "<?php 
echo NewsModule::t('Manage News Categories');
?>
",
		width: 500,
		height: 400,
		minWidth: 500,
		minHeight: 400,
		buttons: {
			"<?php 
echo NewsModule::t('Create New Category');
?>
": function() { window.parent.showDialog("<?php 
echo $this->createAbsoluteUrl('/news/manage_categories/create');
?>
"); }
		}
	});
</script>
 private function __getDataTreeChilds($childrens, $moving = null)
 {
     $arrTrees = array();
     $length = count($childrens);
     foreach ($childrens as $index => $child) {
         $strChildId = $child['item']->id;
         $linkUp = $index == 0 ? '' : '<a title="' . NewsModule::t('Move Up') . '" href="' . $this->createAbsoluteUrl('/news/manage_categories/moveup', array('id' => $strChildId)) . '"><img src="' . $this->__baseScriptUrl . '/uparrow.png" /></a>';
         $linkDown = $index == $length - 1 ? '<span style="display:inline-block;width:16px"></span>' : '<a title="' . NewsModule::t('Move Down') . '" href="' . $this->createAbsoluteUrl('/news/manage_categories/movedown', array('id' => $strChildId)) . '"><img src="' . $this->__baseScriptUrl . '/downarrow.png" /></a>';
         $linkUpdate = '<a title="' . NewsModule::t('Update') . '" href="' . $this->createAbsoluteUrl('/news/manage_categories/update', array('id' => $strChildId)) . '"><img src="' . $this->__baseScriptUrl . '/update.png" /></a>';
         $linkDelete = '<a title="' . NewsModule::t('Delete') . '" onClick="if (!confirm(\'' . NewsModule::t('Are you sure you want to delete?') . '\')) return false;" href="' . $this->createAbsoluteUrl('/news/manage_categories/delete', array('id' => $strChildId)) . '"><img src="' . $this->__baseScriptUrl . '/delete.png" /></a>';
         $title = $moving == $strChildId ? '<span style="color:#ff0000;">' . $child['item']->name . '</span>' : $child['item']->name;
         $row['text'] = $title . '<span style="float:right;">' . $linkUp . $linkDown . $linkUpdate . $linkDelete . '</span>';
         $row['children'] = $this->__getDataTreeChilds($child['children'], $moving);
         $arrTrees[] = $row;
     }
     return $arrTrees;
 }
Beispiel #4
0
$this->endWidget();
?>

</div><!-- form -->

<script>
	var box = window.parent.getDialog();
	box.dialog("option", {
		title: "<?php 
echo $model->isNewRecord ? NewsModule::t('Create New Category') : NewsModule::t('Update Category') . ' (' . CHtml::encode($model->name) . ')';
?>
",
		width: 500,
		height: 500,
		minWidth: 500,
		minHeight: 500,
		buttons: {
			"<?php 
echo NewsModule::t('Manage Categories');
?>
": function() { window.parent.showDialog("<?php 
echo $this->createAbsoluteUrl('/news/manage_categories/admin');
?>
"); },
			"<?php 
echo $model->isNewRecord ? NewsModule::t('Create') : NewsModule::t('Save');
?>
": function() { $('#category-form').submit(); }
		}
	});
</script>
Beispiel #5
0
<?php

$this->menu = array(array('label' => NewsModule::t('Add news'), 'url' => array('create')), array('label' => NewsModule::t('Edit news'), 'url' => array('update', 'id' => $model->id)), array('label' => tt('Delete news', 'news'), 'url' => '#', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => tt('Are you sure you want to delete this item?'))));
$this->renderPartial('//modules/news/views/view', array('model' => $model));
Beispiel #6
0
        echo '</div>';
        echo '<div class="clear">&nbsp;</div>';
    }
    foreach ($items as $item) {
        echo '<div class="news-items">';
        echo '<p><font class="date">' . $item->pubDate . '</font></p>';
        //echo CHtml::link($item->title, $item->getUrl(), array('class'=>'title'));
        echo '<p><font class="title">' . $item->title . '</font></p>';
        echo '<p class="desc">';
        echo $item->description;
        echo '</p>';
        echo '<p>';
        echo CHtml::link(NewsModule::t('Read more &raquo;'), $item->link);
        echo '</p>';
        echo '</div>';
        if ($item->is_show == 0) {
            $item->is_show = 1;
            $item->update('is_show');
        }
    }
}
if (!$items) {
    echo NewsModule::t('News list is empty.');
}
if ($pages) {
    echo '<div class="clear">&nbsp;</div>';
    echo '<div class="pagination">';
    $this->widget('itemPaginator', array('pages' => $pages, 'header' => '', 'showHidden' => true));
    echo '</div>';
    echo '<div class="clear">&nbsp;</div>';
}
Beispiel #7
0
<?php

$this->pageTitle = Yii::app()->name . ' - ' . NewsModule::t('Manage news');
$this->menu = array(array('label' => NewsModule::t('Add news'), 'url' => array('create')));
$this->adminTitle = NewsModule::t('Manage news');
?>

<?php 
$this->widget('CustomGridView', array('id' => 'news-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'afterAjaxUpdate' => 'function(){$("a[rel=\'tooltip\']").tooltip(); $("div.tooltip-arrow").remove(); $("div.tooltip-inner").remove();}', 'columns' => array(array('class' => 'CCheckBoxColumn', 'id' => 'itemsSelected', 'selectableRows' => '2', 'htmlOptions' => array('class' => 'center')), array('header' => tc('Name'), 'name' => 'title_' . Yii::app()->language, 'type' => 'raw', 'value' => 'CHtml::link(CHtml::encode($data->getStrByLang("title")), $data->url)'), array('name' => 'dateCreated', 'type' => 'raw', 'filter' => false, 'htmlOptions' => array('style' => 'width:130px;')), array('class' => 'bootstrap.widgets.TbButtonColumn', 'deleteConfirmation' => tc('Are you sure you want to delete this item?'), 'viewButtonUrl' => '$data->url'))));
$this->renderPartial('//site/admin-select-items', array('url' => '/news/backend/main/itemsSelected', 'id' => 'news-grid', 'model' => $model, 'options' => array('delete' => Yii::t('common', 'Delete'))));
Beispiel #8
0
<?php

$this->pageTitle = Yii::app()->name . ' - ' . NewsModule::t('Edit news');
$this->menu = array(array('label' => tt('Manage news'), 'url' => array('admin')), array('label' => NewsModule::t('Add news'), 'url' => array('create')), array('label' => tt('Delete news', 'news'), 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => tc('Are you sure you want to delete this item?'))));
$this->adminTitle = NewsModule::t('Edit news') . ': <i>' . CHtml::encode($model->title) . '</i>';
?>

<?php 
echo $this->renderPartial('/backend/_form', array('model' => $model));
Beispiel #9
0
<?php

$this->pageTitle .= ' - ' . NewsModule::t('News') . ' - ' . CHtml::encode($model->getStrByLang('title'));
$this->breadcrumbs = array(NewsModule::t('News') => array('/news/main/index'), truncateText(CHtml::encode($model->getStrByLang('title')), 10));
?>

<!--<h1 class="title highlight-left-right">
	<span><?php 
echo CHtml::encode($model->getStrByLang('title'));
?>
</span>
</h1>-->




        <!-- One article page -->
        <section class="container-full">
            <div class="one-article">
                <h2><?php 
echo CHtml::encode($model->getStrByLang('title'));
?>
</h2>
                <div class="clearfix">
                    <span class="pull-left"><?php 
echo $model->dateCreatedLong;
?>
</span>
                    <span class="pull-right">Автор: <a href="">Сергей Есенин</a></span>
                </div>
                
Beispiel #10
0
                <div class="carousel-inner">
                    <div class="active item">
                        <img src="/themes/atlas/temp/images/slides/slide-10.png">
                    </div>
                    <div class="item">
                        <img src="/themes/atlas/temp/images/slides/slide-4.png">
                    </div>
                </div>
            </div>
        </section>


<!--<h1 class="title highlight-left-right">
	<span>
		<?php 
echo NewsModule::t('News');
?>
	</span>
</h1>-->


 <!-- News -->
        <section class="container-full">
            <div id="news">
                <div id="filter-nav" class="filter-options">
                    <button class="btn btn-filter active" data-group="all">Все новости</button>
                    <button class="btn btn-filter" data-group="market-property">Рынок недвижимости</button>
                    <button class="btn btn-filter" data-group="around-world">Вокруг света</button>
                    <button class="btn btn-filter" data-group="moscow-region">Москва и область</button>
                    <button class="btn btn-filter" data-group="questions">Вопросы права</button>
                </div>
Beispiel #11
0
<div class="h_module_products_category_tree">
	<?php 
echo $categories;
?>
</div>
<?php 
if (!Yii::app()->user->isGuest && Yii::app()->user->superuser == 1) {
    ?>
<div class="h-admin-manage">
    <a class="h-dialog-link" href="<?php 
    echo Yii::app()->createAbsoluteUrl('/news/manage_categories/admin');
    ?>
"><?php 
    echo NewsModule::t('Manage Categories');
    ?>
</a>
</div>
<?php 
}
Beispiel #12
0
<?php

echo NewsModule::t('No results found.');
if (!Yii::app()->user->isGuest && Yii::app()->user->superuser == 1) {
    ?>
<div>
    <a class="h-dialog-link" href="<?php 
    echo Yii::app()->createAbsoluteUrl('/news/manage_items/admin', array('category' => isset($_GET['category']) ? $_GET['category'] : ''));
    ?>
"><?php 
    echo NewsModule::t('Manage News Items');
    ?>
</a>
</div>
<?php 
}
Beispiel #13
0
<?php

$this->pageTitle = Yii::app()->name . ' - ' . NewsModule::t('Add news');
$this->menu = array(array('label' => tt('Manage news'), 'url' => array('admin')));
$this->adminTitle = NewsModule::t('Add news');
?>

<?php 
echo $this->renderPartial('/backend/_form', array('model' => $model));
Beispiel #14
0
<?php

$this->pageTitle .= ' - ' . NewsModule::t('News') . ' - ' . CHtml::encode($model->getStrByLang('title'));
$this->breadcrumbs = array(NewsModule::t('News') => array('/news/main/index'), truncateText(CHtml::encode($model->getStrByLang('title')), 10));
?>

<h2><?php 
echo CHtml::encode($model->getStrByLang('title'));
?>
</h2>
<span class="date"><?php 
echo NewsModule::t('Created on') . ' ' . $model->dateCreated;
?>
</span>

<?php 
if ($model->image) {
    ?>
	<?php 
    $src = $model->image->getFullThumbLink();
    ?>
	<?php 
    if ($src) {
        ?>
			<div class="clear"></div>
			<div class="news-image">
				<?php 
        echo CHtml::link(CHtml::image($src, $model->getStrByLang('title')), $model->image->fullHref(), array('class' => 'fancy'));
        ?>
			</div>
		<div class="clear"></div>
Beispiel #15
0
 function cms_block_news()
 {
     global $db, $cache, $config, $template, $user, $lang, $bbcode, $block_id, $cms_config_var, $cms_config_vars;
     @(include_once IP_ROOT_PATH . ATTACH_MOD_PATH . 'displaying.' . PHP_EXT);
     @(include_once IP_ROOT_PATH . 'includes/news.' . PHP_EXT);
     $template->_tpldata['no_news.'] = array();
     $template->_tpldata['news_categories.'] = array();
     $template->_tpldata['newsrow.'] = array();
     $template->_tpldata['newscol.'] = array();
     $template->_tpldata['news_detail.'] = array();
     $template->_tpldata['news_archives.'] = array();
     $template->_tpldata['arch.'] = array();
     $template->_tpldata['year.'] = array();
     $template->_tpldata['month.'] = array();
     $template->_tpldata['day.'] = array();
     $template->_tpldata['no_articles.'] = array();
     $template->_tpldata['articles.'] = array();
     $template->_tpldata['comments.'] = array();
     $template->_tpldata['pagination.'] = array();
     //$cms_config_var['md_news_cat_id'] = $cms_config_vars['md_news_cat_id'][$block_id];
     $cms_config_var['md_news_number'] = intval($cms_config_vars['md_news_number'][$block_id]) && $cms_config_vars['md_news_number'][$block_id] > 0 ? $cms_config_vars['md_news_number'][$block_id] : $config['news_item_num'];
     $cms_config_var['md_news_sort'] = $cms_config_vars['md_news_sort'][$block_id] == 1 ? '1' : '0';
     $cms_config_var['md_news_length'] = (int) ($cms_config_vars['md_news_length'][$block_id] >= 0) ? $cms_config_vars['md_news_length'][$block_id] : $config['news_item_trim'];
     //unset($cms_config_var);
     //$index_file = CMS_PAGE_HOME;
     $index_file = !empty($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : getenv('SCRIPT_NAME');
     //$page_query = $_SERVER['QUERY_STRING'];
     //$page_query = (!empty($_SERVER['QUERY_STRING'])) ? explode('&', $_SERVER['QUERY_STRING']) : explode('&', getenv('QUERY_STRING'));
     $portal_page_id = request_var('page', 0);
     $portal_page_id = !empty($portal_page_id) ? 'page=' . $portal_page_id . '&amp;' : '';
     $ubid_link = request_var('ubid', 0);
     $ubid_link = !empty($ubid_link) ? 'ubid=' . $ubid_link . '&amp;' : '';
     $template->set_filenames(array('news' => 'blocks/news_block.tpl'));
     $content = new NewsModule(IP_ROOT_PATH);
     $content->setVariables(array('INDEX_FILE' => htmlspecialchars(urldecode($index_file)), 'PORTAL_PAGE_ID' => $portal_page_id . $ubid_link, 'PHP_EXT' => PHP_EXT, 'S_NEWS_VIEWS' => $user->data['user_level'] == ADMIN && !empty($config['disable_topic_view']) ? true : false, 'S_COLS' => 4, 'L_INDEX' => $lang['Index'], 'L_CATEGORIES' => $lang['Categories'], 'L_BY' => $lang['By'], 'L_NO_NEWS_CATS' => $lang['No_News_Cats'], 'L_NO_NEWS' => $lang['No_News'], 'L_NEWS_CATEGORIES' => $lang['News_Categories'], 'L_NEWS_ARCHIVES' => $lang['News_Archives'], 'L_NEWS_SUMMARY' => $lang['News_Summary'], 'L_NEWS_VIEWS' => $lang['News_Views'], 'L_NEWS_AND' => $lang['News_And'], 'L_NEWS_COMMENTS' => $lang['News_Comments'], 'L_NEWS_CATS' => $lang['News_Cats'], 'L_REPLY_NEWS' => $lang['News_Reply'], 'L_PRINT_NEWS' => $lang['News_Print'], 'L_EMAIL_NEWS' => $lang['News_Email'], 'L_ARCHIVES' => $lang['Archives']));
     $news = request_var('news', '');
     if ($news == 'categories') {
         // View the news categories.
         $data_access = new NewsDataAccess(IP_ROOT_PATH);
         $news_cats = $data_access->fetchCategories();
         $template->assign_block_vars('news_categories', array());
         $cats = sizeof($news_cats);
         if ($cats == 0) {
             $template->assign_block_vars('no_news', array());
         }
         for ($i = 0; $i < sizeof($news_cats); $i += 4) {
             if ($cats > 0) {
                 $template->assign_block_vars('newsrow', array());
             }
             for ($j = $i; $j < $i + 4; $j++) {
                 if ($j >= sizeof($news_cats)) {
                     break;
                 }
                 $template->assign_block_vars('newsrow.newscol', array('THUMBNAIL' => $news_cats[$j]['news_image'] ? $N_this->root_path . $config['news_path'] . '/' . $news_cats[$j]['news_image'] : '', 'ID' => $news_cats[$j]['news_id'], 'DESC' => $news_cats[$j]['news_category']));
                 $template->assign_block_vars('newsrow.news_detail', array('NEWSCAT' => $news_cats[$j]['news_category'], 'CATEGORY' => $newsrow[$j]['news_category']));
             }
         }
         $content->setVariables(array('NEWS_TITLE' => $lang['News_Cmx'] . ' ' . $lang['Categories']));
         $content->renderTopics();
     } elseif ($news == 'archives') {
         $year = request_var('year', 0);
         $month = request_var('month', 0);
         $day = request_var('day', 0);
         $key = request_var('key', '');
         $template->assign_block_vars('news_archives', array());
         $content->setVariables(array('NEWS_TITLE' => $lang['News_Cmx'] . ' ' . $lang['Archives']));
         $content->renderArchives($year, $month, $day, $key);
     } else {
         // View news articles.
         $topic_id = request_var('topic_id', 0);
         $news_id = request_var('news_id', 0);
         $topic_id = empty($topic_id) && !empty($news_id) ? $news_id : $topic_id;
         $topic_id = $topic_id < 0 ? 0 : $topic_id;
         if (!empty($topic_id)) {
             $content->is_topic = true;
         }
         $content->setVariables(array('NEWS_TITLE' => $lang['News_Cmx'] . ' ' . $lang['Articles']));
         $content->renderArticles($topic_id);
     }
     $content->renderPagination();
     //$content->display();
     //$content->clear();
 }
Beispiel #16
0
<div>
    <?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'news-item-grid', 'dataProvider' => $model->search(), 'columns' => array('id', 'title', 'short_content', array('class' => 'CButtonColumn', 'template' => '{update}{delete}', 'buttons' => array('update' => array('url' => 'Yii::app()->createAbsoluteUrl("/news/manage_items/update",array("id"=>$data->primaryKey,"category"=>isset($_GET["category"])?$_GET["category"]:""))'))))));
?>
</div>
<script>
	var box = window.parent.getDialog();
	box.dialog("option", {
		title: "<?php 
echo NewsModule::t('Manage News Items') . (isset($_GET['category']) && $_GET['category'] ? " (Of a Category)" : " (All News)");
?>
",
		width: 500,
		height: 360,
		minWidth: 500,
		minHeight: 360,
		buttons: {
			"<?php 
echo NewsModule::t('Create New News');
?>
": function() { window.parent.showDialog("<?php 
echo $this->createAbsoluteUrl('/news/manage_items/create', array('category' => isset($_GET['category']) ? $_GET['category'] : ''));
?>
"); }
		}
	});
</script>