本文整理汇总了PHP中Account类的典型用法代码示例。如果您正苦于以下问题:PHP Account类的具体用法?PHP Account怎么用?PHP Account使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Account类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doLogin
function doLogin($referer_in, $post)
{
extract($post);
if ($submit_login) {
if (!recaptchaCheck()) {
return 0;
}
$database = connectToDatabase();
$account = new Account($username);
if ($account->checkPassword($password)) {
session_name($username);
$_SESSION['username'] = $username;
$_SESSION['id'] = $account->getDatabaseID();
if ($referer) {
doRedirect($referer);
} else {
renderError("Cannot redirect you to the proper place. Please press the back button and try again.");
return 0;
}
} else {
renderError("Your password is incorrect. Please try again");
return 0;
}
} else {
renderError("You need to login to do that.");
displayLoginForm($referer_in);
return 0;
}
}
示例2: overwriteRead
public function overwriteRead($return)
{
$objs = $return['objs'];
foreach ($objs as $obj) {
if (isset($obj->news_postdate)) {
$obj->news_postdate = date("d-m-Y", strtotime($obj->news_postdate));
}
if (isset($obj->news_updatedate)) {
$obj->news_updatedate = date("d-m-Y", strtotime($obj->news_updatedate));
}
if (isset($obj->news_validity_begin)) {
$obj->news_validity_begin = date("d-m-Y", strtotime($obj->news_validity_begin));
}
if (isset($obj->news_validity_end)) {
$obj->news_validity_end = date("d-m-Y", strtotime($obj->news_validity_end));
}
if (isset($obj->news_author)) {
$acc = new Account();
$acc->getByID($obj->news_author);
$obj->news_author = $acc->admin_nama_depan;
}
if (isset($obj->news_channel_id)) {
$acc = new NewsChannel();
$acc->getByID($obj->news_channel_id);
$obj->news_channel_id = $acc->channel_name;
}
}
//pr($return);
return $return;
}
示例3: __construct
/**
* @param Identifier $memberId
* @param string $name
* @param Email $email
* @param Account $account
*/
public function __construct(Identifier $memberId, $name, Email $email, Account $account)
{
$this->memberId = $memberId;
$this->name = $name;
$this->email = $email;
$this->account = $account->information();
}
示例4: searchResults
public function searchResults($search)
{
$accounts = new Accounts();
$accounts->userID = $_SESSION['userID'];
$_SESSION['accounts'] = $accounts->getAccounts();
$_SESSION['accountID'] = $search['accountID'];
$this->setAccountSelected($_SESSION['accountID']);
$account = new Account();
$account->accountID = $_SESSION['accountID'];
$account->getAccount();
$_SESSION['searchDetails'] = $search['searchDetails'];
$_SESSION['fromAmount'] = $search['fromAmount'];
$_SESSION['toAmount'] = $search['toAmount'];
if (strlen($search['toDate']) != 0) {
$_SESSION['toDate'] = $search['toDate'];
} else {
$_SESSION['toDate'] = date('Y-m-d');
}
if (strlen($search['fromDate']) != 0) {
$_SESSION['fromDate'] = $search['fromDate'];
} else {
$_SESSION['fromDate'] = date("Y-m-d", strtotime("-1 months"));
}
$_SESSION['period'] = date('d/m/Y', strtotime($_SESSION['fromDate'])) . ' to ' . date('d/m/Y', strtotime($_SESSION['toDate']));
$transactions = new Transactions();
$transactions->accountID = $_SESSION['accountID'];
$arr = array('openBalance' => $account->openBalance);
$_SESSION['history'] = $transactions->getTransactions($arr);
$_SESSION['found'] = $transactions->countTransactions($arr);
$_SESSION['historyDebit'] = $transactions->getDebits($arr);
$_SESSION['historyCredit'] = $transactions->getCredits($arr);
$_SESSION['historyFee'] = $transactions->getFees($arr);
$_SESSION['historyNet'] = $transactions->getNet($arr);
}
示例5: testRequiredAttributesAreMissingFromLayout
public function testRequiredAttributesAreMissingFromLayout()
{
$super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
$account = AccountTestHelper::createAccountByNameForOwner('aTestAccount', $super);
$content = $this->runControllerWithNoExceptionsAndGetContent('accounts/default/create');
$this->assertNotContains('There are required fields missing from the following layout', $content);
$content = $this->runControllerWithNoExceptionsAndGetContent('accounts/default/list');
$this->assertNotContains('There are required fields missing from the following layout', $content);
$this->setGetArray(array('id' => $account->id));
$content = $this->runControllerWithNoExceptionsAndGetContent('accounts/default/edit');
$this->assertNotContains('There are required fields missing from the following layout', $content);
//Now create an attribute that is required.
$this->createTextCustomFieldByModule('AccountsModule', 'text');
$content = $this->runControllerWithExitExceptionAndGetContent('accounts/default/create');
$this->assertContains('There are required fields missing from the following layout', $content);
$content = $this->runControllerWithNoExceptionsAndGetContent('accounts/default/list');
$this->assertNotContains('There are required fields missing from the following layout', $content);
$this->setGetArray(array('id' => $account->id));
$content = $this->runControllerWithExitExceptionAndGetContent('accounts/default/edit');
$this->assertContains('There are required fields missing from the following layout', $content);
//Remove the new field.
$modelAttributesAdapterClassName = TextAttributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
$adapter = new $modelAttributesAdapterClassName(new Account());
$adapter->removeAttributeMetadata('text');
RequiredAttributesValidViewUtil::resolveToRemoveAttributeAsMissingRequiredAttribute('Account', 'text');
$account = new Account();
$this->assertFalse($account->isAttribute('text'));
unset($account);
}
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:29,代码来源:RequiredAttributesViewValidityWalkthroughTest.php
示例6: save
/**
* Logs in the user using the given username and password in the model.
* @return boolean whether login is successful
*/
public function save()
{
$user = new Users();
$user->setAttributes($this->attributes);
$user->setAttribute("password", BaseTool::ENPWD($this->password));
if ($user->validate() && $user->save()) {
$accountarray = array('user_id' => Yii::app()->db->getLastInsertID(), 'total' => 0, 'use_money' => 0, 'no_use_money' => 0, 'newworth' => 0);
$newAccount = new Account();
$newAccount->setAttributes($accountarray);
$newAccount->save();
//发送邮件
$activecode = BaseTool::getActiveMailCode($this->username);
$message = MailTemplet::getActiveEmail($this->username, $activecode);
$mail = Yii::app()->Smtpmail;
$mail->SetFrom(Yii::app()->params['adminEmail']);
$mail->Subject = "好帮贷测试邮件";
$mail->MsgHTML($message);
$mail->AddAddress($this->email);
if ($mail->Send()) {
$user->updateAll(array("regtaken" => $activecode, "regativetime" => time() + 60 * 60), "username=:username", array(":username" => $this->username));
}
Yii::import("application.models.form.LoginForm", true);
$loginform = new LoginForm();
$loginarray = array('rememberMe' => false, 'username' => $this->username, 'password' => $this->password);
$loginform->setAttributes($loginarray);
if ($loginform->validate() && $loginform->login()) {
}
return true;
} else {
$usererror = $user->errors;
$this->addError("username", current(current($usererror)));
return false;
}
}
示例7: init
public function init()
{
$account = new Account();
$account->accountID = $_SESSION['payAccountID'];
$account->getAccount();
$_SESSION['payAccount'] = $account->accountName;
}
示例8: create
public function create()
{
$user = Confide::user();
//throw new Exception($user);
if (Request::isMethod('GET')) {
$patient = Patient::find($user->id);
return View::make('home/patient/create', compact('user', 'patient'));
} elseif (Request::isMethod('POST')) {
// Create a new Appointment with the given data
$user = Confide::user();
$user->fill(Input::all());
$user->save();
// If patient already exists in system
$patient = Patient::find($user->id);
if ($patient != null) {
// Retreive Patient
} else {
// Create a new account for the Patient
$account = new Account();
$account->patient_id = $user->id;
$account->save();
// Create a new Patient
$patient = new Patient();
$patient->fill(Input::all());
//$patient->dob = new Date();
$patient->user_id = $user->id;
$patient->save();
}
return Redirect::route('home.index');
}
}
示例9: query
public static function query($q)
{
$db = getDatabase();
try {
$stmt = $db->prepare($q);
$stmt->execute();
} catch (PDOException $ex) {
Utils::HandlePDOException($ex);
}
$len = $stmt->rowCount();
if ($len <= 0) {
throw new Exception("no item");
} else {
if ($len == 1) {
$temp = new Account();
$temp->initWithVar($stmt->fetch());
return $temp;
} else {
$result = array();
foreach ($stmt->fetchAll() as $thread) {
$temp = new Account();
$temp->initWithVar($thread);
array_push($result, $temp);
}
return $result;
}
}
}
示例10: setUp
public function setUp()
{
SugarTestHelper::setUp('beanFiles');
SugarTestHelper::setUp('beanList');
SugarTestHelper::setUp('current_user');
$unid = uniqid();
$time = date('Y-m-d H:i:s');
$contact = new Contact();
$contact->id = 'c_' . $unid;
$contact->first_name = 'testfirst';
$contact->last_name = 'testlast';
$contact->new_with_id = true;
$contact->disable_custom_fields = true;
$contact->save();
$this->contact = $contact;
$account = new Account();
$account->id = 'a_' . $unid;
$account->first_name = 'testfirst';
$account->last_name = 'testlast';
$account->assigned_user_id = 'SugarUser';
$account->new_with_id = true;
$account->disable_custom_fields = true;
$account->save();
$this->account = $account;
$ac_id = 'ac_' . $unid;
$this->ac_id = $ac_id;
//Accounts to Contacts
$GLOBALS['db']->query("INSERT INTO accounts_contacts (id , contact_id, account_id, date_modified, deleted) values ('{$ac_id}', '{$contact->id}', '{$account->id}', '{$time}', 0)");
$_REQUEST['relate_id'] = $this->contact->id;
$_REQUEST['relate_to'] = 'projects_contacts';
}
示例11: setUp
/**
* Create test user
*
*/
public function setUp()
{
$this->markTestIncomplete('Skipping for now while investigating');
//setup test portal user
$this->_setupTestUser();
$this->_soapClient = new nusoapclient($GLOBALS['sugar_config']['site_url'] . '/soap.php', false, false, false, false, false, 600, 600);
$this->_login();
//setup test account
$account = new Account();
$account->name = 'test account for bug 39855';
$account->assigned_user_id = 'SugarUser';
$account->save();
$this->_acc = $account;
//setup test cases
$case1 = new aCase();
$case1->name = 'test case for bug 39855 ASDF';
$case1->account_id = $this->_acc->id;
$case1->status = 'New';
$case1->save();
$this->_case1 = $case1;
$case2 = new aCase();
//$account->id = 'a_'.$unid;
$case2->name = 'test case for bug 39855 QWER';
$case2->account_id = $this->_acc->id;
$case2->status = 'Rejected';
$case2->save();
$this->_case2 = $case2;
}
示例12: setUp
public function setUp()
{
global $current_user, $currentModule;
global $beanList;
require 'include/modules.php';
$current_user = SugarTestUserUtilities::createAnonymousUser();
$unid = uniqid();
$time = date('Y-m-d H:i:s');
$contact = new Contact();
$contact->id = 'c_' . $unid;
$contact->first_name = 'testfirst';
$contact->last_name = 'testlast';
$contact->new_with_id = true;
$contact->disable_custom_fields = true;
$contact->save();
$this->contact = $contact;
$account = new Account();
$account->id = 'a_' . $unid;
$account->first_name = 'testfirst';
$account->last_name = 'testlast';
$account->assigned_user_id = 'SugarUser';
$account->new_with_id = true;
$account->disable_custom_fields = true;
$account->save();
$this->account = $account;
$ac_id = 'ac_' . $unid;
$this->ac_id = $ac_id;
//Accounts to Contacts
$GLOBALS['db']->query("INSERT INTO accounts_contacts (id , contact_id, account_id, date_modified, deleted) values ('{$ac_id}', '{$contact->id}', '{$account->id}', '{$time}', 0)");
$_REQUEST['relate_id'] = $this->contact->id;
$_REQUEST['relate_to'] = 'projects_contacts';
}
示例13: execute
function execute(&$bean)
{
if ($bean->sales_stage == "completed") {
$realty_list = $bean->get_linked_beans("realty_opportunities", "Realty");
if (!empty($bean->contact_id)) {
$contact = new Contact();
$contact->retrieve($bean->contact_id);
foreach ($realty_list as $realty) {
if ($realty->operation == 'rent') {
$contact->load_relationship("realty_contacts_rent");
$contact->realty_contacts_rent->add($realty->id);
} elseif ($realty->operation == 'buying') {
$contact->load_relationship("realty_contacts_buying");
$contact->realty_contacts_buying->add($realty->id);
}
}
}
if (!empty($bean->account_id)) {
$account = new Account();
$account->retrieve($bean->account_id);
foreach ($realty_list as $realty) {
if ($realty->operation == 'rent') {
$account->load_relationship("realty_accounts_rent");
$account->realty_accounts_rent->add($realty->id);
} elseif ($realty->operation == 'buying') {
$account->load_relationship("realty_accounts_buying");
$account->realty_accounts_buying->add($realty->id);
}
}
}
}
}
示例14: writeDefaultConfig
public function writeDefaultConfig($config)
{
$account = new Account();
$account->name = $config['name'];
$account->workingdays = '31';
$account->type = 'unlimited';
$account->save();
// add timeitem types
$tit = new TimeItemType();
$tit->account_id = $account->id;
$tit->name = 'DEV';
$tit->save();
$tit = new TimeItemType();
$tit->account_id = $account->id;
$tit->name = 'ADMIN';
$tit->default_item = true;
$tit->save();
$admin_settings = new Setting();
$admin_settings->theme = 'green';
$admin = new User();
$admin->Account = $account;
$admin->administrator = true;
$admin->username = $config['username'];
$admin->password = md5($config['password']);
$admin->Setting = $admin_settings;
$admin->save();
return $account->id;
}
示例15: setUp
public function setUp()
{
global $current_user, $currentModule;
$mod_strings = return_module_language($GLOBALS['current_language'], "Contacts");
$current_user = SugarTestUserUtilities::createAnonymousUser();
$unid = uniqid();
$time = date('Y-m-d H:i:s');
$contact = new Contact();
$contact->id = 'c_' . $unid;
$contact->first_name = 'testfirst';
$contact->last_name = 'testlast';
$contact->new_with_id = true;
$contact->disable_custom_fields = true;
$contact->save();
$this->c = $contact;
$account = new Account();
$account->id = 'a_' . $unid;
$account->first_name = 'testfirst';
$account->last_name = 'testlast';
$account->assigned_user_id = 'SugarUser';
$account->new_with_id = true;
$account->disable_custom_fields = true;
$account->save();
$this->a = $account;
$ac_id = 'ac_' . $unid;
$this->ac_id = $ac_id;
$GLOBALS['db']->query("insert into accounts_contacts (id , contact_id, account_id, date_modified, deleted) values ('{$ac_id}', '{$contact->id}', '{$account->id}', '{$time}', 0)");
}