You are here

function photos_get_count in Album Photos 7.3

Same name and namespace in other branches
  1. 6.2 photos.module \photos_get_count()

Return number of albums or photos.

4 calls to photos_get_count()
photos_page_image in inc/photos.page.inc
Latest images page.
photos_upload_form in inc/photos.edit.inc
Upload form.
photos_user_count in ./photos.module
Tracks number of albums created and number of albums allowed.
photos_user_load in ./photos.module
Implements hook_user_load().

File

./photos.module, line 1804
Implementation of photos.module.

Code

function photos_get_count($type, $id = 0) {
  switch ($type) {
    case 'user_album':
    case 'user_image':
    case 'site_album':
    case 'site_image':
    case 'node_node':
      return db_query("SELECT value FROM {photos_count} WHERE cid = :cid AND type = :type", array(
        ':cid' => $id,
        ':type' => $type,
      ))
        ->fetchField();
    case 'node_album':
      return db_query("SELECT count FROM {photos_album} WHERE pid = :pid", array(
        ':pid' => $id,
      ))
        ->fetchField();
  }
}