/** * Validation d'une cat�gorie. */ public function doValidCategory() { $id_blog = $this->getRequest('id_blog', null); if ($id_blog == null) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('blog.error.param'), 'back' => CopixUrl::get('blog|admin|listBlog'))); } if (!BlogAuth::canMakeInBlog('ADMIN_CATEGORIES', create_blog_object($id_blog))) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('blog.error.cannotManageCategory'), 'back' => CopixUrl::get('blog|admin|listBlog'))); } $tpl = new CopixTpl(); $categoryDAO = CopixDAOFactory::create('blog|blogarticlecategory'); $id_bacg = $this->getRequest('id_bacg', null); if (strlen($id_bacg) == 0) { $id_bacg = null; } if ($id_bacg != null) { // EDITION D'UNE CATEGORIE $category = $categoryDAO->get($id_bacg); $category->id_blog = $id_blog; $category->name_bacg = $this->getRequest('name_bacg'); $category->url_bacg = $this->getRequest('url_bacg'); if (strlen($category->url_bacg) == 0) { $category->url_bacg = killBadUrlChars($category->name_bacg); } $tpl->assign('TITLE_PAGE', CopixI18N::get('blog.get.edit.category.title')); $errors = _dao('blog|blogarticlecategory')->check($category); if ($errors != 1) { // Traitement des erreurs $showErrors = true; } else { // Modification dans la base $categoryDAO->update($category); return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('blog|admin|showBlog', array("id_blog" => $id_blog, "kind" => $this->getRequest('kind', '0')))); } } else { // CREATION D'UNE CATEGORIE $category = CopixDAOFactory::createRecord('blogarticlecategory'); $category->id_blog = $id_blog; $category->name_bacg = $this->getRequest('name_bacg'); $category->order_bacg = $categoryDAO->getNewPos($id_blog); $category->url_bacg = killBadUrlChars($category->name_bacg); if (strlen($category->url_bacg) == 0) { $category->url_bacg = killBadUrlChars($category->name_bacg); } $tpl->assign('TITLE_PAGE', CopixI18N::get('blog.get.create.category.title')); $errors = _dao('blog|blogarticlecategory')->check($category); if ($errors != 1) { // Traitement des erreurs $showErrors = true; } else { // Insertion dans la base $categoryDAO->insert($category); $category->url_bacg = killBadUrlChars($category->id_bacg . '-' . $category->name_bacg); $categoryDAO->update($category); return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('blog|admin|showBlog', array("id_blog" => $id_blog, "kind" => $this->getRequest('kind', '0')))); } } $tpl->assign('MAIN', CopixZone::process('EditCategory', array('id_blog' => $id_blog, 'id_bacg' => $id_bacg, 'category' => $category, 'errors' => $errors, 'showErrors' => $showErrors, 'kind' => $this->getRequest('kind', '0')))); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }
/** * Validation d'une catégorie. */ public function doValidRss() { $id_blog = $this->getRequest('id_blog', null); if ($id_blog == null) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('blog.error.param'), 'back' => CopixUrl::get('blog|admin|listBlog'))); } if (!BlogAuth::canMakeInBlog('ADMIN_RSS', create_blog_object($id_blog))) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('blog.error.cannotManageRss'), 'back' => CopixUrl::get('blog|admin|listBlog'))); } $tpl = new CopixTpl(); $fluxRssDAO = CopixDAOFactory::create('blog|blogfluxrss'); $id_bfrs = $this->getRequest('id_bfrs', null); if (strlen($id_bfrs) == 0) { $id_bfrs = null; } if ($id_bfrs != null) { // EDITION D'UNE Link $fluxRss = $fluxRssDAO->get($id_bfrs); $fluxRss->id_blog = $id_blog; $fluxRss->name_bfrs = $this->getRequest('name_bfrs'); $fluxRss->url_bfrs = $this->getRequest('url_bfrs'); $tpl->assign('TITLE_PAGE', CopixI18N::get('blog.get.edit.rss.title')); $errors = _dao('blog|blogfluxrss')->check($fluxRss); if ($errors != 1) { // Traitement des erreurs $showErrors = true; } else { // Modification dans la base $fluxRssDAO->update($fluxRss); return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('blog|admin|showBlog', array("id_blog" => $id_blog, "kind" => $this->getRequest('kind', '0')))); } } else { // CREATION D'UNE Link $fluxRss = CopixDAOFactory::createRecord('blogfluxrss'); $fluxRss->id_blog = $id_blog; $fluxRss->name_bfrs = $this->getRequest('name_bfrs'); $fluxRss->url_bfrs = $this->getRequest('url_bfrs'); $fluxRss->order_bfrs = $fluxRssDAO->getNewPos($id_blog); $tpl->assign('TITLE_PAGE', CopixI18N::get('blog.get.create.rss.title')); $errors = _dao('blog|blogfluxrss')->check($fluxRss); if ($errors != 1) { // Traitement des erreurs $showErrors = true; } else { // Insertion dans la base $fluxRssDAO->insert($fluxRss); return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('blog|admin|showBlog', array("id_blog" => $id_blog, "kind" => $this->getRequest('kind', '0')))); } } $tpl->assign('MAIN', CopixZone::process('EditRss', array('id_blog' => $id_blog, 'id_brfs' => $id_bfrs, 'fluxRss' => $fluxRss, 'errors' => $errors, 'showErrors' => $showErrors, 'kind' => $this->getRequest('kind', '0')))); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }
public function _createContent(&$toReturn) { //Getting the user. //Create Services, and DAO CopixHTMLHeader::addCSSLink(_resource("styles/module_blog_admin.css")); CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/module_blog.js'); $tpl = new CopixTpl(); $id_blog = $this->getParam('id_blog', ''); $tpl->assign('article', $this->getParam('article', null)); $tpl->assign('kind', $this->getParam('kind', null)); $tpl->assign('id_blog', $id_blog); $tpl->assign('id_bact', $this->getParam('id_bact', '')); $tpl->assign('errors', $this->getParam('errors', '')); $tpl->assign('showErrors', $this->getParam('showErrors', false)); $tpl->assign('preview', $this->getParam('preview', '0')); $tpl->assign('tabArticleCategory', $this->getParam('tabArticleCategory', null)); $tpl->assign('can_format_articles', CopixConfig::get('blog|blog.default.can_format_articles')); $tpl->assign('default_format_articles', CopixConfig::get('blog|blog.default.default_format_articles')); $formats = CopixConfig::get('blog|blog.formats_articles'); $tabFormats = explode(',', $formats); $values = $output = array(); foreach ($tabFormats as $k) { $values[] = $k; $output[] = CopixI18N::get('blog|blog.default_format_articles.' . $k); } $tpl->assign('format_bact', array('values' => $values, 'output' => $output)); $art = $this->getParam('article'); $tpl->assign('edition_sumary', CopixZone::process('kernel|edition', array('field' => 'sumary_bact', 'format' => $art->format_bact, 'content' => $art->sumary_bact, 'options' => array('toolbarSet' => 'IconitoBlog'), 'object' => array('type' => 'MOD_BLOG', 'id' => $this->getParam('id_blog')), 'height' => 160))); $tpl->assign('edition_content', CopixZone::process('kernel|edition', array('field' => 'content_bact', 'format' => $art->format_bact, 'content' => $art->content_bact, 'options' => array('toolbarSet' => 'IconitoBlog'), 'object' => array('type' => 'MOD_BLOG', 'id' => $this->getParam('id_blog')), 'height' => 290))); //cat�gorie de l'article if ($this->getParam('kind', null) == 1) { $article = $this->getParam('article', null); $idCategorie = $article->tabSelectCat[0]; foreach ($this->getParam('tabArticleCategory', null) as $key => $obj) { if ($obj->id_bacg == $idCategorie) { $categorie = $obj->name_bacg; } } $tpl->assign('categorie', $categorie); } $tpl->assign('canWriteOnline', BlogAuth::canMakeInBlog('ADMIN_ARTICLE_MAKE_ONLINE', create_blog_object($id_blog))); // retour de la fonction : $toReturn = $tpl->fetch('article.edit.tpl'); return true; }
public function _createContent(&$toReturn) { //Getting the user. //Create Services, and DAO $tpl = new CopixTpl(); $id_blog = $this->getParam('id_blog', ''); $tpl->assign('resultats', $this->getParam('resultats', null)); $tpl->assign('id_bact', $this->getParam('id_bact', '')); $tpl->assign('id_blog', $id_blog); $tpl->assign('errors', $this->getParam('errors', null)); $tpl->assign('showErrors', $this->getParam('showErrors', false)); $tpl->assign('toEdit', $this->getParam('toEdit', false)); //capability $tpl->assign('canManageComment', BlogAuth::canMakeInBlog('ADMIN_COMMENTS', create_blog_object($id_blog))); // retour de la fonction : $toReturn = $tpl->fetch('comment.list.tpl'); return true; }
public function _createContent(&$toReturn) { //Getting the user. //Create Services, and DAO CopixHTMLHeader::addCSSLink(_resource("styles/module_blog_admin.css")); CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/module_blog.js'); $tpl = new CopixTpl(); $id_blog = $this->getParam('id_blog', ''); $tpl->assign('page', $this->getParam('page', null)); $tpl->assign('id_blog', $this->getParam('id_blog', '')); $tpl->assign('id_bpge', $this->getParam('id_bpge', '')); $tpl->assign('errors', $this->getParam('errors', '')); $tpl->assign('showErrors', $this->getParam('showErrors', '')); $tpl->assign('preview', $this->getParam('preview', '0')); $tpl->assign('kind', $this->getParam('kind', '0')); $tpl->assign('can_format_articles', CopixConfig::get('blog|blog.default.can_format_articles')); $tpl->assign('default_format_articles', CopixConfig::get('blog|blog.default.default_format_articles')); //$tpl->assign ('wikibuttons', CopixZone::process ('kernel|wikibuttons', array('field'=>'content_bpge', 'object'=>array('type'=>'MOD_BLOG', 'id'=>$this->getParam('id_blog'))))); $formats = CopixConfig::get('blog|blog.formats_articles'); $tabFormats = explode(',', $formats); $values = $output = array(); foreach ($tabFormats as $k) { $values[] = $k; $output[] = CopixI18N::get('blog|blog.default_format_articles.' . $k); } $tpl->assign('format_bpge', array('values' => $values, 'output' => $output)); $pag = $this->getParam('page'); //print_r($pag); if (!isset($pag->content_bpge)) { $pag->content_bpge = ''; } //$content = (isset($pag->content_bpge)) ? $pag->content_bpge : ''; //$tpl->assign ('content_bpge', CopixZone::process ('kernel|edition', array('field'=>'content_bpge', 'format'=>'wiki', 'content'=>$content, 'object'=>array('type'=>'MOD_BLOG', 'id'=>$this->getParam('id_blog')), 'height'=>290))); $tpl->assign('edition_content', CopixZone::process('kernel|edition', array('field' => 'content_bpge', 'format' => $pag->format_bpge, 'content' => $pag->content_bpge, 'object' => array('type' => 'MOD_BLOG', 'id' => $this->getParam('id_blog')), 'height' => 290))); $tpl->assign('canWriteOnline', BlogAuth::canMakeInBlog('ADMIN_ARTICLE_MAKE_ONLINE', create_blog_object($id_blog))); // retour de la fonction : $toReturn = $tpl->fetch('page.edit.tpl'); return true; }
/** * Validation d'une cat�gorie. */ public function doValidModifyComment() { $id_blog = $this->getRequest('id_blog', null); if (strlen($id_blog) == 0) { $id_blog = null; } $id_bact = $this->getRequest('id_bact', null); if (strlen($id_bact) == 0) { $id_bact = null; } $id_bacc = $this->getRequest('id_bacc', null); if (strlen($id_bacc) == 0) { $id_bacc = null; } if ($id_blog == null || $id_bact == null || $id_bacc == null) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('blog.error.param'), 'back' => CopixUrl::get('blog|admin|listBlog'))); } if (!BlogAuth::canMakeInBlog('ADMIN_COMMENTS', create_blog_object($id_blog))) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('blog.error.cannotManageComment'), 'back' => CopixUrl::get('blog|admin|listBlog'))); } $tpl = new CopixTpl(); $commentDAO = CopixDAOFactory::create('blog|blogarticlecomment'); // EDITION D'UNE CATEGORIE $comment = $commentDAO->get($id_bacc); $this->_validFromPostProperties($comment); $tpl->assign('TITLE_PAGE', CopixI18N::get('blog.get.edit.comment.title')); $errors = _dao('blog|blogarticlecomment')->check($comment); if ($errors != 1) { // Traitement des erreurs $showErrors = true; } else { // Modification dans la base $commentDAO->update($comment); return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('blog|admin|listComment', array("id_blog" => $id_blog, "id_bact" => $id_bact))); } $articleDAO = CopixDAOFactory::create('blog|blogarticle'); $article = $articleDAO->get($id_bact); $comment->name_bact = $article->name_bact; $comment->time_bacc = BDToTime($comment->time_bacc); $tpl->assign('MAIN', CopixZone::process('EditComment', array('id_blog' => $id_blog, 'id_bact' => $id_bact, 'id_bacc' => $id_bacc, 'comment' => $comment, 'errors' => $errors, 'showErrors' => $showErrors))); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }
/** * Validation d'une page. */ public function doValidPage() { $id_blog = $this->getRequest('id_blog', null); $go = $this->getRequest('go', 'preview'); //die ("go=$go"); if ($id_blog == null) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('blog.error.param'), 'back' => CopixUrl::get('blog|admin|listBlog'))); } if (!BlogAuth::canMakeInBlog('ADMIN_PAGES', create_blog_object($id_blog))) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('blog.error.cannotManagePage'), 'back' => CopixUrl::get('blog|admin|listBlog'))); } $tpl = new CopixTpl(); $showErrors = false; $pageDAO = CopixDAOFactory::create('blog|blogpage'); $id_bpge = $this->getRequest('id_bpge', null); if (strlen($id_bpge) == 0) { $id_bpge = null; } // On r�cup�re l'utilisateur connect� $user = BlogAuth::getUserInfos(); if ($id_bpge != null) { // EDITION D'UNE PAGE $page = $pageDAO->get($id_bpge); $this->_validFromPostProperties($page); $tpl->assign('TITLE_PAGE', CopixI18N::get('blog.get.edit.page.title')); $errors = _dao('blog|blogpage')->check($page); if ($errors != 1) { // Traitement des erreurs $showErrors = true; } elseif ($go == 'save') { // Modification dans la base $page->content_html_bpge = smarty_modifier_blog_format_article($page->content_bpge, $page->format_bpge); $pageDAO->update($page); return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('blog|admin|showBlog', array("id_blog" => $id_blog, "kind" => $this->getRequest('kind', '0')))); } } else { // CREATION D'UNE PAGE $page = CopixDAOFactory::createRecord('blogpage'); $this->_validFromPostProperties($page); $page->order_bpge = $pageDAO->getNewPos($id_blog); $page->date_bpge = date('Ymd'); $page->author_bpge = $user->userId; $tpl->assign('TITLE_PAGE', CopixI18N::get('blog.get.create.page.title')); $errors = _dao('blog|blogpage')->check($page); if ($errors != 1) { // Traitement des erreurs $showErrors = true; } elseif ($go == 'save') { // Insertion dans la base $page->content_html_bpge = smarty_modifier_blog_format_article($page->content_bpge, $page->format_bpge); $pageDAO->insert($page); $page->url_bpge = killBadUrlChars($page->id_bpge . '-' . $page->name_bpge); $pageDAO->update($page); //on vide la session //$this->_setSessionPage(null); return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('blog|admin|showBlog', array("id_blog" => $id_blog, "kind" => $this->getRequest('kind', '0')))); } } $tpl->assign('MAIN', CopixZone::process('EditPage', array('id_blog' => $id_blog, 'id_bpge' => $id_bpge, 'page' => $page, 'errors' => $errors, 'showErrors' => $showErrors, 'kind' => $this->getRequest('kind', '0'), 'preview' => $go == 'preview' ? 1 : 0))); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }
/** * Suppression d'un article. */ public function doDeleteArticle() { $id_bact = $this->getRequest('id_bact', null); $id_blog = $this->getRequest('id_blog', null); if ($id_bact == null) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('blog.error.param'), 'back' => CopixUrl::get('blog|admin|listBlog'))); } $articleDAO =& CopixDAOFactory::create('blog|blogarticle'); if (!($toDelete = $articleDAO->get($id_bact))) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('blog.error.cannotFindBlog'), 'back' => CopixUrl::get('blog|admin|listBlog'))); } if (!BlogAuth::canMakeInBlog('ADMIN_ARTICLE_DELETE', create_blog_object($id_blog))) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.noRights'), 'back' => CopixUrl::get('blog||'))); } $urlReturn = CopixUrl::get('blog|admin|showBlog', array('id_blog' => $id_blog, 'kind' => $this->getRequest('kind', '0'), 'selectCategory' => $this->getRequest('selectCategory', ''), 'selectMonth' => $this->getRequest('selectMonth', ''))); if ($this->getRequest('confirm', null) != null) { $articleDAO->delete($toDelete); return new CopixActionReturn(COPIX_AR_REDIRECT, $urlReturn); } return CopixActionGroup::process('genericTools|messages::getConfirm', array('confirm' => CopixUrl::get('blog|admin|deleteArticle', array('id_bact' => $id_bact, 'id_blog' => $id_blog, 'kind' => $this->getRequest('kind', '0'), "selectCategory" => $this->getRequest('selectCategory', ''), "selectMonth" => $this->getRequest('selectMonth', ''), 'confirm' => 1)), 'cancel' => $urlReturn, 'message' => CopixI18N::get('blog.messages.confirmDeleteArticle'), 'title' => CopixI18N::get('blog.get.delete.article.title'))); }