本文整理汇总了PHP中CContact::store方法的典型用法代码示例。如果您正苦于以下问题:PHP CContact::store方法的具体用法?PHP CContact::store怎么用?PHP CContact::store使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CContact
的用法示例。
在下文中一共展示了CContact::store方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testStoreCreate
/**
* Tests the proper creation of a user & contact
*/
public function testStoreCreate()
{
$this->obj->bind($this->post_data);
$result = $this->obj->store();
$contact = new CContact();
$contact->overrideDatabase($this->mockDB);
$contact->bind($this->post_data);
$result = $contact->store();
$this->assertTrue($result);
$this->assertNotEquals(0, $contact->contact_id);
$this->obj->user_contact = $contact->contact_id;
$result = $this->obj->store();
$this->assertTrue($result);
$this->assertNotEquals(0, $this->obj->user_id);
}
示例2: CUser
$contact->contact_private = 1;
$contact->store();
}
}
} else {
$AppUI->setMsg('failed to delete role', UI_MSG_ERROR);
}
} else {
if ($user_role) {
$public_contact = false;
if (dPgetConfig('user_contact_activate') && !$perms->checkLogin($user_id)) {
$public_contact = true;
}
if ($perms->insertUserRole($user_role, $user_id)) {
$AppUI->setMsg('added', UI_MSG_OK, true);
if ($public_contact) {
// Mark contact as public
$obj = new CUser();
$contact = new CContact();
$obj->load($user_id);
if ($contact->load($obj->user_contact)) {
$contact->contact_private = 0;
$contact->store();
}
}
} else {
$AppUI->setMsg('failed to add role', UI_MSG_ERROR);
}
}
}
$AppUI->redirect();
示例3: header
header('Location: newuser.php?msg=existing-user');
}
$email = w2PgetParam($_POST, 'contact_email', 0);
$contact = new CContact();
$result = $contact->loadAll(null, "contact_email = '{$email}'");
if (count($result)) {
header('Location: newuser.php?msg=existing-email');
}
if (!$user->bind($_POST)) {
$AppUI->setMsg($user->getError(), UI_MSG_ERROR);
header('Location: newuser.php?msg=user');
}
if (!$contact->bind($_POST)) {
$AppUI->setMsg($contact->getError(), UI_MSG_ERROR);
header('Location: newuser.php?msg=contact');
}
$result = $contact->store();
if (count($contact->getError())) {
header('Location: newuser.php?msg=contact');
} else {
$user->user_contact = $contact->contact_id;
$result = $user->store(null, true);
if (count($user->getError())) {
header('Location: newuser.php?msg=user');
} else {
notifyNewExternalUser($contact->contact_email, $contact->contact_first_name, $user->user_username, $_POST['user_password']);
notifyHR(w2PgetConfig('admin_email', 'admin@web2project.net'), 'w2P System Human Resources', $contact->contact_email, $contact->contact_first_name, $user->user_username, $_POST['user_password'], $user->user_id);
$AppUI->setMsg('The User Administrator has been notified to grant you access to the system and an email message was sent to you with your login info. Thank you.', UI_MSG_OK);
}
}
$AppUI->redirect();
示例4: createsqluser
public function createsqluser($username, $password, $ldap_attribs = array())
{
global $AppUI;
$hash_pass = MD5($password);
if (!count($ldap_attribs) == 0) {
// Contact information based on the inetOrgPerson class schema
$c = new CContact();
$c->contact_first_name = $ldap_attribs['givenname'][0];
$c->contact_last_name = $ldap_attribs['sn'][0];
$c->contact_city = $ldap_attribs['l'][0];
$c->contact_country = $ldap_attribs['country'][0];
$c->contact_state = $ldap_attribs['st'][0];
$c->contact_zip = $ldap_attribs['postalcode'][0];
$c->contact_job = $ldap_attribs['title'][0];
$c->contact_email = $ldap_attribs['mail'][0];
$c->contact_phone = $ldap_attribs['telephonenumber'][0];
$c->contact_owner = $AppUI->user_id;
$c->store();
$contactArray = array('phone_mobile' => $ldap_attribs['mobile'][0]);
$c->setContactMethods($contactArray);
}
$contact_id = $c->contact_id == null ? 'NULL' : $c->contact_id;
$u = new CUser();
$u->user_username = $username;
$u->user_password = $hash_pass;
$u->user_type = 0;
// Changed from 1 (administrator) to 0 (Default user)
$u->user_contact = (int) $contact_id;
$u->store();
$user_id = $u->user_id;
$this->user_id = $user_id;
$acl =& $AppUI->acl();
$acl->insertUserRole($acl->get_group_id('anon'), $this->user_id);
}
示例5: strtolower
}
}
}
$obj->user_username = strtolower($obj->user_username);
// !User's contact information not deleted - left for history.
if ($del) {
$result = $obj->delete($AppUI);
$message = $result ? 'User deleted' : $obj->getError();
$path = $result ? 'm=admin' : 'm=public&a=access_denied';
$status = $result ? UI_MSG_ALERT : UI_MSG_ERROR;
$AppUI->setMsg($message, $status);
$AppUI->redirect($path);
}
$contact->contact_owner = $contact->contact_owner ? $contact->contact_owner : $AppUI->user_id;
$contactArray = $contact->getContactMethods();
$result = $contact->store($AppUI);
if ($result) {
$contact->setContactMethods($contactArray);
$obj->user_contact = $contact->contact_id;
if ($obj->store($AppUI)) {
if ($isNewUser && w2PgetParam($_POST, 'send_user_mail', 0)) {
notifyNewUserCredentials($contact->contact_email, $contact->contact_first_name, $obj->user_username, $_POST['user_password']);
}
if (isset($_REQUEST['user_role']) && $_REQUEST['user_role']) {
$perms =& $AppUI->acl();
if ($perms->insertUserRole($_REQUEST['user_role'], $obj->user_id)) {
$AppUI->setMsg('', UI_MSG_ALERT, true);
} else {
$AppUI->setMsg('failed to add role', UI_MSG_ERROR);
}
}
示例6: elseif
$contactValues['contact_address1'] = $ci['ADR'][0]['value'][2][0];
$contactValues['contact_address2'] = $ci['ADR'][0]['value'][1][0] . ', ' . $ci['ORG'][0]['value'][0][0];
$contactValues['contact_city'] = $ci['ADR'][0]['value'][3][0];
$contactValues['contact_state'] = $ci['ADR'][0]['value'][4][0];
$contactValues['contact_zip'] = $ci['ADR'][0]['value'][5][0];
$contactValues['contact_country'] = $ci['ADR'][0]['value'][6][0];
$contactValues['contact_notes'] = $ci['NOTE'][0]['value'][0][0];
$contactValues['contact_order_by'] = $contactValues['contact_first_name'] . ' ' . $contactValues['contact_last_name'];
$contactValues['contact_id'] = 0;
// bind array to object
if (!$obj->bind($contactValues)) {
$AppUI->setMsg($obj->getError(), UI_MSG_ERROR);
$AppUI->redirect();
}
// store vCard data for this object
if ($msg = $obj->store($AppUI)) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
}
}
// one or more vCard imports were successful
$AppUI->setMsg('vCard(s) imported', UI_MSG_OK, true);
$AppUI->redirect();
} else {
// redirect in case of file upload trouble
$AppUI->setMsg('vCardFileUploadError', UI_MSG_ERROR);
$AppUI->redirect();
}
} elseif (isset($_GET['dialog']) && w2PgetParam($_GET, 'dialog', null) == '0') {
//file upload formular
$titleBlock = new CTitleBlock('Import vCard', 'monkeychat-48.png', $m, $m . '.' . $a);
$titleBlock->addCrumb('?m=contacts', 'contacts list');
示例7: notifyNewUserCredentials
$AppUI->redirect();
} else {
$AppUI->setMsg('deleted', UI_MSG_ALERT, true);
$AppUI->redirect();
}
return;
}
if ($isNewUser) {
// If userName already exists quit with error and do nothing
if (CUser::exists($obj->user_username) == true) {
$AppUI->setMsg('already exists. Try another username.', UI_MSG_ERROR, true);
$AppUI->redirect();
}
$contact->contact_owner = $AppUI->user_id;
}
if ($msg = $contact->store($AppUI)) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
} else {
$obj->user_contact = $contact->contact_id;
if ($msg = $obj->store()) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
} else {
if ($isNewUser && w2PgetParam($_REQUEST, 'send_user_mail', 0)) {
notifyNewUserCredentials($contact->contact_email, $contact->contact_first_name, $obj->user_username, $_POST['user_password']);
}
if (isset($_REQUEST['user_role']) && $_REQUEST['user_role']) {
$perms =& $AppUI->acl();
if ($perms->insertUserRole($_REQUEST['user_role'], $obj->user_id)) {
$AppUI->setMsg('', UI_MSG_ALERT, true);
} else {
$AppUI->setMsg('failed to add role', UI_MSG_ERROR);
示例8: CustomFields
if (!$obj->bind($_POST)) {
$AppUI->setMsg($obj->getError(), UI_MSG_ERROR);
$AppUI->redirect();
}
// prepare (and translate) the module name ready for the suffix
$AppUI->setMsg('Contact');
if ($del) {
if ($msg = $obj->delete($AppUI)) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
$AppUI->redirect();
} else {
$AppUI->setMsg('deleted', UI_MSG_ALERT, true);
$AppUI->redirect('m=contacts');
}
} else {
if ($result = $obj->store($AppUI)) {
if (is_array($result)) {
$AppUI->setMsg($result, UI_MSG_ERROR, true);
$AppUI->holdObject($obj);
$AppUI->redirect('m=contacts&a=addedit');
}
} else {
$custom_fields = new CustomFields($m, 'addedit', $obj->contact_id, 'edit');
$custom_fields->bind($_POST);
$sql = $custom_fields->store($obj->contact_id);
// Store Custom Fields
$updatekey = $obj->getUpdateKey();
if ($notifyasked && !$updatekey) {
$rnow = new CDate();
$obj->contact_updatekey = MD5($rnow->format(FMT_DATEISO));
$obj->contact_updateasked = $rnow->format(FMT_DATETIME_MYSQL);
示例9: die
<?php
/* $Id: do_contact_aed.php 1940 2011-05-31 05:20:41Z caseydk $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/tags/version2.4/modules/contacts/do_contact_aed.php $ */
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
}
$del = (int) w2PgetParam($_POST, 'del', 0);
$obj = new CContact();
if (!$obj->bind($_POST)) {
$AppUI->setMsg($obj->getError(), UI_MSG_ERROR);
$AppUI->redirect();
}
$action = $del ? 'deleted' : 'stored';
$result = $del ? $obj->delete($AppUI) : $obj->store($AppUI);
$redirect = $del ? 'm=contacts' : 'm=contacts&a=view&contact_id=' . $obj->contact_id;
if (is_array($result)) {
$AppUI->setMsg($result, UI_MSG_ERROR, true);
$AppUI->holdObject($obj);
$AppUI->redirect('m=contacts&a=addedit');
}
if ($result) {
$AppUI->setMsg('Contact ' . $action, UI_MSG_OK, true);
if (!$del) {
$updatekey = $obj->getUpdateKey();
$notifyasked = w2PgetParam($_POST, 'contact_updateask', 0);
if ($notifyasked && !$updatekey) {
$rnow = new w2p_Utilities_Date();
$obj->contact_updatekey = MD5($rnow->format(FMT_DATEISO));
$obj->contact_updateasked = $rnow->format(FMT_DATETIME_MYSQL);
$obj->contact_lastupdate = '';
$obj->store($AppUI);
示例10: createsqluser
public function createsqluser($username, $password, $ldap_attribs = array())
{
$hash_pass = $this->hashPassword($password);
$u = new CUser();
$u->user_username = $username;
$u->user_password = $hash_pass;
$u->user_type = 0;
// Changed from 1 (administrator) to 0 (Default user)
$u->user_contact = 0;
$result = $u->store(null, true);
$user_id = $u->user_id;
$this->user_id = $user_id;
$c = new CContact();
if (count($ldap_attribs)) {
// Contact information based on the inetOrgPerson class schema
$c->contact_first_name = $ldap_attribs['givenname'][0];
$c->contact_last_name = $ldap_attribs['sn'][0];
$c->contact_city = $ldap_attribs['l'][0];
$c->contact_country = $ldap_attribs['country'][0];
$c->contact_state = $ldap_attribs['st'][0];
$c->contact_zip = $ldap_attribs['postalcode'][0];
$c->contact_job = $ldap_attribs['title'][0];
$c->contact_email = $ldap_attribs['mail'][0];
$c->contact_phone = $ldap_attribs['telephonenumber'][0];
$c->contact_owner = $this->user_id;
$result = $c->store();
$contactArray = array('phone_mobile' => $ldap_attribs['mobile'][0]);
$c->setContactMethods($contactArray);
}
//we may be able to use the above user element for this but I didnt know how it would handle an update after the store command so I created a new object.
$tmpUser = new CUser();
$tmpUser->load($user_id);
$tmpUser->user_contact = $this->contactId($user_id);
$tmpUser->store();
$acl =& $this->AppUI->acl();
$acl->insertUserRole($acl->get_group_id('normal'), $this->user_id);
}
示例11: executePut
/**
* Put Request Handler
*
* This method is called when a request is a PUT
*
* @return array
*/
public function executePut()
{
$valid = $this->hasRequiredParameters($this->requiredParams);
if ($valid instanceof Frapi_Error) {
return $valid;
}
$username = $this->getParam('username');
$password = $this->getParam('password');
// Attempt to login as user, a little bit of a hack as we currently
// require the $_POST['login'] var to be set as well as a global AppUI
$AppUI = new CAppUI();
$GLOBALS['AppUI'] = $AppUI;
$_POST['login'] = 'login';
if (!$AppUI->login($username, $password)) {
throw new Frapi_Error('INVALID_LOGIN');
}
$post_data = array('contact_id' => 0, 'contact_first_name' => $this->getParam('contact_first_name'), 'contact_last_name' => $this->getParam('contact_last_name'), 'contact_order_by' => $this->getParam('contact_order_by'), 'contact_private' => $this->getParam('contact_private'), 'contact_job' => $this->getParam('contact_job'), 'contact_company_name' => $this->getParam('contact_company_name'), 'contact_company' => $this->getParam('contact_company'), 'contact_department_name' => $this->getParam('contact_department_name'), 'contact_department' => $this->getParam('contact_department'), 'contact_title' => $this->getParam('contact_title'), 'contact_type' => $this->getParam('contact_type'), 'contact_address1' => $this->getParam('contact_address1'), 'contact_address2' => $this->getParam('contact_address2'), 'contact_city' => $this->getParam('contact_city'), 'contact_state' => $this->getParam('contact_state'), 'contact_zip' => $this->getParam('contact_zip'), 'contact_country' => $this->getParam('contact_country'), 'contact_birthday' => $this->getParam('contact_birthday'), 'contact_notes' => $this->getParam('contact_notes'));
// Ugh, the store method uses $_POST directly for contact methods :(
$_POST['contact_methods'] = $this->getParam('contact_methods');
$contact = new CContact();
$contact->bind($post_data);
$error_array = $contact->store($AppUI);
if ($error_array !== true) {
$error_message = '';
foreach ($error_array as $error) {
$error_message .= $error . '. ';
}
throw new Frapi_Error('SAVE_ERROR', $error_message);
}
/*
* TODO: How do we handle extra fields?
*/
$contact = (array) $contact;
// Remove the data that is not for display
unset($contact['tbl_prefix'], $contact['_tbl'], $contact['_tbl_key'], $contact['_error'], $contact['_query']);
$this->data['contact'] = $contact;
$this->data['success'] = true;
return new Frapi_Response(array('code' => 201, 'data' => $this->data));
}
示例12: _processContact
protected function _processContact(CAppUI $AppUI, $username, $company_id)
{
$space = strrpos($username, ' ');
if ($space === false) {
$first_name = '';
$last_name = $username;
} else {
$first_name = substr($username, 0, $space);
$last_name = substr($username, $space + 1);
}
$contact = new CContact();
$contact->contact_first_name = ucwords($first_name);
$contact->contact_last_name = ucwords($last_name);
$contact->contact_order_by = $username;
$contact->contact_company = $company_id;
$result = $contact->store($AppUI);
return is_array($result) ? $result : $contact->contact_id;
}
示例13: DBQuery
$userEx = TRUE;
}
}
//pull a list of existing usernames
$sql = "SELECT user_username FROM users";
$q = new DBQuery();
$q->addTable('users', 'u');
$q->addQuery('user_username');
$users = $q->loadList();
// Iterate the above userNameExistenceCheck for each user
foreach ($users as $usrs) {
$usrLst = array_map("userExistence", $usrs);
}
// If userName already exists quit with error and do nothing
if ($userEx == TRUE) {
$AppUI->setMsg("already exists. Try another username.", UI_MSG_ERROR, true);
$AppUI->redirect();
}
$contact->contact_owner = $AppUI->user_id;
}
if ($msg = $contact->store()) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
} else {
$obj->user_contact = $contact->contact_id;
if ($msg = $obj->store()) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
} else {
$AppUI->setMsg($isNewUser ? 'added - please setup roles and permissions now. User must have at least one role to log in.' : 'updated', UI_MSG_OK, true);
}
}
$isNewUser ? $AppUI->redirect("m=admin&a=viewuser&user_id=" . $obj->user_id . "&tab=3") : $AppUI->redirect();
示例14: createsqluser
public function createsqluser($username, $password, $email, $first, $last)
{
$hash_pass = $this->hashPassword($password);
$c = new CContact();
$c->contact_first_name = $first;
$c->contact_last_name = $last;
$c->contact_email = $email;
$c->store();
$u = new CUser();
$u->user_username = $username;
$u->user_password = $hash_pass;
$u->user_type = 0;
// Changed from 1 (administrator) to 0 (Default user)
$u->user_contact = (int) $c->contact_id;
$u->store(null, true);
$user_id = $u->user_id;
$this->user_id = $user_id;
$acl =& $this->AppUI->acl();
$acl->insertUserRole($acl->get_group_id('anon'), $this->user_id);
}
示例15: die
/* CONTACTS $Id: do_contact_aed.php 5872 2009-04-25 00:09:56Z merlinyoda $ */
if (!defined('DP_BASE_DIR')) {
die('You should not access this file directly.');
}
$obj = new CContact();
$msg = '';
if (!$obj->bind($_POST)) {
$AppUI->setMsg($obj->getError(), UI_MSG_ERROR);
$AppUI->redirect();
}
$del = dPgetParam($_POST, 'del', 0);
// prepare (and translate) the module name ready for the suffix
$AppUI->setMsg('Contact');
if ($del) {
if ($msg = $obj->delete()) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
$AppUI->redirect();
} else {
$AppUI->setMsg("deleted", UI_MSG_ALERT, true);
$AppUI->redirect("m=contacts");
}
} else {
$isNotNew = @$_POST['contact_id'];
if ($msg = $obj->store()) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
} else {
$AppUI->setMsg($isNotNew ? 'updated' : 'added', UI_MSG_OK, true);
}
$AppUI->redirect();
}