|
iTx Technologies offre gratuitement
|
||
[Vue sommaire] [Imprimer] [Vue textuelle]
1 <?php 2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); 3 /* 4 * Creates demo data for the team table 5 * 6 * SugarCRM is a customer relationship management program developed by 7 * SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc. 8 * 9 * This program is free software; you can redistribute it and/or modify it under 10 * the terms of the GNU General Public License version 3 as published by the 11 * Free Software Foundation with the addition of the following permission added 12 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK 13 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY 14 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. 15 * 16 * This program is distributed in the hope that it will be useful, but WITHOUT 17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 19 * details. 20 * 21 * You should have received a copy of the GNU General Public License along with 22 * this program; if not, see http://www.gnu.org/licenses or write to the Free 23 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 24 * 02110-1301 USA. 25 * 26 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, 27 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com. 28 * 29 * The interactive user interfaces in modified source and object code versions 30 * of this program must display Appropriate Legal Notices, as required under 31 * Section 5 of the GNU General Public License version 3. 32 * 33 * In accordance with Section 7(b) of the GNU General Public License version 3, 34 * these Appropriate Legal Notices must retain the display of the "Powered by 35 * SugarCRM" logo. If the display of the logo is not reasonably feasible for 36 * technical reasons, the Appropriate Legal Notices must display the words 37 * "Powered by SugarCRM". 38 */ 39 40 41 42 class TeamDemoData { 43 var $_team; 44 var $_large_scale_test; 45 46 var $guids = array( 47 'jim' => 'seed_jim_id', 48 'sarah' => 'seed_sarah_id', 49 'sally' => 'seed_sally_id', 50 'max' => 'seed_max_id', 51 'will' => 'seed_will_id', 52 'chris' => 'seed_chris_id', 53 /* 54 * Pending fix of demo data mechanism 55 'jim' => 'jim00000-0000-0000-0000-000000000000', 56 'sarah' => 'sarah000-0000-0000-0000-000000000000', 57 'sally' => 'sally000-0000-0000-0000-000000000000', 58 'max' => 'max00000-0000-0000-0000-000000000000', 59 'will' => 'will0000-0000-0000-0000-000000000000', 60 'chris' => 'chris000-0000-0000-0000-000000000000', 61 */ 62 ); 63 64 /** 65 * Constructor for creating demo data for teams 66 */ 67 function TeamDemoData($seed_team, $large_scale_test = false) 68 { 69 $this->_team = $seed_team; 70 $this->_large_scale_test = $large_scale_test; 71 } 72 73 /** 74 * 75 */ 76 function create_demo_data() { 77 global $current_language; 78 global $sugar_demodata; 79 foreach($sugar_demodata['teams'] as $v) 80 { 81 if (!$this->_team->retrieve($v['team_id'])) 82 $this->_team->create_team($v['name'], $v['description'], $v['team_id']); 83 } 84 85 if($this->_large_scale_test) 86 { 87 $team_list = $this->_seed_data_get_team_list(); 88 foreach($team_list as $team_name) 89 { 90 $this->_quick_create($team_name); 91 } 92 } 93 94 $this->add_users_to_team(); 95 } 96 97 function add_users_to_team() { 98 // Create the west team memberships 99 $this->_team->retrieve("West"); 100 $this->_team->add_user_to_team($this->guids['sarah']); 101 $this->_team->add_user_to_team($this->guids['sally']); 102 $this->_team->add_user_to_team($this->guids["max"]); 103 104 // Create the east team memberships 105 $this->_team->retrieve("East"); 106 $this->_team->add_user_to_team($this->guids["will"]); 107 $this->_team->add_user_to_team($this->guids['chris']); 108 } 109 110 /** 111 * 112 */ 113 function get_random_team() 114 { 115 $team_list = $this->_seed_data_get_team_list(); 116 $team_list_size = count($team_list); 117 $random_index = mt_rand(0,$team_list_size-1); 118 119 return $team_list[$random_index]; 120 } 121 122 /** 123 * 124 */ 125 function get_random_teamset() 126 { 127 $team_list = $this->_seed_data_get_teamset_list(); 128 $team_list_size = count($team_list); 129 $random_index = mt_rand(0,$team_list_size-1); 130 131 return $team_list[$random_index]; 132 } 133 134 135 /** 136 * 137 */ 138 function _seed_data_get_teamset_list() 139 { 140 $teamsets = Array(); 141 $teamsets[] = array("East", "West"); 142 $teamsets[] = array("East", "West", "1"); 143 $teamsets[] = array("West", "East"); 144 $teamsets[] = array("West", "East", "1"); 145 $teamsets[] = array("1", "East"); 146 $teamsets[] = array("1", "West"); 147 return $teamsets; 148 } 149 150 151 /** 152 * 153 */ 154 function _seed_data_get_team_list() 155 { 156 $teams = Array(); 157 //bug 28138 todo 158 $teams[] = "north"; 159 $teams[] = "south"; 160 $teams[] = "left"; 161 $teams[] = "right"; 162 $teams[] = "in"; 163 $teams[] = "out"; 164 $teams[] = "fly"; 165 $teams[] = "walk"; 166 $teams[] = "crawl"; 167 $teams[] = "pivot"; 168 $teams[] = "money"; 169 $teams[] = "dinero"; 170 $teams[] = "shadow"; 171 $teams[] = "roof"; 172 $teams[] = "sales"; 173 $teams[] = "pillow"; 174 $teams[] = "feather"; 175 176 return $teams; 177 } 178 179 /** 180 * 181 */ 182 function _quick_create($name) 183 { 184 if (!$this->_team->retrieve($name)) 185 { 186 $this->_team->create_team($name, $name, $name); 187 } 188 } 189 190 191 } 192 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
|
|
|
|