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


PHP Gallery::with方法代码示例

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


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

示例1: getAllProperties

 protected function getAllProperties()
 {
     $propertiesModel = new \User2property();
     $userId = Yii::app()->user->getState('id');
     $propertiesLinks = $propertiesModel->with('property')->findAllByAttributes(array('userId' => $userId));
     //Delete deleted properties
     foreach ($propertiesLinks as $key => $link) {
         if ($link->property->getAttribute('isdeactivated') == 1) {
             unset($propertiesLinks[$key]);
         }
     }
     //Formating data
     foreach ($propertiesLinks as $key => $propertiLink) {
         $this->properties[$key] = $propertiLink->getAttributes();
         $this->properties[$key]['property'] = $propertiLink->property->getAttributes();
         $this->properties[$key]['property']['members'] = array();
         $this->properties[$key]['property']['guests'] = array();
         foreach ($propertiLink->property->user2properties as $index => $link) {
             if ($link->getAttribute('access') <= \UserAccessTable::BASIC_ACCESS) {
                 $this->properties[$key]['property']['members'][$index] = $link->getAttributes();
             } else {
                 $this->properties[$key]['property']['guests'][$index] = $link->getAttributes();
             }
         }
         $this->properties[$key]['property']['members_count'] = count($this->properties[$key]['property']['members']);
         $this->properties[$key]['property']['guests_count'] = count($this->properties[$key]['property']['guests']);
         $galleryModel = new Gallery();
         $primaryImage = $galleryModel->with('file')->findByAttributes(array('propertyid' => $this->properties[$key]['property']['id']), array('order' => 't.index'));
         if ($primaryImage) {
             $this->properties[$key]['property']['minimage'] = basePath('propertyfile/') . $primaryImage->file->getAttribute('systempath') . '?propertyid=' . $this->properties[$key]['property']['id'] . "&thumb=true";
             $this->properties[$key]['property']['image'] = basePath('propertyfile/') . $primaryImage->file->getAttribute('systempath') . '?propertyid=' . $this->properties[$key]['property']['id'];
         } else {
             $this->properties[$key]['property']['minimage'] = basePath('images/property-placeholder.png');
             $this->properties[$key]['property']['image'] = basePath('images/property-placeholder.png');
         }
         $this->properties[$key]['access_name'] = UserAccessTable::accessLevelToString($this->properties[$key]['access']);
     }
 }
开发者ID:salem-dev-acc,项目名称:yiiapp,代码行数:38,代码来源:SharedKeyAppController.php

示例2: get_index

 public function get_index()
 {
     $galleries = Gallery::with('organisations')->order_by('sort_order', 'asc')->get();
     return View::make('user.galleries.galleries')->with('galleries', $galleries);
 }
开发者ID:shainmcalindon,项目名称:boothsgardenstudios,代码行数:5,代码来源:galleries.php

示例3: getImages

 protected function getImages()
 {
     $model = new Gallery();
     $property_id = Yii::app()->user->getState('property_id');
     $images = $model->with('file')->findAllByAttributes(array('propertyid' => $property_id), array('order' => 't.index'));
     $resultData = array();
     foreach ($images as $key => $image) {
         $resultData[$key] = (array) $image->getAttributes();
         $resultData[$key]['file'] = (array) $image->file->getAttributes();
     }
     return $resultData;
 }
开发者ID:salem-dev-acc,项目名称:yiiapp,代码行数:12,代码来源:GalleryController.php


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