public function edit_staticpages() { // Set Pagetitle and Breadcrumbs Clansuite_Breadcrumb::add(_('Edit'), '/staticpages/admin/edit'); $info['html'] = $_POST['html']; $info['description'] = $_POST['description']; $info['title'] = $_POST['title']; $info['orig_title'] = $_POST['orig_title']; $info['url'] = $_POST['url']; $info['iframe'] = $_POST['iframe']; $info['iframe_height'] = $_POST['iframe_height']; $info['submit'] = $_POST['submit']; $info['id'] = $_POST['id']; if (!empty($info['submit'])) { if (empty($info['description']) or empty($info['title'])) { $error['fill_form'] = 1; } if ((!$input->check($info['description'], 'is_abc|is_int|is_custom', '_\\s') or !$input->check($info['title'], 'is_abc|is_int|is_custom', '_\\s') or !$input->check($info['iframe_height'], 'is_int')) and !$error['fill_form']) { $error['no_special_chars'] = 1; } if (!$input->check($info['url'], 'is_url') and !empty($url)) { $error['give_correct_url'] = 1; } $entity = $this->getModel()->findOneBySlug($slug); if ($entity === null) { throw new Clansuite_Exception('Unable to find the requested Page: ' . $slug); } Clansuite_Debug::firebug($entity); #$page = Doctrine::getTable('CsStaticPages')->findOneBy('title', $title); if (is_array($page) and $info['orig_title'] != $info['title']) { $error['static_already_exist'] = 1; } if (count($error) == 0) { $page->title = $info['title']; $page->description = $info['description']; $page->url = $info['url']; $page->html = $info['html']; $page->iframe = $info['iframe']; $page->iframe_height = $info['iframe_height']; $page->save(); $this->setFlashmessage('success', _('The page was successfully modified.')); $this->redirect('/controlcenter/staticpages&action=show'); } } else { // $info } $view = $this->getView(); $view->assign('error', $error); $view->assign('info', $info); $view->setLayoutTemplate('index.tpl'); $this->display(); }
public function action_admin_update() { if (false === ($this->request->getRequestMethod() == 'POST')) { return; } Clansuite_Debug::dump($this->request->getPost(), false); $locale_msgstr_array = $this->request->getParameterFromPost('locale_form'); $locale = $this->request->getParameterFromPost('locale'); $module = $this->request->getParameterFromPost('module'); var_dump($locale_msgstr_array); /** * Fetch the po file data of the target locale. */ include ROOT_FRAMEWORK . 'gettext/po.gettext.php'; $target_locale_pofile = $this->getModulePOFilename($module, $locale); $target_locale_data = Gettext_PO_File::read($target_locale_pofile); /** * $locale_msgstr_array is the following relation: * * msgid is the string in english as an identifier. * msgstr is the translation string to use for the identifier. * * msgid = 'house' (english) * msgstr = 'haus' (german) */ $added_counter = 0; $updated_counter = 0; foreach ($locale_msgstr_array as $msgid => $msgstr) { // only add something, if we got a translation string for this msgid if ($msgstr != '') { // if the msgstr already exists, then it's an update if (true === isset($target_locale_data[$msgid])) { $updated_counter = $updated_counter + 1; } else { // a new language string is added $added_counter = $added_counter + 1; } $target_locale_data[$msgid]['msgid'] = $msgid; $target_locale_data[$msgid]['msgstr'] = $msgstr; // @todo add plural strings #$target_locale_data[$msgid]['msgstr'] = array(0 => $msgstr); } } Clansuite_Debug::dump($target_locale_data); /*$msg = sprintf('Locale %s of Module %s updated. Added %s new language items. Updated %s language items.', $locale, $module, $added_counter, $updated_counter); $this->setFlashmessage('success', $msg);*/ }
/** * module news action_showone() * * Show one single news with comments */ public function action_showone($params) { // Get Render Engine $view = $this->getView(); #Clansuite_Debug::firebug($params); $news_id = (int) $params['id']; #(int) $this->request->getParameterFromGet('id'); if ($news_id === null) { $news_id = 1; } // fetch the news to update by news_id // $news = $this->getModel()->find($data['news_id']); $news = $this->getModel()->fetchSingleNews($news_id); Clansuite_Debug::printR($news); // if a news was found if (!empty($news) && is_array($news)) { // Set Pagetitle and Breadcrumbs Clansuite_Breadcrumb::replace(_('Show News'), '/news/show', 1); Clansuite_Breadcrumb::add(_('Viewing Single News: ') . $news['news_title'], '/index.php?mod=news&action=show'); $view->assign('news', $news); } else { // no news found for this id $view->setTemplate('newsnotfound.tpl'); } // Prepare Output $this->display(); }