Example #1
0
 /**
  * @return string
  */
 public function getAsString()
 {
     $id = $this->getId();
     $return = '';
     if ($this->isVisible() and strlen($this->getValue())) {
         $classes = join(' ', $this->getCSSClasses());
         $properties = $this->composeStringProperties();
         $actions = $this->composeStringActions();
         $value = $this->getValue();
         $icon = $this->getIcon();
         $size = $this->getSize();
         if (strlen($icon)) {
             if (strpos($icon, '.') === false) {
                 $icon = P4A_ICONS_PATH . "/{$size}/{$icon}." . P4A_ICONS_EXTENSION;
             }
             $icon = "<img src='{$icon}' alt='' />";
         }
         $return = P4A_Generate_Widget_Layout_Table($icon, $value, $classes, "id='{$id}' {$properties} {$actions}");
     }
     if ($this->auto_clear) {
         $this->setValue();
     }
     if (!strlen($return)) {
         return "<span id='{$id}' class='hidden'></span>";
     }
     return $return;
 }
Example #2
0
 /**
  * Renders HTML
  * @access public
  * @return string
  */
 public function getAsString()
 {
     $id = $this->getId();
     if (!$this->isVisible()) {
         return "<div id='{$id}' class='hidden'></div>";
     }
     $has_items = $this->hasItems() ? "class='p4a_menu_has_items'" : '';
     $properties = $this->composeStringProperties();
     if (P4A::singleton()->isHandheld()) {
         $icon = '';
     } else {
         $icon = $this->getIcon();
         if (strlen($icon)) {
             if (strpos($this->_icon, '.') === false) {
                 $icon_disabled = '';
                 if (!$this->isEnabled()) {
                     $icon_disabled = '_disabled';
                 }
                 $icon = P4A_ICONS_PATH . "/16/{$icon}{$icon_disabled}." . P4A_ICONS_EXTENSION;
             }
             $icon = "<img src='{$icon}' alt='' />";
         }
     }
     if (empty($this->_map_actions["onclick"]["method"]) or !$this->isEnabled()) {
         $sReturn = "<li {$has_items}>" . P4A_Generate_Widget_Layout_Table($icon, "<div {$properties}>" . __($this->getLabel()) . "</div>");
     } else {
         $actions = $this->composeStringActions();
         $sReturn = "<li {$has_items}>" . P4A_Generate_Widget_Layout_Table($icon, "<a href='#' {$actions} {$properties}>" . P4A_Highlight_AccessKey(__($this->getLabel()), $this->getAccessKey()) . "</a>");
     }
     if ($has_items) {
         $sReturn .= "<ul>";
         while ($item = $this->items->nextItem()) {
             $sReturn .= $item->getAsString();
         }
         $sReturn .= "</ul>";
     }
     $sReturn .= "</li>";
     return $sReturn;
 }
Example #3
0
 /**
  * Returns the HTML rendered field as radio buttons group
  * @return string
  */
 public function getAsRadio()
 {
     $id = $this->getId();
     $properties = $this->composeStringProperties();
     $external_data = $this->data->getAll();
     $value_field = $this->getSourceValueField();
     $description_field = $this->getSourceDescriptionField();
     $new_value = $this->getNewValue();
     $sContent = "";
     $enabled = '';
     if (!$this->isEnabled()) {
         $enabled = 'disabled="disabled" ';
     }
     if ($this->isNullAllowed()) {
         if ($this->null_message === null) {
             $message = 'none_selected';
         } else {
             $message = $this->null_message;
         }
         array_unshift($external_data, array($value_field => '', $description_field => __($message)));
     }
     foreach ($external_data as $key => $current) {
         if ($current[$value_field] == $new_value) {
             $checked = "checked='checked'";
         } else {
             $checked = "";
         }
         $input = "<input {$enabled} name='{$id}' id='{$id}_{$key}input' type='radio' " . $this->composeStringActions() . " {$checked} value='" . htmlspecialchars($current[$value_field]) . "'/>";
         if ($this->isFormatted()) {
             $label = $this->format($current[$description_field], $this->data->fields->{$description_field}->getType(), $this->data->fields->{$description_field}->getNumOfDecimals());
         } else {
             $label = $current[$description_field];
         }
         $sContent .= P4A_Generate_Widget_Layout_Table($input, "<label for='{$id}_{$key}input'>{$label}</label>");
     }
     $this->label->unsetProperty('for');
     $return = $this->composeLabel() . "<div class='p4a_field_radio_values' {$properties}>{$sContent}</div>";
     $this->label->setProperty('for', "{$id}input");
     return $return;
 }
Example #4
0
 /**
  * Retuns the HTML rendered button
  * @return string
  */
 public function getAsString()
 {
     $id = $this->getId();
     if (!$this->isVisible()) {
         return "<span id='{$id}' class='hidden'></span>";
     }
     $label = htmlspecialchars(__($this->getLabel()), ENT_QUOTES);
     $title = $label;
     $properties = $this->composeStringProperties();
     $actions = $this->composeStringActions();
     $accesskey = $this->getAccessKey();
     if (strlen($accesskey) > 0) {
         $title = "[{$accesskey}] {$title}";
     }
     if ($this->_label_visible or !$this->_icon) {
         $label = P4A_Highlight_AccessKey($label, $accesskey);
     } else {
         $label = null;
     }
     $icon = "";
     if ($this->_icon != null) {
         $size = $this->getSize();
         if (strpos($size, 'x') !== false) {
             list($width, $size) = explode('x', $size);
         }
         if (strpos($this->_icon, '.') !== false) {
             $icon = $this->_icon;
         } else {
             $icon = P4A_ICONS_PATH . "/{$size}/{$this->_icon}";
             $icon .= '.' . P4A_ICONS_EXTENSION;
         }
         $icon = "<img src='{$icon}' width='{$size}' height='{$size}' alt='' />";
     }
     if ($icon) {
         $class = array('p4a_button_image');
         if (!$this->isEnabled()) {
             $class[] = 'p4a_button_image_disabled';
         }
         $class = $this->composeStringClass($class);
     } else {
         $class = array();
         if (!$this->isEnabled()) {
             $class[] = 'p4a_button_disabled';
         }
         $class = $this->composeStringClass($class);
     }
     $tooltip_text = __($this->getTooltip());
     if ($tooltip_text) {
         $tooltip_text = "<div id='{$id}tooltip' class='p4a_tooltip'><div class='p4a_tooltip_inner'>{$tooltip_text}</div></div>";
         $actions .= " onmouseover='p4a_tooltip_show(this)' ";
     }
     return "<button id='{$id}' title='{$title}' {$class} {$properties} {$actions}>" . $tooltip_text . P4A_Generate_Widget_Layout_Table($icon, $label) . '</button>';
 }
Example #5
0
px;<?php 
if (isset($_sidebar_left_width)) {
    echo "margin-left:{$_sidebar_left_width[0]}{$_sidebar_left_width[1]};";
}
?>
 <?php 
if (isset($_sidebar_right_width)) {
    echo "margin-right:{$_sidebar_right_width[0]}{$_sidebar_right_width[1]};";
}
?>
">
	<?php 
if (strlen($_title)) {
    ?>
	<h2><?php 
    echo P4A_Generate_Widget_Layout_Table($_icon, $_title);
    ?>
</h2>
	<?php 
}
?>

	<?php 
if (isset($main)) {
    ?>
	<div id="p4a_main_inner_container">
		<div id="p4a_main"><?php 
    echo $main;
    ?>
</div>
		<div class="br"></div>
Example #6
0
File: p4a.php Project: eliudiaz/p4a
 /**
  * Returns HTML rendered system messages and clean the queue
  * @return array
  */
 public function getRenderedMessages()
 {
     $messages = $this->getMessages();
     foreach ($messages as &$message) {
         $text = $message[0];
         $icon = $message[1];
         $icon_size = $message[2];
         if (strlen($icon)) {
             if (strpos($icon, '.') === false) {
                 $icon = P4A_ICONS_PATH . "/{$icon_size}/{$icon}." . P4A_ICONS_EXTENSION;
             }
             $icon = "<img src='{$icon}' alt='' />";
         }
         $message = P4A_Generate_Widget_Layout_Table($icon, $text, 'p4a_message');
     }
     return $messages;
 }