You are here

function linkedin_profile_linkedin_admin_page in LinkedIn Integration 7

Same name and namespace in other branches
  1. 6 linkedin_profile/linkedin_profile.pages.inc \linkedin_profile_linkedin_admin_page()

@todo Please document this function.

See also

http://drupal.org/node/1354

File

linkedin_profile/linkedin_profile.pages.inc, line 16

Code

function linkedin_profile_linkedin_admin_page() {
  $form = array();

  //User profile settings
  $form['linkedin_profile'] = array(
    '#description' => t('Let users display information from their LinkedIn profile.'),
    '#title' => t('User profile integration'),
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['linkedin_profile']['user_page'] = array(
    '#description' => t('Enable users to display their LinkedIn profile page on their local user page.'),
    '#title' => t('User page'),
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['linkedin_profile']['user_page']['linkedin_profile_user_page_enabled'] = array(
    '#type' => 'select',
    '#title' => 'Profile display',
    '#options' => array(
      0 => t('Disabled'),
      1 => t('Tab'),
      2 => t('User page'),
      3 => t('Block'),
      4 => t('Hidden'),
    ),
    '#default_value' => variable_get('linkedin_profile_user_page_enabled', 0),
    '#description' => '<ul><li>' . t("Tab : will create a new tab containing the profile on the user's page") . '</li><li>' . t("User page : will display the profile amongst other elements on the user's page") . '</li><li>' . t("Block : will create a block containing the profile. Note you still have to activate it on the Blocks' admin page") . '</li><li>' . t('Hidden : Will not output anything, but make the data available as an array under $user->linkedin for theming') . '</li></ul>',
  );
  $form['linkedin_profile']['user_page']['linkedin_profile_user_page_weight'] = array(
    '#type' => 'textfield',
    '#title' => t('Profile item weight'),
    '#maxlength' => 4,
    '#size' => 2,
    '#description' => t('"User Page" display only. Changing this value will make the profile display move below or after other elements on the user page. E.g. setting this to 100 will make it the very last element.'),
    '#default_value' => variable_get('linkedin_profile_user_page_weight', 2),
  );
  $form['linkedin_profile']['user_page']['linkedin_profile_user_page_fields'] = array(
    '#type' => 'fieldset',
    '#title' => t('LinkedIn fields'),
    '#description' => t('Choose what fields to retrieve from a user LinkedIn profile.'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['linkedin_profile']['user_page']['linkedin_profile_user_page_fields']['warning'] = array(
    '#type' => 'markup',
    '#value' => '<ul>' . '<li>' . t('Be sure to observe what you are allowed to do with the data by checking the "Business and Legal" documents at http://developer.linkedin.com/community/apis?view=documents.') . '</li>' . '<li>' . t('A description of each field is available at http://developer.linkedin.com/docs/DOC-1061.') . '</li>' . '<li>' . t('Also, please note that the visibility of each field depends on the relation between the viewing and the viewed user at LinkedIn and his visibilty settings : be careful when theming the output.') . '<li>' . '<li>' . t('And finally, the output might be buggy for some of them and will probably need some theming work.') . '<li>' . '</ul>',
  );
  module_load_include('inc', 'linkedin');
  $fields = _linkedin_list_fields('auth');
  $options = array();
  foreach ($fields as $field) {
    $options[$field] = $field;
  }
  $form['linkedin_profile']['user_page']['linkedin_profile_user_page_fields']['linkedin_profile_user_page_linkedin_fields'] = array(
    '#type' => 'checkboxes',
    '#default_value' => _linkedin_profile_vget_user_page_linkedin_fields(),
    '#options' => $options,
  );
  $form['#submit'][] = 'linkedin_profile_admin_submit';
  return $form;
}