예제 #1
0
 /**
  * Returns an list with the parent hierarchy until root with:
  *   * id: key of the item
  *   * name: form name for the component (selected value will be overriden with $this->name)
  *   * value: item value
  * Example:
  * getHierarchy(100) => array(
  *   array(id=>0,   [name=n0,] value=ROOT),
  *   array(id=>1,   [name=n1,] value=Spain),
  *   array(id=>20,  [name=n2,] value=Galicia),
  *   array(id=>100, [name=n3,] value=A Coruña),
  * )
  */
 public static function getHierarchy($id = null)
 {
     $result = array();
     foreach (ZoneService::getParentHierarchy($id) as $zone) {
         $result[] = array('id' => $zone->zid, 'value' => $zone->name);
     }
     return $result;
 }
예제 #2
0
    echo CHtml::encode($model->email);
}
?>
            <?php 
if (!empty($model->phones)) {
    echo CHtml::encode($model->phones);
}
?>
        </div>
    </div>
    <div class="field">
        <label>Zone</label>
        <div>
            <?php 
$zoneNames = array();
foreach (ZoneService::getParentHierarchy($model->zid) as $zone) {
    if ($zone->zid == 0) {
        continue;
    }
    $zoneNames[] = CHtml::link($zone->name, $this->createUrl("/zone/view", array("id" => $zone->zid)));
}
echo implode(" >> ", $zoneNames);
?>
        </div>
    </div>
    <div class="field" style="position:absolute;bottom: 0px;left: 0px; "> <?php 
// Align to bottom
?>
    <?php 
if (isset($model->lat) && isset($model->lon)) {
    $zoom = isset($model->zoom) ? $model->zoom - 2 : 5;