You are here

function gallery_assist_items_upload in Gallery Assist 7

Same name in this branch
  1. 7 gallery_assist_form_BUP.inc \gallery_assist_items_upload()
  2. 7 gallery_assist_form.inc \gallery_assist_items_upload()

Form builder; GA items data form.

Parameters

$node: Object containing the node object.

See also

gallery_assist_items_form_submit()

1 call to gallery_assist_items_upload()
gallery_assist_gallery_node_form in ./gallery_assist.module
Form builder; GA settings node form builder.

File

./gallery_assist_form.inc, line 379
GA node settings, upload, sorting and gallery items management forms.

Code

function gallery_assist_items_upload($node, $allowed = array()) {
  if (isset($node->ga_items_unassigned) && count($node->ga_items_unassigned) > 0) {
    $files = '';
    if (count($node->ga_items_unassigned) > 0) {
      $rows = array();
      $fheader = array(
        t('#'),
        t('Archives'),
        #t('URL')
        '',
        '',
      );
      foreach ($node->ga_items_unassigned as $pid => $file) {
        $file = (object) $file;
        $row = array();
        $row[] = $file->fid;
        $row[] = array(
          'data' => $file->filename,
          'style' => 'width:100%;',
        );

        #$row[] = array('data' => $file->uri, 'style' => 'width:100%;');
        $row[] = l(t('add'), '#', array(
          'attributes' => array(
            'title' => 'Unpack and add images to the gallery',
          ),
        ));
        $row[] = l(t('discard'), '#', array(
          'attributes' => array(
            'title' => 'Remove this package permanently',
          ),
        ));
        $rows[] = $row;
      }
      $files = theme('table', array(
        'header' => $fheader,
        'rows' => $rows,
      ));
    }
  }
  $form = array();
  $form['upload'] = array(
    '#type' => 'fieldset',
    '#title' => 'Upload',
    '#collapsible' => TRUE,
    '#weight' => 1,
  );
  for ($i = 0; $i < 6; $i++) {
    $form['upload']["ga_file_{$i}"] = array(
      '#type' => 'file',
      '#title' => 'File',
    );
  }
  $form['upload']['allow_all_extensions'] = array(
    '#type' => 'hidden',
    '#value' => TRUE,
  );
  $form['upload']['extensions'] = array(
    '#type' => 'hidden',
    '#value' => 'jpg jpeg gif png zip ZIP',
  );
  if (!empty($files)) {
    $form['files_archives'] = array(
      '#type' => 'fieldset',
      '#title' => t('Files and archives'),
      '#collapsible' => TRUE,
      '#weight' => 3,
    );
    $form['files_archives']['table'] = array(
      '#markup' => !empty($packages) ? $packages . $files : $files,
    );
  }
  return $form;
}