Esempio n. 1
0
 public function update($tID)
 {
     $json = Loader::helper('json');
     $tJSON = $json->decode(file_get_contents("php://input"));
     $t = \Concrete\Package\Formify\Src\FormifyTemplate::get($tID);
     foreach ($tJSON as $property => $value) {
         $t->set($property, $value);
     }
 }
Esempio n. 2
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);
         }
     }
 }
 public function send($record)
 {
     $this->record = $record;
     $to = $this->getDestination();
     $from = $this->from;
     $fromName = $this->fromName;
     $subject = $this->subject;
     $t = \Concrete\Package\Formify\Src\FormifyTemplate::get($this->tID);
     $html = $t->render($record, true);
     if ($to != '' && $subject != '') {
         if ($this->verifyCondition()) {
             $mh = Loader::helper('mail');
             $mh->to($to);
             $mh->from($from, $fromName);
             $mh->setSubject($subject);
             $mh->setBodyHTML($html);
             @$mh->sendMail();
         }
     }
 }