#Find the project_id in the output ##################################################### #Get the classes from the xml #$xml = get_object_vars($xml); $xmlclasses = $xml['RESOURCE']; #echo '<pre>';print_r($xmlclasses); for ($i = 0; $i < count($xmlclasses); ++$i) { #create the classes $class = get_object_vars($xmlclasses[$i]); $s3ql['where'] = ''; $s3ql['insert'] = 'collection'; $s3ql['where']['project_id'] = $project_id; $s3ql['where']['entity'] = urldecode($class['ENTITY']); $s3ql['where']['notes'] = urldecode($class['NOTES']); $s3ql['format'] = 'html'; $classInserted = S3QLAction($s3ql); $msg = html2cell($classInserted); $msg = $msg[2]; #echo $classInserted; #was class created? check #ereg('<error>([0-9]+)</error>(.*)<(message|collection_id)>(.*)</(message|collection_id)>', $classInserted, $s3qlout); if ($msg['error_code'] == '0') { $class_id = $msg['collection_id']; $classes[$class['ENTITY']]['class_id'] = $class_id; #echo '<pre>';print_r($class['RULE']); $classes[$class['ENTITY']]['rules'] = is_object($class['RULE']) ? array(get_object_vars($class['RULE'])) : $class['RULE']; $report .= '<tr><td><font color = "#FF9900">Class ' . urldecode($class['ENTITY']) . ' created</font></td></tr>'; } if ($class_id == '') { $report .= '<tr><td><font color = "#FFCC00">' . $msg['message'] . '</font></td></tr>'; }
function localQ($tri_s3ql) { $query = S3QLAction($tri_s3ql); ##Now force the RDF output $format = $tri_s3ql['format']; $data = $query; $db = $tri_s3ql['db']; if (is_array($query[0])) { $cols = array_keys($query[0]); $letter = letter($tri_s3ql['from']); $z = compact('data', 'cols', 'format', 'db', 'letter'); $answer = outputFormat($z); } else { $answer = array(); } return $answer; }
function get_rule_drop_down_menu($D) { extract($D); if ($rule_info == '') { $rule_info = s3info('rule', $rule_id, $db); #$rule_info = include_all_class_id(compact('rule_info', 'db', 'project_id', 'user_id')); } #if(is_array($_SESSION[$user_id]['instances'][$rule_info['object_class_id']])) { # $instances = $_SESSION[$user_id]['instances'][$class_id]; #} #else { $s3ql = compact('db', 'user_id'); $s3ql['select'] = '*'; $s3ql['from'] = 'instances'; $s3ql['where']['class_id'] = $rule_info['object_id']; #echo '<pre>';print_r($s3ql);exit; #$s3ql['where']['project_id'] = $project_id; #$instances = s3list($s3ql); $instances = S3QLAction($s3ql); #echo '<pre>';print_r($instances); #if(!is_array($instances)) #{ #$s3ql['where']=''; #$s3ql['where']['project_id']=$project_id; #$s3ql['where']['entity']=$rule_info['object']; #$instances = S3QLaction($s3ql); #$_SESSION[$user_id]['instances'][$rule_info['object_class_id']] = $instances; #} #} $inputBox .= '<select name="' . $select_name . '" size="1" style="background-color: lightyellow; font-size: 8pt" size="1">'; $inputBox .= '<option value="" selected></option>'; if (is_array($instances)) { foreach ($instances as $object_instance_info) { $inputBox .= '<option value ="' . $object_instance_info['resource_id'] . '" >' . $object_instance_info['notes'] . ' <sub>(ID#' . $object_instance_info['resource_id'] . ')</sub></option>'; } } $inputBox .= '</select>'; return $inputBox; }