本文整理汇总了PHP中CCalendar::GetAccessTasksByName方法的典型用法代码示例。如果您正苦于以下问题:PHP CCalendar::GetAccessTasksByName方法的具体用法?PHP CCalendar::GetAccessTasksByName怎么用?PHP CCalendar::GetAccessTasksByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCalendar
的用法示例。
在下文中一共展示了CCalendar::GetAccessTasksByName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: InstallEvents
function InstallEvents()
{
global $DB;
$arCurPhpVer = Explode(".", PhpVersion());
if (IntVal($arCurPhpVer[0]) < 5)
return true;
$sIn = "'CALENDAR_INVITATION'";
$rs = $DB->Query("SELECT count(*) C FROM b_event_type WHERE EVENT_NAME IN (".$sIn.") ", false, "File: ".__FILE__."<br>Line: ".__LINE__);
$ar = $rs->Fetch();
if($ar["C"] <= 0)
include($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/calendar/install/events.php");
if (!IsModuleInstalled('intranet'))
{
COption::SetOptionString("intranet", "calendar_2", "Y");
CModule::IncludeModule('calendar');
CCalendar::ClearCache();
CCalendar::CacheTime(0);
$arTypes = CCalendarType::GetList();
if (!$arTypes || !count($arTypes))
{
CCalendarType::Edit(array(
'NEW' => true,
'arFields' => array(
'XML_ID' => 'events',
'NAME' => GetMessage('CAL_DEFAULT_TYPE'),
'ACCESS' => array(
'G2' => CCalendar::GetAccessTasksByName('calendar_type', 'calendar_type_view')
)
)
));
}
}
return true;
}
示例2: array
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
if (!CModule::IncludeModule("calendar") || WIZARD_IS_RERUN) {
return;
}
COption::SetOptionString("intranet", "calendar_2", "Y");
// company calendar calendar type
CCalendarType::Edit(array('NEW' => true, 'arFields' => array('XML_ID' => 'company_calendar', 'NAME' => GetMessage('CAL_TYPE_COMPANY_NAME'), 'DESCRIPTION' => '', 'ACCESS' => array('G2' => CCalendar::GetAccessTasksByName('calendar_type', 'calendar_type_view')))));
// Sections
$sectId0 = CCalendar::SaveSection(array('arFields' => array('CAL_TYPE' => 'company_calendar', 'ID' => 0, 'NAME' => GetMessage("CAL_COMPANY_SECT_0"), 'DESCRIPTION' => GetMessage("CAL_COMPANY_SECT_DESC_0"), 'COLOR' => '#855CC5', 'TEXT_COLOR' => '', 'OWNER_ID' => '', 'EXPORT' => array('ALLOW' => true, 'SET' => '3_9'), 'ACCESS' => array(), 'IS_EXCHANGE' => false)));
$sectId1 = CCalendar::SaveSection(array('arFields' => array('CAL_TYPE' => 'company_calendar', 'ID' => 0, 'NAME' => GetMessage("CAL_COMPANY_SECT_1"), 'DESCRIPTION' => GetMessage("CAL_COMPANY_SECT_DESC_1"), 'COLOR' => '#7DDEC2', 'TEXT_COLOR' => '', 'OWNER_ID' => '', 'EXPORT' => array('ALLOW' => true, 'SET' => '3_9'), 'ACCESS' => array(), 'IS_EXCHANGE' => false)));
$sectId2 = CCalendar::SaveSection(array('arFields' => array('CAL_TYPE' => 'company_calendar', 'ID' => 0, 'NAME' => GetMessage("CAL_COMPANY_SECT_2"), 'DESCRIPTION' => GetMessage("CAL_COMPANY_SECT_DESC_2"), 'COLOR' => '#F6EA68', 'TEXT_COLOR' => '', 'OWNER_ID' => '', 'EXPORT' => array('ALLOW' => true, 'SET' => '3_9'), 'ACCESS' => array(), 'IS_EXCHANGE' => false)));
// Events for company_calendar
CCalendar::SaveEvent(array('arFields' => array('CAL_TYPE' => 'company_calendar', 'OWNER_ID' => 0, 'NAME' => GetMessage("CAL_COMP_EVENT_NAME_0"), 'DESCRIPTION' => GetMessage("CAL_COMP_EVENT_DESC_0"), 'DT_FROM' => GetTime(mktime(9, 0, 0, date("m"), date("d"), date("Y")), "FULL"), 'DT_TO' => GetTime(mktime(16, 0, 0, date("m"), date("d"), date("Y")), "FULL"), 'RRULE' => array('FREQ' => 'WEEKLY', 'INTERVAL' => 1, 'UNTIL' => GetTime(mktime(0, 0, 0, date("m"), date("d"), date("Y") + 1), "SHORT"), 'BYDAY' => 'TU'), 'SECTIONS' => $sectId0), 'userId' => 1));
CCalendar::SaveEvent(array('arFields' => array('CAL_TYPE' => 'company_calendar', 'OWNER_ID' => 0, 'NAME' => GetMessage("CAL_COMP_EVENT_NAME_1"), 'DESCRIPTION' => GetMessage("CAL_COMP_EVENT_DESC_1"), 'DT_FROM' => GetTime(mktime(0, 0, 0, date("m"), date("d") + 2, date("Y")), "SHORT"), 'DT_TO' => GetTime(mktime(0, 0, 0, date("m"), date("d") + 2, date("Y")), "SHORT"), 'RRULE' => array('FREQ' => 'MONTHLY', 'INTERVAL' => 1, 'UNTIL' => GetTime(mktime(0, 0, 0, date("m"), date("d"), date("Y") + 1), "SHORT")), 'SECTIONS' => $sectId0), 'userId' => 1));
CCalendar::SaveEvent(array('arFields' => array('CAL_TYPE' => 'company_calendar', 'OWNER_ID' => 0, 'NAME' => GetMessage("CAL_COMP_EVENT_NAME_2"), 'DESCRIPTION' => GetMessage("CAL_COMP_EVENT_DESC_2"), 'DT_FROM' => GetTime(mktime(10, 0, 0, date("m"), date("d"), date("Y")), "FULL"), 'DT_TO' => GetTime(mktime(12, 0, 0, date("m"), date("d"), date("Y")), "FULL"), 'RRULE' => array('FREQ' => 'WEEKLY', 'INTERVAL' => 1, 'BYDAY' => 'MO'), 'SECTIONS' => $sectId1), 'userId' => 1));
CCalendar::SaveEvent(array('arFields' => array('CAL_TYPE' => 'company_calendar', 'OWNER_ID' => 0, 'NAME' => GetMessage("CAL_COMP_EVENT_NAME_3"), 'DESCRIPTION' => GetMessage("CAL_COMP_EVENT_DESC_3"), 'DT_FROM' => GetTime(mktime(9, 0, 0, date("m"), date("d"), date("Y")), "FULL"), 'DT_TO' => GetTime(mktime(18, 0, 0, date("m"), date("d"), date("Y")), "FULL"), 'RRULE' => array('FREQ' => 'WEEKLY', 'INTERVAL' => 1, 'BYDAY' => 'TU'), 'SECTIONS' => $sectId2), 'userId' => 1));
CCalendar::SaveEvent(array('arFields' => array('CAL_TYPE' => 'company_calendar', 'OWNER_ID' => 0, 'NAME' => GetMessage("CAL_COMP_EVENT_NAME_4"), 'DESCRIPTION' => GetMessage("CAL_COMP_EVENT_DESC_4"), 'DT_FROM' => GetTime(mktime(12, 0, 0, date("m"), date("d"), date("Y")), "FULL"), 'DT_TO' => GetTime(mktime(17, 0, 0, date("m"), date("d"), date("Y")), "FULL"), 'RRULE' => array('FREQ' => 'WEEKLY', 'INTERVAL' => 1, 'BYDAY' => 'FR'), 'SECTIONS' => $sectId2), 'userId' => 1));
CCalendar::SaveEvent(array('arFields' => array('CAL_TYPE' => 'company_calendar', 'OWNER_ID' => 1, 'NAME' => GetMessage("CAL_COMP_EVENT_NAME_5"), 'DESCRIPTION' => GetMessage("CAL_COMP_EVENT_DESC_5"), 'DT_FROM' => GetTime(mktime(16, 0, 0, date("m"), date("d"), date("Y")), "FULL"), 'DT_TO' => GetTime(mktime(21, 0, 0, date("m"), date("d"), date("Y")), "FULL"), 'RRULE' => array('FREQ' => 'WEEKLY', 'INTERVAL' => 1, 'BYDAY' => 'SA'), 'SECTIONS' => $sectId1), 'userId' => 1));
// User's calendar type
CCalendarType::Edit(array('NEW' => true, 'arFields' => array('XML_ID' => 'user', 'NAME' => GetMessage('CAL_TYPE_USER_NAME'), 'DESCRIPTION' => '', 'ACCESS' => array('G2' => CCalendar::GetAccessTasksByName('calendar_type', 'calendar_type_edit')))));
// Group's calendar type
CCalendarType::Edit(array('NEW' => true, 'arFields' => array('XML_ID' => 'group', 'NAME' => GetMessage('CAL_TYPE_GROUP_NAME'), 'DESCRIPTION' => '', 'ACCESS' => array('G2' => CCalendar::GetAccessTasksByName('calendar_type', 'calendar_type_edit')))));
$id = CCalendar::SaveEvent(array('arFields' => array('CAL_TYPE' => 'user', 'OWNER_ID' => 1, 'NAME' => GetMessage("W_IB_CALENDAR_EMP_ABS"), 'DT_FROM' => GetTime(mktime(12, 0, 0, date("m"), date("d") + 1, date("Y")), "FULL"), 'DT_TO' => GetTime(mktime(14, 0, 0, date("m"), date("d") + 1, date("Y")), "FULL"), 'DESCRIPTION' => ''), 'userId' => 1, 'autoDetectSection' => true, 'autoCreateSection' => true));
示例3: ConvertEntity
public static function ConvertEntity($ownerType, $ownerId, $sectionId, $iblockId, $createdBy)
{
$eventsCount = 0;
$sectCount = 0;
$bs = new CIBlockSection();
$ent_id = "IBLOCK_" . $iblockId . "_SECTION";
$result = array('eventsCount' => 0, 'sectCount' => 0);
$bSetAccessFromCalendar = true;
$Access = array('G2' => CCalendar::GetAccessTasksByName('calendar_section', 'calendar_denied'));
// CONVERT ACCESS:
if ($ownerType == 'user') {
if (!CSocNetFeatures::IsActiveFeature(SONET_ENTITY_USER, $ownerId, "calendar")) {
return $result;
}
// Read
$read = CSocNetFeaturesPerms::GetOperationPerm(SONET_ENTITY_USER, $ownerId, "calendar", 'view');
$taskId = CCalendar::GetAccessTasksByName('calendar_section', 'calendar_view');
if ($read == 'A') {
// All users
$Access['G2'] = $taskId;
} elseif ($read == 'C') {
// All autorized
$Access['AU'] = $taskId;
} elseif ($read == 'M' || $read == 'E') {
// Friends
$Access['SU' . $ownerId . '_F'] = $taskId;
} elseif ($bSetAccessFromCalendar) {
$bSetAccessFromCalendar = false;
}
// Write - will override read access
$write = CSocNetFeaturesPerms::GetOperationPerm(SONET_ENTITY_USER, $ownerId, "calendar", 'write');
$taskId = CCalendar::GetAccessTasksByName('calendar_section', 'calendar_edit');
if ($write == 'A') {
// All users
$Access['G2'] = $taskId;
} elseif ($write == 'C') {
// All autorized
$Access['AU'] = $taskId;
} elseif ($write == 'M' || $write == 'E') {
// Friends
$Access['SU' . $ownerId . '_F'] = $taskId;
}
} elseif ($ownerType == 'group') {
if (!CSocNetFeatures::IsActiveFeature(SONET_ENTITY_GROUP, $ownerId, "calendar")) {
return $result;
}
// Read
$read = CSocNetFeaturesPerms::GetOperationPerm(SONET_ENTITY_GROUP, $ownerId, "calendar", 'view');
$taskId = CCalendar::GetAccessTasksByName('calendar_section', 'calendar_view');
if ($read == 'A') {
// Group owner
$Access['SG' . $ownerId . '_A'] = $taskId;
} elseif ($read == 'E') {
// Group moderator
$Access['SG' . $ownerId . '_E'] = $taskId;
} elseif ($read == 'K') {
// User
$Access['SG' . $ownerId . '_K'] = $taskId;
} elseif ($read == 'L') {
// Authorized
$Access['AU'] = $taskId;
} elseif ($read == 'N') {
// Authorized
$Access['G2'] = $taskId;
}
// Write - will override read access
$write = CSocNetFeaturesPerms::GetOperationPerm(SONET_ENTITY_GROUP, $ownerId, "calendar", 'write');
$taskId = CCalendar::GetAccessTasksByName('calendar_section', 'calendar_edit');
if ($write == 'A') {
// Group owner
$Access['SG' . $ownerId . '_A'] = $taskId;
} elseif ($write == 'E') {
// Group moderator
$Access['SG' . $ownerId . '_E'] = $taskId;
} elseif ($write == 'K') {
// User
$Access['SG' . $ownerId . '_K'] = $taskId;
} elseif ($write == 'L') {
// Authorized
$Access['AU'] = $taskId;
} elseif ($write == 'N') {
// Authorized
$Access['G2'] = $taskId;
}
} else {
$arGroupPerm = CIBlock::GetGroupPermissions($iblockId);
$taskByLetter = array('D' => CCalendar::GetAccessTasksByName('calendar_section', 'calendar_denied'), 'R' => CCalendar::GetAccessTasksByName('calendar_section', 'calendar_view'), 'W' => CCalendar::GetAccessTasksByName('calendar_section', 'calendar_edit'), 'X' => CCalendar::GetAccessTasksByName('calendar_section', 'calendar_access'));
foreach ($arGroupPerm as $groupId => $letter) {
$Access['G' . $groupId] = $taskByLetter[$letter];
}
}
// 1. Fetch sections
$arUserSections = CEventCalendar::GetCalendarList(array($iblockId, $sectionId, 0, $ownerType));
$calendarIndex = array();
foreach ($arUserSections as $section) {
$arUF = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields($ent_id, $section['ID']);
if (isset($arUF["UF_CAL_CONVERTED"]) && strlen($arUF["UF_CAL_CONVERTED"]['VALUE']) > 0) {
continue;
}
$SectionAccess = array();
//.........这里部分代码省略.........
示例4: GetDefaultAccess
public static function GetDefaultAccess($type, $ownerId)
{
if (CCalendar::IsIntranetEnabled()) {
$access = array('G2' => CCalendar::GetAccessTasksByName('calendar_section', 'calendar_view_time'));
} else {
$access = array('G2' => CCalendar::GetAccessTasksByName('calendar_section', 'calendar_view'));
}
if ($type == 'user') {
} elseif ($type == 'group' && $ownerId > 0) {
$access['SG' . $ownerId . '_A'] = CCalendar::GetAccessTasksByName('calendar_section', 'calendar_access');
$access['SG' . $ownerId . '_E'] = CCalendar::GetAccessTasksByName('calendar_section', 'calendar_edit');
$access['SG' . $ownerId . '_K'] = CCalendar::GetAccessTasksByName('calendar_section', 'calendar_edit');
} else {
}
// Creator of the section
$access['U' . CCalendar::GetUserId()] = CCalendar::GetAccessTasksByName('calendar_section', 'calendar_access');
$arAccessCodes = array();
foreach ($access as $code => $o) {
$arAccessCodes[] = $code;
}
CCalendar::PushAccessNames($arAccessCodes);
return $access;
}
示例5: array
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
if (!CModule::IncludeModule("calendar")) {
return;
}
COption::SetOptionString("intranet", "calendar_2", "Y");
if (WIZARD_FIRST_INSTAL != 'Y') {
// calendar type
$arTypes = CCalendarType::GetList(array("arFilter" => array("XML_ID" => 'events_info')));
if (!$arTypes || count($arTypes) <= 0) {
CCalendarType::Edit(array('NEW' => true, 'arFields' => array('XML_ID' => 'events_info', 'NAME' => GetMessage('CAL_DEFAULT_TYPE'), 'ACCESS' => array('G2' => CCalendar::GetAccessTasksByName('calendar_type', 'calendar_type_view')))));
}
// Sections
$sectId0 = CCalendar::SaveSection(array('arFields' => array('CAL_TYPE' => 'events_info', 'ID' => 0, 'NAME' => GetMessage("CAL_TYPE_COMPANY_NAME"), 'DESCRIPTION' => "", 'COLOR' => '#855CC5', 'TEXT_COLOR' => '', 'OWNER_ID' => '', 'EXPORT' => array('ALLOW' => true, 'SET' => '3_9'), 'ACCESS' => array(), 'IS_EXCHANGE' => false)));
// Events for company_calendar
CCalendar::SaveEvent(array('arFields' => array('CAL_TYPE' => 'events_info', 'OWNER_ID' => 0, 'NAME' => GetMessage("CAL_EVENT_1_NAME"), 'DESCRIPTION' => "", 'DT_FROM' => GetTime(mktime(0, 0, 0, date("m"), date("d") + 4, date("Y")), "FULL"), 'DT_TO' => GetTime(mktime(0, 0, 0, date("m"), date("d") + 4, date("Y")), "FULL"), 'RRULE' => array(), 'SECTIONS' => $sectId0), 'userId' => 1));
CCalendar::SaveEvent(array('arFields' => array('CAL_TYPE' => 'events', 'OWNER_ID' => 0, 'NAME' => GetMessage("CAL_EVENT_2_NAME"), 'DESCRIPTION' => "", 'COLOR' => '#FFFF80', 'DT_FROM' => GetTime(mktime(0, 0, 0, date("m"), date("d"), date("Y")), "SHORT"), 'DT_TO' => GetTime(mktime(0, 0, 0, date("m"), date("d"), date("Y")), "SHORT"), 'RRULE' => array('FREQ' => 'WEEKLY', 'INTERVAL' => 3, 'BYDAY' => 'SA'), 'SECTIONS' => $sectId0), 'userId' => 1));
}