Ejemplo n.º 1
0
 /**
  * Get all blog comment list
  * @param int $blogId
  * @param int $pageId
  */
 public function getListByBlog($blogId, $pageId = 0)
 {
     $list = array();
     $sql = $this->select()->from($this->t1, '*')->where("{$this->t1}.blogid = ?", $blogId)->order("{$this->t1}.uptime desc");
     $res = $this->dbr()->fetchAll($sql);
     foreach ($res as $row) {
         $customerDao = new Core_Customer();
         $customer = $customerDao->read($row['customerid']);
         $comment = array('id' => $row['id'], 'content' => '<b>' . $customer['name'] . '</b> : ' . $row['content'], 'uptime' => $row['uptime']);
         array_push($list, $comment);
     }
     return $list;
 }
Ejemplo n.º 2
0
 /**
  * Get blog list 
  * @param string $customerId Customer ID
  * @param int $pageId
  */
 public function getListByCustomer($customerId, $pageId = 0)
 {
     $list = array();
     $sql = $this->select()->from($this->t1, '*')->where("{$this->t1}.customerid = ?", $customerId)->order("{$this->t1}.uptime desc")->limitPage($pageId, 10);
     $res = $this->dbr()->fetchAll($sql);
     if ($res) {
         $customerDao = new Core_Customer();
         foreach ($res as $row) {
             $customer = $customerDao->read($row['customerid']);
             $blog = array('id' => $row['id'], 'content' => '<b>' . $customer['name'] . '</b> : ' . $row['content'], 'comment' => '评论(' . $row['commentcount'] . ')', 'picture' => $row['picture'], 'uptime' => $row['uptime']);
             array_push($list, $blog);
         }
     }
     return $list;
 }