本文整理汇总了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']);
}
}
示例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);
}
示例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;
}