コード例 #1
0
ファイル: list.php プロジェクト: bitweaver/suggestion
        $formHash['submit_mult'] = 'remove_suggestion_data';
        foreach ($_REQUEST["checked"] as $del) {
            $tmpPage = new BitSuggestion($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"]) . ' suggestion records?', 'error' => tra('This cannot be undone!')));
    } else {
        foreach ($_REQUEST["checked"] as $deleteId) {
            $tmpPage = new BitSuggestion($deleteId);
            if (!$tmpPage->load() || !$tmpPage->expunge()) {
                array_merge($errors, array_values($tmpPage->mErrors));
            }
        }
        if (!empty($errors)) {
            $gBitSmarty->assign_by_ref('errors', $errors);
        }
    }
}
// Create new suggestion object
$suggestion = new BitSuggestion();
$suggestionList = $suggestion->getList($_REQUEST);
$gBitSmarty->assign_by_ref('suggestionList', $suggestionList);
// getList() has now placed all the pagination information in $_REQUEST['listInfo']
$gBitSmarty->assign_by_ref('listInfo', $_REQUEST['listInfo']);
// Display the template
$gBitSystem->display('bitpackage:suggestion/list_suggestion.tpl', tra('Suggestion'), array('display_mode' => 'list'));
コード例 #2
0
<?php

global $gContent;
require_once SUGGESTION_PKG_PATH . 'BitSuggestion.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 suggestion_id supplied, use that
    if (@BitBase::verifyId($_REQUEST['suggestion_id'])) {
        $gContent = new BitSuggestion($_REQUEST['suggestion_id']);
        // if content_id supplied, use that
    } elseif (@BitBase::verifyId($_REQUEST['content_id'])) {
        $gContent = new BitSuggestion(NULL, $_REQUEST['content_id']);
    } elseif (@BitBase::verifyId($_REQUEST['suggestion']['suggestion_id'])) {
        $gContent = new BitSuggestion($_REQUEST['suggestion']['suggestion_id']);
        // otherwise create new object
    } else {
        $gContent = new BitSuggestion();
    }
    $gContent->load();
    $gBitSmarty->assign_by_ref("gContent", $gContent);
}