/**
  * Unlock accounts
  * @return bool
  */
 protected function lockUsers()
 {
     $this->tabs_gui->setTabActive('participants');
     $participants_to_unlock = (array) array_unique(array_merge((array) $_POST['admins'], (array) $_POST['members']));
     if (!count($participants_to_unlock)) {
         ilUtil::sendFailure($this->lng->txt('no_checkbox'));
         $this->participants();
         return false;
     }
     foreach ($participants_to_unlock as $part) {
         $unlock = new ilViteroLockedUser();
         $unlock->setUserId($part);
         $unlock->setVGroupId($this->object->getVGroupId());
         $unlock->setLocked(true);
         $unlock->update();
     }
     $grp = new ilViteroGroupSoapConnector();
     $grp->updateEnabledStatusForUsers($participants_to_unlock, $this->object->getVGroupId(), false);
     ilUtil::sendSuccess($GLOBALS['lng']->txt('settings_saved'), true);
     $GLOBALS['ilCtrl']->redirect($this, 'participants');
 }
Example #2
0
 public static function handleDeletedGroups()
 {
     global $ilDB;
     $query = 'SELECT child, obd.obj_id FROM tree ' . 'JOIN object_reference obr ON child = ref_id ' . 'JOIN object_data obd ON obr.obj_id = obd.obj_id ' . 'WHERE type = ' . $ilDB->quote('xvit', 'text') . ' ' . 'AND tree < ' . $ilDB->quote(0, 'integer');
     $res = $ilDB->query($query);
     while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
         if (!ilObject::_hasUntrashedReference($row->obj_id)) {
             try {
                 $vgroup_id = ilObjVitero::lookupVGroupId($row->obj_id);
                 if (!$vgroup_id) {
                     continue;
                 }
                 $start = new ilDate(time(), IL_CAL_UNIX);
                 $end = clone $start;
                 $start->increment(IL_CAL_YEAR, -2);
                 $end->increment(IL_CAL_YEAR, 2);
                 $booking_service = new ilViteroBookingSoapConnector();
                 $books = $booking_service->getByGroupAndDate($vgroup_id, $start, $end);
                 if (is_object($books->booking)) {
                     try {
                         $booking_service->deleteBooking($books->booking->bookingid);
                     } catch (ilViteroConnectorException $e) {
                         $GLOBALS['ilLog']->write(__METHOD__ . ': Deleting deprecated booking failed with message: ' . $e->getMessage());
                     }
                 }
                 if (is_array($books->booking)) {
                     foreach ((array) $books->booking as $book) {
                         try {
                             $booking_service->deleteBooking($book->bookingid);
                         } catch (ilViteroConnectorException $e) {
                             $GLOBALS['ilLog']->write(__METHOD__ . ': Deleting deprecated booking failed with message: ' . $e->getMessage());
                         }
                     }
                 }
             } catch (ilViteroConnectorException $e) {
                 $GLOBALS['ilLog']->write(__METHOD__ . ': Cannot read bookings of group "' . $vgroup_id . '": ' . $e->getMessage());
             }
         }
         // Delete group
         try {
             $groups = new ilViteroGroupSoapConnector();
             $groupDefinition = new ilViteroGroupSoap();
             $groupDefinition->groupid = $vgroup_id;
             $groups->delete($groupDefinition);
             // Update vgroup id
             $query = 'UPDATE rep_robj_xvit_data ' . 'SET vgroup_id = 0 ' . 'WHERE obj_id = ' . $ilDB->quote($row->obj_id, 'integer');
             $ilDB->manipulate($query);
         } catch (ilViteroConnectorException $e) {
             $GLOBALS['ilLog']->write(__METHOD__ . ': Delete group failed: "' . $vgroup_id . '": ' . $e->getMessage());
         }
     }
 }