public function afterDelete() { parent::afterDelete(); ProductFieldByCatalog::model()->deleteAll('fid=' . $this->id); }
<?php $this->breadcrumbs = array(CartModule::t($model->parentName() . ' Fields', $model->parentName()) => array('admin'), CartModule::t('Manage')); $this->menu = array(array('label' => CartModule::t('Create ' . $model->parentName() . ' Field', $model->parentName()), 'url' => array('create')), array('label' => CartModule::t('Manage ' . $model->parentName(), $model->parentName()), 'url' => array($model->parentName() . '/admin'))); Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('product-field-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n"); ?> <h1><?php echo CartModule::t('Manage ' . $model->parentName() . ' Fields', $model->parentName()); ?> </h1> <p><?php echo CartModule::t('You may optionally enter a comparison operator (<b><</b>, <b><=</b>, <b>></b>, <b>>=</b>, <b><></b> or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.'); ?> </p> <?php echo CHtml::link(CartModule::t('Advanced Search'), '#', array('class' => 'search-button')); ?> <div class="search-form" style="display:none"> <?php $this->renderPartial('_search', array('model' => $model)); ?> </div><!-- search-form --> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'product-field-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('id', 'varname', array('name' => 'title', 'value' => 'CartModule::t($data->title,$data->parentName())'), array('name' => 'required', 'value' => 'CDynamicFieldModel::itemAlias("required",$data->required)', 'filter' => CDynamicFieldModel::itemAlias("required")), 'position', array('name' => 'visible', 'value' => 'CDynamicFieldModel::itemAlias("visible",$data->visible)', 'filter' => CDynamicFieldModel::itemAlias("visible")), array('class' => 'CButtonColumn'))));
?> <?php echo $form->error($model, 'position'); ?> <p class="hint"><?php echo CartModule::t('Display order of fields.'); ?> </p> </div> <div class="row visible"> <?php echo $form->labelEx($model, 'visible'); ?> <?php echo $form->dropDownList($model, 'visible', CDynamicFieldModel::itemAlias('visible')); ?> <?php echo $form->error($model, 'visible'); ?> </div> <div class="row buttons"> <?php echo CHtml::submitButton($model->isNewRecord ? CartModule::t('Create') : CartModule::t('Save')); ?> </div> <?php $this->endWidget(); ?>
<?php $this->breadcrumbs = array(CartModule::t($model->parentName() . ' Fields', $model->parentName()) => array('admin'), $model->varname); $this->menu = array(array('label' => CartModule::t('Create'), 'url' => array('create')), array('label' => CartModule::t('Update'), 'url' => array('update', 'id' => $model->id)), array('label' => CartModule::t('Delete'), 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => CartModule::t('Are you sure you want to delete this field?'))), array('label' => CartModule::t('Manage ' . $model->parentName() . ' Field', $model->parentName()), 'url' => array('admin'))); ?> <h1><?php echo CartModule::t('View "{varname}"', '', array('{varname}' => $model->varname)); ?> </h1> <?php $catalogs = array(); foreach ($model->catalogs as $catalog) { array_push($catalogs, CHtml::link($catalog->name, array('catalog/view', 'id' => $catalog->id))); } $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id', 'varname', 'title', 'field_type', 'field_size', 'field_size_min', 'required', 'match', 'range', 'error_message', 'other_validator', 'default', array('name' => 'catalogs', 'type' => 'raw', 'value' => implode(', ', $catalogs)), 'widget', 'widgetparams', 'position', array('name' => 'visible', 'value' => CDynamicFieldModel::itemAlias("visible", $model->visible)))));