示例#1
0
    function WriteCommentOptions($Comment)
    {
        $Controller = Gdn::Controller();
        $Session = Gdn::Session();
        $Id = $Comment->CommentID;
        $Options = GetCommentOptions($Comment);
        if (empty($Options)) {
            return;
        }
        ?>
   <span class="ToggleFlyout OptionsMenu">
      <span class="OptionsTitle" title="<?php 
        echo T('Options');
        ?>
"><?php 
        echo T('Options');
        ?>
</span>
		<span class="SpFlyoutHandle"></span>
      <ul class="Flyout MenuItems">
      <?php 
        foreach ($Options as $Code => $Option) {
            ?>
         <li><?php 
            echo Anchor($Option['Label'], $Option['Url'], GetValue('Class', $Option, $Code));
            ?>
</li>
      <?php 
        }
        ?>
      </ul>
   </span>
   <?php 
        if (C('Vanilla.AdminCheckboxes.Use')) {
            // Only show the checkbox if the user has permission to affect multiple items
            $Discussion = Gdn::Controller()->Data('Discussion');
            $PermissionCategoryID = GetValue('PermissionCategoryID', $Discussion);
            if ($Session->CheckPermission('Vanilla.Comments.Delete', TRUE, 'Category', $PermissionCategoryID)) {
                if (!property_exists($Controller, 'CheckedComments')) {
                    $Controller->CheckedComments = $Session->GetAttribute('CheckedComments', array());
                }
                $ItemSelected = InSubArray($Id, $Controller->CheckedComments);
                echo '<span class="AdminCheck"><input type="checkbox" name="' . 'Comment' . 'ID[]" value="' . $Id . '"' . ($ItemSelected ? ' checked="checked"' : '') . ' /></span>';
            }
        }
    }
 function writeCommentOptions($Comment)
 {
     $Controller = Gdn::controller();
     $Session = Gdn::session();
     $Id = $Comment->CommentID;
     $Options = GetCommentOptions($Comment);
     if (empty($Options)) {
         return;
     }
     echo '<span class="ToggleFlyout OptionsMenu">';
     echo '<span class="OptionsTitle" title="' . t('Options') . '">' . t('Options') . '</span>';
     echo sprite('SpFlyoutHandle', 'Arrow');
     echo '<ul class="Flyout MenuItems">';
     foreach ($Options as $Code => $Option) {
         echo wrap(Anchor($Option['Label'], $Option['Url'], val('Class', $Option, $Code)), 'li');
     }
     echo '</ul>';
     echo '</span>';
     if (c('Vanilla.AdminCheckboxes.Use')) {
         // Only show the checkbox if the user has permission to affect multiple items
         $Discussion = Gdn::controller()->data('Discussion');
         $PermissionCategoryID = val('PermissionCategoryID', $Discussion);
         if ($Session->checkPermission('Vanilla.Comments.Delete', TRUE, 'Category', $PermissionCategoryID)) {
             if (!property_exists($Controller, 'CheckedComments')) {
                 $Controller->CheckedComments = $Session->getAttribute('CheckedComments', array());
             }
             $ItemSelected = InSubArray($Id, $Controller->CheckedComments);
             echo '<span class="AdminCheck"><input type="checkbox" name="' . 'Comment' . 'ID[]" value="' . $Id . '"' . ($ItemSelected ? ' checked="checked"' : '') . ' /></span>';
         }
     }
 }