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


PHP ActivityModel::defineType方法代码示例

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


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

示例1: array

$SQL->replace('ActivityType', array('AllowComments' => '0', 'FullHeadline' => '%1$s banned %3$s.', 'ProfileHeadline' => '%1$s banned %3$s.', 'Notify' => '0', 'Public' => '1'), array('Name' => 'Banned'), true);
//if ($SQL->getWhere('ActivityType', array('Name' => 'Unbanned'))->numRows() == 0)
$SQL->replace('ActivityType', array('AllowComments' => '0', 'FullHeadline' => '%1$s un-banned %3$s.', 'ProfileHeadline' => '%1$s un-banned %3$s.', 'Notify' => '0', 'Public' => '1'), array('Name' => 'Unbanned'), true);
// Applicant activity
if ($SQL->getWhere('ActivityType', array('Name' => 'Applicant'))->numRows() == 0) {
    $SQL->insert('ActivityType', array('AllowComments' => '0', 'Name' => 'Applicant', 'FullHeadline' => '%1$s applied for membership.', 'ProfileHeadline' => '%1$s applied for membership.', 'Notify' => '1', 'Public' => '0'));
}
$WallPostType = $SQL->getWhere('ActivityType', array('Name' => 'WallPost'))->firstRow(DATASET_TYPE_ARRAY);
if (!$WallPostType) {
    $WallPostTypeID = $SQL->insert('ActivityType', array('AllowComments' => '1', 'ShowIcon' => '1', 'Name' => 'WallPost', 'FullHeadline' => '%3$s wrote on %2$s %5$s.', 'ProfileHeadline' => '%3$s wrote:'));
    $WallCommentTypeID = $SQL->getWhere('ActivityType', array('Name' => 'WallComment'))->value('ActivityTypeID');
    // Update all old wall comments to wall posts.
    $SQL->update('Activity')->set('ActivityTypeID', $WallPostTypeID)->set('ActivityUserID', 'RegardingUserID', false)->set('RegardingUserID', 'InsertUserID', false)->where('ActivityTypeID', $WallCommentTypeID)->where('RegardingUserID is not null')->put();
}
$ActivityModel = new ActivityModel();
$ActivityModel->defineType('Default');
$ActivityModel->defineType('Registration');
$ActivityModel->defineType('Status');
$ActivityModel->defineType('Ban');
// Message Table
$Construct->table('Message')->primaryKey('MessageID')->column('Content', 'text')->column('Format', 'varchar(20)', true)->column('AllowDismiss', 'tinyint(1)', '1')->column('Enabled', 'tinyint(1)', '1')->column('Application', 'varchar(255)', true)->column('Controller', 'varchar(255)', true)->column('Method', 'varchar(255)', true)->column('CategoryID', 'int', true)->column('IncludeSubcategories', 'tinyint', '0')->column('AssetTarget', 'varchar(20)', true)->column('CssClass', 'varchar(20)', true)->column('Sort', 'int', true)->set($Explicit, $Drop);
$Prefix = $SQL->Database->DatabasePrefix;
if ($PhotoIDExists && !$PhotoExists) {
    $Construct->query("update {$Prefix}User u\n   join {$Prefix}Photo p\n      on u.PhotoID = p.PhotoID\n   set u.Photo = p.Name");
}
if ($PhotoIDExists) {
    $Construct->table('User')->dropColumn('PhotoID');
}
$Construct->table('Tag');
$FullNameColumnExists = $Construct->columnExists('FullName');
$TagCategoryColumnExists = $Construct->columnExists('CategoryID');
开发者ID:mcnasby,项目名称:datto-vanilla,代码行数:31,代码来源:structure.php

示例2: array

$SQL->replace('AddonType', array('Label' => 'Plugin', 'Visible' => '1'), array('AddonTypeID' => 1), true);
$SQL->replace('AddonType', array('Label' => 'Theme', 'Visible' => '1'), array('AddonTypeID' => 2), true);
$SQL->replace('AddonType', array('Label' => 'Style', 'Visible' => '0'), array('AddonTypeID' => 3), true);
$SQL->replace('AddonType', array('Label' => 'Locale', 'Visible' => '1'), array('AddonTypeID' => 4), true);
$SQL->replace('AddonType', array('Label' => 'Application', 'Visible' => '1'), array('AddonTypeID' => 5), true);
$SQL->replace('AddonType', array('Label' => 'Core', 'Visible' => '1'), array('AddonTypeID' => 10), true);
$Construct->table('Addon');
$Description2Exists = $Construct->columnExists('Description2');
$Construct->primaryKey('AddonID')->column('CurrentAddonVersionID', 'int', true, 'key')->column('AddonKey', 'varchar(50)', null, 'index')->column('AddonTypeID', 'int', false, 'key')->column('InsertUserID', 'int', false, 'key')->column('UpdateUserID', 'int', true)->column('Name', 'varchar(100)')->column('Icon', 'varchar(200)', true)->column('Description', 'text', true)->column('Description2', 'text', null)->column('Requirements', 'text', true)->column('CountComments', 'int', '0')->column('CountDownloads', 'int', '0')->column('Visible', 'tinyint(1)', '1')->column('Vanilla2', 'tinyint(1)', '1')->column('DateInserted', 'datetime')->column('DateUpdated', 'datetime', true)->column('Checked', 'tinyint(1)', '0')->column('Official', 'tinyint(1)', '0')->column('License', 'varchar(100)')->column('GitHub', 'varchar(100)', null)->column('EnName', 'varchar(100)', null)->column('PercentComplete', 'tinyint', null)->set($Explicit, $Drop);
if (!$Description2Exists) {
    $Construct->query("update {$Px}Addon set Description2 = Description where Checked = 0");
}
$Construct->table('AddonVersion')->primaryKey('AddonVersionID')->column('AddonID', 'int', false, 'key')->column('File', 'varchar(200)', true)->column('Version', 'varchar(20)')->column('TestedWith', 'text', null)->column('FileSize', 'int', null)->column('MD5', 'varchar(32)')->column('Notes', 'text', null)->column('Format', 'varchar(10)', 'Html')->column('InsertUserID', 'int', false, 'key')->column('DateInserted', 'datetime')->column('DateReviewed', 'datetime', true)->column('Checked', 'tinyint(1)', '0')->column('Deleted', 'tinyint(1)', '0')->set($Explicit, $Drop);
$Construct->table('AddonPicture')->primaryKey('AddonPictureID')->column('AddonID', 'int', false, 'key')->column('File', 'varchar(200)')->column('DateInserted', 'datetime')->set($Explicit, $Drop);
$Construct->table('Confidence')->primaryKey('ConfidenceID')->column('AddonVersionID', 'int', false, 'key')->column('CoreVersionID', 'int', false, 'key')->column('UserID', 'int', false, 'key')->column('Weight', 'int', null)->set($Explicit, $Drop);
$Construct->table('Download')->primaryKey('DownloadID')->column('AddonID', 'int', false, 'key')->column('DateInserted', 'datetime')->column('RemoteIp', 'varchar(50)', true)->set($Explicit, $Drop);
$Construct->table('UpdateCheckSource')->primaryKey('SourceID')->column('Location', 'varchar(255)', true)->column('DateInserted', 'datetime', true)->column('RemoteIp', 'varchar(50)', true)->set($Explicit, $Drop);
$Construct->table('UpdateCheck')->primaryKey('UpdateCheckID')->column('SourceID', 'int', false, 'key')->column('CountUsers', 'int', '0')->column('CountDiscussions', 'int', '0')->column('CountComments', 'int', '0')->column('CountConversations', 'int', '0')->column('CountConversationMessages', 'int', '0')->column('DateInserted', 'datetime')->column('RemoteIp', 'varchar(50)', true)->set($Explicit, $Drop);
// Need to use this table instead of linking directly with the Addon table
// because we might not have all of the addons being checked for.
$Construct->table('UpdateAddon')->primaryKey('UpdateAddonID')->column('AddonID', 'int', false, 'key')->column('Name', 'varchar(255)', true)->column('Type', 'varchar(255)', true)->column('Version', 'varchar(255)', true)->set($Explicit, $Drop);
$Construct->table('UpdateCheckAddon')->column('UpdateCheckID', 'int', false, 'key')->column('UpdateAddonID', 'int', false, 'key')->set($Explicit, $Drop);
$PermissionModel = Gdn::permissionModel();
$PermissionModel->Database = Gdn::database();
$PermissionModel->SQL = $SQL;
// Define some global addon permissions.
$PermissionModel->define(array('Addons.Addon.Add', 'Addons.Addon.Manage', 'Addons.Comments.Manage'));
$ActivityModel = new ActivityModel();
$ActivityModel->defineType('Addon');
// Add AddonID column to discussion table for allowing discussions on addons.
$Construct->table('Discussion')->column('AddonID', 'int', null)->set();
开发者ID:vanilla,项目名称:community,代码行数:31,代码来源:structure.php


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