public function getAttrList($id) { $temp = array(); $model = AttributeValues::model()->findAllByAttributes(array('AttributeId' => $id)); foreach ($model as $list) { $temp[] = $list->AttributeValue; } if (empty($temp)) { return '--'; } else { return implode(',', $temp); } }
/** * Deletes a particular model. * If deletion is successful, the browser will be redirected to the 'admin' page. * @param integer $id the ID of the model to be deleted */ public function actionDelete($id) { UserOptions::model()->deleteAllByAttributes(array('AttributeId' => $id)); UserText::model()->deleteAllByAttributes(array('AttributeId' => $id)); AttributeValues::model()->deleteAllByAttributes(array('AttributeId' => $id)); $this->loadModel($id)->delete(); // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser if (!isset($_GET['ajax'])) { $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin')); } }
</span> </div> </li> <?php } else { if ($att_list->Type == 'checkbox') { ?> <li> <div> <label><?php echo $att_list->Name; ?> </label> <span> <?php $list = CHtml::listData(AttributeValues::model()->findAllByAttributes(array('AttributeId' => $att_list->Objid)), 'Objid', 'AttributeValue'); $options_list->AttributeValueId = array($att_list->Objid => $selectedValue); echo $form->checkBoxList($options_list, 'AttributeValueId[' . $att_list->Objid . ']', $list); ?> </span> </div> </li> <?php } } ?> <?php } ?> <div class="updateBlock2">
<td class="first_col"><?php echo $att_list->Name; ?> </td> <td> <?php if ($att_list->Type == "dropdown") { $att_index_val = !empty($att_value['basic'][$att_list->Objid]) ? $att_value['basic'][$att_list->Objid] : ''; $value = AttributeValues::model()->findByPk($att_index_val); echo !empty($value) ? $value->AttributeValue : '-No Data Given-'; } else { if ($att_list->Type == "checkbox") { $att_index_val = !empty($att_value['basic'][$att_list->Objid]) ? $att_value['basic'][$att_list->Objid] : ''; if (!empty($att_index_val)) { foreach ($att_index_val as $aid) { echo '<span>' . AttributeValues::model()->findByPk($aid)->AttributeValue . '</span>'; } } else { echo '-No Data Given-'; } } } ?> </td> </tr> <?php if ($temp % $i == 0) { echo '</table></div><div class="column_right"><table border="0" cellpadding="0" cellspacing="0">'; } $temp++; }
<?php /* @var $this AttributesController */ /* @var $model Attributes */ $this->breadcrumbs = array('Attributes' => array('index'), $model->Name); $this->menu = array(array('label' => 'List Attributes', 'url' => array('index')), array('label' => 'Create Attributes', 'url' => array('create')), array('label' => 'Update Attributes', 'url' => array('update', 'id' => $model->Objid)), array('label' => 'Delete Attributes', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->Objid), 'confirm' => 'Are you sure you want to delete this item?')), array('label' => 'Manage Attributes', 'url' => array('admin'))); ?> <div class="row-fluid"> <div class="span12"> <div class="widget-box"> <div class="widget-title"> <span class="icon"> <i class="icon-align-justify"></i> </span> <h5>Attribute :<?php echo $model->Name; ?> </h5> </div> <div class="widget-content"> <?php $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('Name', 'Type', array('name' => 'Value', 'value' => AttributeValues::model()->getAttrList($model->Objid)), 'Position', array('name' => 'Status', 'value' => $model->Status ? "Active" : "Inactive")))); ?> </div> </div> </div> </div>