Example #1
0
 /**
  * Get all blog comment list
  * @param int $activityId
  * @param int $pageId
  */
 public function getListByActivity($activityId, $pageId = 0)
 {
     $list = array();
     $sql = $this->select()->from($this->t1, '*')->where("{$this->t1}.activityid = ?", $activityId)->order("{$this->t1}.uptime desc")->limitPage($pageId, 10);
     $res = $this->dbr()->fetchAll($sql);
     if ($res) {
         foreach ($res as $row) {
             if ($row['personal'] == 0) {
                 $customerDao = new Core_CustomerPerson();
             } else {
                 $customerDao = new Core_CustomerClub();
             }
             $customer = $customerDao->read($row['customerid']);
             $comment = array('id' => $row['id'], 'customername' => $customer['name'], 'content' => $row['content'], 'uptime' => $row['uptime']);
             array_push($list, $comment);
         }
     }
     return $list;
 }
Example #2
0
 /**
  * Get customer comment list 
  * @param string $customerId Customer ID
  * @param int $pageId
  */
 public function getListByCustomer($personal, $customerId, $pageId = 0)
 {
     $list = array();
     $sql = $this->select()->from($this->t1, '*')->where("{$this->t1}.customerid = ?", $customerId)->where("{$this->t1}.personal = ?", $personal)->order("{$this->t1}.uptime desc")->limitPage($pageId, 10);
     $res = $this->dbr()->fetchAll($sql);
     if ($res) {
         foreach ($res as $row) {
             $activityDao = new Core_Activity();
             $activity = $activityDao->read($row['activityid']);
             $per = $activity['personal'];
             if ($per == 0) {
                 $customerDao = new Core_CustomerPerson();
             } else {
                 $customerDao = new Core_CustomerClub();
             }
             $customer = $customerDao->read($activity['customerid']);
             $activity1 = array('id' => $activity['id'], 'title' => $activity['title'], 'face' => _FACE_URL . $customer['face'], 'picture' => _PICTURE_URL . $activity['picture'], 'content' => $activity['content'], 'person' => $customer['name'], 'personal' => $activity['personal'], 'comment' => '评论(' . $activity['commentcount'] . ')', 'like' => '赞(' . $activity['likecount'] . ')', 'part' => '参与(' . $activity['partcount'] . ')', 'uptime' => $activity['uptime']);
             array_push($list, $activity1);
         }
     }
     return $list;
 }