function setFilterValue($name, $value, $originalValue = null) { $this->_filters[$name] = $value; if (!is_null($this->sessionEx)) { $this->sessionEx->set($name, is_null($originalValue) ? $value : $originalValue, $this->rememberMode); } }
public function execute($hash, $authorName, $authorEmail, $text, $captcha) { $valid = true; $error = ''; if (!($hash && $authorName && $authorEmail && $text && $captcha)) { $valid = false; $error = 'Wrong input'; } if ($valid && !filter_var($authorEmail, FILTER_VALIDATE_EMAIL)) { $valid = false; $error = 'Wrong email'; } $sessionEx = new org_glizy_SessionEx($this->application->getPageId()); $verCaptcha = $sessionEx->get('captcha' . $hash); if ($valid && $verCaptcha != $captcha) { $valid = false; $error = 'Wrong verify code'; } if ($valid) { $ar = org_glizy_ObjectFactory::createModel('movio.modules.storyteller.models.Comment'); $ar->hash = $hash; $ar->menuId = $this->application->getPageId(); $ar->authorName = $authorName; $ar->authorEmail = $authorEmail; $ar->approved = 1; $ar->date = new org_glizy_types_Date(); $ar->text = nl2br($text); $ar->save(); $sessionEx->remove($hash . '_author'); $sessionEx->remove($hash . '_email'); $sessionEx->remove($hash . '_text'); $sessionEx->remove($hash . '_error'); $destHash = '#comments_' . $hash; } else { $sessionEx->set($hash . '_author', $authorName); $sessionEx->set($hash . '_email', $authorEmail); $sessionEx->set($hash . '_text', $text); $sessionEx->set($hash . '_error', $error); $destHash = '#form_' . $hash; } $this->goHere(null, $destHash); }
/** * @param $records * * @return mixed */ function splitTextResult($records) { $records = $this->htmlParsingSplitter($records, 'hr'); $this->pageUrl = GLZ_PAGINATE_PAGE; // TODO sostituire con un attributo $currentPage = $this->_sessionEx->get($this->pageUrl, '1', true, true); //org_glizy_Request::get($this->pageUrl, '1'); if ($currentPage - 1 >= count($records)) { $currentPage = 1; } $this->_sessionEx->set($this->pageUrl, $currentPage); $this->resetContent(); $this->_content['pagesLinks'] = array(); $this->_content['pageLength'] = 1; $this->_content['currentPage'] = $currentPage; $result = array(); if ($currentPage == "ALL" || !count($records)) { $this->_content['start'] = 0; $this->_content['stop'] = count($records) - 1; $this->_content['totalPages'] = 0; $result = $records; } else { $this->_content['start'] = $currentPage - 1; $this->_content['stop'] = $this->_content['start']; $this->_content['totalPages'] = count($records); $result = array_slice($records, $this->_content['start'], 1); } if ($this->_content['totalPages'] > 1) { for ($i = 1; $i <= $this->_content['totalPages']; $i++) { $tempArray = array(); $tempArray['__cssClass__'] = ''; $tempArray['__url__'] = ''; $tempArray['value'] = $i; if ($i == $this->_content['totalPages']) { $tempArray['__cssClass__'] = "last"; } if ($currentPage != $i) { $tempArray['__url__'] = org_glizy_helpers_Link::addParams(array($this->getId() . '_' . $this->pageUrl => $i)); } $this->_content['pagesLinks'][] = $tempArray; } } if ($this->getAttribute('showTotal')) { $this->_content['totalRecords'] = count($records); } return $result[0]; }