Hi!
First, i guess you need to be clear in the flow of the "MVC" architecture on Zikula:
pnuser.php (or pnadmin.php) are the entry points or "Controllers",
the ones that receives the parameters, passes them to the Model (APIs) and return an Output.
So, a controller function basically does something like:
function MyModule_type_showPoints
($args) { // get the input parameters $uid = FormUtil::
getPassedValue('uid') // validate the uid, if empty takes the current user id if (empty($uid)) { $uid =
-1;
} // get the item through the model $points = pnModAPIFunc
('MyModule',
'user',
'getpoints',
array('uid' =>
$uid)) // or just $points = pnUserGetVar
('pn_points',
$uid) // if there's no item return an error if ($points ===
false) { return LogUtil::
registerError(_NOSUCHITEM,
404);
} // build the output $renderer = pnRender::
getInstance('MyModule');
// assign the item data to the template $renderer->
assign('points',
$points) // return the output return $renderer->
fetch('mymodule_type_showpoints.htm')}
So, as clean as possible, get the parameters, use the model and build the output.
You can render the points value with:
The code above is a
Smarty plugin call (requires that the file /modules/MyModule/pntemplates/function.points.php exists and deifned the plugin work). Inside a plugin you can call the adminapi method (or pnUserGetVar) too, and return the user points.
Anyways, the man that i know worked with this stuff a lot is Topiatic.
You should check his RosterMaster module @CoZi
Greetings
--
-
Mateo T. -
Mis principios... son mis fines