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


PHP Front::drawCheckboxIcon方法代码示例

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


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

示例1: getPropertyValue

 public function getPropertyValue($property, $value)
 {
     $returnValue = "Undefined";
     $list = array();
     foreach ($this->formFields as $field) {
         if ($field->property == $property) {
             if (in_array($field->type, array('select', 'multiSelect'))) {
                 $listMethod = $field->selectType->listMethod;
                 if ($field->selectType->type == 'model') {
                     $selectModel = ModelConfig::fullEntityName($field->selectType->modelName);
                     if ($field->selectType->callMethodOnInstance) {
                         $list = array();
                         /** @var BaseModel $modelName */
                         $modelName = ModelConfig::fullEntityName($field->selectType->modelName);
                         $idField = $field->selectType->callMethodOnInstance->id;
                         $valueField = $field->selectType->callMethodOnInstance->value;
                         $object = $modelName::where($idField, $value)->first();
                         if ($object) {
                             $list[$value] = $object->{$valueField};
                         }
                     } else {
                         //id is passed to the list method so automatic Search can work
                         $list = $selectModel::$listMethod('id');
                     }
                 } else {
                     if ($field->selectType->type == 'list') {
                         $entity = ModelConfig::fullEntityName($this->name);
                         $list = $entity::$listMethod();
                     }
                 }
                 foreach ($list as $actualValue => $frontValue) {
                     if ($actualValue == $value) {
                         $returnValue = $frontValue;
                         break;
                     }
                 }
             } else {
                 if ($field->type == 'checkbox') {
                     $returnValue = $value ? Front::drawCheckboxIcon(true) : Front::drawCheckboxIcon(false);
                 } else {
                     $returnValue = $value;
                 }
             }
             return $returnValue;
             break;
         }
     }
     return $returnValue;
 }
开发者ID:gtcrais,项目名称:gtcms,代码行数:49,代码来源:ModelConfig.php

示例2: getModelConfigFieldValue

 public static function getModelConfigFieldValue($modelConfig, $originalField, BaseModel $object, $currentLanguage = NULL, $returnLabel = false, $export = false)
 {
     $languages = config('gtcmslang.languages');
     if (is_numeric($currentLanguage)) {
         foreach ($languages as $key => $language) {
             if ($key == $currentLanguage) {
                 $lang = $language;
             }
         }
     } else {
         if (!is_null($currentLanguage)) {
             $lang = $languages[$currentLanguage];
         } else {
             $lang = "";
         }
     }
     $field = clone $originalField;
     if (config('gtcms.premium') && $field->langDependent) {
         $field->property .= "_" . $lang;
         $field->label .= " [{$lang}]";
     }
     if ($returnLabel) {
         return $field->label;
     }
     $value = "";
     $displayProperty = $field->displayProperty ? $field->displayProperty : $field->property;
     if (is_object($displayProperty)) {
         if ($displayProperty->type == 'model') {
             $method = $displayProperty->method;
             $relatedProperty = $displayProperty->property;
             if ($object->{$method}()->count()) {
                 if ($displayProperty->multiple) {
                     $relatedModels = $object->{$method}()->withPivot('position')->orderBy('pivot_position', 'asc')->get();
                     $value = "";
                     foreach ($relatedModels as $relModel) {
                         $value .= $relModel->{$relatedProperty} . ", ";
                     }
                     $value = rtrim($value, ", ");
                 } else {
                     $value = $object->{$method}->{$relatedProperty};
                 }
             } else {
                 $value = " - ";
             }
         } else {
             if ($displayProperty->type == 'accessor') {
                 $method = $displayProperty->method;
                 if ($method == 'indexDate' && $export) {
                     $value = $object->getIndexDateAttribute();
                 } else {
                     $value = $object->{$method};
                 }
             } else {
                 if ($displayProperty->type == 'image') {
                     $method = $displayProperty->method;
                     if ($object->{$method}('name')) {
                         if ($displayProperty->display == 'image' && !$export) {
                             $value = "<img style='max-width: 300px; max-height: 300px' src='" . $object->{$method}('url', 'original', $field->property) . "' >";
                         } else {
                             if ($displayProperty->display == 'name' || $export) {
                                 $value = $object->{$method}('name');
                             }
                         }
                     } else {
                         $value = "This " . $modelConfig->hrName . " has no " . $field->label . ".";
                     }
                 } else {
                     if (in_array($displayProperty->type, array('date', 'dateTime'))) {
                         $property = $field->property;
                         $value = $object->formatDate($object->{$property}, $displayProperty->dateFormat ? $displayProperty->dateFormat : $property->dateFormat);
                     } else {
                         if ($displayProperty->type == 'file') {
                             $method = $displayProperty->method;
                             if ($object->{$method}('name')) {
                                 if ($displayProperty->display == 'url' && !$export) {
                                     $value = "<a href='" . $object->{$method}() . "' target='_blank'>" . $object->{$method}('name') . "</a>";
                                 } else {
                                     if ($displayProperty->display == 'name' || $export) {
                                         $value = $object->{$method}('name');
                                     }
                                 }
                             } else {
                                 $value = "This " . $modelConfig->hrName . " has no " . $field->label . ".";
                             }
                         }
                     }
                 }
             }
         }
     } else {
         if ($field->type == 'checkbox') {
             $value = $object->{$displayProperty} ? Front::drawCheckboxIcon(true) : Front::drawCheckboxIcon(false);
         } else {
             $value = $object->{$displayProperty};
         }
     }
     return $value;
 }
开发者ID:gtcrais,项目名称:gtcms,代码行数:98,代码来源:AdminHelper.php


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