public function __construct($task_id = 0) { parent::__construct(); $this->_taskds = new EDS('\\ZippyERP\\ERP\\Entity\\Task'); $this->add(new Panel('listtab')); $this->listtab->add(new Form('filterform'))->setSubmitHandler($this, 'OnFilter'); $this->listtab->filterform->add(new DropDownChoice('filterproject', Project::findArray('projectname'), 0)); $this->listtab->filterform->add(new DropDownChoice('filterassignedto', Task::getAssignedList(), 0)); $this->listtab->filterform->add(new DropDownChoice('filterstatus', Task::getStatusList(), -1)); $this->listtab->filterform->add(new DropDownChoice('filtersorting')); //форма поиска по коду $this->listtab->add(new Form('searchform'))->setSubmitHandler($this, 'OnSearch'); $this->listtab->searchform->add(new TextInput('searchcode')); $this->listtab->add(new DataView('tasklist', $this->_taskds, $this, 'tasklistOnRow')); $this->add(new Panel('contenttab'))->setVisible(false); $this->contenttab->add(new Label('showtaskname')); $this->contenttab->add(new Form('editform'))->setSubmitHandler($this, 'OnEdit'); $this->contenttab->editform->add(new DropDownChoice('editstatus', Task::getStatusList(), 0)); $this->contenttab->editform->add(new DropDownChoice('editassignedto', Task::getAssignedList(), 0)); $this->contenttab->add(new DataView('dw_msglist', new ArrayDataSource(new Prop($this, '_msglist')), $this, 'dw_msglistOnRow')); $this->contenttab->add(new Form('addmsgform'))->setSubmitHandler($this, 'OnMsgSubmit'); $this->contenttab->addmsgform->add(new TextArea('addmsg')); $this->contenttab->add(new DataView('dw_files', new ArrayDataSource(new Prop($this, '_fileslist')), $this, 'dw_filesOnRow')); $this->contenttab->add(new Form('addfileform'))->setSubmitHandler($this, 'OnFileSubmit'); $this->contenttab->addfileform->add(new File('addfile')); $this->contenttab->addfileform->add(new TextInput('adddescfile')); $this->contenttab->add(new ClickLink('tolist'))->setClickHandler($this, 'tolistOnClick'); //$this->_taskds->setWhere('task_id=' . ($task_id > 0 ? $task_id : 0 )); //$this->listtab->tasklist->Reload(); if ($task_id > 0) { $this->_task = Task::load($task_id); $this->OpenTask(); } }
public function OnGantt($sender, $eventdata) { $action = $eventdata['action']; $task = Task::load($eventdata['id']); if ($action == "drag") { $task->start_date = $eventdata['start']; $task->end_date = $eventdata['end']; $task->save(); } if ($action == "resize") { $task->start_date = $eventdata['start']; $task->end_date = $eventdata['end']; $task->hours = ($task->end_date - $task->start_date) / 3600; $task->updated = time(); $task->save(); } }