当前位置: 首页>>代码示例>>PHP>>正文


PHP Gallery::model方法代码示例

本文整理汇总了PHP中Gallery::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Gallery::model方法的具体用法?PHP Gallery::model怎么用?PHP Gallery::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gallery的用法示例。


在下文中一共展示了Gallery::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getGallery

 /** @return Gallery Returns gallery associated with model */
 public function getGallery()
 {
     if (empty($this->_gallery)) {
         $this->_gallery = Gallery::model()->findByPk($this->getOwner()->{$this->idAttribute});
     }
     return $this->_gallery;
 }
开发者ID:lidijakralj,项目名称:bober,代码行数:8,代码来源:GalleryBehavior.php

示例2: actionShow

 public function actionShow($id)
 {
     $model = Gallery::model()->findByPk((int) $id);
     if (is_null($model)) {
         throw new CHttpException(404, Yii::t('gallery', 'Страница не найдена!'));
     }
     $image = new Image();
     if (Yii::app()->request->isPostRequest && isset($_POST['Image'])) {
         $transaction = Yii::app()->db->beginTransaction();
         try {
             $image = $image->create($_POST['Image']);
             if (!$image->hasErrors()) {
                 if ($model->addImage($image)) {
                     Yii::app()->user->setFlash(YFlashMessages::NOTICE_MESSAGE, Yii::t('gallery', 'Фотография добавлена!'));
                 }
                 $transaction->commit();
                 $this->redirect(array('/gallery/gallery/show/', 'id' => $model->id));
             }
             throw new CDbException(Yii::t('gallery', 'При добавлении изображения произошла ошибка!'));
         } catch (Exception $e) {
             $transaction->rollback();
             Yii::app()->user->setFlash(YFlashMessages::ERROR_MESSAGE, Yii::t('gallery', $e->getMessage()));
         }
     }
     $dataProvider = new CActiveDataProvider('ImageToGallery', array('criteria' => array('condition' => 'galleryId = :galleryId', 'params' => array(':galleryId' => $model->id), 'limit' => self::GALLERY_PER_PAGE, 'order' => 't.creation_date DESC', 'with' => 'image'), 'pagination' => array('pageSize' => self::GALLERY_PER_PAGE)));
     $this->render('show', array('image' => $image, 'model' => $model, 'dataProvider' => $dataProvider));
 }
开发者ID:RSol,项目名称:yupe,代码行数:27,代码来源:GalleryController.php

示例3: actionView

 /**
  * @param $id
  * @throws CDbException
  * @throws CHttpException
  */
 public function actionView($id)
 {
     if (($gallery = Gallery::model()->published()->findByPk($id)) === null) {
         throw new CHttpException(404, Yii::t('GalleryModule.gallery', 'Page was not found!'));
     }
     $image = new Image();
     if (Yii::app()->getRequest()->getIsPostRequest() && !empty($_POST['Image'])) {
         try {
             $transaction = Yii::app()->db->beginTransaction();
             $image->attributes = $_POST['Image'];
             if ($image->save() && $gallery->addImage($image)) {
                 $transaction->commit();
                 Yii::app()->user->setFlash(yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, Yii::t('GalleryModule.gallery', 'Photo was created!'));
                 $this->redirect(['/gallery/gallery/view', 'id' => $gallery->id]);
             }
         } catch (Exception $e) {
             $transaction->rollback();
             Yii::app()->user->setFlash(yupe\widgets\YFlashMessages::ERROR_MESSAGE, $e->getMessage());
         }
     }
     if ($gallery->status == Gallery::STATUS_PRIVATE && $gallery->owner != Yii::app()->user->id) {
         throw new CHttpException(404);
     }
     $this->render('view', ['image' => $image, 'model' => $gallery]);
 }
开发者ID:alextravin,项目名称:yupe,代码行数:30,代码来源:GalleryController.php

示例4: actionIndex

 public function actionIndex()
 {
     $criteria = new CDbCriteria();
     $criteria->condition = "status = 1";
     $criteria->order = "sort_order asc,gallery_id asc";
     $model = Gallery::model()->findAll($criteria);
     $this->render('index', array('gallery' => $model));
 }
开发者ID:ultr4h4ck,项目名称:project_gspa,代码行数:8,代码来源:GalleryController.php

示例5: actionView

 /**
  * Index Page, for now just render all static content.
  */
 public function actionView($id)
 {
     $gallery = Gallery::model()->with('galleryImages')->findByPk($id);
     if (empty($gallery)) {
         $gallery = new Gallery();
     }
     $this->render('view', array('gallery' => $gallery));
 }
开发者ID:CNAEF,项目名称:go9999_v2,代码行数:11,代码来源:GalleryController.php

示例6: loadModel

 public function loadModel($id)
 {
     $model = Gallery::model()->findByPk($id);
     if (!$model) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:mmorpg2015,项目名称:ghtweb5,代码行数:8,代码来源:GalleryController.php

示例7: actionIndex

 public function actionIndex()
 {
     $dependency = new CDbCacheDependency('SELECT MAX(UNIX_TIMESTAMP(updated_at)), COUNT(0) FROM {{gallery}} WHERE status = :status');
     $dependency->params = array('status' => ActiveRecord::STATUS_ON);
     $model = Gallery::model()->cache(3600 * 24, $dependency, 2)->opened();
     $dataProvider = new CActiveDataProvider($model, array('criteria' => array('order' => 'sort'), 'pagination' => array('pageSize' => (int) config('gallery.limit'), 'pageVar' => 'page')));
     $this->render('//gallery', array('dataProvider' => $dataProvider));
 }
开发者ID:mmorpg2015,项目名称:ghtweb5,代码行数:8,代码来源:DefaultController.php

示例8: LoadGallery

 public static function LoadGallery($id)
 {
     $id = _xls_number_only($id);
     if ($id > 1000) {
         $id = 1000;
     }
     $gallery = Gallery::model()->findByPk($id);
     if (!$gallery) {
         $gallery = new Gallery();
         $gallery->id = $id;
         $gallery->name = true;
         $gallery->description = true;
         $gallery->versions = array('small' => array('resize' => array(200, null)), 'medium' => array('resize' => array(800, null)));
         $gallery->save();
     }
     return $gallery;
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:17,代码来源:Gallery.php

示例9: run

 public function run()
 {
     if (Yii::app()->request->isAjaxRequest && isset($_GET['q'])) {
         $title = Yii::app()->request->getParam('q', '');
         $limit = Yii::app()->request->getParam('limit', 50);
         $limit = min($limit, 50);
         $criteria = new CDbCriteria();
         $criteria->condition = "title LIKE :sterm";
         $criteria->params = array(":sterm" => "%{$title}%");
         $criteria->limit = $limit;
         $array = Gallery::model()->findAll($criteria);
         $result = '';
         foreach ($array as $val) {
             $result .= $val->getAttribute('title') . '|' . $val->getAttribute('id') . "\n";
         }
         echo $result;
     }
 }
开发者ID:BGCX261,项目名称:zoomtyre-svn-to-git,代码行数:18,代码来源:ajaxAutocompleteGalleriesAction.php

示例10: foreach

echo $getTranslateWorld['gallery'];
?>
</h1>
                    <div id="slider_container" style="position:relative;margin:0 auto;top:0px;left:0px;width:800px;height:456px;background:#191919;">
                        <div u="loading" style="position:absolute;top:0px;left:0px;">
                            <div style="filter:alpha(opacity=70);opacity:0.7;position:absolute;display:block;background-color:#000000;top:0px;left:0px;width:100%;height:100%;">
                            </div>
                            <div style="position:absolute;display:block;background:url(<?php 
echo Yii::app()->request->baseUrl;
?>
/css/xeon/img/loading.gif) no-repeat center center;top:0px;left:0px;width:100%;height:100%;">
                            </div>
                        </div>
                        <div u="slides" style="cursor:move;position:absolute;left:0px;top:0px;width:800px;height:356px;overflow:hidden;">
                            <?php 
$gallery = Gallery::model()->findAll();
if (!empty($gallery)) {
    foreach ($gallery as $key => $value) {
        ?>
                                    <div>
                                        <a href=''><img u = "image" src = "<?php 
        echo Yii::app()->request->baseUrl . '/css/xeon/images/gallery/' . $value->image_big;
        ?>
"></a>
                                        <img u = "thumb" src = "<?php 
        echo Yii::app()->request->baseUrl . '/css/xeon/images/gallery/' . $value->image_small;
        ?>
">
                                    </div>
                                    <?php 
    }
开发者ID:abaritci,项目名称:worlds-travel.dev,代码行数:31,代码来源:main.php

示例11: loadModel

 /**
  * Возвращает модель по указанному идентификатору
  * Если модель не будет найдена - возникнет HTTP-исключение.
  *
  * @param integer идентификатор нужной модели
  *
  * @return Gallery $model
  *
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     if (($model = Gallery::model()->findByPk($id)) === null) {
         throw new CHttpException(404, Yii::t('GalleryModule.gallery', 'Requested page was not found.'));
     }
     return $model;
 }
开发者ID:alextravin,项目名称:yupe,代码行数:17,代码来源:GalleryBackendController.php

示例12: getSelectedGallery

 public static function getSelectedGallery($id)
 {
     return Gallery::model()->findByPk($id);
 }
开发者ID:xPashaNx,项目名称:diet,代码行数:4,代码来源:Gallery.php

示例13: getGalleryList

 public function getGalleryList()
 {
     $result = array();
     if ($galleries = Gallery::model()->findAll()) {
         foreach ($galleries as $gallery) {
             $result[$gallery->id] = $gallery->title;
         }
     }
     return $result;
 }
开发者ID:xPashaNx,项目名称:diet,代码行数:10,代码来源:GalleryConfig.php

示例14: getGallery

 public static function getGallery($id)
 {
     return !empty($id) ? Gallery::model()->with('photos')->findByPk($id) : new Gallery();
 }
开发者ID:andreyantonov78,项目名称:atmosphera,代码行数:4,代码来源:Portfolio.php

示例15: loadGallery

 /**
  * Load model for our gallery.
  * Sets @var $this->gmodel.
  * Sets order of pictures
  * Sets @var $this->imgsOrder.
  */
 public function loadGallery()
 {
     $this->gmodel = Gallery::model()->find(array('condition' => "pid='{$this->pid}'"));
     $this->imgsOrder = unserialize($this->gmodel->imgsOrder);
 }
开发者ID:rjuppa,项目名称:viral_startup,代码行数:11,代码来源:FBGallery.php


注:本文中的Gallery::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。