public static function getLayers() { $layers = Wms::model()->findAllByAttributes(array('username' => Yii::app()->user->id)); $return = array(); foreach ($layers as $i => $l) { $return[] = array('name' => $l->name, 'title' => $l->title, 'url' => $l->url, 'projection' => $l->projection); } return $return; }
echo ', group:\'' . $l['group'] . '\''; } ?> } ); map.addLayer(layer_<?php echo $l['layer']; ?> ); <?php } ?> <?php foreach (Wms::getLayers() as $l_id => $l) { ?> var layer_<?php echo $l['name']; ?> = new OpenLayers.Layer.WMS( "<?php echo $l['title']; ?> ", "<?php echo $l['url']; ?> ", { layers: "<?php
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param string $id the identifier of the model to be loaded */ public function loadModel($name) { $model = Wms::model()->findByPk(array('username' => Yii::app()->user->id, 'name' => $name)); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }