function xnppresentationGetRegisterBlock()
{
    global $xoopsDB;
    $myts =& MyTextSanitizer::getInstance();
    // retrieve detail information
    $formdata =& xoonips_getutility('formdata');
    if ($formdata->getValue('get', 'post_id', 's', false)) {
        $detail = array('presentation_type' => $formdata->getValue('post', 'presentation_type', 's', true));
    } else {
        $detail = array('presentation_type' => 'other');
    }
    // retrieve blocks of BasicInformation / Preview / index block
    $basic = xnpGetBasicInformationRegisterBlock();
    $preview = xnpGetPreviewRegisterBlock();
    $index = xnpGetIndexRegisterBlock();
    $presentation_file = xnpGetAttachmentRegisterBlock('presentation_file');
    $readme = xnpGetTextFileRegisterBlock('readme');
    $rights = xnpGetRightsRegisterBlock();
    // assign to template
    global $xoopsTpl;
    $tpl = new XoopsTpl();
    $tpl->assign($xoopsTpl->get_template_vars());
    // variables assigned to xoopsTpl are copied to tpl
    $tpl->assign('basic', $basic);
    $tpl->assign('preview', $preview);
    $tpl->assign('index', $index);
    $tpl->assign('presentation_file', $presentation_file);
    $tpl->assign('attachment_dl_limit', xnpGetDownloadLimitationOptionRegisterBlock('xnppresentation'));
    $tpl->assign('attachment_dl_notify', xnpGetDownloadNotificationOptionRegisterBlock('xnppresentation'));
    $tpl->assign('detail', $detail);
    $tpl->assign('readme', $readme);
    $tpl->assign('rights', $rights);
    $tpl->assign('presentation_type', xnppresentationGetTypes());
    $tpl->assign('presentation_type_selected', $detail['presentation_type']);
    $tpl->assign('xnppresentation_creator', xoonips_get_multiple_field_template_vars(xoonips_get_orm_from_post('xnppresentation', 'creator'), 'xnppresentation', 'creator'));
    // return HTML content
    return $tpl->fetch('db:xnppresentation_register_block.html');
}
function xnpmodelGetRegisterBlock()
{
    global $xoopsDB;
    $formdata =& xoonips_getutility('formdata');
    // retrive creator, model_type from GET/POST array
    foreach (array('model_type', 'readme', 'rights') as $k) {
        $tmp = $formdata->getValue('both', $k, 's', false);
        if ($tmp !== NULL) {
            ${$k} = $tmp;
        } else {
            ${$k} = false;
        }
    }
    // get BasicInformation / Preview / Readme / License / index block
    $basic = xnpGetBasicInformationRegisterBlock();
    $model_types = xnpmodel_get_type_array();
    if ($model_type == false) {
        list($model_type) = each($model_types);
    }
    $detail = array('model_type' => array('value' => $model_type, 'display_value' => $model_types[$model_type], 'select' => xnpmodel_get_type_array()));
    $preview = xnpGetPreviewRegisterBlock();
    $index = xnpGetIndexRegisterBlock();
    $attachment = xnpGetAttachmentRegisterBlock('model_data');
    $readme = xnpGetTextFileRegisterBlock('readme');
    $rights = xnpGetRightsRegisterBlock();
    // set to template
    global $xoopsTpl;
    $tpl = new XoopsTpl();
    // copy variables in $xoopsTpl to $tpl
    $tpl->assign($xoopsTpl->get_template_vars());
    $tpl->assign('basic', $basic);
    $tpl->assign('preview', $preview);
    $tpl->assign('index', $index);
    $tpl->assign('attachment', $attachment);
    $tpl->assign('attachment_dl_limit', xnpGetDownloadLimitationOptionRegisterBlock('xnpmodel'));
    $tpl->assign('attachment_dl_notify', xnpGetDownloadNotificationOptionRegisterBlock('xnpmodel'));
    $tpl->assign('detail', $detail);
    $tpl->assign('readme', $readme);
    $tpl->assign('rights', $rights);
    $tpl->assign('xnpmodel_creator', xoonips_get_multiple_field_template_vars(xoonips_get_orm_from_post('xnpmodel', 'creator'), 'xnpmodel', 'creator'));
    // return as HTML
    return $tpl->fetch('db:xnpmodel_register_block.html');
}
function xnpdataGetRegisterBlock()
{
    $textutil =& xoonips_getutility('text');
    $formdata =& xoonips_getutility('formdata');
    // get DetailInformation
    if ($formdata->getValue('get', 'post_id', 's', false)) {
        $detail = array('data_type' => $textutil->html_special_chars($formdata->getValue('post', 'data_type', 's', true)));
    } else {
        $detail = array('data_type' => '');
    }
    // get BasicInformation / Preview / index block
    $basic = xnpGetBasicInformationRegisterBlock();
    $preview = xnpGetPreviewRegisterBlock();
    $index = xnpGetIndexRegisterBlock();
    $data_file = xnpGetAttachmentRegisterBlock('data_file');
    $readme = xnpGetTextFileRegisterBlock('readme');
    $rights = xnpGetRightsRegisterBlock();
    $attachment_dl_limit = xnpGetDownloadLimitationOptionRegisterBlock('xnpdata');
    $attachment_dl_notify = xnpGetDownloadNotificationOptionRegisterBlock('xnpdata');
    // set to template
    global $xoopsTpl;
    $tpl = new XoopsTpl();
    // copy variables in $xoopsTpl to $tpl
    $tpl->assign($xoopsTpl->get_template_vars());
    $tpl->assign('basic', $basic);
    $tpl->assign('preview', $preview);
    $tpl->assign('index', $index);
    $tpl->assign('attachment_dl_limit', $attachment_dl_limit);
    $tpl->assign('attachment_dl_notify', $attachment_dl_notify);
    $tpl->assign('data_file', $data_file);
    $tpl->assign('detail', $detail);
    $tpl->assign('readme', $readme);
    $tpl->assign('rights', $rights);
    $tpl->assign('data_type', xnpdataGetTypes());
    $tpl->assign('data_type_selected', $formdata->getValue('post', 'data_type', 's', false));
    $tpl->assign('xnpdata_experimenter', xoonips_get_multiple_field_template_vars(xoonips_get_orm_from_post('xnpdata', 'experimenter'), 'xnpdata', 'experimenter'));
    // return as HTML
    return $tpl->fetch('db:xnpdata_register_block.html');
}
function xnpsimulatorGetRegisterBlock()
{
    $formdata =& xoonips_getutility('formdata');
    // retrieve detail information
    $detail = array();
    $simulator_types = xnpsimulator_get_type_array();
    $post_id = $formdata->getValue('get', 'post_id', 's', false);
    if (is_null($post_id)) {
        $simulator_type = false;
    } else {
        $simulator_type = $formdata->getValue('post', 'simulator_type', 's', false);
    }
    if ($simulator_type == false) {
        list($simulator_type) = each($simulator_types);
    }
    $detail['simulator_type'] = array('value' => $simulator_type, 'display_value' => $simulator_types[$simulator_type], 'select' => $simulator_types);
    // retrieve blocks of BasicInformation / Preview / Readme / License / index
    $basic = xnpGetBasicInformationRegisterBlock();
    $preview = xnpGetPreviewRegisterBlock();
    $index = xnpGetIndexRegisterBlock();
    $attachment = xnpGetAttachmentRegisterBlock('simulator_data');
    $readme = xnpGetTextFileRegisterBlock('readme');
    $rights = xnpGetRightsRegisterBlock();
    // assign to template
    global $xoopsTpl;
    $tpl = new XoopsTpl();
    // variables assigned to xoopsTpl are copied to tpl
    $tpl->assign($xoopsTpl->get_template_vars());
    $tpl->assign('basic', $basic);
    $tpl->assign('preview', $preview);
    $tpl->assign('index', $index);
    $tpl->assign('attachment', $attachment);
    $tpl->assign('attachment_dl_limit', xnpGetDownloadLimitationOptionRegisterBlock('xnpsimulator'));
    $tpl->assign('attachment_dl_notify', xnpGetDownloadNotificationOptionRegisterBlock('xnpsimulator'));
    $tpl->assign('detail', $detail);
    $tpl->assign('readme', $readme);
    $tpl->assign('rights', $rights);
    if (isset($simulator_date)) {
        $tpl->assign('gmtime', mktime(0, 0, 0, $simulator_date['Date_Month'], $simulator_date['Date_Day'], $simulator_date['Date_Year']));
    } else {
        $tpl->assign('gmtime', time());
    }
    $tpl->assign('xnpsimulator_developer', xoonips_get_multiple_field_template_vars(xoonips_get_orm_from_post('xnpsimulator', 'developer'), 'xnpsimulator', 'developer'));
    // return HTML content
    return $tpl->fetch('db:xnpsimulator_register_block.html');
}
function xnpurlGetRegisterBlock()
{
    $textutil =& xoonips_getutility('text');
    $formdata =& xoonips_getutility('formdata');
    // get DetailInformation
    if ($formdata->getValue('get', 'post_id', 's', false)) {
        $detail = array('url' => $textutil->html_special_chars($formdata->getValue('post', 'url', 's', true)));
    } else {
        $detail = array('url' => '');
    }
    // retrieve blocks of BasicInformation / Preview / index block
    $basic = xnpGetBasicInformationRegisterBlock();
    $preview = xnpGetPreviewRegisterBlock();
    $index = xnpGetIndexRegisterBlock();
    $url_banner_file = xnpGetAttachmentRegisterBlock('url_banner_file');
    // assign to template
    global $xoopsTpl;
    $tpl = new XoopsTpl();
    // variables assigned to xoopsTpl are copied to tpl
    $tpl->assign($xoopsTpl->get_template_vars());
    $tpl->assign('basic', $basic);
    $tpl->assign('preview', $preview);
    $tpl->assign('index', $index);
    $tpl->assign('url_banner_file', $url_banner_file);
    $tpl->assign('detail', $detail);
    // return HTML content
    return $tpl->fetch('db:xnpurl_register_block.html');
}