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


PHP AdminHelper::modelExists方法代码示例

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


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

示例1: fullEntityName

 public static function fullEntityName($entity, $namespace = false)
 {
     if ($namespace) {
         return $namespace . "\\" . $entity;
     } else {
         $modelConfig = AdminHelper::modelExists($entity);
         if ($modelConfig) {
             return $modelConfig->myFullEntityName();
         }
     }
     Dbar::error("ModelConfig for " . $entity . "doesn't exist!");
     return "";
 }
开发者ID:gtcrais,项目名称:gtcms,代码行数:13,代码来源:ModelConfig.php

示例2: addHistoryLink

 public static function addHistoryLink($link = false, $modelName = false, $ignoreRequestForModelName = false)
 {
     if (\Session::has('adminHistoryLinks')) {
         $links = \Session::get('adminHistoryLinks');
     } else {
         $links = array();
     }
     if (!$link) {
         $url = explode('?', $_SERVER["REQUEST_URI"]);
         $link = array_shift($url) . Tools::getGets();
     }
     if (!$modelName) {
         $modelName = \Request::segment(2);
     }
     $linkSegments = explode("/", $link);
     $action = isset($linkSegments[3]) ? $linkSegments[3] : false;
     $addLink = isset($linkSegments[4]) && $linkSegments[4] == "new" ? true : false;
     $tempLinks = $links;
     if (count($links)) {
         $delete = false;
         foreach ($links as $index => $cLink) {
             // If ModelName and Action already exist in history, it means we're going back
             // therefore delete all history links AFTER the current history link
             // and replace current history with the newly modified one
             if ($cLink['modelConfigName'] == $modelName && $cLink['action'] == $action) {
                 $delete = true;
                 // Skip this iteration because this is the link we're going back to
                 continue;
             }
             // Delete all links after the one we're going back to
             if ($delete) {
                 unset($tempLinks[$index]);
             }
         }
         if ($delete) {
             \Session::put('adminHistoryLinks', $tempLinks);
             // There is no need to insert the current link because it already exists
             // so just return
             return;
         }
     }
     $modelConfig = AdminHelper::modelExists($modelName);
     if ($ignoreRequestForModelName) {
         $returnModelName = $modelConfig ? $modelConfig->hrName : $modelName;
     } else {
         $returnModelName = $modelConfig ? count(\Request::segments()) > 2 && \Request::segment(3) == 'edit' ? $modelConfig->hrName : $modelConfig->hrNamePlural : $modelName;
     }
     $links[] = array('link' => $link, 'action' => $action, 'addLink' => $addLink, 'modelConfigName' => $modelConfig ? $modelConfig->name : $modelName, 'modelName' => $returnModelName, 'modelIcon' => $modelConfig && $modelConfig->faIcon ? $modelConfig->faIcon : 'fa-circle');
     \Session::put('adminHistoryLinks', $links);
 }
开发者ID:gtcrais,项目名称:gtcms,代码行数:50,代码来源:AdminHistoryManager.php

示例3: foreach

<div class="col-lg-6">

	@foreach ($modelConfig->relatedModels as $relatedModel)
		<?php 
$displayModel = true;
if ($modelConfig->reverseConstrainingModels) {
    foreach ($modelConfig->reverseConstrainingModels as $constraint) {
        if (method_exists($object, $constraint) && $object->{$constraint}->count()) {
            $displayModel = false;
            break;
        }
    }
}
$method = $relatedModel->method;
$relatedModelConfig = AdminHelper::modelExists($relatedModel->name);
$gets = Tools::getGets(array($modelConfig->id => $object->id ? $object->id : "new_gtcms_entry"));
$configInParent = $object->relatedModelConfiguration($relatedModelConfig->name);
GtcmsPremium::setDisplayRelatedModelBasedOnModelKey($configInParent, $object, $displayModel);
?>
		@if ($displayModel)

			<div class="panel panel-default">
				<div class="panel-body">
					<?php 
// --------------- EXCEPTIONS ----------------
$addObject = true;
?>
					@if ($addObject)
						<div class="indexTableHeader">
							<a href="/admin/{{$relatedModelConfig->name}}/add{{$gets}}&addToParent=true" class="btn btn-primary btn-sm addRelatedObject">
								<i class="fa fa-plus-circle"></i> {{$relatedModelConfig->hrName}}
开发者ID:gtcrais,项目名称:gtcms,代码行数:31,代码来源:editContentRelatedModels.blade.php

示例4: modelConfig

 public function modelConfig()
 {
     $reflection = new \ReflectionClass($this);
     $class = $reflection->getShortName();
     $modelConfig = AdminHelper::modelExists($class);
     return $modelConfig;
 }
开发者ID:gtcrais,项目名称:gtcms,代码行数:7,代码来源:BaseModel.php

示例5: modelImageMinDimensions

 public static function modelImageMinDimensions()
 {
     if (!empty($_GET)) {
         $parentProperty = false;
         foreach ($_GET as $requiredParent => $parentId) {
             $parentProperty = $requiredParent;
             break;
         }
         if ($parentModelConfig = AdminHelper::modelExists($parentProperty, 'id')) {
             if ($parentModelConfig->imageSizes) {
                 $parentModelConfig = AdminHelper::modelExists($parentProperty, 'id');
                 if (config('gtcms.premium') && $parentModelConfig->keyBasedSizes) {
                     $sizes = GtcmsPremium::getKeyBasedImageSizes($parentModelConfig);
                 } else {
                     $sizes = $parentModelConfig->imageSizes;
                 }
                 if ($sizes) {
                     $size = false;
                     foreach ($sizes as $size) {
                         break;
                     }
                     $size = AdminHelper::objectToArray($size);
                     $minWidth = $size[0];
                     $minHeight = $size[1];
                     $manipulationType = $size[2];
                     return array($minWidth, $minHeight, $manipulationType);
                 } else {
                     return false;
                 }
             } else {
                 return false;
             }
         }
         return false;
     } else {
         return false;
     }
 }
开发者ID:gtcrais,项目名称:gtcms,代码行数:38,代码来源:AdminHelper.php

示例6:

								@endif
							</div>
						@endforeach
					</div>
				@else
					<?php 
$index = 0;
?>
					@if (config('gtcms.premium') && $modelConfig->tabbedLanguageFields)
						@include('gtcms.admin.elements.premium.tabbedLanguageFields')
					@else
						<?php 
$fieldType = 'all';
$ignoreLanguageIterations = false;
$hideSave = false;
$modelConfig = AdminHelper::modelExists($modelConfig->name);
?>
						@include("gtcms.admin.elements.editContentFormFields")
					@endif
				@endif

			</div>
		</div>

		{{Form::close()}}
	</div>

	@if (!$quickEdit && !empty($modelConfig->relatedModels))

		@include("gtcms.admin.elements.editContentRelatedModels")
开发者ID:gtcrais,项目名称:gtcms,代码行数:30,代码来源:editContent.blade.php

示例7: process

 public static function process($modelConfig, $imageFields, $parentProperty)
 {
     $imageData = array();
     $counter = 0;
     foreach ($imageFields as $imageField) {
         $imageData[$counter]['property'] = $imageField->property;
         if (\Request::hasFile($imageField->property)) {
             $ext = \Request::file($imageField->property)->getClientOriginalExtension();
             if (!in_array(strtolower($ext), array('jpg', 'jpeg', 'gif', 'png'))) {
                 throw new \Exception("File is not an image");
             } else {
                 $basePath = public_path() . "/img/modelImages/" . $modelConfig->name . "/";
                 $dirs = [public_path("img"), public_path("img/modelImages"), public_path("img/modelImages/" . $modelConfig->name), public_path("img/modelImages/" . $modelConfig->name . "/original"), public_path("img/modelImages/" . $modelConfig->name . "/gtcmsThumb")];
                 foreach ($dirs as $dir) {
                     if (!is_dir($dir)) {
                         mkdir($dir, 0755);
                     }
                 }
                 //here check if file exists
                 do {
                     $name = str_random(32) . "." . $ext;
                 } while (file_exists($basePath . "original/" . $name));
                 //end check
                 //copy the image to the original folder
                 \Image::make(\Request::file($imageField->property)->getRealPath())->save($basePath . "original/" . $name);
                 $img = \Image::make($basePath . "original/" . $name);
                 if ($parentProperty && $modelConfig->name == 'ModelImage') {
                     $parentModelConfig = AdminHelper::modelExists($parentProperty, 'id');
                     if (config('gtcms.premium') && $parentModelConfig->keyBasedSizes) {
                         $sizes = GtcmsPremium::getKeyBasedImageSizes($parentModelConfig);
                     } else {
                         $sizes = $parentModelConfig->imageSizes;
                     }
                 } else {
                     $sizes = $imageField->sizes;
                 }
                 if (!$sizes) {
                     throw new \Exception("Sizes not found!");
                 }
                 // Get the first size, which has the min/max dimensions
                 foreach ($sizes as $size) {
                     break;
                 }
                 $size = AdminHelper::objectToArray($size);
                 $minWidth = $size[0];
                 $minHeight = $size[1];
                 $transformMethod = $size[2];
                 if (in_array($transformMethod, array('resizeCanvas', 'resize'))) {
                     if ($img->width() < $minWidth && $img->height() < $minHeight) {
                         throw new \Exception(trans('gtcms.imageTooSmall'), self::DIM_ERROR);
                     }
                 }
                 if (in_array($transformMethod, array('minWidth'))) {
                     if ($img->width() < $minWidth) {
                         throw new \Exception(trans('gtcms.imageTooSmall'), self::DIM_ERROR);
                     }
                 }
                 if (in_array($transformMethod, array('minHeight'))) {
                     if ($img->height() < $minHeight) {
                         throw new \Exception(trans('gtcms.imageTooSmall'), self::DIM_ERROR);
                     }
                 } else {
                     if ($img->width() < $minWidth || $img->height() < $minHeight) {
                         throw new \Exception(trans('gtcms.imageTooSmall'), self::DIM_ERROR);
                     }
                 }
                 $returnFolder = 'gtcmsThumb';
                 $gtcmsSize = array(80, 80, 'resizeCanvas', 'gtcmsThumb', 100);
                 $sizes = AdminHelper::objectToArray($sizes);
                 array_unshift($sizes, $gtcmsSize);
                 foreach ($sizes as $size) {
                     $newImg = clone $img;
                     $size = AdminHelper::objectToArray($size);
                     if (!is_dir($basePath . $size[3])) {
                         mkdir($basePath . $size[3], 0755);
                     }
                     if ($size[2] == 'crop') {
                         $newImg->fit($size[0], $size[1])->save($basePath . $size[3] . "/" . $name, $size[4]);
                     } else {
                         if (in_array($size[2], array('resize', 'minWidth', 'minHeight'))) {
                             $newImg->resize($size[0], $size[1], function ($constraint) {
                                 $constraint->aspectRatio();
                                 $constraint->upsize();
                             })->save($basePath . $size[3] . "/" . $name, $size[4]);
                         } else {
                             if ($size[2] == 'resizeCanvas') {
                                 $newImg->resize($size[0], null, function ($constraint) {
                                     $constraint->aspectRatio();
                                     $constraint->upsize();
                                 });
                                 $newImg->resize(null, $size[1], function ($constraint) {
                                     $constraint->aspectRatio();
                                     $constraint->upsize();
                                 });
                                 if ($newImg->width() < $size[0] || $newImg->height() < $size[1]) {
                                     $newImg = \Image::canvas($size[0], $size[1], '#FFFFFF')->insert($newImg, 'center');
                                 }
                                 $newImg->save($basePath . $size[3] . "/" . $name, $size[4]);
                             } else {
                                 $newImg->save($basePath . $size[3] . "/" . $name, $size[4]);
//.........这里部分代码省略.........
开发者ID:gtcrais,项目名称:gtcms,代码行数:101,代码来源:ImageHandler.php


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