'seed_jim_id', 'sarah' => 'seed_sarah_id', 'sally' => 'seed_sally_id', 'max' => 'seed_max_id', 'will' => 'seed_will_id', 'chris' => 'seed_chris_id', /* * Pending fix of demo data mechanism 'jim' => 'jim00000-0000-0000-0000-000000000000', 'sarah' => 'sarah000-0000-0000-0000-000000000000', 'sally' => 'sally000-0000-0000-0000-000000000000', 'max' => 'max00000-0000-0000-0000-000000000000', 'will' => 'will0000-0000-0000-0000-000000000000', 'chris' => 'chris000-0000-0000-0000-000000000000', */ ); /** * Constructor for creating user demo data */ function UserDemoData($seed_user, $large_scale_test = false) { // use a seed user so it does not have to be known which file to // include the User class from $this->_user = $seed_user; $this->_large_scale_test = $large_scale_test; } /** * */ function create_demo_data() { // Create the VP if(!$this->_user->retrieve($this->guids['jim'])) { $this->_create_seed_user($this->guids['jim'], "Brennan", "Jim", "jim", "VP Sales", false, null, null, "jim@example.com"); } // Create the west team if(!$this->_user->retrieve($this->guids['sarah'])) { $this->_create_seed_user($this->guids['sarah'], "Smith", "Sarah", "sarah", "Sales Manager West", false, $this->guids['jim'], "Brennan, Jim", "sarah@example.com"); } if(!$this->_user->retrieve($this->guids['sally'])) { $this->_create_seed_user($this->guids['sally'], "Bronsen", "Sally", "sally", "Senior Account Rep", false, $this->guids['sarah'], "Smith, Sarah", "sally@example.com"); } if(!$this->_user->retrieve($this->guids['max'])) { $this->_create_seed_user($this->guids['max'], "Jensen", "Max", "max", "Account Rep", false, $this->guids['sarah'], "Smith, Sarah", "max@example.com"); } // Create the east team if(!$this->_user->retrieve($this->guids['will'])) { $this->_create_seed_user($this->guids['will'], "Westin", "Will", "will", "Sales Manager East", false, $this->guids['jim'], "Brennan, Jim", "will@example.com"); } if(!$this->_user->retrieve($this->guids['chris'])) { $this->_create_seed_user($this->guids['chris'], "Olliver", "Chris", "chris", "Senior Account Rep", false, $this->guids['will'], "Westin, Will", "chris@example.com"); } if($this->_large_scale_test) { $user_list = $this->_seed_data_get_user_list(); foreach($user_list as $user_name) { $this->_quick_create_user($user_name); } } } /** * creates seed users using multi-byte characters to simulate real-world * login conditions */ function create_demo_data_jp() { // Create the VP if(!$this->_user->retrieve($this->guids['jim'])) { $this->_create_seed_user($this->guids['jim'], "ブレナン", "ジーム", "jim", "VP Sales", false, null, null, "jim@example.com"); } // Create the west team if(!$this->_user->retrieve($this->guids['sarah'])) { $this->_create_seed_user($this->guids['sarah'], "スミス", "サーラー", "sarah", "Sales Manager West", false, $this->guids['jim'], "ブレナン, ジーム", "sarah@example.com"); } if(!$this->_user->retrieve($this->guids['sally'])) { $this->_create_seed_user($this->guids['sally'], "ブロンソン", "サーリー", "sally", "Senior Account Rep", false, $this->guids['sarah'], "スミス, サーラー", "sally@example.com"); } if(!$this->_user->retrieve($this->guids['max'])) { $this->_create_seed_user($this->guids['max'], "ジェンソン", "マクス", "max", "Account Rep", false, $this->guids['sarah'], "スミス、サーラー", "max@example.com"); } // Create the east team if(!$this->_user->retrieve($this->guids['will'])) { $this->_create_seed_user($this->guids['will'], "ウエストン", "ウイル", "will", "Sales Manager East", false, $this->guids['jim'], "ブレナン, ジーム", "will@example.com"); } if(!$this->_user->retrieve($this->guids['chris'])) { $this->_create_seed_user($this->guids['chris'], "オリバー", "クリス", "chris", "Senior Account Rep", false, $this->guids['will'], "ウエストン, ウイル", "chris@example.com"); } } function create_demo_data_jp_mssql() { // mssql is broken for mbcs $this->create_demo_data(); } /** * Create a user in the seed data. */ function _create_seed_user($id, $last_name, $first_name, $user_name, $title, $is_admin, $reports_to, $reports_to_name, $email) { $u = new User(); $u->id=$id; $u->new_with_id = true; $u->last_name = $last_name; $u->first_name = $first_name; $u->user_name = $user_name; $u->title = $title; $u->status = 'Active'; $u->employee_status = 'Active'; $u->is_admin = $is_admin; //$u->user_password = $u->encrypt_password($user_name); $u->user_hash = strtolower(md5($user_name)); $u->reports_to_id = $reports_to; $u->reports_to_name = $reports_to_name; //$u->email1 = $email; $u->emailAddress->addAddress($email, true); $u->emailAddress->addAddress("reply.".$email, false, true); $u->emailAddress->addAddress("alias.".$email); // bug 15371 tyoung set a user preference so that Users/DetailView.php can find something without repeatedly querying the db in vain $u->setPreference('max_tabs','12'); UserPreference::savePreferencesToDB($u,true); $u->save(); } /** * */ function _seed_data_get_user_list() { $users = Array(); $users[] = "north"; $users[] = "south"; $users[] = "east"; $users[] = "west"; $users[] = "left"; $users[] = "right"; $users[] = "in"; $users[] = "out"; $users[] = "fly"; $users[] = "walk"; $users[] = "crawl"; $users[] = "pivot"; $users[] = "money"; $users[] = "dinero"; $users[] = "shadow"; $users[] = "roof"; $users[] = "sales"; $users[] = "pillow"; $users[] = "feather"; return $users; } /** * */ function _quick_create_user($name) { if (!$this->_user->retrieve($name.'_id')) { $this->_create_seed_user("{$name}_id", $name, $name, $name, "Sales Manager of no territory", false, "seed_jim_id", "Brennan, Jim", "jim@example.com"); } } } ?>