本文整理汇总了PHP中SugarFolder::save方法的典型用法代码示例。如果您正苦于以下问题:PHP SugarFolder::save方法的具体用法?PHP SugarFolder::save怎么用?PHP SugarFolder::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SugarFolder
的用法示例。
在下文中一共展示了SugarFolder::save方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createAutoImportSugarFolder
/**
* Create a sugar folder for this inbound email account
* if the Enable Auto Import option is selected
*
* @return String Id of the sugar folder created.
*/
function createAutoImportSugarFolder()
{
global $current_user;
$guid = create_guid();
$GLOBALS['log']->debug("Creating Sugar Folder for IE with id {$guid}");
$folder = new SugarFolder();
$folder->id = $guid;
$folder->new_with_id = TRUE;
$folder->name = $this->name;
$folder->has_child = 0;
$folder->is_group = 1;
$folder->assign_to_id = $current_user->id;
$folder->parent_folder = "";
//If this inbound email is marked as inactive, don't add subscriptions.
$addSubscriptions = $this->status == 'Inactive' || $this->mailbox_type == 'bounce' ? FALSE : TRUE;
$folder->save($addSubscriptions);
return $guid;
}
示例2: createFolder
/**
* Creates Mail folder
*
* @param object $user User in focus
* @param array $folder_params Array of parameters for folder creation
*/
protected function createFolder($user, $folder_params)
{
$folder = new SugarFolder();
foreach ($folder_params as $key => $val) {
$folder->{$key} = $val;
}
$folder->save();
return $folder;
}
示例3: preflightUser
/**
* Creates defaults for the User
* @param object $user User in focus
*/
function preflightUser(&$user)
{
global $mod_strings;
$goodToGo = $user->getPreference("email2Preflight", "Emails");
$q = "SELECT count(*) count FROM folders f where f.created_by = '{$user->id}' AND f.folder_type = 'inbound' AND f.deleted = 0";
$r = $user->db->query($q);
$a = $user->db->fetchByAssoc($r);
if ($a['count'] < 1) {
require_once "include/SugarFolders/SugarFolders.php";
// My Emails
$folder = new SugarFolder();
$folder->new_with_id = true;
$folder->id = create_guid();
$folder->name = $mod_strings['LNK_MY_INBOX'];
$folder->has_child = 1;
$folder->created_by = $user->id;
$folder->modified_by = $user->id;
$folder->is_dynamic = 1;
$folder->folder_type = "inbound";
$folder->dynamic_query = $this->generateDynamicFolderQuery('inbound', $user->id);
$folder->save();
// My Drafts
$drafts = new SugarFolder();
$drafts->name = $mod_strings['LNK_MY_DRAFTS'];
$drafts->has_child = 0;
$drafts->parent_folder = $folder->id;
$drafts->created_by = $user->id;
$drafts->modified_by = $user->id;
$drafts->is_dynamic = 1;
$drafts->folder_type = "draft";
$drafts->dynamic_query = $this->generateDynamicFolderQuery('draft', $user->id);
$drafts->save();
// My Archived
//$archived = new SugarFolder();
//$archived->name = $mod_strings['LNK_MY_ARCHIVED_LIST'];
//$archived->has_child = 0;
//$archived->parent_folder = $folder->id;
//$archived->created_by = $user->id;
//$archived->modified_by = $user->id;
//$archived->is_dynamic = 1;
//$archived->dynamic_query = $this->generateDynamicFolderQuery('archived', $user->id);
//$archived->save();
// Sent Emails
$archived = new SugarFolder();
$archived->name = $mod_strings['LNK_SENT_EMAIL_LIST'];
$archived->has_child = 0;
$archived->parent_folder = $folder->id;
$archived->created_by = $user->id;
$archived->modified_by = $user->id;
$archived->is_dynamic = 1;
$archived->folder_type = "sent";
$archived->dynamic_query = $this->generateDynamicFolderQuery('sent', $user->id);
$archived->save();
// set flag to show that this was run
$user->setPreference("email2Preflight", true, 1, "Emails");
}
}
示例4: syncSugarFoldersWithBeanChanges
/**
* Certain updates to the IE account need to be reflected in the related SugarFolder since they are
* created automatically. Only valid for IE accounts with auto import turned on.
*
* @param string $fieldName The field name that changed
* @param SugarBean $focus The InboundEmail bean being saved.
*/
function syncSugarFoldersWithBeanChanges($fieldName, $focus)
{
$f = new SugarFolder();
$f->retrieve($focus->groupfolder_id);
switch ($fieldName) {
case 'name':
case 'team_id':
case 'team_set_id':
$f->{$fieldName} = $focus->{$fieldName};
$f->save();
break;
case 'status':
if ($focus->status == 'Inactive') {
$f->clearSubscriptionsForFolder($focus->groupfolder_id);
} else {
if ($focus->mailbox_type != 'bounce') {
$f->addSubscriptionsToGroupFolder();
}
}
break;
}
}
示例5: testFolderEmailMethods
/**
* Tests sugar folder methods that deal with emails.
*
*/
function testFolderEmailMethods()
{
$emailParams = array('status' => 'read');
$email = $this->_createEmailObject($emailParams);
$this->emails[] = $email->id;
$this->_createNewSugarFolder();
$this->folder->addBean($email, $GLOBALS['current_user']);
$emailExists = $this->folder->checkEmailExistForFolder($email->id);
$this->assertTrue($emailExists, "Unable to check for emails with a specific folder");
//Remove the specific email from our folder.
$this->folder->deleteEmailFromFolder($email->id);
$emailExists = $this->folder->checkEmailExistForFolder($email->id);
$this->assertFalse($emailExists, "Unable to check for emails with a specific folder.");
//Move the Email bean from one folder to another
$f3 = new SugarFolder();
$f3->id = create_guid();
$f3->new_with_id = TRUE;
$f3->save();
$this->additionalFolders[] = $f3->id;
$this->folder->addBean($email, $GLOBALS['current_user']);
$emailExists = $f3->checkEmailExistForFolder($email->id);
$this->assertFalse($emailExists);
$this->folder->move($this->folder->id, $f3->id, $email->id);
$emailExists = $f3->checkEmailExistForFolder($email->id);
$this->assertTrue($emailExists, "Unable to move Emails bean to a different sugar folder");
}