예제 #1
0
파일: doclist.php 프로젝트: Niqpue/zippyerp
 /**
  *
  * @param mixed $docid  Документ  должен  быть  показан  в  просмотре
  * @return DocList
  */
 public function __construct($docid = 0)
 {
     parent::__construct();
     $filter = Filter::getFilter("doclist");
     if ($filter->to == null) {
         $filter->to = time();
         $filter->from = time() - 7 * 24 * 3600;
         $filter->page = 1;
     }
     $this->add(new Form('filter'))->setSubmitHandler($this, 'filterOnSubmit');
     $this->filter->add(new Date('from', $filter->from));
     $this->filter->add(new Date('to', $filter->to));
     $this->filter->add(new DropDownChoice('docgroup', H::getDocGroups()));
     $this->filter->add(new CheckBox('onlymy'))->setChecked($filter->onlymy == true);
     $this->filter->add(new TextInput('searchnumber'));
     if (strlen($filter->docgroup) > 0) {
         $this->filter->docgroup->setValue($filter->docgroup);
     }
     $doclist = $this->add(new DataView('doclist', new DocDataSource(), $this, 'doclistOnRow'));
     $doclist->setSelectedClass('success');
     $this->add(new Paginator('pag', $doclist));
     $doclist->setPageSize(10);
     $filter->page = $this->doclist->setCurrentPage($filter->page);
     $doclist->Reload();
     $this->add(new \ZippyERP\ERP\Blocks\DocView('docview'))->setVisible(false);
     if ($docid > 0) {
         $this->docview->setVisible(true);
         $this->docview->setDoc(Document::load($docid));
         $this->doclist->setSelectedRow($docid);
         $doclist->Reload();
     }
 }