Ejemplo n.º 1
0
 public static function checkForumsExistsInsert($ref_id, $user_id = 0)
 {
     global $ilUser;
     include_once 'Modules/Forum/classes/class.ilForumProperties.php';
     $node_data = self::getCachedNodeData($ref_id);
     foreach ($node_data as $data) {
         //check frm_properties if frm_noti is enabled
         $frm_noti = new ilForumNotification($data['ref_id']);
         if ($user_id != 0) {
             $frm_noti->setUserId($user_id);
         } else {
             $frm_noti->setUserId($ilUser->getId());
         }
         $admin_force = ilForumProperties::_isAdminForceNoti($data['obj_id']);
         $frm_noti->setAdminForce($admin_force);
         $user_toggle = ilForumProperties::_isUserToggleNoti($data['obj_id']);
         if ($user_toggle) {
             $frm_noti->setAdminForce(1);
         }
         if ($admin_force == 1 || $user_toggle == 1) {
             $frm_noti->setUserToggle($user_toggle);
             $frm_noti->setForumId($data['obj_id']);
             if ($frm_noti->existsNotification() == false) {
                 $frm_noti->insertAdminForce();
             }
         }
     }
 }