Example #1
0
    /**
     * @param $commentsOnPage
     * @param $feedbackType
     */
    private static function _comments($commentsOnPage, $feedbackType)
    {
        ?>
        <?php 
        foreach ($commentsOnPage as $commentOnPage) {
            ?>
        <li class="media" id="li_<?php 
            echo $commentOnPage->id;
            ?>
">
            <?php 
            echo CommentOnPageHelper::comment($commentOnPage, $feedbackType);
            ?>
            <ul id="ul_<?php 
            echo $commentOnPage->id;
            ?>
">
                <?php 
            echo CommentOnPageHelper::_comments($commentOnPage->childCommentsOnPage, $feedbackType);
            ?>
            </ul>
        </li>
    <?php 
        }
        ?>
    <?php 
    }
Example #2
0
   public function javascript($model)
   {
       ?>
   <!-- START JAVASCRIPT -->
   <?php 
       if ($model->feedbackType == PageEntity::$FEEDBACK_EMAIL) {
           ?>
     <script type="text/javascript">
       function confirm()
       {
         var message = '';
         if($('#Subject').val() == '')
         {
           message = message + '<?php 
           echo Language::$SUBJECT_CAN_NOT_BE_EMPTY[Config::$LANGUAGE];
           ?>
\r\\n';
         }
         if($('#Body').val() == '')
         {
           message = message + '<?php 
           echo Language::$EMAIL_CAN_NOT_BE_EMPTY[Config::$LANGUAGE];
           ?>
\r\\n';
         }
         if(message != '')
         {
           alert(message);
           return false;
         }
         return true;
       }
     </script>
   <?php 
       }
       ?>
   <?php 
       if ($model->feedbackType == PageEntity::$FEEDBACK_COMMENTS_ALL || $model->feedbackType == PageEntity::$FEEDBACK_COMMENTS_AUTH || $model->feedbackType == PageEntity::$FEEDBACK_COMMENTS_CAPTCHA) {
           ?>
     <?php 
           echo CommentOnPageHelper::getScriptForComments($model->id, $model->feedbackType);
           ?>
   <?php 
       }
       ?>
   <!-- END JAVASCRIPT -->
 <?php 
   }
Example #3
0
 /**
  * POST: /main/create-comment
  */
 public function createCommentPost()
 {
     $pageId = $_REQUEST['PageId'];
     $commentId = $_REQUEST['CommentId'];
     $body = $_REQUEST['Body'];
     $pageDAO = new PageDAO();
     $page = $pageDAO->getPage($pageId);
     if ($page->feedbackType != PageEntity::$FEEDBACK_COMMENTS_AUTH || Authentication::isAuthenticated()) {
         $captcha = true;
         if ($page->feedbackType == PageEntity::$FEEDBACK_COMMENTS_CAPTCHA && !Authentication::isAuthenticated()) {
             $captcha = Captcha::getCaptcha($commentId) == $_REQUEST['Captcha'];
         }
         if ($captcha) {
             $commentId = $commentId == 0 ? null : $commentId;
             $browsingId = Browsing::getBrowsingId();
             $userId = Authentication::isAuthenticated() ? Authentication::getUserEntity()->id : null;
             $commentOnPageDAO = new CommentOnPageDAO();
             $newCommentId = $commentOnPageDAO->createCommentOnPage($pageId, $commentId, $browsingId, $userId, $body);
             $newComment = $commentOnPageDAO->getCommentOnPage($newCommentId);
             echo CommentOnPageHelper::comment($newComment, $page->feedbackType);
         } else {
             echo 'captcha';
         }
     }
 }