本文整理汇总了PHP中f::dbFullRes方法的典型用法代码示例。如果您正苦于以下问题:PHP f::dbFullRes方法的具体用法?PHP f::dbFullRes怎么用?PHP f::dbFullRes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类f
的用法示例。
在下文中一共展示了f::dbFullRes方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
public static function get()
{
if (!security::isLogged() || !USER_IS_ADMIN) {
return;
}
$clients = f::dbFullRes("select id, name, status from fm_clients order by status desc, name");
f::setResponseJson(array("data" => $clients));
}
示例2: get
public static function get()
{
if (!security::isLogged()) {
return;
}
$clients = f::dbFullRes("select distinct c.id, c.name \n\t\t\t\t\t\t\t\t from fm_clients c\n\t\t\t\t\t\t\t\t join fm_users_clients uc on (uc.client_id = c.id)\n\t\t\t\t\t\t\t\t where c.status = 1\n\t\t\t\t\t\t\t\t and uc.user_id = {userId}\n\t\t\t\t\t\t\t\t order by c.name ", array("userId" => USER_ID));
$forms = f::dbFullRes("select c.id client_id, f.id, f.name, f.status\n\t\t\t\t\t\t\t\t from fm_forms f\n\t\t\t\t\t\t\t\t join fm_clients c on (c.id = f.client_id)\n\t\t\t\t\t\t\t\t join fm_users_clients uc on (uc.client_id = c.id)\n\t\t\t\t\t\t\t\t where c.status = 1\n\t\t\t\t\t\t\t\t and uc.user_id = {userId}\n\t\t\t\t\t\t\t\t order by c.id, f.status desc, f.id desc ", array("userId" => USER_ID));
foreach ($forms as $k => $v) {
$siteTableId = "fm_userdata_" . substr("00" . $forms[$k]["client_id"], -3);
$forms[$k]["data_7_days"] = f::dbRes("select count(*) from {d:siteTableId} ud where ud.form_id = {formId} and date(created_date) >= (CURDATE() - INTERVAL 7 DAY)", array("siteTableId" => $siteTableId, "formId" => $forms[$k]["id"]));
$forms[$k]["data_total"] = f::dbRes("select count(*) from {d:siteTableId} ud where ud.form_id = {formId}", array("siteTableId" => $siteTableId, "formId" => $forms[$k]["id"]));
}
f::setResponseJson(array("clients" => $clients, "forms" => $forms));
}
示例3: get
public static function get()
{
if (!security::isLogged() || !USER_IS_ADMIN) {
return;
}
$clients = f::dbFullRes("select id, name, status from fm_clients");
$forms = f::dbFullRes("select f.id, f.client_id, f.name, f.detail, f.description, date_format(f.available_from,'%d/%m/%Y') as available_from, date_format(f.available_to,'%d/%m/%Y') as available_to, f.status, c.name client_name \n\t\t\t\t\t\t\tfrom fm_forms f \n\t\t\t\t\t\t\tleft join fm_clients c on (c.id=f.client_id)\n\t\t\t\t\t\t\twhere (f.status = 1 or f.status = 0)\n\t\t\t\t\t\t\torder by client_id, status desc, name");
foreach ($forms as $k => $v) {
$forms[$k]["available_from"] = $forms[$k]["available_from"] == '00/00/0000' ? "" : $forms[$k]["available_from"];
$forms[$k]["available_to"] = $forms[$k]["available_to"] == '00/00/0000' ? "" : $forms[$k]["available_to"];
$forms[$k]["detail"] = json_decode($forms[$k]["detail"], true);
$forms[$k]["path"] = "/form/" . $forms[$k]["client_id"] . "/" . $forms[$k]["id"];
}
f::setResponseJson(array("data" => $forms, "clients" => $clients));
}
示例4: get
public static function get()
{
if (!security::isLogged() || !USER_IS_ADMIN) {
return;
}
$users = f::dbFullRes("select id, name, email, status, is_admin from fm_users order by status desc, name");
foreach ($users as $k => $u) {
$users[$k]["clients"] = array();
$clients = f::dbFullRes("select client_id from fm_users_clients where user_id = {userId}", array("userId" => $users[$k]["id"]));
foreach ($clients as $c) {
$users[$k]["clients"][] = array("clientId" => $c["client_id"]);
}
}
$clients = f::dbFullRes("select id, name, status from fm_clients order by status desc, name");
f::setResponseJson(array("data" => $users, "clients" => $clients));
}
示例5: get
public static function get()
{
$forms = f::dbFullRes("select f.id, f.client_id, f.name, f.detail, f.description, date_format(f.available_from,'%d/%m/%Y') as available_from, date_format(f.available_to,'%d/%m/%Y') as available_to, f.status, c.name client_name \n\t\t\t\t\t\t\tfrom fm_forms f \n\t\t\t\t\t\t\tleft join fm_clients c on (c.id=f.client_id)\n\t\t\t\t\t\t\twhere (c.status=1 or c.status=0) and (f.status=1 or f.status=0) \n\t\t\t\t\t\t\torder by client_id, status desc, name");
foreach ($forms as $f) {
$detail = json_decode($f["detail"], true);
$parameters = array();
if (isset($detail["captcha"]) && $detail["captcha"]) {
$parameters[] = array("in" => "formData", "name" => "captcha", "type" => "integer", "description" => "Call captcha service or get a form definition for the capthca image.<br>Use number \"9999\" for test purposes.");
}
$data = self::getParameters($parameters, $detail);
$responses["200"] = array("description" => "ok");
if ($data["error400"]) {
$responses["400"] = array("description" => $data["error400"]);
}
$form["post"] = array("tags" => array($f["client_name"]), "summary" => $f["name"] . ($f["status"] == 0 ? " (Disabled)" : ""), "description" => $f["description"], "responses" => $responses, "parameters" => $data["parameters"]);
$paths["/form/" . $f["client_id"] . "/" . $f["id"]] = $form;
}
$paths["/forms/getform"] = self::getFormService();
echo '{ "swagger": "2.0", "info": { "description": "Wunderforms API", "version": "1.0.0", "title": "Wunderforms API", "termsOfService": "" }, "host": "", "basePath": "", "schemes": [ "http" ], "paths": ';
echo json_encode($paths, JSON_UNESCAPED_UNICODE);
echo '}';
}
示例6: step2
private static function step2($page, $start, $rowsPerPage, $outData)
{
$excel = f::getParam("excel") == 1;
$order = f::getParam("order") * 1;
$orderDesc = f::getParam("orderDesc") * 1;
$orderBy = $order == "" ? "" : " ORDER BY {$order}";
$clientId = f::dbRes("select client_id from fm_forms where id = {p:form_id}");
$siteTableId = "fm_userdata_" . substr("00" . $clientId, -3);
$limit = $excel ? "" : " limit {$start}, {$rowsPerPage}";
$textFilter = "";
if (f::getParam("textFilter")) {
$textFilter = " and user_data like '%" . f::dbEscape(f::getParam("textFilter")) . "%'";
}
$sql = "select SQL_CALC_FOUND_ROWS id, date_format(created_date,'%d/%m/%Y %H:%i') as created_date, user_data \n\t\t\t\t\t\tfrom {d:siteTableId}\n\t\t\t\t\t\twhere form_id = {p:form_id} \n\t\t\t\t\t\t{n:textFilter}\n\t\t\t\t\t\torder by id desc {d:orderBy} {d:limit}";
$formData = f::dbFullRes($sql, array("siteTableId" => $siteTableId, "textFilter" => $textFilter, "orderBy" => $orderBy, "limit" => $limit));
foreach ($formData as $k => $v) {
$formData[$k]["user_data"] = json_decode($formData[$k]["user_data"], true);
}
$totalRows = f::dbRes("SELECT FOUND_ROWS()");
if ($totalRows <= $page * $rowsPerPage) {
$outData["nextPage"] = 0;
}
$form = f::dbFirstRow("select id, name, enabled_domains, detail \n\t\t\t\tfrom fm_forms \n\t\t\t\twhere id = {p:form_id}");
$form["detail"] = json_decode($form["detail"], true);
$outData["form"] = $form;
$outData["data"] = $formData;
$outData["totalRows"] = $totalRows;
$outData["order"] = $order;
$outData["orderDesc"] = $orderDesc;
$outData["end"] = min($outData["start"] + $rowsPerPage, $totalRows);
if (!$excel) {
f::setResponseJson($outData);
} else {
$out = self::prepareExcel($form, $formData);
$formName = preg_replace("/[^A-Za-z0-9 ]/", '', $form["name"]);
f::setExcelOutput($form["id"] . "_{$formName}_" . date("Ymd_His") . ".xls", $out);
}
}