Esempio n. 1
0
;

/**
 * <?php 
echo CrudHelper::basename($generator->helperCrud->getClass(CrudHelper::RK_CONTROLLER_FE));
?>
 implements the CRUD actions for <?php 
echo ModelHelper::root($generator->helperModel->getClass(CrudHelper::RK_MODEL_CM));
?>
 model.
 */
class <?php 
echo CrudHelper::basename($generator->helperCrud->getClass(CrudHelper::RK_CONTROLLER_FE));
?>
 extends <?php 
echo CrudHelper::root($generator->helperCrud->getParentClass(CrudHelper::RK_CONTROLLER_FE));
?>
 
{

    /**
     * Lists all <?php 
echo ModelHelper::root($generator->helperModel->getClass(ModelHelper::RK_MODEL_CM));
?>
 models.
     * @return mixed
     */
    public function actionIndex()
    {
        $handler = new <?php 
echo ComponentHelper::basename($generator->helperComponent->getClass(ComponentHelper::RK_HANDLER_SEARCH_FE));
Esempio n. 2
0
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");
    }
}
?>

</div>
Esempio n. 3
0
 /**
  * Generates a string depending on enableI18N property
  *
  * @param string $string the text be generated
  * @param array $placeholders the placeholders to use by `Yii::t()`
  * @return string
  */
 public function generateString($string = '', $placeholders = [])
 {
     $string = addslashes($string);
     if ($this->enableI18N) {
         // If there are placeholders, use them
         if (!empty($placeholders)) {
             $ph = ', ' . VarDumper::export($placeholders);
         } else {
             $ph = '';
         }
         $str = "Yii::t('" . $this->helperCrud->getI18nCategory() . "', '" . $string . "'" . $ph . ")";
     } else {
         // No I18N, replace placeholders by real words, if any
         if (!empty($placeholders)) {
             $phKeys = array_map(function ($word) {
                 return '{' . $word . '}';
             }, array_keys($placeholders));
             $phValues = array_values($placeholders);
             $str = "'" . str_replace($phKeys, $phValues, $string) . "'";
         } else {
             // No placeholders, just the given string
             $str = "'" . $string . "'";
         }
     }
     return $str;
 }