Exemplo n.º 1
0
 public function view()
 {
     if ($r = \Concrete\Package\Formify\Src\FormifyRecord::get($_GET['rID'][$this->bID])) {
         $records[] = $r;
         $template = \Concrete\Package\Formify\Src\FormifyTemplate::get($this->detailTemplateID);
     } elseif ($r = \Concrete\Package\Formify\Src\FormifyRecord::get($_GET['rID'][0])) {
         $records[] = $r;
         $template = \Concrete\Package\Formify\Src\FormifyTemplate::get($this->detailTemplateID);
     } elseif ($rs = \Concrete\Package\Formify\Src\FormifyRecordSet::get($this->fID)) {
         if ($this->requireApproval) {
             $rs->requireApproval();
         }
         if ($this->requireOwnership) {
             $rs->requireOwnership();
         }
         if ($this->sortBy) {
             $rs->setSortField($this->sortBy);
         }
         if ($this->sortOrder != '') {
             $rs->setSortOrder($this->sortOrder);
         }
         if ($_GET['ccm_paging_p'] == '') {
             $rs->setPage(1);
         } else {
             $rs->setPage(intval($_GET['ccm_paging_p']));
         }
         $rs->setPageSize(intval($this->pageSize));
         if ($this->includeExpired) {
             $rs->includeExpired();
         }
         $records = $rs->getRecords();
         $template = \Concrete\Package\Formify\Src\FormifyTemplate::get($this->listTemplateID);
     }
     if ($this->detailDestination == 'page' && intval($this->detailCID) > 0) {
         $template->setDetailCollectionID($this->detailCID);
         $template->setBlockID(0);
     } else {
         $template->setBlockID($this->bID);
     }
     if ($records && $template) {
         $this->set('records', $records);
         $this->set('template', $template);
     }
     if ($this->displayPaginator && intval($this->pageSize) > 0) {
         $fullRecordSet = $rs;
         $fullRecordSet->setPageSize(0);
         $fullRecordSet->clearRecords();
         $allRecords = $fullRecordSet->getRecords();
         if (count($allRecords) > count($records)) {
             $pageBase = Page::getCurrentPage()->getCollectionLink();
             $paginator = $this->createPagination($pageBase, count($allRecords), $this->pageSize, $rs->getPage());
             $this->set('paginator', $paginator);
         }
     }
 }
Exemplo n.º 2
0
 public function view()
 {
     $this->requireAsset('redactor');
     $f = \Concrete\Package\Formify\Src\FormifyForm::get($this->fID);
     $this->set('f', $f);
     $this->set('context', $this->context);
     $r = \Concrete\Package\Formify\Src\FormifyRecord::getWithToken($this->rID, $this->token);
     if (is_object($r)) {
         $fields = $f->getFields();
         foreach ($fields as $key => $ff) {
             if ($r->getAnswerValue($ff->ffID) != '') {
                 $fields[$key]->defaultValue = $r->getAnswerValue($ff->ffID);
             }
         }
         $this->set('rID', $this->rID);
         $this->set('token', $this->token);
     }
     $html = Loader::helper('html');
     $this->addHeaderItem($html->css('font-awesome.css'));
 }
Exemplo n.º 3
0
 function getRecords($source = 'cache')
 {
     if (!$this->isPrePopulated) {
         //If the record list has not been pre populated, do so now
         $this->getRecordData();
     }
     //Get the record data according to the records returned in prePopulate
     $records = array();
     foreach ($this->records as $rData) {
         if ($this->source == 'cache') {
             $records[] = \Concrete\Package\Formify\Src\FormifyRecord::getFromArray($rData);
         } else {
             $r = \Concrete\Package\Formify\Src\FormifyRecord::get($rData['rID'], 'db');
             $r->cache();
         }
     }
     return $records;
 }
Exemplo n.º 4
0
 public function addRecord()
 {
     return \Concrete\Package\Formify\Src\FormifyRecord::create($this->fID);
 }
Exemplo n.º 5
0
 public function pend($rID)
 {
     $r = \Concrete\Package\Formify\Src\FormifyRecord::get($rID);
     $r->pend();
 }