コード例 #1
0
function xnpbookGetDetailBlock($item_id)
{
    // get uid
    global $xoopsUser;
    $myuid = is_object($xoopsUser) ? $xoopsUser->getVar('uid', 'n') : UID_GUEST;
    // set to template
    global $xoopsTpl;
    $tpl = new XoopsTpl();
    // copy variables in $xoopsTpl to $tpl
    $tpl->assign($xoopsTpl->get_template_vars());
    $tpl->assign('editable', xnp_get_item_permission($_SESSION['XNPSID'], $item_id, OP_MODIFY));
    $tpl->assign('basic', xnpGetBasicInformationDetailBlock($item_id));
    $tpl->assign('index', xnpGetIndexDetailBlock($item_id));
    $tpl->assign('attachment', xnpGetAttachmentDetailBlock($item_id, 'book_pdf'));
    $xnpbook_handler =& xoonips_getormcompohandler('xnpbook', 'item');
    $tpl->assign('xoonips_item', $xnpbook_handler->getTemplateVar(XOONIPS_TEMPLATE_TYPE_ITEM_DETAIL, $item_id, $myuid));
    // return as HTML
    return $tpl->fetch('db:xnpbook_detail_block.html');
}
コード例 #2
0
function xnp_get_index_id_by_item_id($sess_id, $item_id, &$xids)
{
    $item_id = (int) $item_id;
    $xids = array();
    global $xoopsDB;
    if (!xnp_is_valid_session_id($sess_id)) {
        return RES_NO_SUCH_SESSION;
    }
    if (!xnp_get_item_permission($sess_id, $item_id, OP_READ)) {
        return RES_NO_READ_ACCESS_RIGHT;
    }
    $sql = "SELECT index_id FROM " . $xoopsDB->prefix("xoonips_index_item_link") . " WHERE item_id={$item_id}";
    $result = $xoopsDB->query($sql);
    if (!$result) {
        _xnpal_setLastErrorString("error in getIndexIDByItemID " . $xoopsDB->error() . " sql={$sql}" . " at " . __LINE__ . " in " . __FILE__ . "\n" . xnp_get_last_error_string());
        return RES_DB_QUERY_ERROR;
    }
    while (list($xid) = $xoopsDB->fetchRow($result)) {
        $xids[] = $xid;
    }
    _xnpal_setLastErrorString("");
    return RES_OK;
}
コード例 #3
0
function xnppaperGetPrinterFriendlyDetailBlock($item_id)
{
    // get uid
    global $xoopsUser;
    $myuid = is_object($xoopsUser) ? $xoopsUser->getVar('uid', 'n') : UID_GUEST;
    global $xoopsTpl;
    $mhandler =& xoops_gethandler('module');
    $chandler =& xoops_gethandler('config');
    $module = $mhandler->getByDirname('xnppaper');
    $assoc = $chandler->getConfigsByCat(false, $module->mid());
    // set to template
    $tpl = new XoopsTpl();
    // copy variables in $xoopsTpl to $tpl
    $tpl->assign($xoopsTpl->get_template_vars());
    $tpl->assign('editable', xnp_get_item_permission($_SESSION['XNPSID'], $item_id, OP_MODIFY));
    $tpl->assign('basic', xnpGetBasicInformationPrinterFriendlyBlock($item_id));
    $tpl->assign('index', xnpGetIndexPrinterFriendlyBlock($item_id));
    $tpl->assign('paper_pdf_reprint', xnpGetAttachmentPrinterFriendlyBlock($item_id, 'paper_pdf_reprint'));
    // Make sure that this user access to item_id is permitted or not
    $tpl->assign('show_pdf', $assoc['pdf_access_rights'] <= xnpGetAccessRights($item_id));
    $tpl->assign('show_abstract', $assoc['abstract_access_rights'] <= xnpGetAccessRights($item_id));
    $xnppaper_handler =& xoonips_getormcompohandler('xnppaper', 'item');
    $tpl->assign('xoonips_item', $xnppaper_handler->getTemplateVar(XOONIPS_TEMPLATE_TYPE_ITEM_DETAIL, $item_id, $myuid));
    // return as HTML
    return $tpl->fetch('db:xnppaper_detail_block.html');
}
コード例 #4
0
function xnppresentationGetPrinterFriendlyDetailBlock($item_id)
{
    // get uid
    global $xoopsUser;
    $myuid = is_object($xoopsUser) ? $xoopsUser->getVar('uid', 'n') : UID_GUEST;
    global $xoopsTpl;
    // get DetailInformation
    $detail_handler =& xoonips_getormhandler('xnppresentation', 'item_detail');
    $detail_orm =& $detail_handler->get($item_id);
    if (!$detail_orm) {
        return '';
    }
    // set to template
    $tpl = new XoopsTpl();
    // copy variables in $xoopsTpl to $tpl
    $tpl->assign($xoopsTpl->get_template_vars());
    $tpl->assign('editable', xnp_get_item_permission($_SESSION['XNPSID'], $item_id, OP_MODIFY));
    $tpl->assign('basic', xnpGetBasicInformationPrinterFriendlyBlock($item_id));
    $tpl->assign('index', xnpGetIndexPrinterFriendlyBlock($item_id));
    $tpl->assign('preview', xnpGetPreviewPrinterFriendlyBlock($item_id));
    $tpl->assign('presentation_file', xnpGetAttachmentPrinterFriendlyBlock($item_id, 'presentation_file'));
    $tpl->assign('readme', xnpGetTextFilePrinterFriendlyBlock($item_id, 'readme', $detail_orm->getVar('readme', 'n')));
    $tpl->assign('rights', xnpGetRightsPrinterFriendlyBlock($item_id, $detail_orm->getVar('use_cc', 'n'), $detail_orm->getVar('rights', 'n'), $detail_orm->getVar('cc_commercial_use', 'n'), $detail_orm->getVar('cc_modification', 'n')));
    $xnppresentation_handler =& xoonips_getormcompohandler('xnppresentation', 'item');
    $tpl->assign('xoonips_item', $xnppresentation_handler->getTemplateVar(XOONIPS_TEMPLATE_TYPE_ITEM_DETAIL, $item_id, $myuid));
    // return as HTML
    return $tpl->fetch('db:xnppresentation_detail_block.html');
}
コード例 #5
0
function xnpbinderGetDetailBlock($item_id)
{
    // Get Block of BasicInformation / RegisteredItem.
    $basic = xnpGetBasicInformationDetailBlock($item_id);
    $index = xnpGetIndexDetailBlock($item_id);
    $detail = xnpbinder_get_registered_items($item_id);
    // Variables are set to template.
    global $xoopsTpl;
    $tpl = new XoopsTpl();
    // Variables set to $xoopsTpl ( $xoops_url etc.. ) is copied to $tpl.
    $tpl->assign($xoopsTpl->get_template_vars());
    $tpl->assign('editable', xnp_get_item_permission($_SESSION['XNPSID'], $item_id, OP_MODIFY));
    $tpl->assign('basic', $basic);
    $tpl->assign('index', $index);
    $tpl->assign('detail', $detail);
    // Output in HTML.
    return $tpl->fetch('db:xnpbinder_detail_block.html');
}