00001 <?php
00002
00003
00004
00005
00006
00007
00008 class WidgetBookmarking implements IWidget {
00009
00010
00011
00012
00013
00014 public $page_data;
00015
00016
00017
00018 public $services;
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 public static function output($page_data, $set_or_array, $policy = self::NONE) {
00029 $w = new WidgetBookmarking($page_data, $set_or_array);
00030 return $w->render($policy);
00031 }
00032
00033 public function __construct($page_data, $set_or_array) {
00034 $this->page_data = $page_data;
00035 $this->services = is_array($set_or_array) ? $set_or_array : SocialBookmarking::create_set($set_or_array);
00036 }
00037
00038
00039
00040
00041
00042
00043
00044 public function render($policy = self::NONE) {
00045 $arr_services = array();
00046 foreach($this->services as $service) {
00047 $tmp = SocialBookmarking::get_service($service);
00048 if ($tmp) {
00049 $arr_services[] = $tmp;
00050 }
00051 }
00052
00053 $this->page_data->head->add_css_file('css/socialbookmarking.css', true);
00054
00055 $view = ViewFactory::create_view(IViewFactory::MESSAGE, 'widgets/bookmarking', false);
00056 $view->assign('page_data', $this->page_data);
00057 $view->assign('services', $arr_services);
00058 return $view->render();
00059 }
00060 }