public static function DeleteTestCat($page_id) { $model = WTestCat::model()->find("id=" . $page_id); if ($model->delete()) { return TRUE; } return FALSE; }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return WTestCat the loaded model * @throws CHttpException */ public function loadModel($id) { $model = WTestCat::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
?> <?php echo $form->error($model, 'test_name'); ?> </div> <input type="hidden" name="avatar" id="txtAvatarTest" value="<?php echo $model->avatar; ?> "/> </div> <div class="form-group"> <label for="WTest_test_cat_id" class="col-sm-2 control-label required">Category</label> <div class="col-sm-10"> <?php echo $form->dropDownList($model, 'test_cat_id', CHtml::listData(WTestCat::model()->findAll(), 'id', 'test_cat'), array('prompt' => '--Select Category--', 'class' => 'form-control', 'style' => 'width:180px;')); ?> <?php echo $form->error($model, 'test_cat_id'); ?> </div> </div> <div class="form-group"> <label for="WTest_kind_of_test" class="col-sm-2 control-label required">Kind of test</label> <div class="col-sm-10"> <label class="radio-inline"> <input type="radio" name="WTest[kind_of_test]" id="WTest_kind_of_test_0" checked value="0"/> Post test </label> <label class="radio-inline"> <input type="radio" name="WTest[kind_of_test]" id="WTest_kind_of_test_1" value="1"/> Pre-test
?> <div class="clear"></div> </div> </div> <div class="primary_container"> <div class="primary_container_test" style="box-shadow: 0px 0px 0px; border: 0px; "> <div class="container_test"> <div class="box_test"> <div class="form-group" style="width: 100%; float: left;"> <div class="col-sm-1">Filter: </div> <div class="col-sm-3"><?php echo CHtml::dropDownList('company_code', 'id', CHtml::listData(WCompany::model()->findAll(), 'company_code', 'company_name'), array('prompt' => '--' . Yii::t('web/home', 'Chọn công ty') . '--', 'class' => 'form-control', 'style' => 'width:250px;', "onchange" => "return LoadTestParent()")); ?> </div> <div class="col-sm-3"><?php echo CHtml::dropDownList('test_cat_id', 'id', CHtml::listData(WTestCat::model()->findAll(), 'id', 'test_cat'), array('prompt' => '--' . Yii::t('web/home', 'Chọn danh mục') . '--', 'class' => 'form-control', 'style' => 'width:250px;', "onchange" => "return LoadTestParent()")); ?> </div> <div class="col-sm-2"> <select id="filter_test" onchange="return LoadTestParent()" class="form-control"> <option value="">-- Filter Test --</option> <option value="1">Pre-test</option> <option value="0">Post-test</option> <option value="2">Both</option> </select> </div> <div class="col-sm-3"> <input type="text" id="nametestparent" onblur="return LoadTestParent();" value="" class="form-control" placeholder="Name Question"> </div> </div> <div class="form-group" id="formData" style="float: left; width: 100%; margin-top: 10px;">