function get_properties_change_history_records_xml() { $eids = array(); $xml_string = ""; $sql = "select eid from view_int_prop_to_e_p_to_e\nwhere type_id in (select type_id from type where type_name like '%_history') and prop_id = 40 and int_val = " . $this->eid; $result = mysql_query($sql) or die("Error in RecordHistory...3lkd0skdjskfklk" . mysql_error()); while ($row = mysql_fetch_assoc($result)) { $eids[] = $row['eid']; } $doc = new DOMDocument('1.0', 'UTF-8'); $doc->formatOutput = true; $recs = $doc->createElement('records'); $recs = $doc->appendChild($recs); foreach ($eids as $eid) { $type_id = RecordsSys_EntityManagementSystems::get_type_id($eid); $rec = new Record($eid, $type_id); $rec->initialize(); $xml_string = $rec->xml_string; $doc2 = new DOMDocument('1.0', 'UTF-8'); $doc2->loadXML($xml_string); $node = $doc->importNode($doc2->firstChild, true); $recs->appendChild($node); } // $rec->glu->prop_ids_num_extra[6] = 1; // $rec->glu->set_prop_ids_num_extra_by_group_id(1); //$rec->glu->set_prop_ids_num_extra_by_group_id(1); // $xslt_file = $_SERVER['DOCUMENT_ROOT']."/XSLTemplates/testrecs.xsl"; $xml_string = $doc->saveXML(); return $xml_string; }
function get_record_xml_filtered($eid, $filter_properties) { $type_id = RecordsSys_EntityManagementSystems::get_type_id($eid); $rec = new Record($eid, $type_id); $rec->filter_properties = $filter_properties; $rec->initialize(); $xml_string = $rec->xml_string; return $xml_string; }
function get_date_last_modified() { return RecordsSys_EntityManagementSystems::get_date_last_modified($this->eid); }
function search_and_gather_eids($ctns_prop_ids, $ctns_prop_vals, $ctns_prop_vals_exact_match, $ctns_prop_vals_inverse_match, $prop_ids, $prop_vals, $type_id, $sort_prop_ids, $prop_comps, $type_ids, $group_nums, $ctns_prop_types) { //print_r(func_get_args()); //$debug_time = ""; $fin_eids = array(); $filt_eids = null; $all_filts_any = true; //$debug_time .= microtime().'entering search_and_gather_eids<br>'; //filter by set //Currently assumes ORing of match properties, need to do as below for text search! for ($i = 0; $i < count($prop_ids); $i++) { //echo '-- $search_prop_id'.$prop_ids[$i]." searchpropval: ".$prop_vals[$i]." , typeid: ".$type_id; $search_prop_val = $prop_vals[$i]; $search_prop_id = $prop_ids[$i]; $search_prop_comp = $prop_comps[$i]; //note: if using comparison function, must include spc[] post variable for all prop_ids $group_num = $group_nums[$i]; if (count($type_ids) > 0) { $_type_id = $type_ids[$i]; } else { $_type_id = $type_id; } if ($search_prop_val == 0 && strlen($search_prop_comp) == 0) { //echo '<br>$search_prop_val:'.$search_prop_val; continue; } else { $all_filts_any = false; } // $eids = RecordsSys_EntityManagementSystems::get_eids_by_prop_contains_search($search_prop_val, $search_prop_id, $type_id); if (strlen($search_prop_val) == 0) { $eids = RecordsSys_EntityManagementSystems::get_eids_by_prop_contains_search($search_prop_val, $search_prop_id, $_type_id); } else { $eids = RecordsSys_EntityManagementSystems::get_eids($search_prop_val, $search_prop_id, $_type_id, $search_prop_comp); } $arr2 = array(); foreach ($eids as $eid) { array_push($arr2, $eid); } if ($group_num) { if (!isset($filt_eids)) { $filt_eids = $arr2; } else { $filt_eids = array_unique(array_merge($filt_eids, $arr2)); } } else { if (!isset($filt_eids)) { //echo "search_prop_val: ".$search_prop_val." -- search_prop_id: " . $search_prop_id." filt_eids: " . print_r($filt_eids,true).", arr2: " . print_r($arr2, true)."<br>"; $filt_eids = $arr2; } else { $filt_eids = array_intersect($filt_eids, $arr2); } } } //echo "<br>all filters any? ".$all_filts_any." or the filteids:". print_r($filt_eids,true); //intersect with Contains search //echo count($ctns_prop_ids)."yo".print_r($ctns_prop_ids,true); if (empty($ctns_prop_ids) or count($ctns_prop_ids) == 0) { // echo '<br>;starting contains search. $all_filts_any: '.$all_filts_any.', $ctns_prop_ids: '.print_r($ctns_prop_ids,true); // .'; count($cnts_prop_ids)'.count($ctns_prop_ids); $fin_eids = $filt_eids; // echo 'n4ello'.print_r($fin_eids,true); } else { //$debug_time .= microtime().' starting contains filter'.print_r($fin_eids,true)."<br>"; for ($i = 0; $i < count($ctns_prop_ids); $i++) { $search_prop_val = count($ctns_prop_vals) > 1 ? $ctns_prop_vals[$i] : $ctns_prop_vals[0]; $search_prop_val_exact_match = count($ctns_prop_vals_exact_match) > 1 ? $ctns_prop_vals_exact_match[$i] : $ctns_prop_vals_exact_match[0]; //not sure if this will work with more than one ctnse, need to test $search_prop_val_inverse_match = count($ctns_prop_vals_inverse_match) > 1 ? $ctns_prop_vals_inverse_match[$i] : $ctns_prop_vals_inverse_match[0]; //not sure if this will work with more than one ctnse, need to test //echo "heeeelo".$search_prop_val_exact_match."end"; $search_prop_val = trim($search_prop_val); $search_prop_id = $ctns_prop_ids[$i]; $ctns_prop_type = empty($ctns_prop_types[$i]) ? $type_id : $ctns_prop_types[$i]; //echo " <br>the ctns_prop_types[i]: ".$ctns_prop_types[$i]; //echo "<br>SEARCH COUNT for $search_prop_val :". count($eids)."<br>"; if ($search_prop_id == "by_eid") { $eids = empty($search_prop_val) ? array() : array($search_prop_val); } elseif ($search_prop_val_exact_match) { //echo "BLOWBLOWBLOWBLWO".$search_prop_val_exact_match; //$eids = RecordsSys_EntityManagementSystems::get_eids_by_prop_contains_search($search_prop_val, $search_prop_id, $type_id); $eids = RecordsSys_EntityManagementSystems::get_eids($search_prop_val, $search_prop_id, $_type_id, $search_prop_comp); } else { //echo "<br>IN CONTAINS SEARCH!!$search_prop_val, $search_prop_id, $ctns_prop_type<BR>".empty($search_prop_val)."yo"; $eids = RecordsSys_EntityManagementSystems::get_eids_by_prop_contains_search($search_prop_val, $search_prop_id, $ctns_prop_type); //echo "<BR>result eids: ".print_r($eids,true); } if ($search_prop_val_inverse_match) { $data_type = "varchar"; if ($ctns_prop_type == 3) { $type_category = "user"; } else { $type_category = "product"; } //echo $ctns_prop_type."type? ".$type_id; $all_product_eids = RecordsSys_EntityManagementSystems::get_all_eids_by_type_category_and_datatype($data_type, $type_category, $ctns_prop_type); $eids = array_diff($all_product_eids, $eids); } //echo "<br>HERE variables: eid: $eid, fin_eids: ".print_r($fin_eids,true).", filt_eids: ".print_r($filt_eids,true)." all_filts_any: $all_filts_any, "; foreach ($eids as $eid) { if (!in_array($eid, $fin_eids) && ($all_filts_any || in_array($eid, $filt_eids))) { //echo "<br>pusing eid: ".$eid; array_push($fin_eids, $eid); } } } } //echo "<BR>COUNT OF FINEIDS:".count($fin_eids)."<br>"; //$debug_time .= microtime().' starting sort'."<br>"; //Currently assumes only 1 property to sort by if ($sort_prop_ids[0] == 0) { $sort_prop_ids[0] = 1; //customer wants sort by name by default } if ($sort_prop_ids[0] != 0 && count($fin_eids) > 0) { //get prop values for final eid set; do asort $sorted_eids = array(); $desc = 0; //NOTE: sorting also takes place below for lookuptable values $eidsvalshash = RecordsSys_EntityManagementSystems::get_eids_values_hash($fin_eids, $sort_prop_ids[0], $type_id, $desc); //can't do page offset/limit filter here because there may be duplicate eids $prop_id = $sort_prop_ids[0]; if (ClientServerDataOps::has_lookup_table($prop_id)) { foreach ($eidsvalshash as $eid => $val) { $newval = ClientServerDataOps::get_value_by_id($val, $prop_id); $eidsvalshash[$eid] = $newval; } asort($eidsvalshash); } foreach ($eidsvalshash as $eid => $val) { if (!in_array($eid, $sorted_eids)) { array_push($sorted_eids, $eid); } } //any for which entity doesn't have set property, on which this function sorts -- means no match goes after all the matches foreach ($fin_eids as $eid) { if (!in_array($eid, $sorted_eids)) { array_push($sorted_eids, $eid); } } $fin_eids = $sorted_eids; } //$debug_time .= microtime().' end of search and gather eids'.print_r($fin_eids,true)."<br>"; //echo $debug_time; //echo 'hello'.print_r($fin_eids,true); return $fin_eids; }
function preprocess_output($xml_string, $xslt_file, $params) { //echo microtime()." starting OutputProcessor::preprocess_output<br>"; //print_r($_SERVER); foreach ($_REQUEST as $getkey => $getval) { if (!in_array($getkey,array_keys($_COOKIE))) { if (is_array($getval)) { $getval = array_pop($getval); } $params[$getkey] = $getval; } } $logged_in_user = AppEntities_Facade::get_user_instance(); $logged_in_user_id = $logged_in_user->user_id; $logged_in_user_full_name = $logged_in_user->full_name; if ($_REQUEST['eid']) { $entity = RecordsSys_EntityManagementSystems::get_entity($_REQUEST['eid']); $params['date_last_modified'] = $entity->date_last_modified; $params['date_added'] = $entity->date_added; $params['user_last_modified'] = $entity->user_last_modified; $params['user_added'] = $entity->user_added; } else { $params['date_last_modified'] = ""; $params['date_added'] = ""; $params['user_last_modified'] = ""; $params['user_added'] = ""; } $params['php_self'] = $_SERVER['PHP_SELF']; $params['httphost'] = $_SERVER['HTTP_HOST']; $params['logged_in_user_full_name'] = $logged_in_user_full_name; $params['cur_user'] = Output_SecuritySystem::get_user_eid(); $params['auth_level'] = Output_SecuritySystem::get_user_auth_level(); $params['app_root_client'] = URL_APP_ROOT; $params['current_date_time'] = date("F j, Y, g:i a"); // March 10, 2001, 5:16 pm //echo microtime()." OutputProcessor::preprocess_output, calling MyEDB_XSLTProcessor::output_template<br>"; MyEDB_XSLTProcessor::output_template($xml_string, $xslt_file, $params); //echo microtime()." ending OutputProcessor::preprocess_output<br>"; }