public function actionQuestionLoadPage() { $page = $_REQUEST["page"]; $questionType = isset($_REQUEST["questionType"]) ? $_REQUEST["questionType"] : ""; $namequestion = isset($_REQUEST["namequestion"]) ? $_REQUEST["namequestion"] : ""; $question_cat_id = isset($_REQUEST["question_cat_id"]) ? $_REQUEST["question_cat_id"] : ""; $view = isset($_REQUEST["view"]) ? $_REQUEST["view"] : "_loadpage"; $results = WQuestionLib::getQuestionLibAll(10, $page - 1, $questionType, $namequestion, $question_cat_id); $index = ($page - 1) * 10; $idactive = $_REQUEST["idquestionlist"]; $arrId = array(); if (!empty($idactive)) { $arrId = explode(",", $idactive); unset($arrId[count($arrId) - 1]); } $data = $this->renderPartial('lib/' . $view, array('data' => $results, "arrId" => $arrId, "index" => $index), true); echo json_encode(array("result" => "true", "html" => $data)); }
<?php $data = WQuestionLib::getQuestionLibAll(10, 0, $questionType, $namequestion, $question_cat_id); $where = ""; if (!empty($questionType)) { $where .= " AND t.question_type=" . $questionType; } if (!empty($namequestion)) { $where .= " AND t.question_text LIKE '%" . $namequestion . "%'"; } if (!empty($question_cat_id)) { $where .= " AND t.question_cat_id=" . $question_cat_id; } $total = WQuestionLib::getTotalQuestionLib($where); $page = ceil($total / 10); ?> <p><a href="javascript:;" class="btn btn-danger btn-xs" style="visibility: hidden;" id="btndeleteall" onclick="return removeAllData(this);"><?php echo Yii::t('web/home', 'Delete All'); ?> </a></p> <table class="table table-hover" style="margin-bottom: 0px;"> <thead class="first_thead"> <tr> <th width="1"><input type="checkbox" id="checkAll"></th> <th width="1">#</th> <th><?php echo Yii::t('web/home', 'Question'); ?> </th> <th class="col-lg-2"><?php echo Yii::t('web/home', 'Action');