<script type="text/javascript" src="<?php echo GLOBAL_ADMIN_JS_PATH;?>highslide/highslide-with-html.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo GLOBAL_ADMIN_JS_PATH;?>highslide/highslide.css" />
<script type="text/javascript">


    hs.graphicsDir = '<?php echo GLOBAL_ADMIN_JS_PATH;?>highslide/graphics/';
    hs.align = 'center';
    hs.transitions = ['expand', 'crossfade'];
    hs.wrapperClassName = 'dark borderless floating-caption';
    hs.fadeInOut = true;
    hs.dimmingOpacity = .75;

    // Add the controlbar
    if (hs.addSlideshow) hs.addSlideshow({
        slideshowGroup: 'group1',
        interval: 5000,
        repeat: false,
        useControls: true,
        fixedControls: 'fit',
        overlayOptions: {
            opacity: .6,
            position: 'bottom center',
            hideOnMouseOut: true
        }
    });
</script>
<script type="text/javascript">
	hs.graphicsDir = '<?php echo GLOBAL_ADMIN_JS_PATH;?>highslide/graphics/';
	hs.outlineType = 'rounded-white';
	hs.showCredits = false;
	hs.wrapperClassName = 'draggable-header';
</script>
<script type="text/javascript">
    function verify()
    {
        SendGridBindRequest('<?= $ppackagetypeObj->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=packagetype"></a> &nbsp;<span class="current">&nbsp;Manage Package Types</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="center" 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="1%" align="left" valign="top" class="grid-td-top">&nbsp;</td>
                <td width="24%" align="left" valign="top" class="grid-td-top"><a href="javascript:;" onclick="SendGridBindRequest('<?= $ppackagetypeObj->urlwithoutsort ?>&orderby=var_title&sorting=Y','gridbody','ST')">Title
                        <?= $setsortimgvar_title ?></a>
                </td>
                <td width="10%" valign="middle" align="center" class="grid-td-top">View Package(s)</td>
                
                 <td width="8%" align="center" valign="middle" class="grid-td-top"style="padding-left:0px;">Image</a></td>
                <td width="11%" align="center" valign="middle" class="grid-td-top" ><a href="javascript:;" onclick="SendGridBindRequest('<?= $specialObj->urlwithoutsort ?>&orderby=dt_startdate&sorting=Y','gridbody','ST')">Start Date<?= $setsortimgdt_startdate ?></a> </td>
                <td width="10%" align="center" valign="middle" class="grid-td-top" ><a href="javascript:;" onclick="SendGridBindRequest('<?= $specialObj->urlwithoutsort ?>&orderby=dt_expiredate&sorting=Y','gridbody','ST')">End Date<?= $setsortimgdt_expiredate ?></a> </td>  
                
                <!--<td width="8%" align="center" valign="middle" class="grid-td-top"style="padding-left:0px;">Banner Image</a></td>-->
                 

                <td width="15%" align="center" valign="middle" class="grid-td-top">
                    <table border="0" cellpadding="0" cellspacing="0">
                        <tr>
                            <td width="65%" nowrap>
                                <a href="javascript:;" onclick="SendGridBindRequest('<?= $ppackagetypeObj->urlwithoutsort ?>&orderby=int_displayorder&sorting=Y','gridbody','ST')"> Display Order
                                    &nbsp;<?= $setsortimgint_displayorder ?></a>
                            </td>
                            <td width="35%">
                                <a href="javascript:;" onclick="javascript:SendGridBindRequest('<?= $ppackagetypeObj->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></td>
                        </tr>
                    </table>
                </td>
                <td width="14%" align="center" valign="top" class="grid-td-top"><a href="javascript:;" onclick="SendGridBindRequest('<?= $ppackagetypeObj->urlwithoutsort ?>&orderby=int_hits&sorting=Y','gridbody','ST')">Hits
                        <?= $setsortimgint_hits ?></a>
                </td>
                
                 <td width="11%" align="center" valign="top" class="grid-td-top">
                                <a href="javascript:;" onclick="SendGridBindRequest('<?php echo $ppackagetypeObj->urlwithoutsort ?>&orderby=chr_publish&sorting=Y','gridbody','ST')"> Display
                                    &nbsp;<?= $setsortimgchr_publish ?></a>
                            </td>
                
                <!--<td width="11%" align="center" valign="top" class="grid-td-top"><a href="javascript:;" onclick="SendGridBindRequest('<?= $ppackagetypeObj->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)) {
                        //print_R($row); exit;

                        $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
                        if ($row['chr_history_read'] == 'Y') {
                            $trackimage = "histry-icon.png";
                        } else {
                            $trackimage = "histry-unread-icon.png";
                        }
                        ?>
                        <tr id="gtr-<?= $row['int_glcode'] ?>"  style="background-color: transparent;"  class="<?= $clsname ?>" onmouseover="this.style.backgroundColor='#f6f6f6'" onmouseout="this.style.backgroundColor='transparent'" >
                           <?php $countno =$ppackagetypeObj->getmodulesrecords($row['int_glcode']);  ?>
                            <td width="3%" align="center" valign="middle" class="grid-td-left">                                                                                                                                                      
                                <?php if($countno > 0){ ?>
                                   <img border="0" src="<?= GLOBAL_ADMIN_IMAGES_PATH ?>delete_warning.png" title="There are some Packages have been added for this Package type so can't be deleted." alt="delete_warning" id="<?php echo $row['int_glcode'] ?>">
                                <?php }else{ ?>
                                    <input name="chkgrow" id="chkgrow" type="checkbox" value="<?php echo $row['int_glcode'] ?>" />
                                 <?php } ?>
                            </td> 



                            <td width="1%" align="center" valign="middle" class="grid-left1"></td>

                            <?php
                            $char = htmlspecialchars_decode(substr($row['var_title'], 0, 70));
                            if (strlen($row['var_title']) > 70) {
                                $char.='...';
                            }
                            ?>

                            <td width="27%" align="left" valign="middle" class="grid-td-top">
                                <?php if ($paramMain['Edit'] == 'Y') { ?>
                                    <a href="<?php echo $ppackagetypeObj->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>
                            
                            <?php $count1 = $ppackagetypeObj->count1($row['int_glcode']); ?>
                            
                            <td width="7%" align="left" valign="middle" class="grid-td-top">
                                <a href="index.php?module=package&fk_packagetype=<?= $row['int_glcode'] ?>"> View (<?= $count1; ?>)</a>
<!--                                <a href="index.php?module=package&fk_packagetype=<?= $row['int_glcode'] ?>&action=add"> Add </a>-->
                            </td>
                            
                            <td width="8%" align="center" valign="middle" class="grid-td-top">

                            <?php if(file_exists("../upimages/package/logo/thumb_".trim($row['var_logo']))){  ?>
                                     <a onClick="return hs.expand(this);" href="<?php echo "../upimages/package/logo/thumb_".trim($row['var_logo'])?>">
                                     <img border="0" src="<?=GLOBAL_ADMIN_IMAGES_PATH?>/photo-gallery-icon.png" >
                                     </a>
                            <?php } ?>
                            </td>
                             <?php
                            if (DEFAULT_DATEFORMAT == '%d/%m/%Y') {
                                $start_date = $configObj->glLibraryObj->dtConvertYMDtoDMY($row['dt_startdate']);
                            }
                            if (DEFAULT_DATEFORMAT == '%m/%d/%Y') {
                                $start_date = $configObj->glLibraryObj->dtConvertYMDtoMDY($row['dt_startdate']);
                            }
                            if (DEFAULT_DATEFORMAT == '%Y/%m/%d') {
                                $start_date = $configObj->glLibraryObj->dtConvertYMDtoYMD($row['dt_startdate']);
                            }
                            if (DEFAULT_DATEFORMAT == '%Y/%d/%m') {
                                $start_date = $row['dt_startdate'];
                            }
                            $date_special = DEFAULT_DATEFORMAT;
                            if (DEFAULT_DATEFORMAT == '%d/%m/%Y') {
                                $expiry_date = $configObj->glLibraryObj->dtConvertYMDtoDMY($row['dt_expiredate']);
                            }
                            if (DEFAULT_DATEFORMAT == '%m/%d/%Y') {
                                $expiry_date = $configObj->glLibraryObj->dtConvertYMDtoMDY($row['dt_expiredate']);
                            }
                            if (DEFAULT_DATEFORMAT == '%Y/%m/%d') {
                                $expiry_date = $configObj->glLibraryObj->dtConvertYMDtoYMD($row['dt_expiredate']);
                            }
                            if (DEFAULT_DATEFORMAT == '%Y/%d/%m') {
                                $expiry_date = $row['dt_expiredate'];
                            }
                            ?>
                            <td width="11%" align="center" valign="middle"  class="grid-td-top">
                                <?php echo $row['dt_startdate']; ?>
                            </td>

                            
                            <td width="10%" align="center" valign="middle"  class="grid-td-top">
                                <?php
                                if ($expiry_date == '00/00/0000' || $expiry_date == '0000/00/00' || $expiry_date == '0000-00-00') {
                                    echo 'No Expiry';
                                } else {
                                    echo $row['dt_expiredate'];
                                }
                                ?>
                            </td>
<!--                            <td width="8%" align="center" valign="middle" class="grid-td-top">

                            <?php // if(file_exists("../upimages/pagephoto/images/thumb_".trim($row['var_image']))){  ?>
                                     <a onClick="return hs.expand(this);" href="<?php echo "../upimages/pagephoto/images/thumb_".trim($row['var_image'])?>">
                                     <img border="0" src="<?=GLOBAL_ADMIN_IMAGES_PATH?>/photo-gallery-icon.png" >
                                     </a>
                            <?php // } ?>
                            </td>-->

                              


                            <?php if ($configObj->glSessionObj->value('admin_id') == '1' || DISPLAY_DISPORDER_FLAG == 'Y') { ?>
                            <?php } ?>
                            <td width="15%" align="center" valign="middle" class="grid-td-top">

                                <table cellspacing="0" cellpadding="0" border="0">
                                    <tbody><tr>
                                            <td width="41%" nowrap="" colspan="2">
                                                <input type="text" maxlength="3" class="order" name="displayorder<?= $rowcount ?>" id="displayorder<?= $rowcount ?>"  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>         
                                    </tbody></table>

                            </td>
                            
                            <td width="14%" align="center" valign="middle" class="grid-td-top">
                                <?php echo $row['int_hits'] ?>
                            </td>
                            <td width="11%" align="center" valign="middle" class="grid-td-top" >
                                <?php // if($countno > 0){ ?>
                                       <!--<img border="0" height="14" width="14" src="<?=GLOBAL_ADMIN_IMAGES_PATH?>apply.png" title="Display order cannot be unpublish because this packagetype is used for Team member." alt="pulish_warning" id="<?php echo $row['int_glcode']?>">-->
                                <?php // }else{ ?>
                                <?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_packagetype','chr_publish','<?= $row['int_glcode'] ?>','','packagetype');">
                                    </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;"  class="<?= $clsname ?>" 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>