本文整理汇总了PHP中Permissions::canReadVersions方法的典型用法代码示例。如果您正苦于以下问题:PHP Permissions::canReadVersions方法的具体用法?PHP Permissions::canReadVersions怎么用?PHP Permissions::canReadVersions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Permissions
的用法示例。
在下文中一共展示了Permissions::canReadVersions方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: on_start
public function on_start() {
$c = Page::getByPath('/dashboard/blocks/stacks');
$cp = new Permissions($c);
if ($cp->canRead()) {
$c = Page::getCurrentPage();
$pcp = new Permissions($c);
if ((!$pcp->canReadVersions()) || ($_GET['vtask'] != 'view_versions' && $_GET['vtask'] != 'compare')) {
$cID = $c->getCollectionID();
$this->redirect('/dashboard/blocks/stacks','view_details', $cID);
} else {
$this->theme = 'dashboard';
}
} else {
global $c; // ugh
$v = View::getInstance();
$c = new Page();
$c->loadError(COLLECTION_NOT_FOUND);
$v->setCollectionObject($c);
$this->c = $c;
$cont = Loader::controller("/page_not_found");
$v->setController($cont);
$v->render('/page_not_found');
}
}
示例2: get
/**
* Returns an array of page objects based on current settings
*/
public function get($itemsToGet = 0, $offset = 0)
{
$pages = array();
if ($this->getQuery() == '') {
$this->setBaseQuery();
}
$this->setItemsPerPage($itemsToGet);
$r = parent::get($itemsToGet, $offset);
foreach ($r as $row) {
$nc = $this->loadPageID($row['cID']);
if (!$this->displayOnlyApprovedPages) {
$cp = new Permissions($nc);
if ($cp->canReadVersions()) {
$nc->loadVersionObject('RECENT');
} else {
$nc->loadVersionObject();
}
} else {
$nc->loadVersionObject();
}
$nc->setPageIndexScore($row['cIndexScore']);
$pages[] = $nc;
}
return $pages;
}
示例3: switch
switch ($cp->getError()) {
case COLLECTION_FORBIDDEN:
$v = View::getInstance();
$v->setCollectionObject($c);
$v->render('/page_forbidden');
break;
}
}
if (!$c->isActive() && !$cp->canWrite()) {
$v = View::getInstance();
$v->render('/page_not_found');
}
## If there's no error, then we build the collection, but first we load it with the appropriate
## version. We pass the function the collection object, as well as the collection permissions
## object, which the function will use to determine what version we get to see
if ($cp->canWrite() || $cp->canReadVersions()) {
$cvID = $_REQUEST['cvID'] ? $_REQUEST['cvID'] : "RECENT";
} else {
$cvID = "ACTIVE";
}
if ($_REQUEST['ccm-disable-controls'] == true || intval($cvID) > 0) {
$v = View::getInstance();
$v->disableEditing();
$v->disableLinks();
}
$vp = $c->loadVersionObject($cvID);
// returns the $vp object, which we then check
if ($vp->isError()) {
// if we've gotten an error getting information about this particular collection
// than we load up the Content class, and get prepared to fire away
switch ($vp->getError()) {
示例4: getAreaBlocksArray
function getAreaBlocksArray($c)
{
if (is_array($this->areaBlocksArray)) {
return $this->areaBlocksArray;
}
$this->cID = $c->getCollectionID();
$this->c = $c;
$this->areaBlocksArray = array();
if ($this->arIsGlobal) {
$blocks = array();
$cp = new Permissions($c);
if ($cp->canReadVersions()) {
$c = Stack::getByName($this->arHandle);
} else {
$c = Stack::getByName($this->arHandle, 'ACTIVE');
}
if (is_object($c)) {
$blocks = $c->getBlocks(STACKS_AREA_NAME);
$globalArea = Area::get($c, STACKS_AREA_NAME);
}
} else {
$blocks = $c->getBlocks($this->arHandle);
}
foreach ($blocks as $ab) {
if ($this->arIsGlobal && is_object($globalArea)) {
$ab->setBlockAreaObject($globalArea);
} else {
$ab->setBlockAreaObject($this);
}
$this->areaBlocksArray[] = $ab;
$this->totalBlocks++;
}
return $this->areaBlocksArray;
}
示例5: t
menuHTML += '<li><a class="ccm-menu-icon ccm-icon-permissions" dialog-append-buttons="true" id="ccm-toolbar-nav-permissions" dialog-width="640" dialog-height="330" dialog-modal="false" dialog-title="<?php
echo t('Permissions');
?>
" href="<?php
echo REL_DIR_FILES_TOOLS_REQUIRED;
?>
/edit_collection_popup.php?&cID=<?php
echo $cID;
?>
&ctask=edit_permissions"><?php
echo t('Permissions');
?>
</a></li>';
<?php
}
if ($cp->canReadVersions()) {
?>
menuHTML += '<li><a class="ccm-menu-icon ccm-icon-versions" id="ccm-toolbar-nav-versions" dialog-width="640" dialog-height="340" dialog-modal="false" dialog-title="<?php
echo t('Page Versions');
?>
" id="menuVersions<?php
echo $cID;
?>
" href="<?php
echo REL_DIR_FILES_TOOLS_REQUIRED;
?>
/versions.php?cID=<?php
echo $cID;
?>
"><?php
echo t('Versions');
示例6: die
<?php
defined('C5_EXECUTE') or die("Access Denied.");
$valt = Loader::helper('validation/token');
$fh = Loader::helper('file');
$token = '&' . $valt->getParameter();
$c = Page::getByID($_REQUEST['cID']);
$cID = $c->getCollectionID();
$cp = new Permissions($c);
$isCheckedOut = $c->isCheckedOut() && !$c->isEditMode();
if (!$cp->canReadVersions() && !$cp->canApproveCollection()) {
die(_("Access Denied."));
}
if ($_GET['vtask'] == 'view_version') {
?>
<?php
/*
we use the always-updated ID below so that Safari doesn't cache the iframe's contents. We probably shouldn't be
making a new iframe on every request to this anyway, but it doesn't happen very often and it represents a significant
hurdle to making it a bit of a better citizen, so we'll do it this way for now.
*/
?>
<iframe border="0" id="v<?php
echo time();
?>
" frameborder="0" height="100%" width="100%" src="<?php
echo BASE_URL . DIR_REL;
?>
/<?php
echo DISPATCHER_FILENAME;
示例7: t
?>
menuHTML += '<li class="ccm-main-nav-edit-option" <?php
if (!$c->isEditMode()) {
?>
style="display: none" <?php
}
?>
><a href="javascript:void(0)" id="ccm-nav-permissions"><?php
echo t('Permissions');
?>
</a></li>';
<?php
}
?>
<?php
if ($cp->canReadVersions() && !$c->isMasterCollection()) {
?>
menuHTML += '<li class="ccm-main-nav-edit-option" <?php
if (!$c->isEditMode()) {
?>
style="display: none" <?php
}
?>
><a href="javascript:void(0)" id="ccm-nav-versions"><?php
echo t('Versions');
?>
</a></li>';
<?php
}
if (($sh->canRead() || $cp->canDeleteCollection()) && !$c->isMasterCollection()) {
?>
示例8: getGlobalBlocks
public function getGlobalBlocks() {
$db = Loader::db();
$v = array( Stack::ST_TYPE_GLOBAL_AREA );
$rs = $db->GetCol('select stName from Stacks where Stacks.stType = ?', $v );
$blocks = array();
if (count($rs) > 0) {
$pcp = new Permissions($this);
foreach($rs as $garHandle) {
if ($pcp->canReadVersions()) {
$s = Stack::getByName($garHandle, 'RECENT');
} else {
$s = Stack::getByName($garHandle, 'ACTIVE');
}
if (is_object($s)) {
$blocksTmp = $s->getBlocks(STACKS_AREA_NAME);
$blocks = array_merge($blocks, $blocksTmp);
}
}
}
return $blocks;
}