Exemple #1
0
 public function init()
 {
     $criteria = new CDbCriteria();
     $criteria->limit = 2;
     $criteria->group = 'id DESC';
     $this->photos = PhotoCategory::model()->findAll($criteria);
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return PhotoCategory the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = PhotoCategory::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 private function loadCategory($id, $slug)
 {
     $model = PhotoCategory::model()->findByAttributes(array('term_id' => (int) $id, 'slug' => $slug));
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
                                'afterFileSelect'=>'function(e, v, m){ alert("afterFileSelect - "+v) }',
                                'onFileAppend'=>'function(e, v, m){ alert("onFileAppend - "+v) }',
                                'afterFileAppend'=>'function(e, v, m){ alert("afterFileAppend - "+v) }',
                                'onFileRemove'=>'function(e, v, m){ alert("onFileRemove - "+v) }',
                                'afterFileRemove'=>'function(e, v, m){ alert("afterFileRemove - "+v) }',
                            ),*/
                        ));
                    } else {
                        echo CHtml::image('/uploads/images/thumbs/'.$model->name, '');
                    } ?>
                    <?= $form->error($model,'image'); ?>
                </div>

                <div class="form-group">
                    <?= $form->labelEx($model,'category_id'); ?>
                    <?= $form->dropDownList($model,'category_id', CHtml::listData(PhotoCategory::model()->findAll(array('order' => 'title_ru ASC')), 'id', 'title_ru'), array('empty'=>'Выберите категорию', 'class'=>'form-control')); ?>
                    <?= $form->error($model,'category_id'); ?>
                </div>
            </div>

            <div class="box-footer">
                <?php echo CHtml::submitButton($model->isNewRecord ? Yii::t('main', 'Добавить') : Yii::t('main', 'Сохранить'), array('class'=>'btn btn-primary')); ?>
            </div>

        </div>
    </div>
    <div class="col-md-6">
        <div class="box box-success">
            <div class="box-header">
                <h3 class="box-title">
                    <?= Yii::t('main', 'Дополнительные настройки'); ?>
 public function listPhotoCategory()
 {
     return CHtml::listData(PhotoCategory::model()->findAll(array('order' => 'name ASC')), 'term_id', 'name');
 }
Exemple #6
0
         </span>
         <?= CHtml::link(Yii::t('main', 'Всі новини з категорії'), array('/site/category', 'alias'=>$category->alias)); ?>
     </div>
 </div>
 <div>
     <div>
         <h1><?= CHtml::link(Yii::t('main', 'Відеозаписи'), array('/site/videos')); ?></h1>
         <?php $news = Video::model()->find(array('order'=>'date DESC', 'condition'=>'category_id != :category_id', 'params'=>array(':category_id'=>11))); ?>
         <span>
             <?= CHtml::link(Yii::app()->language == 'ru' ? $news->title_ru : $news->title_uk, array('/site/videos', 'id'=>$news->id)); ?>
         </span>
         <?= CHtml::link(Yii::t('main', 'Всі новини з категорії'), array('/site/videos')); ?>
     </div>
     <div>
         <h1><?= CHtml::link(Yii::t('main', 'Фоторепортажі'), array('/site/photos')); ?></h1>
         <?php $news = PhotoCategory::model()->find(array('order'=>'date DESC')); ?>
         <span>
             <?= CHtml::link(Yii::app()->language == 'ru' ? $news->title_ru : $news->title_uk, array('/site/photos', 'id'=>$news->id)); ?>
         </span>
         <?= CHtml::link(Yii::t('main', 'Всі новини з категорії'), array('/site/photos')); ?>
     </div>
     <form action="#" class="forSubscribe">
     <div class="input-group">
         <div class="input-addon">@</div>
         <input type="email" class="input" name="url" placeholder="Подписаться..." required>
         <div class="input-addon"><button type="submit"><i class="fa fa-envelope"></i></button></div>
     </div>
     </form>
     <div class="resultSubscribe">
         <p>Вы подписались на рассылку новостей Garmata.tv</p>
     </div>
    /**
     * @param $id
     */
    public function actionNews($id = 1)
    {
        if(isset($_GET['date']))
        {
            $criteria = new CDbCriteria();
            $criteria->distinct = true;
            $criteria->condition='date >= :date_start AND date <= :date_end';
            $criteria->params = array(':date_start'=>$_GET['date'].' 00.00.00', ':date_end'=>$_GET['date'].' 23.59.59');
            $criteria->order = 'date DESC';

            $news = News::model()->findAll($criteria);
            $photoCategories = PhotoCategory::model()->findAll($criteria);
            $videos = Video::model()->findAll($criteria);

            $this->render('allNews', array(
                'news'=>$news,
                'photoCategories'=>$photoCategories,
                'videos'=>$videos,
            ));
        }
        else
        {
            $data = News::model()->findByPk($id);
            $data->views++;
            $data->save();
            $relatedNews = News::model()->findAll(array('condition'=>'category_id = :cat_id AND id NOT IN (:id)', 'params'=>array(':cat_id'=>$data->category_id, ':id'=>$data->id), 'limit'=>20, 'order'=>'date Desc'));
            $this->render('news', array('data'=>$data, 'relatedNews'=>$relatedNews));
        }
    }
      
	
	<?php 
echo $form->textFieldRow($model, 'name', array('class' => 'span12'));
?>
	<p class='muted'>Nama Yang akan tampil</p><hr>
	
	<?php 
echo $form->textFieldRow($model, 'slug', array('class' => 'span12'));
?>
	<p class=' muted'>'slug' adalah versi URL dari nama.
Dalam hal ini berupa huruf kecil semua dan hanya mengandung huruf,
angka, dan tanda (-). <br>(Jika Kosong maka akan di isi otomatis.)</p><hr>
	
	 <?php 
echo $form->dropDownListRow($model, 'parent', PhotoCategory::makeDropDown(), array('empty' => '-- none --'));
?>
	 <p class='muted'>
		Kategori dapat memiliki hirarki.
		Contoh anda memiliki kategori Musik,
		dan kategori tersebut memiliki anak kategori yaitu Rock dan
		Metal.<br> (Kosongkan jika tidak mempunyai hirarki)
		
	 </p><hr>
	
	
        <?php 
echo $form->textAreaRow($model, 'description', array('class' => 'span12', 'rows' => '3'));
?>
        <hr>
	
 public function init()
 {
     $this->model = PhotoCategory::model()->findAll(array('order' => 'date DESC', 'limit' => 12, 'select' => 'name_ru, name_uk, id, image'));
 }
<p>
	You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>
		&lt;&gt;</b>
	or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
</p>


<?php 
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('action' => Yii::app()->createUrl($this->route), 'method' => 'get'));
echo $form->textFieldRow($model, 'post_name', array('class' => 'span5', 'maxlength' => 255));
echo $form->dropDownListRow($model, 'authorSearch', $this->listUser('author'), array('class' => 'span3', 'prompt' => ''));
echo $form->dropDownListRow($model, 'editorSearch', $this->listUser('editor'), array('class' => 'span3', 'prompt' => ''));
echo $form->dropDownListRow($model, 'categorySearch', Category::makeDropDown(), array('class' => 'span3', 'prompt' => ''));
echo $form->dropDownListRow($model, 'photocategorySearch', PhotoCategory::makeDropDown(), array('class' => 'span3', 'prompt' => ''));
?>
 
<?php 
echo $form->dropDownListRow($model, 'tagSearch', Tag::makeList(), array('class' => 'span3', 'prompt' => ''));
echo $form->dropDownListRow($model, 'post_status', $this->listAllStatus(), array('class' => 'span3', 'prompt' => ''));
?>

<?php 
/*echo $form->datepickerRow($model,'post_date',
         array('options'=>array('format' => 'yyyy-mm-dd','viewformat' => 'yyyy-mm-dd')),
  array('prepend' => '<i class="icon-calendar"></i>',)); */
echo $form->datepickerRow($model, 'post_modified', array('options' => array('format' => 'yyyy-mm-dd', 'viewformat' => 'yyyy-mm-dd')), array('prepend' => '<i class="icon-calendar"></i>'));
?>

<?php 
echo $form->textFieldRow($model, 'post_hits', array('class' => 'span2'));
?>
 public function actionPhotos($id = null)
 {
     if (isset($_GET['id'])) {
         $criteria = new CDbCriteria();
         $criteria->condition = 'category_id = :category_id';
         $criteria->params = array(':category_id' => $id);
         $category = PhotoCategory::model()->findByPk($id);
         $photos = Photo::model()->findAll($criteria);
         $data = new CActiveDataProvider('PhotoCategory', array('criteria' => array('order' => 'id DESC'), 'sort' => false, 'pagination' => array('pageSize' => 24)));
         $this->rightReclameId = 23;
         $this->render('single_album', array('photos' => $photos, 'data' => $data, 'category' => $category));
     } else {
         $data = new CActiveDataProvider('PhotoCategory', array('criteria' => array('order' => 'id DESC'), 'sort' => false, 'pagination' => array('pageSize' => 39)));
         $this->rightReclameId = 46;
         $this->render('albums', array('data' => $data));
     }
 }
Exemple #12
0
</label>
            <?php 
if ($model->isNewRecord) {
    $this->widget('CMultiFileUpload', array('name' => 'images', 'accept' => 'jpeg|jpg|gif|png'));
} else {
    echo CHtml::image('/uploads/images/thumbs/' . $model->name, '');
}
?>
        </div>

        <div class="row">
            <?php 
echo $form->labelEx($model, 'category_id');
?>
            <?php 
echo $form->dropDownList($model, 'category_id', CHtml::listData(PhotoCategory::model()->findAll(array('order' => 'name_ru ASC')), 'id', 'name_ru'), array('empty' => 'Выберите категорию'));
?>
            <?php 
echo $form->error($model, 'category_id');
?>
        </div>

        <div class="row">
            <?php 
echo $form->labelEx($model, 'description_ru');
?>
            <?php 
echo $form->textField($model, 'description_ru', array('maxlength' => 255));
?>
            <?php 
echo $form->error($model, 'description_ru');
 public function actionVideo($id = null)
 {
     $criteria = new CDbCriteria();
     $criteria->limit = 2;
     $criteria->group = 'id DESC';
     $photos = PhotoCategory::model()->findAll($criteria);
     if (isset($id)) {
         $criteria = new CDbCriteria();
         $criteria->group = 'id DESC';
         $criteria->limit = 3;
         $criteria->condition = 'region_id = 12 OR region_id = 0';
         $news = News::model()->findAll($criteria);
         $video = Video::model()->findByPk($id);
         $videos = Video::model()->findAll(array('limit' => 4));
         $this->render('singleVideo', array('video' => $video, 'photos' => $photos, 'videos' => $videos, 'news' => $news));
     } else {
         $data = new CActiveDataProvider('Video', array('criteria' => array('order' => 'id DESC'), 'sort' => false, 'pagination' => array('pageSize' => 6)));
         $this->render('video', array('data' => $data, 'photos' => $photos));
     }
 }
    public function actionMoreAllPhotos()
    {

        $criteria = new CDbCriteria();
        $criteria->offset = $_POST['count'];
        $criteria->limit = 3;
        $criteria->order = 'date DESC';

        if(isset($_POST['category'])) {
            $criteria->condition = 'category_id = :cat';
            $criteria->params = array(':cat'=>$_POST['category']);
        }

        if(!empty($_POST['date'])){
            $criteria->distinct = true;
            $criteria->condition='date >= :date_start AND date <= :date_end';
            $criteria->params = array(':date_start'=>$_GET['date'].' 00.00.00', ':date_end'=>$_GET['date'].' 23.59.59');
            $criteria->order = 'date DESC';
        }

        $photoCategories = PhotoCategory::model()->findAll($criteria);
        $this->renderPartial('moreAllPhotos', array('photoCategories'=>$photoCategories));
    }
<?php

$this->breadcumbs();
?>
	
<h3>Lihat : <?php 
echo $model->post_name;
?>
</h3>
<?php 
$this->alert();
$webUrl = Yii::app()->FrontUrl->createUrl('/photo/index/', array('id' => $model->ID, 'slug' => $model->post_link));
$mobileUrl = Yii::app()->FrontMobileUrl->createUrl('/photo/index/', array('id' => $model->ID, 'slug' => $model->post_link));
$link = "Web Url : " . $webUrl . " - " . CHtml::Link('Go to Link', $webUrl) . "<br>";
$link .= frontendMobileUrl == '' ? "" : "Mobile url : " . $mobileUrl . " - " . CHtml::Link('Go to Link', $mobileUrl);
$this->widget('bootstrap.widgets.TbDetailView', array('data' => $model, 'attributes' => array('ID', 'post_name', 'post_title', array('name' => 'post_link', 'type' => 'raw', 'value' => $link), array('name' => 'photometa.photo', 'type' => 'raw', 'value' => array($this, 'Photometa')), array('name' => 'post_excerpt', 'type' => 'raw'), array('name' => 'post_content', 'type' => 'raw'), 'post_source', 'post_source_link', array('name' => 'post_status', 'type' => 'raw', 'value' => array($this, 'Status')), array('label' => 'Author', 'name' => 'authors.username'), array('label' => 'Editor', 'name' => 'editors.username'), array('name' => 'tags.name', 'type' => 'raw', 'value' => Tag::makeValue($model)), array('label' => 'Category', 'type' => 'raw', 'value' => Category::makeValue($model)), array('label' => 'Category Photo', 'type' => 'raw', 'value' => PhotoCategory::makeValue($model)), 'post_created', 'post_modified', 'post_meta_key', 'post_meta_desc')));
 public function init()
 {
     $this->model = PhotoCategory::model()->findAll(array('order'=>'date DESC', 'limit'=>4, 'select'=>'title_ru, views, title_uk, id, image, category_id, short_uk, short_ru, date, reclame'));
 }
<?php

return array(array('header' => '#', 'value' => '$this->grid->dataProvider->pagination->currentPage * $this->grid->dataProvider->pagination->pageSize + ($row+1)', 'htmlOptions' => array('style' => 'width:30px;')), array('name' => 'name', 'type' => 'raw', 'value' => '$data->parent != 0 ?
		       $data->selfParent->name ." <i class=\'fa fa-angle-double-right\'></i> ". $data->name."<br><small class=muted>Slug : ".$data->slug." | ".count($data->photos)." Posts</small>":
		       $data->name."<br><small class=muted>Slug : ".$data->slug." | ".count($data->photos)." Posts</small>"'), array('name' => 'parent', 'type' => 'raw', 'filter' => PhotoCategory::makeDropDown(), 'value' => '$data->parent != 0 ? "<span class=muted>".$data->selfParent->name."</span>" : "<span class=\'muted\'>---</span>"'));
<?php

return array(array('value' => '$this->grid->dataProvider->pagination->currentPage * $this->grid->dataProvider->pagination->pageSize + ($row+1)', 'htmlOptions' => array('style' => 'width:20px;')), array('name' => 'post_name', 'type' => 'raw', 'value' => array($this, 'Post')), array('name' => 'photocategorySearch', 'filter' => PhotoCategory::makeDropDown(), 'type' => 'raw', 'value' => 'PhotoCategory::makeValue($data)'), array('name' => 'categorySearch', 'filter' => Category::makeDropDown(), 'type' => 'raw', 'value' => 'Category::makeValue($data)'), array('name' => 'post_status', 'filter' => array('draft' => 'Draft', 'publish' => 'Publish'), 'type' => 'raw', 'value' => array($this, 'Status'), 'htmlOptions' => array('style' => 'width:100px;')));