コード例 #1
0
ファイル: _form.php プロジェクト: dlds/yii2-giixer
echo $generator->helperCrud->getClassid(CrudHelper::RK_MODEL_CM);
?>
-form">

    <?php 
echo "<?php ";
?>
$form = ActiveForm::begin(); ?>

    <?php 
echo "<?= GxFlashHelper::alertValidation(\$model) ?>";
?>

    <?php 
if ($generator->generateMutation) {
    echo "<?=\n    \$form->field(\$model, " . ModelHelper::root($generator->helperModel->getClass(ModelHelper::RK_MODEL_CM)) . "::" . sprintf('%s%s', \dlds\giixer\Module::RELATION_NAME_PREFIX, strtoupper(Inflector::pluralize($generator->mutationSourceTableName))) . ")->widget(dlds\\rels\\widgets\\RelTabs::className(), [\n        'relView' => '/" . $generator->helperCrud->getClassid(CrudHelper::RK_MODEL_CM) . "/crud/relations/" . Inflector::camel2id(StringHelper::basename($generator->mutationJoinTableName)) . "',\n        'header' => '" . lcfirst(Inflector::classify($generator->mutationSourceTableName)) . ".title',\n        'form' => \$form,\n    ])->label(false);\n    ?>";
    ?>
    <?php 
}
?>


    <?php 
foreach ($columnNames as $attribute) {
    if (isset($safeAttributes[$attribute]) && !$safeAttributes[$attribute]->isPrimaryKey && $attribute != $generator->sortableColumnAttribute) {
        echo "<?= " . $generator->generateActiveField($attribute) . " ?>\n\n";
    }
}
?>
    <div class="form-group">
        <?php 
コード例 #2
0
ファイル: query.php プロジェクト: dlds/yii2-giixer
echo ModelHelper::basename($generator->helperModel->getClass(ModelHelper::RK_QUERY));
?>
 extends <?php 
echo ModelHelper::root($generator->helperModel->getParentClass(ModelHelper::RK_QUERY));
?>
 {

    /**
     * @inheritdoc
     * @return string
     */
    protected function modelClass()
    {
        return <?php 
echo ModelHelper::basename($generator->helperModel->getClass(ModelHelper::RK_MODEL_CM));
?>
::className();
    }

    /**
     * @inheritdoc
     * @return string
     */
    protected function modelTable()
    {
        return <?php 
echo ModelHelper::basename($generator->helperModel->getClass(ModelHelper::RK_MODEL_CM));
?>
::tableName();
    }
}
コード例 #3
0
ファイル: mutation.php プロジェクト: dlds/yii2-giixer
<?php

use yii\helpers\Inflector;
use yii\helpers\StringHelper;
use dlds\giixer\generators\ultimate\helpers\ModelHelper;
use dlds\giixer\generators\ultimate\helpers\CrudHelper;
/* @var $this yii\web\View */
/* @var $generator \dlds\giixer\generators\ultimate\Generator */
/* @var $model \yii\db\ActiveRecord */
echo "<?php\n";
?>

/* @var $this yii\web\View */
/* @var $model <?php 
echo ModelHelper::root($generator->helperModel->getClass(ModelHelper::RK_MODEL_CM, $generator->mutationJoinTableName));
?>
 */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="<?php 
echo CrudHelper::basename($generator->helperCrud->getClassid(CrudHelper::RK_MODEL_CM, $generator->mutationJoinTableName));
?>
-index">
    <?php 
foreach ($mutationColumns as $attribute) {
    if (isset($mutationSafeAttributes[$attribute]) && !$mutationSafeAttributes[$attribute]->isPrimaryKey && $attribute != $generator->sortableColumnAttribute && !$generator->isMutationAttributeIgnored($attribute)) {
        echo str_replace("'" . $attribute . "'", "'[' . \$id . ']" . $attribute . "'", "\n<?= " . $generator->generateActiveField($attribute) . " ?>\n");
    }
}
?>
コード例 #4
0
     */
    public function actionIndex()
    {
        $handler = new <?php 
echo ComponentHelper::basename($generator->helperComponent->getClass(ComponentHelper::RK_HANDLER_SEARCH_FE));
?>
(\Yii::$app->request->queryParams);

        return $this->render('index', [
            'searchHandler' => $handler,
        ]);
    }

    /**
     * Displays a single <?php 
echo ModelHelper::root($generator->helperModel->getClass(ModelHelper::RK_MODEL_CM));
?>
 model.
     * @param integer $id primary key
     * @return mixed
     */
    public function actionView($id)
    {
        $handler = new <?php 
echo ComponentHelper::basename($generator->helperComponent->getClass(ComponentHelper::RK_HANDLER_CRUD_FE));
?>
();

        $evt = $handler->read($id);

        if (!$evt->isRead()) {
コード例 #5
0
ファイル: model.php プロジェクト: dlds/yii2-giixer
}
?>

    /**
     * @inheritdoc
     */
    public function getRecordPrint()
    {
        <?php 
echo $generator->getRecordPrintSyntax();
?>
;
    }

    /**
     * @inheritdoc
     * @return <?php 
echo ModelHelper::root($generator->helperModel->getClass(ModelHelper::RK_QUERY));
?>
 the active query used by this AR class.
     */
    public static function find()
    {
        return new <?php 
echo ModelHelper::root($generator->helperModel->getClass(ModelHelper::RK_QUERY));
?>
(get_called_class());
    }
    
}
コード例 #6
0
ファイル: update.php プロジェクト: dlds/yii2-giixer
echo "\n    <?php Portlet::end(); ?>\n    ";
?>

<?php 
if ($generator->generateGalleryBehavior) {
    ?>

    <?php 
    echo "<?php\n    Portlet::begin([\n        'icon' => 'icon-picture',\n        'title' => \\Yii::t('" . $generator->i18nDefaultCategory . "', 'title_gallery'),\n        'color' => Metronic::UI_COLOR_GREEN_HAZE,\n    ]);\n    ?>\n    ";
    ?>

    <div class="row">
        <div class="col-md-12">

            <?php 
    echo "\n            <?=\n            GalleryManager::widget([\n                'model' => \$model,\n                'behaviorName' => " . ModelHelper::root($generator->helperModel->getClass(ModelHelper::RK_MODEL_CM)) . "::" . $generator->getBehaviorConstantName(\dlds\giixer\Module::BEHAVIOR_NAME_GALLERY_MANAGER) . ",\n                'apiRoute' => ArrayHelper::getValue(" . ComponentHelper::basename($generator->helperComponent->getClass(ComponentHelper::RK_HELPER_URL_ROUTE_BE)) . "::gallery(), 0),\n            ]);\n            ?>\n            ";
    ?>


        </div>
    </div>

    <?php 
    echo "\n    <?php Portlet::end(); ?>\n    ";
    ?>

<?php 
}
?>

</div>
コード例 #7
0
ファイル: Generator.php プロジェクト: dlds/yii2-giixer
 /**
  * Retrieves behavior specification
  * @return array behavior specification
  */
 public function getBehaviorsToGenerate()
 {
     $behaviors = [];
     if ($this->generateMutation) {
         $modelClassName = ModelHelper::root($this->helperModel->getClass(ModelHelper::RK_MODEL_CM, $this->getClassName($this->mutationJoinTableName)));
         $db = $this->getDbConnection();
         $tableSchema = $db->getTableSchema($this->mutationJoinTableName);
         $mutationableAttrs = array_diff($tableSchema->columnNames, $tableSchema->primaryKey);
         $behaviors[Module::BEHAVIOR_NAME_MUTATION] = ['class' => '\\dlds\\rels\\components\\Behavior::className()', 'config' => [sprintf('%s::className()', $modelClassName), sprintf('%s::%s%s', $modelClassName, Module::RELATION_NAME_PREFIX, strtoupper($this->tableName)), sprintf('%s::%s%s', $modelClassName, Module::RELATION_NAME_PREFIX, strtoupper($this->mutationSourceTableName)), sprintf('self::%s%s', Module::RELATION_NAME_PREFIX, Module::RELATION_NAME_MUTATION_CURRENT)], 'attrs' => $mutationableAttrs];
     }
     if ($this->generateGalleryBehavior) {
         $helperClassName = ModelHelper::basename($this->helperModel->getClass(ModelHelper::RK_HELPER_IMAGE));
         $behaviors[Module::BEHAVIOR_NAME_GALLERY_MANAGER] = ['class' => '\\dlds\\galleryManager\\GalleryBehavior::className()', 'type' => sprintf('%s::getType()', $helperClassName), 'directory' => sprintf('%s::getDirectory()', $helperClassName), 'url' => sprintf('%s::getUrl()', $helperClassName), 'versions' => sprintf('%s::getVersions()', $helperClassName), 'extension' => sprintf('%s::getExtension()', $helperClassName), 'tableName' => $this->galleryTableName];
     }
     if ($this->generateTimestampBehavior) {
         $behaviors[Module::BEHAVIOR_NAME_TIMESTAMP] = ['class' => '\\yii\\behaviors\\TimestampBehavior::className()'];
         if ($this->timestampCreatedAtAttribute && self::DEFAULT_TIMESTAMP_CREATED_AT_ATTR != $this->timestampCreatedAtAttribute) {
             $behaviors[Module::BEHAVIOR_NAME_TIMESTAMP]['createdAtAttribute'] = $this->timestampCreatedAtAttribute;
         }
         if ($this->timestampUpdatedAtAttribute && self::DEFAULT_TIMESTAMP_UPDATED_AT_ATTR != $this->timestampUpdatedAtAttribute) {
             $behaviors[Module::BEHAVIOR_NAME_TIMESTAMP]['updatedAtAttribute'] = $this->timestampUpdatedAtAttribute;
         }
     }
     if ($this->generateSortableBehavior) {
         $behaviors[Module::BEHAVIOR_NAME_SORTABLE] = ['class' => '\\dlds\\sortable\\components\\Behavior::className()'];
         if ($this->sortableKeyAttribute) {
             $behaviors[Module::BEHAVIOR_NAME_SORTABLE]['key'] = $this->sortableKeyAttribute;
         }
         if ($this->sortableColumnAttribute) {
             $behaviors[Module::BEHAVIOR_NAME_SORTABLE]['column'] = $this->sortableColumnAttribute;
         }
         if ($this->sortableIndexAttribute) {
             $behaviors[Module::BEHAVIOR_NAME_SORTABLE]['index'] = $this->sortableIndexAttribute;
         }
         if ($this->sortableRestrictionsAttribute) {
             $behaviors[Module::BEHAVIOR_NAME_SORTABLE]['restrictions'] = explode(',', $this->sortableRestrictionsAttribute);
         }
     }
     if ($this->generateSluggableBehavior) {
         $behaviors[Module::BEHAVIOR_NAME_SLUGGABLE] = ['class' => '\\yii\\behaviors\\SluggableBehavior::className()'];
         $behaviors[Module::BEHAVIOR_NAME_SLUGGABLE]['attribute'] = explode(',', $this->sluggableBehaviorSourceAttribute);
         $behaviors[Module::BEHAVIOR_NAME_SLUGGABLE]['slugAttribute'] = $this->sluggableBehaviorTargetAttribute;
         $behaviors[Module::BEHAVIOR_NAME_SLUGGABLE]['ensureUnique'] = $this->getBooleanQuoted($this->sluggableBehaviorEnsureUnique);
         $behaviors[Module::BEHAVIOR_NAME_SLUGGABLE]['immutable'] = $this->getBooleanQuoted($this->sluggableBehaviorImutable);
     }
     return $behaviors;
 }