Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
tool_delete_bmail_users.inc
1 <?php
17 require_once SQ_SYSTEM_ROOT.'/core/assets/system/tool/tool.inc';
18 
33 {
34 
35 
42  function Tool_Delete_Bmail_Users($assetid=0)
43  {
44  $this->Tool($assetid);
45 
46  }//end constructor
47 
48 
58  public static function paintTool(&$o, $type_code)
59  {
60  $tool_info = $GLOBALS['SQ_SYSTEM']->am->getTypeInfo($type_code);
61  $o->openSection($tool_info['name']);
62 
63  $o->openField(translate('bm_tool_delete_bmail_users_file_upload'));
64  file_upload($type_code.'_file_upload');
65  $o->note(translate('bm_tool_delete_bmail_users_file_upload_note'));
66  $o->closeField();
67 
68  $o->openField(translate('bm_tool_delete_bmail_users_root_node'));
69  multiple_asset_finder($type_code.'_root_node');
70  $o->note(translate('bm_tool_delete_bmail_users_root_node_note'));
71  $o->closeField();
72 
73  $o->openField(translate('bm_tool_delete_bmail_users_confirm'));
74  combo_box($type_code.'_confirm', Array(0=>translate('no'), 1=>translate('yes')));
75  $o->note(translate('bm_tool_delete_bmail_users_confirm_note'));
76  $o->closeField();
77 
78  $o->openField(translate('bm_tool_delete_bmail_users_link_node'));
79  asset_finder($type_code.'_link_node');
80  $o->note(translate('bm_tool_delete_bmail_users_link_node_note'));
81  $o->closeField();
82 
83  $link_type_list = get_link_type_names();
84 
85  $o->openField(translate('bm_tool_delete_bmail_users_link_type'));
86  combo_box($type_code.'_link_type', $link_type_list, FALSE);
87  $o->note(translate('bm_tool_delete_bmail_users_link_type_note'));
88  $o->closeField();
89 
90  $o->closeSection();
91 
92  }//end paintTool()
93 
94 
104  public static function processTool(&$o, $type_code)
105  {
106  // error: csv file not specified
107  $file_info = get_file_upload_info($type_code.'_file_upload');
108  if (empty($file_info)) {
109  trigger_localised_error('BML0011', E_USER_NOTICE);
110  return FALSE;
111  }
112 
113  $selected_root_nodes = array_get_index($_POST, $type_code.'_root_node', Array());
114  $root_nodes = Array();
115  if (!empty($selected_root_nodes)) {
116  foreach ($selected_root_nodes as $root_node) {
117  $assetid = array_get_index($root_node, 'assetid', 0);
118  if (!empty($assetid)) {
119  $root_nodes[] = $assetid;
120  }//end if
121  }//end foreach
122  }//end if
123 
124  $link_node = array_get_index($_POST, $type_code.'_link_node');
125  $link_type = array_get_index($_POST, $type_code.'_link_type', Array());
126 
127  // set HIPO running_vars
128  $vars = Array(
129  'file_info' => $file_info,
130  'root_nodes' => $root_nodes,
131  'link_asset' => Array(
132  'assetid' => $link_node['assetid'],
133  'link_type' => $link_type,
134  ),
135  );
136 
137  // OK to continue?
138  if ((!isset($_POST[$type_code.'_confirm'])) || ($_POST[$type_code.'_confirm'] == 0)) {
139  return FALSE;
140  }
141 
142  // run HIPO job
143  $hh =& $GLOBALS['SQ_SYSTEM']->getHipoHerder();
144  $hh->queueHipo('hipo_job_tool_delete_bmail_users', $vars, '', SQ_PACKAGES_PATH.'/bulkmail/hipo_jobs');
145  $url = $hh->runQueuedJobs();
146  if (!empty($url)) $o->setRedirect($url);
147  return TRUE;
148 
149  }//end processTool()
150 
151 
152 }//end class
153 
154 
155 ?>