Пример #1
0
 function processPropertyTemplates($objectType, $propMap)
 {
     static $propTemplate;
     static $propertyTypeMap;
     if (!isset($propTemplate)) {
         $propTemplate = CMISService::getPropertyTemplate();
     }
     if (!isset($propertyTypeMap)) {
         // Not sure if I need to do this like this
         $propertyTypeMap = array("integer" => "Integer", "boolean" => "Boolean", "datetime" => "DateTime", "decimal" => "Decimal", "html" => "Html", "id" => "Id", "string" => "String", "url" => "Url", "xml" => "Xml");
     }
     $propertyContent = "";
     $hash_values = array();
     foreach ($propMap as $propId => $propValue) {
         $hash_values['propertyType'] = $propertyTypeMap[$this->getPropertyType($objectType, $propId)];
         $hash_values['propertyId'] = $propId;
         if (is_array($propValue)) {
             $first_one = true;
             $hash_values['properties'] = "";
             foreach ($propValue as $val) {
                 //This is a bit of a hack
                 if ($first_one) {
                     $first_one = false;
                 } else {
                     $hash_values['properties'] .= "</cmis:values>\n<cmis:values>";
                 }
                 $hash_values['properties'] .= $val;
             }
         } else {
             $hash_values['properties'] = $propValue;
         }
         //echo "HASH:\n";
         //print_r(array("template" =>$propTemplate, "Hash" => $hash_values));
         $propertyContent .= CMISRepositoryWrapper::processTemplate($propTemplate, $hash_values);
     }
     return $propertyContent;
 }