當前位置: 首頁>>代碼示例>>PHP>>正文


PHP MessageManager::returnSentMessages方法代碼示例

本文整理匯總了PHP中MessageManager::returnSentMessages方法的典型用法代碼示例。如果您正苦於以下問題:PHP MessageManager::returnSentMessages方法的具體用法?PHP MessageManager::returnSentMessages怎麽用?PHP MessageManager::returnSentMessages使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MessageManager的用法示例。


在下文中一共展示了MessageManager::returnSentMessages方法的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::returnSentMessages方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。