You are here

function photos_edit_upload in Album Photos 6.2

Same name and namespace in other branches
  1. 7.3 inc/photos.edit.inc \photos_edit_upload()
1 string reference to 'photos_edit_upload'
photos_menu in ./photos.module

File

inc/photos.edit.inc, line 2

Code

function photos_edit_upload() {
  global $user;
  $header = array(
    array(
      'data' => t('Album title'),
      'field' => 'n.title',
    ),
    array(
      'data' => t('Image count'),
      'field' => 'p.count',
    ),
    array(
      'data' => t('Link'),
    ),
    array(
      'data' => t('Create time'),
      'field' => 'n.nid',
      'sort' => 'desc',
    ),
  );
  $result = pager_query('SELECT n.*, p.count FROM {node} n INNER JOIN {x_album} p ON n.nid = p.pid WHERE n.uid = %d' . tablesort_sql($header), 20, 0, NULL, $user->uid);
  while ($node = db_fetch_object($result)) {
    $table[] = array(
      l($node->title, 'node/' . $node->nid),
      $node->count,
      array(
        'data' => l(t('Upload'), "node/{$node->nid}/photos") . l(t('View'), "photos/album/{$node->nid}") . l(t('Slideshow'), "photos/Slide/{$node->nid}"),
        'class' => 'photos_album_edit_table_link',
      ),
      format_date($node->created, 'small'),
    );
  }
  $v = drupal_get_form('photos_upload_form', 0, array(
    'submit' => true,
  ));
  if (empty($table)) {
    $table[] = array(
      array(
        'data' => t('Please create a album.'),
        'colspan' => 4,
      ),
    );
  }
  else {
    $v .= t('Or select an album: ');
  }
  $v .= theme('table', $header, $table);
  $v .= theme('pager', NULL, 20);
  return $v;
}