Ejemplo n.º 1
0
 public static function rebuild_NestedInformation($parent, $left)
 {
     // the right value of this node is the left value + 1
     $right = $left + 1;
     // get all children of this node
     $TreeRecords = ActivityRecord::finder()->findAllByparent_idtm_activity($parent);
     if (count($TreeRecords) >= 1) {
         foreach ($TreeRecords as $TreeRecord) {
             // recursive execution of this function for each
             // child of this node
             // $right is the current right value, which is
             // incremented by the rebuild_tree function
             $right = PFDBActivityTools::rebuild_NestedInformation($TreeRecord->idtm_activity, $right);
         }
     }
     // we've got the left value, and now that we've processed
     // the children of this node we also know the right value
     if ($parent != 0) {
         $TreeChangeRecord = ActivityRecord::finder()->findByidtm_activity($parent);
         $TreeChangeRecord->act_lft = $left;
         $TreeChangeRecord->act_rgt = $right;
         $TreeChangeRecord->save();
         unset($TreeChangeRecord);
     }
     // return the right value of this node + 1
     return $right + 1;
 }
Ejemplo n.º 2
0
 public function SavedButtonClicked($sender, $param)
 {
     $tempus = 'ed' . $this->primarykey;
     if ($this->edactivity_edit_status->Text == '1') {
         $EditRecord = ActivityRecord::finder()->findByPK($this->{$tempus}->Text);
     } else {
         $EditRecord = new ActivityRecord();
     }
     //DATUM
     foreach ($this->datfields as $recordfield) {
         $edrecordfield = 'ed' . $recordfield;
         $EditRecord->{$recordfield} = date('Y-m-d', $this->{$edrecordfield}->Timestamp);
     }
     //BOOL
     foreach ($this->boolfields as $recordfield) {
         $edrecordfield = 'ed' . $recordfield;
         $EditRecord->{$recordfield} = $this->{$edrecordfield}->Checked ? 1 : 0;
     }
     //LIST
     foreach ($this->listfields as $recordfield) {
         $edrecordfield = 'ed' . $recordfield;
         $EditRecord->{$recordfield} = $this->{$edrecordfield}->Text;
     }
     //NON DATUM
     foreach ($this->fields as $recordfield) {
         $edrecordfield = 'ed' . $recordfield;
         $EditRecord->{$recordfield} = $this->{$edrecordfield}->Text;
     }
     $EditRecord->save();
     $idtm_activity = $EditRecord->idtm_activity;
     $this->initWindowLink($idtm_activity);
     $this->initPullDowns($idtm_activity);
     $this->initRelations($idtm_activity);
     //los aufgabos
     $this->Tedauf_id->Text = $idtm_activity;
     $this->Iedino_id->Text = $idtm_activity;
     $this->edidtm_activity->Text = $idtm_activity;
     if ($this->edactivity_edit_status->Text == '0') {
         //$idta_activity_type = $this->edidta_activity_type->Text;
         $act_name = $this->edact_name->Text;
         $this->getPage()->getClientScript()->registerEndScript('xinsert', "tree.insertNewChild(tree.getSelectedItemId()||0,{$idtm_activity},'{$act_name}')");
         PFDBActivityTools::rebuild_NestedInformation(0, 1);
     }
     $this->edactivity_edit_status->Text = '1';
     $this->edActivityActivitybindList($idtm_activity);
     $this->edActivityZielebindList();
     $this->edActivityInoutputbindList();
     $this->bindListInterface();
     $this->bindActivityProtokollListe($idtm_activity);
     $this->edparent_idtm_activity->Text = $EditRecord->parent_idtm_activity;
 }