You are here

function support_pm_admin_project_form in Support Ticketing System 7

Same name and namespace in other branches
  1. 6 support_pm/support_pm.admin.inc \support_pm_admin_project_form()
1 string reference to 'support_pm_admin_project_form'
support_pm_menu in support_pm/support_pm.module
Implements hook_menu(). TODO: Include date in 'view' and 'edit' tabs

File

support_pm/support_pm.admin.inc, line 509

Code

function support_pm_admin_project_form($form, &$form_state, $project = array()) {
  $form['project'] = array(
    '#title' => t('Project'),
    '#type' => 'textfield',
    '#required' => TRUE,
    '#maxlength' => 255,
    '#default_value' => isset($project->project) ? $project->project : '',
    '#description' => t('The project name.  This name may appear on invoices.'),
  );
  $form['path'] = array(
    '#title' => t('Path'),
    '#type' => 'textfield',
    '#required' => TRUE,
    '#maxlength' => 255,
    '#default_value' => isset($project->path) ? $project->path : '',
    '#description' => t('A url friendly project path using alpha-numerics, "-", and "_".'),
  );
  $form['disabled'] = array(
    '#title' => t('Disabled'),
    '#type' => 'checkbox',
    '#default_value' => isset($project->disabled) ? $project->disabled : 0,
    '#description' => t('Disabled projects won\'t show up as an option when creating new tickets.'),
  );
  $form['weight'] = array(
    '#title' => t('Weight'),
    '#type' => 'weight',
    '#default_value' => isset($project->weight) ? $project->weight : 0,
    '#description' => t('When multiple projects are available, the project with the smallest (negative) weight will be selected as the default.'),
  );
  $clients = array(
    0 => t('-- All clients --'),
  ) + _support_clients_load();
  $form['clids'] = array(
    '#title' => t('Clients'),
    '#type' => 'select',
    '#options' => $clients,
    '#multiple' => TRUE,
    '#required' => TRUE,
    '#size' => count($clients) > 5 ? count($clients) : 5,
    '#default_value' => isset($project->clids) ? $project->clids : array(
      0,
    ),
    '#description' => t('Select the client(s) this project applies to.'),
  );
  if (!empty($project)) {
    $form['#project'] = $project;
  }
  $form['actions']['submit'] = array(
    '#value' => t('Save'),
    '#type' => 'submit',
  );
  if (isset($project->projid)) {
    $form['actions']['delete'] = array(
      '#value' => t('Delete'),
      '#type' => 'submit',
      '#submit' => array(
        'support_pm_admin_project_form_delete_submit',
      ),
    );
    $form['actions']['cancel'] = array(
      '#markup' => l(t('Cancel'), 'admin/support/project'),
    );
  }
  return $form;
}