3
* This code is part of GOsa (http://www.gosa-project.org)
4
* Copyright (C) 2003-2008 GONICUS GmbH
6
* ID: $$Id: class_EventAddSystemDialog.inc 19076 2010-07-23 09:34:32Z hickert $$
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2 of the License, or
11
* (at your option) any later version.
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, write to the Free Software
20
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23
class EventAddSystemDialog extends management
26
protected $skipFooter = TRUE;
27
protected $skipHeader = TRUE;
29
function __construct($config,$ui)
31
$this->config = $config;
33
$this->storagePoints = array(
34
get_ou("servgeneric", "serverRDN"),
35
get_ou("workgeneric", "workstationRDN"),
36
get_ou("group", "ogroupRDN"),
37
get_ou("termgeneric", "terminalRDN"));
40
if (session::global_is_set(get_class($this)."_filter")){
41
$filter= session::global_get(get_class($this)."_filter");
43
$filter = new filter(get_template_path("../../addons/goto/events/eventTargetSystems-filter.xml", TRUE));
44
$filter->setObjectStorage($this->storagePoints);
46
$this->setFilter($filter);
49
$headpage = new listing(get_template_path("../../addons/goto/events/eventTargetSystems-list.xml", TRUE));
50
$headpage->setFilter($filter);
51
parent::__construct($config, $ui, "object", $headpage);
54
function save_object() {}
58
$act = $this->detectPostActions();
59
$headpage = $this->getHeadpage();
60
if(!isset($act['targets'])) return(array());
62
foreach($act['targets'] as $dn){
63
$ret[] = $headpage->getEntry($dn);
68
function get_selected_targets()
70
// Collect mac addresses
71
$entries = $this->save();
73
$ldap = $this->config->get_ldap_link();
74
$ldap->cd($this->config->current['BASE']);
75
$member_dns = array();
76
foreach($entries as $entry){
77
$member_dns[] = $entry['dn'];
78
if(in_array("gosaGroupOfNames", $entry['objectClass'])){
79
$ldap->cat($entry['dn']);
81
$attrs = $ldap->fetch();
82
if(isset($attrs['member'])){
83
for($i =0 ; $i< $attrs['member']['count']; $i++){
84
$member_dns[] = $attrs['member'][$i];
90
foreach($member_dns as $dn){
91
$ldap->cat($dn, array('macAddress'));
93
$attrs = $ldap->fetch();
94
if(isset($attrs['macAddress'])){
95
$macs[] = $attrs['macAddress'][0];
102
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: