コード例 #1
0
ファイル: Post.php プロジェクト: rayku/rayku
 public function getDataForHistory()
 {
     $c = new Criteria();
     $c->add(ThreadPeer::ID, $this->getThreadId());
     $thread = ThreadPeer::doSelectOne($c);
     return new HistoricalObjectEntry($this->getPosterId(), array('thread_id' => $this->getThreadId(), 'thread_title' => $thread->getTitle()));
 }
コード例 #2
0
ファイル: components.class.php プロジェクト: rayku/rayku
 /**
  * The component to display a single thread
  */
 public function executeShowThread()
 {
     $this->thread = ThreadPeer::retrieveByPK($this->threadID);
     $this->post = PostPeer::getFirstForThreadId($this->threadID);
     //First are experts anserws ( firest best than other )
     //Than are other users answers ( first best than other )
     $this->expert_best_posts = PostPeer::getForThreadIdAndFor($this->threadID, $this->post->getId(), true, 1);
     $this->expert_others_posts = PostPeer::getForThreadIdAndFor($this->threadID, $this->post->getId(), true, 0);
     $this->other_best_posts = PostPeer::getForThreadIdAndFor($this->threadID, $this->post->getId(), false, 1);
     $this->other_others_posts = PostPeer::getForThreadIdAndFor($this->threadID, $this->post->getId(), false, 0);
 }
コード例 #3
0
ファイル: actions.class.php プロジェクト: rayku/rayku
    public function executeExpertReplyThread()
    {
        $connection = RaykuCommon::getDatabaseConnection();
        $c = new Criteria();
        $c->add(ForumPeer::TYPE, 0);
        $this->publicforums = ForumPeer::doSelect($c);
        $this->allcategories = CategoryPeer::doSelect($c = new Criteria());
        $this->forum = $this->getRequestParameter('forum_id');
        $this->thread = ThreadPeer::retrieveByPK($this->getRequestParameter('thread_id'));
        $c = new Criteria();
        $c->add(PostPeer::THREAD_ID, $this->thread->getId());
        $this->post = PostPeer::doSelectOne($c);
        $user = $this->getUser()->getRaykuUser();
        if ($this->getRequestParameter('post_edit_content') != '') {
            $threadId = $this->getRequestParameter('thread_id');
            $_thread = ThreadPeer::retrieveByPK($threadId);
            $_thread->setTitle($this->getRequestParameter('post_edit_title'));
            $_thread->save();
            $v = new Criteria();
            $v->add(PostPeer::THREAD_ID, $threadId);
            $v->addAscendingOrderByColumn(PostPeer::ID);
            $post = PostPeer::doSelectOne($v);
            $post->setContent($this->getRequestParameter('post_edit_content'));
            $post->save();
            return $this->redirect('@view_thread?thread_id=' . $threadId);
        }
        if ($this->getRequestParameter('post_body') != '') {
            if ($this->getRequestParameter('final_id') != '') {
                $_quick_reply = '';
                $_post_id = $this->getRequestParameter('final_id');
                $_Post = PostPeer::retrieveByPK($_post_id);
                $_User = UserPeer::retrieveByPK($_Post->getPosterId());
                $_quick_reply .= "<div style='margin-left:20px'><em><strong>Quote from " . $_User->getUsername() . "</strong></em><br><br>";
                $_explode_post = explode("*^-", $_Post->getContent());
                if (count($_explode_post) > 1) {
                    $_quick_reply .= $_explode_post[1];
                } else {
                    $_quick_reply .= $_Post->getContent();
                }
                $_quick_reply .= "</div>";
                $_post_body_msg = $this->getRequestParameter('post_body');
                $_quick_reply .= $_post_body_msg;
                $user->makeNewPost($this->getRequestParameter('thread_id'), $_quick_reply);
                ///////////////////updating the ip of the user
                $post_id = mysql_fetch_row(mysql_query("SELECT max(id) from post limit 0,1", $connection));
                mysql_query("update post set \tuser_ip='" . $_SERVER['REMOTE_ADDR'] . "' where id=" . $post_id[0] . "", $connection);
                ///////////////////updating the ip of the user
            } else {
                $user->makeNewPost($this->getRequestParameter('thread_id'), $this->getRequestParameter('post_body'));
                ///////////////////updating the ip of the user
                $post_id = mysql_fetch_row(mysql_query("SELECT max(id) from post limit 0,1", $connection));
                mysql_query("update post set \tuser_ip='" . $_SERVER['REMOTE_ADDR'] . "' where id=" . $post_id[0] . "", $connection);
                ///////////////////updating the ip of the user
            }
            if ($this->getUser()->getRaykuUser()->getType() == '5') {
                $c = new Criteria();
                $c->add(ThreadPeer::ID, $this->getRequestParameter('thread_id'));
                $thread = ThreadPeer::doSelectOne($c);
                $c = new Criteria();
                $c->add(UserPeer::ID, $thread->getPosterId());
                $user = UserPeer::doSelectOne($c);
                if ($thread->getNotifyPm() == '1') {
                    $subject = 'Expert Response for your Question';
                    $body = 'Hi there, <br><br>
							A Rayku expert, "' . $this->getUser()->getRaykuUser()->getName() . '" has just responsed to your question, "' . $thread->getTitle() . '" on the question boards. Take a look!<br><br>
							Rayku Administration';
                    //Grab the user object
                    $currentuser = UserPeer::retrieveByPK($this->getUser()->getRaykuUserId());
                    //Send the message
                    $currentuser->sendMessage($user->getId(), $subject, $body);
                }
                if ($thread->getNotifyEmail() == '1') {
                    $this->mail = new sfMail();
                    //Set the to, from, and subject headers
                    $this->mail->addAddress($user->getEmail());
                    $this->mail->setFrom('Expert <' . $this->getUser()->getRaykuUser()->getEmail() . '>');
                    $this->mail->setSubject('Expert Response to your Question');
                    $this->mail->setBody('Hi there,<br>
							A Rayku expert, "' . $this->getUser()->getRaykuUser()->getName() . '", has just responded to your question (below) on the question boards. Take a look!<br><br>
							' . $thread->getTitle() . '');
                    $this->mail->send();
                }
            }
            return $this->redirect('@view_thread?thread_id=' . $this->thread->getId());
        }
    }
コード例 #4
0
ファイル: _showThread.php プロジェクト: rayku/rayku
	}


	</style>

<div style="display: none;">
		<div id="inline1" style="width:630px;height:650px;overflow:auto;padding:25px" align="left">


 <div class="body-main">
    <div class="qa">
      <div class="ta">
<?php 
$_thread = explode("/", $_SERVER['REQUEST_URI']);
$_thread_id = $_thread[3];
$thread = ThreadPeer::retrieveByPK($_thread_id);
$c = new Criteria();
$c->add(PostPeer::THREAD_ID, $thread->getId());
$c->addAscendingOrderByColumn(PostPeer::ID);
$post = PostPeer::doSelectOne($c);
$logedUserId = $_SESSION['symfony/user/sfUser/attributes']['symfony/user/sfUser/attributes']['user_id'];
if (!empty($logedUserId)) {
    $c = new Criteria();
    $c->add(UserPeer::ID, $logedUserId);
    $actionCheck = UserPeer::doSelectOne($c);
    if ($actionCheck->getType() == '5') {
        echo form_tag('@expertreply_thread?forum_id=' . $thread->getCategoryId() . '&thread_id=' . $thread->getId());
    } else {
        echo form_tag('@userreply_thread?forum_id=' . $thread->getCategoryId() . '&thread_id=' . $thread->getId());
    }
}
コード例 #5
0
ファイル: ThreadPeer.php プロジェクト: rayku/rayku
 static function getCountOfCreatedThreadsForUser($user)
 {
     $c = new Criteria();
     $c->add(ThreadPeer::POSTER_ID, $user->getId());
     return ThreadPeer::doCount($c);
 }
コード例 #6
0
ファイル: _showForum.php プロジェクト: rayku/rayku
        $i++;
    }
    if (count($_StickieId) > 0 && count($_Non_StickieId) > 0) {
        $threads = array_merge($_StickieId, $_Non_StickieId);
    } else {
        if (count($_StickieId) > 0 && count($_Non_StickieId) == 0) {
            $threads = $_StickieId;
        } else {
            if (count($_StickieId) == 0 && count($_Non_StickieId) > 0) {
                $threads = $_Non_StickieId;
            }
        }
    }
    foreach ($threads as $thread) {
        $_class = '';
        $thread = ThreadPeer::retrieveByPK($thread);
        $post = PostPeer::getFirstForThreadId($thread->getId());
        $user = UserPeer::retrieveByPK($thread->getPosterId());
        if (!empty($_StickieId)) {
            if (in_array($thread->getId(), $_StickieId)) {
                $_class = "background-color:#E6F8FF";
            }
        }
        ?>
      <div class="entry" style="<?php 
        echo $_class;
        ?>
">
        <div class="information" >
          <?php 
        echo link_to($thread, '@view_thread?thread_id=' . $thread->getId(), array('class' => 'threadttle'));
コード例 #7
0
ファイル: _other_others_posts.php プロジェクト: rayku/rayku
        }
    }
    ////////end follow me
    ?>
</div>
    <div class="cmmt">
      <div class="info">
        <?php 
    $date = RaykuCommon::formatDateForPost($post->getUpdatedAt());
    ?>
        <div class="postdate">Posted on <?php 
    echo $date;
    ?>
</div>
        <?php 
    $thread = ThreadPeer::retrieveByPK($post->getThreadId());
    if ($rowBest["poster_id"] != $user->getId()) {
        if ($sf_user->getRaykuUserId() == $thread->getPosterId()) {
            $best_resp_count = PostPeer::getCountOfBestResponseForThread($thread);
            if ($best_resp_count < 1) {
                echo link_to('Set as best', 'forum/bestresponse?post_id=' . $post->getId() . '&temp=' . $post->getUpdatedAt(), array('class' => 'setbest'));
            }
        }
    }
    ?>
      </div>
      <!--      <p class="message"><?php 
    // echo nl2br(htmlentities($post))
    ?>
 </p> -->
コード例 #8
0
ファイル: indexSuccess.php プロジェクト: rayku/rayku
</script>
<div style="display: none;">
  <div id="inline_moreposts" style="width:650px;height:500px;overflow:auto;padding:25px" align="left">
    <h4 style="font-size:20px;color:#069;font-weight:bold;line-height:30px;">More recent posts</h4>
    <br/>
    <br/>
    <table width="650"  border='2px' align='center' style = "'border-bottom-width : 4px';">
      <tr >
        <th width="130px">Post</th>
        <th width="130px">Created</th>
        <th width="130px">Last post</th>
      </tr>
<?php 
if ($bestResponses != NULL) {
    foreach ($bestResponses as $response) {
        $a = new Criteria();
        $a->add(ThreadPeer::ID, $best_response->getThreadId());
        $threads = ThreadPeer::doSelectOne($a);
        if ($threads != NULL) {
            echo '<tr align="center">';
            echo '<td>' . link_to($threads->getTitle(), '@view_thread?thread_id=' . $threads->getId(), array('class' => 'threadttle')) . '</td>';
            echo '<td>' . $threads->getCreatedAt() . '</td>';
            echo '<td>' . $threads->getLastpostAt() . '</td>';
            echo '</tr>';
        }
    }
}
?>
    </table>
  </div>
</div>
コード例 #9
0
ファイル: User.php プロジェクト: rayku/rayku
 function getLastQuestionsForDashboard()
 {
     return ThreadPeer::getLastUsersThreads(array($this->getId()), 8);
 }
コード例 #10
0
ファイル: indexSuccess.php プロジェクト: rayku/rayku
      <div class="cat">
        <div class="iconnew2"><img src="../images/forum-icon-new2.png" /></div>
        <div class="desc">
          <h1><a href="#"><?php 
        echo link_to($publicforum->getName(), 'forum/' . $publicforum->getID());
        ?>
</a></h1>
          <?php 
        echo $publicforum->getDescription();
        ?>
 </div>
        <?php 
        $t = new Criteria();
        $t->add(ThreadPeer::CATEGORY_ID, $publicforum->getID());
        $t->add(ThreadPeer::CANCEL, 0);
        $forumcount = ThreadPeer::doCount($t);
        ?>
        <div class="threads"><?php 
        echo $forumcount;
        ?>
 Topics<br />
          <?php 
        $p = new Criteria();
        $p->addJoin(ThreadPeer::ID, PostPeer::THREAD_ID, Criteria::JOIN);
        $p->add(ThreadPeer::CATEGORY_ID, $publicforum->getID());
        $p->add(ThreadPeer::CANCEL, 0);
        $postcount = PostPeer::doCount($p);
        ?>
          <?php 
        echo $postcount - $forumcount;
        ?>
コード例 #11
0
ファイル: BaseThreadPeer.php プロジェクト: rayku/rayku
 /**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      PropelPDO $con the connection to use
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function retrieveByPKs($pks, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(ThreadPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(ThreadPeer::DATABASE_NAME);
         $criteria->add(ThreadPeer::ID, $pks, Criteria::IN);
         $objs = ThreadPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
コード例 #12
0
ファイル: BaseThread.php プロジェクト: rayku/rayku
 /**
  * Populates the object using an array.
  *
  * This is particularly useful when populating an object from one of the
  * request arrays (e.g. $_POST).  This method goes through the column
  * names, checking to see whether a matching key exists in populated
  * array. If so the setByName() method is called for that column.
  *
  * You can specify the key type of the array by additionally passing one
  * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  * The default key type is the column's phpname (e.g. 'AuthorId')
  *
  * @param      array  $arr     An array to populate the object from.
  * @param      string $keyType The type of keys the array uses.
  * @return     void
  */
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = ThreadPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setPosterId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setForumId($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setTitle($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setTags($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setVisible($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setCancel($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setCategoryId($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setNotifyEmail($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setNotifyPm($arr[$keys[9]]);
     }
     if (array_key_exists($keys[10], $arr)) {
         $this->setNotifySms($arr[$keys[10]]);
     }
     if (array_key_exists($keys[11], $arr)) {
         $this->setCellNumber($arr[$keys[11]]);
     }
     if (array_key_exists($keys[12], $arr)) {
         $this->setSchoolGrade($arr[$keys[12]]);
     }
     if (array_key_exists($keys[13], $arr)) {
         $this->setCreatedAt($arr[$keys[13]]);
     }
     if (array_key_exists($keys[14], $arr)) {
         $this->setLastpostAt($arr[$keys[14]]);
     }
     if (array_key_exists($keys[15], $arr)) {
         $this->setUserIp($arr[$keys[15]]);
     }
     if (array_key_exists($keys[16], $arr)) {
         $this->setBanned($arr[$keys[16]]);
     }
     if (array_key_exists($keys[17], $arr)) {
         $this->setReported($arr[$keys[17]]);
     }
     if (array_key_exists($keys[18], $arr)) {
         $this->setReportedDate($arr[$keys[18]]);
     }
     if (array_key_exists($keys[19], $arr)) {
         $this->setStickie($arr[$keys[19]]);
     }
 }