Sounds like you need a widget… if you need it on the layout of your page. If you only need it in one controller then you may not even need that (you could just put it in the view folder for that controller and renderPartial).
If you do the widget you’d just make a property for the action and initialise it in the constructor. The basic doc/tutorial is here (see how CMaskedTextField is set):
Widgets and modules are components. Everything (or almost) in Yii is a component. So you need a component. But which one? Module is too “huge” component for this task, because it usually has own views, controllers, models and other components. You need something simple, that can have own logic and display a piece of html code. That’s what we call a Widget.