public function actionView() { if (Yii::app()->getRequest()->getIsAjaxRequest()) { $this->renderPartial('view', array('model' => ZoneService::getZone($_REQUEST["id"]))); } else { $this->render('view', array('model' => ZoneService::loadModel())); } }
/** * Returns an array with all the children values * getChildren(1) => array( * 2 => Galicia, * 3 => Andalucia, * 4 => Sevilla, * ) */ public static function getChildren($id) { $h = array(); $zone = ZoneService::getZone($id); if (isset($zone)) { foreach ($zone->children as $child) { $h[$child->zid] = $child->name; } } //print "<pre>$id".print_r($h, true)."</pre>"; return $h; }
<?php $this->pageTitle = Yii::app()->name . " - Zones"; $this->breadcrumbs = array('Zones'); $this->contentTitle = "Zones"; $this->contentMenu = (require '_actionBar.php'); ?> <table><tr> <td width="200px"> <?php $this->widget('CTreeView', array('url' => Yii::app()->createUrl("/zone/treeFill", array('selected' => 4)), 'animated' => 'slow')); ?> </td><td> <div id="zone_view"> <div id="location"> <?php $this->renderPartial('view', array('model' => ZoneService::getZone($model))); ?> </div> </div> </td> </tr></table>