當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Repository::createSession方法代碼示例

本文整理匯總了PHP中Repository::createSession方法的典型用法代碼示例。如果您正苦於以下問題:PHP Repository::createSession方法的具體用法?PHP Repository::createSession怎麽用?PHP Repository::createSession使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Repository的用法示例。


在下文中一共展示了Repository::createSession方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testCreateSession

 public function testCreateSession()
 {
     $repository = new Repository();
     $ticket = $repository->authenticate("admin", "admin");
     $session = $repository->createSession($ticket);
     $this->assertNotNull($session);
     $this->assertEquals("http://localhost:8080/alfresco/api", $session->repository->connectionUrl);
     $this->assertEquals($ticket, $session->ticket);
     // TODO for now if no ticket is provided a null session is returned
     $session2 = $repository->createSession();
     $this->assertNull($session2);
 }
開發者ID:negabaro,項目名稱:alfresco,代碼行數:12,代碼來源:RepositoryTest.php

示例2: display

 function display($tpl = null)
 {
     // Get the url of the Alfresco repository from the Joosco plugin
     // That's why the Joosco plugin needs to be installed and configured before the component
     $plugin =& JPluginHelper::getPlugin('authentication', 'joosco');
     $pluginParams = new JParameter($plugin->params);
     // Here we connect to the Repository
     $repositoryUrl = $pluginParams->get('alf-url');
     $repository = new Repository($repositoryUrl);
     // The ticket is created by the plugin when a user connects
     $ticket = $_SESSION["ticket"];
     $session = $repository->createSession($ticket);
     $store = new SpacesStore($session);
     $currentNode = null;
     $uuid = null;
     $uuid =& JRequest::getVar('uuid');
     if (!isset($uuid)) {
         $currentNode = $store->companyHome;
         $path = 'Company Home';
     } else {
         $currentNode = $session->getNode($store, JRequest::getVar('uuid'));
         $path = JRequest::getVar('path') . '|' . JRequest::getVar('uuid') . '|' . JRequest::getVar('name');
     }
     // Pass the values to the rest of the template
     $this->assignRef('path', $path);
     $this->assignRef('session', $session);
     $this->assignRef('store', $store);
     $this->assignRef('currentNode', $currentNode);
     $this->assignRef('option', JRequest::getVar('option'));
     $this->assignRef('view', JRequest::getVar('view'));
     $this->assignRef('itemid', JRequest::getVar('Itemid'));
     parent::display($tpl);
 }
開發者ID:fintanmm,項目名稱:joosco,代碼行數:33,代碼來源:view.html.php

示例3: getConnection

 protected function getConnection()
 {
     if ($this->alfresco == null) {
         if (!empty($this->alfrescoUrl)) {
             $repository = new Repository($this->alfrescoUrl);
             try {
                 $ticket = $repository->authenticate($this->alfrescoUser, $this->alfrescoPass);
             } catch (Exception $e) {
                 za()->log()->err("Failed authenticating to Alfresco");
                 return;
             }
             $this->alfresco = $repository->createSession($ticket);
             $this->spacesStore = new SpacesStore($this->alfresco);
         }
     }
     return $this->alfresco;
 }
開發者ID:nyeholt,項目名稱:relapse,代碼行數:17,代碼來源:AlfrescoFileService.php

示例4: Repository

 * Note: any changes to this file should be uploaded to the wiki
 */
// Include the required Alfresco PHP API objects
if (isset($_SERVER["ALF_AVAILABLE"]) == false) {
    require_once "Alfresco/Service/Repository.php";
    require_once "Alfresco/Service/Session.php";
    require_once "Alfresco/Service/SpacesStore.php";
}
// Specify the connection details
$repositoryUrl = "http://localhost:8080/alfresco/api";
$userName = "admin";
$password = "admin";
// Authenticate the user and create a session
$repository = new Repository($repositoryUrl);
$ticket = $repository->authenticate($userName, $password);
$session = $repository->createSession($ticket);
// Create a reference to the 'SpacesStore'
$spacesStore = new SpacesStore($session);
// Use a serach to get the content node we are updating
$nodes = $session->query($spacesStore, "PATH:\"app:company_home/app:guest_home/cm:Alfresco-Tutorial.pdf\"");
$contentNode = $nodes[0];
// Update the property if the form has been posted with the correct details
if (isset($_REQUEST["update"]) == true) {
    // Set the updated title and decription values
    $contentNode->cm_title = $_REQUEST["title"];
    $contentNode->cm_description = $_REQUEST["description"];
    // Save the session.  This ensures that the updates are presisted back to the repository.
    // If this save call is not made the changes made will be lost when the session object is destroyed.
    $session->save();
}
?>
開發者ID:negabaro,項目名稱:alfresco,代碼行數:31,代碼來源:BasicTutorial4-UpdateProperties.php

示例5: header

    // Put the ticket into the session for later use
    $_SESSION["alfTicket"] = $alfTicket;
} else {
    if (isset($_SESSION["alfTicket"]) == true) {
        // Get the ticket out of the session
        $alfTicket = $_SESSION["alfTicket"];
    }
}
// If we don't have a ticket redirect to the login page somehow
if ($alfTicket == null) {
    // Redirect to the login page
    header("Location: " . $loginURL);
    exit;
}
// Create an alfresco session that can be used
$alfSession = $alfRepository->createSession($alfTicket);
// Create a reference to the media wiki node
if ($alfWikiSpaceNodeRef != null) {
    $alfMediaWikiNode = $alfSession->getNodeFromString($alfWikiSpaceNodeRef);
} else {
    // Use the default wiki node
    $nodes = $alfSession->query(new SpacesStore($alfSession), "TYPE:\"mw:mediaWiki\"");
    if (sizeof($nodes) == 0) {
        // Redirect to the login page, since we can't find the mediaWiki space (probably means incorrect permissions)
        header("Location: " . $loginURL);
        exit;
    }
    $alfMediaWikiNode = $nodes[0];
    $alfWikiSpaceNodeRef = $alfMediaWikiNode->__toString();
}
// Validate the ticket (checks you have correct permissions on the wiki space and that the ticket is valid)
開發者ID:negabaro,項目名稱:alfresco,代碼行數:31,代碼來源:Alfresco.php

示例6: Repository

<?php

$repository = new Repository();
$stores = $repository->createSession()->stores;
?>
<html>

<head>
</head>

<body>
	<h1>List of stores</h1>
	<ul>	
<?php 
foreach ($stores as $store) {
    echo "<li>" . $store->scheme . "://" . $store->address . "</li>\n";
}
?>
    
	</ul>

</body>

</html>
開發者ID:negabaro,項目名稱:alfresco,代碼行數:24,代碼來源:storeListTemplate.php


注:本文中的Repository::createSession方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。