public function merchantList() { $slug = $this->data['slug']; $aColumns = array('merchant_id', 'restaurant_name', 'street', 'city', 'country_code', 'contact_phone', 'package_id', 'activation_token', 'is_commission', 'status'); $sWhere = ''; $sOrder = ''; $sLimit = ''; $sTable = "{{merchant}}"; $functionk = new FunctionsK(); $t = $functionk->ajaxDataTables($aColumns); if (is_array($t) && count($t) >= 1) { $sWhere = $t['sWhere']; $sOrder = $t['sOrder']; $sLimit = $t['sLimit']; } $stmt = "\n\t\t\tSELECT SQL_CALC_FOUND_ROWS \n\t\t\ta.*,\n\t\t\t(\n\t\t\tselect title\n\t\t\tfrom\n\t\t\t{{packages}}\n\t\t\twhere\n\t\t\tpackage_id = a.package_id\n\t\t\tlimit 0,1\n\t\t\t) as package_name\n\t\t\t\n\t\t\tFROM {$sTable} a\n\t\t\t{$sWhere}\n\t\t\t{$sOrder}\n\t\t\t{$sLimit}\n\t\t"; if (isset($_GET['debug'])) { dump($stmt); } if ($res = $this->rst($stmt)) { $iTotalRecords = 0; $stmt2 = "SELECT FOUND_ROWS()"; if ($res2 = $this->rst($stmt2)) { //dump($res2); $iTotalRecords = $res2[0]['FOUND_ROWS()']; } $feed_data['sEcho'] = intval($_GET['sEcho']); $feed_data['iTotalRecords'] = $iTotalRecords; $feed_data['iTotalDisplayRecords'] = $iTotalRecords; foreach ($res as $val) { /*$date=date('M d,Y G:i:s',strtotime($val['date_created'])); $date=Yii::app()->functions->translateDate($date);*/ $date = FormatDateTime($val['date_created']); $action = "<div class=\"options\">\n \t \t\t<a href=\"{$slug}/id/{$val['merchant_id']}\" >" . Yii::t("default", "Edit") . "</a>\n \t \t\t<a href=\"javascript:;\" class=\"row_del\" rev=\"{$val['merchant_id']}\" >" . Yii::t("default", "Delete") . "</a>\n \t \t\t</div>"; $val['package_name'] = isset($val['package_name']) ? $val['package_name'] : ''; if ($val['status'] == "expired") { $class = 'uk-badge-danger'; } elseif ($val['status'] == "pending") { $class = ''; } elseif ($val['status'] == "active") { $class = 'uk-badge-success'; } $membershipdate = FormatDateTime($val['membership_expired'], false); $membershipdate = Yii::app()->functions->translateDate($membershipdate); $url_login = baseUrl() . "/merchant/autologin/id/" . $val['merchant_id'] . "/token/" . $val['password']; $link_login = '******' . $url_login . '"><div class="uk-badge">' . t("AutoLogin") . '</div></a> '; $aa_access = Yii::app()->functions->AAccess(); if (!in_array('autologin', (array) $aa_access)) { $link_login = ''; } $feed_data['aaData'][] = array($val['merchant_id'], stripslashes($val['restaurant_name']) . $action, $val['street'], $val['city'], $val['country_code'], $val['restaurant_phone'] . " / " . $val['contact_phone'], $val['package_name'] . "<br/>" . $membershipdate, $val['activation_key'], membershipType($val['is_commission']), $date . "<br/><div class=\"uk-badge {$class}\">" . strtoupper(Yii::t("default", $val['status'])) . "</div>" . $link_login); } $this->otableOutput($feed_data); } $this->otableNodata(); }