ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules 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 ()
 
 getVatId ()
 
 setVatId ($a_vat_id)
 
 setSubtype ($a_subtype)
 
 getSubtype ()
 
 setSpecial ($a_special)
 
 getSpecial ()
 
 getVat ($a_amount=0, $type='CALCULATION')
 
 add ()
 
 delete ()
 
 update ()
 

Static Public Member Functions

static _lookupPobjectId ($a_ref_id)
 
static _lookupTopicId ($a_ref_id)
 
static _getCountObjectsByPayMethod ($a_id)
 
static _getObjectsData ($a_user_id)
 
static _getAllObjectsData ()
 
static _getObjectData ($a_id)
 
static _isPurchasable ($a_ref_id, $a_vendor_id=0, $a_check_trustee=false, $a_check_status=false)
 
static _hasAccess ($a_ref_id, $a_transaction=0, $a_subtype='')
 
static _isBuyable ($a_ref_id, $a_subtype='')
 
static _isNewObject ($a_ref_id)
 
static _requiresPurchaseToAccess ($a_ref_id, $a_purchasetype='')
 this function should be used by all buyable repository objects !! More...
 
static _isInCart ($a_ref_id)
 
static _hasExtensions ($a_ref_id)
 
static _checkExcSubtype ($a_ref_id)
 
static getAllBuyableObjects ()
 
static _getSpecialObjects ()
 
static _getContainerObjects ($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
 
 $vat_id = 0
 
 $subtype = null
 
 $is_special = 0
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

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

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

References $user_obj, and __read().

28  {
29  global $ilDB;
30 
31  $this->db = $ilDB;
32  $this->user_obj = $user_obj;
33 
34  $this->STATUS_NOT_BUYABLE = 0;
35  $this->STATUS_BUYABLE = 1;
36  $this->STATUS_EXPIRES = 2;
37 
38  $this->PAY_METHOD_NOT_SPECIFIED = 0;
39 
40  $this->pobject_id = $a_pobject_id;
41 
42  include_once './Services/Payment/classes/class.ilPayMethods.php';
43  $pmObj = new ilPayMethods();
44  $tmp = $pmObj->readAll();
45 
46  foreach($tmp as $pm)
47  {
48  $tmp = strtoupper($pm['pm_title']);
49  $this->PAY_METHOD_.$tmp = $pm['pm_id'];
50  }
51  $this->__read();
52  }
Class ilObjPaymentSettingsGUI.
+ Here is the call graph for this function:

Member Function Documentation

◆ __read()

ilPaymentObject::__read ( )
private

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

References $result, $row, getPobjectId(), setPayMethod(), setRefId(), setSpecial(), setStatus(), setSubtype(), setTopicId(), setVatId(), and setVendorId().

Referenced by __construct().

668  {
669  if($this->getPobjectId())
670  {
671  $result = $this->db->queryf('SELECT * FROM payment_objects WHERE pobject_id = %s',
672  array('integer'), array($this->getPobjectId()));
673 
674  while($row = $this->db->fetchObject($result))
675  {
676  $this->setRefId($row->ref_id);
677  $this->setStatus($row->status);
678  $this->setPayMethod($row->pay_method);
679  $this->setVendorId($row->vendor_id);
680  $this->setTopicId($row->pt_topic_fk);
681  $this->setVatId($row->vat_id);
682  $this->setSubtype($row->subtype);
683  $this->setSpecial($row->is_special);
684 
685  return true;
686  }
687  }
688 
689  return false;
690  }
$result
setVendorId($a_vendor_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _checkExcSubtype()

static ilPaymentObject::_checkExcSubtype (   $a_ref_id)
static

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

References $res, and $row.

Referenced by ilPaymentObjectGUI\addObject(), ilShopSearchResult\getResultsForPresentation(), and ilPaymentObjectGUI\resetObjectFilter().

693  {
694  global $ilDB;
695 
696  $res = $ilDB->queryF('SELECT * FROM payment_objects WHERE
697  ref_id = %s', array('integer'), array($a_ref_id));
698  $subtypes = array();
699  while($row = $ilDB->fetchAssoc($res))
700  {
701  $subtypes[] = $row['subtype'];
702  }
703  return $subtypes;
704  }
+ Here is the caller graph for this function:

◆ _getAllObjectsData()

static ilPaymentObject::_getAllObjectsData ( )
static

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

References $_SESSION, $query, $res, and $row.

Referenced by ilObjPaymentSettingsGUI\objectsObject().

317  {
318  global $ilDB;
319 
320  $data_types = array();
321  $data_values = array();
322 
323  $query = 'SELECT * FROM payment_objects ';
324 
325  if ($_SESSION['pay_objects']['title_value'] != '')
326  {
327  $query .= ', object_reference obr, object_data od ';
328  }
329 
330  if ($_SESSION['pay_objects']['vendor'] != '')
331  {
332  $query .= ', usr_data ud ';
333  }
334 
335  $query .= ' WHERE 1 = 1 ';
336 
337  if ($_SESSION['pay_objects']['title_value'])
338  {
339  $query .= ' AND obr.ref_id = payment_objects.ref_id AND od.obj_id = obr.obj_id ';
340 
341  $search_string = '';
342 
343  $title_search = explode(' ', trim($_SESSION['pay_objects']['title_value']));
344  for ($i = 0; $i < count($title_search); $i++)
345  {
346  $title_search[$i] = trim($title_search[$i]);
347 
348  if ($title_search[$i] != '')
349  {
350  //$search_string .= " od.title LIKE ".$ilDB->quote("%".$title_search[$i]."%")." ";
351  $search_string .= ' od.title LIKE %s '; // ".$ilDB->quote("%".$title_search[$i]."%")." ";
352  array_push($data_types, 'text');
353  array_push($data_values,'%'.$title_search[$i].'%');
354 
355  switch ($_SESSION['pay_objects']['title_type'])
356  {
357  case 'or' :
358  if ($i < count($title_search) - 1)
359  {
360  $search_string .= ' OR ';
361  }
362  break;
363  case 'and' :
364  if ($i < count($title_search) - 1)
365  {
366  $search_string .= ' AND ';
367  }
368  break;
369  }
370  }
371  }
372 
373  if ($search_string != '')
374  {
375  $query .= ' AND (' . $search_string . ') ';
376  }
377  }
378 
379  if ($_SESSION['pay_objects']['vendor'] != '')
380  {
381  $query .= ' AND ud.usr_id = payment_objects.vendor_id AND login = %s';
382  array_push($data_types, 'text');
383  array_push($data_values, $_SESSION['pay_objects']['vendor']);
384  }
385 
386  if($_SESSION['pay_objects']['pay_method'] > 0)
387  {
388  $query .= ' AND pay_method = %s';
389  array_push($data_types, 'integer');
390  array_push($data_values, $_SESSION['pay_objects']['pay_method']);
391  }
392 
393  $res = $ilDB->queryf($query, $data_types, $data_values);
394  $objects = array();
395  while($row = $ilDB->fetchObject($res))
396  {
397  $objects[$row->pobject_id]['pobject_id'] = $row->pobject_id;
398  $objects[$row->pobject_id]['ref_id'] = $row->ref_id;
399  $objects[$row->pobject_id]['status'] = $row->status;
400  $objects[$row->pobject_id]['pay_method'] = $row->pay_method;
401  $objects[$row->pobject_id]['vendor_id'] = $row->vendor_id;
402  $objects[$row->pobject_id]['topic_id'] = $row->pt_topic_fk;
403  $objects[$row->pobject_id]['vat_id'] = $row->vat_id;
404  $objects[$row->pobject_id]['subtype'] = $row->subtype;
405  $objects[$row->pobject_id]['is_special'] = $row->is_special;
406  }
407  return $objects ? $objects : array();
408  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
+ Here is the caller graph for this function:

◆ _getContainerObjects()

static ilPaymentObject::_getContainerObjects (   $a_ref_id)
static

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

References $res, and $row.

Referenced by ilShopGUI\showContainerContent().

740  {
741  global $ilDB, $tree;
742 
743  $filter = array( "lm", "sahs", "htlm",'file', 'exc', 'tst', 'icrs','crs','crsr','rcrs', 'glo');
744  $objects = $tree->getChildsByTypeFilter($a_ref_id, $filter);
745 
746  $counter = 0;
747  $obj_res = array();
748  foreach($objects as $object)
749  {
750  if(self::_isBuyable($object['ref_id']))
751  {
752  $res = $ilDB->queryF('SELECT * FROM payment_objects
753  WHERE ref_id = %s AND status = %s
754  ORDER BY pt_topic_fk',
755  array('integer', 'integer'), array($object['ref_id'],1));
756 
757  while($row = $ilDB->fetchAssoc($res))
758  {
759  $obj_res[$counter] = $row;
760  #$obj_res[$counter]['ref_id'] = $object['ref_id'];
761  $obj_res[$counter]['obj_id'] = $object['obj_id'];
762  $obj_res[$counter]['type'] = $object['type'];
763  $obj_res[$counter]['title'] = $object['title'];
764  $obj_res[$counter]['child'] = $object['child'];
765  $obj_res[$counter]['description'] = $object['description'];
766  }
767  }
768 
769  $counter++;
770  }
771  return $obj_res;
772  }
+ Here is the caller graph for this function:

◆ _getCountObjectsByPayMethod()

static ilPaymentObject::_getCountObjectsByPayMethod (   $a_id)
static

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

References $result, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilObjPaymentSettingsGUI\savePayMethodsObject().

239  {
240  global $ilDB;
241 
242 
243  $result = $ilDB->queryf('SELECT COUNT(pay_method) pm FROM payment_objects WHERE pay_method = %s',
244  array('integer'), array($a_id));
245 
246  while($row = $result->fetchRow(DB_FETCHMODE_OBJECT))
247  {
248  return (int)$row->pm;
249  }
250 
251  return 0;
252  }
$result
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the caller graph for this function:

◆ _getObjectData()

static ilPaymentObject::_getObjectData (   $a_id)
static

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

References $res.

Referenced by ilPurchaseBaseGUI\__addBookings(), ilObjPaymentSettingsGUI\editPriceObject(), ilPaymentStatisticGUI\editStatistic(), ilPaymentStatisticGUI\performDeleteDeassignCrs(), ilPurchase\purchase(), and ilShopGUI\showContainerContent().

411  {
412  global $ilDB;
413 
414  $res = $ilDB->queryf('
415  SELECT * FROM payment_objects
416  WHERE pobject_id = %s',
417  array('integer'), array($a_id));
418 
419  if (is_object($res))
420  {
421  return $ilDB->fetchAssoc($res);
422 
423  }
424 
425  return false;
426  }
+ Here is the caller graph for this function:

◆ _getObjectsData()

static ilPaymentObject::_getObjectsData (   $a_user_id)
static

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

References $in, $query, $res, $row, and ilPaymentTrustees\_getVendorsForObjects().

Referenced by ilPaymentObjectGUI\resetObjectFilter().

255  {
256  global $ilDB;
257 
258  // get all vendors user is assigned to
259  include_once './Services/Payment/classes/class.ilPaymentTrustees.php';
260  include_once './Services/Payment/classes/class.ilPaymentVendors.php';
261 
262  $vendors = ilPaymentTrustees::_getVendorsForObjects($a_user_id);
263 
264  if(ilPaymentVendors::_isVendor($a_user_id))
265  {
266  $vendors[] = $a_user_id;
267  }
268 
269  if(!count($vendors))
270  {
271  return array();
272  }
273 
274  $data_types = array();
275  $data_values = array();
276  $cnt_vendors = count($vendors);
277 
278  $query = 'SELECT * FROM payment_objects WHERE vendor_id IN';
279 
280  if (is_array($vendors) &&
281  $cnt_vendors > 0)
282  {
283  $in = '(';
284  $counter = 0;
285  foreach($vendors as $vendor)
286  {
287  array_push($data_values, $vendor);
288  array_push($data_types, 'integer');
289 
290  if($counter > 0) $in .= ',';
291  $in .= '%s';
292  ++$counter;
293  }
294  $in .= ')';
295  $query .= $in;
296  }
297 
298  $res= $ilDB->queryf($query, $data_types, $data_values);
299 
300 
301  while($row = $ilDB->fetchObject($res))
302  {
303  $objects[$row->pobject_id]['pobject_id'] = $row->pobject_id;
304  $objects[$row->pobject_id]['ref_id'] = $row->ref_id;
305  $objects[$row->pobject_id]['status'] = $row->status;
306  $objects[$row->pobject_id]['pay_method'] = $row->pay_method;
307  $objects[$row->pobject_id]['vendor_id'] = $row->vendor_id;
308  $objects[$row->pobject_id]['topic_id'] = $row->pt_topic_fk;
309  $objects[$row->pobject_id]['vat_id'] = $row->vat_id;
310  $objects[$row->pobject_id]['subtype'] = $row->subtype;
311  $objects[$row->pobject_id]['is_special'] = $row->is_special;
312  }
313  return $objects ? $objects : array();
314  }
static _getVendorsForObjects($a_usr_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getSpecialObjects()

static ilPaymentObject::_getSpecialObjects ( )
static

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

References $res, and $row.

Referenced by ilShopGUI\showSpecialContent().

723  {
724  global $ilDB;
725 
726  $res = $ilDB->queryF('SELECT * FROM payment_objects
727  WHERE is_special = %s AND status = %s
728  ORDER BY pt_topic_fk',
729  array('integer', 'integer'), array(1,1));
730 
731  $obj = array();
732  while($row = $ilDB->fetchAssoc($res))
733  {
734  $obj[] = $row;
735  }
736  return $obj;
737  }
+ Here is the caller graph for this function:

◆ _hasAccess()

static ilPaymentObject::_hasAccess (   $a_ref_id,
  $a_transaction = 0,
  $a_subtype = '' 
)
static

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

References $ilUser, $result, $row, ilPaymentTrustees\_getVendorIdsByTrustee(), and ilPaymentBookings\_hasAccess().

Referenced by ilObjFileListGUI\getCommandFrame(), ilObjFileBasedLMListGUI\getCommandFrame(), ilObjDlBookListGUI\getCommandFrame(), ilObjSAHSLearningModuleListGUI\getCommandFrame(), ilObjLearningModuleListGUI\getCommandFrame(), ilExAssignmentGUI\getOverviewBody(), ilObjLearningModuleListGUI\getProperties(), and ilShopResultPresentationGUI\renderItems().

483  {
484  include_once './Services/Payment/classes/class.ilPaymentBookings.php';
485  include_once './Services/Payment/classes/class.ilPaymentTrustees.php';
486  include_once './Services/Payment/classes/class.ilPaymentVendors.php';
487 
488  global $rbacsystem,$ilDB, $ilUser;
489 
490  // check write access
491  if($rbacsystem->checkAccess('write', $a_ref_id))
492  {
493  return true;
494  }
495  // check if user is vendor/trustee
496  $vendors_of_trustee = ilPaymentTrustees::_getVendorIdsByTrustee($ilUser->getId());
497 
498  if(!IS_PAYMENT_ENABLED)
499  {
500  return true;
501  }
502 
503  if($a_subtype)
504  {
505  $result = $ilDB->queryf('
506  SELECT * FROM payment_objects
507  WHERE ref_id = %s AND (status = %s or status = %s)
508  AND subtype = %s',
509  array('integer', 'integer', 'integer','text'),
510  array($a_ref_id, '1', '2',$a_subtype));
511  }
512  else
513  {
514  $result = $ilDB->queryf('
515  SELECT * FROM payment_objects
516  WHERE ref_id = %s
517  AND (status = %s OR status = %s)
518  OR (vendor_id = %s)',
519  array('integer', 'integer', 'integer','integer'),
520  array($a_ref_id, '1', '2',$ilUser->getId()));
521  }
522  while($row = $ilDB->fetchObject($result))
523  {
524  if($row->vendor_id == $ilUser->getId() || in_array($row->vendor_id, $vendors_of_trustee))
525  {
526  return true;
527  }
528  else
529  if(!ilPaymentBookings::_hasAccess($row->pobject_id, '', $a_transaction))
530  {
531  return false;
532  }
533  else
534  {
535  return true;
536  }
537  }
538  return false;
539  }
$result
static _hasAccess($a_pobject_id, $a_user_id=0, $a_transaction=0)
global $ilUser
Definition: imgupload.php:15
static _getVendorIdsByTrustee($a_usr_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _hasExtensions()

static ilPaymentObject::_hasExtensions (   $a_ref_id)
static

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

References $res, and $row.

Referenced by ilObjectListGUI\insertPayment().

647  {
648  global $ilDB;
649 
650  // user has already access to current object
651  // object contain buyable extension-prices
652 
653  $res = $ilDB->queryf('
654  SELECT * FROM payment_prices pp, payment_objects po
655  WHERE po.ref_id = %s
656  AND pp.pobject_id = po.pobject_id
657  AND pp.extension = %s',
658  array('integer', 'integer'), array($a_ref_id, 1));
659 
660  if($row = $ilDB->numRows($res))
661  {
662  return true;
663  }
664  return false;
665  }
+ Here is the caller graph for this function:

◆ _isBuyable()

static ilPaymentObject::_isBuyable (   $a_ref_id,
  $a_subtype = '' 
)
static

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

References $result, and $row.

Referenced by ilRepUtil\deleteObjects(), ilObjFileListGUI\getCommandFrame(), ilObjFileBasedLMListGUI\getCommandFrame(), ilObjDlBookListGUI\getCommandFrame(), ilObjSAHSLearningModuleListGUI\getCommandFrame(), ilObjLearningModuleListGUI\getCommandFrame(), ilExAssignmentGUI\getOverviewBody(), ilObjLearningModuleListGUI\getProperties(), ilShopExplorer\setOutput(), and ilShopGUI\showContainerContent().

542  {
543  global $ilDB;
544 
545 
546  if(!IS_PAYMENT_ENABLED)
547  {
548  return false;
549  }
550 
551  if($a_subtype)
552  {
553  $result = $ilDB->queryf('
554  SELECT * FROM payment_objects
555  WHERE ref_id = %s
556  AND (status = %s or status = %s)
557  AND subtype = %s',
558  array('integer', 'integer', 'integer','text'),
559  array($a_ref_id, '1', '2',$a_subtype));
560  }
561  else
562  {
563  $result = $ilDB->queryf('
564  SELECT * FROM payment_objects
565  WHERE ref_id = %s AND (status = %s or status = %s)',
566  array('integer', 'integer', 'integer'),
567  array($a_ref_id, '1', '2'));
568  }
569 
570  while($row = $ilDB->fetchObject($result))
571  {
572  return true;
573  }
574  return false;
575  }
$result
+ Here is the caller graph for this function:

◆ _isInCart()

static ilPaymentObject::_isInCart (   $a_ref_id)
static

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

References $ilUser, $result, and $row.

Referenced by ilObjLearningModuleListGUI\getProperties().

615  {
616  global $ilDB, $ilUser;
617 
618  if(ANONYMOUS_USER_ID == $ilUser->getId())
619  {
620  $result = $ilDB->queryf('
621  SELECT psc_id FROM payment_objects po, payment_shopping_cart psc
622  WHERE ref_id = %s
623  AND session_id = %s
624  AND po.pobject_id = psc.pobject_id',
625  array('integer', 'text'),
626  array($a_ref_id, session_id()));
627  }
628  else
629  {
630  $result = $ilDB->queryf('
631  SELECT psc_id FROM payment_objects po, payment_shopping_cart psc
632  WHERE ref_id = %s
633  AND customer_id = %s
634  AND po.pobject_id = psc.pobject_id',
635  array('integer', 'integer'),
636  array($a_ref_id, $ilUser->getId()));
637  }
638  while($row = $ilDB->fetchObject($result))
639  {
640  return true;
641  }
642 
643  return false;
644  }
$result
global $ilUser
Definition: imgupload.php:15
+ Here is the caller graph for this function:

◆ _isNewObject()

static ilPaymentObject::_isNewObject (   $a_ref_id)
static

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

References $res.

Referenced by ilPaymentObjectSelector\isClickable().

579  {
580  global $ilDB;
581 
582  $res = $ilDB->queryF('SELECT * FROM payment_objects WHERE ref_id = %s',
583  array('integer'), array($a_ref_id));
584 
585  $rows = $ilDB->numRows($res);
586 
587  return $rows ? false : true;
588  }
+ Here is the caller graph for this function:

◆ _isPurchasable()

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

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

References $data, $query, $res, and ilPaymentTrustees\_getVendorsForObjects().

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

429  {
430  global $ilDB;
431 
432  // In the moment it's not possible to sell one object twice
433 
434  $data = array();
435  $data_types = array();
436 
437 
438  $query = 'SELECT * FROM payment_objects WHERE ref_id = %s ';
439  $data_types[] = 'integer';
440  $data[]= $a_ref_id;
441 
442  // check if object is buyable !!
443  if($a_check_status)
444  {
445  $query .= 'AND status > %s ';
446  $data_types[] = 'integer';
447  $data[] = 0;
448  }
449 
450  if ($a_vendor_id > 0)
451  {
452  $query .= 'AND vendor_id = %s';
453  $data_types[] = 'integer';
454  $data[] = $a_vendor_id;
455 
456  if($a_check_trustee)
457  {
458  include_once './Services/Payment/classes/class.ilPaymentTrustees.php';
459  include_once './Services/Payment/classes/class.ilPaymentVendors.php';
460 
461  $vendors = ilPaymentTrustees::_getVendorsForObjects($a_vendor_id);
462  if(ilPaymentVendors::_isVendor($a_user_id))
463  {
464  $vendors[] = $a_user_id;
465  }
466 
467  if(is_array($vendors) && count($vendors))
468  {
469  $query .= ' OR '.$ilDB->in('vendor_id', $vendors, false, 'integer');
470  }
471  }
472  }
473 
474  $res = $ilDB->queryf($query, $data_types, $data);
475  $rows = $ilDB->numRows($res);
476 
477  return $rows ? true : false;
478 
479  }
static _getVendorsForObjects($a_usr_id)
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _lookupPobjectId()

static ilPaymentObject::_lookupPobjectId (   $a_ref_id)
static

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

References $res, and $row.

Referenced by ilShopPurchaseGUI\__initPaymentObject(), ilPaymentStatisticGUI\addCustomer(), ilObjPaymentSettingsGUI\addCustomerObject(), ilObjectListGUI\insertPayment(), ilShopResultPresentationGUI\renderItems(), ilObjPaymentSettingsGUI\saveCustomerObject(), and ilShopGUI\showContainerContent().

200  {
201  global $ilDB;
202 
203  $res = $ilDB->queryf('
204  SELECT * FROM payment_objects
205  WHERE ref_id = %s',
206  array('integer'),
207  array($a_ref_id));
208 
209  while($row = $ilDB->fetchAssoc($res))
210  {
211  return $row['pobject_id'];
212  }
213  return 0;
214  }
+ Here is the caller graph for this function:

◆ _lookupTopicId()

static ilPaymentObject::_lookupTopicId (   $a_ref_id)
static

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

References $result, $row, and DB_FETCHMODE_OBJECT.

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

217  {
218  global $ilDB;
219 
220  static $cache = array();
221  if(isset($cache[$a_ref_id]))
222  {
223  return $cache[$a_ref_id];
224  }
225 
226  $result = $ilDB->queryf('SELECT pt_topic_fk FROM payment_objects WHERE ref_id = %s',
227  array('integer'),array($a_ref_id));
228 
229  while($row = $result->fetchRow(DB_FETCHMODE_OBJECT))
230  {
231  $cache[$a_ref_id] = $row->pt_topic_fk;
232  return (int)$cache[$a_ref_id];
233  }
234 
235  return 0;
236  }
$result
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the caller graph for this function:

◆ _requiresPurchaseToAccess()

static ilPaymentObject::_requiresPurchaseToAccess (   $a_ref_id,
  $a_purchasetype = '' 
)
static

this function should be used by all buyable repository objects !!

Parameters
<integer>$a_ref_id
<text>$a_purchasetype ('buy', 'demo')
Returns
<bool>

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

Referenced by ilObjFileGUI\executeCommand(), ilSAHSPresentationGUI\executeCommand(), ilObjFileBasedLMGUI\executeCommand(), ilObjTestGUI\executeCommand(), ilGlossaryPresentationGUI\executeCommand(), ilObjCourseGUI\executeCommand(), ilLMPresentationGUI\ilLMPresentationGUI(), ilLMExplorer\isClickable(), ilLMTOCExplorer\isClickable(), ilTableOfContentsExplorer\isClickable(), ilLMTOCExplorerGUI\isNodeClickable(), and ilObjContentObjectGUI\setilLMMenu().

599  {
600  /* Check:
601  * - User has no Access -> return false
602  * - User has Access but there are also Extension-Prices available -> User is able to buy the Object AGAIN to extend duration
603  */
604 
605  if( (self::_isBuyable($a_ref_id) && !self::_hasAccess($a_ref_id))
606  || (self::_isBuyable($a_ref_id) && self::_hasAccess($a_ref_id)
607  && self::_hasExtensions($a_ref_id) && isset($a_purchasetype)))
608  {
609  return true;
610  }
611  else return false;
612  }
+ Here is the caller graph for this function:

◆ add()

ilPaymentObject::add ( )

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

References getPayMethod(), getRefId(), getSpecial(), getStatus(), getSubtype(), getTopicId(), getVatId(), and getVendorId().

142  {
143  $next_id = $this->db->nextId('payment_objects');
144 
145  $this->db->insert('payment_objects',array(
146  'pobject_id' => array('integer', $next_id),
147  'ref_id' => array('integer', $this->getRefId()),
148  'status' => array('integer', $this->getStatus()),
149  'pay_method' => array('integer', $this->getPayMethod()),
150  'vendor_id' => array('integer', $this->getVendorId()),
151  'pt_topic_fk' => array('integer', $this->getTopicId()),
152  'vat_id' => array('integer', $this->getVatId()),
153  'subtype' => array('text', $this->getSubtype()),
154  'is_special' => array('integer', $this->getSpecial())
155  ));
156  return $next_id;
157  }
+ Here is the call graph for this function:

◆ delete()

ilPaymentObject::delete ( )

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

References getPobjectId().

160  {
161  if($this->getPobjectId())
162  {
163  include_once 'Services/Payment/classes/class.ilFileDataShop.php';
164  $oFileData = new ilFileDataShop($this->getPobjectId());
165  $oFileData->deassignFileFromPaymentObject();
166 
167  $statement = $this->db->manipulateF('DELETE FROM payment_objects WHERE pobject_id = %s',
168  array('integer'), array($this->getPobjectId()));
169 
170 
171  return true;
172  }
173 
174  return false;
175  }
This class handles all operations on files in directory data/shop.
+ Here is the call graph for this function:

◆ getAllBuyableObjects()

static ilPaymentObject::getAllBuyableObjects ( )
static

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

References $res, and $row.

Referenced by ilShopExplorer\ilShopExplorer().

707  {
708  global $ilDB;
709 
710 
711  $res = $ilDB->queryF('SELECT ref_id FROM payment_objects WHERE status = %s',
712  array('integer'), array(1));
713 
714  $obj = array();
715  while($row = $ilDB->fetchAssoc($res))
716  {
717  $obj[] = $row['ref_id'];
718  }
719  return $obj;
720  }
+ Here is the caller graph for this function:

◆ getPayMethod()

ilPaymentObject::getPayMethod ( )

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

References $pay_method.

Referenced by add(), and update().

88  {
89  return $this->pay_method;
90  }
+ Here is the caller graph for this function:

◆ getPobjectId()

ilPaymentObject::getPobjectId ( )

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

References $pobject_id.

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

64  {
65  return $this->pobject_id;
66  }
+ Here is the caller graph for this function:

◆ getRefId()

ilPaymentObject::getRefId ( )

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

References $ref_id.

Referenced by add(), and update().

72  {
73  return $this->ref_id;
74  }
+ Here is the caller graph for this function:

◆ getSpecial()

ilPaymentObject::getSpecial ( )

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

References $is_special.

Referenced by add(), and update().

122  {
123  return $this->is_special;
124  }
+ Here is the caller graph for this function:

◆ getStatus()

ilPaymentObject::getStatus ( )

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

References $status.

Referenced by add(), and update().

80  {
81  return $this->status;
82  }
+ Here is the caller graph for this function:

◆ getSubtype()

ilPaymentObject::getSubtype ( )

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

References $subtype.

Referenced by add(), and update().

114  {
115  return $this->subtype;
116  }
+ Here is the caller graph for this function:

◆ getTopicId()

ilPaymentObject::getTopicId ( )

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

References $topic_id.

Referenced by add(), and update().

56  {
57  return $this->topic_id;
58  }
+ Here is the caller graph for this function:

◆ getVat()

ilPaymentObject::getVat (   $a_amount = 0,
  $type = 'CALCULATION' 
)

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

References ilShopUtils\_formatFloat(), and getVatId().

127  {
128  $oVAT = new ilShopVats($this->getVatId());
129  switch($type)
130  {
131  case 'CALCULATION':
132  $val = (float)($a_amount - (round(($a_amount / (1 + ($oVAT->getRate() / 100))) * 100) / 100));
133  return number_format((float)$val,'2','.','');
134  default:
135  $val = (float)($a_amount - (round(($a_amount / (1 + ($oVAT->getRate() / 100))) * 100) / 100));
136  $val = ilShopUtils::_formatFloat($val);
137  return $val;
138  }
139  }
Class ilShopVats.
static _formatFloat($a_float, $a_num_decimals=2)
Formats a float value for gui output.
+ Here is the call graph for this function:

◆ getVatId()

ilPaymentObject::getVatId ( )

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

References $vat_id.

Referenced by add(), getVat(), and update().

100  {
101  return $this->vat_id;
102  }
+ Here is the caller graph for this function:

◆ getVendorId()

ilPaymentObject::getVendorId ( )

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

References $vendor_id.

Referenced by add(), and update().

96  {
97  return $this->vendor_id;
98  }
+ Here is the caller graph for this function:

◆ setPayMethod()

ilPaymentObject::setPayMethod (   $a_method)

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

Referenced by __read().

84  {
85  $this->pay_method = $a_method;
86  }
+ Here is the caller graph for this function:

◆ setRefId()

ilPaymentObject::setRefId (   $a_ref_id)

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

Referenced by __read().

68  {
69  $this->ref_id = $a_ref_id;
70  }
+ Here is the caller graph for this function:

◆ setSpecial()

ilPaymentObject::setSpecial (   $a_special)

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

Referenced by __read().

118  {
119  $this->is_special = $a_special;
120  }
+ Here is the caller graph for this function:

◆ setStatus()

ilPaymentObject::setStatus (   $a_status)

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

Referenced by __read().

76  {
77  $this->status = $a_status;
78  }
+ Here is the caller graph for this function:

◆ setSubtype()

ilPaymentObject::setSubtype (   $a_subtype)

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

Referenced by __read().

109  {
110  $this->subtype = $a_subtype;
111  }
+ Here is the caller graph for this function:

◆ setTopicId()

ilPaymentObject::setTopicId (   $a_topic_id)

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

Referenced by __read().

60  {
61  $this->topic_id = $a_topic_id;
62  }
+ Here is the caller graph for this function:

◆ setVatId()

ilPaymentObject::setVatId (   $a_vat_id)

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

Referenced by __read().

104  {
105  $this->vat_id = $a_vat_id;
106  }
+ Here is the caller graph for this function:

◆ setVendorId()

ilPaymentObject::setVendorId (   $a_vendor_id)

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

Referenced by __read().

92  {
93  $this->vendor_id = $a_vendor_id;
94  }
+ Here is the caller graph for this function:

◆ update()

ilPaymentObject::update ( )

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

References getPayMethod(), getPobjectId(), getRefId(), getSpecial(), getStatus(), getSubtype(), getTopicId(), getVatId(), and getVendorId().

178  {
179  if((int)$this->getPobjectId())
180  {
181  $this->db->update('payment_objects',array(
182  'ref_id' => array('integer', $this->getRefId()),
183  'status' => array('integer', $this->getStatus()),
184  'pay_method' => array('integer', $this->getPayMethod()),
185  'vendor_id' => array('integer', $this->getVendorId()),
186  'pt_topic_fk' => array('integer', $this->getTopicId()),
187  'vat_id' => array('integer', $this->getVatId()),
188  'subtype' => array('text', $this->getSubtype()),
189  'is_special' => array('integer', $this->getSpecial())
190  ),
191  array('pobject_id' => array('integer', $this->getPobjectId())));
192 
193  return true;
194  }
195  else
196  return false;
197  }
+ Here is the call graph for this function:

Field Documentation

◆ $db

ilPaymentObject::$db = null
private

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

◆ $is_special

ilPaymentObject::$is_special = 0
private

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

Referenced by getSpecial().

◆ $pay_method

ilPaymentObject::$pay_method = null
private

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

Referenced by getPayMethod().

◆ $pobject_id

ilPaymentObject::$pobject_id = null
private

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

Referenced by getPobjectId().

◆ $ref_id

ilPaymentObject::$ref_id = null
private

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

Referenced by getRefId().

◆ $status

ilPaymentObject::$status = null
private

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

Referenced by getStatus().

◆ $subtype

ilPaymentObject::$subtype = null
private

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

Referenced by getSubtype().

◆ $topic_id

ilPaymentObject::$topic_id = 0
private

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

Referenced by getTopicId().

◆ $user_obj

ilPaymentObject::$user_obj = null
private

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

Referenced by __construct().

◆ $vat_id

ilPaymentObject::$vat_id = 0
private

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

Referenced by getVatId().

◆ $vendor_id

ilPaymentObject::$vendor_id = null
private

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

Referenced by getVendorId().


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