public function actionData($id = null, $metric = null) { if (isset($_POST['data'])) { foreach ($_POST['data'] as $id => $value) { $model = Data::model()->findByPk($id); $model->value = is_numeric($value) ? (int) $value : null; $model->save(); } echo Sector::getJson(); } else { $metricModel = Metric::model()->findByAttributes(array('name' => $metric)); $metric_ids = CHtml::listData($metricModel->getMetricWithDescendants(), 'id', 'id'); if ($metricModel->type == '1') { echo $this->renderPartial('dataForm', array('sector' => Sector::model()->findByPk($id), 'metric_ids' => $metric_ids)); } elseif ($metricModel->type = '2') { foreach (Sector::model()->findByPk($id)->square->sectors as $sector) { echo CHtml::tag('h3', array(), $sector->title); echo $this->renderPartial('dataForm', array('sector' => $sector, 'metric_ids' => $metric_ids)); echo Chtml::hiddenField('sector_id', $id); } } } }
?> </div> </div> <div id="map"></div> <style> .phoneytext { text-shadow: 0 -1px 0 #000; color: #fff; font-family: Helvetica Neue, Helvetica, arial; font-size: 12px; line-height: 14px; padding: 4px 45px 4px 15px; font-weight: bold; } .phoney { background: -webkit-gradient(linear, left top, left bottom, color-stop(0, rgb(112, 112, 112)), color-stop(0.51, rgb(94, 94, 94)), color-stop(0.52, rgb(57, 57, 57))); background: -moz-linear-gradient(center top, rgb(112, 112, 112) 0%, rgb(94, 94, 94) 51%, rgb(57, 57, 57) 52%); } </style> <script type="text/javascript"> $(document).ready(function () { $('#map').metricMap({ globalData: <?php echo Sector::getJson(); ?> }); }); </script>
public function actionActualData() { echo Sector::getJson(); }