Ejemplo n.º 1
0
 function addTab($name, $class, $relationWithParentField = null)
 {
     global $SYS;
     $instancedObject = newObject("{$class}");
     $LayOut = new wLayoutTable("{$name}", $this->tabPane);
     $LayOut->setHorizontal();
     $LayOut->fixedSizes = array("", "");
     /* Grid */
     $grid = new wGrid("grid{$class}{$this->id}", $LayOut);
     $grid->DataURL = "?oDataRequest=" . get_class($this) . "&instance={$class}";
     $grid->setWidth(595);
     $grid->actionOnSelectID = "xajax_wForm.requestloadFromId(value,'form{$class}{$this->id}','{$class}')";
     /* Form */
     $form = new wForm("form{$class}{$this->id}", $LayOut);
     $form->setCSS("margin", "5px");
     /* Data */
     $grid->setDataModelFromCore($instancedObject);
     /* VNH */
     $form->setDataModelFromCore($instancedObject);
     $form->createDefaultButtons();
     $form->setCSS("width", "95%");
     $form->doAfterSave("aj_ReloadGrid");
     $form->doAfterDelete("aj_GridDelete");
     if ($relationWithParentField) {
         $this->hierarchyClass["{$class}"] = "{$relationWithParentField}";
         $this->grids["{$class}"] = $grid;
         $label = new wHidden("{$this->MainClass}_driver", $this, false);
         //$form->components["$relationWithParentField"]->setReadOnly();
     }
     $this->aForms[sizeof($this->aForms)] = $form;
 }
Ejemplo n.º 2
0
 public function requestloadFromId($id, $fjid, $class)
 {
     $this->coreObject = newObject("{$class}", $id);
     $objResponse = new xajaxResponse();
     foreach ($this->coreObject->properties as $k => $v) {
         if (strpos($this->coreObject->properties_type["{$k}"], "boolean") === 0) {
             $objResponse->script("\$(\"{$fjid}.{$k}\").checked=" . wForm::dataFormater($v, $this->coreObject->properties_type[$k]));
         } else {
             $objResponse->assign("{$fjid}.{$k}", "value", wForm::dataFormater($v, $this->coreObject->properties_type[$k]));
         }
     }
     $objResponse->assign("{$fjid}.ID", "value", $id);
     $MethodtoCall = "afterrequestloadFromId";
     $cParent =& $this->wParent;
     while ($cParent) {
         debug(__FILE__ . " Calling parent: " . get_class($cParent), "white");
         if (method_exists($cParent, $MethodtoCall)) {
             debug("Parent component mehtod exsists {$MethodtoCall}: " . get_class($cParent), "blue");
             call_user_func(array($cParent, $MethodtoCall), &$objResponse, &$this, $fjid);
             break;
         } else {
             $cParent =& $cParent->wParent;
         }
     }
     return $objResponse;
 }