imce_directories_theme

Definition

imce_directories_theme($form = array())
imce/inc/admin.inc, line 319

Description

Directorys form themed.

Code

<?php
function imce_directories_theme($form = array()) {
  $rows = array();
  $root = file_directory_path();

  foreach (element_children($form) as $key) {
    //directory path
    $row = array('<div class="container-inline">'. $root .'/'. drupal_render($form[$key]['name']) .'</div>'. drupal_render($form[$key]['subnav']));
    unset($form[$key]['name'], $form[$key]['subnav']);

    //permissions
    $header = array();
    foreach (element_children($form[$key]) as $perm) {
      $header[] = $form[$key][$perm]['#title'];
      unset($form[$key][$perm]['#title']);
      $row[] = drupal_render($form[$key][$perm]);
    }

    $rows[] = $row;
  }

  array_unshift($header, t('Directory path'));

  $output = '<h3 class="title">'. t('Directories') .'</h3>';
  $output .= theme('table', $header, $rows);
  $output .= '<div class="form-item"><div class="description">'. t('Define directories that users of this profile can access.
<ul>
	<li>Use alphanumeric characters as directory paths.</li>
	<li>To specify file system root, just enter <strong>.</strong>(dot) character.</li>
	<li>Use <strong>%uid</strong> as a placeholder for user ID. Ex: <em>users/user%uid</em> creates directories such as <em>users/user1</em>, <em>users/user42</em>, etc.</li>
  <li>To remove a directory from the list, leave the directory path blank.</li>
  <li>If you want more flexibility in directory paths you can execute php to return a directory path.<br />
  For php execution your directory path must start with <strong>php:</strong> and the rest must be a valid php code that is expected to return the actual directory path. <br />Ex: <strong>php: return \'users/\'.$user->name;</strong> defines <strong>users/USER-NAME</strong> as the directory path.<br />
  A multi-level directory example <strong>php: return date(\'Y\', $user->created).\'/\'.date(\'m\', $user->created).\'/\'.$user->uid;</strong> defines <strong>MEMBERSHIP-YEAR/MONTH/USER-ID</strong> as the directory path, resulting in self-categorized user directories based on membership date.<br />
  Note that you should use the $user variable instead of $GLOBALS[\'user\'] since they are not always the same object.</li>
</ul>
<p>Note that thumbnails permission does not affect thumbnail creation on upload. See thumbnails decription below.</p>
<p>If you need more fields, just fill all and save, and you will get two more on the next page.</p>') .'</div></div>';
  $output .= drupal_render($form);
  return $output;
}
?>