Example #1
0
 /**
  * Our own version of the alfresco session getNode where it actually
  * gets the node instead of just querying a cache. 
  *
  * @param string $id
  */
 public function getNode($id)
 {
     if (!$this->getConnection()) {
         return null;
     }
     $node = $this->alfresco->getNode($this->spacesStore, $id);
     /* @var $node Node */
     if ($node) {
         return $node;
     }
     $nodes = $this->alfresco->query($this->spacesStore, '@sys:node-uuid:"' . $id . '"');
     return isset($nodes[0]) ? $nodes[0] : null;
 }
Example #2
0
/*
 * This example shows how queries can be executed in an iterative manner.
 * Iterative evaluation will be slower, as more server requests are performed.
 *
 * Documentation: http://docs.basex.org/wiki/Clients
 *
 * (C) BaseX Team 2005-12, BSD License
 */
include "BaseXClient.php";
try {
    // create session
    $session = new Session("localhost", 1984, "admin", "admin");
    try {
        // create query instance
        $input = 'for $i in 1 to 10 return <xml>Text { $i }</xml>';
        $query = $session->query($input);
        // loop through all results
        while ($query->more()) {
            print $query->next() . "\n";
        }
        // close query instance
        $query->close();
    } catch (Exception $e) {
        // print exception
        print $e->getMessage();
    }
    // close session
    $session->close();
} catch (Exception $e) {
    // print exception
    print $e->getMessage();
Example #3
0
 *
 * (C) BaseX Team 2005-11, ISC License
 */
include "BaseXClient.php";
// commands to be performed
$cmd = 'for $node in doc("factbook")//country order by xs:int($node/@population) return data($node/@name)';
$cmd2 = 'for $node in doc("factbook")//country order by xs:int($node/@population) return data($node/@population)';
try {
    // create session
    $session = new Session("localhost", 1984, "admin", "admin");
    echo "<table border='0' cellspacing='2' cellpadding='4' width='20%'>\r\n  <tbody><tr style='text-align:center;'><tbody><tr style='text-align:center;'>";
    echo "<td style='text-align:center;background-color:#D7D7D7;border:#ffffff 1px solid;font-size:12pt;'></td>";
    echo "<td style='text-align:center;background-color:#D7D7D7;border:#ffffff 1px solid;font-size:12pt;'>Country</td>";
    echo "<td style='text-align:center;background-color:#D7D7D7;border:#ffffff 1px solid;font-size:12pt;'>Population</td>";
    try {
        $query = $session->query($cmd);
        print $query->init();
        $query2 = $session->query($cmd2);
        print $query2->init();
        $count = 0;
        while ($query->more()) {
            $next = $query->next();
            $query2->more();
            $next2 = $query2->next();
            $count += 1;
            if ($count % 2) {
                echo "<tr style='text-align:center;'>\r\n      <td style='text-align:center;'>{$count}</td><td style='text-align:center;'>{$next}</td>\r\n        <td style='text-align:center;'>{$next2}</td></tr>";
            } else {
                echo "<tr style='text-align:center; background-color:#eeeeee;'>\r\n      <td style='text-align:center;'>{$count}</td><td style='text-align:center;'>{$next}</td>\r\n        <td style='text-align:center;'>{$next2}</td></tr>";
            }
        }