Exemple #1
0
 public function executeIndex(sfWebRequest $request)
 {
     $this->articles = ArticleTable::getInstance()->getArticlesForWeekmail()->execute();
     $this->events = EventTable::getInstance()->getEventsForWeekmail()->execute();
     $this->weekmails = WeekmailTable::getInstance()->getLast()->execute();
     $this->current_weekmails = WeekmailTable::getInstance()->getCurrent()->execute();
 }
 public function executeSearch(sfWebRequest $request)
 {
     $text = $request->getParameter('search');
     $this->pager = new sfDoctrinePager('Article', sfConfig::get('app_max_blog_on_page'));
     $this->pager->setQuery(ArticleTable::getInstance()->getPublishedQueryWithSearch($text));
     $this->pager->setPage($request->getParameter('page', 1));
     $this->pager->init();
 }
Exemple #3
0
 public function executeList(sfWebRequest $request)
 {
     try {
         $this->asso = $this->getRoute()->getObject();
     } catch (Exception $e) {
         $this->forward('article', 'index');
     }
     $this->articles = ArticleTable::getInstance()->getArticlesList($this->asso->getPrimaryKey())->execute();
 }
Exemple #4
0
 public function executeArticles()
 {
     $this->articles = ArticleTable::getInstance()->getArticlesList($this->asso)->execute();
 }
Exemple #5
0
 public function executeArticles()
 {
     $this->asso = $this->getRoute()->getObject();
     $this->redirectUnless($this->asso, 'assos_list');
     $this->articles = ArticleTable::getInstance()->getArticlesList($this->asso)->execute();
 }
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $this->blogArticles = ArticleTable::getInstance()->getFourLastArticles();
     $this->sliderArticles = ArticleTable::getInstance()->getFourLastSliderArticles();
     $event = EventTable::getInstance()->findUpComingEvent();
 }
Exemple #7
0
 public function executeMyFlux()
 {
     $this->abonnements = ArticleTable::getInstance()->getAbonnementsFollowed($this->getUser()->getGuardUser()->getId());
 }
Exemple #8
0
 public function executeLastArticles()
 {
     $this->articles = ArticleTable::getInstance()->getLastArticles(5)->execute();
 }
Exemple #9
0
 public function delete($id)
 {
     parent::load('model', 'articles');
     parent::load('model', 'system/contrib/auth.User');
     $article = ArticleTable::getInstance()->find($id);
     /*
      * 判断是否有权限修改此类文章
      */
     $has_role = Category::has_role($article->Category->id, User::info());
     if (!$has_role || !User::has_role('人力资源') || !User::has_role('总经理')) {
         $this->smarty->display(403);
         Boot::shutdown();
     }
     if ($article) {
         $article->delete();
         $message = '删除成功';
     } else {
         $message = '文章不存在';
     }
     import('system/share/network/redirect');
     HTTPRedirect::flash_to('', $message, $this->smarty);
 }