本文整理汇总了PHP中Contacts类的典型用法代码示例。如果您正苦于以下问题:PHP Contacts类的具体用法?PHP Contacts怎么用?PHP Contacts使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Contacts类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildDocumentModel
function buildDocumentModel()
{
global $app_strings;
try {
$model = parent::buildDocumentModel();
$this->generateEntityModel($this->focus, 'Potentials', 'potential_', $model);
$entity = new Accounts();
if ($this->focusColumnValue('related_to')) {
$entity->retrieve_entity_info($this->focusColumnValue('related_to'), 'Accounts');
}
$this->generateEntityModel($entity, 'Accounts', 'account_', $model);
$entity = new Contacts();
if ($this->focusColumnValue('contact_id')) {
$entity->retrieve_entity_info($this->focusColumnValue('contact_id'), 'Contacts');
}
$this->generateEntityModel($entity, 'Contacts', 'contact_', $model);
$this->generateUi10Models($model);
$this->generateRelatedListModels($model);
$model->set('potential_no', $this->focusColumnValue('potential_no'));
$model->set('potential_owner', getUserFullName($this->focusColumnValue('assigned_user_id')));
return $model;
} catch (Exception $e) {
echo '<meta charset="utf-8" />';
if ($e->getMessage() == $app_strings['LBL_RECORD_DELETE']) {
echo $app_strings['LBL_RECORD_INCORRECT'];
echo '<br><br>';
} else {
echo $e->getMessage();
echo '<br><br>';
}
return null;
}
}
示例2: buildDocumentModel
function buildDocumentModel()
{
global $app_strings;
try {
$model = parent::buildDocumentModel();
$this->generateEntityModel($this->focus, 'PurchaseOrder', 'purchaseorder_', $model);
$entity = new Contacts();
if ($this->focusColumnValue('contact_id')) {
$entity->retrieve_entity_info($this->focusColumnValue('contact_id'), 'Contacts');
}
$this->generateEntityModel($entity, 'Contacts', 'contact_', $model);
$entity = new Vendors();
if ($this->focusColumnValue('vendor_id')) {
$entity->retrieve_entity_info($this->focusColumnValue('vendor_id'), 'Vendors');
}
$this->generateEntityModel($entity, 'Vendors', 'vendor_', $model);
$this->generateUi10Models($model);
$this->generateRelatedListModels($model);
$model->set('purchaseorder_no', $this->focusColumnValue('purchaseorder_no'));
return $model;
} catch (Exception $e) {
echo '<meta charset="utf-8" />';
if ($e->getMessage() == $app_strings['LBL_RECORD_DELETE']) {
echo $app_strings['LBL_RECORD_INCORRECT'];
echo '<br><br>';
} else {
echo $e->getMessage();
echo '<br><br>';
}
return null;
}
}
示例3: __construct
public function __construct($options = null)
{
$staff = new Contacts();
$flos = $staff->getAttending();
parent::__construct($options);
ZendX_JQuery::enableForm($this);
$decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'apppend', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li')));
$this->setName('addFlo');
$flo = new Zend_Form_Element_Select('staffID');
$flo->setLabel('Finds officer present: ')->setRequired(true)->addFilters(array('StringTrim', 'StripTags'))->addValidator('Int')->setDecorators($decorators)->addMultiOptions(array(NULL => 'Choose attending officer', 'Our staff members' => $flos));
$dateFrom = new ZendX_JQuery_Form_Element_DatePicker('dateFrom');
$dateFrom->setLabel('Attended from: ')->setRequired(true)->addValidator('Date')->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty')->setAttrib('size', 20)->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'li'))->removeDecorator('DtDdWrapper');
$dateTo = new ZendX_JQuery_Form_Element_DatePicker('dateTo');
$dateTo->setLabel('Attended to: ')->setRequired(true)->addValidator('Date')->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 20)->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'li'))->removeDecorator('DtDdWrapper');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submit')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag');
$hash = new Zend_Form_Element_Hash('csrf');
$hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60);
$this->addElement($hash);
$this->addElements(array($flo, $dateFrom, $dateTo, $submit));
$this->addDisplayGroup(array('staffID', 'dateFrom', 'dateTo'), 'details')->removeDecorator('HtmlTag');
$this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
$this->details->removeDecorator('DtDdWrapper');
$this->details->removeDecorator('HtmlTag');
$this->details->setLegend('Attending Finds Officers');
$this->addDisplayGroup(array('submit'), 'submit');
$this->submit->removeDecorator('DtDdWrapper');
$this->submit->removeDecorator('HtmlTag');
}
示例4: save
public function save()
{
$this->load->model('contacts');
$contact = new Contacts();
$contact->id = 1;
$contact->name = $this->input->post('name');
$contact->number = $this->input->post('number');
$contact->city = $this->input->post('city');
if ($contact->save()) {
die('Saved');
}
}
示例5: testGetRecordIds
public function testGetRecordIds()
{
$_GET['Contacts'] = array('firstName' => 't', 'assignedTo' => 'Chris');
$_GET['Contacts_sort'] = 'id.desc';
$contact = new Contacts('search');
$dataProvider = $contact->search(PHP_INT_MAX);
$dataProvider->calculateChecksum = true;
$data = $dataProvider->getData();
$this->assertNotEquals(0, count($data));
$ids = array();
foreach ($data as $model) {
$ids[] = $model->id;
}
$this->assertEquals($dataProvider->getRecordIds(), $ids);
$contact = new Contacts('search');
// lower page size so that record count is incorrect
$dataProvider = $contact->search(10);
$dataProvider->calculateChecksum = true;
$data = $dataProvider->getData();
$this->assertNotEquals(0, count($data));
$ids = array();
foreach ($data as $model) {
$ids[] = $model->id;
}
$this->assertNotEquals($dataProvider->getRecordIds(), $ids);
// ensure that default ordering gets applied in both cases (SmartActiveDataProvider applies
// default id DESC ordering if /\bid\b/ isn't found in sort order)
$_GET['Contacts'] = array('firstName' => 't', 'assignedTo' => 'Chris');
$_GET['Contacts_sort'] = 'dupeCheck.desc';
$contact = new Contacts('search');
$dataProvider = $contact->search(PHP_INT_MAX);
$dataProvider->calculateChecksum = true;
$data = $dataProvider->getData();
$this->assertNotEquals(0, count($data));
$ids = array();
foreach ($data as $model) {
$ids[] = $model->id;
}
$this->assertEquals($dataProvider->getRecordIds(), $ids);
// more filters, different sort order
$_GET['Contacts'] = array('firstName' => 't', 'lastName' => '<>t', 'assignedTo' => 'Chloe', 'rating' => '<4');
$_GET['Contacts_sort'] = 'rating.desc';
$contact = new Contacts('search');
$dataProvider = $contact->search(PHP_INT_MAX);
$dataProvider->calculateChecksum = true;
$data = $dataProvider->getData();
$this->assertNotEquals(0, count($data));
$ids = array();
foreach ($data as $model) {
$ids[] = $model->id;
}
$this->assertEquals($dataProvider->getRecordIds(), $ids);
}
示例6: AddNew
/**
* Add a new contact
* @param $id
* @param array $data
* @return integer contact_id
*/
public static function AddNew(array $data, $id = "")
{
if (is_numeric($id)) {
$contact = self::find($id);
} else {
$contact = new Contacts();
}
$contact['contact'] = $data['contact'];
$contact['type_id'] = $data['type_id'];
$contact['customer_id'] = $data['customer_id'];
$contact->save();
return $contact['contact_id'];
}
示例7: createContact
private function createContact($con)
{
$con_model = new \Contacts();
$con_model->attributes = $con;
$con_model->ID_user = $this->tiUser->ID;
try {
if (!$con_model->save()) {
new \Error(5, null, json_encode($con_model->getErrors()));
}
} catch (Exception $e) {
new \Error(5, null, $e->getMessage());
}
}
示例8: profileAction
/** Set up view for individual contact
*/
public function profileAction()
{
if ($this->_getParam('id', false)) {
$id = $this->_getParam('id');
$staffs = new Contacts();
$this->view->staffs = $staffs->getPersonDetails($id);
$findstotals = new Finds();
$this->view->findstotals = $findstotals->getFindsFloQuarter($id);
$periodtotals = new Finds();
$this->view->periodtotals = $periodtotals->getFindsFloPeriod($id);
} else {
throw new Pas_Exception_Param($this->_missingParameter);
}
}
示例9: profileAction
/** Profile page
* @access public
* @return void
* @throws Pas_Exception_Param
*/
public function profileAction()
{
if ($this->getParam('id', false)) {
$id = $this->getParam('id');
$staffs = new Contacts();
$this->view->persons = $staffs->getPersonDetails($id);
$this->view->findstotals = $this->getFinds()->getFindsFloQuarter($id);
$this->view->periodtotals = $this->getFinds()->getFindsFloPeriod($id);
$accts = new OnlineAccounts();
$this->view->accts = $accts->getAccounts($id);
} else {
throw new Pas_Exception_Param($this->_missingParameter, 500);
}
}
示例10: testSubscription
/**
* Test subscribing and then receiving data:
*/
public function testSubscription()
{
// 1: Request to subscribe:
$hookName = 'ContactsCreate';
$hook = array('event' => 'RecordCreateTrigger', 'target_url' => TEST_WEBROOT_URL . '/api2HooksTest.php?name=' . $hookName);
$ch = $this->getCurlHandle('POST', array('{suffix}' => ''), 'admin', $hook, array(CURLOPT_HEADER => 1));
$response = curl_exec($ch);
$this->assertResponseCodeIs(201, $ch, VERBOSE_MODE ? $response : '');
$trigger = ApiHook::model()->findByAttributes($hook);
// 2. Create a contact
$contact = array('firstName' => 'Walter', 'lastName' => 'White', 'email' => 'walter.white@sandia.gov', 'visibility' => 1);
$ch = curl_init(TEST_BASE_URL . 'api2/Contacts');
$options = array(CURLOPT_POSTFIELDS => json_encode($contact), CURLOPT_HTTPHEADER => array('Content-Type: application/json'), CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => true);
foreach ($this->authCurlOpts() as $opt => $optVal) {
$options[$opt] = $optVal;
}
curl_setopt_array($ch, $options);
$response = curl_exec($ch);
$c = Contacts::model()->findByAttributes($contact);
$this->assertResponseCodeIs(201, $ch);
$this->assertNotEmpty($c);
// 3. Test that the receiving end got the payload
$outputDir = implode(DIRECTORY_SEPARATOR, array(Yii::app()->basePath, 'tests', 'data', 'output'));
$this->assertFileExists($outputDir . DIRECTORY_SEPARATOR . "hook_{$hookName}.json");
$contactPulled = json_decode(file_get_contents($outputDir . DIRECTORY_SEPARATOR . "hook_pulled_{$hookName}.json"), 1);
foreach ($contact as $field => $value) {
$this->assertEquals($value, $contactPulled[$field]);
}
}
示例11: fetchSpecificContact
private function fetchSpecificContact()
{
$con_model = Contacts::model()->findAllByAttributes($this->contacts);
foreach ($con_model as $data) {
$this->data[] = $data->attributes;
}
}
示例12: getUser
/**
* Return user object
*
* @param void
* @return Contact
*/
function getUser()
{
if (is_null($this->user)) {
$this->user = Contacts::findById($this->getContactId());
}
return $this->user;
}
示例13: afterMemberPermissionChanged
/**
*
* @param array $permissions with the member and the changed_pgs
*/
function afterMemberPermissionChanged($permissions)
{
$member = array_var($permissions, 'member');
//get all users in the set of permissions groups
$permissionGroupIds = array();
foreach (array_var($permissions, 'changed_pgs') as $pg_id) {
$permissionGroupId = $pg_id;
if (!in_array($permissionGroupId, $permissionGroupIds)) {
$permissionGroupIds[] = $permissionGroupId;
}
}
if (count($permissionGroupIds) > 0) {
$usersIds = ContactPermissionGroups::getAllContactsIdsByPermissionGroupIds($permissionGroupIds);
foreach ($usersIds as $us_id) {
$user = Contacts::findById($us_id);
ContactMemberCaches::updateContactMemberCache($user, $member->getId());
}
} else {
//update this member for all user in cache
$contacts = Contacts::getAllUsers();
foreach ($contacts as $contact) {
ContactMemberCaches::updateContactMemberCache($contact, $member->getId());
}
}
}
示例14: run
public function run()
{
$actionParams = Yii::app()->controller->getActionParams();
$address = '';
if (Yii::app()->controller->module != null && Yii::app()->controller->module->id == 'contacts' && Yii::app()->controller->action->id == 'view' && isset($actionParams['id'])) {
// must have an actual ID value
$currentRecord = Contacts::model()->findByPk($actionParams['id']);
if (!empty($currentRecord->city)) {
if (!empty($currentRecord->address)) {
$address .= $currentRecord->address . ', ';
}
$address .= $currentRecord->city . ', ';
}
if (!empty($currentRecord->state)) {
$address .= $currentRecord->state . ' ';
}
if (!empty($currentRecord->zipcode)) {
$address .= $currentRecord->zipcode . ' ';
}
if (!empty($currentRecord->country)) {
$address .= $currentRecord->country;
}
}
$this->render('googleMaps', array('address' => $address));
}
示例15: testContacts
/**
* Ensure that update and create trigger appropriate flows
*/
public function testContacts()
{
X2FlowTestingAuxLib::clearLogs($this);
$this->action = 'model';
$this->assertEquals(array(), TriggerLog::model()->findAll());
// Create
$contact = array('firstName' => 'Walt', 'lastName' => 'White', 'email' => 'walter.white@sandia.gov', 'visibility' => 1, 'trackingKey' => '1234');
$ch = $this->getCurlHandle('POST', array('{modelAction}' => 'Contacts'), 'admin', $contact);
$response = json_decode(curl_exec($ch), 1);
$id = $response['id'];
$this->assertResponseCodeIs(201, $ch);
$this->assertTrue((bool) ($newContact = Contacts::model()->findBySql('SELECT * FROM x2_contacts
WHERE firstName="Walt"
AND lastName="White"
AND email="walter.white@sandia.gov"
AND trackingKey="1234"')));
$logs = TriggerLog::model()->findAll();
$this->assertEquals(1, count($logs));
$trace = X2FlowTestingAuxLib::getTraceByFlowId($this->flows('flow1')->id);
$this->assertTrue(is_array($trace));
$this->assertTrue(X2FlowTestingAuxLib::checkTrace($trace));
// Update
$contact['firstName'] = 'Walter';
$ch = $this->getCurlHandle('PUT', array('{modelAction}' => "Contacts/{$id}.json"), 'admin', $contact);
$response = json_decode(curl_exec($ch), 1);
$this->assertResponseCodeIs(200, $ch);
$newContact->refresh();
$this->assertEquals($contact['firstName'], $newContact['firstName']);
$logs = TriggerLog::model()->findAll();
$this->assertEquals(2, count($logs));
$trace = X2FlowTestingAuxLib::getTraceByFlowId($this->flows('flow2')->id);
$this->assertTrue(is_array($trace));
$this->assertTrue(X2FlowTestingAuxLib::checkTrace($trace));
}