| Server IP : 180.180.241.3 / Your IP : 216.73.216.35 Web Server : Microsoft-IIS/7.5 System : Windows NT NETWORK-NHRC 6.1 build 7601 (Windows Server 2008 R2 Standard Edition Service Pack 1) i586 User : IUSR ( 0) PHP Version : 5.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /AppServ/www/app/webroot/news/components/com_spidercalendar/views/show_events/tmpl/ |
Upload File : |
<?php
/**
* @package Spider Calendar
* @author Web-Dorado
* @copyright (C) 2011 Web-Dorado. All rights reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
**/
defined( '_JEXEC' ) or die( 'Restricted access' );
$task=JRequest::getVar('task');
switch($task)
{
case 'publish_event':
changeNote(1);
break;
case 'unpublish_event':
changeNote(0);
break;
case 'remove_event':
removeNote();
break;
}
$session =& JFactory::getSession();
$rows=$this->rows;
$pageNav=$this->pageNav;
$lists=$this->lists;
$option=$this->option;
$user =& JFactory::getUser();
$module_id=JRequest::getVar( "module_id");
$calendar_id=JRequest::getVar( "calendar");
$calendar =& JTable::getInstance('spidercalendar_calendar', 'Table');
// load the row from the db table
$calendar->load( $calendar_id);
$allow_publish=$calendar->allow_publish;
JHTML::_('behavior.tooltip');
JHTML::_('behavior.calendar');
?>
</style>
<table>
<tr>
<td>
<a href="index.php?option=com_spidercalendar&view=add_event&calendar=<?php echo JRequest::getVar('calendar'); ?>&module_id=<?php echo $module_id ?>">
<button><?php echo JText::_('NEW_EVENT') ?></button>
</a>
</td>
<td>
<a onclick="javascript:if(document.adminForm.boxchecked.value==0){alert('Please make a selection from the list to publish');}else{ submitbutton('publish_event')}" class="toolbar">
<button><?php echo JText::_('PUBLISH_EVENT') ?></button>
</a>
</td>
<td>
<a onclick="javascript:if(document.adminForm.boxchecked.value==0){alert('Please make a selection from the list to unpublish');}else{ submitbutton('unpublish_event')}" class="toolbar">
<button><?php echo JText::_('UNPUBLISH_EVENT') ?></button>
</a>
</td>
<td>
<a onclick="javascript:if(document.adminForm.boxchecked.value==0){alert('Please make a selection from the list to delete');}else{if(confirm('Are you sure you want to delete?')){submitbutton('remove_event');}}" class="toolbar">
<button><?php echo JText::_('DELETE_EVENT') ?></button>
</a>
</td>
</tr>
</table>
<form action="index.php?option=com_spidercalendar&view=show_events&calendar=<?php echo JRequest::getVar('calendar'); ?>" method="post" name="adminForm" >
<table>
<tr>
<td align="left" width="100%">
<?php echo JText::_( 'TITLE' ); ?>:
<input type="text" name="search" value="<?php echo $lists['search'];?>" class="text_area" onchange="document.adminForm.submit();" />
<?php echo JText::_( 'FROM' ); ?>:<input class="inputbox" type="text" name="startdate" id="startdate" size="10" maxlength="10" value="<?php echo $lists['startdate'];?>" />
<input type="reset" class="button" value="..."
onclick="return showCalendar('startdate','%Y-%m-%d');" /> <?php echo JText::_( 'TO' ); ?>: <input class="inputbox" type="text" name="enddate" id="enddate" size="10" maxlength="10" value="<?php echo $lists['enddate'];?>" />
<input type="reset" class="button" value="..."
onclick="return showCalendar('enddate','%Y-%m-%d');" />
<button onclick="this.form.submit();">
<?php echo JText::_( 'Go' ); ?></button>
<button onclick="document.getElementById('search').value='';document.getElementById('startdate').value='';document.getElementById('enddate').value='';this.form.submit();">
<?php echo JText::_( 'Reset' ); ?></button> </td>
</tr>
</table>
<table class="adminlist">
<thead>
<tr>
<th width="20">
<input type="checkbox" name="toggle"
value="" onclick="checkAll(<?php echo count($rows)?>)">
</th>
<th width="20" class="title"><?php echo JHTML::_('grid.sort', 'ID', 'id', @$lists['order_Dir'], @$lists['order'] ); ?></th>
<th width="250" nowrap="nowrap"><?php echo JHTML::_('grid.sort', JText::_( "TITLE" ), 'title', @$lists['order_Dir'], @$lists['order'] ); ?></th>
<th width="80" nowrap="nowrap"><?php echo JHTML::_('grid.sort', JText::_( "Date" ), 'date', @$lists['order_Dir'], @$lists['order'] ); ?></th>
<th width="80" nowrap="nowrap"><?php echo JHTML::_('grid.sort', JText::_( "TIME" ), 'time', @$lists['order_Dir'], @$lists['order'] ); ?></th>
<th width="20" nowrap="nowrap"><?php if($allow_publish==1) echo JHTML::_('grid.sort', JText::_( "PUBLISHED" ), 'published',@$lists['order_Dir'], @$lists['order'] ); ?>
</th>
</tr>
</thead>
<tfoot align="center">
<tr>
<td colspan="11" style="text-align:center;">
<?php echo $pageNav->getListFooter(); ?>
</td>
</tr>
</tfoot>
<?php
$k = 0;
for($i=0, $n=count($rows); $i < $n ; $i++)
{
$row = &$rows[$i];
$checked = JHTML::_('grid.id', $i, $row->id);
$published = published($row, $i, 'event');
// prepare link for id column
$link = JRoute::_( 'index.php?option=com_spidercalendar&view=edit_event&calendar='.JRequest::getVar('calendar').'&module_id='.JRequest::getVar('module_id').'&cid[]='. $row->id );
echo '<tr class="row'.$k.'">
<td>'.$checked.'</td>
<td align="center"><a href="'.$link.'">'.$row->id.'</a></td>
<td align="center"><a href="'.$link.'">'.$row->title.'</a></td>
<td align="center">'.$row->date;
if($row->date_end!="" and $row->date_end!='0000-00-00')
echo " - ".$row->date_end."";
echo '</td>
<td align="center">'.$row->time.'</td>';
if($allow_publish==1)
echo'
<td align="center">'.$published.'</td> ';
echo '</tr>';
$k = 1 - $k;
}
?>
</table>
<input type="hidden" name="option" value="com_spidercalendar">
<input type="hidden" name="task" value="event">
<input type="hidden" name="boxchecked" value="0">
<input type="hidden" name="filter_order"
value="<?php echo $lists['order']; ?>" />
<input type="hidden" name="filter_order_Dir" value="" />
<input type="hidden" name="calendar" value="<?php echo JRequest::getVar('calendar'); ?>" />
</form>
<?php
function published( &$row, $i, $task, $imgY = "tick.png", $imgX = 'publish_x.png', $prefix='' ){
$img = $row->published ? $imgY : $imgX;
$task = $row->published ? 'unpublish_'.$task : 'publish_'.$task;
$alt = $row->published ? JText::_( 'Published' ) : JText::_( 'Unpublished' );
$action = $row->published ? JText::_( 'Unpublish Item' ) : JText::_( 'Publish item' );
$href = '
<a href="javascript:void(0);" onclick="return listItemTask(\'cb'. $i .'\',\''. $prefix.$task .'\')" title="'. $action .'">
<img src="administrator/images/'. $img .'" border="0" alt="'. $alt .'" /></a>'
;
return $href;
}
function changeNote( $state=0 )
{
global $mainframe;
// Initialize variables
$db =& JFactory::getDBO();
// define variable $cid from GET
$cid = JRequest::getVar( 'cid' , array() , '' , 'array' );
JArrayHelper::toInteger($cid);
// Check there is/are item that will be changed.
//If not, show the error.
if (count( $cid ) < 1) {
$action = $state ? 'publish' : 'unpublish';
JError::raiseError(500, JText::_( 'Select an item
to' .$action, true ) );
}
// Prepare sql statement, if cid more than one,
// it will be "cid1, cid2, cid3, ..."
$cids = implode( ',', $cid );
$query = 'UPDATE #__spidercalendar_event'
. ' SET published = ' . (int) $state
. ' WHERE id IN ( '. $cids .' )'
;
// Execute query
$db->setQuery( $query );
if (!$db->query()) {
JError::raiseError(500, $db->getErrorMsg() );
}
if (count( $cid ) == 1) {
$row =& JTable::getInstance('spidercalendar_event', 'Table');
$row->checkin( intval( $cid[0] ) );
}
// After all, redirect to front page
$mainframe->redirect( 'index.php?option=com_spidercalendar&view=show_events&calendar='.JRequest::getVar('calendar') );
}
function removeNote()
{
global $mainframe;
// Initialize variables
$db =& JFactory::getDBO();
// Define cid array variable
$cid = JRequest::getVar( 'cid' , array() , '' , 'array' );
// Make sure cid array variable content integer format
JArrayHelper::toInteger($cid);
// If any item selected
if (count( $cid )) {
// Prepare sql statement, if cid array more than one,
// will be "cid1, cid2, ..."
$cids = implode( ',', $cid );
// Create sql statement
$query = 'DELETE FROM #__spidercalendar_event'
. ' WHERE id IN ( '. $cids .' )'
;
// Execute query
$db->setQuery( $query );
if (!$db->query()) {
echo "<script> alert('".$db->getErrorMsg(true)."');
window.history.go(-1); </script>\n";
}
}
// After all, redirect again to frontpage
$mainframe->redirect( "index.php?option=com_spidercalendar&view=show_events&calendar=".JRequest::getVar('calendar') );
}
?>