function process() { $this->_content = array(); $this->_content['label'] = $this->getAttribute('label'); $this->_content['cssClass'] = $this->getAttribute('cssClass'); $this->_content['current'] = ''; $this->_content['records'] = array(); $iterator = org_glizy_ObjectFactory::createModelIterator('org.glizycms.core.models.Language'); $iterator->orderBy('language_order'); if ($iterator->count()) { $editLanguageId = $this->_application->getEditingLanguageId(); foreach ($iterator as $ar) { if ($ar->language_id == $editLanguageId) { $this->_content['current'] = $ar->language_name; continue; } $url = org_glizy_helpers_Link::addParams(array('switchLanguage' => $ar->language_id)); $this->_content['records'][] = org_glizy_helpers_Link::makeSimpleLink(glz_encodeOutput($ar->language_name), $url, $ar->language_name); } } }
function getJSAction($action, $forceUrl = true) { $pageId = $this->_application->getPageId(); $targetPage = $this->getAttribute('targetPage'); if (!is_null($targetPage)) { $pageId = $this->getAttribute('targetPage'); } if ($forceUrl) { $url = '\'' . org_glizy_helpers_Link::makeUrl('link', array('pageId' => $pageId), array($this->_stateName => $action)) . '\''; } else { $url = '\'' . org_glizy_helpers_Link::addParams(array($this->_stateName => $action)) . '\''; } return $url; }
/** * @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]; }