1: <?php
2: /**
3: * Copyright 2014 Horde LLC (http://www.horde.org/)
4: *
5: * See the enclosed file COPYING for license information (GPL). If you
6: * did not receive this file, see http://www.horde.org/licenses/gpl.
7: *
8: * @category Horde
9: * @copyright 2014 Horde LLC
10: * @license http://www.horde.org/licenses/gpl GPL
11: * @package IMP
12: */
13:
14: /**
15: * Wraps all display issues for a message part in a status message that hides
16: * the details by default.
17: *
18: * @author Michael Slusarz <slusarz@horde.org>
19: * @category Horde
20: * @copyright 2014 Horde LLC
21: * @license http://www.horde.org/licenses/gpl GPL
22: * @package IMP
23: */
24: class IMP_Mime_Status_RenderIssue_Display extends IMP_Mime_Status
25: {
26: /**
27: * Render issues.
28: *
29: * @var array
30: */
31: protected $_issues = array();
32:
33: /**
34: * Add render issues to queue.
35: *
36: * @param array $issues Render issues.
37: */
38: public function addIssues(array $issues)
39: {
40: $this->_issues = array_merge($this->_issues, $issues);
41: }
42:
43: /**
44: * Output status block HTML.
45: *
46: * @return string The formatted status message HTML.
47: */
48: public function __toString()
49: {
50: global $registry;
51:
52: $out = '';
53:
54: switch ($registry->getView()) {
55: case $registry::VIEW_SMARTMOBILE:
56: break;
57:
58: default:
59: $unique_id = strval(new Horde_Support_Randomid());
60:
61: $this->icon('info_icon.png', _("Info"));
62: $this->_text = array(
63: Horde::link('#', '', 'showRenderIssues', '', '', '', '', array(
64: 'domid' => $unique_id
65: )) . _("Click to show message part display errors.") . '</a>'
66: );
67:
68: $out = parent::__toString();
69:
70: $out .= '<div id="' . $unique_id . '" style="display:none">';
71: foreach ($this->_issues as $val) {
72: $out .= strval($val);
73: }
74: $out .= '</div>';
75: }
76:
77: return $out;
78: }
79:
80: }
81: