本文整理匯總了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);
}