ILIAS  Release_4_4_x_branch Revision 61816
 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)
static _addPurchasedObjToDesktop ($oPaymentObject, $a_user_id=0)
static _assignPurchasedCourseMemberRole ($oPaymentObject, $a_user_id=0)
static _addToShoppingCartSymbol ($a_type, $a_ref_id)
static _getSpecialObjectSymbol ()
static _getPaymethodSymbol ($a_paymethod)
static _deassignPurchasedCourseMemberRole ($a_ref_id, $a_user_id)

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::_addPurchasedObjToDesktop (   $oPaymentObject,
  $a_user_id = 0 
)
static

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

References $ilUser, and ilObject\_lookupType().

Referenced by ilPurchaseBaseGUI\__addBookings(), and ilObjPaymentSettingsGUI\saveCustomerObject().

{
global $ilUser;
$type = ilObject::_lookupType($oPaymentObject->getRefId(),true);
if($a_user_id > 0)
{
// administrator added a selling process to statistics
$tmp_usr = new ilObjUser($a_user_id);
$tmp_usr->addDesktopItem($oPaymentObject->getRefId(),$type);
}
else
{
// user purchased object
$ilUser->addDesktopItem($oPaymentObject->getRefId(),$type);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilShopUtils::_addToShoppingCartSymbol (   $a_type,
  $a_ref_id 
)
static

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

References $ilCtrl, $img, and ilUtil\img().

Referenced by ilShopResultPresentationGUI\renderItems().

{
global $ilCtrl;
switch($a_type)
{
case 'sahs':
$detail_link = 'ilias.php?baseClass=ilSAHSPresentationGUI&ref_id='.$a_ref_id;
break;
case 'lm':
$detail_link = 'ilias.php?baseClass=ilLMPresentationGUI&ref_id='.$a_ref_id;
break;
case 'exc':
$detail_link = $ilCtrl->getLinkTargetByClass("ilShopPurchaseGUI", "showDetails").'&ref_id='.$a_ref_id;
break;
default:
$detail_link = $ilCtrl->getLinkTargetByClass("ilShopPurchaseGUI", "showDetails").'&ref_id='.$a_ref_id;
break;
}
$img = ilUtil::img('./templates/default/images/payment/shopcart_add_32.png');
$link = '<a href="'.$detail_link.'">'.$img.'</a>';
return $link;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilShopUtils::_assignPurchasedCourseMemberRole (   $oPaymentObject,
  $a_user_id = 0 
)
static

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

References $ilUser, $res, ilCourseParticipants\_getInstanceByObjId(), ilObject\_lookupObjectId(), and IL_CRS_MEMBER.

Referenced by ilPurchaseBaseGUI\__addBookings(), and ilObjPaymentSettingsGUI\saveCustomerObject().

{
global $ilUser;
include_once './Modules/Course/classes/class.ilCourseParticipants.php';
$obj_id = ilObject::_lookupObjectId($oPaymentObject->getRefId());
if($a_user_id > 0)
{
// administrator added a selling process to statistics
$res = $participants->add($a_user_id, IL_CRS_MEMBER);
}
else
{
$res = $participants->add($ilUser->getId(),IL_CRS_MEMBER);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 $res.

{
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));
}
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, $ilSetting, $ilUser, $lng, $res, $row, ilObject\_exists(), ilObjRole\_lookupRegisterAllowed(), ilUtil\generatePasswords(), and IL_PASSWD_PLAIN.

{
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:

static ilShopUtils::_deassignPurchasedCourseMemberRole (   $a_ref_id,
  $a_user_id 
)
static

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

References $res, ilCourseParticipants\_getInstanceByObjId(), ilObject\_lookupObjectId(), and IL_CRS_MEMBER.

Referenced by ilPaymentStatisticGUI\performDeleteDeassignCrs().

{
include_once './Modules/Course/classes/class.ilCourseParticipants.php';
$obj_id = ilObject::_lookupObjectId($a_ref_id);
$res = $participants->delete($a_user_id, IL_CRS_MEMBER);
}

+ 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 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 ilPurchaseBaseGUI\__showShoppingCart(), ilObjPaymentSettingsGUI\editDetailsObject(), ilObjPaymentSettingsGUI\objectsObject(), ilShopShoppingCartGUI\showItems(), 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::_getPaymethodSymbol (   $a_paymethod)
static

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

References ilUtil\img().

Referenced by ilShopResultPresentationGUI\renderItems().

{
switch($a_paymethod)
{
case '1':
case 'pm_bill':
case 'bill':
case 'PAY_METHOD_BILL': return '';
break;
case '2':
case 'pm_bmf':
case 'bmf':
case 'PAY_METHOD_BMF': return '';
break;
case '3':
case 'pm_paypal':
case 'paypal':
case 'PAY_METHOD_PAYPAL': return ilUtil::img('./templates/default/images/payment/paypal_48.png');
break;
case '4':
case 'pm_epay':
case 'epay':
case 'PAY_METHOD_EPAY': return '';
break;
case 'PAY_METHOD_NOT_SPECIFIED': return '';
break;
default:
break;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilShopUtils::_getSpecialObjectSymbol ( )
static

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

References $img, and ilUtil\img().

Referenced by ilShopResultPresentationGUI\renderItems().

{
$img = ilUtil::img('./templates/default/images/payment/star_32.png');
#$link = '<a href="'.$detail_link.'">'.$img.'</a>';
return $img;
}

+ Here is the call graph for this function:

+ 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, $success, 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: