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


PHP ActivityModel::add方法代码示例

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


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

示例1: addActivity

 /**
  *
  *
  * @return bool
  * @throws Gdn_UserException
  */
 public function addActivity()
 {
     // Build the story for the activity.
     $Header = $this->getImportHeader();
     $PorterVersion = val('Vanilla Export', $Header, t('unknown'));
     $SourceData = val('Source', $Header, t('unknown'));
     $Story = sprintf(t('Vanilla Export: %s, Source: %s'), $PorterVersion, $SourceData);
     $ActivityModel = new ActivityModel();
     $ActivityModel->add(Gdn::session()->UserID, 'Import', $Story);
     return true;
 }
开发者ID:oMadMartigaNo,项目名称:readjust-forum,代码行数:17,代码来源:class.importmodel.php

示例2: registerApproval

 /**
  * Registration that requires approval.
  *
  * Events: RegistrationPending
  *
  * @access private
  * @since 2.0.0
  */
 private function registerApproval()
 {
     Gdn::userModel()->addPasswordStrength($this);
     // If the form has been posted back...
     if ($this->Form->isPostBack()) {
         // Add validation rules that are not enforced by the model
         $this->UserModel->defineSchema();
         $this->UserModel->Validation->applyRule('Name', 'Username', $this->UsernameError);
         $this->UserModel->Validation->applyRule('TermsOfService', 'Required', t('You must agree to the terms of service.'));
         $this->UserModel->Validation->applyRule('Password', 'Required');
         $this->UserModel->Validation->applyRule('Password', 'Strength');
         $this->UserModel->Validation->applyRule('Password', 'Match');
         $this->UserModel->Validation->applyRule('DiscoveryText', 'Required', 'Tell us why you want to join!');
         // $this->UserModel->Validation->applyRule('DateOfBirth', 'MinimumAge');
         $this->fireEvent('RegisterValidation');
         try {
             $Values = $this->Form->formValues();
             $Values = $this->UserModel->filterForm($Values, true);
             unset($Values['Roles']);
             $AuthUserID = $this->UserModel->register($Values);
             $this->setData('UserID', $AuthUserID);
             if (!$AuthUserID) {
                 $this->Form->setValidationResults($this->UserModel->validationResults());
             } else {
                 // The user has been created successfully, so sign in now.
                 Gdn::session()->start($AuthUserID);
                 if ($this->Form->getFormValue('RememberMe')) {
                     Gdn::authenticator()->SetIdentity($AuthUserID, true);
                 }
                 // Notification text
                 $Label = t('NewApplicantEmail', 'New applicant:');
                 $Story = anchor(Gdn_Format::text($Label . ' ' . $Values['Name']), ExternalUrl('dashboard/user/applicants'));
                 $this->EventArguments['AuthUserID'] = $AuthUserID;
                 $this->EventArguments['Story'] =& $Story;
                 $this->fireEvent('RegistrationPending');
                 $this->View = "RegisterThanks";
                 // Tell the user their application will be reviewed by an administrator.
                 // Grab all of the users that need to be notified.
                 $Data = Gdn::database()->sql()->getWhere('UserMeta', array('Name' => 'Preferences.Email.Applicant'))->resultArray();
                 $ActivityModel = new ActivityModel();
                 foreach ($Data as $Row) {
                     $ActivityModel->add($AuthUserID, 'Applicant', $Story, $Row['UserID'], '', '/dashboard/user/applicants', 'Only');
                 }
             }
         } catch (Exception $Ex) {
             $this->Form->addError($Ex);
         }
         $this->render();
     } else {
         $this->render();
     }
 }
开发者ID:korelstar,项目名称:vanilla,代码行数:60,代码来源:class.entrycontroller.php


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