Exemple #1
0
        $formHash['delete'] = TRUE;
        $formHash['submit_mult'] = 'remove_sample_data';
        foreach ($_REQUEST["checked"] as $del) {
            $tmpPage = new BitSample($del);
            if ($tmpPage->load() && !empty($tmpPage->mInfo['title'])) {
                $info = $tmpPage->mInfo['title'];
            } else {
                $info = $del;
            }
            $formHash['input'][] = '<input type="hidden" name="checked[]" value="' . $del . '"/>' . $info;
        }
        $gBitSystem->confirmDialog($formHash, array('warning' => tra('Are you sure you want to delete ') . count($_REQUEST["checked"]) . ' sample records?', 'error' => tra('This cannot be undone!')));
    } else {
        foreach ($_REQUEST["checked"] as $deleteId) {
            $tmpPage = new BitSample($deleteId);
            if (!$tmpPage->load() || !$tmpPage->expunge()) {
                array_merge($errors, array_values($tmpPage->mErrors));
            }
        }
        if (!empty($errors)) {
            $gBitSmarty->assign_by_ref('errors', $errors);
        }
    }
}
// Create new sample object
$sample = new BitSample();
$sampleList = $sample->getList($_REQUEST);
$gBitSmarty->assign_by_ref('sampleList', $sampleList);
// getList() has now placed all the pagination information in $_REQUEST['listInfo']
$gBitSmarty->assign_by_ref('listInfo', $_REQUEST['listInfo']);
// Display the template
<?php

global $gContent;
require_once SAMPLE_PKG_PATH . 'BitSample.php';
require_once LIBERTY_PKG_PATH . 'lookup_content_inc.php';
// if we already have a gContent, we assume someone else created it for us, and has properly loaded everything up.
if (empty($gContent) || !is_object($gContent) || !$gContent->isValid()) {
    // if sample_id supplied, use that
    if (@BitBase::verifyId($_REQUEST['sample_id'])) {
        $gContent = new BitSample($_REQUEST['sample_id']);
        // if content_id supplied, use that
    } elseif (@BitBase::verifyId($_REQUEST['content_id'])) {
        $gContent = new BitSample(NULL, $_REQUEST['content_id']);
    } elseif (@BitBase::verifyId($_REQUEST['sample']['sample_id'])) {
        $gContent = new BitSample($_REQUEST['sample']['sample_id']);
        // otherwise create new object
    } else {
        $gContent = new BitSample();
    }
    $gContent->load();
    $gBitSmarty->assign_by_ref("gContent", $gContent);
}