$iids = get_only_own_items($iids);
}
$selected = array_merge($selected, $selected_hidden);
if ($search_tab == 'metadata' || $search_itemtype == 'metadata') {
} else {
    $start = ($page - 1) * $item_per_page;
    if ($start >= count($iids)) {
        $page = 1;
        $start = 0;
    }
    if ($order_by == 'publication_date') {
        $cri = array('orders' => array(array('name' => 'publication_year', 'order' => $order_dir), array('name' => 'publication_month', 'order' => $order_dir), array('name' => 'publication_mday', 'order' => $order_dir)));
    } else {
        $cri = array('orders' => array(array('name' => $order_by, 'order' => $order_dir)));
    }
    if (xnp_get_items($xnpsid, $iids, $cri, $items) != RES_OK) {
        redirect_header(XOOPS_URL . '/', 3, "ERROR ");
        break;
    }
    $xoopsTpl->assign('ids', $iids);
    //slice items array
    $xoopsTpl->assign('items', $items);
    $item_htmls = array();
    $display_item_ids = array();
    $c = 0;
    $item_template_vars = array();
    foreach ($items as $i) {
        if ($start <= $c && $c < $start + $item_per_page) {
            if (array_key_exists($i['item_type_id'], $itemtypes)) {
                $itemtype = $itemtypes[$i['item_type_id']];
                $modname = $itemtype['name'];
/**
 *
 * アイテム情報取得.
 *
 * @param sess_id セッションID
 * @param iid 取得したいアイテムのID
 * @param item 結果のアイテム情報を受け取る連想配列
 * @return RES_OK
 * @return RES_DB_NOT_INITIALIZED
 * @return RES_NO_SUCH_SESSION
 * @return RES_NO_SUCH_ITEM
 * @return RES_DB_QUERY_ERROR
 *
 */
function xnp_get_item($sess_id, $iid, &$item)
{
    $items = array();
    $item = array();
    $result = xnp_get_items($sess_id, array((int) $iid), array(), $items);
    if (count($items) == 0) {
        return RES_NO_SUCH_ITEM;
    }
    $item = $items[0];
    return $result;
}
/**
 * Item's information registered in binder specified by $binder_id
 * is read from database and it returns as association_array.
 *
 * Structure of assciation_array
 *   array( 'html' => HTML of item's information, 'item_id' => number of item_id )
 *
 * @param binder_id "ID of the binder for processing"
 * @return Array => Execution result
 * @return false => Miss
 *
 */
function xnpbinder_get_registered_items($binder_id)
{
    $items = array();
    $cri = array();
    $item_id = array();
    if (xnp_get_item_id_by_binder_id($_SESSION['XNPSID'], $binder_id, $cri, $item_id) != RES_OK) {
        return false;
    }
    if (xnp_get_items($_SESSION['XNPSID'], $item_id, $cri, $items) != RES_OK) {
        return false;
    }
    $itemtypes = array();
    // $itemtypes[<item_type_id>]=array( detail of an itemtype );
    $tmp = array();
    if (xnp_get_item_types($tmp) != RES_OK) {
        redirect_header(XOOPS_URL . '/modules/xoonips/index.php', 3, 'ERROR xnp_get_item_types ');
        break;
    } else {
        foreach ($tmp as $i) {
            $itemtypes[$i['item_type_id']] = $i;
        }
    }
    $item_details = array();
    foreach ($items as $i) {
        if (array_key_exists($i['item_type_id'], $itemtypes)) {
            $itemtype = $itemtypes[$i['item_type_id']];
            include_once XOOPS_ROOT_PATH . '/modules/' . $itemtype['viewphp'];
            eval("\$body = " . $itemtype['name'] . "GetListBlock( \$i );");
            $item_details[] = array('item_id' => $i['item_id'], 'html' => $body);
        }
    }
    return $item_details;
}