当前位置: 首页>>代码示例>>PHP>>正文


PHP Space::findAll方法代码示例

本文整理汇总了PHP中humhub\modules\space\models\Space::findAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Space::findAll方法的具体用法?PHP Space::findAll怎么用?PHP Space::findAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在humhub\modules\space\models\Space的用法示例。


在下文中一共展示了Space::findAll方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionBasic

 /**
  * Returns a List of Users
  */
 public function actionBasic()
 {
     $form = new \humhub\modules\admin\models\forms\BasicSettingsForm();
     $form->name = Setting::Get('name');
     $form->baseUrl = Setting::Get('baseUrl');
     $form->defaultLanguage = Setting::Get('defaultLanguage');
     $form->timeZone = Setting::Get('timeZone');
     $form->dashboardShowProfilePostForm = Setting::Get('showProfilePostForm', 'dashboard');
     $form->tour = Setting::Get('enable', 'tour');
     $form->share = Setting::Get('enable', 'share');
     $form->defaultSpaceGuid = "";
     foreach (\humhub\modules\space\models\Space::findAll(['auto_add_new_members' => 1]) as $defaultSpace) {
         $form->defaultSpaceGuid .= $defaultSpace->guid . ",";
     }
     if ($form->load(Yii::$app->request->post()) && $form->validate()) {
         Setting::Set('name', $form->name);
         Setting::Set('baseUrl', $form->baseUrl);
         Setting::Set('defaultLanguage', $form->defaultLanguage);
         Setting::Set('timeZone', $form->timeZone);
         Setting::Set('enable', $form->tour, 'tour');
         Setting::Set('enable', $form->share, 'share');
         Setting::Set('showProfilePostForm', $form->dashboardShowProfilePostForm, 'dashboard');
         $spaceGuids = explode(",", $form->defaultSpaceGuid);
         // Remove Old Default Spaces
         foreach (\humhub\modules\space\models\Space::findAll(['auto_add_new_members' => 1]) as $space) {
             if (!in_array($space->guid, $spaceGuids)) {
                 $space->auto_add_new_members = 0;
                 $space->save();
             }
         }
         // Add new Default Spaces
         foreach ($spaceGuids as $spaceGuid) {
             $space = \humhub\modules\space\models\Space::findOne(['guid' => $spaceGuid]);
             if ($space != null && $space->auto_add_new_members != 1) {
                 $space->auto_add_new_members = 1;
                 $space->save();
             }
         }
         DynamicConfig::rewrite();
         // set flash message
         Yii::$app->getSession()->setFlash('data-saved', Yii::t('AdminModule.controllers_SettingController', 'Saved'));
         return Yii::$app->response->redirect(Url::toRoute('/admin/setting/basic'));
     }
     return $this->render('basic', array('model' => $form));
 }
开发者ID:SimonBaeumer,项目名称:humhub,代码行数:48,代码来源:SettingController.php

示例2: setUpApproved

 public function setUpApproved()
 {
     $userInvite = Invite::findOne(['email' => $this->email]);
     if ($userInvite !== null) {
         // User was invited to a space
         if ($userInvite->source == Invite::SOURCE_INVITE) {
             $space = \humhub\modules\space\models\Space::findOne(['id' => $userInvite->space_invite_id]);
             if ($space != null) {
                 $space->addMember($this->id);
             }
         }
         // Delete/Cleanup Invite Entry
         $userInvite->delete();
     }
     // Auto Assign User to the Group Space
     /* $group = Group::findOne(['id' => $this->group_id]);
        if ($group != null && $group->space_id != "") {
        $space = \humhub\modules\space\models\Space::findOne(['id' => $group->space_id]);
        if ($space !== null) {
        $space->addMember($this->id);
        }
        } */
     // Auto Add User to the default spaces
     foreach (\humhub\modules\space\models\Space::findAll(['auto_add_new_members' => 1]) as $space) {
         $space->addMember($this->id);
     }
 }
开发者ID:kreativmind,项目名称:humhub,代码行数:27,代码来源:User.php

示例3: setUpApproved

 public function setUpApproved()
 {
     $userInvite = Invite::findOne(['email' => $this->email]);
     if ($userInvite !== null) {
         // User was invited to a space
         if ($userInvite->source == Invite::SOURCE_INVITE) {
             $space = \humhub\modules\space\models\Space::findOne(['id' => $userInvite->space_invite_id]);
             if ($space != null) {
                 $space->addMember($this->id);
             }
         }
         // Delete/Cleanup Invite Entry
         $userInvite->delete();
     }
     // Auto Assign User to the Group Space
     $group = Group::findOne(['id' => $this->group_id]);
     if ($group != null && $group->space_id != "") {
         $space = \humhub\modules\space\models\Space::findOne(['id' => $group->space_id]);
         if ($space !== null) {
             $space->addMember($this->id);
         }
     }
     // Auto Add User to the default spaces
     foreach (\humhub\modules\space\models\Space::findAll(['auto_add_new_members' => 1]) as $space) {
         $space->addMember($this->id);
     }
     // Create new wall record for this user
     $wall = new \humhub\modules\content\models\Wall();
     $wall->object_model = $this->className();
     $wall->object_id = $this->id;
     $wall->save();
     $this->wall_id = $wall->id;
     $this->update(false, ['wall_id']);
 }
开发者ID:ArneVanDaele,项目名称:humhub,代码行数:34,代码来源:User.php

示例4: save

 /**
  * Saves the form
  *
  * @return boolean
  */
 public function save()
 {
     Yii::$app->settings->set('name', $this->name);
     Yii::$app->settings->set('baseUrl', $this->baseUrl);
     Yii::$app->settings->set('defaultLanguage', $this->defaultLanguage);
     Yii::$app->settings->set('timeZone', $this->timeZone);
     Yii::$app->getModule('dashboard')->settings->set('showProfilePostForm', $this->dashboardShowProfilePostForm);
     Yii::$app->getModule('tour')->settings->set('enable', $this->tour);
     Yii::$app->getModule('friendship')->settings->set('enable', $this->enableFriendshipModule);
     Yii::$app->getModule('content')->settings->set('stream.defaultSort', $this->defaultStreamSort);
     $spaceGuids = explode(",", $this->defaultSpaceGuid);
     // Remove Old Default Spaces
     foreach (Space::findAll(['auto_add_new_members' => 1]) as $space) {
         if (!in_array($space->guid, $spaceGuids)) {
             $space->auto_add_new_members = 0;
             $space->save();
         }
     }
     // Add new Default Spaces
     foreach ($spaceGuids as $spaceGuid) {
         $space = Space::findOne(['guid' => $spaceGuid]);
         if ($space != null && $space->auto_add_new_members != 1) {
             $space->auto_add_new_members = 1;
             $space->save();
         }
     }
     DynamicConfig::rewrite();
     return true;
 }
开发者ID:VasileGabriel,项目名称:humhub,代码行数:34,代码来源:BasicSettingsForm.php


注:本文中的humhub\modules\space\models\Space::findAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。