コード例 #1
0
ファイル: manage_attachments.php プロジェクト: artre/study
    $form_fields->crf_download_file($file);
}
if (isset($_REQUEST['form_id'])) {
    $form_id = $_REQUEST['form_id'];
} else {
    $qry = "select id from {$crf_forms} order by id asc limit 1";
    $reg = $wpdb->get_var($qry);
    $form_id = $_REQUEST['form_id'] = $reg;
}
if (!empty($_POST['selected']) && isset($_POST['download_selected'])) {
    $retrieved_nonce = $_REQUEST['_wpnonce'];
    if (!wp_verify_nonce($retrieved_nonce, 'manage_crf_entries')) {
        die('Failed security check');
    }
    $ids = implode(',', $_POST['selected']);
    $file = $form_fields->crf_create_attachment_zip($_POST['selected']);
    $form_fields->crf_download_file($file);
    //echo $file;
}
$pagenum = isset($_GET['pagenum']) ? absint($_GET['pagenum']) : 1;
$limit = 10;
// number of rows in page
$offset = ($pagenum - 1) * $limit;
$i = $offset;
if ($_REQUEST['form_id'] != "") {
    $attchmentids = $form_fields->crf_get_all_attachments_ids($_REQUEST['form_id']);
    //print_r($attchmentids);die;
    $total = count($attchmentids);
    $num_of_pages = ceil($total / $limit);
    if ($total - $offset <= $limit) {
        $total_records = $total - $offset + $offset;