07-17-2013 08:03 AM
07-17-2013 09:27 AM
07-18-2013 01:41 AM
07-18-2013 04:14 AM
07-18-2013 05:23 AM
function setMetaData($siteName, $empData, $getVar, $siteDescription, $sessionID, $empLocation) {
$retVar = true;
$ch = curl_init();
$url = "localhost:8080/alfresco/service/farthest-gate/get-notice/site/";
$url .= $siteName . "/documentLibrary?output=nodeonly&docname=" . $siteName . ".XML";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, $getVar);
curl_setopt($ch, CURLOPT_HTTPGET, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_TIMEOUT, '3');
$response = curl_exec($ch);
curl_close($ch);
// Response SHOULD be a JSON response
try {
$or = json_decode($response);
if(!@$or->items[0]->nodeRef) {
echo "Site XML file not found\r\n";
$retVar = false;
} else {
$jsonPost = $this->setJSON($empData, $empLocation);
$ch = curl_init();
$nodeRef = str_replace("://", "/", $or->items[0]->nodeRef);
$url = "localhost:8080/share/proxy/alfresco/api/node/" . $nodeRef . "/formprocessor";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
$sessionCookie = sprintf("JSESSIONID=%s",$sessionID);
curl_setopt($ch, CURLOPT_COOKIE, $sessionCookie);
$headerOptions[0] = "Content-Type: application/json";
$headerOptions[1] = "Accept: application/json";
$headerOptions[2] = "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
$headerOptions[3] = "X-Requested-With: application/x-www-form-urlencoded";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headerOptions);
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonPost);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$response = curl_exec($ch);
curl_close($ch);
// Response SHOULD be a JSON response
try {
$or = json_decode($response);
if($or == NULL) {
echo "Alfresco service returned invalid JSON $response\r\n";
$retVar = false;
} else {
if(@$or->message) {
if(strpos($or->message,"Successfully persisted form") === FALSE) {
echo "Alfresco service returned error $or->message\r\n";
$retVar = false;
} else {
echo "Employee metadata for $siteName ($siteDescription) updated\r\n";
}
} else {
echo "Alfresco service did not update metadata responded with $response\r\n";
$retVar = false;
}
}
} catch (Exception $e) {
echo "Request returned invalid JSON. response: ". $repsonse . " Exception: ". $e.getMessage() . "\r\n";
$retVar = false;
}
}
} catch (Exception $e) {
echo "Failed to update metadata ". $e.getMessage() . "\r\n";
$retVar = false;
}
return $retVar;
}
07-26-2013 05:58 AM
07-26-2013 08:51 AM
07-28-2013 11:54 PM
07-30-2013 11:46 AM
<?php
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); 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.
require_once ('cmis_repository_wrapper.php');
$repo_url = $_SERVER["argv"][1];
$repo_username = $_SERVER["argv"][2];
$repo_password = $_SERVER["argv"][3];
@$repo_debug = $_SERVER["argv"][4];
$testfolios = array("xxxxx","yyyyyy");
$fname = "fred.csv";
$fhandle = fopen($fname,"w");
$client = new CMISService($repo_url, $repo_username, $repo_password);
$objs = $client->query("select cmis:objectId, cmis:objectTypeId, cmis:baseTypeId, cmis:name, cmis:creationDate, fgemp:mraempfolio, fgemp:mraempname, fgemp:mralocation, fgemp:mraapptdatetime, fgemp:mraapptwith, fgemp:mraattendedYN from fgemp:mgtrefappt");
foreach ($objs->objectList as $obj)
{
if(!in_array($obj->properties['fgemp:mraempfolio'], $testfolios)) {
@$apptdt = $obj->properties['fgemp:mraapptdatetime'];
@$apptwh = $obj->properties['fgemp:mraapptwith'];
$record = array($obj->properties['cmis:creationDate'],$obj->properties['fgemp:mraempfolio'],$obj->properties['fgemp:mraempname'],$obj->properties['fgemp:mralocation'],$apptdt,$apptwh,$obj->properties['fgemp:mraattendedYN']);
fputcsv($fhandle, $record);
}
}
07-31-2013 12:55 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.