本文整理汇总了PHP中TaskPermission::canUninstallPackages方法的典型用法代码示例。如果您正苦于以下问题:PHP TaskPermission::canUninstallPackages方法的具体用法?PHP TaskPermission::canUninstallPackages怎么用?PHP TaskPermission::canUninstallPackages使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TaskPermission
的用法示例。
在下文中一共展示了TaskPermission::canUninstallPackages方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: do_uninstall_package
public function do_uninstall_package() {
$pkgID = $this->post('pkgID');
$valt = Loader::helper('validation/token');
if ($pkgID > 0) {
$pkg = Package::getByID($pkgID);
}
if (!$valt->validate('uninstall')) {
$this->error->add($valt->getErrorMessage());
}
$tp = new TaskPermission();
if (!$tp->canUninstallPackages()) {
$this->error->add(t('You do not have permission to uninstall packages.'));
}
if (!is_object($pkg)) {
$this->error->add(t('Invalid package.'));
}
if (!$this->error->has()) {
$pkg->uninstall();
if ($this->post('pkgMoveToTrash')) {
$r = $pkg->backup();
if (is_array($r)) {
$pe = Package::mapError($r);
foreach($pe as $ei) {
$this->error->add($ei);
}
}
}
if (!$this->error->has()) {
$this->redirect('/dashboard/extend/install', 'package_uninstalled');
}
}
if ($this->error->has()) {
$this->set('error', $this->error);
}
$this->inspect_package($pkgID);
}
示例2: TaskPermission
<td class="ccm-addon-list-description"><h3><?=$bt->getBlockTypeName()?></a></h3><?=$bt->getBlockTypeDescription()?></td>
<td><div style="width: 80px"><?=$ch->button(t("Edit"), View::url('/dashboard/install', 'inspect_block_type', $bt->getBlockTypeID()))?></div></td>
</tr>
</table>
</div>
<? } ?>
<br/><br/>
<? } ?>
<div class="ccm-spacer"> </div>
<?
$tp = new TaskPermission();
if ($tp->canUninstallPackages()) {
$buttons[] = $ch->button(t('Uninstall Package'), $this->url('/dashboard/install', 'uninstall', $pkg->getPackageID()), 'left');
print $ch->buttons($buttons);
} ?>
</div>
<?
} else if (is_object($bt)) { ?>
<h1><span><?=$bt->getBlockTypeName()?></span></h1>
<div class="ccm-dashboard-inner">
<img src="<?=$ci->getBlockTypeIconURL($bt)?>" style="float: right" />