/** * Uninstalls a Module */ public function disableModule($moduleId) { // Not enabled globally if (!array_key_exists($moduleId, $this->getAvailableModules())) { return false; } // Already enabled module if (!$this->isModuleEnabled($moduleId)) { Yii::log("Room->disableModule(" . $moduleId . ") module is not enabled"); return false; } // New Way: Handle it directly in module class $module = Yii::app()->moduleManager->getModule($moduleId); $module->disableRoomModule($this->getOwner()); $roomModule = RoomApplicationModule::model()->findByAttributes(array('room_id' => $this->getOwner()->id, 'module_id' => $moduleId)); if ($roomModule == null) { $roomModule = new RoomApplicationModule(); $roomModule->room_id = $this->getOwner()->id; $roomModule->module_id = $moduleId; } $roomModule->state = RoomApplicationModule::STATE_DISABLED; $roomModule->save(); return true; }