public static function show($lists)
    {
        $filter = '';
        $filterClear = '';
        if (isset($lists['fog'])) {
            $filter .= ' ' . $lists['fog'];
            $filterClear .= "document.getElementById('fog').value='';";
        }
        if (isset($lists['flang'])) {
            $filter .= ' ' . $lists['flang'];
            $filterClear .= "document.getElementById('flang').value='';";
        }
        if (isset($lists['foid'])) {
            $filter .= ' ' . $lists['foid'];
            $filterClear .= "document.getElementById('foid').value='';";
        }
        if (isset($lists['fauthor']) && $lists['fauthor'] != '') {
            $filter .= ' ' . $lists['fauthor'];
            $filterClear .= "document.getElementById('fauthor').value='';";
        }
        if (isset($lists['fstate'])) {
            $filter .= ' ' . $lists['fstate'];
            $filterClear .= "document.getElementById('fstate').value='';\n";
        }
        if (JCOMMENTS_JVERSION != '1.0') {
            ?>
<script type="text/javascript">
<!--
function tableOrdering(order, dir, task)
{
	var form = document.adminForm;
	form.filter_order.value = order;
	form.filter_order_Dir.value = dir;
	document.adminForm.submit(task);
}
//-->
</script>
<?php 
        }
        ?>
<form action="<?php 
        echo JCOMMENTS_INDEX;
        ?>
" method="post" name="adminForm" id="adminForm">
<table class="adminheading" width="100%">
	<tr>
<?php 
        if (JCOMMENTS_JVERSION == '1.0') {
            ?>
	<th style="background-image: none; padding: 0;"><img src="components/com_jcomments/assets/icon-48-subscriptions.png" width="48" height="48" align="middle" alt="<?php 
            echo JText::_('A_SUBSCRIPTIONS');
            ?>
" />&nbsp;<?php 
            echo JText::_('A_SUBSCRIPTIONS');
            ?>
</th>
<?php 
        }
        ?>
	<td nowrap="nowrap" align="left" width="50%">
		<label for="search"><?php 
        echo JText::_('A_FILTER');
        ?>
:</label>
		<input type="text" name="search" id="search" value="<?php 
        echo $lists['search'];
        ?>
" class="text_area" onchange="document.adminForm.submit();" />
		<button onclick="this.form.submit();"><?php 
        echo JText::_('A_FILTER_APPLY');
        ?>
</button>
		<button onclick="document.getElementById('search').value='';<?php 
        echo $filterClear;
        ?>
this.form.submit();"><?php 
        echo JText::_('A_FILTER_RESET');
        ?>
</button>
	</td>
	<td nowrap="nowrap" align="right" width="50%">
<?php 
        if (trim($filter) != '') {
            echo $filter;
        }
        ?>
	</td>
	</tr>
</table>
<table class="adminlist jgrid" cellspacing="1">
	<thead>
		<tr>
			<th width="1%"><input type="checkbox" id="toggle" name="toggle" value="" onclick="checkAll(<?php 
        echo count($lists['rows']);
        ?>
);" /></th>
<?php 
        if (JCOMMENTS_JVERSION == '1.0') {
            ?>
			<th width="20%" align="left" nowrap="nowrap"><?php 
            echo JText::_('A_SUBSCRIPTION_NAME');
            ?>
</th>
			<th width="20%" align="left"><?php 
            echo JText::_('A_SUBSCRIPTION_EMAIL');
            ?>
</th>
			<th width="40%" align="left"><?php 
            echo JText::_('A_COMMENT_OBJECT_TITLE');
            ?>
</th>
			<th width="10%" align="left"><?php 
            echo JText::_('A_COMPONENT');
            ?>
</th>
			<th width="10%" nowrap="nowrap"><?php 
            echo JText::_('A_PUBLISHING');
            ?>
</th>
<?php 
        } else {
            ?>
			<th width="20%" align="left" nowrap="nowrap"><?php 
            echo JHTML::_('grid.sort', 'A_SUBSCRIPTION_NAME', 'js.name', $lists['order_Dir'], $lists['order']);
            ?>
</th>
			<th width="20%" align="left"><?php 
            echo JHTML::_('grid.sort', 'A_SUBSCRIPTION_EMAIL', 'js.email', $lists['order_Dir'], $lists['order']);
            ?>
</th>
			<th width="40%" align="left"><?php 
            echo JText::_('A_COMMENT_OBJECT_TITLE');
            ?>
</th>
			<th width="10%" align="left"><?php 
            echo JHTML::_('grid.sort', 'A_COMPONENT', 'js.object_group', $lists['order_Dir'], $lists['order']);
            ?>
</th>
			<th width="10%" nowrap="nowrap"><?php 
            echo JHTML::_('grid.sort', 'A_PUBLISHING', 'js.published', $lists['order_Dir'], $lists['order']);
            ?>
</th>
<?php 
        }
        ?>
		</tr>
	</thead>
	<tbody>
<?php 
        for ($i = 0, $k = 0, $n = count($lists['rows']); $i < $n; $i++) {
            $row =& $lists['rows'][$i];
            $row->title = JCommentsBackendObjectHelper::getTitle($row->object_id, $row->object_group, $row->lang);
            $row->link = JCommentsBackendObjectHelper::getLink($row->object_id, $row->object_group, $row->lang);
            $link = JCOMMENTS_INDEX . '?option=com_jcomments&task=subscription.edit&hidemainmenu=1&cid=' . $row->id;
            ?>
		<tr class="<?php 
            echo "row{$k}";
            ?>
">
			<td align="center"><?php 
            echo JCommentsHTML::_('grid.id', $row, $i);
            ?>
</td>
			<td align="left"><a href="<?php 
            echo $link;
            ?>
" title="<?php 
            echo JText::_('A_EDIT');
            ?>
"><?php 
            echo $row->name;
            ?>
</a></td>
			<td align="left"><?php 
            echo $row->email;
            ?>
</td>
			<td align="left"><a href="<?php 
            echo $row->link;
            ?>
" title="<?php 
            echo htmlspecialchars($row->title);
            ?>
" target="_blank"><?php 
            echo $row->title;
            ?>
</a></td>
			<td align="left">[<?php 
            echo $row->object_group;
            ?>
]</td>
			<td align="center"><?php 
            echo JCommentsHTML::_('grid.published', $row, $i, 'subscription.');
            ?>
</td>
		</tr>
<?php 
            $k = 1 - $k;
        }
        ?>
	</tbody>
	<tfoot>
		<tr>
			<td colspan="15"><?php 
        echo $lists['pageNav']->getListFooter();
        ?>
</td>
		</tr>
	</tfoot>
</table>
<input type="hidden" name="option" value="com_jcomments" />
<input type="hidden" name="task" value="subscriptions" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="hidemainmenu" value="0" />
<input type="hidden" name="filter_order" value="<?php 
        echo $lists['order'];
        ?>
" />
<input type="hidden" name="filter_order_Dir" value="" />
<?php 
        echo JCommentsSecurity::formToken();
        ?>
</form>
<?php 
    }
Esempio n. 2
0
 public static function edit()
 {
     $id = JCommentsInput::getVar('cid', 0);
     if (is_array($id)) {
         $id = $id[0];
     }
     $user = JCommentsFactory::getUser();
     $db = JCommentsFactory::getDBO();
     $row = new JCommentsTableComment($db);
     if ($row->load(intval($id))) {
         $row->checkout($user->id);
         $row->comment = JCommentsText::br2nl($row->comment);
         $row->comment = htmlspecialchars($row->comment);
         $row->comment = JCommentsText::nl2br($row->comment);
         $row->comment = strip_tags(str_replace('<br />', "\n", $row->comment));
         $lists['object_title'] = JCommentsBackendObjectHelper::getTitle($row->object_id, $row->object_group, $row->lang);
         $lists['object_link'] = JCommentsBackendObjectHelper::getLink($row->object_id, $row->object_group, $row->lang);
         $lists = array();
         $query = "SELECT * " . "\n FROM #__jcomments_reports " . "\n WHERE commentid = " . (int) $row->id . "\n ORDER BY date";
         $db->setQuery($query);
         $lists['reports'] = $db->loadObjectList();
         HTML_JComments::edit($row, $lists);
     } else {
         JCommentsRedirect(JCOMMENTS_INDEX . '?option=com_jcomments&task=comments');
     }
 }