Beispiel #1
0
 public function render()
 {
     $url = $this->url;
     $height = $this->height;
     $self = $this;
     $this->renderFunction(function ($ctx, $tpx) use($url, $height, $self) {
         global $INLINE;
         $extraAttributes = array();
         foreach ($self->attributes as $k => $v) {
             $extraAttributes[] = "{$k} = '{$INLINE(\cricket\utils\Utils::escape_html($v))}'";
         }
         $extraAttributes = implode(" ", $extraAttributes);
         $extraStyles = "";
         foreach ($self->styles as $k => $v) {
             $extraStyles .= \cricket\utils\Utils::escape_html("{$k}:{$v};");
         }
         echo "<iframe style='width:100%;height:{$height}px;{$extraStyles}' src='{$url}' {$extraAttributes}></iframe>";
     });
 }
 /**
  * I'm not sure what this does ;)
  * 
  * type: link | button | submit
  * action: "action"
  * label: "label"
  * param: null | array | js-string       used for link and button
  * ind: null | indicator id
  * confirm: null | string
  * 
  * @param unknown $genIndicatorID
  * @param unknown $indicatorFirst
  * @param array $controlDefs
  * 
  * @return void
  */
 public function control_group($genIndicatorID, $indicatorFirst, array $controlDefs)
 {
     global $INLINE;
     $indID = $genIndicatorID ? $this->componentID("_{$genIndicatorID}") : $genIndicatorID;
     if ($indicatorFirst && $indID) {
         echo $this->indicator($indID, 'vertical-align:top;');
     }
     $cList = array();
     foreach ($controlDefs as $control) {
         $thisInd = isset($control['ind']) ? $control['ind'] : $indID;
         $param = isset($control['param']) ? $control['param'] : null;
         $confirm = isset($control['confirm']) ? $control['confirm'] : null;
         $label = Utils::escape_html($control['label']);
         $thisControl = "";
         switch ($control['type']) {
             case "link":
                 $url = $this->call_href($control['action'], $param, $thisInd, $confirm);
                 $thisControl = "<a href='{$url}' class='action_link'>{$INLINE(Utils::escape_html($label))}</a>";
                 break;
             case "button":
                 $url = $this->call_attr($control['action'], $param, $thisInd, $confirm);
                 $thisControl = "<input type='button' value='{$INLINE(Utils::escape_html($label))}' onclick='{$url}'>";
                 break;
             case "submit":
                 $url = $this->form_submit_attr($control['action'], $thisInd, $confirm);
                 $thisControl = "<input type='button' value='{$INLINE(Utils::escape_html($label))}' onclick='{$url}'>";
         }
         $cList[] = $thisControl;
     }
     echo implode("&nbsp;", $cList);
     if (!$indicatorFirst && $indID) {
         echo $this->indicator($indID, 'vertical-align:top;');
     }
 }