/**
  * get getMasterData
  */
 public function getMasterData()
 {
     global $user, $base_url;
     $ret = array();
     $ret["modulename"] = "churchcal";
     $ret["modulespath"] = CHURCHCAL;
     $ret["churchservice_name"] = getConf("churchservice_name");
     $ret["churchcal_name"] = getConf("churchcal_name");
     $ret["churchresource_name"] = getConf("churchresource_name");
     $ret["maincal_name"] = getConf("churchcal_maincalname", "Gemeindekalender");
     $ret["firstDayInWeek"] = getConf("churchcal_firstdayinweek", 1);
     $ret["notification"] = churchcore_getMyNotifications();
     $ret["notificationtype"] = churchcore_getTableData("cc_notificationtype");
     $ret["reminder"] = ct_getMyReminders($user->id, "event");
     $ret["base_url"] = $base_url;
     $ret["user_pid"] = $user->id;
     if (user_access("view", "churchdb")) {
         $ret["cdb_bereich"] = churchcore_getTableData("cdb_bereich");
         $ret["cdb_status"] = churchcore_getTableData("cdb_status");
         $ret["cdb_station"] = churchcore_getTableData("cdb_station");
         $ret["absent_reason"] = churchcore_getTableData("cs_absent_reason");
         foreach ($ret["absent_reason"] as $key => $reason) {
             if (isset($reason->color)) {
                 $ret["absent_reason"][$key]->textColor = getContrastYIQ($reason->color);
             }
         }
     }
     if (user_access("view", "churchresource") || user_access("create bookings", "churchresource")) {
         $ret["resources"] = churchcore_getTableData("cr_resource");
         $ret["resourceTypes"] = churchcore_getTableData("cr_resourcetype");
         $ret["bookingStatus"] = churchcore_getTableData("cr_status");
     }
     $ret["category"] = churchcal_getAllowedCategories(true);
     $ret["settings"] = churchcore_getUserSettings("churchcal", $user->id);
     $ret["repeat"] = churchcore_getTableData("cc_repeat");
     if (count($ret["settings"]) == 0) {
         $arr["checkboxEvents"] = "true";
         $ret["settings"] = $arr;
     }
     $ret["auth"] = churchcal_getAuthForAjax();
     $ret["views"] = array("WeekView" => array("filename" => "../churchresource/cr_weekview"));
     return $ret;
 }
Ejemplo n.º 2
0
/**
 * TODO: remove private cals?
 *
 * @param string $withPrivat
 * @param string $onlyIds
 * @return multitype:NULL Ambigous <object, boolean, db_accessor>
 */
function churchcal_getAllowedCategories($withPrivat = true, $onlyIds = false)
{
    global $user;
    include_once CHURCHDB . "/churchdb_db.php";
    $db = db_query("SELECT * FROM {cc_calcategory}");
    $res = array();
    $auth = churchcal_getAuthForAjax();
    foreach ($db as $category) {
        if ($category->privat_yn == 0 || $withPrivat) {
            // Zugriff, weil ich View-Rechte auf die Kategorie habe
            if (isset($auth["view category"]) && isset($auth["view category"][$category->id]) || isset($auth["edit category"]) && isset($auth["edit category"][$category->id])) {
                if ($onlyIds) {
                    $res[$category->id] = $category->id;
                } else {
                    $category->textColor = getContrastYIQ($category->color);
                    $res[$category->id] = $category;
                }
            }
        }
    }
    return $res;
}