ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 _getTopicsObjects ($topic_id=NULL)
 
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.

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.
global $ilDB

References $ilDB, $user_obj, and __read().

+ Here is the call graph for this function:

Member Function Documentation

◆ __read()

ilPaymentObject::__read ( )
private

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

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

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

Referenced by __construct().

+ 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 694 of file class.ilPaymentObject.php.

695 {
696 global $ilDB;
697
698 $res = $ilDB->queryF('SELECT * FROM payment_objects WHERE
699 ref_id = %s', array('integer'), array($a_ref_id));
700 $subtypes = array();
701 while($row = $ilDB->fetchAssoc($res))
702 {
703 $subtypes[] = $row['subtype'];
704 }
705 return $subtypes;
706 }

References $ilDB, $res, and $row.

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

+ Here is the caller graph for this function:

◆ _getAllObjectsData()

static ilPaymentObject::_getAllObjectsData ( )
static

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

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 }
$_SESSION["AccountId"]

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

Referenced by ilObjPaymentSettingsGUI\objectsObject().

+ Here is the caller graph for this function:

◆ _getContainerObjects()

static ilPaymentObject::_getContainerObjects (   $a_ref_id)
static

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

772 {
773 global $ilDB, $tree;
774
775 $filter = array( "lm", "sahs", "htlm",'file', 'exc', 'tst', 'crs','crsr','rcrs', 'glo');
776 $objects = $tree->getChildsByTypeFilter($a_ref_id, $filter);
777
778 $counter = 0;
779 $obj_res = array();
780 foreach($objects as $object)
781 {
782 if(self::_isBuyable($object['ref_id']))
783 {
784 $res = $ilDB->queryF('SELECT * FROM payment_objects
785 WHERE ref_id = %s AND status = %s
786 ORDER BY pt_topic_fk',
787 array('integer', 'integer'), array($object['ref_id'],1));
788
789 while($row = $ilDB->fetchAssoc($res))
790 {
791 $obj_res[$counter] = $row;
792 #$obj_res[$counter]['ref_id'] = $object['ref_id'];
793 $obj_res[$counter]['obj_id'] = $object['obj_id'];
794 $obj_res[$counter]['type'] = $object['type'];
795 $obj_res[$counter]['title'] = $object['title'];
796 $obj_res[$counter]['child'] = $object['child'];
797 $obj_res[$counter]['description'] = $object['description'];
798 }
799 }
800
801 $counter++;
802 }
803 return $obj_res;
804 }

References $ilDB, $res, and $row.

Referenced by ilShopGUI\showContainerContent().

+ Here is the caller graph for this function:

◆ _getCountObjectsByPayMethod()

static ilPaymentObject::_getCountObjectsByPayMethod (   $a_id)
static

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

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 }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11

References $ilDB, $result, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilObjPaymentSettingsGUI\savePayMethodsObject().

+ Here is the caller graph for this function:

◆ _getObjectData()

static ilPaymentObject::_getObjectData (   $a_id)
static

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

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 }

References $ilDB, and $res.

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

+ 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.

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)

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

+ Here is the call graph for this function:

◆ _getSpecialObjects()

static ilPaymentObject::_getSpecialObjects ( )
static

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

725 {
726 global $ilDB;
727
728 $res = $ilDB->queryF('SELECT * FROM payment_objects
729 WHERE is_special = %s AND status = %s
730 ORDER BY pt_topic_fk',
731 array('integer', 'integer'), array(1,1));
732
733 $obj = array();
734 while($row = $ilDB->fetchAssoc($res))
735 {
736 $obj[] = $row;
737 }
738 return $obj;
739 }

References $ilDB, $res, and $row.

Referenced by ilShopGUI\showSpecialContent().

+ Here is the caller graph for this function:

◆ _getTopicsObjects()

static ilPaymentObject::_getTopicsObjects (   $topic_id = NULL)
static
Parameters
null | integer$topic_id
Returns
array

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

746 {
747 global $ilDB;
748
749 if($topic_id === NULL)
750 {
751 $res = $ilDB->queryF('
752 SELECT * FROM payment_objects
753 WHERE status = %s
754 ORDER BY pt_topic_fk', array('integer'), array(1));
755 }
756 else
757 {
758 $res = $ilDB->queryF('
759 SELECT * FROM payment_objects
760 WHERE pt_topic_fk = %s AND status = %s',
761 array('integer', 'integer'), array((int)$topic_id, 1));
762 }
763 $obj = array();
764 while($row = $ilDB->fetchAssoc($res))
765 {
766 $obj[] = $row;
767 }
768 return $obj;
769 }

References $ilDB, $res, $row, and $topic_id.

Referenced by ilShopGUI\showTopicsContent().

+ Here is the caller graph for this function:

◆ _hasAccess()

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

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

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

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

Referenced by ilExAssignmentGUI\addFiles(), ilExAssignmentGUI\addSubmission(), ilObjFileListGUI\getCommandFrame(), ilObjFileBasedLMListGUI\getCommandFrame(), ilObjDlBookListGUI\getCommandFrame(), ilObjLearningModuleListGUI\getCommandFrame(), ilObjSAHSLearningModuleListGUI\getCommandFrame(), ilShopResultPresentationGUI\getObjectListItem(), and ilObjLearningModuleListGUI\getProperties().

+ 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 648 of file class.ilPaymentObject.php.

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

References $ilDB, $res, and $row.

Referenced by ilObjectListGUI\insertPayment().

+ Here is the caller graph for this function:

◆ _isBuyable()

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

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

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

References $ilDB, $result, and $row.

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

+ Here is the caller graph for this function:

◆ _isInCart()

static ilPaymentObject::_isInCart (   $a_ref_id)
static

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

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

References $ilDB, $ilUser, $result, and $row.

Referenced by ilObjLearningModuleListGUI\getProperties().

+ Here is the caller graph for this function:

◆ _isNewObject()

static ilPaymentObject::_isNewObject (   $a_ref_id)
static

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

581 {
582 global $ilDB;
583
584 $res = $ilDB->queryF('SELECT * FROM payment_objects WHERE ref_id = %s',
585 array('integer'), array($a_ref_id));
586
587 $rows = $ilDB->numRows($res);
588
589 return $rows ? false : true;
590 }

References $ilDB, and $res.

Referenced by ilPaymentObjectSelector\isNodeClickable().

+ 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.

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
463 // @todo $a_user_id not defined?!?!
464 if(ilPaymentVendors::_isVendor($a_user_id))
465 {
466 $vendors[] = $a_user_id;
467 }
468
469 if(is_array($vendors) && count($vendors))
470 {
471 $query .= ' OR '.$ilDB->in('vendor_id', $vendors, false, 'integer');
472 }
473 }
474 }
475
476 $res = $ilDB->queryf($query, $data_types, $data);
477 $rows = $ilDB->numRows($res);
478
479 return $rows ? true : false;
480
481 }
$data

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

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

+ 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.

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 }

References $ilDB, $res, and $row.

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

+ 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.

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 }

References $ilDB, $result, $row, and DB_FETCHMODE_OBJECT.

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

+ 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 600 of file class.ilPaymentObject.php.

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

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

+ Here is the caller graph for this function:

◆ add()

ilPaymentObject::add ( )

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

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 }

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

+ Here is the call graph for this function:

◆ delete()

ilPaymentObject::delete ( )

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

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.

References getPobjectId().

+ Here is the call graph for this function:

◆ getAllBuyableObjects()

static ilPaymentObject::getAllBuyableObjects ( )
static

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

709 {
710 global $ilDB;
711
712
713 $res = $ilDB->queryF('SELECT ref_id FROM payment_objects WHERE status = %s',
714 array('integer'), array(1));
715
716 $obj = array();
717 while($row = $ilDB->fetchAssoc($res))
718 {
719 $obj[] = $row['ref_id'];
720 }
721 return $obj;
722 }

References $ilDB, $res, and $row.

◆ getPayMethod()

ilPaymentObject::getPayMethod ( )

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

References $pay_method.

Referenced by add(), and update().

+ 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().

+ Here is the caller graph for this function:

◆ getRefId()

ilPaymentObject::getRefId ( )

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

72 {
73 return $this->ref_id;
74 }

References $ref_id.

Referenced by add(), and update().

+ Here is the caller graph for this function:

◆ getSpecial()

ilPaymentObject::getSpecial ( )

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

122 {
123 return $this->is_special;
124 }

References $is_special.

Referenced by add(), and update().

+ Here is the caller graph for this function:

◆ getStatus()

ilPaymentObject::getStatus ( )

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

80 {
81 return $this->status;
82 }

References $status.

Referenced by add(), and update().

+ Here is the caller graph for this function:

◆ getSubtype()

ilPaymentObject::getSubtype ( )

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

114 {
115 return $this->subtype;
116 }

References $subtype.

Referenced by add(), and update().

+ Here is the caller graph for this function:

◆ getTopicId()

ilPaymentObject::getTopicId ( )

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

56 {
57 return $this->topic_id;
58 }

References $topic_id.

Referenced by add(), and update().

+ 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.

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 }
static _formatFloat($a_float, $a_num_decimals=2)
Formats a float value for gui output.
Class ilShopVats.

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

+ Here is the call graph for this function:

◆ getVatId()

ilPaymentObject::getVatId ( )

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

100 {
101 return $this->vat_id;
102 }

References $vat_id.

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

+ 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().

+ Here is the caller graph for this function:

◆ setPayMethod()

ilPaymentObject::setPayMethod (   $a_method)

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

84 {
85 $this->pay_method = $a_method;
86 }

Referenced by __read().

+ Here is the caller graph for this function:

◆ setRefId()

ilPaymentObject::setRefId (   $a_ref_id)

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

68 {
69 $this->ref_id = $a_ref_id;
70 }

Referenced by __read().

+ Here is the caller graph for this function:

◆ setSpecial()

ilPaymentObject::setSpecial (   $a_special)

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

118 {
119 $this->is_special = $a_special;
120 }

Referenced by __read().

+ Here is the caller graph for this function:

◆ setStatus()

ilPaymentObject::setStatus (   $a_status)

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

76 {
77 $this->status = $a_status;
78 }

Referenced by __read().

+ Here is the caller graph for this function:

◆ setSubtype()

ilPaymentObject::setSubtype (   $a_subtype)

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

109 {
110 $this->subtype = $a_subtype;
111 }

Referenced by __read().

+ Here is the caller graph for this function:

◆ setTopicId()

ilPaymentObject::setTopicId (   $a_topic_id)

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

60 {
61 $this->topic_id = $a_topic_id;
62 }

Referenced by __read().

+ Here is the caller graph for this function:

◆ setVatId()

ilPaymentObject::setVatId (   $a_vat_id)

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

104 {
105 $this->vat_id = $a_vat_id;
106 }

Referenced by __read().

+ Here is the caller graph for this function:

◆ setVendorId()

ilPaymentObject::setVendorId (   $a_vendor_id)

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

92 {
93 $this->vendor_id = $a_vendor_id;
94 }

Referenced by __read().

+ Here is the caller graph for this function:

◆ update()

ilPaymentObject::update ( )

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

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 }

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

+ 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 _getTopicsObjects(), and 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: