3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
18 require_once '../civicrm.config.php';
20 require_once 'CRM/Core/Config.php';
21 require_once 'CRM/Core/Error.php';
22 require_once 'CRM/Core/I18n.php';
24 require_once 'CRM/Contact/BAO/Group.php';
26 $config = CRM_Core_Config
::singleton();
28 $prefix = 'Automated Generated Group: ';
29 $query = "DELETE FROM civicrm_group where name like '%{$prefix}%'";
30 CRM_Core_DAO
::executeQuery($query);
34 $visibility = array('User and User Admin Only', 'Public Pages');
35 $groupType = array(NULL, '\ 11\ 1', '\ 12\ 1', '\ 11\ 12\ 1');
37 for ($i = 1; $i <= $numGroups; $i++
) {
38 $group = new CRM_Contact_BAO_Group();
39 $cnt = sprintf('%05d', $i);
40 $alphabet = mt_rand(97, 122);
41 $group->name
= $group->title
= chr($alphabet) . ": $prefix $cnt";
42 $group->is_active
= 1;
45 $group->visibility
= $visibility[$v];
48 $group->group_type
= $groupType[$t];