Exemplo n.º 1
0
 /**
  * @param string|P4A_DB_Source $source Table name or P4A_DB_Source object
  */
 public function __construct($source = null)
 {
     parent::__construct();
     if ($source === null) {
         $source = get_class($this);
     }
     $this->constructSimpleEdit($source);
 }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
 public function __construct()
 {
     parent::__construct();
     $this->i18n_dir = dirname(dirname(__FILE__)) . "/i18n";
     $current_locale = P4A::singleton()->i18n->getLocale();
     $languages = array();
     foreach (scandir($this->i18n_dir) as $file) {
         if (substr($file, -4) == ".php") {
             $locale = substr($file, 0, -4);
             list($language_code, $region_code) = explode("_", $locale);
             $language_name = Zend_Locale_Data::getContent($current_locale, 'language', $language_code);
             $region_name = Zend_Locale_Data::getContent($current_locale, 'country', $region_code);
             $languages[] = array("locale" => $locale, "description" => "{$language_name} ({$region_name})");
         }
     }
     $this->build("P4A_Array_Source", "languages")->setPk("locale")->load($languages);
     $this->build("P4A_Field", "choose_language")->setType("radio")->setValue($current_locale)->setSource($this->languages);
     $this->choose_language->label->setWidth(120);
     $this->build("P4A_Button", "apply")->implement("onclick", $this, "apply");
     $this->frame->anchor($this->choose_language)->newRow()->anchorCenter($this->apply);
 }
Exemplo n.º 4
0
 public function __construct()
 {
     parent::__construct();
     // DB Source
     $this->build("p4a_db_source", "source")->setTable("products")->addJoin("categories", "products.category_id = categories.category_id", array('description' => 'category'))->addJoin("brands", "products.brand_id = brands.brand_id", array('description' => 'brand'))->addOrder("product_id")->setPageLimit(10)->load();
     $this->setSource($this->source);
     $this->firstRow();
     // Customizing fields properties
     $this->setFieldsProperties();
     // Search Fieldset
     $this->build("p4a_field", "txt_search")->setLabel("Model")->implement("onreturnpress", $this, "search");
     $this->build("p4a_button", "cmd_search")->setLabel("Go")->implement("onclick", $this, "search");
     $this->build("p4a_fieldset", "fs_search")->setLabel("Search")->anchor($this->txt_search)->anchorLeft($this->cmd_search);
     // Toolbar
     $this->build("p4a_full_toolbar", "toolbar")->setMask($this);
     // Table
     $this->build("p4a_table", "table")->setWidth(600)->setSource($this->source)->setVisibleCols(array("product_id", "model", "date_arrival", "category", "brand"))->showNavigationBar();
     $this->table->cols->product_id->setLabel("Product ID");
     $this->build("p4a_fieldset", "fs_details")->setLabel("Product detail")->anchor($this->fields->product_id)->anchorLeft($this->fields->model)->anchor($this->fields->category_id)->anchorLeft($this->fields->brand_id)->anchor($this->fields->date_arrival)->anchorLeft($this->fields->price)->anchorLeft($this->fields->discount)->anchor($this->fields->picture)->anchor($this->fields->is_new)->anchorLeft($this->fields->visible)->anchor($this->fields->description);
     $this->frame->anchor($this->fs_search)->anchor($this->table)->anchor($this->fs_details);
     $this->setRequiredField("product_id")->setRequiredField("category_id")->setRequiredField("brand_id")->setRequiredField("model")->setRequiredField("price")->setRequiredField("description")->setRequiredField("discount");
     // Display
     $this->display("menu", P4A::singleton()->menu)->display("top", $this->toolbar)->setFocus($this->fields->model);
 }