本文整理汇总了PHP中Call::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Call::save方法的具体用法?PHP Call::save怎么用?PHP Call::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Call
的用法示例。
在下文中一共展示了Call::save方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createCall
public static function createCall()
{
$time = mt_rand();
$name = 'Call';
$call = new Call();
$call->name = $name . $time;
$call->save();
self::$_createdCalls[] = $call;
return $call;
}
示例2: run
public function run()
{
$data = new Call();
$data->level_id = 1;
$data->function = 'backgroundObj';
$data->x = 0;
$data->y = 85;
$data->width = 700;
$data->height = 15;
$data->color = 'black';
$data->save();
}
示例3: testSaveAndMarkDeleted
public function testSaveAndMarkDeleted()
{
$call = new Call();
$call->name = 'test';
$call->id = $call->save();
//test for record ID to verify that record is saved
$this->assertTrue(isset($call->id));
$this->assertEquals(36, strlen($call->id));
//mark the record as deleted and verify that this record cannot be retrieved anymore.
$call->mark_deleted($call->id);
$result = $call->retrieve($call->id);
$this->assertEquals(null, $result);
}
示例4: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
// $validator = new Validator::make(Input::all(), ObjectsData::$rules);
// if( $validator->fails())
// {
// return Redirect::back()->withInput()->withErrors($validator);
// } else {
// $oldData = ObjectsData::were('level_id', 1)->get();
// dd($oldData);
$prev = Level::where('next_level', '=', NULL)->first();
$lvl = new Level();
$lvl->game_id = 1;
$lvl->level_name = Input::get('level_name');
$lvl->next_level = null;
$lvl->save();
$prev->next_level = $lvl->id;
$prev->save();
// $oldData = Call::where('level_id', $lvl->id)->get();
// foreach($oldData as $old)
// {
// $old->destroy($old->id);
// }
$lines = explode('*', Input::get('csvString'));
foreach ($lines as $line) {
$data = explode(',', $line);
$submit = new Call();
$submit->level_id = $lvl->id;
$submit->function = $data[0];
$submit->x = $data[1];
$submit->y = $data[2];
$submit->width = $data[3];
$submit->height = $data[4];
$submit->color = $data[5];
$submit->save();
}
if ($submit) {
return Redirect::action('GamesController@show', $lvl->id);
} else {
return Redirect::action('GamesController@create')->withInput();
}
// }
}
示例5: Call
}
// Adds the new relationship! (This must be done here in case the call has already been hungup as that's when asteriskLogger sets relations)
$focus = new Call();
$focus->retrieve($callRecord);
$focus->load_relationship('contacts');
// Remove any contacts already associated with call (if there are any)
foreach ($focus->contacts->getBeans() as $contact) {
$focus->contacts->delete($callRecord, $contact->id);
}
$focus->contacts->add($contactId);
// Add the new one!
$contactBean = new Contact();
$contactBean->retrieve($contactId);
$focus->parent_id = $contactBean->account_id;
$focus->parent_type = "Accounts";
$focus->save();
} else {
if ($_REQUEST['action'] == "call") {
// TODO: For some reason this code isn't working... I think it's getting the extension.
// For the time being, callCreate is still being used.
/*
$cUser = new User();
$cUser->retrieve($_SESSION['authenticated_user_id']);
$extension = $cUser->asterisk_ext_c;
//$extension = $current_user->asterisk_ext_c;
$context = $sugar_config['asterisk_context'];
// Take the user supplied pattern, we find the part with the #'s (which are the ext)... then we get something like
// asterisk_dialout_channel == "SIP/###" --> $matches[1] == SIP/, $matches[2] == "###", $matches[3] is "".
// asterisk_dialout_channel == "Local/###@sugarsip/n" --> $matches[1] == Local/, $matches[2] == "###", $matches[3] is "@sugarsip/n".
示例6: _createUpcomingActivities
private function _createUpcomingActivities()
{
$GLOBALS['current_user']->setPreference('datef', 'Y-m-d');
$GLOBALS['current_user']->setPreference('timef', 'H:i');
$date1 = $GLOBALS['timedate']->to_display_date_time(gmdate("Y-m-d H:i:s", gmmktime() + 3600 * 24 * 2), true, true, $GLOBALS['current_user']);
//Two days from today
$date2 = $GLOBALS['timedate']->to_display_date_time(gmdate("Y-m-d H:i:s", gmmktime() + 3600 * 24 * 4), true, true, $GLOBALS['current_user']);
//Two days from today
$callID = uniqid();
$c = new Call();
$c->id = $callID;
$c->new_with_id = TRUE;
$c->status = 'Not Planned';
$c->date_start = $date1;
$c->name = "UNIT TEST";
$c->assigned_user_id = $this->_user->id;
$c->save(FALSE);
$callID = uniqid();
$c = new Call();
$c->id = $callID;
$c->new_with_id = TRUE;
$c->status = 'Planned';
$c->date_start = $date1;
$c->name = "UNIT TEST";
$c->assigned_user_id = $this->_user->id;
$c->save(FALSE);
$taskID = uniqid();
$t = new Task();
$t->id = $taskID;
$t->new_with_id = TRUE;
$t->status = 'Not Started';
$t->date_due = $date2;
$t->name = "UNIT TEST";
$t->assigned_user_id = $this->_user->id;
$t->save(FALSE);
return array($callID, $taskID);
}
示例7: CreateTaskAndCallForNewOpportunity
function CreateTaskAndCallForNewOpportunity($bean)
{
$timeDate = new TimeDate();
if (empty($bean->fetched_row['id'])) {
$task = new Task();
$task->name = "Send Proposal";
$task->priority = "High";
$task->status = "Not Started";
$task->date_due = $timeDate->getNow(true)->modify("+1 days")->asDb();
$task->parent_type = "Opportunities";
$task->parent_id = $bean->id;
$task->assigned_user_id = $bean->assigned_user_id;
$task->save();
$call = new Call();
$call->name = "Follow up";
$call->direction = "Outbound";
$call->status = "Planned";
$call->duration_hours = 0;
$call->duration_minutes = 15;
$call->date_start = $timeDate->getNow(true)->modify("+2 days")->asDb();
$call->parent_type = "Opportunities";
$call->parent_id = $bean->id;
$call->assigned_user_id = $bean->assigned_user_id;
$call->save();
}
}
示例8: Call
$note->assigned_user_id = $account->assigned_user_id;
$note->assigned_user_name = $account->assigned_user_name;
$note->save();
$call = new Call();
$call->parent_type = 'Accounts';
$call->parent_id = $account->id;
$call->name = $call_seed_data_names[mt_rand(0, 3)];
$call->assigned_user_id = $account->assigned_user_id;
$call->assigned_user_name = $account->assigned_user_name;
$call->direction = 'Outbound';
$call->date_start = create_date() . ' ' . create_time();
$call->duration_hours = '0';
$call->duration_minutes = '30';
$call->account_id = $account->id;
$call->status = 'Planned';
$call->save();
//Create new opportunities
$opp = new Opportunity();
$opp->assigned_user_id = $account->assigned_user_id;
$opp->assigned_user_name = $account->assigned_user_name;
$opp->name = substr($account_name . " - 1000 units", 0, 50);
$opp->date_closed = create_date();
$key = array_rand($app_list_strings['lead_source_dom']);
$opp->lead_source = $app_list_strings['lead_source_dom'][$key];
$key = array_rand($app_list_strings['sales_stage_dom']);
$opp->sales_stage = $app_list_strings['sales_stage_dom'][$key];
// If the deal is already one, make the date closed occur in the past.
if ($opp->sales_stage == "Closed Won" || $opp->sales_stage == "Closed Lost") {
$opp->date_closed = create_past_date();
}
$key = array_rand($app_list_strings['opportunity_type_dom']);
示例9: testCallEmptyStatusLangConfig
/**
* @group bug40999
* Check if empty status is handled correctly
*/
public function testCallEmptyStatusLangConfig()
{
$this->markTestIncomplete("This test is failing on Jenkins only. Disabling for now");
$langpack = new SugarTestLangPackCreator();
$langpack->setModString('LBL_DEFAULT_STATUS', 'FAILED!', 'Calls');
$langpack->save();
$GLOBALS['mod_strings'] = return_module_language($GLOBALS['current_language'], 'Calls');
$call = new Call();
$call->field_defs['status']['default'] = 'My Call';
$call = new Call();
$this->callid = $call->id = create_guid();
$call->new_with_id = 1;
$call->save();
// then retrieve
$call = new Call();
$call->retrieve($this->callid);
$this->assertEquals('My Call', $call->status);
}
示例10: _createUpcomingActivities
private function _createUpcomingActivities()
{
$GLOBALS['current_user']->setPreference('datef', 'Y-m-d');
$GLOBALS['current_user']->setPreference('timef', 'H:i');
global $timedate;
$date1 = $timedate->asUser($timedate->getNow()->modify("+2 days"));
$date2 = $timedate->asUser($timedate->getNow()->modify("+4 days"));
$callID = uniqid();
$c = new Call();
$c->id = $callID;
$c->new_with_id = TRUE;
$c->status = 'Not Planned';
$c->date_start = $date1;
$c->name = "UNIT TEST";
$c->assigned_user_id = $GLOBALS['current_user']->id;
$c->save(FALSE);
$callID = uniqid();
$c = new Call();
$c->id = $callID;
$c->new_with_id = TRUE;
$c->status = 'Planned';
$c->date_start = $date1;
$c->name = "UNIT TEST";
$c->assigned_user_id = $GLOBALS['current_user']->id;
$c->save(FALSE);
$taskID = uniqid();
$t = new Task();
$t->id = $taskID;
$t->new_with_id = TRUE;
$t->status = 'Not Started';
$t->date_due = $date2;
$t->name = "UNIT TEST";
$t->assigned_user_id = $GLOBALS['current_user']->id;
$t->save(FALSE);
$GLOBALS['db']->commit();
return array($callID, $taskID);
}
示例11: setBeanID
function setBeanID($call_record, $bean_module, $bean_id)
{
//wrapped the entire action to require a call_record - if this is not being passed then there is no point for this action - PJH
if (is_string($call_record) && is_string($bean_id)) {
// Very basic sanitization
$bean_id = preg_replace('/[^a-z0-9\\-\\. ]/i', '', $bean_id);
$bean_module = preg_replace('/[^a-z0-9\\-\\. ]/i', '', $bean_module);
$call_record = preg_replace('/[^a-z0-9\\-\\. ]/i', '', $call_record);
// Workaround See Discussion here: https://github.com/blak3r/yaai/pull/20
$parent_module = null;
$parent_id = null;
$parent_name = null;
$parent_link = null;
$bean_link = build_link($bean_module, $bean_id);
$bean_module = strtolower($bean_module);
if ($bean_module == 'contacts') {
$c = new Contact();
$c->retrieve($bean_id);
$bean_name = $c->name;
$bean_description = $c->description;
$parent_id = $c->account_id;
$parent_module = "accounts";
$parent_name = $c->account_name;
//$GLOBALS["log"]->fatal(print_r($c,true));
} else {
if ($bean_module == "accounts") {
$a = new Account();
$a->retrieve($bean_id);
$bean_name = $a->name;
$bean_description = $a->description;
} else {
$GLOBALS['log']->fatal("Unsupported Module: {$bean_module}!");
}
}
$query = "update asterisk_log set bean_id='{$bean_id}', bean_module='{$bean_module}', bean_name='{$bean_name}', bean_link='{$bean_link}', bean_description='{$bean_description}', " . " parent_id='{$parent_id}', parent_module='{$parent_module}', parent_name='{$parent_name}', parent_link='{$parent_link}' " . " where call_record_id='{$call_record}'";
// $GLOBALS['log']->fatal($query);
$GLOBALS['current_user']->db->query($query, false);
if ($GLOBALS['current_user']->db->checkError()) {
trigger_error("Update setContactId-Query failed: {$query}");
}
$focus = new Call();
$focus->retrieve($call_record);
$focus->load_relationship('contacts');
$focus->load_relationship('accounts');
// TODO here, find if there is a way to remove all relationships dynamically so we don't need to specify 'contacts', 'accounts' explicitly
// Remove any contacts already associated with call (if there are any)
foreach ($focus->contacts->getBeans() as $contact) {
$focus->contacts->delete($call_record, $contact->id);
}
foreach ($focus->accounts->getBeans() as $account) {
$focus->accounts->delete($call_record, $account->id);
}
switch ($bean_module) {
case 'contacts':
$focus->contacts->add($bean_id);
// Add the new one!
$contactBean = new Contact();
$contactBean->retrieve($bean_id);
$focus->parent_id = $contactBean->account_id;
$focus->parent_type = "Accounts";
break;
case 'accounts':
$focus->accounts->add($bean_id);
break;
}
$focus->save();
}
}
示例12: callComplete
//.........这里部分代码省略.........
$call->direction = "Outbound";
if (strpos(strtolower($_REQUEST['From']), 'client:') === false) {
//Call in or using call conection
if (strpos(strtolower($_REQUEST['Direction']), 'inbound') !== false) {
//this is inbound call
$call_sid = $_REQUEST['CallSid'];
$call->direction = "Inbound";
}
}
$call_record = $client->account->calls->get($call_sid);
// if(is_array($call_record->recordings)){
// _ppl('array');
// }else{
// _ppl('not array');
// }
//_ppl($call_record);
// foreach($call_record->recordings as $record_obj){
// $call->description= "Recording URL: ". $record_obj->RecordingUrl;
// //break;
// _ppl('recording url:' . $record_obj->RecordingUrl);
// _ppl('recording url2:' . $record_obj->recordingurl);
// }
//$RecordingUrl
_ppl('from: ' . $call_record->from);
_ppl('to: ' . $call_record->to);
_ppl('Direction: ' . $call_record->direction);
if ($call->direction == 'Inbound') {
$call->name = "Call from {$call_record->from}";
/*
* currently, we only support looking up the phone number in E.164 number formatting, see following URL for detail
* http://www.twilio.com/help/faq/phone-numbers/how-do-i-format-phone-numbers-to-work-internationally
*/
$matched_obj = lookup_inbound_obj($call_record->from);
$module_name = isset($matched_obj['module_name']) ? $matched_obj['module_name'] : '';
$record_id = isset($matched_obj['record_id']) ? $matched_obj['record_id'] : '';
} else {
if (strpos(strtolower($_REQUEST['From']), 'client:') === false) {
$call->name = "Call to {$call_record->to} (using connection)";
} else {
$call->name = "Call to {$call_record->to}";
}
}
$start_time = new DateTime(isset($call_record->starttime) ? $call_record->starttime : '');
$end_time = new DateTime(isset($call_record->endtime) ? $call_record->endtime : '');
$timezone = new DateTimeZone("UTC");
$start_time->setTimezone($timezone);
$end_time->setTimezone($timezone);
$call->date_start = $start_time->format($timedate->get_db_date_time_format());
$call->date_end = $end_time->format($timedate->get_db_date_time_format());
_ppl('duration: ' . $call_record->duration);
$duration_hours = floor($call_record->duration / 3600);
$duration_minutes = $call_record->duration / 60 % 60;
$call->duration_hours = $duration_hours;
if ($duration_minutes > 0 && $duration_minutes <= 15) {
$call->duration_minutes = 15;
} elseif ($duration_minutes > 15 && $duration_minutes <= 30) {
$call->duration_minutes = 30;
} elseif ($duration_minutes > 30 && $duration_minutes <= 45) {
$call->duration_minutes = 45;
} else {
$call->duration_minutes = 0;
}
$call->status = "Held";
$call->team_id = '1';
$call->assigned_user_id = '1';
$call->parent_type = 'Contacts';
$call->parent_id = $record_id;
if ($module_name == 'Contacts') {
$call->contact_id = $record_id;
$contact_bean = new Contact();
$contact_bean->retrieve($record_id);
$call->parent_type = 'Accounts';
$call->parent_id = $contact_bean->account_id;
}
if ($module_name == 'Accounts') {
$call->parent_id = $record_id;
$call->parent_type = 'Accounts';
}
$call->save();
if ($module_name == 'Contacts') {
$call->load_relationship("contacts");
$call->contacts->add($record_id);
} else {
if ($module_name == 'Leads') {
$call->load_relationship("leads");
$call->leads->add($record_id);
} else {
if ($module_name == 'Users') {
$call->load_relationship("users");
$call->users->add($record_id);
}
}
}
header('Content-type: text/xml');
?>
<Response>
<Hangup/>
</Response>
<?php
}