<?php

/*---------------------------------------------
  MAIAN EVENTS v2.0
  Written by David Ian Bennett
  E-Mail: support@maianscriptworld.co.uk
  Website: www.maianscriptworld.co.uk
  This File: Admin - Manage Events
----------------------------------------------*/

if(!defined('INCLUDE_FILES')) {
	include('index.html');
	exit;
}

?>
<tr>
    <td>
    <table border="0" cellpadding="0" cellspacing="0" width="100%" class="tableBorder">
    <tr>
        <td class="displayTable">&raquo; <b><?php echo strtoupper($manage); ?></b><br /><br /><?php echo str_replace("{count}",rowCount('events'),$manage2); ?></td>
    </tr>
    </table>
    <form method="post" name="MyForm" action="index.php?cmd=manage" onsubmit="return delete_confirm('<?php echo $msg_javascript; ?>')">
    <p><input type="hidden" name="process" value="1" /></p>
    <table cellpadding="0" cellspacing="1" width="100%" class="tableBorderHeader">
    <tr>
        <td class="menutable"><b><?php echo str_replace("{count}",rowCount('events'),$manage3); ?></b></td>
        <td class="menutable" style="width:5%;text-align:center"><input type="checkbox" name="log" onclick="selectAll()" /></td>
    </tr>
    </table>
    <?php
    if (isset($OK)) {
    echo ok($manage8);
    }
    
    $q_events = mysql_query("SELECT *,DATE_FORMAT(fromDate,'".$SETTINGS->formatdate."') AS f_date,
                             DATE_FORMAT(toDate,'".$SETTINGS->formatdate."') AS t_date  
                             FROM ".$database['prefix']."events
                             ORDER BY id DESC
                             LIMIT $limitvalue,$limit
                             ") or die(mysql_error());
    if (mysql_num_rows($q_events)>0) {
      while ($EVENTS = mysql_fetch_object($q_events)) {
      ?>
      <table width="100%" cellspacing="0" cellpadding="0" class="tableBorder">
      <tr>
        <td class="displayTable" style="width:55%;vertical-align:top">
        <b><?php echo $manage5; ?></b>: <?php echo cleanData($EVENTS->title); ?><br />
        <b><?php echo $manage6; ?></b>: <?php echo ($EVENTS->fromDate===$EVENTS->toDate ? translateCalendar($EVENTS->f_date) : translateCalendar($EVENTS->f_date).' / '.translateCalendar($EVENTS->t_date)); ?><br />
        <b><?php echo $manage12; ?></b>: <?php echo rowCount('comments',' WHERE eventid = \''.$EVENTS->id.'\' AND is_active = \'1\''); ?><br />
        <b><?php echo $manage13; ?></b>: <?php echo ($EVENTS->is_archived ? $manage15 : $manage14); ?>
        </td>
        <td class="displayTable" style="width:40%">
        <table width="100%" cellspacing="1" cellpadding="0">
        <tr>
          <td class="<?php echo ($EVENTS->is_archived=='1' ? 'optionsArchiveCell' : 'optionsCell'); ?>"><a href="<?php echo $SETTINGS->folder.'/'.($SETTINGS->modr ? 'event/'.$EVENTS->id.'/'.cleanEventName(cleanData($EVENTS->title)).'/index.html' : 'index.php?cmd=event&amp;event='.$EVENTS->id); ?>" target="_blank"><img src="img/view.gif" alt="<?php echo $manage9; ?>" title="<?php echo $manage9; ?>" /></a><span class="optionsText"><?php echo $manage9; ?></span></td>
          <td class="<?php echo ($EVENTS->is_archived=='1' ? 'optionsArchiveCell' : 'optionsCell'); ?>"><a href="index.php?cmd=edit&amp;id=<?php echo $EVENTS->id; ?>"><img src="img/edit.gif" alt="<?php echo $manage10; ?>" title="<?php echo $manage10; ?>" /></a><span class="optionsText"><?php echo $manage10; ?></span></td>
          <td class="<?php echo ($EVENTS->is_archived=='1' ? 'optionsArchiveCell' : 'optionsCell'); ?>"><a href=<?php echo (rowCount('comments',' WHERE eventid = \''.$EVENTS->id.'\' AND is_active = \'1\'')>0 ? '"index.php?cmd=manage&amp;comments='.$EVENTS->id.'" rel="gb_page_center[680, 540]" title="'.$comments13.' ('.rowCount('comments',' WHERE eventid = \''.$EVENTS->id.'\' AND is_active = \'1\'').')"' : '"#" onclick="javascript:message(\''.$msg_javascript16.'\');return false"'); ?>><img src="img/comments2.gif" alt="<?php echo $manage11; ?>" title="<?php echo $manage11; ?>" /></a><span class="optionsText"><?php echo $manage11; ?></span></td>
        </tr>
        </table>
        </td>
        <td class="displayTable" style="width:5%;text-align:center;"><input type="checkbox" name="id[]" value="<?php echo $EVENTS->id; ?>" /></td>
      </tr>
      </table>
      <?php
      }
    } else {
    ?>
    <table width="100%" cellspacing="0" cellpadding="0" class="tableBorder">
    <tr>
        <td class="displayTable" style="text-align:center;padding:10px 0 10px 0"><?php echo $manage4; ?></td>
    </tr>
    </table>
    <?php
    }
    
    ?>
    <?php
    if (rowCount('events')>0) {
    ?>
    <p class="button"><input class="formbutton" type="submit" value="<?php echo $manage7; ?>" title="<?php echo $manage7; ?>" /></p>
    <?php
    echo admin_page_numbers(rowCount('events'),$limit,$page);
    }
    ?>
    </form>
    </td>
</tr>

