static function begin_import($source_name, $username = NULL, $password = NULL, $tracking_string = '', $redirect_url = NULL, $options = array()) { // $this->source_name = $source_name; // $this->redirect_url = $redirect_url; // $this->import_tracking_id = $tracking_string; $id = NULL; $consent_url = NULL; $applet_tag = NULL; // look at the given service and decide how which begin function to invoke. if (!empty($username)) { $resp = CSImport::begin_import_username_password($source_name, $username, $password, $tracking_string, $options); $consent_url = $resp['url']; } else { if (strcasecmp($source_name, "OUTLOOK") == 0 || strcasecmp($source_name, "ADDRESSBOOK") == 0) { $resp = CSImport::begin_import_applet($source_name, $tracking_string, $options); $applet_tag = CSImport::create_applet_tag($resp['id'], $resp['url']); } else { $resp = CSImport::begin_import_consent($source_name, $tracking_string, $redirect_url, $options); $consent_url = $resp['url']; } } $id = $resp['id']; return array('import_id' => $id, 'consent_url' => $consent_url, 'applet_tag' => $applet_tag); }