You are here

function _photos_useralbum_option in Album Photos 6.2

Same name and namespace in other branches
  1. 7.3 photos.module \_photos_useralbum_option()
3 calls to _photos_useralbum_option()
photos_admin_import in inc/photos.admin.inc
photos_editlist in inc/photos.edit.inc
photos_upload_form in inc/photos.edit.inc

File

./photos.module, line 1009

Code

function _photos_useralbum_option($uid = 0, $current = 0) {
  if (!$uid) {
    $uid = $GLOBALS['user']->uid;
  }
  $output = array();
  if (arg(1) == 'quote' && $_GET['type'] != 'upload') {
    $choice = new stdClass();
    $choice->option = array(
      t('All albums'),
    );
    $output[] = $choice;
  }
  $result = db_query('SELECT n.nid, n.title FROM {node} n INNER JOIN {x_album} a ON a.pid = n.nid WHERE n.uid = %d ORDER BY n.nid DESC', $uid);
  $true = false;
  while ($a = db_fetch_object($result)) {
    $choice = new stdClass();
    $choice->option = array(
      $a->nid => $a->title,
    );
    $output[] = $choice;
    $true = true;
  }
  if ($current) {
    $choice = new stdClass();
    $choice->option = array(
      $current[0] => $current[1],
    );
    $output[] = $choice;
  }
  if (!$true) {
    $output = array(
      t('You do not have an album yet.'),
    );
  }
  return $output;
}