Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

model.php 6.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. <?php
  2. /*
  3. +-----------------------------------------------------------------------+
  4. | lib/rcube_vacation.php |
  5. | |
  6. | Copyright (C) 2009 Boris HUISGEN <bhuisgen@hbis.fr> |
  7. | Licensed under the GNU GPL |
  8. +-----------------------------------------------------------------------+
  9. */
  10. class model
  11. {
  12. public $username = '';
  13. public $email = '';
  14. public $email_local = '';
  15. public $email_domain = '';
  16. public $addressed_to = null;
  17. public $send_from = null;
  18. public $vacation_enable = false;
  19. public $vacation_start = 0;
  20. public $vacation_starttime = 12;
  21. public $vacation_end = 0;
  22. public $vacation_endtime = 12;
  23. public $append_subject = true;
  24. public $vacation_subject = 'Out of office'; // overwrite in config.inc.php
  25. public $vacation_message = 'I am in Holidays...'; // overwrite in config.inc.php
  26. public $every = 1;
  27. /**
  28. * Constructor of the class.
  29. */
  30. public function __construct()
  31. {
  32. $this->init();
  33. }
  34. /*
  35. * Initialize the object.
  36. */
  37. private function init()
  38. {
  39. $this->username = rcmail::get_instance()->user->get_username();
  40. $parts = explode('@', $this->username);
  41. if (count($parts) >= 2)
  42. {
  43. $this->email = $this->username;
  44. $this->email_local = $parts[0];
  45. $this->email_domain = $parts[1] ;
  46. }
  47. }
  48. /*
  49. * Gets the username.
  50. *
  51. * @return string the username.
  52. */
  53. public function get_username()
  54. {
  55. return $this->username;
  56. }
  57. /*
  58. * Gets the full email of the user.
  59. *
  60. * @return string the email of the user.
  61. */
  62. public function get_email()
  63. {
  64. return $this->email;
  65. }
  66. /*
  67. * Gets the email local part of the user.
  68. *
  69. * @return string the email local part.
  70. */
  71. public function get_email_local()
  72. {
  73. return $this->email_local;
  74. }
  75. /*
  76. * Gets the email domain of the user.
  77. *
  78. * @return string the email domain.
  79. */
  80. public function get_email_domain()
  81. {
  82. return $this->email_domain;
  83. }
  84. /*
  85. * Gets the destination email address(es)
  86. *
  87. * @return string the 'from' email.
  88. */
  89. public function get_addressed_to()
  90. {
  91. return $this->addressed_to;
  92. }
  93. /*
  94. * Gets the sending email address..
  95. *
  96. * @return string the 'from' email.
  97. */
  98. public function get_send_from()
  99. {
  100. return $this->send_from;
  101. }
  102. /*
  103. * Checks if the vacation is enabled.
  104. *
  105. * @return boolean TRUE if vacation is enabled; FALSE otherwise.
  106. */
  107. public function is_vacation_enable ()
  108. {
  109. return $this->vacation_enable;
  110. }
  111. /*
  112. * Gets the vacation start date.
  113. *
  114. * @returng int the timestamp of the start date.
  115. */
  116. public function get_vacation_start()
  117. {
  118. if ( !$this->vacation_start )
  119. $this->vacation_start = time();
  120. return $this->vacation_start;
  121. }
  122. /*
  123. * Gets the vacation start time.
  124. *
  125. * @returng int Time in 24h format.
  126. */
  127. public function get_vacation_starttime()
  128. {
  129. return $this->vacation_starttime;
  130. }
  131. /*
  132. * Gets the vacation end date.
  133. *
  134. * @returng int the timestamp of the end date.
  135. */
  136. public function get_vacation_end()
  137. {
  138. if ( !$this->vacation_end )
  139. $this->vacation_end = 86400 + time();
  140. return $this->vacation_end;
  141. }
  142. /*
  143. * Gets the vacation end time.
  144. *
  145. * @returng int Time in 24h format.
  146. */
  147. public function get_vacation_endtime()
  148. {
  149. return $this->vacation_endtime;
  150. }
  151. /*
  152. * Gets the vacation subject.
  153. *
  154. * @return string the vacation subject.
  155. */
  156. public function get_vacation_subject()
  157. {
  158. return $this->vacation_subject;
  159. }
  160. /*
  161. * Gets the append subject.
  162. *
  163. * @return bool the apppend subject.
  164. */
  165. public function get_append_subject()
  166. {
  167. return $this->append_subject;
  168. }
  169. /*
  170. * Gets the vacation message.
  171. *
  172. * @return string the vacation message.
  173. */
  174. public function get_vacation_message()
  175. {
  176. return $this->vacation_message;
  177. }
  178. /*
  179. * Checks if a copy in inbox must be keep when the vacation is enabled.
  180. *
  181. * @return boolean TRUE if a copy must be keeped; FALSE otherwise.
  182. */
  183. public function is_vacation_keep_copy_in_inbox()
  184. {
  185. return $this->vacation_keepcopyininbox;
  186. }
  187. /*
  188. * Gets the periodicity of the email sent
  189. *
  190. * @return int the periodicity
  191. */
  192. public function get_every()
  193. {
  194. return $this->every;
  195. }
  196. /*
  197. * Sets the email of the user
  198. *
  199. * @param string $email the email.
  200. */
  201. public function set_email($email)
  202. {
  203. $this->email = $email;
  204. }
  205. /*
  206. * Sets the email local part of the user
  207. *
  208. * @param string $local the local part of the email.
  209. */
  210. public function set_email_local($local)
  211. {
  212. $this->email_local = $local;
  213. }
  214. /*
  215. * Sets the email domain part of the user
  216. *
  217. * @param string $local the domain part of the email.
  218. */
  219. public function set_email_domain($domain)
  220. {
  221. $this->email_domain = $domain;
  222. }
  223. /*
  224. * Sets the destination email address(es)
  225. *
  226. * @param string the 'from' email.
  227. */
  228. public function set_addressed_to($email)
  229. {
  230. $this->addressed_to = $email;
  231. }
  232. /*
  233. * Sets the sending email address..
  234. *
  235. * @param string the 'from' email.
  236. */
  237. public function set_send_from($email)
  238. {
  239. $this->send_from = $email;
  240. }
  241. /*
  242. * Enables or disables the vacation.
  243. *
  244. * @param boolean the flag.
  245. */
  246. public function set_vacation_enable($flag)
  247. {
  248. $this->vacation_enable = $flag;
  249. }
  250. /*
  251. * Sets the vacation start date.
  252. *
  253. * @param int the timestamp of the vacation start date.
  254. */
  255. public function set_vacation_start ($date)
  256. {
  257. $this->vacation_start = $date;
  258. }
  259. /*
  260. * Sets the vacation start time.
  261. *
  262. * @param int The time in 24h format.
  263. */
  264. public function set_vacation_starttime ($time)
  265. {
  266. $this->vacation_starttime = $time;
  267. }
  268. /*
  269. * Sets the vacation end date.
  270. *
  271. * @param int the timestamp of the vacation end date.
  272. */
  273. public function set_vacation_end ($date)
  274. {
  275. $this->vacation_end = $date;
  276. }
  277. /*
  278. * Sets the vacation end time.
  279. *
  280. * @param int The time in 24h format.
  281. */
  282. public function set_vacation_endtime ($time)
  283. {
  284. $this->vacation_endtime = $time;
  285. }
  286. /*
  287. * Sets the vacation subject.
  288. *
  289. * @param string $subject the vacation subject.
  290. */
  291. public function set_vacation_subject($subject)
  292. {
  293. $this->vacation_subject = $subject;
  294. }
  295. /*
  296. * Sets the append subject.
  297. *
  298. * @param bool $append Append the original subject to the subject
  299. */
  300. public function set_append_subject($append)
  301. {
  302. $this->append_subject = $append;
  303. }
  304. /*
  305. * Sets the vacation message.
  306. *
  307. * @param string $message the vacation message.
  308. */
  309. public function set_vacation_message($message)
  310. {
  311. $this->vacation_message = $message;
  312. }
  313. /*
  314. * Sets the vacation keep copy in inbox flag.
  315. *
  316. * @param boolean the flag.
  317. */
  318. public function set_vacation_keep_copy_in_inbox($flag)
  319. {
  320. $this->vacation_keepcopyininbox = $flag;
  321. }
  322. /*
  323. * Sets the periodicity of the auto answer
  324. *
  325. * @param int $period the periodicity
  326. */
  327. public function set_every($period)
  328. {
  329. $this->every = $period;
  330. }
  331. }