/** * get person data to search for * * @return array with persons, key = id */ function getSearchableData() { $persons = churchdb_getAllowedPersonData('', 'person_id p_id, person_id id, familienstand_no, geschlecht_no, hochzeitsdatum, nationalitaet_id, erstkontakt, zugehoerig, eintrittsdatum, austrittsdatum, taufdatum, plz, geburtsort, imageurl, cmsuserid, lastlogin'); foreach ($persons as $arr) { unset($persons[$arr->id]->p_id); $persons[$arr->id]->auth = getAuthForPerson($arr->id); } return $persons; }
function churchcal_getAllowedPersons() { include_once CHURCHDB . '/churchdb_ajax.php'; return churchdb_getAllowedPersonData('archiv_yn=0'); }
public function getAllPersonArchiveData($params) { return churchdb_getAllowedPersonData('archiv_yn=1'); }
/** * prepare person data for export * * @param string $ids; null for all or comma separated list * @param string $template; when null, export everything that is possible * @throws Exception * * @return array */ function _getPersonDataForExport($person_ids = null, $template = null) { global $user; $ids = null; if ($person_ids != null) { $ids = explode(",", $person_ids); } // Check allowed persons $ps = churchdb_getAllowedPersonData(); $department = churchcore_getTableData("cdb_bereich"); $status = churchcore_getTableData("cdb_status"); $station = churchcore_getTableData("cdb_station"); $export = array(); foreach ($ps as $p) { if ($ids == null || in_array($p->p_id, $ids)) { $detail = churchdb_getPersonDetails($p->p_id, false); $detail->bereich = ""; $departments = array(); foreach ($p->access as $dep_id) { $departments[] = $department[$dep_id]->bezeichnung; } $detail->bereich_id = implode('::', $departments); $detail->station_id = $station[$detail->station_id]->bezeichnung; if (user_access("view alldetails", "churchdb")) { $detail->status_id = $status[$detail->status_id]->bezeichnung; } else { if ($status[$detail->status_id]->mitglied_yn == 1) { $detail->status_id = "Mitglied"; } else { $detail->status_id = "Kein Mitglied"; } } if ($detail->geschlecht_no == 1) { $detail->Anrede1 = "Herrn"; $detail->Anrede2 = "Lieber"; } else { if ($detail->geschlecht_no == 2) { $detail->Anrede1 = "Frau"; $detail->Anrede2 = "Liebe"; } } if (isset($detail->geburtsdatum)) { $detail->age = churchcore_getAge($detail->geburtsdatum); } // If template was selected if ($template != null) { $export_entry = array(); foreach ($template as $key => $field) { if (strpos($key, "f_") === 0) { $key = substr($key, 2, 99); if (isset($detail->{$key})) { $export_entry[$key] = $detail->{$key}; } } } } else { $export_entry = (array) $detail; if (!user_access("administer persons", "churchcore")) { unset($export_entry["letzteaenderung"]); unset($export_entry["aenderunguser"]); unset($export_entry["einladung"]); unset($export_entry["active_yn"]); unset($export_entry["lastlogin"]); unset($export_entry["createdate"]); unset($export_entry["lat"]); unset($export_entry["lng"]); unset($export_entry["gp_id"]); unset($export_entry["imageurl"]); } // Unset Array, cause this is not exportable unset($export_entry["auth"]); } $export[$p->p_id] = _export_optimzations($export_entry); } } return $export; }