/php/lib/content_object_rendition/html/full.class.php
PHP | 68 lines | 60 code | 8 blank | 0 comment | 3 complexity | b75d30507132389b1fccfd251327e911 MD5 | raw file
- <?php
- namespace repository;
-
- use common\libraries\Utilities;
- use common\libraries\Translation;
- use common\libraries\AttachmentSupport;
- use common\libraries\Theme;
-
- class HtmlFullContentObjectRendition extends HtmlContentObjectRendition
- {
-
- function render()
- {
- $object = $this->get_content_object();
- $html = array();
- $html[] = '<div class="content_object" style="background-image: url(' . Theme :: get_image_path(ContentObject :: get_content_object_type_namespace($object->get_type())) . 'logo/' . $object->get_icon_name() . ($object->is_latest_version() ? '' : '_na') . '.png);">';
- $html[] = '<div class="title">' . $object->get_title() . '</div>';
- $html[] = $this->get_description();
- $html[] = '</div>';
- $html[] = '<div class="clear"></div>';
-
- return implode("\n", $html);
- }
-
- function get_description()
- {
- $html[] = '<div class="description" style="overflow: auto;">';
- $renderer = new ContentObjectResourceRenderer($this, $this->get_content_object()->get_description());
- $html[] = $renderer->run();
- $html[] = '<div class="clear"></div>';
- if (method_exists($this->get_rendition_implementation(), 'get_description'))
- {
- $html[] = $this->get_rendition_implementation()->get_description();
- }
- $html[] = $this->get_attachments();
- $html[] = '</div>';
-
- return implode("\n", $html);
- }
-
- function get_attachments()
- {
- $object = $this->get_content_object();
- $html = array();
- if ($object instanceof AttachmentSupport)
- {
- $attachments = $object->get_attached_content_objects();
- if (count($attachments))
- {
- $html[] = '<div class="attachments" style="margin-top: 1em;">';
- $html[] = '<div class="attachments_title">' . htmlentities(Translation :: get('Attachments')) . '</div>';
- Utilities :: order_content_objects_by_title($attachments);
- $html[] = '<ul class="attachments_list">';
- foreach ($attachments as $attachment)
- {
- $url = $this->get_context()->get_content_object_display_attachment_url($attachment);
- $url = 'javascript:openPopup(\'' . $url . '\'); return false;';
- $html[] = '<li><a href="#" onClick="' . $url . '"><img src="' . Theme :: get_image_path(ContentObject :: get_content_object_type_namespace($attachment->get_type())) . 'logo/' . Theme :: ICON_MINI . '.png" alt="' . htmlentities(Translation :: get('TypeName', null, ContentObject :: get_content_object_type_namespace($attachment->get_type()))) . '"/> ' . $attachment->get_title() . '</a></li>';
- }
- $html[] = '</ul>';
- $html[] = '</div>';
-
- }
- }
- return implode("\n", $html);
- }
- }
- ?>