/** * 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')); } }
<?php $this->endWidget(); ?> </div> <div id="des" class="tab-pane"> <div class="widget-content nopadding"> <?php $form = $this->beginWidget('CActiveForm', array('id' => 'users-form', 'enableClientValidation' => true, 'clientOptions' => array('validateOnSubmit' => true), 'htmlOptions' => array('class' => 'form-horizontal'))); $criteria = new CDbCriteria(); $criteria->condition = 'Type IN ("textarea","textfield") AND Status=1'; $criteria->order = 'Position ASC'; $attributes = Attributes::model()->findAll($criteria); foreach ($attributes as $att_list) { $value = ''; if (UserText::model()->findByAttributes(array('UserId' => $model->Objid, 'AttributeId' => $att_list->Objid))) { $value = UserText::model()->findByAttributes(array('UserId' => $model->Objid, 'AttributeId' => $att_list->Objid))->Value; } ?> <div class="control-group"> <label class="control-label"><?php echo $att_list->Name; ?> </label> <div class="controls"> <?php if ($att_list->Type == 'textfield') { echo $form->textField($options_text, 'Value[' . $att_list->Objid . ']', array('value' => $value)); } else { if ($att_list->Type == 'textarea') { echo $form->textArea($options_text, 'Value[' . $att_list->Objid . ']', array('value' => $value));
/** * 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) { $folder = Yii::getPathOfAlias('webroot') . '/../images/users/'; UserText::model()->deleteAllByAttributes(array("UserId" => $id)); UserOptions::model()->deleteAllByAttributes(array("UserId" => $id)); MembershipUsers::model()->deleteAllByAttributes(array("UserId" => $id)); Messages::model()->deleteAllByAttributes(array("SenderId" => $id)); Messages::model()->deleteAllByAttributes(array("ReceiverId" => $id)); if (UserImages::model()->findAllByAttributes(array("UserId" => $id))) { $imgList = UserImages::model()->findAllByAttributes(array("UserId" => $id)); foreach ($imgList as $list) { unlink($folder . $list->ImagePath); } } UserImages::model()->deleteAllByAttributes(array("UserId" => $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')); } }
echo $attValId->attributeName->AttributeValue; } else { echo '----'; } } else { if ($attlist->Type == 'checkbox') { $checkValId = UserOptions::model()->findAllByAttributes(array('UserId' => $model->Objid, 'AttributeId' => $attlist->Objid)); if ($checkValId) { foreach ($checkValId as $cid) { echo $cid->attributeName->AttributeValue . ', '; } } else { echo '----'; } } else { $text = UserText::model()->findByAttributes(array("UserId" => $model->Objid, "AttributeId" => $attlist->Objid)); if ($text) { echo substr($text->Value, 0, 70) . '..'; } else { echo '---'; } } } ?> </td></tr> <?php if ($temp == $count) { echo '</table></td><td><table id="yw0" class="detail-view">'; } $temp++; }