</thead> <tbody><?php $k = 0; $i = 0; $n = count($this->t['filesitems']); $rows =& $this->t['filesitems']; if (is_array($rows)) { foreach ($rows as $row) { // USER RIGHT - Delete (Publish/Unpublish) - - - - - - - - - - - // 2, 2 means that user access will be ignored in function getUserRight for display Delete button // because we cannot check the access and delete in one time $user = JFactory::getUser(); $rightDisplayDelete = 0; $catAccess = PhocaDownloadAccess::getCategoryAccessByFileId((int) $row->id); if (!empty($catAccess)) { $rightDisplayDelete = PhocaDownloadAccess::getUserRight('deleteuserid', $catAccess->deleteuserid, 2, $user->getAuthorisedViewLevels(), $user->get('id', 0), 0); } // - - - - - - - - - - - - - - - - - - - - - - ?> <tr class="<?php echo "row{$k}"; ?> "> <td><?php echo $row->title; ?> </td>
function delete() { $app = JFactory::getApplication(); $post['id'] = $app->input->get('actionid', '', 'int', 0); $post['limitstart'] = $app->input->get('limitstart', '', 'int', 0); $model = $this->getModel('user'); //$isOwnerCategory = 1;//$model->isOwnerCategoryImage((int)$this->_user->id, (int)$id); // USER RIGHT - Delete - - - - - - - - - - - // 2, 2 means that user access will be ignored in function getUserRight for display Delete button $user = JFactory::getUser(); $rightDisplayDelete = 0; $catAccess = PhocaDownloadAccess::getCategoryAccessByFileId((int) $post['id']); if (!empty($catAccess)) { $rightDisplayDelete = PhocaDownloadAccess::getUserRight('deleteuserid', $catAccess->deleteuserid, 2, $user->getAuthorisedViewLevels(), $user->get('id', 0), 0); } // - - - - - - - - - - - - - - - - - - - - - - if ($rightDisplayDelete) { if (!$model->delete((int) $post['id'])) { $msg = JText::_('COM_PHOCADOWNLOAD_ERROR_DELETING_ITEM'); } else { $msg = JText::_('COM_PHOCADOWNLOAD_SUCCESS_DELETING_ITEM'); } } else { $app->redirect($this->loginUrl, $this->loginString); exit; } $lSO = ''; if ($post['limitstart'] != '') { $lSO = '&limitstart=' . (int) $post['limitstart']; } $this->setRedirect(JRoute::_($this->url . $lSO, false), $msg); }