
Öffentliche Methoden | |
| preDispatch () | |
| Vor dem Dispatchen auszuführende Routinen. | |
| deleteAction () | |
| Loescht eine Schriftrolle / einen Thread. | |
| sendAction () | |
| Versenden einer Schriftrolle. | |
Definiert in Zeile 10 der Datei ScrollController.php.
| Scroll_ScrollController::deleteAction | ( | ) |
Loescht eine Schriftrolle / einen Thread.
Definiert in Zeile 22 der Datei ScrollController.php.
Benutzt Dsao_Controller_Action::_getModel(), Dsao_Controller_Action::getHelper(), Dsao_Controller_Action::getLog(), Dsao_Controller_Action::getUri(), Dsao_Controller_Action::getUser() und Dsao_Controller_Action::getView().
00023 { 00024 // Standardmaessig kein Template anzeigen 00025 $this->getView()->addTemplate(false); 00026 00027 // int, ID der zu loeschenden Schriftrolle 00028 $idScroll = $this->getUri()->id; 00029 00030 // bool|Dsao_Scroll, enthaelt entweder die zu loeschende Schriftrolle 00031 // oder false 00032 $scroll = $this->_getModel()->isParticipated 00033 ($this->getUser()->getId(), $idScroll); 00034 00035 // Falls Schriftrolle nicht vorhanden bzw. Benutzer nicht daran beteiligt 00036 if (!$scroll || $scroll->isDeleted($this->getUser()->getId())) 00037 { 00038 $this->getLog()->err('scroll_scroll_delete_error_no_permission'); 00039 00040 return; 00041 } 00042 00043 // string, Ob Schriftrolle oder Thread geloescht werden soll 00044 $scrollThread = 'scroll_scroll'; 00045 00046 // Falls Thread geloescht werden soll. 00047 if ($this->getUri()->thread) 00048 { 00049 $scrollThread = 'scroll_thread'; 00050 } 00051 00052 // Falls Benutzer Loeschen noch nicht bestaetigt hat 00053 if (!$this->getUri()->confirm) 00054 { 00055 // URI für die Bestätigung 00056 $uriConfirm = new Dsao_Uri_Http('/scroll/scroll/delete', array( 00057 'confirm' => true, 00058 'id' => $idScroll, 00059 )); 00060 00061 // Falls Thread gelöscht werden soll 00062 if ($scrollThread == 'scroll_thread') 00063 { 00064 $uriConfirm->thread = true; 00065 } 00066 00067 $this->getView()->addConfirmationTemplate(array( 00068 'scroll_scroll_delete_confirm', 00069 array( 00070 'nameAuthor' => $scroll->nameAuthor, 00071 'scrollThread' => $scrollThread, 00072 'subject' => $scroll->subject, 00073 ), true), 00074 $uriConfirm); 00075 00076 return true; 00077 } 00078 00079 // Token 00080 if (!$this->getHelper('SessionToken')->hasValidToken()) 00081 { 00082 return; 00083 } 00084 00085 // Dsao_Scrollset, die zu loeschenden Schriftrollen, im Normalfall ist 00086 // dies nur eine, naemlich $scroll. Falls es sich jedoch um einen Thread 00087 // handelt, sind es mehrere 00088 $scrolls = null; 00089 00090 // Falls es sich um die Anfangsschriftrolle eines Threads handelt 00091 if ($scroll->idThread == 0) 00092 { 00093 $scrolls = $this->_getModel('Scroll_Thread')->fetchThread 00094 ($idScroll, $this->getUser()->getId()); 00095 } 00096 else 00097 { 00098 $scrolls = new Dsao_Scrollset(array($scroll)); 00099 } 00100 00101 $scrolls->delete($this->getUser()->getId()); 00102 00103 // Bestaetigung 00104 $this->getLog()->affirm 00105 (array('scroll_scroll_delete_affirmation_deleted', 00106 array('scrollThread' => $scrollThread), true)); 00107 }
| Scroll_ScrollController::sendAction | ( | ) |
Versenden einer Schriftrolle.
Definiert in Zeile 114 der Datei ScrollController.php.
Benutzt Dsao_Controller_Action::_getModel(), Dsao_Controller_Action::getHelper(), Dsao_Controller_Action::getLog(), Dsao_Controller_Action::getUser(), Dsao_Controller_Action::getView() und Dsao_Model_Abstract::underscore().
00115 { 00116 $this->getHelper('History')->setAddToHistory(); 00117 00118 $scrollDataSubmitted = array 00119 ( 00120 'content' => $this->getRequest()->getParam('content', false), 00121 'idThread' => $this->getRequest()->getParam('idthread', 0), 00122 'nameRecipient' => $this->getRequest()->getParam('recipient', false), 00123 'subject' => $this->getRequest()->getParam('subject', false) 00124 ); 00125 00126 $scrollSubmitted = new Dsao_Scroll($scrollDataSubmitted); 00127 00128 // Falls Formular abgeschickt wurde. 00129 if ($this->getRequest()->isPost()) 00130 { 00131 // Token 00132 if (!$this->getHelper('SessionToken')->hasValidToken()) 00133 { 00134 return; 00135 } 00136 00137 $scroll = clone $scrollSubmitted; 00138 00139 // Falls Fehler beim Einfuegen aufgetreten sind. 00140 if (!$this->_getModel()->insertScroll($scroll)->isValid()) 00141 { 00142 // Ueberpruefte Daten durchgehen. 00143 foreach ($scroll->toArray() as $key => $value) 00144 { 00145 // Falls Fehler aufgetreten. 00146 if (false === $value) 00147 { 00148 $this->getLog() 00149 ->err('scroll_scroll_send_error_'.Dsao_Model_Abstract::underscore($key)); 00150 } 00151 } 00152 } 00153 else 00154 { 00155 // Bestaetigung ausgeben. 00156 $this->getLog()->affirm(array('scroll_scroll_send_affirmation_sent', 00157 array('username' => $scroll->nameRecipient))); 00158 00159 // Kein Template anzeigen. 00160 $this->getView()->addTemplate(false); 00161 00162 return; 00163 } 00164 } 00165 00166 // Falls Thread-ID uebergeben wurde, Empfaenger und Betreff laden. 00167 if ($scrollSubmitted->idThread > 0) 00168 { 00169 // Falls Benutzer an Thread beteiligt. 00170 if ( ($scrollThread = $this->_getModel()-> 00171 isParticipated($this->getUser()->id, $scrollSubmitted->idThread)) ) 00172 { 00173 $scrollSubmitted->idThread = $scrollThread->id; 00174 $scrollSubmitted->subject = $scrollThread->subject; 00175 $scrollSubmitted->nameRecipient = $scrollThread 00176 ->getOtherUser($this->getUser()->id)->username; 00177 } 00178 // Ansonsten Fehlermeldung ausgeben. 00179 else 00180 { 00181 $this->getLog()->err('scroll_scroll_send_error_idthread'); 00182 } 00183 } 00184 00185 $this->getView()->assign('scroll', $scrollSubmitted); 00186 }
1.5.7.1