I'm going to trace this one a bit further back to give you more insight into the inner workings...<div><br></div><div>So the Notification.php of that that module registers for a callback of CALLBACK_CORE_ITEM_VIEW_ACTIONMENU. This is found in the core/views/item/view.phtml file, which gets displayed when the ItemController.viewAction is called. In that view.phtml file we have this line:</div>
<div><br></div><div>$htmltArray = Zend_Registry::get('notifier')->callback("CALLBACK_CORE_ITEM_VIEW_ACTIONMENU", array('item' => $this->itemDao, 'isModerator' => $this->isModerator, 'isAdmin' => $this->isAdmin));</div>
<div><br></div><div>This calls the callback in question with these params, which means any module that registers with this callback will have its registered callback handler called with these params. These params are the itemDao, and then permissions for the currently logged-in user, isModerator and isAdmin say whether the current user has these permissions for the itemDao (the item currently being viewed). Moderator means the user can write to the item and edit, Admin means the user has delete permissions on the item (and if they are Admin, they are automatically Moderator also).</div>
<div><br></div><div>To tie this in a bit with writing controllers and views, in the view.phtml, the "$this" in question is the view object. The values of the view object properties get populated in the controller, so looking in the ItemController.php viewAction method, we see these two lines</div>
<div><br></div><div><div>$this->view->isAdmin = $this->Item->policyCheck($itemDao, $this->userSession->Dao, MIDAS_POLICY_ADMIN);</div><div>$this->view->isModerator = $this->Item->policyCheck($itemDao, $this->userSession->Dao, MIDAS_POLICY_WRITE);</div>
<div> </div></div><div>Here the "$this" is the controller object, which populates its view object (which is the "$this" in view.phtml) with values for isAdmin and isModerator, and then once we are in the view object itself (in view.pthml), we can refer to them by $this->isAdmin, etc.</div>
<div><br></div><div><br></div><div>Relating back to the question you actually asked :) , in your equivalent of getActionMenu, maybe you only want to display an action link in the item view for items where the current user is a moderator or admin (doesn't make sense to display an action link to a user with read only access on an item, or an anonymous/non-logged in user, if the link will lead them to some behavior where they'll be editing the item, or if you don't want these users to be able to execute this action).</div>
<div><br></div><div>I hope this answer helped more than it confused.</div><div><br></div><div>-Mike</div><div><br></div><div><br><div><br><div class="gmail_quote">On Wed, Jul 4, 2012 at 5:03 PM, Mona Wong <span dir="ltr"><<a href="mailto:mona@sdsc.edu" target="_blank">mona@sdsc.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
I see from the remoteprocessing/Notification.php that it has:<br>
<br>
public function getActionMenu($params)<br>
{<br>
if($this->isExecutable($params) && $params['isModerator'] && $params['item'] instanceof ItemDao)<br>
<br>
I'm wondering what is the $params['isModerator'] used for and whether I should do the same checking as that module on the incoming parameters?<br>
<br>
Mona<br>
<br>
*********************************************<br>
Mona Wong<br>
Web & iPad Application Developer<br>
San Diego Supercomputer Center<br>
<br>
You are the light you wish to see.<br>
*********************************************<br>
<br>
<br>
<br>
_______________________________________________<br>
Midas mailing list<br>
<a href="mailto:Midas@public.kitware.com">Midas@public.kitware.com</a><br>
<a href="http://public.kitware.com/cgi-bin/mailman/listinfo/midas" target="_blank">http://public.kitware.com/cgi-bin/mailman/listinfo/midas</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Thanks,<br>Michael Grauer<br>R & D Engineer<br>Kitware, Inc.<br>919 969 6990 x322<br><br><br><br>
</div></div>