ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilShopUtils Class Reference

Class ilShopUtils. More...

+ Collaboration diagram for ilShopUtils:

Static Public Member Functions

static _formatVAT ($a_vat)
 Formats a vat rate for gui output.
static _formatFloat ($a_float, $a_num_decimals=2)
 Formats a float value for gui output.
static _checkVATRate ($a_vat_rate)
 Checks if the passed vat rate is valid.
static _sendNotificationToVATAdministration ($oPaymentObject)
 Sends a notification message to all users responsible for vat assignment.
static _createRandomUserAccount ($keyarray)
static _assignTransactionToCustomerId ($a_old_user_id, $a_new_user_id, $a_transaction_extern)

Detailed Description

Class ilShopUtils.

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

Definition at line 13 of file class.ilShopUtils.php.

Member Function Documentation

static ilShopUtils::_assignTransactionToCustomerId (   $a_old_user_id,
  $a_new_user_id,
  $a_transaction_extern 
)
static

Definition at line 204 of file class.ilShopUtils.php.

References $ilDB, and $res.

Referenced by ilShopShoppingCartGUI\validateNewUser().

{
global $ilDB;
$res = $ilDB->manipulateF('
UPDATE payment_statistic
SET customer_id = %s
WHERE customer_id = %s
AND transaction_extern = %s',
array('integer', 'integer', 'text'),
array($a_new_user_id, $a_old_user_id, $a_transaction_extern));
}

+ Here is the caller graph for this function:

static ilShopUtils::_checkVATRate (   $a_vat_rate)
static

Checks if the passed vat rate is valid.

public

Parameters
string$a_vat
Returns
bool

Definition at line 53 of file class.ilShopUtils.php.

Referenced by ilObjPaymentSettingsGUI\saveVatObject(), and ilObjPaymentSettingsGUI\updateVatObject().

{
$reg = '/^([0]|([1-9][0-9]*))([\.,][0-9][0-9]*)?$/';
return preg_match($reg, $a_vat_rate);
}

+ Here is the caller graph for this function:

static ilShopUtils::_createRandomUserAccount (   $keyarray)
static

Definition at line 95 of file class.ilShopUtils.php.

References $_SESSION, $ilDB, $ilSetting, $lng, $res, $row, ilObject\_exists(), ilObjRole\_lookupRegisterAllowed(), ilUtil\generatePasswords(), and IL_PASSWD_PLAIN.

Referenced by ilPurchasePaypal\checkData().

{
global $ilDB, $ilUser, $ilSetting, $rbacadmin;
if($_SESSION['create_user_account'] != NULL)
{
$obj_user = new ilObjUser($_SESSION['create_user_account']);
return $obj_user;
}
else
{
$userLogin = array();
$res = $ilDB->query('SELECT sequence FROM object_data_seq');
$row = $ilDB->fetchAssoc($res);
$temp_user_id = (int)$row['sequence'] + 1;
$userLogin['login'] = 'shop_user_'.$temp_user_id;
$userLogin['passwd'] = ilUtil::generatePasswords(1);
require_once 'Services/User/classes/class.ilObjUser.php';
include_once("Services/Mail/classes/class.ilAccountMail.php");
$obj_user = new ilObjUser();
$obj_user->setId($temp_user_id);
$obj_user->setLogin($userLogin['login']);
$obj_user->setPasswd((string)$userLogin['passwd'][0], IL_PASSWD_PLAIN);
$_SESSION['tmp_user_account']['login'] = $userLogin['login'];
$_SESSION['tmp_user_account']['passwd'] = $userLogin['passwd'];
$obj_user->setFirstname($keyarray['first_name']);
$obj_user->setLastname($keyarray['last_name']);
$obj_user->setEmail($keyarray['payer_email']);
# $obj_user->setEmail('nkrzywon@databay.de');
$obj_user->setGender('f');
$obj_user->setLanguage( $ilSetting->get("language"));
$obj_user->setActive(true);
$obj_user->setTimeLimitUnlimited(true);
$obj_user->setTitle($obj_user->getFullname());
$obj_user->setDescription($obj_user->getEmail());
$obj_user->setTimeLimitOwner(7);
$obj_user->setTimeLimitUnlimited(1);
$obj_user->setTimeLimitMessage(0);
$obj_user->setApproveDate(date("Y-m-d H:i:s"));
// Set default prefs
$obj_user->setPref('hits_per_page',$ilSetting->get('hits_per_page',30));
$obj_user->setPref('show_users_online',$ilSetting->get('show_users_online','y'));
$obj_user->writePrefs();
// at the first login the user must complete profile
$obj_user->setProfileIncomplete(true);
$obj_user->create();
$obj_user->saveAsNew();
$user_role = ilObject::_exists(4, false);
if(!$user_role)
{
include_once("./Services/AccessControl/classes/class.ilObjRole.php");
$user_role = $reg_allowed[0]['id'];
}
else $user_role = 4;
$rbacadmin->assignUser((int)$user_role, $obj_user->getId(), true);
include_once "Services/Mail/classes/class.ilMimeMail.php";
global $ilias, $lng;
$settings = $ilias->getAllSettings();
$mmail = new ilMimeMail();
$mmail->autoCheck(false);
$mmail->From($settings["admin_email"]);
$mmail->To($obj_user->getEmail());
// mail subject
$subject = $lng->txt("reg_mail_subject");
// mail body
$body = $lng->txt("reg_mail_body_salutation")." ".$obj_user->getFullname().",\n\n".
$lng->txt("reg_mail_body_text1")."\n\n".
$lng->txt("reg_mail_body_text2")."\n".
ILIAS_HTTP_PATH."/login.php?client_id=".$ilias->client_id."\n";
$body .= $lng->txt("login").": ".$obj_user->getLogin()."\n";
$body.= $lng->txt("passwd").": ".$userLogin['passwd'][0]."\n";
$body.= "\n";
$body .= ($lng->txt("reg_mail_body_text3")."\n\r");
$body .= $obj_user->getProfileAsString($lng);
$mmail->Subject($subject);
$mmail->Body($body);
$mmail->Send();
$_SESSION['create_user_account'] = $obj_user->getId();
return $obj_user;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilShopUtils::_formatFloat (   $a_float,
  $a_num_decimals = 2 
)
static

Formats a float value for gui output.

public

Parameters
float$a_vat
Returns
string

Definition at line 38 of file class.ilShopUtils.php.

References $lng.

Referenced by ilPurchasePaypal\__sendBill(), and ilPaymentObject\getVat().

{
global $lng;
return number_format((float)$a_float, $a_num_decimals, $lng->txt('lang_sep_decimal'), $lng->txt('lang_sep_thousand'));
}

+ Here is the caller graph for this function:

static ilShopUtils::_formatVAT (   $a_vat)
static

Formats a vat rate for gui output.

public

Parameters
float$a_vat
Returns
string

Definition at line 23 of file class.ilShopUtils.php.

Referenced by ilPurchasePaypal\__sendBill(), ilPurchaseBaseGUI\__showShoppingCart(), ilPaymentObjectGUI\editDetails(), ilObjPaymentSettingsGUI\editDetailsObject(), ilObjPaymentSettingsGUI\objectsObject(), ilShopShoppingCartGUI\showItems(), ilPaymentObjectGUI\showObjects(), and ilObjPaymentSettingsGUI\vatsObject().

{
return ((float)$a_vat != floor((float)$a_vat) ?
self::_formatFloat((float)$a_vat) :
(int)$a_vat).' %';
}

+ Here is the caller graph for this function:

static ilShopUtils::_sendNotificationToVATAdministration (   $oPaymentObject)
static

Sends a notification message to all users responsible for vat assignment.

public

Parameters
ilPaymentObject$oPaymentObject

Definition at line 66 of file class.ilShopUtils.php.

References $ilSetting, $lng, ilObjUser\_lookupId(), and ilObjectFactory\getInstanceByRefId().

{
global $ilSetting, $lng, $ilClientIniFile;
$payment_vat_admins = $ilSetting->get('payment_vat_admins');
$users = explode(',', $payment_vat_admins);
$subject = $lng->txt('payment_vat_assignment_notification_subject');
$tmp_obj = ilObjectFactory::getInstanceByRefId($oPaymentObject->getRefId());
$message = sprintf($lng->txt('payment_vat_assignment_notification_body'), $tmp_obj->getTitle())."\n\n";
$message .= "------------------------------------------------------------\n";
$message .= sprintf($lng->txt('payment_vat_assignment_notification_intro'),
$ilClientIniFile->readVariable('client', 'name'),
ILIAS_HTTP_PATH.'/?client_id='.CLIENT_ID);
include_once 'Services/Mail/classes/class.ilMail.php';
$mail_obj = new ilMail(ANONYMOUS_USER_ID);
foreach((array)$users as $login)
{
if(strlen(trim($login)) &&
(int)ilObjUser::_lookupId(trim($login)))
{
$success = $mail_obj->sendMail(trim($login), '', '',
$subject, $message,
array(),array("system"));
}
}
}

+ Here is the call graph for this function:


The documentation for this class was generated from the following file: