Back to index

d-push  2.0
contentparameters.php
Go to the documentation of this file.
00001 <?php
00002 /***********************************************
00003 * File      :   contentparameters.php
00004 * Project   :   Z-Push
00005 * Descr     :   Simple transportation class for
00006 *               requested content parameter options
00007 *
00008 * Created   :   11.04.2011
00009 *
00010 * Copyright 2007 - 2011 Zarafa Deutschland GmbH
00011 *
00012 * This program is free software: you can redistribute it and/or modify
00013 * it under the terms of the GNU Affero General Public License, version 3,
00014 * as published by the Free Software Foundation with the following additional
00015 * term according to sec. 7:
00016 *
00017 * According to sec. 7 of the GNU Affero General Public License, version 3,
00018 * the terms of the AGPL are supplemented with the following terms:
00019 *
00020 * "Zarafa" is a registered trademark of Zarafa B.V.
00021 * "Z-Push" is a registered trademark of Zarafa Deutschland GmbH
00022 * The licensing of the Program under the AGPL does not imply a trademark license.
00023 * Therefore any rights, title and interest in our trademarks remain entirely with us.
00024 *
00025 * However, if you propagate an unmodified version of the Program you are
00026 * allowed to use the term "Z-Push" to indicate that you distribute the Program.
00027 * Furthermore you may use our trademarks where it is necessary to indicate
00028 * the intended purpose of a product or service provided you use it in accordance
00029 * with honest practices in industrial or commercial matters.
00030 * If you want to propagate modified versions of the Program under the name "Z-Push",
00031 * you may only do so if you have a written permission by Zarafa Deutschland GmbH
00032 * (to acquire a permission please contact Zarafa at trademark@zarafa.com).
00033 *
00034 * This program is distributed in the hope that it will be useful,
00035 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00036 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00037 * GNU Affero General Public License for more details.
00038 *
00039 * You should have received a copy of the GNU Affero General Public License
00040 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00041 *
00042 * Consult LICENSE file for details
00043 ************************************************/
00044 
00045 
00046 class ContentParameters extends StateObject {
00047     protected $unsetdata = array(   'contentclass' => false,
00048                                     'foldertype' => '',
00049                                     'conflict' => false,
00050                                     'deletesasmoves' => true,
00051                                     'filtertype' => false,
00052                                     'truncation' => false,
00053                                     'rtftruncation' => false,
00054                                     'mimesupport' => false,
00055                                     'conversationmode' => false,
00056                                 );
00057 
00058     private $synckeyChanged = false;
00059 
00080     public function __call($name, $arguments) {
00081         if ($name === "BodyPreference")
00082             return $this->BodyPreference($arguments[0]);
00083 
00084         return parent::__call($name, $arguments);
00085     }
00086 
00087 
00096     public function BodyPreference($type) {
00097         if (!isset($this->bodypref))
00098             $this->bodypref = array();
00099 
00100         if (isset($this->bodypref[$type]))
00101             return $this->bodypref[$type];
00102         else {
00103             $asb = new BodyPreference();
00104             $arr = (array)$this->bodypref;
00105             $arr[$type] = $asb;
00106             $this->bodypref = $arr;
00107             return $asb;
00108         }
00109     }
00110 
00117     public function GetBodyPreference() {
00118         if (!isset($this->bodypref) || !(is_array($this->bodypref) || empty($this->bodypref))) {
00119             ZLog::Write(LOGLEVEL_DEBUG, sprintf("ContentParameters->GetBodyPreference(): bodypref is empty or not set"));
00120             return false;
00121         }
00122         return array_keys($this->bodypref);
00123     }
00124 
00131     protected function preSerialize() {
00132         parent::preSerialize();
00133 
00134         if ($this->changed === true && $this->synckeyChanged)
00135             $this->lastsynctime = time();
00136 
00137         return true;
00138     }
00139 }
00140 
00141 ?>