Ejemplo n.º 1
0
 *
 * $Id$
 * @package sitehome
 * @subpackage functions
 */
/**
 * required setup
 */
global $gContent;
require_once SITEHOME_PKG_PATH . 'BitSiteHome.php';
require_once LIBERTY_PKG_PATH . 'lookup_content_inc.php';
if (empty($lookupHash)) {
    $lookupHash =& $_REQUEST;
}
// 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) || strtolower(get_class($gContent)) != 'bitsitehome' || !$gContent->isValid()) {
    // if sitehome_id supplied, use that
    if (@BitBase::verifyId($lookupHash['sitehome_id'])) {
        $gContent = new BitSiteHome($lookupHash['sitehome_id']);
        // if content_id supplied, use that
    } elseif (@BitBase::verifyId($lookupHash['content_id'])) {
        $gContent = new BitSiteHome(NULL, $lookupHash['content_id']);
    } elseif (@BitBase::verifyId($lookupHash['sitehome']['sitehome_id'])) {
        $gContent = new BitSiteHome($lookupHash['sitehome']['sitehome_id']);
        // otherwise create new object
    } else {
        $gContent = new BitSiteHome();
    }
    $gContent->load();
    $gBitSmarty->assign_by_ref("gContent", $gContent);
}
Ejemplo n.º 2
0
        $formHash['delete'] = TRUE;
        $formHash['submit_mult'] = 'remove_sitehomes';
        foreach ($_REQUEST["checked"] as $del) {
            $tmpPage = new BitSiteHome($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' => 'Are you sure you want to delete ' . count($_REQUEST["checked"]) . ' sitehomes?', 'error' => 'This cannot be undone!'));
    } else {
        foreach ($_REQUEST["checked"] as $deleteId) {
            $tmpPage = new BitSiteHome($deleteId);
            if (!$tmpPage->load() || !$tmpPage->expunge()) {
                array_merge($errors, array_values($tmpPage->mErrors));
            }
        }
        if (!empty($errors)) {
            $gBitSmarty->assign_by_ref('errors', $errors);
        }
    }
}
// create new sitehome object
$sitehome = new BitSiteHome();
$sitehomesList = $sitehome->getList($_REQUEST);
$gBitSmarty->assign_by_ref('sitehomesList', $sitehomesList);
// getList() has now placed all the pagination information in $_REQUEST['listInfo']
$gBitSmarty->assign_by_ref('listInfo', $_REQUEST['listInfo']);
// Display the template