PageRenderTime 58ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/php/component/link_viewer.class.php

https://bitbucket.org/chamilo/chamilo-app-weblcms-link/
PHP | 141 lines | 2 code | 0 blank | 139 comment | 0 complexity | 3d35ff5e4180132f91f552e8100c43b3 MD5 | raw file
  1. <?php
  2. //namespace application\weblcms\tool\link;
  3. //
  4. //use repository\content_object\introduction\Introduction;
  5. //use common\libraries\PatternMatchCondition;
  6. //use common\libraries\ActionBarRenderer;
  7. //use common\libraries\SubselectCondition;
  8. //use common\libraries\ToolbarItem;
  9. //use common\libraries\Display;
  10. //use common\libraries\Theme;
  11. //use common\libraries\OrCondition;
  12. //use common\libraries\Breadcrumb;
  13. //use common\libraries\BreadcrumbTrail;
  14. //use common\libraries\AndCondition;
  15. //use common\libraries\EqualityCondition;
  16. //use common\libraries\Request;
  17. //use common\libraries\Path;
  18. //use common\libraries\Translation;
  19. //use common\libraries\Utilities;
  20. //
  21. //use application\weblcms\ContentObjectPublication;
  22. //use application\weblcms\WeblcmsDataManager;
  23. //use application\weblcms\WeblcmsRights;
  24. //use application\weblcms\Tool;
  25. //use repository\ContentObject;
  26. //use repository\RepositoryDataManager;
  27. //use application\weblcms\tool\document\DocumentTool;
  28. //
  29. ///**
  30. // * $Id: link_viewer.class.php 216 2009-11-13 14:08:06Z kariboe $
  31. // * @package application.lib.weblcms.tool.link.component
  32. // */
  33. //
  34. //require_once dirname(__FILE__) . '/link_viewer/link_browser.class.php';
  35. //require_once Path :: get_repository_content_object_path() . 'link/php/link.class.php';
  36. //
  37. //class LinkToolViewerComponent extends LinkTool
  38. //{
  39. // private $action_bar;
  40. // private $introduction_text;
  41. //
  42. // function run()
  43. // {
  44. //
  45. // $conditions = array();
  46. // $conditions[] = new EqualityCondition(ContentObjectPublication :: PROPERTY_COURSE_ID, $this->get_course_id());
  47. // $conditions[] = new EqualityCondition(ContentObjectPublication :: PROPERTY_TOOL, 'link');
  48. //
  49. // $subselect_condition = new EqualityCondition(ContentObject :: PROPERTY_TYPE, Introduction :: get_type_name());
  50. // $conditions[] = new SubselectCondition(ContentObjectPublication :: PROPERTY_CONTENT_OBJECT_ID, ContentObject :: PROPERTY_ID, ContentObject :: get_table_name(), $subselect_condition, null, RepositoryDataManager :: get_instance());
  51. // $condition = new AndCondition($conditions);
  52. //
  53. // $publications = WeblcmsDataManager :: get_instance()->retrieve_content_object_publications($condition);
  54. // $this->introduction_text = $publications->next_result();
  55. //
  56. // $this->action_bar = $this->get_action_bar();
  57. //
  58. // $browser = new LinkBrowser($this);
  59. // $trail = BreadcrumbTrail :: get_instance();
  60. // $trail->add_help('courses link tool');
  61. //
  62. // /*if(Request :: get('pcattree') != null)
  63. // {
  64. // foreach(Tool ::get_pcattree_parents(Request :: get('pcattree')) as $breadcrumb)
  65. // {
  66. // $trail->add(new Breadcrumb($this->get_url(), $breadcrumb->get_name()));
  67. // }
  68. // }*/
  69. // if (Request :: get(Tool :: PARAM_PUBLICATION_ID) != null)
  70. // $trail->add(new Breadcrumb($this->get_url(array(Tool :: PARAM_ACTION => 'view', Tool :: PARAM_PUBLICATION_ID => Request :: get(Tool :: PARAM_PUBLICATION_ID))), WebLcmsDataManager :: get_instance()->retrieve_content_object_publication(Request :: get(Tool :: PARAM_PUBLICATION_ID))->get_content_object()->get_title()));
  71. //
  72. // $html = $browser->as_html();
  73. //
  74. // $this->display_header();
  75. //
  76. // //echo '<br /><a name="top"></a>';
  77. // if (! Request :: get(Tool :: PARAM_PUBLICATION_ID))
  78. // {
  79. // if ($this->get_course()->get_intro_text())
  80. // {
  81. // echo $this->display_introduction_text($this->introduction_text);
  82. // }
  83. // }
  84. //
  85. // echo $this->action_bar->as_html();
  86. // echo '<div id="action_bar_browser">';
  87. // echo $html;
  88. // echo '</div>';
  89. //
  90. // $this->display_footer();
  91. // }
  92. //
  93. // function add_actionbar_item($item)
  94. // {
  95. // $this->action_bar->add_tool_action($item);
  96. // }
  97. //
  98. // function get_action_bar()
  99. // {
  100. // $action_bar = new ActionBarRenderer(ActionBarRenderer :: TYPE_HORIZONTAL);
  101. //
  102. // if (! Request :: get(Tool :: PARAM_PUBLICATION_ID))
  103. // {
  104. // $action_bar->set_search_url($this->get_url());
  105. //
  106. // if ($this->is_allowed(WeblcmsRights :: ADD_RIGHT))
  107. // {
  108. // $action_bar->add_common_action(new ToolbarItem(Translation :: get('Publish', null, Utilities :: COMMON_LIBRARIES), Theme :: get_common_image_path() . 'action_publish.png', $this->get_url(array(LinkTool :: PARAM_ACTION => LinkTool :: ACTION_PUBLISH)), ToolbarItem :: DISPLAY_ICON_AND_LABEL));
  109. // }
  110. // }
  111. //
  112. // $action_bar->add_common_action(new ToolbarItem(Translation :: get('ShowAll', null, Utilities :: COMMON_LIBRARIES), Theme :: get_common_image_path() . 'action_browser.png', $this->get_url(array(Tool :: PARAM_ACTION => null)), ToolbarItem :: DISPLAY_ICON_AND_LABEL));
  113. //
  114. // if (! Request :: get(Tool :: PARAM_PUBLICATION_ID) && $this->is_allowed(WeblcmsRights :: EDIT_RIGHT))
  115. // $action_bar->add_common_action(new ToolbarItem(Translation :: get('ManageCategories', null, Utilities :: COMMON_LIBRARIES), Theme :: get_common_image_path() . 'action_category.png', $this->get_url(array(DocumentTool :: PARAM_ACTION => DocumentTool :: ACTION_MANAGE_CATEGORIES)), ToolbarItem :: DISPLAY_ICON_AND_LABEL));
  116. //
  117. // if (! $this->introduction_text && $this->get_course()->get_intro_text() && $this->is_allowed(WeblcmsRights :: EDIT_RIGHT))
  118. // {
  119. // $action_bar->add_common_action(new ToolbarItem(Translation :: get('PublishIntroductionText', null, 'weblcms'), Theme :: get_common_image_path() . 'action_introduce.png', $this->get_url(array(AnnouncementTool :: PARAM_ACTION => Tool :: ACTION_PUBLISH_INTRODUCTION)), ToolbarItem :: DISPLAY_ICON_AND_LABEL));
  120. // }
  121. // //$action_bar->add_tool_action(new ToolbarItem(Translation :: get('Edit'), Theme :: get_common_image_path().'action_edit.png', $this->get_url(array(LinkTool :: PARAM_ACTION => LinkTool :: ACTION_PUBLISH)), ToolbarItem :: DISPLAY_ICON_AND_LABEL));
  122. // //$action_bar->add_tool_action(new ToolbarItem(Translation :: get('Delete'), Theme :: get_common_image_path().'action_delete.png', $this->get_url(), ToolbarItem :: DISPLAY_ICON_AND_LABEL));
  123. //
  124. //
  125. // return $action_bar;
  126. // }
  127. //
  128. // function get_condition()
  129. // {
  130. // $query = $this->action_bar->get_query();
  131. // if (isset($query) && $query != '')
  132. // {
  133. // $conditions[] = new PatternMatchCondition(ContentObject :: PROPERTY_TITLE, '*' . $query . '*');
  134. // $conditions[] = new PatternMatchCondition(ContentObject :: PROPERTY_DESCRIPTION, '*' . $query . '*');
  135. // return new OrCondition($conditions);
  136. // }
  137. //
  138. // return null;
  139. // }
  140. //}
  141. ?>