Ejemplo n.º 1
0
/**
* Return the form to configure blocks
*/
function configure_block()
{
    global $xoopsSecurity;
    if (!$xoopsSecurity->check()) {
        response(__('Sorry, you are not allowed to view this page', 'rmcommon'), array(), 1, 0);
    }
    $id = rmc_server_var($_POST, 'block', 0);
    if ($id <= 0) {
        response(__('The block that you specified seems to be invalid. Please try again', 'rmcommon'), array(), 1, 1);
    }
    $block = new RMInternalBlock($id);
    if ($block->isNew()) {
        response(__('Specified block does not exists!. Please try again', 'rmcommon'), array(), 1, 1);
    }
    $positions = RMBlocksFunctions::block_positions(1);
    $form = new RMForm('', '', '');
    $canvas = new RMFormModules('', 'bk_mod', 1, 1, $block->sections(), 3, null, false, 1);
    $canvas->subpages($block->subpages());
    // Groups
    $groups = new RMFormGroups('', 'bk_groups', true, 1, 3, $block->readGroups());
    $block_options = $block->getOptions();
    ob_start();
    include RMTemplate::get()->get_template('rmc-block-form.php', 'module', 'rmcommon');
    $form = ob_get_clean();
    $ret = array('id' => $block->id(), 'content' => $form);
    response(sprintf(__('Configuration form for block "%s" was loaded successfully!', 'rmcommon'), $block->getVar('name')), $ret, 0, 1);
    die;
}