コード例 #1
0
ファイル: index.php プロジェクト: chaselou/daily
if (isset($_REQUEST['t'])) {
    $pageWhere .= '&t=' . $_REQUEST['t'];
    $where = ' And types=:types';
    $placeholder[':types'] = $_REQUEST['t'];
}
$placeholder[':is_complete'] = $isComplete;
try {
    $pageSize = 5;
    $page = isset($_GET['page']) ? $_GET['page'] : 1;
    $sql = "SELECT COUNT(*) FROM cl_jobs WHERE is_complete=:is_complete" . $where;
    $s = $pdo->prepare($sql);
    $s->execute($placeholder);
    $rowCount = $s->fetch();
    $pageTotal = ceil(intval($rowCount) / $pageSize);
    $offset = ($page - 1) * $pageSize;
    $pagination = outputPagination($page, $pageTotal, 8, $pageWhere);
    $select = 'SELECT id, detail, start_date, completed_date, types';
    $from = ' From cl_jobs';
    $where = ' WHERE true AND is_complete=:is_complete' . $where;
    $order = ' ORDER BY start_date DESC';
    $limit = " LIMIT {$offset}, {$pageSize}";
    $sql = $select . $from . $where . $order . $limit;
    $s = $pdo->prepare($sql);
    $s->execute($placeholder);
    while ($row = $s->fetch()) {
        $jobs[] = array('id' => $row['id'], 'detail' => $row['detail'], 'start_date' => $row['start_date'], 'completed_date' => $row['completed_date'], 'types' => $row['types']);
    }
    include 'jobs.html.php';
} catch (PDOException $e) {
    $output = 'Error fetching jobs: ' . $e->getMessage();
    include $_SERVER['DOCUMENT_ROOT'] . '/huaqiao/src/templates/output.html.php';
コード例 #2
0
ファイル: index.php プロジェクト: chaselou/daily
    $minetype = $file['minetype'];
    $filedata = $file['filedata'];
    $disposition = 'attachment';
    header('Content-length: ' . strlen($filedata));
    header("Content-type: application/octet-steams");
    header("Content-disposition: {$disposition};filename={$filename}");
    echo $filedata;
    exit;
}
include_once $_SERVER['DOCUMENT_ROOT'] . '/huaqiao/include/dbConnection.inc.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/huaqiao/lib/paginate.php';
try {
    $pageSize = 1;
    $page = isset($_GET['page']) ? $_GET['page'] : 1;
    $sql = "SELECT COUNT(*) FROM record";
    $result = $pdo->query($sql);
    $rowCount = $result->fetchColumn();
    $pageTotal = ceil(intval($rowCount) / $pageSize);
    $offset = ($page - 1) * $pageSize;
    $pagination = outputPagination($page, $pageTotal);
    $sql = "SELECT record.id AS id, name, content, filestore.id AS fileid, filename FROM record LEFT JOIN filestore ON recordid = record.id LIMIT {$offset}, {$pageSize}";
    $result = $pdo->query($sql);
    while ($row = $result->fetch()) {
        $records[] = array('id' => $row['id'], 'name' => $row['name'], 'content' => $row['content'], 'fileid' => $row['fileid'], 'filename' => $row['filename']);
    }
    include 'records.html.php';
} catch (PDOException $e) {
    $output = 'Error fetching daily: ' . $e->getMessage();
    include $_SERVER['DOCUMENT_ROOT'] . '/huaqiao/src/templates/output.html.php';
    exit;
}
コード例 #3
0
ファイル: index.php プロジェクト: chaselou/daily
        $s->execute();
    } catch (PDOException $e) {
        $output = 'ERROR editing daily ' . $e->getMessage();
        include $_SERVER['DOCUMENT_ROOT'] . '/huaqiao/src/templates/output.html.php';
        exit;
    }
    header('Location: .?editDaily&id=' . $_POST['id'] . '&done=edit');
    exit;
}
include_once $_SERVER['DOCUMENT_ROOT'] . '/huaqiao/include/dbConnection.inc.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/huaqiao/lib/paginate.php';
try {
    $pageSize = 5;
    $page = isset($_GET['page']) ? $_GET['page'] : 1;
    $sql = "SELECT COUNT(*) FROM Daily";
    $result = $pdo->query($sql);
    $rowCount = $result->fetchColumn();
    $pageTotal = ceil(intval($rowCount) / $pageSize);
    $offset = ($page - 1) * $pageSize;
    $pagination = outputPagination($page, $pageTotal, 8, 'cid=10');
    $sql = "SELECT id, Date, Weather, Comment FROM Daily ORDER BY Date DESC LIMIT {$offset}, {$pageSize}";
    $result = $pdo->query($sql);
    while ($row = $result->fetch()) {
        $dailys[] = array('id' => $row['id'], 'date' => $row['Date'], 'weather' => $row['Weather'], 'comment' => $row['Comment']);
    }
    include 'dailys.html.php';
} catch (PDOException $e) {
    $output = 'Error fetching daily: ' . $e->getMessage();
    include $_SERVER['DOCUMENT_ROOT'] . '/huaqiao/src/templates/output.html.php';
    exit;
}