<?php
class GroupManager extends ManagerParent{ 
public $x_232 = ''; 
protected $x_233 = array( 
'addGroups' => array( 
'result' => 'out', 
'aGroupList' => 'array' 
), 
'updateGroups' => array( 
'result' => 'out', 
'groupIds' => 'array', 
'groupDetails' => 'array', 
'fields' => 'array' 
), 
'deleteGroups' => array( 
'result' => 'out', 
'groupList' => 'array' 
), 
'getGroupList' => array( 
'aGroupList' => 'out', 
'totalItems' => 'out', 
'query' => 'array', 
), 
); 
private $x_24d = array ( 
'GUID::001' => array('guid' => 'GUID::001', 'name' => 'name_001', 'description' => 'description_001'), 
'GUID::002' => array('guid' => 'GUID::002', 'name' => 'name_002', 'description' => 'description_002'), 
'GUID::003' => array('guid' => 'GUID::003', 'name' => 'name_003', 'description' => 'description_003'), 
'GUID::004' => array('guid' => 'GUID::004', 'name' => 'name_004', 'description' => 'description_004'), 
'GUID::005' => array('guid' => 'GUID::005', 'name' => 'name_005', 'description' => 'description_005'), 
'GUID::006' => array('guid' => 'GUID::006', 'name' => 'name_006', 'description' => 'description_006'), 
'GUID::007' => array('guid' => 'GUID::007', 'name' => 'name_007', 'description' => 'description_007'), 
'GUID::008' => array('guid' => 'GUID::008', 'name' => 'name_008', 'description' => 'description_008'), 
'GUID::009' => array('guid' => 'GUID::009', 'name' => 'name_009', 'description' => 'description_009'), 
'GUID::010' => array('guid' => 'GUID::010', 'name' => 'name_010', 'description' => 'description_010') 
); 
private $x_24e = 11; 
private function x_24f($x_24g) { 
$x_24h = array(); 
foreach ($x_24g as $x_24i) { 
$x_24h[] = $x_24i; 
} 
return $x_24h; 
} 
private function x_24j() { 
$x_z3 = kerio('webadmin::Session'); 
$x_z3->setSessionVariable('groupList', json_encode($this->x_24d)); 
$x_z3->setSessionVariable('groupNextId', $this->x_24e); 
} 
private function x_24k() { 
$x_z3 = kerio('webadmin::Session'); 
$x_z3->getSessionVariable('groupList', &$x_24l); 
if (!empty($x_24l)) { 
$this->x_24d = json_decode($x_24l, true); 
} 
$x_z3->getSessionVariable('groupNextId', &$x_24e); 
if (!empty($x_24e) && is_numeric($x_24e)) { 
$this->x_24e = intval($x_24e, 10); 
} 
} 
public function addGroups(&$x_232, $x_24d) { 
$this->x_24k(); 
foreach ($x_24d as $x_24m) { 
$x_24n = sprintf('GUID::%03d', $this->x_24e++); 
$this->x_24d[$x_24n] = array ( 
'guid' => $x_24n, 
'name' => $x_24m['name'], 
'description' => $x_24m['description'] 
); 
} 
$this->x_24j(); 
$x_232 = $this->x_24f($this->x_24d); 
return true; 
} 
public function updateGroups(&$x_232, $x_24o, $x_24p, $x_24q) { 
$this->x_24k(); 
if (empty($x_24q)) { 
$x_24q = array('name', 'description'); 
} 
for ($x_24r = 0, $x_24s = count($x_24o); $x_24r < $x_24s; $x_24r++) { 
$x_24t = $x_24o[$x_24r]; 
$x_24u = $x_24p[$x_24r]; 
if (!isset($this->x_24d[$x_24t])) { 
return false; 
} 
$x_24m = $this->x_24d[$x_24t]; 
foreach ($x_24q as $x_24v) { 
$x_24m[$x_24v] = $x_24u[$x_24v]; 
} 
$this->x_24d[$x_24t] = $x_24m; 
} 
$this->x_24j(); 
$x_232 = $this->x_24f($this->x_24d); 
return true; 
} 
public function deleteGroups(&$x_232, $x_24d) { 
$this->x_24k(); 
foreach ($x_24d as $x_24t) { 
unset($this->x_24d[$x_24t]); 
} 
$this->x_24j(); 
$x_232 = $this->x_24f($this->x_24d); 
return true; 
} 
public function getGroupList(& $x_24d, & $x_23z, $x_240) { 
$this->x_24k(); 
$x_24d = $this->x_24d; 
$x_23z = count($x_24d); 
$x_24w = $x_240['start']; 
$x_24a = $x_240['limit']; 
$x_24a = (-1 === $x_24a) ? $x_23z : $x_24a; 
$x_24w = max(0, (int) $x_24w); 
$x_24a = max(0, (int) $x_24a); 
$x_24d = array_slice($x_24d, $x_24w, $x_24a); 
$x_24d = $this->x_24f($this->x_24d); 
return true; 
} 
} 
?>
