Beispiel #1
0
 /**
  * Get the number of rows in the table
  *
  * @param array $options
  *
  * @return int
  */
 public function getCountRowsTable($options = NULL)
 {
     $request = $this->getRequest();
     $params = $request->getParams();
     $table = $params['table'];
     //---------------------------
     if ($table == 'admin.blog_posts') {
         return Default_Model_DbTable_BlogPost::GetPostsCount($this->db, $options);
     }
     if ($table == 'admin.blog_posts_tags') {
         $post_ids = Default_Model_DbTable_BlogPost::GetPostsIds_Array($this->db, $options);
         return Default_Model_DbTable_BlogPostTag::GetPostsTags_Count($this->db, array('post_id' => $post_ids));
     }
     if ($table == 'admin.blog_posts_images') {
         $post_ids = Default_Model_DbTable_BlogPost::GetPostsIds_Array($this->db, $options);
         return Default_Model_DbTable_BlogPostImage::GetPostsImages_Count($this->db, array('post_id' => $post_ids));
     }
     if ($table == 'admin.blog_posts_audio') {
         $post_ids = Default_Model_DbTable_BlogPost::GetPostsIds_Array($this->db, $options);
         return Default_Model_DbTable_BlogPostAudio::GetPostsAudio_Count($this->db, array('post_id' => $post_ids));
     }
     if ($table == 'admin.blog_posts_video') {
         $post_ids = Default_Model_DbTable_BlogPost::GetPostsIds_Array($this->db, $options);
         return Default_Model_DbTable_BlogPostVideo::GetPostsVideo_Count($this->db, array('post_id' => $post_ids));
     }
     if ($table == 'admin.blog_posts_locations') {
         $post_ids = Default_Model_DbTable_BlogPost::GetPostsIds_Array($this->db, $options);
         return Default_Model_DbTable_BlogPostLocation::GetPostsLocations_Count($this->db, array('post_id' => $post_ids));
     }
 }