/** * get master data * @see CTModuleInterface::getMasterData() * * @return array */ public function getMasterData() { global $user, $base_url, $files_dir, $config; $res = churchdb_getMasterDataTables(); $res["feldtyp"] = churchcore_getTableData("cdb_feldtyp"); $res["fields"] = getAllFields(); $res["groups"] = getAllGroups(); $res["tags"] = getAllTags(); $res["FUNachfolgeDomains"] = array("0" => array("id" => "0", "bezeichnung" => "Kein"), "1" => array("id" => "1", "bezeichnung" => $res["fields"]["f_group"]["fields"]["gruppentyp_id"]["text"]), "2" => array("id" => "2", "bezeichnung" => $res["fields"]["f_group"]["fields"]["distrikt_id"]["text"]), "3" => array("id" => "3", "bezeichnung" => t("group"))); $res["groupMemberTypes"] = getGroupMemberTypes(); $res["groupFilterTypes"] = churchdb_getGroupFilterTypes(); // master data information for maintain masterdata and statistics if (user_access("edit masterdata", "churchdb") || user_access("view statistics", "churchdb")) { $res["masterDataTables"] = churchdb_getMasterDataTablenames(); } $res["user_pid"] = $user->id; $res["userid"] = $user->vorname . " " . $user->cmsuserid . " [" . $user->id . "]"; $res["auth"] = churchdb_getAuthForAjax(); $res["site_name"] = getConf('site_name'); $res["modulespath"] = churchdb_getModulesPath(); $res["files_url"] = $base_url . $files_dir; $res["modulename"] = "churchdb"; $res["max_uploadfile_size_kb"] = getConf('max_uploadfile_size_kb'); $res["adminemail"] = getConf('site_mail', ''); $res["max_exporter"] = getConf('churchdb_maxexporter', '150'); $res["groupnotchoosable"] = getConf('churchdb_groupnotchoosable', 30); $res["home_lat"] = getConf('churchdb_home_lat', '53.568537'); $res["home_lng"] = getConf('churchdb_home_lng', '10.03656'); $res["settings"] = churchdb_getUserSettings($user->id); $res["last_log_id"] = churchdb_getLastLogId(); $res["mailchimp"] = getConf('churchdb_mailchimp_apikey') != ""; $res["views"] = array("ArchiveView" => array("filename" => "cdb_archiveview"), "MapView" => array("filename" => "cdb_mapview"), "StatisticView" => array("filename" => "cdb_statisticview"), "SettingsView" => array("filename" => "cdb_settingsview"), "MaintainView" => array("filename" => "cdb_maintainview"), "WeekView" => array("filename" => "../churchresource/cr_weekview")); if (user_access("administer persons", "churchcore")) { $res["auth_table"] = churchdb_getAuthTable(); } if (isset($res["auth"]["edit newsletter"])) { $nl = churchdb_getTableData("cdb_newsletter"); $newsletter = array(); foreach ($res["auth"]["edit newsletter"] as $n) { $newsletter = $nl[$n]; } $res["newsletter"] = $newsletter; } return $res; }
/** * get log news newer then $last_id log * * @param int $last_id * * @return array containing [lastlogid]=id, [logs]=array */ function churchdb_pollForNews($last_id) { global $user; $res = db_query("SELECT * FROM {cdb_log} WHERE id > {$last_id} AND person_id!={$user->id}"); $arr_logs = array(); foreach ($res as $log) { $arr_logs[$log->id] = $log; } $return = array(); $return["lastLogId"] = churchdb_getLastLogId(); $return["logs"] = $arr_logs; return $return; }
/** * get log news newer then $last_id log * * @param int $last_id * * @return array containing [lastlogid]=id, [logs]=array */ function churchdb_pollForNews($last_id) { global $user; $res = db_query("SELECT * FROM {cdb_log}\n WHERE id > :last_id AND person_id != :user", array(":last_id" => $last_id, ":user" => $user->id)); $arr_logs = array(); foreach ($res as $log) { $arr_logs[$log->id] = $log; } $return = array("lastLogId" => churchdb_getLastLogId(), "logs" => $arr_logs); return $return; }