Esempio n. 1
0
echo <<<HEADER
<?php
/**
 * @var \$this  {$controllerClass}
 * @var \$model {$modelClass}
 */
 ?>
HEADER;
?>
<div class="view">
	<div class="viewData">
		<?php 
// Description de l'objet, sauf les colonnes created_at et updated_at
$titleFound = false;
foreach ($this->tableSchema->columns as $column) {
    if (CodeGeneratorHelper::isAdminColumn($column)) {
        // On n'affiche pas ces colonnes...
        continue;
    }
    if (!$titleFound && strpos($column->dbType, 'varchar') !== false) {
        // La première colonne varchar est censée être le titre de l'objet
        // @todo Essayer de remplacer ce test par un appel à CrudCode::guessNameColumn()
        $titleFound = true;
        echo "<b><?php echo CHtml::encode(\$data->getAttributeLabel('{$column->name}')); ?>:</b>\n";
        echo "<?php echo CHtml::link(\$data->{$column->name}, array(\$this->id.'/view/' . \$data->id)); ?>\n                    <br/>\n\n";
        continue;
    }
    // Affichage des autres colonnes...
    echo "<b><?php echo CHtml::encode(\$data->getAttributeLabel('{$column->name}')); ?>:</b>\n";
    echo "<?php echo CHtml::encode(CodeGeneratorHelper::getFormattedValue('{$column->dbType}', \$data->{$column->name})); ?>\n                <br />\n\n";
}
Esempio n. 2
0
echo "<?php\n";
echo "\$form=\$this->beginWidget('CActiveForm', array(\n\t'id'=>'" . $this->class2id($this->modelClass) . "-form',\n\t'enableAjaxValidation'=>false,\n    ));\n";
echo "\$this->renderPartial('//site/shared/_mandatoryFields');\n";
echo "echo \$form->errorSummary(\$model); \n";
echo "?>\n";
// Les champs du formulaire...
foreach ($this->tableSchema->columns as $column) {
    if (CodeGeneratorHelper::isAdminColumn($column)) {
        // On n'affiche pas ceux-là
        continue;
    }
    ?>
		<div class="row">
			<?php 
    echo "<?php echo " . $this->generateActiveLabel($this->modelClass, $column) . "; ?>\n";
    $activeField = CodeGeneratorHelper::generateActiveField($column, $this->modelClass);
    if ($activeField) {
        echo "<?php {$activeField}; ?>\n";
    } else {
        $activeField = $this->generateActiveField($this->modelClass, $column);
        echo "<?php echo {$activeField}; ?>\n";
    }
    echo "<?php echo \$form->error(\$model,'{$column->name}'); ?>\n";
    ?>
		</div>
	<?php 
}
?>
	<div class="row buttons">
		<?php 
echo <<<PHP
Esempio n. 3
0
\t\t\t</li>
\t\t\t<li class="update">
\t\t\t\t<?php echo CHtml::link(Yii::t('app', 'Update this {$modelClass}'), array('/{$controllerId}/update', "id" => \$model->id)); ?>
\t\t\t</li>
\t\t</ul>
\t</div>
\t<div class="clear"></div>
</div>
TITLE_SECTION;
// On construit la liste des colonnes à afficher dans la CDetailView, à savoir tous les champs qui ne sont pas
// des champs admin (id, date de création, etc...)
$displayableColumnsList = array();
foreach ($this->tableSchema->columns as $column) {
    if (CodeGeneratorHelper::isAdminColumn($column)) {
        continue;
    }
    $displayableColumnsList[] = "'" . CodeGeneratorHelper::getViewAttributesEntry($column, $templateRecord) . "'";
}
$displayableColumnsList = implode(",\n", $displayableColumnsList);
echo <<<CONTENT_SECTION
<div id="content_section">
\t<?php
\t\$this->widget('zii.widgets.CDetailView', array(
\t\t'data' => \$model,
\t\t'attributes' => array({$displayableColumnsList},
\t\t)
\t));
\t?>
</div>
CONTENT_SECTION
;
Esempio n. 4
0
echo CHtml::encode($data->getAttributeLabel('enabled'));
?>
:</b>
		<?php 
echo AssetsHelper::getImageTagForBoolean($data->enabled);
?>
		<br/>

		<b><?php 
echo CHtml::encode($data->getAttributeLabel('created_at'));
?>
:</b>
		<?php 
echo CHtml::encode(CodeGeneratorHelper::getFormattedValue('datetime', $data->created_at));
?>
		<br/>

		<b><?php 
echo CHtml::link($data->getAttributeLabel('updated_at'), array($this->id . '/update/id/' . $data->id));
?>
			:</b>
		<?php 
echo CHtml::encode(CodeGeneratorHelper::getFormattedValue('datetime', $data->updated_at));
?>
		<br/>
	</div>
	<div class="clear"></div>
</div>