当前位置: 首页>>代码示例>>PHP>>正文


PHP MessageManager::returnReceivedMessages方法代码示例

本文整理汇总了PHP中MessageManager::returnReceivedMessages方法的典型用法代码示例。如果您正苦于以下问题:PHP MessageManager::returnReceivedMessages方法的具体用法?PHP MessageManager::returnReceivedMessages怎么用?PHP MessageManager::returnReceivedMessages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MessageManager的用法示例。


在下文中一共展示了MessageManager::returnReceivedMessages方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: process

 public function process($parameters)
 {
     //do control panela maju pristup len prihlaseny uzivatelia
     $this->checkUser();
     $noticeManager = new NoticeManager();
     $userManager = new UserManager();
     $loggedUser = $userManager->returnUser();
     //zadane URL pre odhlasenie
     if (!empty($parameters[0]) && $parameters[0] == 'odhlasit') {
         $userManager->logOut();
         $this->redirect('prihlasenie');
     }
     //zadane URL pre zobrazenie rozpisanych clankov redaktora alebo admina
     if (!empty($parameters[0]) && $parameters[0] == 'moje-clanky') {
         //ak je prihlaseny redaktor alebo admin
         if ($loggedUser['admin'] == 1 || $loggedUser['admin'] == 2) {
             $articleManager = new ArticleManager();
             $unpublishedArticles = $articleManager->returnUnpublishedArticles();
             //vybratie iba tych nepublikovanych clankov, ktorych autor je momentalne prihlaseny uzivatel
             $userArticles = array();
             foreach ($unpublishedArticles as $article) {
                 if ($article['author'] == $loggedUser['name']) {
                     $userArticles[] = $article;
                 }
             }
             //ak nie su ziadne clanky na zobrazenie
             if (sizeof($userArticles) == 0) {
                 $this->createMessage('Žiadne články na zobrazenie', 'info');
             }
             $this->data['userArticles'] = $userArticles;
             $this->head['title'] = 'Moje články';
             $this->view = 'myArticles';
         }
     }
     //ak bol odoslany formular s novym oznamom
     if (isset($_POST['newNoticeSubmit'])) {
         //overenie ci je prihlaseny admin
         $this->checkUser(true);
         if (isset($_POST['noticeField'])) {
             $noticeManager->addNotice($_POST['noticeField']);
             $this->createMessage('Oznam bol úspešne uložený', 'success');
             $this->redirect('panel');
         }
     }
     //zadane URL pre odstranenie oznamu
     if (!empty($parameters[1]) && $parameters[1] == 'odstranit') {
         //overenie ci je prihlaseny admin
         $this->checkUser(true);
         //odstran oznam s danym ID
         $noticeManager->removeNotice($parameters[0]);
         $this->redirect('panel');
     }
     //ak je zadane URL pre odstranenie uzivatelskeho uctu
     if (!empty($parameters[1]) && $parameters[1] == 'odstranit-ucet') {
         if ($parameters[0] == $loggedUser['name']) {
             $userManager->deleteUser($parameters[0]);
         } else {
             $this->redirect('chyba');
         }
         $this->createMessage('Váš účet bol odstránený zo systému. Ďakujeme', 'warning');
         $userManager->logOut();
         $this->redirect('');
     }
     //zadane URL pre zobrazenie control panelu
     if (empty($parameters[0])) {
         $user = $userManager->returnUser();
         //oznamy
         $this->data['notices'] = $noticeManager->returnNotices();
         //data pre sablonu
         $this->data['admin'] = $user['admin'];
         $this->data['user'] = $user['name'];
         $messageManager = new MessageManager();
         $this->data['receivedMessages'] = $messageManager->returnReceivedMessages($user['name']);
         $this->data['sentMessages'] = $messageManager->returnSentMessages($user['name']);
         //nastavenie sablony a title
         $this->view = 'controlPanel';
         $this->head['title'] = 'Ovládací panel';
     }
 }
开发者ID:tomas3093,项目名称:cms-blog,代码行数:79,代码来源:PanelController.php


注:本文中的MessageManager::returnReceivedMessages方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。