public function actionTestParentLoadPage() { $page = $_REQUEST["page"]; $view = isset($_REQUEST["view"]) ? $_REQUEST["view"] : "_loadpage"; $kind_of_test = (isset($_REQUEST["kind_of_test"]) and !empty($_REQUEST["kind_of_test"])) ? $_REQUEST["kind_of_test"] : NULL; $test_cat_id = (isset($_REQUEST["test_cat_id"]) and !empty($_REQUEST["test_cat_id"])) ? $_REQUEST["test_cat_id"] : NULL; $company_code = (isset($_REQUEST["company_code"]) and !empty($_REQUEST["company_code"])) ? $_REQUEST["company_code"] : NULL; $nametestparent = (isset($_REQUEST["nametestparent"]) and !empty($_REQUEST["nametestparent"])) ? $_REQUEST["nametestparent"] : NULL; $results = WTestParent::getTestParentAll(10, $page - 1, $company_code, $test_cat_id, $nametestparent, $kind_of_test); $data = $this->renderPartial('blocks/' . $view, array('data' => $results), true); echo json_encode(array("result" => "true", "html" => $data)); }
<?php $data = WTestParent::getTestParentAll(10, 0, $company_code, $test_cat_id, $nametestparent, $kind_of_test); $where = ""; if (!empty($company_code)) { $where .= " AND t.company_code='" . $company_code . "'"; } if (!empty($test_cat_id)) { $where .= " AND t.test_cat_id=" . $test_cat_id; } if (!empty($nametestparent)) { $where .= " AND t.test_name LIKE '%" . $nametestparent . "%'"; } if ($kind_of_test != "") { $where .= " AND t.kind_of_test=" . $kind_of_test; } if (!empty(Yii::app()->user->id) and Yii::app()->session["group_id"] == 1) { $where .= " AND t.created_by=" . Yii::app()->user->id; } elseif (!empty(Yii::app()->user->id) and Yii::app()->session["group_id"] == 2) { $where .= " AND t.created_by=NULL"; } $total = WTestParent::getTotalPages($where); $page = ceil($total / 10); ?> <div id="content_data"> <?php if (isset($data) && !empty($data)) { foreach ($data as $key => $item) { ?> <div class="dataList_item_test_trainer"> <a href="<?php