/**
 * Prints the table part of a single page item for the sortable pages list
 *
 * @param object $page The array containing the single page
 * @param bool $flag set to true to flag the element as having a problem with nesting level
 */
function printItemsListTable($item, $flag)
{
    global $_zp_gallery;
    $array = getItemTitleAndURL($item);
    if ($array['valid']) {
        switch ($item['type']) {
            case "album":
                $link = '<a href="../../admin-edit.php?page=edit&amp;album=' . html_encode($item['link']) . '">' . html_encode(truncate_string($item['link'], 40, '...')) . '</a>';
                break;
            case "zenpagenewsindex":
                if (!class_exists('zenpage')) {
                    $link = '<span class="notebox">' . gettext('Zenpage CMS plugin required for this item type!') . '</span>';
                }
                break;
            case "zenpagepage":
                if (class_exists('zenpage')) {
                    $link = '<a href="../zenpage/admin-edit.php?page&amp;titlelink=' . html_encode($item['link']) . '">' . html_encode(truncate_string($item['link'], 40, '...')) . '</a>';
                } else {
                    $link = '<span class="notebox">' . gettext('Zenpage CMS plugin required for this item type!') . '</span>';
                }
                break;
            case "zenpagecategory":
                if (class_exists('zenpage')) {
                    $link = '<a href="../zenpage/admin-edit.php?newscategory&amp;titlelink=' . html_encode($item['link']) . '">' . html_encode(truncate_string($item['link'], 40, '...')) . '</a>';
                } else {
                    $link = '<span class="notebox">' . gettext('Zenpage CMS plugin required for this item type!') . '</span>';
                }
                break;
            case 'customlink':
                $link = '<a href="' . html_encode($item['link']) . '">' . html_encode(truncate_string($item['link'], 40, '...')) . '</a>';
                break;
            case 'menulabel':
                $link = '';
                break;
            default:
                $link = html_encode(truncate_string($item['link'], 40, '...'));
                break;
        }
    } else {
        $link = '<span class="notebox">' . sprintf(gettext('Target does not exists in <em>%1$s</em> theme'), $array['theme']) . '</span>';
    }
    ?>
	<div class="page-list_row">
		<div class="page-list_title">
			<?php 
    printItemEditLink($item);
    ?>
		</div>
		<div class="page-list_extra">
			<em><?php 
    echo $item['type'];
    ?>
</em>
		</div>
		<div class="page-list_extra">
			<?php 
    echo $link;
    ?>
		</div>
		<div class="page-list_iconwrapper">
			<div class="page-list_icon">
				<?php 
    if ($array['protected']) {
        ?>
					<img src="../../images/lock_2.png" alt="<?php 
        echo gettext("The object of this menu is under password protection");
        ?>
" title="<?php 
        echo gettext("The object of this menu is under password protection");
        ?>
" style="border: 0px;" />
					<?php 
    } else {
        ?>
					<img src="../../images/place_holder_icon.png" alt="<?php 
        echo gettext("under password protection");
        ?>
" style="border: 0px;" />
					<?php 
    }
    ?>
			</div>
			<div class="page-list_icon">
				<?php 
    if ($item['show'] === '1') {
        ?>
					<a href="menu_tab.php?publish&amp;id=<?php 
        echo $item['id'] . "&amp;show=0";
        ?>
&amp;add&amp;XSRFToken=<?php 
        echo getXSRFToken('update_menu');
        ?>
" title="<?php 
        echo gettext('hide');
        ?>
" >
						<img src="../../images/pass.png"	alt="<?php 
        echo gettext('hide');
        ?>
" style="border: 0px;" />
					</a>
					<?php 
    } else {
        ?>
					<a href="menu_tab.php?publish&amp;id=<?php 
        echo $item['id'] . "&amp;show=1";
        ?>
&amp;add&amp;XSRFToken=<?php 
        echo getXSRFToken('update_menu');
        ?>
"  title="<?php 
        echo gettext('show');
        ?>
">
						<img src="../../images/action.png"	alt="<?php 
        echo gettext('show');
        ?>
" style="border: 0px;" />
					</a>
					<?php 
    }
    ?>
			</div>
			<div class="page-list_icon">
				<?php 
    switch ($item['type']) {
        default:
            if (!empty($array['url'])) {
                ?>
							<a href="<?php 
                echo $array['url'];
                ?>
">
								<img src="../../images/view.png" alt="<?php 
                echo gettext('view');
                ?>
" title="<?php 
                echo gettext('view');
                ?>
" style="border: 0px;" />
							</a>
							<?php 
                break;
            }
        case 'menulabel':
        case 'menufunction':
        case 'html':
            ?>
						<img src="../../images/icon_inactive.png" alt="" style="border: 0px;" />
						<?php 
            break;
    }
    ?>
			</div>
			<div class="page-list_icon">
				<a href="javascript:deleteMenuItem('<?php 
    echo $item['id'];
    ?>
','<?php 
    printf(gettext('Ok to delete %s? This cannot be undone.'), html_encode($array['name']));
    ?>
');" >
					<img src="../../images/fail.png" alt="<?php 
    echo gettext('delete');
    ?>
" title="<?php 
    echo gettext('delete');
    ?>
" style="border: 0px;" />
				</a>
			</div>
			<div class="page-list_icon">
				<input class="checkbox" type="checkbox" name="ids[]" value="<?php 
    echo html_encode($item['id']);
    ?>
" onclick="triggerAllBox(this.form, 'ids[]', this.form.allbox);" />
			</div>
		</div>
	</div>
	<?php 
}
/**
 * Prints the table part of a single page item for the sortable pages list
 *
 * @param object $page The array containing the single page
 * @param bool $flag set to true to flag the element as having a problem with nesting level
 */
function printItemsListTable($item, $flag)
{
    $gallery = new Gallery();
    ?>
 <div class="page-list_row">
	<div class="page-list_title">
			<?php 
    $array = getItemTitleAndURL($item);
    printItemEditLink($item);
    ?>
		</div>
		<div class="page-list_extra"><?php 
    echo html_encode(truncate_string($array['name'], 40, '...'));
    ?>
</div>
		<div class="page-list_extra"><em><?php 
    echo $item['type'];
    ?>
</em></div>
		<div class="page-list_iconwrapper">
		<div class="page-list_icon">
			<?php 
    if ($array['protected']) {
        ?>
				<img src="../../images/lock_2.png" alt="<?php 
        echo gettext("The object of this menu is under password protection");
        ?>
" title="<?php 
        echo gettext("The object of this menu is under password protection");
        ?>
" style="border: 0px;" />
				<?php 
    } else {
        ?>
				<img src="../../images/place_holder_icon.png" alt="<?php 
        echo gettext("under password protection");
        ?>
"style="border: 0px;" />
				<?php 
    }
    ?>
		</div>
		<div class="page-list_icon">
		<?php 
    if ($item['show'] === '1') {
        ?>
			<a href="menu_tab.php?publish&amp;id=<?php 
        echo $item['id'] . "&amp;show=0";
        ?>
&amp;add&amp;XSRFToken=<?php 
        echo getXSRFToken('update_menu');
        ?>
" title="<?php 
        echo gettext('hide');
        ?>
" >
				<img src="../../images/pass.png"	alt="<?php 
        echo gettext('hide');
        ?>
" style="border: 0px;" />
			</a>
			<?php 
    } else {
        ?>
			<a href="menu_tab.php?publish&amp;id=<?php 
        echo $item['id'] . "&amp;show=1";
        ?>
&amp;add&amp;XSRFToken=<?php 
        echo getXSRFToken('update_menu');
        ?>
"  title="<?php 
        echo gettext('show');
        ?>
">
				<img src="../../images/action.png"	alt="<?php 
        echo gettext('show');
        ?>
" style="border: 0px;" />
			</a>
			<?php 
    }
    ?>
	</div>
		<div class="page-list_icon">
			<?php 
    switch ($item['type']) {
        default:
            if (!empty($array['url'])) {
                ?>
						<a href="<?php 
                echo $array['url'];
                ?>
">
							<img src="../../images/view.png" alt="<?php 
                echo gettext('view');
                ?>
" title="<?php 
                echo gettext('view');
                ?>
" style="border: 0px;" />
						</a>
						<?php 
                break;
            }
        case 'menulabel':
        case 'menufunction':
        case 'html':
            ?>
					<img src="../../images/icon_inactive.png" alt="" style="border: 0px;" />
					<?php 
            break;
    }
    ?>
		</div>
		<div class="page-list_icon">
			<a href="javascript:deleteMenuItem('<?php 
    echo $item['id'];
    ?>
','<?php 
    printf(gettext('Ok to delete %s? This cannot be undone.'), html_encode($array['name']));
    ?>
');" >
				<img src="../../images/fail.png" alt="<?php 
    echo gettext('delete');
    ?>
" title="<?php 
    echo gettext('delete');
    ?>
" style="border: 0px;" />
			</a>
		</div>
		<div class="page-list_icon">
		<input class="checkbox" type="checkbox" name="ids[]" value="<?php 
    echo html_encode($item['id']);
    ?>
" onclick="triggerAllBox(this.form, 'ids[]', this.form.allbox);" />
	</div>
	</div>
</div>
	<?php 
}