Ejemplo n.º 1
0
 /**
 		@brief		Displays the input as a string.
 		@details	Converting a combination of label + input + description, wrapped in a div, is a several step process.
 
 		First, we must use placeholders to hold the above elements during the wrapping and tabbing process.
 		Otherwise any tabs in the input / description / label will be modified, which breaks especially breaks textareas.
 
 		Then, after wrapping and retabbing is done, replace the unique placeholders with the actual elements.
 
 		@return		string		The input + label + description as a string.
 		@since		20130524
 	**/
 public function __toString()
 {
     $random = \plainview\sdk_broadcast\base::uuid();
     $placeholders = new \stdClass();
     $placeholders->label = $random . 'label';
     $placeholders->input = $random . 'input';
     $placeholders->description = $random . 'description';
     $div = $this->get_display_div();
     // Prepare the input string that will be displayed to the user.
     $o = new \stdClass();
     $o->indent = $this->indent();
     $o->input = $placeholders->input;
     $o->label = $placeholders->label;
     if (!$this->description->is_empty()) {
         $o->description = $placeholders->description;
     }
     $input_string = $this->assemble_input_string($o);
     $r = sprintf('%s%s%s', $div->open_tag(), "\n", $input_string);
     // Increase one tab
     $r = preg_replace('/^\\t/m', "\t\t", $r);
     // Close the tag
     $r = $this->indent() . $r . "\n" . $this->indent() . $div->close_tag() . "\n";
     // Replace the placeholders with their corresponding functions.
     foreach ($placeholders as $type => $placeholder) {
         $function = 'display_' . $type;
         $r = str_replace($placeholder, $this->{$function}(), $r);
     }
     return $r;
 }
Ejemplo n.º 2
0
 public function __construct($row, $id = null)
 {
     if ($id !== null) {
         $this->id = $id;
         $this->attribute('id')->set($this->id);
     } else {
         $this->id = \plainview\sdk_broadcast\base::uuid();
     }
     $this->row = $row;
 }
Ejemplo n.º 3
0
 public function __construct($section, $id = null)
 {
     if ($id !== null) {
         $this->attribute('id')->set($id);
         $this->id = $id;
     } else {
         $this->id = \plainview\sdk_broadcast\base::uuid();
     }
     $this->cells = array();
     $this->section = $section;
 }
Ejemplo n.º 4
0
 /**
 		@brief		If no name was specified, and markup doesn't really need one, then make something up.
 	**/
 public function _construct()
 {
     if ($this->get_attribute('name') == '') {
         $this->set_attribute('name', \plainview\sdk_broadcast\base::uuid(4));
     }
 }