本文整理汇总了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');
}