public function __construct() { $p4a = p4a::singleton(); parent::__construct($p4a->categories); $this->setRequiredField("description"); $this->table->cols->category_id->setLabel("Category ID"); $this->fields->category_id->disable()->setLabel("Category ID"); $this->fieldset->setLabel("Category detail"); $this->display("menu", $p4a->menu)->setFocus($this->fields->description); }
public function preChange($params = null) { $p4a = p4a::singleton(); $params[0] = base64_decode($params[0]); $col_name = $params[1]; $value = @$params[2]; if ($this->cols->{$col_name}->isFormatted()) { if ($this->cols->{$col_name}->isActionTriggered('normalize')) { $params[3] = $this->cols->{$col_name}->actionHandler('normalize', $value, $this->data->fields->{$col_name}->getType(), $this->data->fields->{$col_name}->getNumOfDecimals()); } else { $params[3] = $p4a->i18n->normalize($value, $this->data->fields->{$col_name}->getType(), $this->data->fields->{$col_name}->getNumOfDecimals(), false); } } return $this->actionHandler('onChange', $params); }
public function __construct() { parent::__construct(); $p4a = p4a::singleton(); $this->setSource($p4a->brands); $this->firstRow(); $this->build("p4a_full_toolbar", "toolbar")->setMask($this); $this->build("p4a_table", "table")->setSource($p4a->brands)->setWidth(500)->showNavigationBar(); $this->setRequiredField("description"); $this->table->cols->brand_id->setLabel("Brand ID"); $this->fields->brand_id->disable()->setLabel("Brand ID"); $this->build("p4a_fieldset", "fs_details")->setLabel("Brand detail")->anchor($this->fields->brand_id)->anchor($this->fields->description)->anchor($this->fields->visible); $this->frame->anchor($this->table)->anchor($this->fs_details); $this->display("menu", $p4a->menu)->display("top", $this->toolbar)->setFocus($this->fields->description); }
* @link http://p4a.sourceforge.net * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License * @package p4a */ // Select application's locale define("P4A_LOCALE", 'en_US'); define("P4A_DSN", 'mysql://root:@localhost/p4a_products_catalogue'); // define("P4A_DSN", 'pgsql://*****:*****@localhost/p4a_products_catalogue'); // define("P4A_DSN", 'oci://*****:*****@localhost/xe'); // define("P4A_DSN", 'sqlite:/p4a_products_catalogue'); // define("P4A_DSN", 'mssql-dblib://user:password@localhost/p4a_products_catalogue'); // Enable logging and profiling of all DB actions // define("P4A_DB_PROFILE", true); // Enable more error details // define("P4A_EXTENDED_ERRORS", true); // Disable AJAX during the development phase, it will allows you // a faster debug, enable it on the production server // define("P4A_AJAX_ENABLED", false); // Path (on server) where P4A will write all code transferred via AJAX // define("P4A_AJAX_DEBUG", "/tmp/p4a_ajax_debug.txt"); require_once dirname(__FILE__) . '/../../p4a.php'; // Check Installation and configuration. // This lines should be removed after the first run. $check = p4a_check_configuration(); // Here we go if (is_string($check)) { print $check; } else { $p4a = p4a::singleton("products_catalogue"); $p4a->main(); }
protected function getChildrenAsString() { $string = ""; $p4a = P4A::singleton(); $handheld = p4a::singleton()->isHandheld(); foreach ($this->_map as $objs) { $one_visible = false; $row = "\n<div class='row'>"; foreach ($objs as $obj) { $classes = array("col"); $object = $p4a->getObject($obj["id"]); if (is_object($object)) { $as_string = $object->getAsString(); } else { unset($p4a->objects[$obj["id"]]); unset($this->_map[$i][$j]); if (empty($this->_map[$i])) { unset($this->_map[$i]); } $as_string = ''; } if (strlen($as_string) > 0) { if ($obj["float"] == "none") { $obj["float"] = "left"; $obj["margin"] = 0; $classes[] = "p4a_frame_anchor_center"; } $one_visible = true; $float = $obj["float"]; $margin = "margin-" . $obj["float"]; $margin_value = $obj["margin"]; $as_string = "\n\t\t{$as_string}"; if ($handheld) { $row .= $as_string; } else { $display = $object->isVisible() ? 'block' : 'none'; $class = empty($classes) ? '' : 'class="' . implode(' ', $classes) . '"'; $row .= "\n\t<div {$class} style='display:{$display};float:{$float};{$margin}:{$margin_value}'>{$as_string}\n\t</div>"; } } } $row .= "\n</div>\n"; if ($one_visible) { $string .= $row; } } return $string; }
/** * Takes the formatted passed value and takes it back to its normalized form. * @param mixed $value * @param string $type * @return mixed */ protected function normalize($value, $type = null) { if ($type === null) { $type = $this->data_field->getType(); } if ($this->isActionTriggered("onformat")) { return $this->actionHandler("onformat", $value, $type); } elseif (is_array($value) or is_object($value) or $value === null or strlen($value) == 0) { return $value; } else { return p4a::singleton()->i18n->normalize($value, $type, $this->data_field->getNumOfDecimals(), false); } }
/** * @param string $string * @return string */ public function translate($string) { if (strlen($string) == 0) { return ''; } $translation = $this->_translation_engine->translate($string, $this->locale); $is_translated = $this->_translation_engine->isTranslated($string, $this->locale); p4a::singleton()->actionHandler('ontranslate', $string, $translation, $is_translated); return $translation; }
/** * Destroyes current mask and reopen it (useful for developers) */ public function restart() { $p4a = p4a::singleton(); $p4a->showPrevMask(true); $p4a->openMask(get_class($this)); }