本文整理匯總了PHP中vCal::cache_sugar_vcal方法的典型用法代碼示例。如果您正苦於以下問題:PHP vCal::cache_sugar_vcal方法的具體用法?PHP vCal::cache_sugar_vcal怎麽用?PHP vCal::cache_sugar_vcal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vCal
的用法示例。
在下文中一共展示了vCal::cache_sugar_vcal方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: while
$query = "SELECT email_marketing_prospect_lists.id from email_marketing_prospect_lists ";
$query .= " left join email_marketing on email_marketing.id=email_marketing_prospect_lists.email_marketing_id";
$query .= " where email_marketing.campaign_id='{$record}'";
$query .= " and email_marketing_prospect_lists.prospect_list_id='{$linked_id}'";
$result = $focus->db->query($query);
while (($row = $focus->db->fetchByAssoc($result)) != null) {
$del_query = " update email_marketing_prospect_lists set email_marketing_prospect_lists.deleted=1, email_marketing_prospect_lists.date_modified=" . db_convert("'" . gmdate($GLOBALS['timedate']->get_db_date_time_format(), time()) . "'", 'datetime');
$del_query .= " WHERE email_marketing_prospect_lists.id='{$row['id']}'";
$focus->db->query($del_query);
}
$focus->db->query($query);
}
if ($bean_name == "Meeting") {
$focus->retrieve($record);
$user = new User();
$user->retrieve($linked_id);
if (!empty($user->id)) {
//make sure that record exists. we may have a contact on our hands.
if ($focus->update_vcal) {
vCal::cache_sugar_vcal($user);
}
}
}
if (!empty($_REQUEST['return_url'])) {
$_REQUEST['return_url'] = urldecode($_REQUEST['return_url']);
}
$GLOBALS['log']->debug("deleted relationship: bean: {$bean_name}, linked_field: {$linked_field}, linked_id:{$linked_id}");
if (empty($_REQUEST['refresh_page'])) {
handleRedirect();
}
exit;
示例2: markRepeatDeleted
/**
* Delete recurring activities and their invitee relationships
* @param SugarBean $bean
*/
static function markRepeatDeleted(SugarBean $bean)
{
// we don't use mark_deleted method here because it runs very slowly
global $db;
$date_modified = $GLOBALS['timedate']->nowDb();
if (!empty($GLOBALS['current_user'])) {
$modified_user_id = $GLOBALS['current_user']->id;
} else {
$modified_user_id = 1;
}
$lower_name = strtolower($bean->object_name);
$qu = "SELECT id FROM {$bean->table_name} WHERE repeat_parent_id = '{$bean->id}' AND deleted = 0";
$re = $db->query($qu);
while ($ro = $db->fetchByAssoc($re)) {
$id = $ro['id'];
$date_modified = $GLOBALS['timedate']->nowDb();
$db->query("UPDATE {$bean->table_name} SET deleted = 1, date_modified = " . $db->convert($db->quoted($date_modified), 'datetime') . ", modified_user_id = '{$modified_user_id}' WHERE id = '{$id}'");
$db->query("UPDATE {$bean->rel_users_table} SET deleted = 1, date_modified = " . $db->convert($db->quoted($date_modified), 'datetime') . " WHERE {$lower_name}_id = '{$id}'");
$db->query("UPDATE {$bean->rel_contacts_table} SET deleted = 1, date_modified = " . $db->convert($db->quoted($date_modified), 'datetime') . " WHERE {$lower_name}_id = '{$id}'");
$db->query("UPDATE {$bean->rel_leads_table} SET deleted = 1, date_modified = " . $db->convert($db->quoted($date_modified), 'datetime') . " WHERE {$lower_name}_id = '{$id}'");
}
vCal::cache_sugar_vcal($GLOBALS['current_user']);
}
示例3: set_accept_status
function set_accept_status(&$user,$status)
{
if ( $user->object_name == 'User')
{
$relate_values = array('user_id'=>$user->id,'call_id'=>$this->id);
$data_values = array('accept_status'=>$status);
$this->set_relationship($this->rel_users_table, $relate_values, true, true,$data_values);
global $current_user;
if ( $this->update_vcal )
{
vCal::cache_sugar_vcal($user);
}
}
else if ( $user->object_name == 'Contact')
{
$relate_values = array('contact_id'=>$user->id,'call_id'=>$this->id);
$data_values = array('accept_status'=>$status);
$this->set_relationship($this->rel_contacts_table, $relate_values, true, true,$data_values);
}
else if ( $user->object_name == 'Lead')
{
$relate_values = array('lead_id'=>$user->id,'call_id'=>$this->id);
$data_values = array('accept_status'=>$status);
$this->set_relationship($this->rel_leads_table, $relate_values, true, true,$data_values);
}
}
示例4: handleSave
//.........這裏部分代碼省略.........
if (!empty($_POST['parent_id']) && $_POST['parent_type'] == 'Leads') {
$focus->leads_arr[] = $_POST['parent_id'];
}
// Call the Meeting module's save function to handle saving other fields besides
// the users and contacts relationships
$focus->update_vcal = false;
// Bug #49195 : don't update vcal b/s related users aren't saved yet, create vcal cache below
$focus->save(true);
$return_id = $focus->id;
if (empty($return_id)) {
//this is to handle the situation where the save fails, most likely because of a failure
//in the external api. bug: 42200
$_REQUEST['action'] = 'EditView';
$_REQUEST['return_action'] = 'EditView';
handleRedirect('', 'Meetings');
}
// Process users
$existing_users = array();
if (!empty($_POST['existing_invitees'])) {
$existing_users = explode(",", trim($_POST['existing_invitees'], ','));
}
foreach ($focus->users_arr as $user_id) {
if (empty($user_id) || isset($existing_users[$user_id]) || isset($deleteUsers[$user_id])) {
continue;
}
if (!isset($acceptStatusUsers[$user_id])) {
$focus->users->add($user_id);
} else {
if (!$focus->date_changed) {
// update query to preserve accept_status
$qU = 'UPDATE meetings_users SET deleted = 0, accept_status = \'' . $acceptStatusUsers[$user_id] . '\' ';
$qU .= 'WHERE meeting_id = \'' . $focus->id . '\' ';
$qU .= 'AND user_id = \'' . $user_id . '\'';
$focus->db->query($qU);
}
}
}
// Process contacts
$existing_contacts = array();
if (!empty($_POST['existing_contact_invitees'])) {
$existing_contacts = explode(",", trim($_POST['existing_contact_invitees'], ','));
}
foreach ($focus->contacts_arr as $contact_id) {
if (empty($contact_id) || isset($existing_contacts[$contact_id]) || isset($deleteContacts[$contact_id])) {
continue;
}
if (!isset($acceptStatusContacts[$contact_id])) {
$focus->contacts->add($contact_id);
} else {
if (!$focus->date_changed) {
// update query to preserve accept_status
$qU = 'UPDATE meetings_contacts SET deleted = 0, accept_status = \'' . $acceptStatusContacts[$contact_id] . '\' ';
$qU .= 'WHERE meeting_id = \'' . $focus->id . '\' ';
$qU .= 'AND contact_id = \'' . $contact_id . '\'';
$focus->db->query($qU);
}
}
}
// Process leads
$existing_leads = array();
if (!empty($_POST['existing_lead_invitees'])) {
$existing_leads = explode(",", trim($_POST['existing_lead_invitees'], ','));
}
foreach ($focus->leads_arr as $lead_id) {
if (empty($lead_id) || isset($existing_leads[$lead_id]) || isset($deleteLeads[$lead_id])) {
continue;
}
if (!isset($acceptStatusLeads[$lead_id])) {
$focus->leads->add($lead_id);
} else {
if (!$focus->date_changed) {
// update query to preserve accept_status
$qU = 'UPDATE meetings_leads SET deleted = 0, accept_status = \'' . $acceptStatusLeads[$lead_id] . '\' ';
$qU .= 'WHERE meeting_id = \'' . $focus->id . '\' ';
$qU .= 'AND lead_id = \'' . $lead_id . '\'';
$focus->db->query($qU);
}
}
}
// Bug #49195 : update vcal
vCal::cache_sugar_vcal($current_user);
// CCL - Comment out call to set $current_user as invitee
// set organizer to auto-accept
if ($focus->assigned_user_id == $current_user->id && $newBean) {
$focus->set_accept_status($current_user, 'accept');
}
//// END REBUILD INVITEE RELATIONSHIPS
///////////////////////////////////////////////////////////////////////////
}
}
if (isset($_REQUEST['return_module']) && $_REQUEST['return_module'] == 'Home') {
header("Location: index.php?module=Home&action=index");
} else {
if ($redirect) {
handleRedirect($return_id, 'Meetings');
} else {
return $focus;
}
}
}
示例5: handleSave
//.........這裏部分代碼省略.........
}
} elseif (empty($focus->id)) {
//this is not from long form so add assigned and current user automatically as there is no invitee list UI.
//This call could be through an ajax call from subpanels or shortcut bar
if (!isset($_POST['user_invitees'])) {
$_POST['user_invitees'] = '';
}
$_POST['user_invitees'] .= ',' . $_POST['assigned_user_id'] . ', ';
//add current user if the assigned to user is different than current user.
if ($current_user->id != $_POST['assigned_user_id'] && $_REQUEST['module'] != "Calendar") {
$_POST['user_invitees'] .= ',' . $current_user->id . ', ';
}
//remove any double comma's introduced during appending
$_POST['user_invitees'] = str_replace(',,', ',', $_POST['user_invitees']);
}
if (isset($_POST['isSaveFromDetailView']) && $_POST['isSaveFromDetailView'] == 'true' || (isset($_POST['is_ajax_call']) && !empty($_POST['is_ajax_call']) && !empty($focus->id) || isset($_POST['return_action']) && $_POST['return_action'] == 'SubPanelViewer' && !empty($focus->id)) || !isset($_POST['user_invitees'])) {
$focus->save(true);
$return_id = $focus->id;
} else {
if ($focus->status == 'Held' && $this->isEmptyReturnModuleAndAction() && !$this->isSaveFromDCMenu()) {
//if we are closing the meeting, and the request does not have a return module AND return action set and it is not a save
//being triggered by the DCMenu (shortcut bar) then the request is coming from a dashlet or subpanel close icon and there is no
//need to process user invitees, just save the current values.
$focus->save(true);
} else {
$relate_to = $this->getRelatedModuleName($focus);
$userInvitees = array();
$contactInvitees = array();
$leadInvitees = array();
$existingUsers = array();
$existingContacts = array();
$existingLeads = array();
if (!empty($_POST['user_invitees'])) {
$userInvitees = explode(',', trim($_POST['user_invitees'], ','));
}
if (!empty($_POST['existing_invitees'])) {
$existingUsers = explode(",", trim($_POST['existing_invitees'], ','));
}
if (!empty($_POST['contact_invitees'])) {
$contactInvitees = explode(',', trim($_POST['contact_invitees'], ','));
}
if (!empty($_POST['existing_contact_invitees'])) {
$existingContacts = explode(",", trim($_POST['existing_contact_invitees'], ','));
}
if (!empty($_POST['parent_id']) && $_POST['parent_type'] == 'Contacts') {
$contactInvitees[] = $_POST['parent_id'];
}
if ($relate_to == 'Contacts') {
if (!empty($_REQUEST['relate_id']) && !in_array($_REQUEST['relate_id'], $contactInvitees)) {
$contactInvitees[] = $_REQUEST['relate_id'];
}
}
if (!empty($_POST['lead_invitees'])) {
$leadInvitees = explode(',', trim($_POST['lead_invitees'], ','));
}
if (!empty($_POST['existing_lead_invitees'])) {
$existingLeads = explode(",", trim($_POST['existing_lead_invitees'], ','));
}
if (!empty($_POST['parent_id']) && $_POST['parent_type'] == 'Leads') {
$leadInvitees[] = $_POST['parent_id'];
}
if ($relate_to == 'Leads') {
if (!empty($_REQUEST['relate_id']) && !in_array($_REQUEST['relate_id'], $leadInvitees)) {
$leadInvitees[] = $_REQUEST['relate_id'];
}
}
// Call the Meeting module's save function to handle saving other fields besides
// the users and contacts relationships
$focus->update_vcal = false;
// Bug #49195 : don't update vcal b/s related users aren't saved yet, create vcal cache below
$focus->users_arr = $userInvitees;
$focus->contacts_arr = $contactInvitees;
$focus->leads_arr = $leadInvitees;
$focus->save(true);
$return_id = $focus->id;
if (empty($return_id)) {
//this is to handle the situation where the save fails, most likely because of a failure
//in the external api. bug: 42200
$_REQUEST['action'] = 'EditView';
$_REQUEST['return_action'] = 'EditView';
handleRedirect('', 'Meetings');
}
$focus->setUserInvitees($userInvitees, $existingUsers);
$focus->setContactInvitees($contactInvitees, $existingContacts);
$focus->setLeadInvitees($focus->leads_arr, $existingLeads);
// Bug #49195 : update vcal
vCal::cache_sugar_vcal($current_user);
$this->processRecurring($focus);
}
}
if (isset($_REQUEST['return_module']) && $_REQUEST['return_module'] === 'Home') {
SugarApplication::redirect(buildRedirectURL('', 'Home'));
} else {
if ($redirect) {
handleRedirect($return_id, 'Meetings');
} else {
return $focus;
}
}
}
示例6: rebuildFreeBusyCache
/**
* Rebuild the FreeBusy Vcal Cache for specified user
*/
public function rebuildFreeBusyCache(User $user)
{
vCal::cache_sugar_vcal($user);
}
示例7: testcache_sugar_vcal
public function testcache_sugar_vcal()
{
$vcal = new vCal();
$user_focus = new User('1');
//execute the method and test if it works and does not throws an exception.
try {
$vcal->cache_sugar_vcal($user_focus);
$this->assertTrue(true);
} catch (Exception $e) {
$this->fail();
}
}
示例8: set_accept_status
function set_accept_status(&$user, $status)
{
if ($user->object_name == 'User') {
$relate_values = array('user_id' => $user->id, 'meeting_id' => $this->id);
$data_values = array('accept_status' => $status);
$this->set_relationship($this->rel_users_table, $relate_values, true, true, $data_values);
global $current_user;
require_once 'modules/vCals/vCal.php';
if ($this->update_vcal) {
vCal::cache_sugar_vcal($user);
}
} else {
if ($user->object_name == 'Contact') {
$relate_values = array('contact_id' => $user->id, 'meeting_id' => $this->id);
$data_values = array('accept_status' => $status);
$this->set_relationship($this->rel_contacts_table, $relate_values, true, true, $data_values);
}
}
}