Ignore:
Timestamp:
Dec 7, 2013, 6:43:09 PM (10 years ago)
Author:
mistic100
Message:

load tags,themes,users,languages list in AJAX + move javascript code to external file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/AdminTools/include/MultiView.class.php

    r25791 r25817  
    212212    }
    213213  }
     214 
     215  /**
     216   * Register custom API methods
     217   */
     218  public static function register_ws($arr)
     219  {
     220    $service = &$arr[0];
     221   
     222    $service->addMethod(
     223      'multiView.getData',
     224      array('MultiView', 'ws_get_data'),
     225      array(),
     226      'AdminTools private method.',
     227      null,
     228      array('admin_only' => true, 'hidden' => true)
     229      );
     230  }
     231 
     232  /**
     233   * API method
     234   * Return full list of users, themes and languages
     235   */
     236  public static function ws_get_data($params)
     237  {
     238    global $conf;
     239   
     240    // get users
     241    $query = '
     242SELECT
     243  '.$conf['user_fields']['id'].' AS id,
     244  '.$conf['user_fields']['username'].' AS username
     245FROM '.USERS_TABLE.'
     246  ORDER BY CONVERT('.$conf['user_fields']['username'].', CHAR)
     247;';
     248    $out['users'] = array_from_query($query);
     249
     250    // get themes
     251    include_once(PHPWG_ROOT_PATH.'admin/include/themes.class.php');
     252    $themes = new themes();
     253    foreach (array_keys($themes->db_themes_by_id) as $theme)
     254    {
     255      if (!empty($theme))
     256      {
     257        $out['themes'][] = $theme;
     258      }
     259    }
     260
     261    // get languages
     262    foreach (get_languages() as $code => $name)
     263    {
     264      $out['languages'][] = array(
     265        'id' => $code,
     266        'name' => $name,
     267        );
     268    }
     269   
     270    return $out;
     271  }
    214272}
Note: See TracChangeset for help on using the changeset viewer.