Beispiel #1
0
 /**
  * Render the alerts and reset the queue
  *
  * @return UI\HTML
  */
 public static function render()
 {
     $html = Builder::handle('alert', static::$_alerts);
     static::$_alerts = array();
     return $html;
 }
Beispiel #2
0
 /**
  * generate an select
  *
  *     Form::select( 'gender', array( 'F', 'M' ), 0 );
  *
  *     Form::select( 'gender', array( '1' => 'A', '2' => 'B' ), array( 1,2 ), 2 );
  *
  * @param string		$id			The id that has been generated for us.
  * @param string 	$name		This is the name
  * @param array		$options
  * @param array 		$selected
  * @param int		$size
  * @return string
  */
 public static function make_select($id, $name, array $options, $selected = array(), $size = 1)
 {
     if (!is_array($selected)) {
         $selected = array($selected);
     }
     $buffer = "";
     foreach ($options as $key => $option) {
         if (!$option instanceof HTML) {
             $option = HTML::tag('option', $option)->value($key);
         }
         if (in_array($key, $selected)) {
             $option->selected(true);
         }
         $buffer .= $option->render();
     }
     $element = HTML::tag('select', $buffer, array('id' => $id, 'name' => $name, 'size' => $size));
     if (!static::$builder_enabled) {
         return $element;
     }
     return Builder::handle('form_select', $element);
 }