コード例 #1
0
 public function executeDeletechapter()
 {
     $chapter = ChapterPeer::retrieveByPK($this->getRequestParameter('id'));
     $cr = $chapter->getChapterregion();
     $c = new Criteria();
     $c->add(UserchapterregionPeer::CHAPTERREGION_ID, $cr->getId());
     $ucount = UserchapterregionPeer::doCount($c);
     $ucr = UserchapterregionPeer::doSelectOne($c);
     if ($ucr) {
         $this->setFlash('notice', 'Cannot delete chapter. <b>' . $ucount . '</b> user(s) are subscribed to this chapter.');
     } else {
         $chapter->delete();
         $cr->delete();
         $this->setFlash('notice', 'Chapter Deleted Successfully');
     }
     $this->redirect('admin/chapters');
 }
コード例 #2
0
 public function executeUnjoinchapter()
 {
     $userid = $this->getUser()->getAttribute('userid');
     $crid = $this->getRequestParameter('crid');
     $c = new Criteria();
     $c->add(UserchapterregionPeer::USER_ID, $userid);
     $c->add(UserchapterregionPeer::CHAPTERREGION_ID, $crid);
     $ucr = UserchapterregionPeer::doSelectOne($c);
     if ($ucr) {
         $ucr->delete();
     }
     $this->redirect('/address/show');
 }