Example #1
0
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Contributors:
 *     Pierre-Gildas MILLON <*****@*****.**>
 */
require_once '../vendor/autoload.php';
$documents = null;
$client = new \Nuxeo\Client\Api\NuxeoClient('http://nuxeo:8080/nuxeo', 'Administrator', 'Administrator');
if (!empty($_POST['path'])) {
    $path = $_POST['path'];
    $schema = $_POST['schema'] ?: '*';
    /** @var \Nuxeo\Client\Api\Objects\Documents $documents */
    $documents = $client->schemas($schema)->automation('Document.Query')->param('query', sprintf('SELECT * FROM Document WHERE ecm:path = "%s"', $path))->execute(\Nuxeo\Client\Api\Objects\Documents::className);
}
?>
<!DOCTYPE html>

<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>B1 test php Client</title>
  <!-- Latest compiled and minified CSS -->
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
Example #2
0
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Contributors:
 *     Pierre-Gildas MILLON <*****@*****.**>
 */
require_once '../vendor/autoload.php';
$documents = null;
$client = new \Nuxeo\Client\Api\NuxeoClient('http://nuxeo:8080/nuxeo', 'Administrator', 'Administrator');
$blobTempStorage = __DIR__ . DIRECTORY_SEPARATOR . 'blobs';
if (!@mkdir($blobTempStorage) && !is_dir($blobTempStorage)) {
    throw new \Symfony\Component\HttpFoundation\File\Exception\FileException(sprintf('Could not create %s: ', $blobTempStorage));
}
/** @var \Nuxeo\Client\Api\Objects\Documents $availablePaths */
$availablePaths = $client->automation('Document.Query')->param('query', 'SELECT * FROM Workspace')->execute(\Nuxeo\Client\Api\Objects\Documents::className);
$httpRequest = \Symfony\Component\HttpFoundation\Request::createFromGlobals();
$document = null;
if ($httpRequest->files->has('blob') && $httpRequest->request->has('path')) {
    $path = $httpRequest->get('path');
    $uploadedBlob = $httpRequest->files->get('blob');
    /** @var \Symfony\Component\HttpFoundation\File\UploadedFile $uploadedBlob */
    $blob = $uploadedBlob->move($blobTempStorage, $uploadedBlob->getClientOriginalName());
    try {
        /** @var \Nuxeo\Client\Api\Objects\Document $document */
Example #3
0
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Contributors:
 *     Pierre-Gildas MILLON <*****@*****.**>
 */
require_once '../vendor/autoload.php';
$documents = null;
$client = new \Nuxeo\Client\Api\NuxeoClient('http://nuxeo:8080/nuxeo', 'Administrator', 'Administrator');
if (!empty($_POST['q'])) {
    $query = $_POST['q'];
    /** @var \Nuxeo\Client\Api\Objects\Documents $documents */
    $documents = $client->automation('Document.Query')->param('query', sprintf('SELECT * FROM Document WHERE ecm:fulltext = "%s"', $query))->execute(\Nuxeo\Client\Api\Objects\Documents::className);
}
?>
<!DOCTYPE html>

<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>B2 test php Client</title>
  <!-- Latest compiled and minified CSS -->
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
Example #4
0
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Contributors:
 *     Pierre-Gildas MILLON <*****@*****.**>
 */
require_once '../vendor/autoload.php';
$documents = null;
$client = new \Nuxeo\Client\Api\NuxeoClient('http://nuxeo:8080/nuxeo', 'Administrator', 'Administrator');
if (!empty($_POST['date'])) {
    $date = DateTime::createFromFormat('Y/m/d', $_POST['date']);
    /** @var \Nuxeo\Client\Api\Objects\Documents $documents */
    $documents = $client->automation('Document.Query')->param('query', sprintf('SELECT * FROM Document WHERE dc:created >= DATE "%s"', date_format($date, 'Y-m-d')))->execute(\Nuxeo\Client\Api\Objects\Documents::className);
}
?>
<!DOCTYPE html>

<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>B3 test php Client</title>
    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
Example #5
0
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Contributors:
 *     Pierre-Gildas MILLON <*****@*****.**>
 */
require_once '../vendor/autoload.php';
$client = new \Nuxeo\Client\Api\NuxeoClient('http://nuxeo:8080/nuxeo', 'Administrator', 'Administrator');
if (!empty($_POST['path'])) {
    $path = $_POST['path'];
    try {
        /** @var \Nuxeo\Client\Api\Objects\Blob $blob */
        $blob = $client->automation('Blob.Get')->input('doc:' . $path)->execute(\Nuxeo\Client\Api\Objects\Blob::className);
        $response = new \Symfony\Component\HttpFoundation\BinaryFileResponse($blob->getFile());
        $response->setContentDisposition(\Symfony\Component\HttpFoundation\ResponseHeaderBag::DISPOSITION_ATTACHMENT, $blob->getFilename());
        $response->prepare(\Symfony\Component\HttpFoundation\Request::createFromGlobals())->send();
    } catch (\Nuxeo\Client\Internals\Spi\NuxeoClientException $ex) {
        throw new RuntimeException(sprintf('Could not fetch blob of %s: ', $path) . $ex->getMessage());
    }
}
?>
<!DOCTYPE html>