PageRenderTime 10ms CodeModel.GetById 1ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/php/component/box_external_repository_table/box_external_repository_table_cell_renderer.class.php

https://bitbucket.org/chamilo/chamilo-ext-repo-box-dev/
PHP | 68 lines | 40 code | 7 blank | 21 comment | 2 complexity | f7296ce1c90da0ddf4649d0b6982331d MD5 | raw file
 1<?php
 2namespace common\extensions\external_repository_manager\implementation\box;
 3
 4use common\extensions\external_repository_manager\DefaultExternalRepositoryObjectTableCellRenderer;
 5use common\extensions\external_repository_manager\ExternalRepositoryObject;
 6
 7use common\libraries\Utilities;
 8use common\libraries\Toolbar;
 9/**
10 * $Id: repository_browser_table_cell_renderer.class.php 204 2009-11-13 12:51:30Z kariboe $
11 * @package repository.lib.repository_manager.component.browser
12 */
13require_once dirname(__FILE__) . '/box_external_repository_table_column_model.class.php';
14/**
15 * Cell rendere for the learning object browser table
16 */
17class BoxExternalRepositoryTableCellRenderer extends DefaultExternalRepositoryObjectTableCellRenderer
18{
19    /**
20     * The repository browser component
21     */
22    private $browser;
23
24    /**
25     * Constructor
26     * @param RepositoryManagerBrowserComponent $browser
27     */
28    function __construct($browser)
29    {
30        parent :: __construct();
31        $this->browser = $browser;
32    
33    }
34
35    // Inherited
36    function render_cell($column, $external_object)
37    {
38        if ($column === BoxExternalRepositoryTableColumnModel :: get_modification_column())
39        {
40            return $this->get_modification_links($external_object);
41        }
42        
43        switch ($column->get_name())
44        {
45            case ExternalRepositoryObject :: PROPERTY_TITLE :
46                return $external_object->get_title();
47            case BoxExternalRepositoryObject :: PROPERTY_DESCRIPTION :
48                return $external_object->get_description();
49            case BoxExternalRepositoryObject :: PROPERTY_CREATED :
50                return $external_object->get_modified();
51        }
52        return parent :: render_cell($column, $external_object);
53    }
54
55    /**
56     * Gets the action links to display
57     * @param ContentObject $content_object The learning object for which the
58     * action links should be returned
59     * @return string A HTML representation of the action links
60     */
61    private function get_modification_links($external_repository_object)
62    {
63        $toolbar = new Toolbar();
64        $toolbar->add_items($this->browser->get_external_repository_object_actions($external_repository_object));
65        return $toolbar->as_html();
66    }
67}
68?>