ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilPaymentObject Class Reference
+ Collaboration diagram for ilPaymentObject:

Public Member Functions

 __construct ($user_obj, $a_pobject_id=null)
 getTopicId ()
 setTopicId ($a_topic_id)
 getPobjectId ()
 setRefId ($a_ref_id)
 getRefId ()
 setStatus ($a_status)
 getStatus ()
 setPayMethod ($a_method)
 getPayMethod ()
 setVendorId ($a_vendor_id)
 getVendorId ()
 add ()
 delete ()
 update ()
 _lookupPobjectId ($a_ref_id)
 _getCountObjectsByPayMethod ($a_type)
 _getObjectsData ($a_user_id)
 _getAllObjectsData ()
 _getObjectData ($a_id)
 _isPurchasable ($a_ref_id, $a_vendor_id=0, $a_check_trustee=false)
 _hasAccess ($a_ref_id)
 _getActivation ($a_ref_id)

Static Public Member Functions

static _lookupTopicId ($a_ref_id)
static _isBuyable ($a_ref_id)
static _requiresPurchaseToAccess ($a_ref_id)
static _isInCart ($a_ref_id)

Private Member Functions

 __read ()

Private Attributes

 $db = null
 $user_obj = null
 $pobject_id = null
 $ref_id = null
 $status = null
 $pay_method = null
 $vendor_id = null
 $topic_id = 0

Detailed Description

Definition at line 37 of file class.ilPaymentObject.php.

Constructor & Destructor Documentation

ilPaymentObject::__construct (   $user_obj,
  $a_pobject_id = null 
)

Definition at line 48 of file class.ilPaymentObject.php.

References $user_obj, __read(), PAY_METHOD_BILL, PAY_METHOD_BMF, PAY_METHOD_NOT_SPECIFIED, and PAY_METHOD_PAYPAL.

{
global $ilDB;
$this->db = $ilDB;
$this->user_obj = $user_obj;
$this->STATUS_NOT_BUYABLE = 0;
$this->STATUS_BUYABLE = 1;
$this->STATUS_EXPIRES = 2;
$this->pobject_id = $a_pobject_id;
$this->__read();
}

+ Here is the call graph for this function:

Member Function Documentation

ilPaymentObject::__read ( )
private

Definition at line 518 of file class.ilPaymentObject.php.

References $result, DB_FETCHMODE_OBJECT, getPobjectId(), setPayMethod(), setRefId(), setStatus(), setTopicId(), and setVendorId().

Referenced by __construct().

{
if($this->getPobjectId())
{
$statement = $this->db->prepare('SELECT * FROM payment_objects WHERE pobject_id = ?',
array('integer'));
$result = $this->db->execute($statement, array($this->getPobjectId()));
while($row = $result->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->setRefId($row->ref_id);
$this->setStatus($row->status);
$this->setPayMethod($row->pay_method);
$this->setVendorId($row->vendor_id);
$this->setTopicId($row->pt_topic_fk);
return true;
}
}
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPaymentObject::_getActivation (   $a_ref_id)

Definition at line 459 of file class.ilPaymentObject.php.

References $res, and DB_FETCHMODE_OBJECT.

{
include_once './payment/classes/class.ilPaymentBookings.php';
global $rbacsystem,$ilDB;
$query = "SELECT * FROM payment_objects ".
"WHERE ref_id = '".$a_ref_id."' ".
"AND (status = '1' OR status = '2')";
$res = $ilDB->query($query);
$row = $res->fetchRow(DB_FETCHMODE_OBJECT);
return ilPaymentBookings::_getActivation($row->pobject_id);
}
ilPaymentObject::_getAllObjectsData ( )

Definition at line 291 of file class.ilPaymentObject.php.

References $_SESSION, $res, and DB_FETCHMODE_OBJECT.

Referenced by ilObjPaymentSettingsGUI\objectsObject().

{
global $ilDB;
$query = "SELECT * FROM payment_objects ";
if ($_SESSION["pay_objects"]["title_value"] != "")
{
$query .= ", object_reference AS obr ";
$query .= ", object_data AS od ";
}
if ($_SESSION['pay_objects']['vendor'] != "")
{
$query .= ", usr_data AS ud ";
}
$query .= " WHERE 1 ";
if ($_SESSION["pay_objects"]["title_value"])
{
$query .= " AND obr.ref_id = payment_objects.ref_id AND od.obj_id = obr.obj_id ";
$search_string = "";
$title_search = explode(" ", trim($_SESSION["pay_objects"]["title_value"]));
for ($i = 0; $i < count($title_search); $i++)
{
$title_search[$i] = trim($title_search[$i]);
if ($title_search[$i] != "")
{
$search_string .= " od.title LIKE ".$ilDB->quote("%".$title_search[$i]."%")." ";
switch ($_SESSION["pay_objects"]["title_type"])
{
case "or" :
if ($i < count($title_search) - 1) $search_string .= " OR ";
break;
case "and" :
if ($i < count($title_search) - 1) $search_string .= " AND ";
break;
}
}
}
if ($search_string != "")
{
$query .= " AND (" . $search_string . ") ";
}
}
if ($_SESSION['pay_objects']['vendor'] != "")
{
$query .= " AND ud.usr_id = payment_objects.vendor_id AND login = ".$ilDB->quote($_SESSION["pay_objects"]["vendor"])." ";
}
if ($_SESSION["pay_objects"]["pay_method"] == "1" ||
$_SESSION["pay_objects"]["pay_method"] == "2" ||
$_SESSION["pay_objects"]["pay_method"] == "3")
{
$query .= " AND pay_method = '" . $_SESSION["pay_objects"]["pay_method"] . "' ";
}
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$objects[$row->pobject_id]['pobject_id'] = $row->pobject_id;
$objects[$row->pobject_id]['ref_id'] = $row->ref_id;
$objects[$row->pobject_id]['status'] = $row->status;
$objects[$row->pobject_id]['pay_method'] = $row->pay_method;
$objects[$row->pobject_id]['vendor_id'] = $row->vendor_id;
$objects[$row->pobject_id]['topic_id'] = $row->pt_topic_fk;
}
return $objects ? $objects : array();
}

+ Here is the caller graph for this function:

ilPaymentObject::_getCountObjectsByPayMethod (   $a_type)

Definition at line 219 of file class.ilPaymentObject.php.

References $result, and DB_FETCHMODE_OBJECT.

Referenced by ilObjPaymentSettingsGUI\savePayMethodsObject().

{
global $ilDB;
switch($a_type)
{
case 'pm_bill':
$pm = 1;
break;
case 'pm_bmf':
$pm = 2;
break;
case 'pm_paypal':
$pm = 3;
break;
default:
$pm = -1;
}
$statement = $ilDB->prepare('SELECT COUNT(pay_method) AS pm FROM payment_objects WHERE pay_method = ?',
array('integer'));
$result = $ilDB->execute($statement, array($pm));
while($row = $result->fetchRow(DB_FETCHMODE_OBJECT))
{
return (int)$row->pm;
}
return 0;
}

+ Here is the caller graph for this function:

ilPaymentObject::_getObjectData (   $a_id)

Definition at line 369 of file class.ilPaymentObject.php.

References $res, and DB_FETCHMODE_ASSOC.

Referenced by ilPurchasePaypal\__saveTransaction().

{
global $ilDB;
$query = "SELECT * FROM payment_objects ".
"WHERE pobject_id = '".$a_id."'";
$res = $ilDB->query($query);
if (is_object($res))
{
return $res->fetchRow(DB_FETCHMODE_ASSOC);
}
return false;
}

+ Here is the caller graph for this function:

ilPaymentObject::_getObjectsData (   $a_user_id)

Definition at line 252 of file class.ilPaymentObject.php.

References $in, $res, ilPaymentTrustees\_getVendorsForObjects(), ilPaymentVendors\_isVendor(), and DB_FETCHMODE_OBJECT.

Referenced by ilPaymentObjectGUI\showObjects().

{
global $ilDB;
// get all vendors user is assigned to
include_once './payment/classes/class.ilPaymentTrustees.php';
include_once './payment/classes/class.ilPaymentVendors.php';
{
$vendors[] = $a_user_id;
}
if(!count($vendors))
{
return array();
}
$in = " IN ('";
$in .= implode("','",$vendors);
$in .= "')";
$query = "SELECT * FROM payment_objects ".
"WHERE vendor_id ".$in;
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$objects[$row->pobject_id]['pobject_id'] = $row->pobject_id;
$objects[$row->pobject_id]['ref_id'] = $row->ref_id;
$objects[$row->pobject_id]['status'] = $row->status;
$objects[$row->pobject_id]['pay_method'] = $row->pay_method;
$objects[$row->pobject_id]['vendor_id'] = $row->vendor_id;
$objects[$row->pobject_id]['topic_id'] = $row->pt_topic_fk;
}
return $objects ? $objects : array();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPaymentObject::_hasAccess (   $a_ref_id)

Definition at line 425 of file class.ilPaymentObject.php.

References $res, ilGeneralSettings\_getInstance(), ilPaymentBookings\_hasAccess(), and DB_FETCHMODE_OBJECT.

Referenced by ilSearch\_checkParentConditions(), _requiresPurchaseToAccess(), ilObjFileGUI\executeCommand(), ilSAHSPresentationGUI\executeCommand(), ilObjTestGUI\executeCommand(), ilObjFileBasedLMGUI\executeCommand(), ilObjCourseGUI\executeCommand(), ilObjFileListGUI\getCommandFrame(), ilObjFileBasedLMListGUI\getCommandFrame(), ilObjSAHSLearningModuleListGUI\getCommandFrame(), ilObjDlBookListGUI\getCommandFrame(), ilObjLearningModuleListGUI\getCommandFrame(), ilObjLearningModuleListGUI\getProperties(), ilObjectListGUI\insertPayment(), and ilShopResultPresentationGUI\renderItems().

{
include_once './payment/classes/class.ilPaymentBookings.php';
global $rbacsystem,$ilDB;
// check write access
if($rbacsystem->checkAccess('write', $a_ref_id))
{
return true;
}
include_once 'payment/classes/class.ilGeneralSettings.php';
if(!(bool)ilGeneralSettings::_getInstance()->get('shop_enabled'))
{
return true;
}
$query = "SELECT * FROM payment_objects ".
"WHERE ref_id = '".$a_ref_id."' ".
"AND (status = '1' OR status = '2')";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
if(!ilPaymentBookings::_hasAccess($row->pobject_id))
{
return false;
}
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilPaymentObject::_isBuyable (   $a_ref_id)
static

Definition at line 474 of file class.ilPaymentObject.php.

References $result, ilGeneralSettings\_getInstance(), and DB_FETCHMODE_OBJECT.

Referenced by _requiresPurchaseToAccess(), ilObjectGUI\confirmedDeleteObject(), ilObjFileGUI\executeCommand(), ilSAHSPresentationGUI\executeCommand(), ilObjTestGUI\executeCommand(), ilObjFileBasedLMGUI\executeCommand(), ilObjCourseGUI\executeCommand(), ilObjFileListGUI\getCommandFrame(), ilObjFileBasedLMListGUI\getCommandFrame(), ilObjSAHSLearningModuleListGUI\getCommandFrame(), ilObjDlBookListGUI\getCommandFrame(), ilObjLearningModuleListGUI\getCommandFrame(), ilObjLearningModuleListGUI\getProperties(), and ilObjectListGUI\insertPayment().

{
global $ilDB;
include_once 'payment/classes/class.ilGeneralSettings.php';
if(!(bool)ilGeneralSettings::_getInstance()->get('shop_enabled'))
{
return false;
}
$statement = $ilDB->prepare('SELECT * FROM payment_objects
WHERE ref_id = ? AND (status = 1 or status = 2)',
array('integer'));
$result = $ilDB->execute($statement, array($a_ref_id));
while($row = $result->fetchRow(DB_FETCHMODE_OBJECT))
{
return true;
}
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilPaymentObject::_isInCart (   $a_ref_id)
static

Definition at line 501 of file class.ilPaymentObject.php.

References $result, and DB_FETCHMODE_OBJECT.

Referenced by ilObjLearningModuleListGUI\getProperties(), and ilObjectListGUI\insertPayment().

{
global $ilDB, $ilUser;
$statement = $ilDB->prepare('SELECT psc_id
FROM payment_objects AS po, payment_shopping_cart AS psc
WHERE ref_id = ? AND customer_id = ? AND po.pobject_id = psc.pobject_id',
array('integer', 'integer'));
$result = $ilDB->execute($statement, array($a_ref_id, $ilUser->getId()));
while($row = $result->fetchRow(DB_FETCHMODE_OBJECT))
{
return true;
}
return false;
}

+ Here is the caller graph for this function:

ilPaymentObject::_isPurchasable (   $a_ref_id,
  $a_vendor_id = 0,
  $a_check_trustee = false 
)

Definition at line 386 of file class.ilPaymentObject.php.

References $in, $res, ilPaymentTrustees\_getVendorsForObjects(), and ilPaymentVendors\_isVendor().

Referenced by ilPaymentObjectGUI\addObject(), ilPaymentObjectSelector\isClickable(), and ilPaymentObjectSelector\showChilds().

{
global $ilDB;
// In the moment it's not possible to sell one object twice
$query = "SELECT * FROM payment_objects ".
"WHERE ref_id = '".$a_ref_id."' ";
if ($a_vendor_id > 0)
{
$query .= "AND vendor_id = '".$a_vendor_id."' ";
if($a_check_trustee)
{
include_once './payment/classes/class.ilPaymentTrustees.php';
include_once './payment/classes/class.ilPaymentVendors.php';
$vendors = ilPaymentTrustees::_getVendorsForObjects($a_vendor_id);
{
$vendors[] = $a_user_id;
}
if(is_array($vendors) && count($vendors))
{
$in = " IN ('";
$in .= implode("','",$vendors);
$in .= "')";
$query .= ' OR vendor_id '.$in;
}
}
}
#"AND status = '1' OR status = '3' ";
$res = $ilDB->query($query);
return $res->numRows() ? false : true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPaymentObject::_lookupPobjectId (   $a_ref_id)

Definition at line 182 of file class.ilPaymentObject.php.

References $res, and DB_FETCHMODE_OBJECT.

Referenced by ilPaymentPurchaseGUI\__initPaymentObject(), ilShopPurchaseGUI\__initPaymentObject(), ilPaymentStatisticGUI\addCustomer(), ilObjPaymentSettingsGUI\addCustomerObject(), ilShopResultPresentationGUI\renderItems(), ilPaymentStatisticGUI\saveCustomer(), and ilObjPaymentSettingsGUI\saveCustomerObject().

{
global $ilDB;
$query = "SELECT * FROM payment_objects ".
"WHERE ref_id = '".$a_ref_id."'";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
return $row->pobject_id;
}
return 0;
}

+ Here is the caller graph for this function:

static ilPaymentObject::_lookupTopicId (   $a_ref_id)
static

Definition at line 197 of file class.ilPaymentObject.php.

References $result, and DB_FETCHMODE_OBJECT.

Referenced by ilShopSearchResult\filter(), and ilShopSearchResult\getResultsForPresentation().

{
global $ilDB;
static $cache = array();
if(isset($cache[$a_ref_id]))
{
return $cache[$a_ref_id];
}
$statement = $ilDB->prepare('SELECT pt_topic_fk FROM payment_objects WHERE ref_id = ?',
array('integer'));
$result = $ilDB->execute($statement, array($a_ref_id));
while($row = $result->fetchRow(DB_FETCHMODE_OBJECT))
{
$cache[$a_ref_id] = $row->pt_topic_fk;
return (int)$cache[$a_ref_id];
}
return 0;
}

+ Here is the caller graph for this function:

static ilPaymentObject::_requiresPurchaseToAccess (   $a_ref_id)
static

Definition at line 496 of file class.ilPaymentObject.php.

References _hasAccess(), and _isBuyable().

Referenced by ilLMPresentationGUI\ilLMPresentationGUI(), ilLMExplorer\isClickable(), ilLMTOCExplorer\isClickable(), ilTableOfContentsExplorer\isClickable(), and ilObjContentObjectGUI\setilLMMenu().

{
return (bool)(self::_isBuyable($a_ref_id) && !self::_hasAccess($a_ref_id));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPaymentObject::add ( )

Definition at line 114 of file class.ilPaymentObject.php.

References $data, getPayMethod(), getRefId(), getStatus(), getTopicId(), and getVendorId().

{
$statement = $this->db->prepareManip(
'INSERT INTO payment_objects
SET
ref_id = ?,
status = ?,
pay_method = ?,
vendor_id = ?,
pt_topic_fk = ?',
array('integer', 'integer', 'integer', 'integer', 'integer'));
$data = array($this->getRefId(),
$this->getStatus(),
$this->getPayMethod(),
$this->getVendorId(),
$this->getTopicId());
$this->db->execute($statement, $data);
return (int)$this->db->getLastInsertId();
}

+ Here is the call graph for this function:

ilPaymentObject::delete ( )

Definition at line 135 of file class.ilPaymentObject.php.

References $data, and getPobjectId().

{
if($this->getPobjectId())
{
include_once 'Services/Payment/classes/class.ilFileDataShop.php';
$oFileData = new ilFileDataShop($this->getPobjectId());
$oFileData->deassignFileFromPaymentObject();
$statement = $this->db->prepareManip('DELETE FROM payment_objects WHERE pobject_id = ?',
array('integer'));
$data = array($this->getPobjectId());
$this->db->execute($statement, $data);
return true;
}
return false;
}

+ Here is the call graph for this function:

ilPaymentObject::getPayMethod ( )

Definition at line 101 of file class.ilPaymentObject.php.

References $pay_method.

Referenced by add(), and update().

{
}

+ Here is the caller graph for this function:

ilPaymentObject::getPobjectId ( )

Definition at line 77 of file class.ilPaymentObject.php.

References $pobject_id.

Referenced by __read(), delete(), and update().

{
}

+ Here is the caller graph for this function:

ilPaymentObject::getRefId ( )

Definition at line 85 of file class.ilPaymentObject.php.

References $ref_id.

Referenced by add(), and update().

{
return $this->ref_id;
}

+ Here is the caller graph for this function:

ilPaymentObject::getStatus ( )

Definition at line 93 of file class.ilPaymentObject.php.

References $status.

Referenced by add(), and update().

{
return $this->status;
}

+ Here is the caller graph for this function:

ilPaymentObject::getTopicId ( )

Definition at line 69 of file class.ilPaymentObject.php.

References $topic_id.

Referenced by add(), and update().

{
}

+ Here is the caller graph for this function:

ilPaymentObject::getVendorId ( )

Definition at line 109 of file class.ilPaymentObject.php.

References $vendor_id.

Referenced by add(), and update().

{
}

+ Here is the caller graph for this function:

ilPaymentObject::setPayMethod (   $a_method)

Definition at line 97 of file class.ilPaymentObject.php.

Referenced by __read().

{
$this->pay_method = $a_method;
}

+ Here is the caller graph for this function:

ilPaymentObject::setRefId (   $a_ref_id)

Definition at line 81 of file class.ilPaymentObject.php.

Referenced by __read().

{
$this->ref_id = $a_ref_id;
}

+ Here is the caller graph for this function:

ilPaymentObject::setStatus (   $a_status)

Definition at line 89 of file class.ilPaymentObject.php.

Referenced by __read().

{
$this->status = $a_status;
}

+ Here is the caller graph for this function:

ilPaymentObject::setTopicId (   $a_topic_id)

Definition at line 73 of file class.ilPaymentObject.php.

Referenced by __read().

{
$this->topic_id = $a_topic_id;
}

+ Here is the caller graph for this function:

ilPaymentObject::setVendorId (   $a_vendor_id)

Definition at line 105 of file class.ilPaymentObject.php.

Referenced by __read().

{
$this->vendor_id = $a_vendor_id;
}

+ Here is the caller graph for this function:

ilPaymentObject::update ( )

Definition at line 154 of file class.ilPaymentObject.php.

References $data, getPayMethod(), getPobjectId(), getRefId(), getStatus(), getTopicId(), and getVendorId().

{
if((int)$this->getPobjectId())
{
$statement = $this->db->prepareManip(
'UPDATE payment_objects
SET
ref_id = ?,
status = ?,
pay_method = ?,
vendor_id = ?,
pt_topic_fk = ?
WHERE pobject_id = ?',
array('integer', 'integer', 'integer', 'integer', 'integer', 'integer'));
$data = array($this->getRefId(),
$this->getStatus(),
$this->getPayMethod(),
$this->getVendorId(),
$this->getTopicId(),
$this->getPobjectId());
$this->db->execute($statement, $data);
return true;
}
return false;
}

+ Here is the call graph for this function:

Field Documentation

ilPaymentObject::$db = null
private

Definition at line 39 of file class.ilPaymentObject.php.

ilPaymentObject::$pay_method = null
private

Definition at line 44 of file class.ilPaymentObject.php.

Referenced by getPayMethod().

ilPaymentObject::$pobject_id = null
private

Definition at line 41 of file class.ilPaymentObject.php.

Referenced by getPobjectId().

ilPaymentObject::$ref_id = null
private

Definition at line 42 of file class.ilPaymentObject.php.

Referenced by getRefId().

ilPaymentObject::$status = null
private

Definition at line 43 of file class.ilPaymentObject.php.

Referenced by getStatus().

ilPaymentObject::$topic_id = 0
private

Definition at line 46 of file class.ilPaymentObject.php.

Referenced by getTopicId().

ilPaymentObject::$user_obj = null
private

Definition at line 40 of file class.ilPaymentObject.php.

Referenced by __construct().

ilPaymentObject::$vendor_id = null
private

Definition at line 45 of file class.ilPaymentObject.php.

Referenced by getVendorId().


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