Esempio n. 1
0
 protected function canEditState($record)
 {
     $rootComment = JUDirectoryFrontHelperComment::getRootComment();
     if (isset($record->id) && $record->id == $rootComment->id) {
         return false;
     }
     $app = JFactory::getApplication();
     if ($app->isSite()) {
         $modCanEditState = JUDirectoryFrontHelperModerator::checkModeratorCanDoWithComment($record->id, 'comment_edit_state');
         if ($modCanEditState) {
             return true;
         }
         return false;
     }
     return parent::canEditState($record);
 }
Esempio n. 2
0
				<th style="width:5%" class="center">
					<?php 
echo JText::_('COM_JUDIRECTORY_FIELD_ID');
?>
				</th>
			</tr>
			</thead>

			<tbody>
			<?php 
if (is_array($this->items) && count($this->items)) {
    // @todo recheck hosting
    require_once JPATH_SITE . '/components/com_judirectory/models/listing.php';
    $listingModel = JModelLegacy::getInstance('Listing', 'JUDirectoryModel');
    foreach ($this->items as $i => $item) {
        $canEdit = JUDirectoryFrontHelperModerator::checkModeratorCanDoWithComment($item->id, 'comment_edit');
        ?>
					<tr>
						<td class="center">
							<input type="checkbox" checked="checked" class="judir-cb" name="cid[]"
							       value="<?php 
        echo $item->id;
        ?>
" id="judir-cb-<?php 
        echo $i;
        ?>
"/>
						</td>

						<td>
							<?php 
Esempio n. 3
0
 public static function canDeleteComment($commentId)
 {
     $isModerator = JUDirectoryFrontHelperModerator::isModerator();
     if ($isModerator) {
         $modCanDeleteComment = JUDirectoryFrontHelperModerator::checkModeratorCanDoWithComment($commentId, 'comment_delete');
         if ($modCanDeleteComment) {
             return true;
         }
     }
     $commentObj = JUDirectoryFrontHelperComment::getCommentObject($commentId, 'cm.listing_id');
     $params = JUDirectoryHelper::getParams(null, $commentObj->listing_id);
     $isCommentOwner = JUDirectoryFrontHelperPermission::isCommentOwner($commentId);
     $deleteOwnComment = $params->get('delete_own_comment', 0);
     if ($isCommentOwner && $deleteOwnComment) {
         return true;
     }
     return false;
 }