public function listAction() { $pages = new Pages($this->getSiteId()); $localString = new LocalString($this->getSiteId()); $langs = $localString->getLangs(); if ($this->_hasParam('lang') && $this->_getParam('lang') != 0) { $this->tplVars['content']['lang'] = $this->_getParam('lang'); $pagesList = $pages->getPagesList($this->_getParam('lang')); } else { $pagesList = $pages->getPagesList(); } for ($i = 0; $i < count($pagesList); $i++) { $pagesList[$i]['lang_code'] = $langs[$pagesList[$i]['pg_lang']]['code']; $pagesList[$i]['lang'] = strtoupper($langs[$pagesList[$i]['pg_lang']]['code']); } $this->tplVars['content']['pagesList'] = $pagesList; array_push($this->viewIncludes, 'content/contentPagesList.tpl'); }
/** * garbagecat@eltima.com /22.08.2014 * Function add no exist lstrings for site in export page * @source array */ public function addLstringsNotExist($data = null) { $callback = ''; if (isset($data) && count($data)) { $localString = new LocalString($this->siteId); foreach ($data as $params) { $result = $localString->addString($params); if (!$result) { $callback .= "<br/>error to insert lstring {$params['nick']}<br/>"; } } } return $callback; }
public function cloneAction() { $localString = new LocalString($this->getSiteId()); $langs = $localString->getLangs(); $pagesList = $this->pages->getPagesList(); if ($this->_request->isPost()) { $sourceId = $this->_request->getPost('source_id'); $targetId = $this->_request->getPost('target_id'); $clonePageData = $this->_request->getPost('page_data'); $clonePageMeta = $this->_request->getPost('page_meta'); if (strlen($sourceId) && strlen($targetId)) { $sourceId = intval($sourceId); $targetId = intval($targetId); if ($sourceId == $targetId) { $this->tplVars['cloner']['err']['equalIds'] = true; } if (!$this->pages->checkPageById($sourceId)) { $this->tplVars['cloner']['err']['sourceNotExist'] = true; } if (!$this->pages->checkPageById($targetId)) { $this->tplVars['cloner']['err']['targetNotExist'] = true; } $targetIds[0] = $targetId; } else { $sourceId = intval($this->_request->getPost('source')); // $targetId = intval($this->_request->getPost('target')); $targetIds = $this->_request->getPost('target'); if (!$targetIds) { $this->tplVars['cloner']['err']['targetNotExist'] = true; } else { foreach ($targetIds as $targetId) { if ($sourceId == intval($targetId)) { $this->tplVars['cloner']['err']['equalIds'] = true; } } } } if (!isset($this->tplVars['cloner']['err'])) { foreach ($targetIds as $targetId) { $this->to_log(); $this->pages->clonePage($sourceId, $targetId, isset($clonePageData) ? TRUE : FALSE, isset($clonePageMeta) ? TRUE : FALSE); } $this->tplVars['cloner']['hasBeenCloned'] = true; } } $this->tplVars['cloner']['langs'] = $langs; $this->tplVars['cloner']['pagesList'] = $pagesList; $this->tplVars['page_js'][] = 'jquery-1.8.3.js'; $this->tplVars['page_js'][] = 'select2.min.js'; $this->tplVars['page_css'][] = 'select2.css'; array_push($this->viewIncludes, 'pages/cloner.tpl'); }