Overview

Packages

  • Prefs

Classes

  • Horde_Prefs
  • Horde_Prefs_Cache_Base
  • Horde_Prefs_Cache_Null
  • Horde_Prefs_Cache_Session
  • Horde_Prefs_CategoryManager
  • Horde_Prefs_Exception
  • Horde_Prefs_Identity
  • Horde_Prefs_Scope
  • Horde_Prefs_Storage_Base
  • Horde_Prefs_Storage_File
  • Horde_Prefs_Storage_Imsp
  • Horde_Prefs_Storage_KolabImap
  • Horde_Prefs_Storage_Ldap
  • Horde_Prefs_Storage_Null
  • Horde_Prefs_Storage_Sql
  • Horde_Prefs_Translation
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * Preference storage implementation for an IMSP server.
 4:  *
 5:  * Copyright 2004-2012 Horde LLC (http://www.horde.org/)
 6:  *
 7:  * See the enclosed file COPYING for license information (LGPL). If you
 8:  * did not receive this file, see http://www.horde.org/licenses/lgpl21.
 9:  *
10:  * @author   Michael Rubinsky <mrubinsk@horde.org>
11:  * @category Horde
12:  * @package  Prefs
13:  */
14: class Horde_Prefs_Storage_Imsp extends Horde_Prefs_Storage_Base
15: {
16:     /**
17:      * Handle for the IMSP server connection.
18:      *
19:      * @var Horde_Imsp_Options
20:      */
21:     protected $_imsp;
22: 
23:     public function __construct($user, array $params = array())
24:     {
25:         if (empty($params['imsp'])) {
26:             throw new InvalidArguementException('Missing required imsp parameter.');
27:         }
28:         $this->_imsp = $params['imsp'];
29:         parent::__construct($user, $params);
30:     }
31: 
32:     /**
33:      */
34:     public function get($scope_ob)
35:     {
36:         try {
37:             $prefs = $this->_imsp->get($scope_ob->scope . '.*');
38:         } catch (Horde_Imsp_Exception $e) {
39:             throw new Horde_Prefs_Exception($e);
40:         }
41: 
42:         foreach ($prefs as $name => $val) {
43:             $name = str_replace($scope_ob->scope . '.', '', $name);
44:             if ($val != '-') {
45:                 $scope_ob->set($name, $val);
46:             }
47:         }
48: 
49:         return $scope_ob;
50:     }
51: 
52:     /**
53:      */
54:     public function store($scope_ob)
55:     {
56:         /* Driver has no support for storing locked status. */
57:         foreach ($scope_ob->getDirty() as $name) {
58:             $value = $scope_ob->get($name);
59:             try {
60:                 $this->_imsp->set($scope_ob->scope . '.' . $name, $value ? $value : '-');
61:             } catch (Horde_Imsp_Exception $e) {
62:                 throw new Horde_Prefs_Exception($e);
63:             }
64:         }
65:     }
66: 
67:     /**
68:      */
69:     public function remove($scope = null, $pref = null)
70:     {
71:         // TODO
72:     }
73: 
74:     /* Helper functions. */
75: 
76: }
77: 
API documentation generated by ApiGen