<script type="text/javascript" src="<?php echo GLOBAL_ADMIN_JS_PATH; ?>highslide/highslide-with-gallery.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo GLOBAL_ADMIN_JS_PATH; ?>highslide/highslide.css" />
<script type="text/javascript">
    function verify()
    {
        SendGridBindRequest('<?= $commonpdfObj->urlwithpara ?>','gridbody','D','chkgrow');
    }
</script>
<div class="web-booking-main" id="gridbody" style="padding-right:2px;">
    <?php if ($_REQUEST['action'] != '') $action = ucwords($_REQUEST['action']); ?>
    <div class="breadcrumbs"><a href="index.php">&nbsp;&nbsp;Home </a>&nbsp;><a href="index.php?module=commonpdf"></a> &nbsp;<span class="current">&nbsp;Manage Common Files</span>  </div>
    <div class="clear"></div>
    <?= $messagebox; ?>
    <?php echo $headerpanel; ?>
    <?php echo $pagingTop; ?>
    <?php echo $notemessagebox; ?>

    <div class="clear"></div>
    <div class="grid-list-subtitle-bg" style="margin-top:10px;margin-right: 1px;">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td width="3%" align="left" valign="middle" class="grid-td-left">
                    <?php if ($paramMain['Delete'] == 'Y') { ?>
                        <input name="chkall" id="chkall" type="checkbox" onclick="checkall('chkgrow')"  />
                    <?php } else { ?>
                        &nbsp;
                    <?php } ?>
                </td>
                <td width="3%" align="left" valign="top" class="grid-td-top">&nbsp;</td>
                <td width="44%" align="left" valign="top" class="grid-td-top"><a href="javascript:;" onclick="SendGridBindRequest('<?= $commonpdfObj->urlwithoutsort ?>&orderby=var_title&sorting=Y','gridbody','ST')">Title
                        <?= $setsortimgvar_title ?></a>
                </td>
                <td width="25%" align="center" valign="top" class="grid-td-top">File</td>
                <td width="7%" align="center" valign="middle" class="grid-td-top">
                            <table border="0" cellpadding="0" cellspacing="0">
                            <tr>
                            <td width="80%" nowrap><a href="javascript:;" onclick="SendGridBindRequest('<?=$commonpdfObj->urlwithoutsort?>&orderby=int_displayorder&sorting=Y','gridbody','ST')">Display Order<?=$setsortimgint_displayorder?></a></td>
                            <td width="20%">
                                    <?php if($paramMain['Edit'] =='Y') { ?>
                                <a href="javascript:;" onclick="javascript:SendGridBindRequest('<?=$commonpdfObj->urlwithoutsort?>','gridbody','DO');"><img src="<?=GLOBAL_ADMIN_IMAGES_PATH?>save.png" width="16" height="16" alt="save" title="Click here to save the display order/rank" border="0" /></a>
                                        <?php } else { ?>
                                        &nbsp;
                                    <?php }  ?>
                            </td>
                            </tr>
                        </table>
                    </td>
                <td width="14%" align="center" valign="top" class="grid-td-top"><a href="javascript:;" onclick="SendGridBindRequest('<?= $commonpdfObj->urlwithoutsort ?>&orderby=chr_publish&sorting=Y','gridbody','ST')">Display<?= $setsortimgchr_publish ?></a></td>
            </tr>
        </table>
    </div>

    <div class="information-white-bg" id="dvpersonalinformation"  style=" margin-right: 1px;" >
        <div class="clear"></div>
        <div class="grid-list-inner-table-text" >
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
            </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <?php
                if ($numofrows > 0) {
                    $rowcount = 0;
                    while ($row = $configObj->glDbObj->fetch_array($result)) {
//                        $clsname = ($row['chr_read'] == 'N') ? "grid-list-inner-table-text-active" : "grid-list-inner-table-text"; // For read unread class
                        $starimg = ($row['chr_star'] == 'Y') ? "gstar.png" : "gstar-disable.png"; // Displaying the stat and unstart image
                        $tool = ($row['chr_star'] == 'Y') ? "Starred" : "Not starred";
                        $tickimg = ($row['chr_publish'] == 'Y') ? "tick.png" : "tick_cross.png"; // Displaying the stat and unstart image
                        ?>
                        <tr id="gtr-<?= $row['int_glcode'] ?>"  style="background-color: transparent;"   onmouseover="this.style.backgroundColor='#f6f6f6'" onmouseout="this.style.backgroundColor='transparent'" >
                            <td width="6%" align="left" valign="middle" class="grid-td-left">
                                <?php if ($paramMain['Delete'] == 'Y') { ?>
                                    <input name="chkgrow" id="chkgrow" type="checkbox" value="<?php echo $row['int_glcode'] ?>" />
                                <?php } else { ?>
                                    &nbsp;
                                <?php } ?>
                            </td>
                            <?php if ($configObj->glSessionObj->value('admin_id') == '1') { ?>
                                <!--<td width="3%" align="center" valign="middle" class="grid-left1"><img id="star-<?= $row['int_glcode'] ?>" height="16" width="16" alt="Not Starred" title="<?php echo $tool; ?>" src="<?= GLOBAL_ADMIN_IMAGES_PATH ?><?= $starimg ?>" style="vertical-align:middle;cursor:pointer;"onclick="UpdateStar('ecl_pdf_mst','chr_star','<?= $row['int_glcode'] ?>');"></td>-->
                            <?php } else { ?>
                                <!--<td width="3%" align="center" valign="middle" class="grid-left1"></td>-->
                            <?php } ?>
                            <?php
                            $char = $configObj->glLibraryObj->add_special_chars(substr($row['var_title'], 0, 40));
                            if (strlen($row['var_title']) > 40) {
                                $char.='...';
                            }
                            ?>

                            <td width="40%" align="left" valign="middle" class="grid-td-top">
                                <?php if ($paramMain['Edit'] == 'Y') { ?>
                                    <a href="<?php echo $commonpdfObj->urlwithpara; ?>&amp;action=edit&amp;eid=<?php echo $row['int_glcode']; ?>"><span><?php echo $char; ?></span></a>
                                <?php } else { ?>
                                    <span><?php echo $char; ?></span>
                                <?php } ?>
                            </td>
                            <td width="25%" align="center" valign="middle" class="grid-td-top">
                                <?php
                                if ($row['var_pdffile'] != '') {
                                    $fileexntension = substr(strrchr($row['var_pdffile'], '.'), 1);

                                    $p = explode('.', $row['var_pdffile']);
                                    if ($fileexntension == 'doc' || $fileexntension == 'docx') {
                                        $t = 'WORD.png';
                                    } else if ($fileexntension == 'zip' || $fileexntension == 'rar') {
                                        $t = 'zip-icon.jpeg';
                                    } else if ($fileexntension == 'ppt' || $fileexntension == 'pptx') {
                                        $t = "ppt-icon.png";
                                    } else {
                                        $t = 'acrobate-readericon.png';
                                    }
                                    ?>
                                    <a href="download.php?f=<?php echo urlencode('upimages/commonpdf/' . $row['var_pdffile']); ?>&module=commonpdf" >
                                        <img id="pdficon" height="16" width="16" alt="<?= $title ?>" title="<?= $var_pdffile ?>" src="<?= GLOBAL_ADMIN_IMAGES_PATH ?>/<?= $t ?>" style="vertical-align:middle;cursor:pointer;">
                                    </a>
                                <?php } ?>
                            </td>
                            <td width="7%" align="center" valign="middle" class="grid-td-top" >
             <input type="text" class="order" name="displayorder<?=$rowcount?>" id="displayorder<?=$rowcount?>" maxlength="3"  onkeypress="return KeycheckOnlyNumeric(event);" value="<?=$row['int_displayorder'];?>" />
             <input type="hidden" name="hdndisplayorder<?=$rowcount?>" id="hdndisplayorder<?=$rowcount?>" value="<?=$row['int_displayorder']?>" />
             <input type="hidden" name="hdnintglcode<?=$rowcount?>" id="hdnintglcode<?=$rowcount?>"  value="<?=$row['int_glcode']?>" />
          </td>
                            
                            <?php if ($configObj->glSessionObj->value('admin_id') == '1' || DISPLAY_DISPORDER_FLAG == 'Y') { ?>
                            <?php } ?>
                            <td width="14%" align="center" valign="middle" class="grid-td-top" >
                                <?php if ($paramMain['Publish'] == 'Y') { ?>
                                    <a href="#">
                                        <img id="tick-<?= $row['int_glcode'] ?>" height="16" width="16" alt="<?= $title ?>" title="<?= $title ?>" src="<?= GLOBAL_ADMIN_IMAGES_PATH ?><?= $tickimg ?>" style="vertical-align:middle;cursor:pointer;" onclick="UpdatePublish_modulewise('ecl_pdf_mst','chr_publish','<?= $row['int_glcode'] ?>','','commonpdf');">
                                    </a>
                                <?php } else { ?>
                                    <img id="tick-<?= $row['int_glcode'] ?>" height="16" width="16" alt="<?= $title ?>"  src="<?= GLOBAL_ADMIN_IMAGES_PATH ?><?= $tickimg ?>" style="vertical-align:middle;" >
                                <?php } ?>
                            </td>
                        </tr>
                        <?php
                        $rowcount++;
                    }
                } else {
                    ?>
                    <tr style="background-color: transparent;"   onmouseover="this.style.backgroundColor='#f6f6f6'" onmouseout="this.style.backgroundColor='transparent'">
                        <td height="25" align="center" valign="middle" colspan="7" class="form_titles">Sorry! No records are available.</td>
                    </tr>
                    <?php
                }
                ?>
                <input type="hidden" name="ptrecords" id="ptrecords" value="<?= $rowcount ?>">
            </table>
        </div>
    </div>
    <div class="clear"></div>

    <?php echo $pagingBottom; ?>
    <?php if ($numofrows > 0) { ?>
        <?php if ($paramMain['Delete'] == 'Y') { ?>
            <div class="add-new-user-button"><a href="javascript:" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image47','','<?= GLOBAL_ADMIN_IMAGES_PATH ?>delete-button-hover.jpg',0)"><img src="<?= GLOBAL_ADMIN_IMAGES_PATH ?>delete-button.jpg" alt="Delete" name="Image47" width="80" height="25" border="0" id="Image47" onclick="return verify();" /></a></div>
                <?php } ?>
            <?php } ?>
</div>