本文整理汇总了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;
}
示例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();
}
}