本文整理汇总了PHP中CCalendar::CachePath方法的典型用法代码示例。如果您正苦于以下问题:PHP CCalendar::CachePath方法的具体用法?PHP CCalendar::CachePath怎么用?PHP CCalendar::CachePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCalendar
的用法示例。
在下文中一共展示了CCalendar::CachePath方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetAttendeesList
public static function GetAttendeesList($Params = array(), &$strInvIds)
{
global $DB;
$userKey = intVal($Params['userKey']);
$bCache = CCalendar::CacheTime() > 0;
if ($bCache) {
$cache = new CPHPCache();
$cacheId = 'attendees_list_' . $userKey;
$cachePath = CCalendar::CachePath() . 'attendees_list';
if ($cache->InitCache(CCalendar::CacheTime(), $cacheId, $cachePath)) {
$res = $cache->GetVars();
$strInvIds = $res["strInvIds"];
$arUserMeeting = $res["arUserMeeting"];
}
}
if (!$bCache || !isset($arUserMeeting)) {
$strSql = "SELECT * FROM b_calendar_attendees WHERE USER_KEY='" . $userKey . "'";
$res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$strInvIds = "";
$arUserMeeting = array();
while ($ev = $res->Fetch()) {
$ev["STATUS"] = trim($ev["STATUS"]);
$ev["DESCRIPTION"] = trim($ev["DESCRIPTION"]);
$ev["COLOR"] = trim($ev["COLOR"]);
$ev["TEXT_COLOR"] = trim($ev["TEXT_COLOR"]);
$ev["ACCESSIBILITY"] = trim($ev["ACCESSIBILITY"]);
$arUserMeeting[$ev['EVENT_ID']] = $ev;
$strInvIds .= ',' . intVal($ev['EVENT_ID']);
}
$strInvIds = trim($strInvIds, " ,");
if ($bCache) {
$cache->StartDataCache(CCalendar::CacheTime(), $cacheId, $cachePath);
$cache->EndDataCache(array("strInvIds" => $strInvIds, "arUserMeeting" => $arUserMeeting));
}
}
return $arUserMeeting;
}
示例2: ClearCache
public static function ClearCache($arPath = false)
{
global $CACHE_MANAGER;
$CACHE_MANAGER->ClearByTag("CALENDAR_EVENT_LIST");
if ($arPath === false) {
$arPath = array('access_tasks', 'type_list', 'section_list', 'attendees_list', 'event_list');
} elseif (!is_array($arPath)) {
$arPath = array($arPath);
}
if (is_array($arPath) && count($arPath) > 0) {
$cache = new CPHPCache();
foreach ($arPath as $path) {
if ($path != '') {
$cache->CleanDir(CCalendar::CachePath() . $path);
}
}
}
}
示例3: GetList
public static function GetList($Params = array())
{
global $DB, $USER;
$arFilter = $Params['arFilter'];
$arOrder = isset($Params['arOrder']) ? $Params['arOrder'] : array('SORT' => 'asc');
$Params['joinTypeInfo'] = !!$Params['joinTypeInfo'];
$checkPermissions = $Params['checkPermissions'] !== false;
$bCache = CCalendar::CacheTime() > 0;
if ($bCache) {
$cache = new CPHPCache();
$cacheId = serialize(array('section_list', $arFilter, $arOrder, $Params['joinTypeInfo'], CCalendar::IsIntranetEnabled()));
$cachePath = CCalendar::CachePath() . 'section_list';
if ($cache->InitCache(CCalendar::CacheTime(), $cacheId, $cachePath)) {
$res = $cache->GetVars();
$arResult = $res["arResult"];
$arSectionIds = $res["arSectionIds"];
}
}
if (!$bCache || !isset($arSectionIds)) {
$arFields = self::GetFields();
$arSqlSearch = array();
if (is_array($arFilter)) {
$filter_keys = array_keys($arFilter);
for ($i = 0, $l = count($filter_keys); $i < $l; $i++) {
$n = strtoupper($filter_keys[$i]);
$val = $arFilter[$filter_keys[$i]];
if (is_string($val) && strlen($val) <= 0 || strval($val) == "NOT_REF") {
continue;
}
if ($n == 'ID' || $n == 'XML_ID' || $n == 'OWNER_ID') {
$arSqlSearch[] = GetFilterQuery("CS." . $n, $val, 'N');
} elseif ($n == 'CAL_TYPE' && is_array($val)) {
$strType = "";
foreach ($val as $type) {
$strType .= ",'" . CDatabase::ForSql($type) . "'";
}
$arSqlSearch[] = "CS.CAL_TYPE in (" . trim($strType, ", ") . ")";
$arSqlSearch[] = "CT.ACTIVE='Y'";
} elseif (isset($arFields[$n])) {
$arSqlSearch[] = GetFilterQuery($arFields[$n]["FIELD_NAME"], $val, isset($arFields[$n]["PROCENT"]) && $arFields[$n]["PROCENT"] == "N" ? "N" : "Y");
}
}
}
$strOrderBy = '';
foreach ($arOrder as $by => $order) {
if (isset($arFields[strtoupper($by)])) {
$strOrderBy .= $arFields[strtoupper($by)]["FIELD_NAME"] . ' ' . (strtolower($order) == 'desc' ? 'desc' . (strtoupper($DB->type) == "ORACLE" ? " NULLS LAST" : "") : 'asc' . (strtoupper($DB->type) == "ORACLE" ? " NULLS FIRST" : "")) . ',';
}
}
if (strlen($strOrderBy) > 0) {
$strOrderBy = "ORDER BY " . rtrim($strOrderBy, ",");
}
$strSqlSearch = GetFilterSqlSearch($arSqlSearch);
if (isset($arFilter['ADDITIONAL_IDS']) && is_array($arFilter['ADDITIONAL_IDS']) && count($arFilter['ADDITIONAL_IDS']) > 0) {
$strTypes = "";
foreach ($arFilter['ADDITIONAL_IDS'] as $adid) {
$strTypes .= "," . IntVal($adid);
}
$strSqlSearch = '(' . $strSqlSearch . ') OR ID in(' . trim($strTypes, ', ') . ')';
}
$select = 'CS.*';
$from = 'b_calendar_section CS';
// Fetch types info into selection
if ($Params['joinTypeInfo']) {
$select .= ", CT.NAME AS TYPE_NAME, CT.DESCRIPTION AS TYPE_DESC";
$from .= "\n INNER JOIN b_calendar_type CT ON (CS.CAL_TYPE=CT.XML_ID)";
}
$strSql = "\n\t\t\t\tSELECT\n\t\t\t\t\t{$select}\n\t\t\t\tFROM\n\t\t\t\t\t{$from}\n\t\t\t\tWHERE\n\t\t\t\t\t{$strSqlSearch}\n\t\t\t\t{$strOrderBy}";
$res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$arResult = array();
$arSectionIds = array();
$isExchangeEnabled = CCalendar::IsExchangeEnabled();
$isCalDAVEnabled = CCalendar::IsCalDAVEnabled();
while ($arRes = $res->Fetch()) {
$arRes['COLOR'] = CCalendar::Color($arRes['COLOR'], true);
$arSectionIds[] = $arRes['ID'];
if (isset($arRes['EXPORT']) && $arRes['EXPORT'] != "") {
$arRes['EXPORT'] = unserialize($arRes['EXPORT']);
if (is_array($arRes['EXPORT']) && $arRes['EXPORT']['ALLOW']) {
$arRes['EXPORT']['LINK'] = self::GetExportLink($arRes['ID'], $arRes['CAL_TYPE'], $arRes['OWNER_ID']);
}
}
if (!is_array($arRes['EXPORT'])) {
$arRes['EXPORT'] = array('ALLOW' => false, 'SET' => false, 'LINK' => false);
}
// Outlook js
if (CCalendar::IsIntranetEnabled()) {
$arRes['OUTLOOK_JS'] = CCalendarSect::GetOutlookLink(array('ID' => intVal($arRes['ID']), 'XML_ID' => $arRes['XML_ID'], 'TYPE' => $arRes['CAL_TYPE'], 'NAME' => $arRes['NAME'], 'PREFIX' => CCalendar::GetOwnerName($arRes['CAL_TYPE'], $arRes['OWNER_ID']), 'LINK_URL' => CCalendar::GetOuterUrl()));
}
if ($arRes['CAL_TYPE'] == 'user') {
$arRes['IS_EXCHANGE'] = strlen($arRes["DAV_EXCH_CAL"]) > 0 && $isExchangeEnabled;
if ($arRes["CAL_DAV_CON"] && $isCalDAVEnabled) {
$arRes["CAL_DAV_CON"] = intVal($arRes["CAL_DAV_CON"]);
$resCon = CDavConnection::GetList(array("ID" => "ASC"), array("ID" => $arRes["CAL_DAV_CON"]));
if ($con = $resCon->Fetch()) {
$arRes['CAL_DAV_CON'] = $arRes["CAL_DAV_CON"];
} else {
$arRes['CAL_DAV_CON'] = false;
}
}
//.........这里部分代码省略.........
示例4: GetList
public static function GetList($Params = array())
{
global $DB;
$access = new CAccess();
$access->UpdateCodes();
$arFilter = $Params['arFilter'];
$arOrder = isset($Params['arOrder']) ? $Params['arOrder'] : array('XML_ID' => 'asc');
$checkPermissions = $Params['checkPermissions'] !== false;
$bCache = CCalendar::CacheTime() > 0;
if ($bCache) {
$cache = new CPHPCache();
$cacheId = serialize(array('type_list', $arFilter, $arOrder));
$cachePath = CCalendar::CachePath() . 'type_list';
if ($cache->InitCache(CCalendar::CacheTime(), $cacheId, $cachePath)) {
$res = $cache->GetVars();
$arResult = $res["arResult"];
$arTypeXmlIds = $res["arTypeXmlIds"];
}
}
if (!$bCache || !isset($arTypeXmlIds)) {
static $arFields = array("XML_ID" => array("FIELD_NAME" => "CT.XML_ID", "FIELD_TYPE" => "string"), "NAME" => array("FIELD_NAME" => "CT.NAME", "FIELD_TYPE" => "string"), "ACTIVE" => array("FIELD_NAME" => "CT.ACTIVE", "FIELD_TYPE" => "string"), "DESCRIPTION" => array("FIELD_NAME" => "CT.DESCRIPTION", "FIELD_TYPE" => "string"), "EXTERNAL_ID" => array("FIELD_NAME" => "CT.EXTERNAL_ID", "FIELD_TYPE" => "string"));
$err_mess = "Function: CCalendarType::GetList<br>Line: ";
$arSqlSearch = array();
$strSqlSearch = "";
if (is_array($arFilter)) {
$filter_keys = array_keys($arFilter);
for ($i = 0, $l = count($filter_keys); $i < $l; $i++) {
$n = strtoupper($filter_keys[$i]);
$val = $arFilter[$filter_keys[$i]];
if (is_string($val) && strlen($val) <= 0) {
continue;
}
if ($n == 'XML_ID') {
if (is_array($val)) {
$strXml = "";
foreach ($val as $xmlId) {
$strXml .= ",'" . CDatabase::ForSql($xmlId) . "'";
}
$arSqlSearch[] = "CT.XML_ID in (" . trim($strXml, ", ") . ")";
} else {
$arSqlSearch[] = GetFilterQuery("CT.XML_ID", $val, 'N');
}
}
if ($n == 'EXTERNAL_ID') {
$arSqlSearch[] = GetFilterQuery("CT.EXTERNAL_ID", $val, 'N');
} elseif (isset($arFields[$n])) {
$arSqlSearch[] = GetFilterQuery($arFields[$n]["FIELD_NAME"], $val);
}
}
}
$strOrderBy = '';
foreach ($arOrder as $by => $order) {
if (isset($arFields[strtoupper($by)])) {
$strOrderBy .= $arFields[strtoupper($by)]["FIELD_NAME"] . ' ' . (strtolower($order) == 'desc' ? 'desc' . (strtoupper($DB->type) == "ORACLE" ? " NULLS LAST" : "") : 'asc' . (strtoupper($DB->type) == "ORACLE" ? " NULLS FIRST" : "")) . ',';
}
}
if (strlen($strOrderBy) > 0) {
$strOrderBy = "ORDER BY " . rtrim($strOrderBy, ",");
}
$strSqlSearch = GetFilterSqlSearch($arSqlSearch);
$strSql = "\n\t\t\t\tSELECT\n\t\t\t\t\tCT.*\n\t\t\t\tFROM\n\t\t\t\t\tb_calendar_type CT\n\t\t\t\tWHERE\n\t\t\t\t\t{$strSqlSearch}\n\t\t\t\t{$strOrderBy}";
$res = $DB->Query($strSql, false, $err_mess . __LINE__);
$arResult = array();
$arTypeXmlIds = array();
while ($arRes = $res->Fetch()) {
$arResult[] = $arRes;
$arTypeXmlIds[] = $arRes['XML_ID'];
}
if ($bCache) {
$cache->StartDataCache(CCalendar::CacheTime(), $cacheId, $cachePath);
$cache->EndDataCache(array("arResult" => $arResult, "arTypeXmlIds" => $arTypeXmlIds));
}
}
if ($checkPermissions && count($arTypeXmlIds) > 0) {
$arPerm = self::GetArrayPermissions($arTypeXmlIds);
$res = array();
$arAccessCodes = array();
foreach ($arResult as $type) {
$typeXmlId = $type['XML_ID'];
if (self::CanDo('calendar_type_view', $typeXmlId)) {
$type['PERM'] = array('view' => self::CanDo('calendar_type_view', $typeXmlId), 'add' => self::CanDo('calendar_type_add', $typeXmlId), 'edit' => self::CanDo('calendar_type_edit', $typeXmlId), 'edit_section' => self::CanDo('calendar_type_edit_section', $typeXmlId), 'access' => self::CanDo('calendar_type_access', $typeXmlId));
if (self::CanDo('calendar_type_access', $typeXmlId)) {
$type['ACCESS'] = array();
if (count($arPerm[$typeXmlId]) > 0) {
// Add codes to get they full names for interface
$arAccessCodes = array_merge($arAccessCodes, array_keys($arPerm[$typeXmlId]));
$type['ACCESS'] = $arPerm[$typeXmlId];
}
}
$res[] = $type;
}
}
CCalendar::PushAccessNames($arAccessCodes);
$arResult = $res;
}
return $arResult;
}
示例5: GetList
public static function GetList($Params = array())
{
global $DB, $USER_FIELD_MANAGER;
$getUF = $Params['getUserfields'] !== false;
$checkPermissions = $Params['checkPermissions'] !== false;
$bCache = CCalendar::CacheTime() > 0;
$Params['setDefaultLimit'] = $Params['setDefaultLimit'] === true;
$userId = isset($Params['userId']) ? intVal($Params['userId']) : CCalendar::GetCurUserId();
CTimeZone::Disable();
if ($bCache) {
$cache = new CPHPCache();
$cacheId = 'event_list_' . md5(serialize($Params));
if ($checkPermissions) {
$cacheId .= 'chper' . CCalendar::GetCurUserId() . '|';
}
if (CCalendar::IsSocNet() && CCalendar::IsSocnetAdmin()) {
$cacheId .= 'socnetAdmin|';
}
$cacheId .= CCalendar::GetOffset();
$cachePath = CCalendar::CachePath() . 'event_list';
if ($cache->InitCache(CCalendar::CacheTime(), $cacheId, $cachePath)) {
$res = $cache->GetVars();
$arResult = $res["arResult"];
$arAttendees = $res["arAttendees"];
}
}
if (!$bCache || !isset($arResult)) {
$arFilter = $Params['arFilter'];
if ($getUF) {
$obUserFieldsSql = new CUserTypeSQL();
$obUserFieldsSql->SetEntity("CALENDAR_EVENT", "CE.ID");
$obUserFieldsSql->SetSelect(array("UF_*"));
$obUserFieldsSql->SetFilter($arFilter);
}
$fetchMeetings = $Params['fetchMeetings'];
$Params['fetchAttendees'] = $Params['fetchAttendees'] !== false;
$skipDeclined = $Params['skipDeclined'] === true;
if ($Params['setDefaultLimit'] !== false) {
if (!isset($arFilter["FROM_LIMIT"])) {
// default 3 month back
$arFilter["FROM_LIMIT"] = CCalendar::Date(time() - 31 * 3 * 24 * 3600, false);
}
if (!isset($arFilter["TO_LIMIT"])) {
// default one year into the future
$arFilter["TO_LIMIT"] = CCalendar::Date(time() + 365 * 24 * 3600, false);
}
}
$arOrder = isset($Params['arOrder']) ? $Params['arOrder'] : array('SORT' => 'asc');
$arFields = self::GetFields();
if ($arFilter["DELETED"] === false) {
unset($arFilter["DELETED"]);
} elseif (!isset($arFilter["DELETED"])) {
$arFilter["DELETED"] = "N";
}
$ownerId = isset($arFilter['OWNER_ID']) ? $arFilter['OWNER_ID'] : CCalendar::GetOwnerId();
$arSqlSearch = array();
if (is_array($arFilter)) {
$filter_keys = array_keys($arFilter);
for ($i = 0, $l = count($filter_keys); $i < $l; $i++) {
$n = strtoupper($filter_keys[$i]);
$val = $arFilter[$filter_keys[$i]];
if (is_string($val) && strlen($val) <= 0 || strval($val) == "NOT_REF") {
continue;
}
if ($n == 'FROM_LIMIT') {
$ts = CCalendar::Timestamp($val, false);
if ($ts > 0) {
$arSqlSearch[] = "CE.DATE_TO_TS_UTC>=" . $ts;
}
} elseif ($n == 'TO_LIMIT') {
$ts = CCalendar::Timestamp($val, false);
if ($ts > 0) {
$arSqlSearch[] = "CE.DATE_FROM_TS_UTC<=" . ($ts + 86399);
}
} elseif ($n == 'OWNER_ID' && intVal($val) > 0) {
$arSqlSearch[] = "CE.OWNER_ID=" . intVal($val);
}
if ($n == 'NAME') {
$arSqlSearch[] = "CE.NAME='" . CDatabase::ForSql($val) . "'";
} elseif ($n == 'CREATED_BY') {
if (is_array($val)) {
$val = array_map(intVal, $val);
$arSqlSearch[] = 'CE.CREATED_BY IN (\'' . implode('\',\'', $val) . '\')';
} else {
if (intVal($val) > 0) {
$arSqlSearch[] = "CE.CREATED_BY=" . intVal($val);
}
}
} elseif ($n == 'SECTION') {
if (!is_array($val)) {
$val = array($val);
}
$q = "";
if (is_array($val)) {
$sval = '';
foreach ($val as $sectid) {
if (intVal($sectid) > 0) {
$sval .= intVal($sectid) . ',';
}
}
//.........这里部分代码省略.........
示例6: ClearCache
public static function ClearCache($arPath = false)
{
if ($arPath === false)
$arPath = array(
'access_tasks',
'type_list',
'section_list',
'attendees_list',
'event_list'
);
elseif (!is_array($arPath))
$arPath = array($arPath);
if (is_array($arPath) && count($arPath) > 0)
{
$cache = new CPHPCache;
foreach($arPath as $path)
if ($path != '')
$cache->CleanDir(CCalendar::CachePath().$path);
}
}