本文整理汇总了PHP中CContact::setContactMethods方法的典型用法代码示例。如果您正苦于以下问题:PHP CContact::setContactMethods方法的具体用法?PHP CContact::setContactMethods怎么用?PHP CContact::setContactMethods使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CContact
的用法示例。
在下文中一共展示了CContact::setContactMethods方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: 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);
}
}
$AppUI->setMsg($isNewUser ? 'User added' : 'User updated', UI_MSG_OK, true);
$path = 'm=admin&a=viewuser&user_id=' . $obj->user_id . '&tab=2';
示例4: testGetContactMethods
public function testGetContactMethods()
{
$methods = array('phone_mobile' => '202-555-1212', 'url' => 'http://web2project.net', 'email_alt' => 'alternate@example.org', 'im_skype' => 'example_s', 'im_google' => 'example_g');
$contact = new CContact();
$contact->contact_id = 1;
$contact->setContactMethods($methods);
$results = $contact->getContactMethods(array('phone_mobile', 'im_skype'));
$this->AssertEquals(2, count($results));
$this->assertEquals($methods['phone_mobile'], $results['phone_mobile']);
$this->assertEquals($methods['im_skype'], $results['im_skype']);
}