protected function getStreamUrl() { $params = array('limit' => '10', 'from' => '-from-', 'mode' => \humhub\modules\content\components\actions\Stream::MODE_ACTIVITY); if ($this->contentContainer) { return $this->contentContainer->createUrl($this->streamAction, $params); } return \yii\helpers\Url::to(array_merge([$this->streamAction], $params)); }
protected function getStreamUrl() { $params = array('limit' => '10', 'from' => '-from-', 'mode' => BaseStreamAction::MODE_ACTIVITY); if ($this->contentContainer) { return $this->contentContainer->createUrl($this->streamAction, $params); } return Yii::app()->createUrl($this->streamAction, $params); }
/** * Creates url to stream BaseStreamAction including placeholders * which are replaced and handled by javascript. * * If a contentContainer is specified it will be used to create the url. * * @return string */ protected function getStreamUrl() { $params = [$this->streamAction, 'limit' => '-limit-', 'filters' => '-filter-', 'sort' => '-sort-', 'from' => '-from-', 'mode' => \humhub\modules\content\components\actions\Stream::MODE_NORMAL]; if ($this->contentContainer) { return $this->contentContainer->createUrl($this->streamAction, $params); } return Url::to($params); }
/** * Checks if current module is enabled on this content container. * * @return boolean */ public function checkModuleIsEnabled() { $module = $this->getModule(); if ($module != null && $module instanceof HWebModule && !$module->isCoreModule) { return $this->contentContainer->isModuleEnabled($module->getId()); } return true; }
/** * Creates url to stream BaseStreamAction including placeholders * which are replaced and handled by javascript. * * If a contentContainer is specified it will be used to create the url. * * @return string */ protected function getStreamUrl() { $params = array('limit' => '-limit-', 'filters' => '-filter-', 'sort' => '-sort-', 'from' => '-from-', 'mode' => BaseStreamAction::MODE_NORMAL); if ($this->contentContainer) { return $this->contentContainer->createUrl($this->streamAction, $params); } return Yii::app()->createUrl($this->streamAction, $params); }
/** * Before Delete of a User * */ public function beforeDelete() { // We don't allow deletion of users who owns a space - validate that foreach (SpaceMembership::GetUserSpaces($this->id) as $workspace) { if ($workspace->isSpaceOwner($this->id)) { throw new Exception("Tried to delete a user which is owner of a space!"); } } UserSetting::model()->deleteAllByAttributes(array('user_id' => $this->id)); // Disable all enabled modules foreach ($this->getAvailableModules() as $moduleId => $module) { if ($this->isModuleEnabled($moduleId)) { $this->disableModule($moduleId); } } HSearch::getInstance()->deleteModel($this); // Delete Profile Image $this->getProfileImage()->delete(); // Delete all pending invites UserInvite::model()->deleteAllByAttributes(array('user_originator_id' => $this->id)); Follow::model()->deleteAllByAttributes(array('user_id' => $this->id)); Follow::model()->deleteAllByAttributes(array('object_model' => 'User', 'object_id' => $this->id)); // Delete all group admin assignments GroupAdmin::model()->deleteAllByAttributes(array('user_id' => $this->id)); // Delete wall entries WallEntry::model()->deleteAllByAttributes(array('wall_id' => $this->wall_id)); // Deletes all content created by this user foreach (Content::model()->findAllByAttributes(array('user_id' => $this->id)) as $content) { $content->delete(); } foreach (Content::model()->findAllByAttributes(array('created_by' => $this->id)) as $content) { $content->delete(); } // Delete all passwords foreach (UserPassword::model()->findAllByAttributes(array('user_id' => $this->id)) as $password) { $password->delete(); } return parent::beforeDelete(); }
/** * After Save Addons * * @return type */ protected function afterSave() { HSearch::getInstance()->addModel($this); return parent::afterSave(); }
/** * Before deletion of a Space */ protected function beforeDelete() { foreach (SpaceSetting::model()->findAllByAttributes(array('space_id' => $this->id)) as $spaceSetting) { $spaceSetting->delete(); } // Disable all enabled modules foreach ($this->getAvailableModules() as $moduleId => $module) { if ($this->isModuleEnabled($moduleId)) { $this->disableModule($moduleId); } } HSearch::getInstance()->deleteModel($this); $this->getProfileImage()->delete(); // Remove all Follwers UserFollow::model()->deleteAllByAttributes(array('object_id' => $this->id, 'object_model' => 'Space')); //Delete all memberships: //First select, then delete - done to make sure that SpaceMembership::beforeDelete() is triggered $spaceMemberships = SpaceMembership::model()->findAllByAttributes(array('space_id' => $this->id)); foreach ($spaceMemberships as $spaceMembership) { $spaceMembership->delete(); } UserInvite::model()->deleteAllByAttributes(array('space_invite_id' => $this->id)); // Delete all content objects of this space foreach (Content::model()->findAllByAttributes(array('space_id' => $this->id)) as $content) { $content->delete(); } // When this workspace is used in a group as default workspace, delete the link foreach (Group::model()->findAllByAttributes(array('space_id' => $this->id)) as $group) { $group->space_id = ""; $group->save(); } Wall::model()->deleteAllByAttributes(array('id' => $this->wall_id)); return parent::beforeDelete(); }
/** * Before deletion of a Room */ protected function beforeDelete() { foreach (RoomSetting::model()->findAllByAttributes(array('room_id' => $this->id)) as $roomSetting) { $roomSetting->delete(); } // Disable all enabled modules foreach ($this->getAvailableModules() as $moduleId => $module) { if ($this->isModuleEnabled($moduleId)) { $this->disableModule($moduleId); } } Yii::app()->search->delete($this); $this->getProfileImage()->delete(); // Remove all Follwers //UserFollow::model()->deleteAllByAttributes(array('object_id' => $this->id, 'object_model' => 'Room')); //Delete all memberships: //First select, then delete - done to make sure that RoomsMembership::beforeDelete() is triggered $roomMemberships = RoomMembership::model()->findAllByAttributes(array('room_id' => $this->id)); foreach ($roomMemberships as $roomMembership) { $roomMembership->delete(); } UserInvite::model()->deleteAllByAttributes(array('room_invite_id' => $this->id)); // Delete all content objects of this room foreach (Content::model()->findAllByAttributes(array('room_id' => $this->id)) as $content) { $content->delete(); } // When this room is used in a group as default room, delete the link foreach (Group::model()->findAllByAttributes(array('room_id' => $this->id)) as $group) { $group->room_id = ""; $group->save(); } Wall::model()->deleteAllByAttributes(array('id' => $this->wall_id)); return parent::beforeDelete(); }
/** * Initialize Default Settings for a Container. * @param HActiveRecordContentContainer $container */ private function setDefaultValues(HActiveRecordContentContainer $container) { $container->setSetting('enableDeadLinkValidation', 0, 'library'); $container->setSetting('enableWidget', 0, 'library'); $container->setSetting('publishersOnly', 0, 'library'); }