Exemple #1
0
 /**
  * This method get the abos of the relevant forum and return the mailadresses
  * @param int $forumid         id of relevant forum if available
  * @param int $userId         userid of the user created the posting
  */
 protected static function getForumAbos($forumid, $userId)
 {
     // we get a repository for abos
     $repository = MUBoard_Util_Model::getAboRepository();
     $where = 'tbl.forumid = \'' . DataUtil::formatForStore($forumid) . '\'';
     $where .= ' AND ';
     $where .= 'tbl.createdUserId != \'' . DataUtil::formatForStore($userId) . '\'';
     $forumabos = $repository->selectWhere($where);
     foreach ($forumabos as $forumabo) {
         //if ($forumabo['createdUserId'] != $userid) {
         $userids[] = $forumabo['createdUserId'];
         //}
     }
     foreach ($userids as $userid) {
         $mailadresses[] = UserUtil::getVar('email', $userid);
     }
     return $mailadresses;
 }
Exemple #2
0
 /**
  * This function counts the call of a posting
  * @param posting   id of the posting to quit abo
  * @param forum     id of the forum to quit abo
  * @param category  id of the category to quit abo
  */
 public static function quitAbo($posting = 0, $forum = 0, $category = 0)
 {
     // Security ckeck
     if (SecurityUtil::checkPermission('MUBoard::', '::', ACCESS_COMMENT) && UserUtil::isLoggedIn() == true) {
         // build posting repository
         $repository = MUBoard_Util_Model::getAboRepository();
         // get actual user id
         $userid = UserUtil::getVar('uid');
         // quit abo of posting if posting is taken
         if ($posting > 0) {
             // look for abo
             $where = 'tbl.postingid = \'' . DataUtil::formatForStore($posting) . '\'';
             $where .= ' AND ';
             $where .= 'tbl.userid = \'' . DataUtil::formatForStore($userid) . '\'';
             $abos = $repository->selectWhere($where);
             $serviceManager = ServiceUtil::getManager();
             $entityManager = $serviceManager->getService('doctrine.entitymanager');
             foreach ($abos as $abo) {
                 $entityManager->remove($abo);
                 $entityManager->flush();
             }
         }
         if ($forum > 0) {
             // look for abo
             $where = 'tbl.forumid = \'' . DataUtil::formatForStore($forum) . '\'';
             $where .= ' AND ';
             $where .= 'tbl.userid = \'' . DataUtil::formatForStore($userid) . '\'';
             $abos = $repository->selectWhere($where);
             $serviceManager = ServiceUtil::getManager();
             $entityManager = $serviceManager->getService('doctrine.entitymanager');
             foreach ($abos as $abo) {
                 $entityManager->remove($abo);
                 $entityManager->flush();
             }
         }
         return true;
     }
 }
Exemple #3
0
 /**
  *
  * This method gets the state of the posting abo
  */
 public static function getStateOfPostingAbo($postingid)
 {
     $request = new Zikula_Request_Http();
     // get objecttype
     $ot = $request->getGet()->filter('ot', 'category', FILTER_SANITIZE_STRING);
     $forumid = $request->getGet()->filter('id', 0, FILTER_SANITIZE_NUMBER_INT);
     // get repositoy for Categories
     $repository = MUBoard_Util_Model::getAboRepository();
     if (UserUtil::isLoggedIn() == true) {
         // get actual userid
         $userid = UserUtil::getVar('uid');
         // look for abo
         $where = 'tbl.postingid = \'' . DataUtil::formatForStore($postingid) . '\'';
         $where .= ' AND ';
         $where .= 'tbl.userid = \'' . DataUtil::formatForStore($userid) . '\'';
         $abo = $repository->selectWhere($where);
         if ($ot == 'posting') {
             if (!$abo) {
                 $url = ModUtil::url('MUBoard', 'admin', 'take', array('ot' => 'abo', 'posting' => $postingid, 'object' => $ot));
                 $out = "<a id='muboard-user-posting-header-infos-abo' href='{$url}'>\n                    <img src='/images/icons/extrasmall/mail_post_to.png' />\n                    </a>";
             }
             if ($abo) {
                 $url = ModUtil::url('MUBoard', 'admin', 'quit', array('ot' => 'abo', 'posting' => $postingid, 'object' => $ot));
                 $out = "<a id='muboard-user-posting-header-infos-abo' href='{$url}'>\n                    <img src='/images/icons/extrasmall/mail_get.png' />\n                    </a>";
             }
         }
         if ($ot == 'forum') {
             if (!$abo) {
                 $url = ModUtil::url('MUBoard', 'admin', 'take', array('ot' => 'abo', 'posting' => $postingid, 'object' => $ot, 'forum' => $forumid));
                 $out = "<a id='muboard-user-posting-header-infos-abo' href='{$url}'>\n                    <img src='/images/icons/extrasmall/mail_post_to.png' />\n                    </a>";
             }
             if ($abo) {
                 $url = ModUtil::url('MUBoard', 'admin', 'quit', array('ot' => 'abo', 'posting' => $postingid, 'object' => $ot, 'forum' => $forumid));
                 $out = "<a id='muboard-user-posting-header-infos-abo' href='{$url}'>\n                    <img src='/images/icons/extrasmall/mail_get.png' />\n                    </a>";
             }
         }
     } else {
         $out = '';
     }
     return $out;
 }