Public Member Functions | Data Fields

ilPaymentObject Class Reference

Public Member Functions

 ilPaymentObject (&$user_obj, $a_pobject_id=null)
 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)
 _getAllObjectsData ()
 _getObjectsData ($a_user_id)
 _getObjectData ($a_id)
 _isPurchasable ($a_ref_id, $a_vendor_id=0)
 _hasAccess ($a_ref_id)
 _getActivation ($a_ref_id)
 _isBuyable ($a_ref_id)
 _isInCart ($a_ref_id)
 __read ()

Data Fields

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

Detailed Description

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


Member Function Documentation

ilPaymentObject::__read (  ) 

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

References $query, $res, $row, getPobjectId(), setPayMethod(), setRefId(), setStatus(), and setVendorId().

Referenced by ilPaymentObject().

        {
                if($this->getPobjectId())
                {
                        $query = "SELECT * FROM payment_objects ".
                                "WHERE pobject_id = '".$this->getPobjectId()."'";

                        $res = $this->db->query($query);
                        while($row =& $res->fetchRow(DB_FETCHMODE_OBJECT))
                        {
                                $this->setRefId($row->ref_id);
                                $this->setStatus($row->status);
                                $this->setPayMethod($row->pay_method);
                                $this->setVendorId($row->vendor_id);
                                
                                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 315 of file class.ilPaymentObject.php.

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

Referenced by ilCourseContentInterface::cci_view().

        {
                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);
        }

Here is the caller graph for this function:

ilPaymentObject::_getAllObjectsData (  ) 

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

        {
                ;
        }

ilPaymentObject::_getCountObjectsByPayMethod ( a_type  ) 

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

References $query, $res, and $row.

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;
                }
                
                $query = 'SELECT count(pay_method) as pm FROM payment_objects '.
                        "WHERE pay_method = '".$pm."'";

                $res = $ilDB->query($query);

                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        return $row->pm;
                }
                return 0;
        }

Here is the caller graph for this function:

ilPaymentObject::_getObjectData ( a_id  ) 

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

References $query, and $res.

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

References $query, $res, $row, ilPaymentTrustees::_getVendorsForObjects(), and ilPaymentVendors::_isVendor().

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 = ilPaymentTrustees::_getVendorsForObjects($a_user_id);

                if(ilPaymentVendors::_isVendor($a_user_id))
                {
                        $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;
                }
                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 289 of file class.ilPaymentObject.php.

References $query, $rbacsystem, $res, $row, and ilPaymentBookings::_hasAccess().

Referenced by ilSearch::_checkParentConditions(), ilObjCourseGUI::executeCommand(), ilSAHSPresentationGUI::executeCommand(), ilLMPresentationGUI::executeCommand(), ilObjSAHSLearningModuleListGUI::getCommandFrame(), ilObjLearningModuleListGUI::getCommandFrame(), ilObjFileBasedLMListGUI::getCommandFrame(), ilObjDlBookListGUI::getCommandFrame(), ilObjLearningModuleListGUI::getProperties(), and ilObjectListGUI::insertPayment().

        {
                include_once './payment/classes/class.ilPaymentBookings.php';

                global $rbacsystem,$ilDB;

                // check write access
                if($rbacsystem->checkAccess('write',$a_ref_id))
                {
                        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:

ilPaymentObject::_isBuyable ( a_ref_id  ) 

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

References $query, $res, and $row.

Referenced by ilCourseContentInterface::cci_view(), ilObjectGUI::confirmedDeleteObject(), ilObjSAHSLearningModuleListGUI::getCommandFrame(), ilObjLearningModuleListGUI::getCommandFrame(), ilObjFileBasedLMListGUI::getCommandFrame(), ilObjDlBookListGUI::getCommandFrame(), ilObjLearningModuleListGUI::getProperties(), and ilObjectListGUI::insertPayment().

        {
                global $ilDB;

                $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))
                {
                        return true;
                }
                return false;
        }

Here is the caller graph for this function:

ilPaymentObject::_isInCart ( a_ref_id  ) 

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

References $query, $res, and $row.

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

        {
                global $ilDB, $ilUser;

                $query = "SELECT psc_id FROM payment_objects AS po, payment_shopping_cart AS psc ".
                        "WHERE ref_id = '".$a_ref_id."' ".
                        "AND customer_id = '".$ilUser->getId()."' ".
                        "AND po.pobject_id = psc.pobject_id";

                $res = $ilDB->query($query);
                while($row = $res->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 
)

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

References $query, and $res.

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."' ";
                }
                #"AND status = '1' OR status = '3' ";
                
                $res = $ilDB->query($query);

                return $res->numRows() ? false : true;
        }

Here is the caller graph for this function:

ilPaymentObject::_lookupPobjectId ( a_ref_id  ) 

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

References $query, $res, and $row.

Referenced by ilPaymentPurchaseGUI::__initPaymentObject(), ilPaymentStatisticGUI::addCustomer(), ilObjPaymentSettingsGUI::addCustomerObject(), 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:

ilPaymentObject::add (  ) 

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

References $query, $res, $row, getPayMethod(), getRefId(), getStatus(), and getVendorId().

        {
                $query = "INSERT INTO payment_objects ".
                        "VALUES('','".
                        $this->getRefId()."','".
                        $this->getStatus()."',' ".
                        $this->getPayMethod()."',' ".
                        $this->getVendorId()."')";

                $this->db->query($query);

                $query = "SELECT LAST_INSERT_ID() as new_id";

                $res = $this->db->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        return $row->new_id;
                }
                return false;
        }

Here is the call graph for this function:

ilPaymentObject::delete (  ) 

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

References $query, and getPobjectId().

        {
                if($this->getPobjectId())
                {
                        $query = "DELETE FROM payment_objects ".
                                "WHERE pobject_id = '".$this->getPobjectId()."'";
                        
                        $this->db->query($query);
                        
                        return true;
                }
                return false;
        }

Here is the call graph for this function:

ilPaymentObject::getPayMethod (  ) 

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

Referenced by add().

        {
                return $this->pay_method;
        }

Here is the caller graph for this function:

ilPaymentObject::getPobjectId (  ) 

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

Referenced by __read(), and delete().

        {
                return $this->pobject_id;
        }

Here is the caller graph for this function:

ilPaymentObject::getRefId (  ) 

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

Referenced by add().

        {
                return $this->ref_id;
        }

Here is the caller graph for this function:

ilPaymentObject::getStatus (  ) 

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

Referenced by add().

        {
                return $this->status;
        }

Here is the caller graph for this function:

ilPaymentObject::getVendorId (  ) 

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

Referenced by add().

        {
                return $this->vendor_id;
        }

Here is the caller graph for this function:

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

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

References $user_obj, and __read().

        {
                global $ilDB;

                $this->db =& $ilDB;
                $this->user_obj =& $user_obj;

                $this->STATUS_NOT_BUYABLE = 0;
                $this->STATUS_BUYABLE = 1;
                $this->STATUS_EXPIRES = 2;

                $this->PAY_METHOD_NOT_SPECIFIED = PAY_METHOD_NOT_SPECIFIED;
                $this->PAY_METHOD_BILL = PAY_METHOD_BILL;
                $this->PAY_METHOD_BMF = PAY_METHOD_BMF;
                $this->PAY_METHOD_PAYPAL = PAY_METHOD_PAYPAL;
                
                $this->pobject_id = $a_pobject_id;
                $this->__read();
        }

Here is the call graph for this function:

ilPaymentObject::setPayMethod ( a_method  ) 

Definition at line 91 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 75 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 83 of file class.ilPaymentObject.php.

Referenced by __read().

        {
                $this->status = $a_status;
        }

Here is the caller graph for this function:

ilPaymentObject::setVendorId ( a_vendor_id  ) 

Definition at line 99 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 145 of file class.ilPaymentObject.php.

References $query.

        {
                $query = "UPDATE payment_objects ".
                        "SET ref_id = '".$this->getRefId()."', ".
                        "status = '".$this->getStatus()."', ".
                        "pay_method = '".$this->getPayMethod()."', ".
                        "vendor_id = '".$this->getVendorId()."' ".
                        "WHERE pobject_id = '".$this->getPobjectId()."'";

                $this->db->query($query);

                return true;
        }


Field Documentation

ilPaymentObject::$db = null

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

ilPaymentObject::$pay_method = null

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

ilPaymentObject::$pobject_id = null

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

ilPaymentObject::$ref_id = null

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

ilPaymentObject::$status = null

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

ilPaymentObject::$user_obj = null

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

Referenced by ilPaymentObject().

ilPaymentObject::$vendor_id = null

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


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