/** * Index Page, for now just render all static content. */ public function actionIndex() { //TODO add cache logic later. //load last 5 news $criteria = new CDbCriteria(); $criteria->limit = 5; $criteria->order = 'n_id DESC'; $news = News::model()->findAll($criteria); //load last 9 suggestion images $criteria = new CDbCriteria(); $criteria->limit = 9; $criteria->order = 'id DESC'; $criteria->condition = 'is_recommend = 1'; $images = GalleryImage::model()->findAll($criteria); $this->render('index', array('news' => $news, 'posts' => BlogPosts::post(), 'notices' => BlogPosts::notice(), 'images' => $images)); }
public function actionIndex() { /* $content = file_get_contents('http://blog.go9999.com/feed/'); // <title></title> <link></link> preg_match_all('/<title>([^<]*)<\/title>[^<]*<link>([^<]*)<\/link>/i', $content, $out); //print_r($out); $blogPosts = array(); foreach($out[1] as $key => $value) { $blogPost[] = array( 'title' => $value, 'link' => $out[1][$key] ); } echo "<pre>"; print_r($blogPost); */ echo "<pre>"; echo 'post'; print_r(BlogPosts::post()); echo 'notice'; print_r(BlogPosts::notice()); }
echo CHtml::encode(BlogPosts::LabelsStatus($post->status_id)); ?> </h4> </div> </div> <div class="row"> <div class="col-md-3"> <h4 class="h4-label"><?php echo $post->getAttributeLabel('can_read'); ?> </h4> </div> <div class="col-md-9"> <h4><?php echo CHtml::encode(BlogPosts::LabelsRead($post->can_read)); ?> </h4> </div> </div> <div class="row"> <div class="col-md-3"> <h4 class="h4-label"><?php echo $post->lang->getAttributeLabel('description'); ?> </h4> </div> <div class="col-md-9"> <h4><?php echo CHtml::encode($post->lang->description);
echo Yii::t('app', 'Запись заблокирована'); ?> </p> <?php } else { ?> <h2><a href="<?php echo $this->createUrl('view/index', array('post' => $post->id)); ?> "><?php echo CHtml::encode($post->lang->title); ?> </a></h2> <ul class="blog-info"> <li><i class="fa fa-calendar"></i> <?php echo BlogPosts::DateHuman($post->created_at); ?> </li> <li><i class="fa fa-comments"></i> <?php if (empty($post->commentsobject->commentsCount)) { ?> <span>Комментариев не добавлено</span> <?php } else { ?> <span>Комментариев: <?php echo $post->commentsobject->commentsCount; ?> </span> <?php
echo CHtml::label(Yii::t('app', 'Статус'), 'body', array('class' => 'col-md-3 control-label', 'style' => 'float:left; padding:10px; width: 8%;')); ?> <div class="col-md-9" style = "float:left; padding:10px"> <?php echo CHtml::listBox('filterstatus', array_key_exists('filterstatus', $filter) ? $filter['filterstatus'] : (string) FALSE, BlogPosts::LabelsStatus(), array('empty' => '-', 'size' => (int) TRUE, 'class' => 'form-control input-large', 'style' => 'width:255px')); ?> </div> </div> <div class="clear"></div> <div class="form-group"> <?php echo CHtml::label(Yii::t('app', 'Могут читать'), 'body', array('class' => 'col-md-3 control-label', 'style' => 'float:left; padding:10px; width: 8%;')); ?> <div class="col-md-9" style = "float:left; padding:10px"> <?php echo CHtml::listBox('filtercanread', array_key_exists('filtercanread', $filter) ? $filter['filtercanread'] : (string) FALSE, BlogPosts::LabelsRead(), array('empty' => '-', 'size' => (int) TRUE, 'class' => 'form-control input-large', 'style' => 'width:255px')); ?> </div> </div> </div> <div class="clear"></div> <div class="form-actions" style = "padding:10px"> <?php echo CHtml::submitbutton(Yii::t('app', 'Применить'), array('name' => 'btn_filter', 'class' => 'btn green', 'onClick' => 'saveFilter()')); ?> <?php echo CHtml::button(Yii::t('app', 'Сбросить фильтр'), array('name' => 'btn_filter', 'class' => 'btn red', 'onClick' => 'location.href="' . $this->createUrl('/admin/blog/index/index') . '"')); ?> </div> </div> </div>