Ejemplo n.º 1
0
 protected function canEditState($record)
 {
     $rootComment = JUDownloadFrontHelperComment::getRootComment();
     if (isset($record->id) && $record->id == $rootComment->id) {
         return false;
     }
     $app = JFactory::getApplication();
     if ($app->isSite()) {
         $modCanEditState = JUDownloadFrontHelperModerator::checkModeratorCanDoWithComment($record->id, 'comment_edit_state');
         if ($modCanEditState) {
             return true;
         }
         return false;
     }
     return parent::canEditState($record);
 }
Ejemplo n.º 2
0
					<?php echo JText::_('COM_JUDOWNLOAD_FIELD_ID'); ?>
				</th>
			</tr>
			</thead>

			<tbody>
			<?php
			if (is_array($this->items) && count($this->items))
			{
				// @todo recheck hosting
				require_once JPATH_SITE . '/components/com_judownload/models/document.php';
				$documentModel = JModelLegacy::getInstance('Document', 'JUDownloadModel');

				foreach ($this->items AS $i => $item)
				{
					$canEdit = JUDownloadFrontHelperModerator::checkModeratorCanDoWithComment($item->id, 'comment_edit');
					?>
					<tr>
						<td class="center">
							<input type="checkbox" checked="checked" class="judl-cb" name="cid[]"
							       value="<?php echo $item->id; ?>" id="judl-cb-<?php echo $i; ?>"/>
						</td>

						<td>
							<?php
							if ($item->checked_out)
							{
								if ($item->checkout_link)
								{
									$checkedOutUser = JFactory::getUser($item->checked_out);
									$checkedOutTime = JHtml::_('date', $item->checked_out_time);
Ejemplo n.º 3
0
	public static function canDeleteComment($commentId)
	{
		
		$isModerator = JUDownloadFrontHelperModerator::isModerator();
		if ($isModerator)
		{
			$modCanDeleteComment = JUDownloadFrontHelperModerator::checkModeratorCanDoWithComment($commentId, 'comment_delete');
			if ($modCanDeleteComment)
			{
				return true;
			}
		}

		$commentObj       = JUDownloadFrontHelperComment::getCommentObject($commentId, 'cm.doc_id');
		$params           = JUDownloadHelper::getParams(null, $commentObj->doc_id);
		$isCommentOwner   = JUDownloadFrontHelperPermission::isCommentOwner($commentId);
		$deleteOwnComment = $params->get('delete_own_comment', 0);
		if ($isCommentOwner && $deleteOwnComment)
		{
			return true;
		}

		return false;
	}