本文整理匯總了PHP中SibdietHelper::getActions方法的典型用法代碼示例。如果您正苦於以下問題:PHP SibdietHelper::getActions方法的具體用法?PHP SibdietHelper::getActions怎麽用?PHP SibdietHelper::getActions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SibdietHelper
的用法示例。
在下文中一共展示了SibdietHelper::getActions方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: addToolbar
/**
* Add the page title and toolbar.
*/
protected function addToolbar()
{
JFactory::getApplication()->input->set('hidemainmenu', true);
$user = JFactory::getUser();
$isNew = $this->item->id == 0;
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
$canDo = SibdietHelper::getActions();
JToolBarHelper::title(JText::_('COM_SIBDIET_MANAGER_ERRAND'), 'database errands');
// If not checked out, can save the item.
if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
JToolBarHelper::apply('errand.apply');
JToolBarHelper::save('errand.save');
}
if (!$checkedOut && $canDo->get('core.create')) {
JToolbarHelper::save2new('errand.save2new');
}
// If an existing item, can save to a copy.
if (!$isNew && $canDo->get('core.create')) {
JToolbarHelper::save2copy('errand.save2copy');
}
if (empty($this->item->id)) {
JToolBarHelper::cancel('errand.cancel');
} else {
JToolBarHelper::cancel('errand.cancel', 'JTOOLBAR_CLOSE');
}
}
示例2: display
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a Error object.
*
* @since 1.6
*/
public function display($tpl = null)
{
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->state = $this->get('State');
$this->canDo = SibdietHelper::getActions('com_sibdiet');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
$this->permissions = SibdietHelper::getUserPermissions();
$this->addToolbar();
if (in_array('units', $this->permissions)) {
parent::display($tpl);
}
}
示例3:
<span class="age hasTooltip" title="<?php
echo JText::_('COM_SIBDIET_AGE');
?>
">
<?php
if (!empty($this->item->profile->birthday)) {
$age = SibdietHelper::age($this->item->profile->birthday, $this->item->created);
echo $age->y . '.' . $age->m;
}
?>
</span>
<?php
echo $this->form->getInput('email', 'profile');
?>
<?php
$canDo = SibdietHelper::getActions();
?>
<?php
if ($canDo->get('room.1')) {
echo $this->form->getInput('room1');
}
?>
<?php
if ($canDo->get('room.2')) {
echo $this->form->getInput('room2');
}
?>
<?php
if ($canDo->get('room.3')) {
echo $this->form->getInput('room3');
}