contributions/voting/view/widgets/votingform.widget.php
Go to the documentation of this file.00001 <?php 00002 /** 00003 * A widget to print a voting result 00004 */ 00005 class WidgetVotingForm implements IWidget { 00006 public $instance; 00007 00008 public static function output($instance, $policy = self::NONE) { 00009 $w = new WidgetVotingForm($instance); 00010 return $w->render($policy); 00011 } 00012 00013 public function __construct($instance) { 00014 $this->instance = $instance; 00015 } 00016 00017 public function render($policy = self::NONE) { 00018 Load::models('votes'); 00019 $inst = $this->instance; 00020 $view = ViewFactory::create_view(IViewFactory::MESSAGE, 'widgets/votingform'); 00021 $view->assign('instance', $inst); 00022 $view->assign('action', ActionMapper::get_path('voting_vote', $inst)); 00023 $view->assign('policy', $policy); 00024 return $view->render(); 00025 } 00026 }