本文整理汇总了PHP中OCP\Activity\IManager::getDefaultTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP IManager::getDefaultTypes方法的具体用法?PHP IManager::getDefaultTypes怎么用?PHP IManager::getDefaultTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OCP\Activity\IManager
的用法示例。
在下文中一共展示了IManager::getDefaultTypes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDefaultTypes
/**
* Get the default selection of types for a method
*
* @param string $method Should be one of 'stream' or 'email'
* @return array Array of strings
*/
public function getDefaultTypes($method)
{
$settings = array();
if ($method === 'stream') {
$settings[] = Data::TYPE_SHARE_CREATED;
$settings[] = Data::TYPE_SHARE_CHANGED;
$settings[] = Data::TYPE_SHARE_DELETED;
// $settings[] = Data::TYPE_SHARE_RESHARED;
$settings[] = Data::TYPE_SHARE_RESTORED;
// $settings[] = Data::TYPE_SHARE_DOWNLOADED;
}
if ($method === 'stream' || $method === 'email') {
$settings[] = Data::TYPE_SHARED;
// $settings[] = Data::TYPE_SHARE_EXPIRED;
// $settings[] = Data::TYPE_SHARE_UNSHARED;
//
// $settings[] = Data::TYPE_SHARE_UPLOADED;
//
// $settings[] = Data::TYPE_STORAGE_QUOTA_90;
// $settings[] = Data::TYPE_STORAGE_FAILURE;
}
// Allow other apps to add notification types to the default setting
$additionalSettings = $this->manager->getDefaultTypes($method);
$settings = array_merge($settings, $additionalSettings);
return $settings;
}
示例2: getDefaultSetting
/**
* Get a good default setting for a preference
*
* @param string $method Should be one of 'stream', 'email' or 'setting'
* @param string $type One of the activity types, 'batchtime', 'self' or 'selfemail'
* @return bool|int
*/
public function getDefaultSetting($method, $type)
{
if ($method === 'setting') {
if ($type === 'batchtime') {
return 3600;
} else {
if ($type === 'self') {
return true;
} else {
if ($type === 'selfemail') {
return false;
}
}
}
}
$settings = $this->manager->getDefaultTypes($method);
return in_array($type, $settings);
}