function xnppresentationGetEditBlock($item_id) { global $xoopsDB; $myts =& MyTextsanitizer::getInstance(); $formdata =& xoonips_getutility('formdata'); // get DetailInformation $result = $xoopsDB->query('select * from ' . $xoopsDB->prefix('xnppresentation_item_detail') . " where presentation_id={$item_id}"); foreach ($model = $xoopsDB->fetchArray($result) as $k => $v) { ${$k} = $v; } // overwrite DetailInformation with POST/GET variables foreach (array('presentation_type', 'creator', 'readme', 'rights') as $k) { if (array_key_exists($k, $_GET)) { ${$k} = $myts->stripSlashesGPC($_GET[$k]); } else { if (array_key_exists($k, $_POST)) { ${$k} = $myts->stripSlashesGPC($_POST[$k]); } } } // retrieve blocks of BasicInformation / Preview / index block $basic = xnpGetBasicInformationEditBlock($item_id); $preview = xnpGetPreviewEditBlock($item_id); $index = xnpGetIndexEditBlock($item_id); $presentation_file = xnpGetAttachmentEditBlock($item_id, 'presentation_file'); // retrieve detail information if (!is_null($formdata->getValue('get', 'post_id', 's', false))) { $myts =& MyTextSanitizer::getInstance(); $detail = array('presentation_type' => $formdata->getValue('post', 'presentation_type', 's', true), 'readme' => '', 'rights' => '', 'use_cc' => '', 'cc_commercial_use' => '', 'cc_modification' => ''); } else { if (!empty($item_id)) { $detail = xnppresentationGetDetailInformation($item_id); } else { $detail = array(); } } $readme = xnpGetTextFileEditBlock($item_id, 'readme', isset($detail['readme']) ? $detail['readme'] : ''); $rights = xnpGetRightsEditBlock($item_id, $detail['use_cc'], $detail['rights'], $detail['cc_commercial_use'], $detail['cc_modification']); // 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', xnpGetDownloadLimitationOptionEditBlock('xnppresentation', xnppresentationGetAttachmentDownloadLimitOption($item_id))); $tpl->assign('attachment_dl_notify', xnpGetDownloadNotificationOptionEditBlock('xnppresentation', xnppresentationGetAttachmentDownloadNotifyOption($item_id))); $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']); if (!$formdata->getValue('get', 'post_id', 's', false)) { $detail_handler =& xoonips_getormhandler('xnppresentation', 'item_detail'); $detail_orm =& $detail_handler->get($item_id); $tpl->assign('xnppresentation_creator', xoonips_get_multiple_field_template_vars($detail_orm->getCreators(), 'xnppresentation', 'creator')); } else { $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 xnpmodelGetEditBlock($item_id) { global $xoopsDB; $textutil =& xoonips_getutility('text'); $formdata =& xoonips_getutility('formdata'); // get DetailInformation $result = $xoopsDB->query('select * from ' . $xoopsDB->prefix('xnpmodel_item_detail') . " where model_id={$item_id}"); foreach ($model = $xoopsDB->fetchArray($result) as $k => $v) { ${$k} = $v; } // overwrite DetailInformation with POST/GET variables foreach (array('model_type', 'readme', 'rights') as $k) { $tmp = $formdata->getValue('both', $k, 's', false); if ($tmp !== NULL) { ${$k} = $tmp; } } // get BasicInformation / Preview / index block $basic = xnpGetBasicInformationEditBlock($item_id); $model_types = xnpmodel_get_type_array(); $detail = xnpmodelGetDetailInformation($item_id); $detail['model_type']['value'] = $model_type; $detail['model_type']['display_value'] = $model_types[$model_type]; $detail['model_type']['select'] = $model_types; $preview = xnpGetPreviewEditBlock($item_id); $index = xnpGetIndexEditBlock($item_id); $attachment = xnpGetAttachmentEditBlock($item_id, 'model_data'); $readme = xnpGetTextFileEditBlock($item_id, 'readme', $textutil->html_special_chars($readme)); $rights = xnpGetRightsEditBlock($item_id, $detail['use_cc']['value'], $detail['rights']['value'], $detail['cc_commercial_use']['value'], $detail['cc_modification']['value']); // 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', xnpGetDownloadLimitationOptionEditBlock('xnpmodel', xnpmodelGetAttachmentDownloadLimitOption($item_id))); $tpl->assign('attachment_dl_notify', xnpGetDownloadNotificationOptionEditBlock('xnpmodel', xnpmodelGetAttachmentDownloadNotifyOption($item_id))); $tpl->assign('detail', $detail); $tpl->assign('readme', $readme); $tpl->assign('rights', $rights); if (!$formdata->getValue('get', 'post_id', 's', false)) { $detail_handler =& xoonips_getormhandler('xnpmodel', 'item_detail'); $detail_orm =& $detail_handler->get($item_id); $tpl->assign('xnpmodel_creator', xoonips_get_multiple_field_template_vars($detail_orm->getCreators(), 'xnpmodel', 'creator')); } else { $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 xnpdataGetEditBlock($item_id) { $textutil =& xoonips_getutility('text'); $formdata =& xoonips_getutility('formdata'); // get BasicInformation / Preview / index block $basic = xnpGetBasicInformationEditBlock($item_id); $preview = xnpGetPreviewEditBlock($item_id); $index = xnpGetIndexEditBlock($item_id); $data_file = xnpGetAttachmentEditBlock($item_id, 'data_file'); // get DetailInformation $data_type = $formdata->getValue('post', 'data_type', 's', false); if (isset($data_type)) { $detail = array('data_type' => $data_type, 'readme' => '', 'rights' => '', 'use_cc' => '', 'cc_commercial_use' => '', 'cc_modification' => ''); } else { if (!empty($item_id)) { $detail = xnpdataGetDetailInformation($item_id); } else { $detail = array(); } } $readme = xnpGetTextFileEditBlock($item_id, 'readme', $detail['readme']); $rights = xnpGetRightsEditBlock($item_id, $detail['use_cc'], $detail['rights'], $detail['cc_commercial_use'], $detail['cc_modification']); $attachment_dl_limit = xnpGetDownloadLimitationOptionEditBlock('xnpdata', xnpdataGetAttachmentDownloadLimitOption($item_id)); $attachment_dl_notify = xnpGetDownloadNotificationOptionEditBlock('xnpdata', xnpdataGetAttachmentDownloadNotifyOption($item_id)); // 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', array_map(array($textutil, 'html_special_chars'), $detail)); $tpl->assign('readme', $readme); $tpl->assign('rights', $rights); $tpl->assign('data_type', xnpdataGetTypes()); $tpl->assign('data_type_selected', $detail['data_type']); if (!$formdata->getValue('get', 'post_id', 's', false)) { $detail_handler =& xoonips_getormhandler('xnpdata', 'item_detail'); $detail_orm =& $detail_handler->get($item_id); $tpl->assign('xnpdata_experimenter', xoonips_get_multiple_field_template_vars($detail_orm->getExperimenters(), 'xnpdata', 'experimenter')); } else { $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 xnpsimulatorGetEditBlock($item_id) { $formdata =& xoonips_getutility('formdata'); // retrieve detail information $detail = xnpsimulatorGetDetailInformation($item_id); $simulator_types = xnpsimulator_get_type_array(); $post_id = $formdata->getValue('get', 'post_id', 's', false); if (!is_null($post_id)) { $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 / index block $basic = xnpGetBasicInformationEditBlock($item_id); $preview = xnpGetPreviewEditBlock($item_id); $index = xnpGetIndexEditBlock($item_id); $attachment = xnpGetAttachmentEditBlock($item_id, 'simulator_data'); $readme = xnpGetTextFileEditBlock($item_id, 'readme', $detail['readme']['value']); $rights = xnpGetRightsEditBlock($item_id, $detail['use_cc']['value'], $detail['rights']['value'], $detail['cc_commercial_use']['value'], $detail['cc_modification']['value']); // 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', xnpGetDownloadLimitationOptionEditBlock('xnpsimulator', xnpsimulatorGetAttachmentDownloadLimitOption($item_id))); $tpl->assign('attachment_dl_notify', xnpGetDownloadNotificationOptionEditBlock('xnpsimulator', xnpsimulatorGetAttachmentDownloadNotifyOption($item_id))); $tpl->assign('detail', $detail); $tpl->assign('readme', $readme); $tpl->assign('rights', $rights); if (!$formdata->getValue('get', 'post_id', 's', false)) { $detail_handler =& xoonips_getormhandler('xnpsimulator', 'item_detail'); $detail_orm =& $detail_handler->get($item_id); $tpl->assign('xnpsimulator_developer', xoonips_get_multiple_field_template_vars($detail_orm->getDevelopers(), 'xnpsimulator', 'developer')); } else { $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 xnpGetTextFileRegisterBlock($name) { return xnpGetTextFileEditBlock(false, $name, ''); }