function setup_content($text, &$pipeline) { /** * Contents of the text box are somewhat similar to the inline box: * a sequence of the text and whitespace boxes; we generate this sequence using * the InlineBox, then copy contents of the created inline box to our button. * * @todo probably, create_from_text() function should be extracted to the common parent * of inline boxes. */ $ibox = InlineBox::create_from_text($text, WHITESPACE_PRE, $pipeline); if (count($ibox->content) == 0) { $this->append_child(TextBox::create(' ', 'iso-8859-1', $pipeline)); } else { for ($i = 0, $size = count($ibox->content); $i < $size; $i++) { $this->append_child($ibox->content[$i]); } } }
function &create(&$root, &$pipeline) { $box = new ListItemBox($root, $pipeline); $box->readCSS($pipeline->getCurrentCSSState()); /** * Create text box containing item number */ $css_state =& $pipeline->getCurrentCSSState(); $css_state->pushState(); $css_state->setProperty(CSS_COLOR, CSSColor::parse('transparent')); $list_style = $css_state->getProperty(CSS_LIST_STYLE); $box->str_number_box = TextBox::create(CSSListStyleType::format_number($list_style->type, $css_state->getProperty(CSS_HTML2PS_LIST_COUNTER)) . ". ", 'iso-8859-1', $pipeline); $box->str_number_box->baseline = $box->str_number_box->default_baseline; $css_state->popState(); /** * Create nested items */ $box->create_content($root, $pipeline); return $box; }
function ListItemBox(&$root, &$pipeline) { // Call parent constructor $this->BlockBox($root); // Pseudo-CSS properties // '-list-counter' $counter =& get_css_handler('-list-counter'); $background_color =& get_css_handler('background-color'); $background_color->push_css('transparent', $pipeline); $this->str_number_box = TextBox::create(CSSListStyleType::format_number($this->list_style->type, $counter->get()), 'iso-8859-1'); $this->str_number_box->baseline = $this->str_number_box->default_baseline; $background_color->pop(); // increase counter value $counter->pop(); // remove inherited value $counter->replace($counter->get() + 1); $counter->push($counter->get()); // open the marker image if specified if (!$this->list_style->image->is_default()) { $this->marker_image = $this->list_style->image->_image; } else { $this->marker_image = null; } }
function process_word($raw_content) { if ($raw_content === "") { return false; } global $g_utf8_to_encodings_mapping_pdf; $ptr = 0; $word = ""; $encoding = "iso-8859-1"; while ($ptr < strlen($raw_content)) { if ((ord($raw_content[$ptr]) & 0xf0) == 0xf0) { $charlen = 4; } elseif ((ord($raw_content[$ptr]) & 0xe0) == 0xe0) { $charlen = 3; } elseif ((ord($raw_content[$ptr]) & 0xc0) == 0xc0) { $charlen = 2; } else { $charlen = 1; } $char = substr($raw_content, $ptr, $charlen); if (!isset($g_utf8_to_encodings_mapping_pdf[$char])) { $ch_hex = ""; for ($i = 0; $i < strlen($char); $i++) { $ch_hex .= sprintf("%x", ord($char[$i])); } error_log("Unknown utf8 character:" . $ch_hex); $char = "?"; } $mapping = $g_utf8_to_encodings_mapping_pdf[$char]; if (isset($mapping[$encoding])) { $add = $mapping[$encoding]; $word .= $add; } else { // This condition prevents empty text boxes from appearing; say, if word starts with a national // character, an () - text box with no letters will be generated, in rare case causing a random line // wraps, if container is narrow if ($word !== "") { $this->add_child(TextBox::create($word, $encoding)); } $encodings = array_keys($mapping); $encoding = $encodings[0]; $add = $mapping[$encoding]; $word = $add; } $ptr += $charlen; } if ($word !== "") { $this->add_child(TextBox::create($word, $encoding)); return true; } return false; }
$row1->create(); $row1->start(); $column1 = new ColumnPanel('column1', 6, 'md'); $column1->create(); $column1->start(); ?> <h1>This is a drop down list.</h1> <?php $newddlSource = new DataSource('articles', null); $ddlValues = $newddlSource->select(); $newddl = new DropDownList('test1', 'test2', 'test3', $ddlValues, "title", "id"); $newddl->create(); $newddl->display(); $column1->close(); $column2 = new ColumnPanel('column2', 6, 'md'); $column2->create(); $column2->start(); ?> <h1>This is a text box.</h1> <?php $newTB = new TextBox('test1', 'test2', 'test3', 'test4'); $newTB->create(); $newTB->display(); $column2->close(); $row1->close(); $panel1->close(); ?> </body> <script src="js/bootstrap.js"></script> </html>