当前位置: 首页>>代码示例>>PHP>>正文


PHP Permissions::canWrite方法代码示例

本文整理汇总了PHP中Permissions::canWrite方法的典型用法代码示例。如果您正苦于以下问题:PHP Permissions::canWrite方法的具体用法?PHP Permissions::canWrite怎么用?PHP Permissions::canWrite使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Permissions的用法示例。


在下文中一共展示了Permissions::canWrite方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: isValidComposerPage

	/** 
	 * Checks to see if the page in question is a valid composer draft for the logged in user
	 */
	protected static function isValidComposerPage($entry) {
		$ct = CollectionType::getByID($entry->getCollectionTypeID());
		if (!$ct->isCollectionTypeIncludedInComposer()) {
			return false;
		}
		$cp = new Permissions($entry);
		if (!$cp->canWrite()) {
			return false;
		}			
		return true;
	}
开发者ID:rii-J,项目名称:concrete5-de,代码行数:14,代码来源:composer_page.php

示例2: checkSSL

 public function checkSSL()
 {
     if ($this->requireSSL == 1) {
         global $c;
         $cp = new Permissions($c);
         if (isset($cp)) {
             if (!$cp->canWrite() && !$cp->canAddSubContent() && !$cp->canAdminPage() && !$cp->canApproveCollection()) {
                 if ($_SERVER['HTTPS'] != "on") {
                     $redirect = "https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
                     header("Location:{$redirect}");
                 }
             }
         }
     }
 }
开发者ID:sixeightmedia,项目名称:formify,代码行数:15,代码来源:controller.php

示例3: on_page_view

 public function on_page_view()
 {
     //Include js and css for image cropper IF user is logged in and has editing capabilities
     // (don't just check for edit mode because user could be in the file manager
     //  via the dashboard OR the front-end sans edit mode [if they have file manager toolbar button enabled]).
     $u = new User();
     $cp = new Permissions(Page::getCurrentPage());
     if ($u->isLoggedIn() && $cp->canWrite()) {
         $html = Loader::helper('html');
         $view = View::getInstance();
         $view->addHeaderItem($html->css(BASE_URL . DIR_REL . '/packages/image_cropper/css/jquery.Jcrop.css'), 'CONTROLLER');
         $view->addHeaderItem($html->css(BASE_URL . DIR_REL . '/packages/image_cropper/css/image_cropper.css'), 'CONTROLLER');
         $view->addHeaderItem($html->javascript(BASE_URL . DIR_REL . '/packages/image_cropper/js/ccm.filemanager.js'), 'CONTROLLER');
         //Note that we passed the 'CONTROLLER' namespace to addHeaderItem() so that it adds our items AFTER the core items
         //TODO: MAKE $.getScript() WORK FROM elements/files/edit/image.php SO WE DON'T HAVE TO LOAD THESE ON EVERY PAGE!
         $view->addHeaderItem($html->javascript(BASE_URL . DIR_REL . '/packages/image_cropper/js/jquery.Jcrop.js'), 'CONTROLLER');
         $view->addHeaderItem($html->javascript(BASE_URL . DIR_REL . '/packages/image_cropper/js/image_editor.js'), 'CONTROLLER');
         $view->addHeaderItem($html->javascript(BASE_URL . DIR_REL . '/packages/image_cropper/js/ui.js'), 'CONTROLLER');
     }
 }
开发者ID:netconstructor,项目名称:c5_image_cropper,代码行数:20,代码来源:controller.php

示例4: Permissions

 ## Get a permissions object for this particular collection.
 $cp = new Permissions($c);
 ## Now that we have a collections and permissions object, we check to make sure
 ## everything is okay with collections and permissions
 if ($cp->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 ($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();
开发者ID:nbourguig,项目名称:concrete5,代码行数:31,代码来源:dispatcher.php

示例5: header

                }
                if ($pcID && $_REQUEST['sbURL']) {
                    header('Location: ' . BASE_URL . $_GET['sbURL']);
                    exit;
                }
                //global scrapbooks
            } elseif ($_REQUEST['bID'] > 0 && $_REQUEST['arHandle']) {
                $bID = intval($_REQUEST['bID']);
                $scrapbookHelper = Loader::helper('concrete/scrapbook');
                $globalScrapbookC = $scrapbookHelper->getGlobalScrapbookPage();
                $globalScrapbookA = Area::get($globalScrapbookC, $_REQUEST['arHandle']);
                $block = Block::getById($bID, $globalScrapbookC, $globalScrapbookA);
                if ($block) {
                    //&& $block->getAreaHandle()=='Global Scrapbook'
                    $bp = new Permissions($block);
                    if (!$bp->canWrite()) {
                        throw new Exception(t('Access to block denied'));
                    } else {
                        $block->delete(1);
                    }
                }
            }
            die;
            break;
    }
}
if ($_REQUEST['processBlock'] && $valt->validate()) {
    // some admin (or unscrupulous person) is doing something to a block of content on the site
    $edit = $_REQUEST['enterViewMode'] ? "" : "&mode=edit";
    if ($_POST['update']) {
        // the person is attempting to update some block of content
开发者ID:VonUniGE,项目名称:concrete5-1,代码行数:31,代码来源:process.php

示例6: array

    $c = $scrapbookHelper->getGlobalScrapbookPage();
    $db = Loader::db();
    $arHandle = $db->getOne('SELECT arHandle FROM CollectionVersionBlocks WHERE bID=? AND cID=? AND isOriginal=1', array(intval($_REQUEST['bID']), intval($c->getCollectionId())));
    $a = Area::get($c, $arHandle);
    $b = Block::getByID(intval($_REQUEST['bID']), $c, $a);
    //redirect cID
    $rcID = intval($_REQUEST['cID']);
    $isGlobal = 1;
    $rarHandle = $_REQUEST['arHandle'];
} else {
    $c = Page::getByID($_REQUEST['cID']);
    $a = Area::get($c, $_REQUEST['arHandle']);
    $b = Block::getByID($_REQUEST['bID'], $c, $a);
}
$bp = new Permissions($b);
if (!$bp->canWrite()) {
    die(t("Access Denied."));
}
if ($_REQUEST['btask'] != 'view' && $_REQUEST['btask'] != 'view_edit_mode') {
    include DIR_FILES_ELEMENTS_CORE . '/dialog_header.php';
}
$bv = new BlockView();
if (($isGlobal || $c->isMasterCollection()) && !in_array($_REQUEST['btask'], array('child_pages', 'composer', 'view_edit_mode'))) {
    echo '<div class="ccm-notification">';
    echo t('This is a global block.  Editing it here will change all instances of this block throughout the site.');
    //echo t('This is a global block.  Edit it from the <a href="%s">Global Scrapbook</a> in your dashboard.<br /><br /><br />', View::url('/dashboard/scrapbook/') );
    //echo '[<a class="ccm-dialog-close">'.t('Close Window').'</a>]';
    echo '</div>';
}
if ($b->isAliasOfMasterCollection() && $_REQUEST['btask'] != 'view_edit_mode') {
    echo '<div class="ccm-notification">';
开发者ID:VonUniGE,项目名称:concrete5-1,代码行数:31,代码来源:edit_block_popup.php

示例7: die

<?php 
defined('C5_EXECUTE') or die("Access Denied.");

$u = new User();
$form = Loader::helper('form');


$f = File::getByID($_REQUEST['fID']);
$fp = new Permissions($f);
if (!$fp->canRead()) {
	die(t("Access Denied."));
}

$fv = $f->getApprovedVersion();

$canViewInline = $fv->canView() ? 1 : 0;
$canEdit = $fv->canEdit() ? 1 : 0;
?>

<div class="ccm-file-selected" fID="<?php echo $_REQUEST['fID']?>" ccm-file-manager-field="<?php echo $_REQUEST['ccm_file_selected_field']?>" ccm-file-manager-can-admin="<?php echo ($fp->canAdmin())?>" ccm-file-manager-can-delete="<?php echo $fp->canAdmin()?>" ccm-file-manager-can-view="<?php echo $canViewInline?>" ccm-file-manager-can-replace="<?php echo $fp->canWrite()?>" ccm-file-manager-can-edit="<?php echo $canEdit?>"  >
<div class="ccm-file-selected-thumbnail"><?php echo $fv->getThumbnail(1)?></div>
<div class="ccm-file-selected-data"><div><?php echo $fv->getTitle()?></div><div></div></div>
<div class="ccm-spacer">&nbsp;</div>
</div>
开发者ID:rii-J,项目名称:concrete5-de,代码行数:24,代码来源:selector_data.php

示例8: t

			foreach($slist as $ak) { ?>
				<th class="<?php echo $pageList->getSearchResultsClass($ak)?>"><a href="<?php echo $pageList->getSortByURL($ak, 'asc', $bu, $soargs)?>"><?php echo $ak->getAttributeKeyDisplayHandle()?></a></th>
			<?php  } ?>			
			<th class="ccm-search-add-column-header"><a href="<?php echo REL_DIR_FILES_TOOLS_REQUIRED?>/pages/customize_search_columns?searchInstance=<?php echo $searchInstance?>" id="ccm-search-add-column"><img src="<?php echo ASSETS_URL_IMAGES?>/icons/add.png" width="16" height="16" alt="<?php  echo t('Add')?>"/></a></th>
		</tr>
	<?php 
		foreach($pages as $cobj) {
			$cpobj = new Permissions($cobj); 
			if (!isset($striped) || $striped == 'ccm-list-record-alt') {
				$striped = '';
			} else if ($striped == '') { 
				$striped = 'ccm-list-record-alt';
			}

			?>
			<tr class="ccm-list-record <?php echo $striped?>" cName="<?php echo htmlentities($cobj->getCollectionName(), ENT_QUOTES, APP_CHARSET)?>" cID="<?php echo $cobj->getCollectionID()?>" sitemap-select-callback="<?php echo $sitemap_select_callback?>" sitemap-select-mode="<?php echo $sitemap_select_mode?>" sitemap-display-mode="search" canWrite="<?php echo $cpobj->canWrite()?>" cNumChildren="<?php echo $cobj->getNumChildren()?>" cAlias="false">
			<?php  if (!$searchDialog) { ?><td class="ccm-<?php echo $searchInstance?>-list-cb" style="vertical-align: middle !important"><input type="checkbox" value="<?php echo $cobj->getCollectionID()?>" /></td><?php  } ?>
			<td><?php echo $cobj->getCollectionTypeName()?></td>
			<td class="ccm-page-list-name"><div style="max-width: 150px; word-wrap: break-word"><?php echo $txt->highlightSearch($cobj->getCollectionName(), $keywords)?></div></td>
			<td><?php echo date(DATE_APP_DASHBOARD_SEARCH_RESULTS_PAGES, strtotime($cobj->getCollectionDatePublic()))?></td>
			<td><?php echo date(DATE_APP_DASHBOARD_SEARCH_RESULTS_PAGES, strtotime($cobj->getCollectionDateLastModified()))?></td>
			<td><?php 
				$ui = UserInfo::getByID($cobj->getCollectionUserID());
				if (is_object($ui)) {
					print $ui->getUserName();
				}
			?></td>
			<?php  if ($pageList->isIndexedSearch()) { ?>
				<td><?php echo $cobj->getPageIndexScore()?></td>
			<?php  } ?>
			
开发者ID:rii-J,项目名称:concrete5-de,代码行数:30,代码来源:search_results.php

示例9: display

	function display(&$c, $alternateBlockArray = null) {

		if(!intval($c->cID)){
			//Invalid Collection
			return false;
		}
		
		$currentPage = Page::getCurrentPage();
		$ourArea = Area::getOrCreate($c, $this->arHandle);
		if (count($this->customTemplateArray) > 0) {
			$ourArea->customTemplateArray = $this->customTemplateArray;
		}
		if (count($this->attributes) > 0) {
			$ourArea->attributes = $this->attributes;
		}
		if ($this->maximumBlocks > -1) {
			$ourArea->maximumBlocks = $this->maximumBlocks;
		}
		$ap = new Permissions($ourArea);
		$blocksToDisplay = ($alternateBlockArray) ? $alternateBlockArray : $ourArea->getAreaBlocksArray($c, $ap);
		$this->totalBlocks = $ourArea->getTotalBlocksInArea();
		$u = new User();
		
		$bv = new BlockView();
		
		// now, we iterate through these block groups (which are actually arrays of block objects), and display them on the page
		
		if (($this->showControls) && ($c->isEditMode() && ($ap->canAddBlocks() || $u->isSuperUser()))) {
			$bv->renderElement('block_area_header', array('a' => $ourArea));	
		}

		$bv->renderElement('block_area_header_view', array('a' => $ourArea));	

		//display layouts tied to this area 
		//Might need to move this to a better position  
		$areaLayouts = $this->getAreaLayouts($c);
		if(is_array($areaLayouts) && count($areaLayouts)){ 
			foreach($areaLayouts as $layout){
				$layout->display($c,$this);  
			}
			if($this->showControls && ($c->isArrangeMode() || $c->isEditMode())) {
				echo '<div class="ccm-layouts-block-arrange-placeholder ccm-block-arrange"></div>';
			}
		}


		foreach ($blocksToDisplay as $b) {
			$bv = new BlockView();
			$bv->setAreaObject($ourArea); 
			
			// this is useful for rendering areas from one page
			// onto the next and including interactive elements
			if ($currentPage->getCollectionID() != $c->getCollectionID()) {
				$b->setBlockActionCollectionID($c->getCollectionID());
			}
			$p = new Permissions($b);
			if (($p->canWrite() || $p->canDeleteBlock()) && $c->isEditMode() && $this->showControls) {
				$includeEditStrip = true;
			}

			if ($p->canRead()) {
				if (!$c->isEditMode()) {
					echo $this->enclosingStart;
				}
				if ($includeEditStrip) {
					$bv->renderElement('block_controls', array(
						'a' => $ourArea,
						'b' => $b,
						'p' => $p
					));
					$bv->renderElement('block_header', array(
						'a' => $ourArea,
						'b' => $b,
						'p' => $p
					));
				}

				$bv->render($b);
				if ($includeEditStrip) {
					$bv->renderElement('block_footer');
				}
				if (!$c->isEditMode()) {
					echo $this->enclosingEnd;
				}
			}
		}

		$bv->renderElement('block_area_footer_view', array('a' => $ourArea));	

		if (($this->showControls) && ($c->isEditMode() && ($ap->canAddBlocks() || $u->isSuperUser()))) {
			$bv->renderElement('block_area_footer', array('a' => $ourArea));	
		}
	}
开发者ID:remkoj,项目名称:concrete5,代码行数:93,代码来源:area.php

示例10:

echo $_REQUEST['fID'];
?>
" ccm-file-manager-field="<?php 
echo $_REQUEST['ccm_file_selected_field'];
?>
" ccm-file-manager-can-admin="<?php 
echo $fp->canAdmin();
?>
" ccm-file-manager-can-delete="<?php 
echo $fp->canAdmin();
?>
" ccm-file-manager-can-view="<?php 
echo $canViewInline;
?>
" ccm-file-manager-can-replace="<?php 
echo $fp->canWrite();
?>
" ccm-file-manager-can-edit="<?php 
echo $canEdit;
?>
"  >
<div class="ccm-file-selected-thumbnail"><?php 
echo $fv->getThumbnail(1);
?>
</div>
<div class="ccm-file-selected-data"><div><?php 
echo $fv->getTitle();
?>
</div><div></div></div>
<div class="ccm-spacer">&nbsp;</div>
</div>
开发者ID:nbourguig,项目名称:concrete5,代码行数:31,代码来源:selector_data.php

示例11: if

				<?php  } ?>
			<?php  } ?>
			<th class="ccm-search-add-column-header"><?php  if ($_REQUEST['fssID'] < 1) { ?><a href="<?php echo REL_DIR_FILES_TOOLS_REQUIRED?>/files/customize_search_columns?searchInstance=<?php echo $searchInstance?>" id="ccm-search-add-column"><img src="<?php echo ASSETS_URL_IMAGES?>/icons/column_preferences.png" width="16" height="16" /></a><?php  } ?></th>
		</tr>
	<?php 
		foreach($files as $f) {
			$pf = new Permissions($f);
			if (!isset($striped) || $striped == 'ccm-list-record-alt') {
				$striped = '';
			} else if ($striped == '') { 
				$striped = 'ccm-list-record-alt';
			}
			$star_icon = ($f->isStarred() == 1) ? 'star_yellow.png' : 'star_grey.png';
			$fv = $f->getApprovedVersion(); 
			$canViewInline = $fv->canView() ? 1 : 0;
			$canEdit = ($fv->canEdit() && $pf->canWrite()) ? 1 : 0;
			$pfg = FilePermissions::getGlobal();
			?>
			<tr class="ccm-list-record <?php echo $striped?>" ccm-file-manager-instance="<?php echo $searchInstance?>" ccm-file-manager-can-admin="<?php echo ($pf->canAdmin())?>" ccm-file-manager-can-duplicate="<?php echo ($pfg->canAddFileType($f->getExtension()) && $pf->canWrite())?>" ccm-file-manager-can-delete="<?php echo $pf->canAdmin()?>" ccm-file-manager-can-view="<?php echo $canViewInline?>" ccm-file-manager-can-replace="<?php echo $pf->canWrite()?>" ccm-file-manager-can-edit="<?php echo $canEdit?>" fID="<?php echo $f->getFileID()?>" id="fID<?php echo $f->getFileID()?>">
			<td class="ccm-file-list-cb" style="vertical-align: middle !important"><input type="checkbox" value="<?php echo $f->getFileID()?>" /></td>
			<td>
				<div class="ccm-file-list-thumbnail">
					<div class="ccm-file-list-thumbnail-image" fID="<?php echo $f->getFileID()?>"><table border="0" cellspacing="0" cellpadding="0" height="70" width="100%"><tr><td align="center" fID="<?php echo $f->getFileID()?>" style="padding: 0px"><?php echo $fv->getThumbnail(1)?></td></tr></table></div>
				</div>
		
			<?php  if ($fv->hasThumbnail(2)) { ?>
				<div class="ccm-file-list-thumbnail-hover" id="fID<?php echo $f->getFileID()?>hoverThumbnail"><div><?php echo $fv->getThumbnail(2)?></div></div>
			<?php  } ?>

				</td>
			<td class="ccm-file-list-starred"><img src="<?php echo ASSETS_URL_IMAGES?>/icons/<?php echo $star_icon?>" height="16" width="16" border="0" class="ccm-star" /></td>
开发者ID:rii-J,项目名称:concrete5-de,代码行数:31,代码来源:search_results.php

示例12: array

	$db = Loader::db();
	$arHandle=$db->getOne('SELECT arHandle FROM CollectionVersionBlocks WHERE bID=? AND cID=? AND isOriginal=1', array(intval($_REQUEST['bID']),intval($c->getCollectionId()))); 
	$a = Area::get( $c, $arHandle);				
	$b=Block::getByID( intval($_REQUEST['bID']), $c, $a);
	//redirect cID
	$rcID = intval($_REQUEST['cID']);
	$isGlobal=1;
	$rarHandle = $_REQUEST['arHandle'];
}else{
	$c = Page::getByID($_REQUEST['cID']);
	$a = Area::get($c, $_REQUEST['arHandle']);
	$b = Block::getByID($_REQUEST['bID'], $c, $a);
}

$bp = new Permissions($b);
if (!$bp->canWrite()) {
	die(t("Access Denied."));
} 

if ($_REQUEST['btask'] != 'view' && $_REQUEST['btask'] != 'view_edit_mode') { 
	include(DIR_FILES_ELEMENTS_CORE . '/dialog_header.php');
}

$bv = new BlockView(); 
			
if(($isGlobal || $c->isMasterCollection()) && (!in_array($_REQUEST['btask'], array('child_pages','composer','view_edit_mode')))) {
	echo '<div class="ccm-notification">';
	echo t('This is a global block.  Editing it here will change all instances of this block throughout the site.');
	//echo t('This is a global block.  Edit it from the <a href="%s">Global Scrapbook</a> in your dashboard.<br /><br /><br />', View::url('/dashboard/scrapbook/') );
	//echo '[<a class="ccm-dialog-close">'.t('Close Window').'</a>]';
	echo '</div>';							
开发者ID:notzen,项目名称:concrete5,代码行数:31,代码来源:edit_block_popup.php

示例13: array

$args = array('c'=>$c, 'a' => $a, 'cp' => $cp, 'ap' => $ap, 'token' => $token);

switch($_GET['atask']) {
	case 'add':
		$toolSection = "block_area_add_new";
		$canViewPane = $ap->canAddBlocks();
		break;
	case 'paste':
		$toolSection = "block_area_add_scrapbook";
		$canViewPane = $ap->canAddBlocks();
		break;
	case 'layout':
		$originalLayoutId = (intval($_REQUEST['originalLayoutID'])) ? intval($_REQUEST['originalLayoutID']) : intval($_REQUEST['layoutID']);
		$args['refreshAction'] = REL_DIR_FILES_TOOLS_REQUIRED . '/edit_area_popup?atask=layout&cID=' . $c->getCollectionID() . '&arHandle=' . $a->getAreaHandle() . '&refresh=1&originalLayoutID='.$originalLayoutId.'&cvalID='.$_REQUEST['cvalID'];
		$toolSection = "block_area_layout";
		$canViewPane = $ap->canWrite();
		$args['action'] = $a->getAreaUpdateAction('layout').'&originalLayoutID='.$originalLayoutId.'&cvalID='.intval($_REQUEST['cvalID']);
		break;
	case 'design':
		$toolSection = 'custom_style';
		$args['style'] = $c->getAreaCustomStyleRule($a);
		$args['action'] = $a->getAreaUpdateAction('design');
		$args['refreshAction'] = REL_DIR_FILES_TOOLS_REQUIRED . '/edit_area_popup?atask=design&cID=' . $c->getCollectionID() . '&arHandle=' . $a->getAreaHandle() . '&refresh=1';
		$canViewPane = $ap->canWrite();
		if ($canViewPane) {
			if ($_REQUEST['subtask'] == 'delete_custom_style_preset') {
				$styleToDelete = CustomStylePreset::getByID($_REQUEST['deleteCspID']);
				$styleToDelete->delete(); 
			}
		}		
		break;
开发者ID:rii-J,项目名称:concrete5-de,代码行数:31,代码来源:edit_area_popup.php

示例14: Minisurvey

$miniSurvey= new Minisurvey();

//Permissions Check
if($_GET['cID'] && $_GET['arHandle']){
	$c = Page::getByID($_GET['cID'], 'RECENT');
	$a = Area::get($c, $_GET['arHandle']);  
	if(intval($_GET['bID'])==0){ 
		//add survey mode
		$ap = new Permissions($a);	
		$bt = BlockType::getByID($_GET['btID']);	
		if(!$ap->canAddBlock($bt)) $badPermissions=true;
	}else{
		//edit survey mode
		$b = Block::getByID($_GET['bID'], $c, $a);
		$bp = new Permissions($b);
		if( !$bp->canWrite() ) $badPermissions=true;
	}
}else $badPermissions=true;
if($badPermissions){
	echo t('Invalid Permissions');
	die;
} 


switch ($_GET['mode']){

	case 'addQuestion':
		$miniSurvey->addEditQuestion($_POST);
		break;
		
	case 'getQuestion':
开发者ID:rii-J,项目名称:concrete5-de,代码行数:31,代码来源:services.php

示例15: outputRequestHTML

	public function outputRequestHTML($instanceID, $display_mode, $select_mode, $req) {
		$nodeID = $req->nodeID;
		$spID = ($this->selectedPageID > 0) ? $this->selectedPageID : 'false';
		$c = Page::getByID($req->nodeID, 'ACTIVE');
		if ($display_mode == 'explore') {
			$nav = Loader::helper('navigation');
			$trail = $nav->getTrailToCollection($c);
			$trail = array_reverse($trail);
			$this->html .= '<div id="ccm-sitemap-bc"><ul>';
			foreach($trail as $t) {
				if ($select_mode == '') {
					$this->html .= '<li><a href="' . View::url('/dashboard/sitemap/explore', $t->getCollectionID()) . '"><span>' . $t->getCollectionName() . '</span></a></li>';
				} else {
					$this->html .= '<li><a href="javascript:void(0)" onclick="ccmSitemapExploreNode(\'' . $instanceID . '\', \''. $display_mode . '\', \'' . $select_mode . '\',' . $t->getCollectionID() . ',' . $spID . ')">' . $t->getCollectionName() . '</a></li>';
				}
			}
			$cp = new Permissions($c);
			$this->html .= '<li class="ccm-sitemap-current-level-title">';
			$this->html .= '<div sitemap-display-mode="' . $display_mode . '" sitemap-select-mode="' . $select_mode . '" sitemap-instance-id="' . $instanceID . '" class="tree-label" rel="' . DIR_REL . '/' . DISPATCHER_FILENAME . '?cID=' . $c->getCollectionID() . '" tree-node-alias="0" ';
			$this->html .= 'selected-page-id="' . $this->selectedPageID . '" tree-node-canwrite="' . $cp->canWrite() . '" tree-node-children="' . $c->getNumChildren() . '" ';
			$this->html .= 'tree-node-title="' . htmlspecialchars($c->getCollectionName()) . '" id="tree-label' . $c->getCollectionID() . '">';
			$this->html .= '<span>' . $c->getCollectionName() . '</span></div></li>';
			$this->html .= '</ul></div>';
		}
		if ($display_mode == 'full' || $display_mode == '') {
			$this->html .= '<div class="dropzone tree-dz' . $nodeID . '" tree-parent="' . $nodeID . '" id="tree-dz' . $nodeID . '-sub"></div>';
		}
		$moveableClass = '';
		for ($i = 0; $i < count($req->results); $i++) {
			$ri = $req->results[$i];
			$typeClass = 'tree-node-document';
			$treeNodeType = 'document';
			$labelClass = "tree-label";
			if ($ri['numSubpages'] > 0) {
				$treeNodeType = 'folder';
				if ($display_mode == 'full' || $display_mode == '') {
					$typeClass = 'tree-node-folder';
				} else {
					$typeClass = 'tree-node-folder-explore';
				}
			}
			$customIconSrc = "";
			if ($ri['cIcon']) {
				$customIconSrc = ' style="background-image: url(' . $ri['cIcon'] . ')"';
			}
			$cAlias = $ri['cAlias'];
			$canWrite = $ri['canWrite'];
			$canDrag = ($ri['id'] > 1) ? "true" : "false";
			$this->html .= '<li tree-node-cancompose="' . $ri['canCompose'] . '" tree-node-type="' . $treeNodeType . '" draggable="' . $canDrag . '" class="tree-node ' . $typeClass . ' tree-branch' . $nodeID . '" id="tree-node' . $ri['id'] . '"' . $customIconSrc . '>';
			
			if ($ri['numSubpages'] > 0) {
				$subPageStr = ($ri['id'] == 1) ? '' : ' (' . $ri['numSubpages'] . ')';
				if ($display_mode == 'explore') {
					$this->html .= ($select_mode == 'move_copy_delete' || $select_mode == 'select_page') ? '<a href="javascript:void(0)" onclick="ccmSitemapExploreNode(\'' . $instanceID . '\', \'' . $display_mode . '\', \'' . $select_mode . '\', ' . $ri["id"] . ',' . $spID . ')">' : '<a href="' . View::url('/dashboard/sitemap/explore', $ri['id']) . '">' ;
				}
				$this->html .= '<img src="' . ASSETS_URL_IMAGES . '/spacer.gif" width="16" height="16" class="handle ' . $moveableClass . '" />';
				if ($display_mode == 'explore' || $select_mode == 'move_copy_delete' || $select_mode == 'select_page') {
					$this->html .= '</a>';
				}
				if ($display_mode == 'full' || $display_mode == '') {
					$this->html .= '<a href="javascript:toggleSub(\'' . $instanceID . '\',\'' . $ri['id'] . '\',\'' . $display_mode . '\',\'' . $select_mode . '\')">';
					$this->html .= '<img src="' . ASSETS_URL_IMAGES . '/dashboard/plus.jpg" width="9" height="9" class="tree-plus" id="tree-collapse' . $ri['id'] . '" /></a>';
				}
				$this->html .= '<div rel="' . DIR_REL . '/' . DISPATCHER_FILENAME . '?cID=' . $ri['id'] . '" class="' . $labelClass . '" tree-node-alias="' . $cAlias . '" ';
				$this->html .= 'selected-page-id="' . $this->selectedPageID . '" tree-node-cancompose="' . $ri['canCompose'] . '" sitemap-display-mode="' . $display_mode . '" sitemap-select-mode="' . $select_mode . '" sitemap-instance-id="' . $instanceID . '" tree-node-canwrite="' . $canWrite . '" tree-node-children="' . $ri['numSubpages'] . '" ';
				$this->html .= 'tree-node-title="' . htmlspecialchars($ri['cvName']) . '" id="tree-label' . $ri['id'] . '" ';
				if ($ri['selected']) {
					$this->html .= 'class="tree-label-selected-onload" ';
				}
				$this->html .= '>';
				$this->html .= '<span>' . $ri['cvName'] . $subPageStr . '</span>';
				/*
				if ($display_mode == 'full' || $display_mode == '') {
					$this->html .= '<a class="ccm-tree-search-trigger" href="javascript:void(0)" onclick="searchSubPages(' . $ri['id'] . ')">';
					$this->html .= '<img src="' . ASSETS_URL_IMAGES . '/icons/magnifying.png" /></a>';
				}
				*/
				$this->html .= '</div>';
				if ($display_mode == 'full' || $display_mode == '') {
					/*
					$this->html .= '<form onsubmit="return searchSitemapNode(' . $ri['id'] . ')" id="ccm-tree-search' . $ri['id'] . '" class="ccm-tree-search">';
					$this->html .= '<a href="javascript:void(0)" onclick="closeSub(' . $ri['id'] . ')" class="ccm-tree-search-close"><img src="' . ASSETS_URL_IMAGES . '/icons/close.png" /></a>';
					$this->html .= '<input type="text" name="submit" name="q" /> <a href="javascript:void(0)" onclick="searchSitemapNode(' . $ri['id'] . ')">';
					$this->html .= '<img src="' . ASSETS_URL_IMAGES . '/icons/magnifying.png" /></a></form>';
					*/
					// we HAVE to add another <LI> because of jQuery UI's weird drag and drop behavior on Windows
					if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') > -1) {
						$this->html .= '<li>';
					}
					$this->html .= '<ul tree-root-state="closed" tree-root-node-id="' . $ri['id'] . '" tree-root-num-subpages="' . $ri['numSubpages'] . '" id="tree-root' . $ri['id'] . '" selected-page-id="' . $this->selectedPageID . '" sitemap-instance-id="' . $instanceID . '" sitemap-display-mode="' . $display_mode . '" sitemap-select-mode="' . $select_mode . '">';
					if (is_object($ri['subnodes']) && count($ri['subnodes']->results) > 0) {
						$this->outputRequestHTML($instanceID, $display_mode, $select_mode, $ri['subnodes']);
					}
					$this->html .= '</ul>';
				}
			} else {
				$this->html .= '<div tree-node-title="' . htmlspecialchars($ri['cvName']) . '" tree-node-children="' . $ri['numSubpages'] . '" ';
				$this->html .= 'class="' . $labelClass . '" tree-node-cancompose="' . $ri['canCompose'] . '" tree-node-alias="' . $cAlias . '" tree-node-canwrite="' . $canWrite . '" ';
				$this->html .= 'selected-page-id="' . $this->selectedPageID . '" sitemap-display-mode="' . $display_mode . '" sitemap-select-mode="' . $select_mode . '" sitemap-instance-id="' . $instanceID . '" id="tree-label' . $ri['id'] . '" rel="' . DIR_REL . '/' . DISPATCHER_FILENAME . '?cID=' . $ri['id'] . '">';
				$this->html .= '<img src="' . ASSETS_URL_IMAGES . '/spacer.gif" width="16" height="16" class="handle ' . $moveableClass . '" /><span>' . $ri['cvName'] . '</span></div>';
//.........这里部分代码省略.........
开发者ID:remkoj,项目名称:concrete5,代码行数:101,代码来源:sitemap.php


注:本文中的Permissions::canWrite方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。