Example #1
0
 /**
  * Declares an association between this object and a User object.
  *
  * @param      User $v
  * @return     Subscription The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setUser(User $v = null)
 {
     if ($v === null) {
         $this->setUserId(NULL);
     } else {
         $this->setUserId($v->getId());
     }
     $this->aUser = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the User object, it will not be re-added.
     if ($v !== null) {
         $v->addSubscription($this);
     }
     return $this;
 }
 $sql_kml = "select wms.wms_getmap, wms.wms_version, layer.layer_name,layer.layer_title, layer_epsg.minx,layer_epsg.miny,layer_epsg.maxx,layer_epsg.maxy from wms, layer, layer_epsg, wms_format where layer.layer_id=\$1 and layer.fkey_wms_id=wms.wms_id and layer.layer_id=layer_epsg.fkey_layer_id and layer_epsg.epsg='EPSG:4326' and wms.wms_id=wms_format.fkey_wms_id and wms_format.data_format like '%image/png%' LIMIT 1";
 $v_kml = array($layer_id);
 $t_kml = array('i');
 $res_kml = db_prep_query($sql_kml, $v_kml, $t_kml);
 $row_kml = db_fetch_array($res_kml);
 generateKML($kml_id, $resdir, $row_kml['wms_getmap'], $row_kml['wms_version'], $row_kml['layer_name'], $row_kml['layer_title'], $row_kml['maxy'], $row_kml['miny'], $row_kml['maxx'], $row_kml['minx']);
 //export KML
 $metadataStr .= "<tr><th>Weitere Schnittstellen</th><td>";
 $metadataStr .= "<a href='kmldownload.php?download=" . $kml_id . ".kml'>KML (Keyhole Markup Language)</a>";
 $user = new User();
 //
 // Monitoring is only available if the user is allowed to access this service
 //
 if ($user->isLayerAccessible($layer['ID'])) {
     if ($subscribe === 1) {
         $user->addSubscription($layer['WMS ID']);
     } else {
         if ($subscribe === 0) {
             $user = new User();
             $user->cancelSubscription($layer['WMS ID']);
         }
     }
     $currentUser = new User();
     $is_subscribed = $currentUser->hasSubscription($wms_id);
     $is_public = $currentUser->isPublic();
     //show abo function to registred and authorized users
     if ($is_subscribed && !$is_public) {
         $metadataStr .= "<tr><th>Abo</th><td><img src = '../img/mail_delete.png'>" . "<a href = '../php/mod_layerMetadata.php?id=" . $layer_id . "&user_id=" . $currentUser->id . "&subscribe=0'>" . _mb("Monitoring Abo l&ouml;schen") . "</a></td></tr>";
     } else {
         if (!$is_subscribed && !$is_public) {
             $metadataStr .= "<tr><th>Abo</th><td><img src = '../img/mail_send.png'>" . "<a href = '../php/mod_layerMetadata.php?id=" . $layer_id . "&user_id=" . $currentUser->id . "&subscribe=1'>" . _mb("Monitoring abonnieren") . "</a></td></tr>";
} else {
    $html .= $t_a . $translation['resourceAbstract'] . $t_b . displayText($resourceMetadata['serviceabstract']) . $t_c;
}
$user = new User();
$layerAccessibility = $user->isLayerAccessible($layerId);
//
//
// Monitoring is only available if the user is allowed to access this service
//
if ($resource == 'wms' or $resource == 'layer') {
    if ($layerAccessibility) {
        $is_public = $user->isPublic();
        //show abo function to registred and authorized users
        if (!$is_public) {
            if ($subscribe == 1) {
                $user->addSubscription($resourceMetadata['serviceid']);
            } else {
                if ($subscribe == 0) {
                    $user->cancelSubscription($resourceMetadata['serviceid']);
                }
            }
            $is_subscribed = $user->hasSubscription($resourceMetadata['serviceid']);
        }
    }
    $html .= $aboStr;
}
$html .= $tableEnd;
$html .= '</p>';
$html .= '</div>';
//**************************overview part end******************************
//**************************properties part begin******************************