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


PHP Object::className方法代码示例

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


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

示例1: getObject

 /**
  * Relation to \app\models\Object
  * @return \yii\db\ActiveQuery
  */
 public function getObject()
 {
     return $this->hasOne(Object::className(), ['id' => 'object_id']);
 }
开发者ID:cooltheo,项目名称:dotplant2,代码行数:8,代码来源:PropertyGroup.php

示例2: function

    <div class="btn-group pull-right">
    <?php 
echo \yii\helpers\Html::a(Yii::t('app', 'Add'), Url::toRoute(['create', 'parent_id' => 0]), ['class' => 'btn btn-success']);
?>
    <?php 
echo \app\backend\widgets\RemoveAllButton::widget(['url' => Url::toRoute(['remove-all', 'returnUrl' => Yii::$app->request->url]), 'gridSelector' => '.grid-view', 'htmlOptions' => ['class' => 'btn btn-danger']]);
?>
    </div>
<div class="clearfix"></div>
<?php 
$this->endBlock();
?>

<div class="reviews-index">
    <?php 
echo DynaGrid::widget(['options' => ['id' => 'reviews-grid'], 'theme' => 'panel-default', 'gridOptions' => ['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'hover' => true, 'panel' => ['heading' => Html::tag('h3', $this->title, ['class' => 'panel-title']), 'after' => $this->blocks['add-button']]], 'columns' => [['class' => \kartik\grid\CheckboxColumn::className(), 'options' => ['width' => '10px']], 'id', 'author_email', ['attribute' => 'submission.form.name', 'label' => Yii::t('app', 'Form name')], ['attribute' => 'object_id', 'filter' => \app\components\Helper::getModelMap(\app\models\Object::className(), 'id', 'name'), 'label' => Yii::t('app', 'Object'), 'value' => function ($data) {
    $obj = \app\models\Object::findById($data->object_id);
    return is_null($obj) ? Yii::t('yii', '(not set)') : $obj->name;
}], ['class' => yii\grid\DataColumn::className(), 'attribute' => 'object_model_id', 'value' => function ($data) {
    /** @var $object \app\models\Object*/
    if (null !== ($object = \app\models\Object::findById($data->object_id))) {
        $class = $object->object_class;
        $resource = $class::findById($data->object_model_id);
        if (null !== $resource) {
            return $resource->name;
        }
        return null;
    }
}], ['class' => yii\grid\DataColumn::className(), 'attribute' => 'processed_by_user_id', 'value' => function ($data) {
    if (isset($data->submission)) {
        if (null !== $data->submission->processed_by_user_id) {
开发者ID:tqsq2005,项目名称:dotplant2,代码行数:31,代码来源:index.php

示例3: loadDynamicContent

 public function loadDynamicContent($object_id, $route, $selections)
 {
     if (Yii::$app->response->is_prefiltered_page === true) {
         // DynamicContent should not work on prefiltered pages - all needed content is set in corresponding model
         return;
     }
     /**
      * @var $this \yii\web\Controller
      */
     $dynamicCacheKey = 'dynamicCacheKey' . json_encode([$object_id, $route, $selections]);
     if (!($dynamicResult = Yii::$app->cache->get($dynamicCacheKey))) {
         $dynamicResult = [];
         $models = DynamicContent::find()->where(['object_id' => $object_id, 'route' => $route])->all();
         if (isset($selections['properties']) === false) {
             $selections['properties'] = [];
         }
         /**
          * @var $model DynamicContent
          */
         foreach ($models as $model) {
             if (is_integer($model->apply_if_last_category_id) === true && $model->apply_if_last_category_id !== 0) {
                 if (!isset($selections['last_category_id'])) {
                     continue;
                 } elseif ($selections['last_category_id'] != $model->apply_if_last_category_id) {
                     continue;
                 }
             }
             $model_selections = Json::decode($model->apply_if_params);
             $matches = false;
             if (is_array($model_selections) === true) {
                 $matches = true;
                 foreach ($model_selections as $property_id => $value) {
                     if (isset($selections['properties']) === true) {
                         if (isset($selections['properties'][$property_id]) === true) {
                             if ($selections['properties'][$property_id][0] == $value) {
                                 // all ok
                             } else {
                                 $matches = false;
                             }
                         } else {
                             $matches = false;
                             break;
                         }
                     } else {
                         $matches = false;
                         break;
                     }
                 }
                 if ($matches === false) {
                     continue;
                 }
                 if (count($selections['properties']) != count($model_selections)) {
                     $matches = false;
                 }
                 if ($matches === true) {
                     $dynamicResult['model'] = $model;
                     if ($model->title) {
                         $dynamicResult['title'] = $model->title;
                     }
                     if ($model->meta_description) {
                         $dynamicResult['meta_description'] = $model->meta_description;
                     }
                     if ($model->h1) {
                         $dynamicResult['blocks']['h1'] = $model->h1;
                     }
                     if ($model->announce) {
                         $dynamicResult['blocks']['announce'] = $model->announce;
                     }
                     if ($model->content) {
                         $dynamicResult['blocks'][$model->content_block_name] = $model->content;
                     }
                 }
             } else {
                 $matches = true;
             }
         }
         Yii::$app->cache->set($dynamicCacheKey, $dynamicResult, 86400, new TagDependency(['tags' => [ActiveRecordHelper::getCommonTag(DynamicContent::className()), ActiveRecordHelper::getObjectTag(Object::className(), $object_id), $route]]));
     }
     if (is_array($dynamicResult) === true && $dynamicResult !== []) {
         Yii::$app->response->dynamic_content_trait = true;
         Yii::$app->response->matched_dynamic_content_trait_model = $dynamicResult['model'];
         if (isset($dynamicResult['title']) && $dynamicResult['title']) {
             Yii::$app->response->title = $dynamicResult['title'];
         }
         if (isset($dynamicResult['meta_description']) && $dynamicResult['meta_description']) {
             Yii::$app->response->meta_description = $dynamicResult['meta_description'];
         }
         if (isset($dynamicResult['blocks']) && is_array($dynamicResult['blocks'])) {
             foreach ($dynamicResult['blocks'] as $nameBlock => $contentBlock) {
                 Yii::$app->response->blocks[$nameBlock] = $contentBlock;
             }
         }
     }
 }
开发者ID:heartshare,项目名称:dotplant2,代码行数:94,代码来源:DynamicContentTrait.php

示例4:

    </div>
    <?php 
$this->endBlock();
?>

<?php 
$form = ActiveForm::begin(['id' => 'product-form', 'type' => ActiveForm::TYPE_HORIZONTAL, 'options' => ['enctype' => 'multipart/form-data']]);
?>
<div class="review-show">
    <div class="row">
        <article class="col-xs-12 col-sm-6 col-md-6 col-lg-6">
            <?php 
BackendWidget::begin(['title' => Yii::t('app', 'Reviews'), 'icon' => 'pencil', 'footer' => $this->blocks['buttons']]);
?>
            <?php 
echo $form->field($review, 'object_id')->dropDownList(array_merge([0 => ''], Helper::getModelMap(Object::className(), 'id', 'name', true, true)));
?>
            <?php 
/**
 * @TODO: Create link for view/edit object
 */
$_jsDataFunc = <<<'JSCODE'
function (term, page) {
    return {
        search: {term:term.term, object:$('select#review-object_id').val()}
    };
}
JSCODE;
$_jsTemplateResultFunc = <<<'JSCODE'
function (data) {
    if (data.loading) return data.text;
开发者ID:yii2ApplicationCollect,项目名称:dotplant2,代码行数:31,代码来源:edit.php


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