ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilPaymentCoupons Class Reference
+ Collaboration diagram for ilPaymentCoupons:

Public Member Functions

 __construct ($user_obj, $a_vendor_view=false)
 getCoupons ()
 setId ($a_id)
 getId ()
 setCouponUser ($a_user_id)
 getCouponUser ()
 setTitle ($a_title)
 getTitle ()
 setDescription ($a_description)
 getDescription ()
 setType ($a_type)
 getType ()
 setValue ($a_value)
 getValue ()
 setFromDate ($a_from)
 getFromDate ()
 setTillDate ($a_till)
 getTillDate ()
 setFromDateEnabled ($a_from_date_enabled=0)
 getFromDateEnabled ()
 setTillDateEnabled ($a_till_date_enabled=0)
 getTillDateEnabled ()
 setChangeDate ($a_date)
 getChangeDate ()
 setUses ($a_uses)
 getUses ()
 setSearchTitleType ($a_title_type)
 getSearchTitleType ()
 setSearchTitleValue ($a_title_value)
 getSearchTitleValue ()
 setSearchType ($a_type)
 getSearchType ()
 setSearchFromDay ($a_day)
 getSearchFromDay ()
 setSearchFromMonth ($a_month)
 getSearchFromMonth ()
 setSearchFromYear ($a_year)
 getSearchFromYear ()
 setSearchTillDay ($a_day)
 getSearchTillDay ()
 setSearchTillMonth ($a_month)
 getSearchTillMonth ()
 setSearchTillYear ($a_year)
 getSearchTillYear ()
 setSearchFromDateEnabled ($a_from_enabled)
 getSearchFromDateEnabled ()
 setSearchTillDateEnabled ($a_till_enabled)
 getSearchTillDateEnabled ()
 setCurrentCoupon ($coupon=array())
 getCurrentCoupon ()
 add ()
 update ()
 delete ()
 getCouponById ($a_coupon_id)
 getCouponBonus ($a_item_price)
 getObjectsByCouponId ($a_coupon_id)
 getCodesByCouponId ($a_coupon_id)
 getUsedCouponsByCouponId ($a_coupon_id)
 getCouponByCode ($a_coupon_code)
 checkCouponValidity ()
 deleteCode ($a_code_id)
 deleteAllCodesByCouponId ($a_coupon_id)
 getCode ($a_code_id)
 addCode ($a_code, $a_coupon_id)
 addCouponForBookingId ($a_booking_id)
 addTracking ()
 isObjectAssignedToCoupon ($a_ref_id)
 Checks if an object is assigned to the current coupon.
 assignObjectToCoupon ($a_ref_id)
 Assigns an object to the current coupon.
 unassignObjectFromCoupon ($a_ref_id)
 Unassigns an object from the current coupon.
 deleteCouponByCouponId ($a_pc_pk)
 deletes all coupon relevant data and tracking

Static Public Member Functions

static _lookupTitle ($a_coupon_id)

Private Member Functions

 getVendorIds ()

Private Attributes

 $db = null
 $user_obj = null
 $vendor_view = false
 $coupons = array()
 $current_coupon = array()
 $codes = array()
 $used_codes = array()
 $objects = array()
 $id = null
 $coupon_user = null
 $title = null
 $description = null
 $type = null
 $value = null
 $from = null
 $till = null
 $from_date_enabled = null
 $till_date_enabled = null
 $change_date = null
 $uses = null
 $search_title_type = null
 $search_title_value = null
 $search_type = null
 $search_from_day = null
 $search_from_month = null
 $search_from_year = null
 $search_till_day = null
 $search_till_month = null
 $search_till_year = null
 $search_from_enabled = null
 $search_till_enabled = null

Detailed Description

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

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

Constructor & Destructor Documentation

ilPaymentCoupons::__construct (   $user_obj,
  $a_vendor_view = false 
)

Definition at line 53 of file class.ilPaymentCoupons.php.

References $ilDB, and $user_obj.

{
global $ilDB;
$this->db = $ilDB;
$this->vendor_view = $a_vendor_view;
$this->user_obj = $user_obj;
$this->COUPON_VALID = 0;
$this->COUPON_OUT_OF_DATE = 1;
$this->COUPON_TOO_MUCH_USED = 2;
$this->COUPON_NOT_FOUND = 3;
}

Member Function Documentation

static ilPaymentCoupons::_lookupTitle (   $a_coupon_id)
static

Definition at line 940 of file class.ilPaymentCoupons.php.

References $ilDB, $res, and $row.

Referenced by ilPaymentCouponGUI\deleteCoupon().

{
global $ilDB;
$res = $ilDB->queryF('SELECT pc_title FROM payment_coupons WHERE pc_pk = %s',
array('integer'), array($a_coupon_id));
$row = $ilDB->fetchAssoc($res);
return $row['pc_title'];
}

+ Here is the caller graph for this function:

ilPaymentCoupons::add ( )

Definition at line 421 of file class.ilPaymentCoupons.php.

References getChangeDate(), getCouponUser(), getDescription(), getFromDate(), getFromDateEnabled(), getTillDate(), getTillDateEnabled(), getTitle(), getType(), getUses(), and getValue().

{
$next_id = $this->db->nextId('payment_coupons');
$statement = $this->db->manipulateF('
INSERT INTO payment_coupons
( pc_pk,
usr_id,
pc_title,
pc_description,
pc_type,
pc_value,
pc_from,
pc_till,
pc_from_enabled,
pc_till_enabled,
pc_uses,
pc_last_change_usr_id,
pc_last_changed
)
VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)',
array( 'integer',
'integer',
'text',
'text',
'text',
'float',
'date',
'date',
'integer',
'integer',
'integer',
'integer',
'timestamp'),
array( $next_id,
$this->getCouponUser(),
$this->getTitle(),
$this->getDescription(),
$this->getType(),
$this->getValue(),
$this->getFromDate(),
$this->getTillDate(),
$this->getUses(),
$this->getCouponUser(),
$this->getChangeDate() )
);
return $next_id;
}

+ Here is the call graph for this function:

ilPaymentCoupons::addCode (   $a_code,
  $a_coupon_id 
)

Definition at line 765 of file class.ilPaymentCoupons.php.

{
if ($a_code && $a_coupon_id)
{
$next_id = $this->db->nextId('payment_coupons_codes');
$statement = $this->db->manipulateF('
INSERT INTO payment_coupons_codes
( pcc_pk,
pcc_pc_fk,
pcc_code
)
VALUES (%s,%s,%s)',
array('integer','integer', 'text'),
array($next_id, $a_coupon_id, $a_code));
return $next_id;
}
return false;
}
ilPaymentCoupons::addCouponForBookingId (   $a_booking_id)

Definition at line 785 of file class.ilPaymentCoupons.php.

References $current_coupon, and getCurrentCoupon().

{
if ($a_booking_id && is_array($current_coupon))
{
$statement = $this->db->manipulateF('
INSERT INTO payment_statistic_coup
( psc_ps_fk,
psc_pc_fk,
psc_pcc_fk
) VALUES(%s,%s,%s)',
array('integer', 'integer', 'integer'),
array($a_booking_id, $current_coupon['pc_pk'], $current_coupon['pcc_pk']));
}
return false;
}

+ Here is the call graph for this function:

ilPaymentCoupons::addTracking ( )

Definition at line 803 of file class.ilPaymentCoupons.php.

References $current_coupon, and getCurrentCoupon().

{
if (is_array($current_coupon))
{
$next_id = $this->db->nextId('payment_coupons_track');
$statement = $this->db->manipulateF('
INSERT INTO payment_coupons_track
( pct_pk,
pct_pcc_fk ,
usr_id,
pct_date
)
VALUES (%s, %s, %s, %s)',
array('integer','integer', 'integer', 'timestamp'),
array($next_id, $current_coupon['pcc_pk'], $this->user_obj->getId(), date("Y-m-d H:i:s")));
return $next_id;
}
return false;
}

+ Here is the call graph for this function:

ilPaymentCoupons::assignObjectToCoupon (   $a_ref_id)

Assigns an object to the current coupon.

public

Returns
bool

Definition at line 856 of file class.ilPaymentCoupons.php.

References getId().

{
if ($a_ref_id && is_numeric($this->getId()))
{
$statement = $this->db->manipulateF('
INSERT INTO payment_coupons_obj
( pco_pc_fk,
ref_id
) VALUES(%s, %s)',
array('integer', 'integer'),
array($this->getId(), $a_ref_id));
return true;
}
return false;
}

+ Here is the call graph for this function:

ilPaymentCoupons::checkCouponValidity ( )

Definition at line 672 of file class.ilPaymentCoupons.php.

References $res, $row, and getCurrentCoupon().

{
$coupon = $this->getCurrentCoupon();
if (empty($coupon)) return $this->COUPON_NOT_FOUND;
$current_date = date("Y-m-d");
if ($coupon["pc_from"] != "0000-00-00" && $coupon["pc_from_enabled"] == '1' &&
$coupon["pc_till"] != "0000-00-00" && $coupon["pc_till_enabled"] == '1'
)
{
if (! ($coupon["pc_from"] <= $current_date && $current_date <= $coupon["pc_till"]))
{
return $this->COUPON_OUT_OF_DATE;
}
}
else if ($coupon["pc_from"] != "0000-00-00" && $coupon["pc_from_enabled"] == '1')
{
if ($coupon["pc_from"] > $current_date)
{
return $this->COUPON_OUT_OF_DATE;
}
}
else if ($coupon["pc_till"] != "0000-00-00" && $coupon["pc_till_enabled"] == '1')
{
if ($coupon["pc_till"] < $current_date)
{
return $this->COUPON_OUT_OF_DATE;
}
}
if (is_numeric($coupon["pc_uses"]) && $coupon["pc_uses"] > 0)
{
$res = $this->db->queryf('
SELECT COUNT(*) used_coupons
FROM payment_coupons_track
WHERE pct_pcc_fk = %s',
array('integer'),
array($coupon['pcc_pk']));
$row = $this->db->fetchObject($res);
if ($row->used_coupons >= $coupon["pc_uses"]) return $this->COUPON_TOO_MUCH_USED;
}
return $this->COUPON_VALID;
}

+ Here is the call graph for this function:

ilPaymentCoupons::delete ( )

Definition at line 522 of file class.ilPaymentCoupons.php.

References getId().

{
if ($this->getId())
{
$statement = $this->db->manipulateF('
DELETE FROM payment_coupons WHERE pc_pk = %s',
array('integer'),
array($this->getId()));
return true;
}
return false;
}

+ Here is the call graph for this function:

ilPaymentCoupons::deleteAllCodesByCouponId (   $a_coupon_id)

Definition at line 733 of file class.ilPaymentCoupons.php.

{
if ($a_coupon_id)
{
$statement = $this->db->manipulateF('
DELETE FROM payment_coupons_codes WHERE pcc_pc_fk = %s',
array('integer'),array($a_coupon_id));
return true;
}
return false;
}
ilPaymentCoupons::deleteCode (   $a_code_id)

Definition at line 720 of file class.ilPaymentCoupons.php.

{
if ($a_code_id)
{
$statement = $this->db->manipulateF('
DELETE FROM payment_coupons_codes WHERE pcc_pk = %s',
array('integer'), array($a_code_id));
return true;
}
return false;
}
ilPaymentCoupons::deleteCouponByCouponId (   $a_pc_pk)

deletes all coupon relevant data and tracking

Parameters
integer$a_pc_pk

Definition at line 899 of file class.ilPaymentCoupons.php.

References $ilDB, $res, and $row.

{
global $ilDB;
$res = $ilDB->queryF('
SELECT pcc_pk
FROM payment_coupons_codes
WHERE pcc_pc_fk = %s',
array('integer'),array($a_pc_pk));
$code_ids = array();
while($row = $ilDB->fetchAssoc($res))
{
$code_ids[] = $row['pcc_pk'];
}
$ilDB->manipulate('
DELETE FROM payment_coupons_track
WHERE '. $ilDB->in('pct_pcc_fk', $code_ids, false, 'integer'));
$ilDB->manipulate('
DELETE FROM payment_statistic_coup
WHERE '.$ilDB->in('psc_pcc_fk', $code_ids, false, 'integer'));
$ilDB->manipulateF('
DELETE FROM payment_coupons
WHERE pc_pk = %s',
array('integer'),array($a_pc_pk));
$ilDB->manipulateF('
DELETE FROM payment_coupons_obj
WHERE pco_pc_fk = %s',
array('integer'),array($a_pc_pk));
$ilDB->manipulateF('
DELETE FROM payment_coupons_codes
WHERE pcc_pk = %s',
array('integer'),array($a_pc_pk));
}
ilPaymentCoupons::getChangeDate ( )

Definition at line 308 of file class.ilPaymentCoupons.php.

References $change_date.

Referenced by add(), and update().

{
}

+ Here is the caller graph for this function:

ilPaymentCoupons::getCode (   $a_code_id)

Definition at line 746 of file class.ilPaymentCoupons.php.

References $res, and $row.

{
$res = $this->db->queryf('
SELECT * FROM payment_coupons_codes
WHERE pcc_pk = %s',
array('integer'),
array($a_code_id));
$code = array();
while($row = $this->db->fetchObject($res))
{
$code['pcc_pk'] = $row->pcc_pk;
$code['pcc_pc_fk'] = $row->pcc_pc_fk;
$code['pcc_code'] = $row->pcc_code;
}
return $code ? $code : array();
}
ilPaymentCoupons::getCodesByCouponId (   $a_coupon_id)

Definition at line 593 of file class.ilPaymentCoupons.php.

References $codes, $res, and $row.

Referenced by getCoupons().

{
$this->codes = array();
$res = $this->db->queryf('
SELECT payment_coupons_codes.*, COUNT(pct_pcc_fk) pcc_used, pcc_pk
FROM payment_coupons_codes
LEFT JOIN payment_coupons_track ON pct_pcc_fk = pcc_pk
WHERE pcc_pc_fk = %s
GROUP BY pcc_pk, payment_coupons_codes.pcc_pc_fk ,pcc_code',
array('integer'),
array($a_coupon_id));
while($row = $this->db->fetchObject($res))
{
$this->codes[$row->pcc_pk]['pcc_pk'] = $row->pcc_pk;
$this->codes[$row->pcc_pk]['pcc_code'] = $row->pcc_code;
$this->codes[$row->pcc_pk]['pcc_used'] = $row->pcc_used;
}
return $this->codes;
}

+ Here is the caller graph for this function:

ilPaymentCoupons::getCouponBonus (   $a_item_price)

Definition at line 559 of file class.ilPaymentCoupons.php.

References getCurrentCoupon().

{
if (is_array($coupon = $this->getCurrentCoupon()))
{
switch ($coupon["pc_type"])
{
case "fix":
return (float) $coupon["pc_value"];
case "percent":
return (float) $a_item_price * ($coupon["pc_value"] / 100);
}
}
return 0;
}

+ Here is the call graph for this function:

ilPaymentCoupons::getCouponByCode (   $a_coupon_code)

Definition at line 639 of file class.ilPaymentCoupons.php.

References $res, $row, getObjectsByCouponId(), setCurrentCoupon(), and setId().

{
$res = $this->db->queryf('
SELECT * FROM payment_coupons_codes
INNER JOIN payment_coupons ON pc_pk = pcc_pc_fk
WHERE pcc_code = %s',
array('text'),
array($a_coupon_code));
$coupon = array();
if (is_object($row = $this->db->fetchObject($res)))
{
$coupon['pc_pk'] = $row->pc_pk;
$coupon['pc_title'] = $row->pc_title;
$coupon['pc_description'] = $row->pc_description;
$coupon['pc_type'] = $row->pc_type;
$coupon['pc_value'] = $row->pc_value;
$coupon['pc_type'] = $row->pc_type;
$coupon['pc_from'] = $row->pc_from;
$coupon['pc_till'] = $row->pc_till;
$coupon['pc_uses'] = $row->pc_uses;
$coupon['pcc_pk'] = $row->pcc_pk;
$coupon['pcc_code'] = $row->pcc_code;
$coupon['objects'] = $this->getObjectsByCouponId($row->pc_pk);
}
$this->setId($coupon['pc_pk']);
$this->setCurrentCoupon($coupon);
return $coupon ? $coupon : array();
}

+ Here is the call graph for this function:

ilPaymentCoupons::getCouponById (   $a_coupon_id)

Definition at line 536 of file class.ilPaymentCoupons.php.

References $res, $row, setChangeDate(), setCouponUser(), setDescription(), setFromDate(), setFromDateEnabled(), setId(), setTillDate(), setTillDateEnabled(), setTitle(), setType(), setUses(), and setValue().

{
$res = $this->db->queryf('
SELECT * FROM payment_coupons
WHERE pc_pk = %s', array('integer'), array($a_coupon_id));
while($row = $this->db->fetchObject($res))
{
$this->setId($row->pc_pk);
$this->setCouponUser($row->usr_id);
$this->setTitle($row->pc_title);
$this->setDescription($row->pc_description);
$this->setType($row->pc_type);
$this->setValue($row->pc_value);
$this->setFromDate($row->pc_from);
$this->setTillDate($row->pc_till);
$this->setFromDateEnabled($row->pc_from_enabled);
$this->setTillDateEnabled($row->pc_till_enabled);
$this->setUses($row->pc_uses);
$this->setChangeDate(date("Y-m-h H:i:s"));
}
}

+ Here is the call graph for this function:

ilPaymentCoupons::getCoupons ( )

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

References $_SESSION, $coupons, $from, $in, $query, $res, $row, getCodesByCouponId(), getObjectsByCouponId(), getSearchTitleType(), getSearchTitleValue(), getSearchType(), getUsedCouponsByCouponId(), and getVendorIds().

{
$this->coupons = array();
$data = array();
$data_types = array();
$query = 'SELECT * FROM payment_coupons WHERE 1 = 1 ';
if ($_SESSION['pay_coupons']['from']['date']['d'] != '' &&
$_SESSION['pay_coupons']['from']['date']['m'] != '' &&
$_SESSION['pay_coupons']['from']['date']['y'] != '')
{
$from = date('Y-m-d',mktime(0, 0, 0, $_SESSION['pay_coupons']['from']['date']['m'],
$_SESSION['pay_coupons']['from']['date']['d'],
$_SESSION['pay_coupons']['from']['date']['y']));
$query .= 'AND pc_from >= %s ';
$data_types[] = 'date';
$data[] = $from;
}
if ($_SESSION['pay_coupons']['til']['date']['d'] != '' &&
$_SESSION['pay_coupons']['til']['date']['m'] != '' &&
$_SESSION['pay_coupons']['til']['date']['y'] != '')
{
$til = date('Y-m-d',mktime(23, 59, 59, $_SESSION['pay_coupons']['til']['date']['m'],
$_SESSION['pay_coupons']['til']['date']['d'],
$_SESSION['pay_coupons']['til']['date']['y']));
$query .= 'AND pc_till <= %s ';
$data_types[] = 'date';
$data[] = $til;
}
if ($this->getSearchTitleValue() != "")
{
if ($this->getSearchTitleType() == 0)
{
$query .= " AND pc_title LIKE %s ";
array_push($data, $this->getSearchTitleValue().'%');
array_push($data_types, 'text');
}
else if ($this->getSearchTitleType() == 1)
{
$query .= " AND pc_title LIKE %s ";
array_push($data, '%'.$this->getSearchTitleValue());
array_push($data_types,'text');
}
}
if ($this->getSearchType() != "")
{
$query .= ' AND pc_type = %s';
array_push($data, $this->getSearchType());
array_push($data_types, 'text');
}
$vendors = $this->getVendorIds();
if (is_array($vendors) &&
count($vendors) > 0)
{
$in = 'usr_id IN (';
$counter = 0;
foreach($vendors as $vendor)
{
array_push($data, $vendor);
array_push($data_types, 'integer');
if($counter > 0) $in .= ',';
$in .= '%s';
++$counter;
}
$in .= ')';
$query .= ' AND '.$in;
}
$cnt_data = count($data);
$cnt_data_types = count($data_types);
if($cnt_data == 0 && $cnt_data_types == 0)
{
$res = $this->db->query($query);
}
else
{
$res= $this->db->queryf($query, $data_types, $data);
}
while($row = $this->db->fetchObject($res))
{
$this->coupons[$row->pc_pk]['pc_pk'] = $row->pc_pk;
$this->coupons[$row->pc_pk]['usr_id'] = $row->usr_id;
$this->coupons[$row->pc_pk]['pc_title'] = $row->pc_title;
$this->coupons[$row->pc_pk]['pc_description'] = $row->pc_description;
$this->coupons[$row->pc_pk]['pc_type'] = $row->pc_type;
$this->coupons[$row->pc_pk]['pc_value'] = $row->pc_value;
$this->coupons[$row->pc_pk]['pc_from'] = $row->pc_from;
$this->coupons[$row->pc_pk]['pc_till'] = $row->pc_till;
$this->coupons[$row->pc_pk]['pc_from_enabled'] = $row->pc_from_enabled;
$this->coupons[$row->pc_pk]['pc_till_enabled'] = $row->pc_till_enabled;
$this->coupons[$row->pc_pk]['pc_uses'] = $row->pc_uses;
$this->coupons[$row->pc_pk]['pc_last_change_usr_id'] = $row->pc_last_change_usr_id;
$this->coupons[$row->pc_pk]['pc_last_changed'] = $row->pc_last_changed;
$this->coupons[$row->pc_pk]['number_of_codes'] = count($this->getCodesByCouponId($row->pc_pk));
$this->coupons[$row->pc_pk]['usage_of_codes'] = count($this->getUsedCouponsByCouponId($row->pc_pk));
$this->coupons[$row->pc_pk]['objects'] = $this->getObjectsByCouponId($row->pc_pk);
}
}

+ Here is the call graph for this function:

ilPaymentCoupons::getCouponUser ( )

Definition at line 231 of file class.ilPaymentCoupons.php.

References $coupon_user.

Referenced by add(), and update().

{
}

+ Here is the caller graph for this function:

ilPaymentCoupons::getCurrentCoupon ( )

Definition at line 416 of file class.ilPaymentCoupons.php.

References $current_coupon.

Referenced by addCouponForBookingId(), addTracking(), checkCouponValidity(), and getCouponBonus().

{
}

+ Here is the caller graph for this function:

ilPaymentCoupons::getDescription ( )

Definition at line 247 of file class.ilPaymentCoupons.php.

References $description.

Referenced by add(), and update().

{
}

+ Here is the caller graph for this function:

ilPaymentCoupons::getFromDate ( )

Definition at line 271 of file class.ilPaymentCoupons.php.

References $from.

Referenced by add(), and update().

{
return $this->from;
}

+ Here is the caller graph for this function:

ilPaymentCoupons::getFromDateEnabled ( )

Definition at line 288 of file class.ilPaymentCoupons.php.

References $from_date_enabled.

Referenced by add(), and update().

+ Here is the caller graph for this function:

ilPaymentCoupons::getId ( )

Definition at line 223 of file class.ilPaymentCoupons.php.

References $id.

Referenced by assignObjectToCoupon(), delete(), isObjectAssignedToCoupon(), unassignObjectFromCoupon(), and update().

{
return $this->id;
}

+ Here is the caller graph for this function:

ilPaymentCoupons::getObjectsByCouponId (   $a_coupon_id)

Definition at line 575 of file class.ilPaymentCoupons.php.

References $objects, $res, and $row.

Referenced by getCouponByCode(), and getCoupons().

{
$this->objects = array();
$res = $this->db->queryf('
SELECT * FROM payment_coupons_obj
WHERE pco_pc_fk = %s',
array('integer'),
array($a_coupon_id));
while($row = $this->db->fetchObject($res))
{
$this->objects[] = $row->ref_id;
}
return $this->objects;
}

+ Here is the caller graph for this function:

ilPaymentCoupons::getSearchFromDateEnabled ( )

Definition at line 399 of file class.ilPaymentCoupons.php.

References $search_from_enabled.

ilPaymentCoupons::getSearchFromDay ( )

Definition at line 350 of file class.ilPaymentCoupons.php.

References $search_from_day.

ilPaymentCoupons::getSearchFromMonth ( )

Definition at line 359 of file class.ilPaymentCoupons.php.

References $search_from_month.

ilPaymentCoupons::getSearchFromYear ( )

Definition at line 367 of file class.ilPaymentCoupons.php.

References $search_from_year.

ilPaymentCoupons::getSearchTillDateEnabled ( )

Definition at line 407 of file class.ilPaymentCoupons.php.

References $search_till_enabled.

ilPaymentCoupons::getSearchTillDay ( )

Definition at line 375 of file class.ilPaymentCoupons.php.

References $search_till_day.

ilPaymentCoupons::getSearchTillMonth ( )

Definition at line 383 of file class.ilPaymentCoupons.php.

References $search_till_month.

ilPaymentCoupons::getSearchTillYear ( )

Definition at line 391 of file class.ilPaymentCoupons.php.

References $search_till_year.

ilPaymentCoupons::getSearchTitleType ( )

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

References $search_title_type.

Referenced by getCoupons().

+ Here is the caller graph for this function:

ilPaymentCoupons::getSearchTitleValue ( )

Definition at line 334 of file class.ilPaymentCoupons.php.

References $search_title_value.

Referenced by getCoupons().

+ Here is the caller graph for this function:

ilPaymentCoupons::getSearchType ( )

Definition at line 342 of file class.ilPaymentCoupons.php.

References $search_type.

Referenced by getCoupons().

{
}

+ Here is the caller graph for this function:

ilPaymentCoupons::getTillDate ( )

Definition at line 279 of file class.ilPaymentCoupons.php.

References $till.

Referenced by add(), and update().

{
return $this->till;
}

+ Here is the caller graph for this function:

ilPaymentCoupons::getTillDateEnabled ( )

Definition at line 297 of file class.ilPaymentCoupons.php.

References $till_date_enabled.

Referenced by add(), and update().

+ Here is the caller graph for this function:

ilPaymentCoupons::getTitle ( )

Definition at line 239 of file class.ilPaymentCoupons.php.

References $title.

Referenced by add(), and update().

{
return $this->title;
}

+ Here is the caller graph for this function:

ilPaymentCoupons::getType ( )

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

References $type.

Referenced by add(), and update().

{
return $this->type;
}

+ Here is the caller graph for this function:

ilPaymentCoupons::getUsedCouponsByCouponId (   $a_coupon_id)

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

References $res, $row, and $used_codes.

Referenced by getCoupons().

{
$this->used_codes = array();
$res = $this->db->queryf('
SELECT * FROM payment_coupons_track
INNER JOIN payment_coupons_codes ON pcc_pk = pct_pcc_fk
WHERE pcc_pc_fk = %s',
array('integer'),
array($a_coupon_id));
while($row = $this->db->fetchObject($res))
{
$this->used_codes[$row->pct_pk]['pct_pk'] = $row->pct_pk;
$this->used_codes[$row->pct_pk]['pcc_code'] = $row->pcc_code;
$this->used_codes[$row->pct_pk]['usr_id'] = $row->usr_id;
$this->used_codes[$row->pct_pk]['pct_date'] = $row->pct_date;
$this->used_codes[$row->pct_pk]['pct_ps_fk'] = $row->pct_ps_fk;
}
}

+ Here is the caller graph for this function:

ilPaymentCoupons::getUses ( )

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

References $uses.

Referenced by add(), and update().

{
return $this->uses;
}

+ Here is the caller graph for this function:

ilPaymentCoupons::getValue ( )

Definition at line 263 of file class.ilPaymentCoupons.php.

References $value.

Referenced by add(), and update().

{
return $this->value;
}

+ Here is the caller graph for this function:

ilPaymentCoupons::getVendorIds ( )
private

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

References $t, ilPaymentTrustees\_getTrusteesForCouponsByVendorId(), and ilPaymentTrustees\_getVendorsForCouponsByTrusteeId().

Referenced by getCoupons().

{
$vendors[] = $this->user_obj->getId();
if (ilPaymentVendors::_isVendor($this->user_obj->getId()))
{
$ptObj = new ilPaymentTrustees($this->user_obj);
if ($trustees = $ptObj->getTrustees())
{
foreach ($trustees as $trustee)
{
if ((bool) $trustee["perm_coupons"])
{
$vendors[] = $trustee["trustee_id"];
}
}
}
}
if ($vend = ilPaymentTrustees::_getVendorsForCouponsByTrusteeId($this->user_obj->getId()))
{
foreach ($vend as $v)
{
$vendors[] = $v;
{
foreach ($trustees as $t)
{
$vendors[] = $t;
}
}
}
}
return $vendors ? $vendors : array();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPaymentCoupons::isObjectAssignedToCoupon (   $a_ref_id)

Checks if an object is assigned to the current coupon.

public

Returns
bool

Definition at line 832 of file class.ilPaymentCoupons.php.

References $res, and getId().

{
if ($a_ref_id && is_numeric($this->getId()))
{
$res = $this->db->queryf('
SELECT * FROM payment_coupons_obj
WHERE ref_id = %s
AND pco_pc_fk = %s',
array('integer', 'integer'),
array($a_ref_id, $this->getId()));
if ($res->numRows()) return true;
return false;
}
return false;
}

+ Here is the call graph for this function:

ilPaymentCoupons::setChangeDate (   $a_date)

Definition at line 301 of file class.ilPaymentCoupons.php.

Referenced by getCouponById().

{
if($a_date == '0000-00-00 00:00:00')
$this->change_date = NULL;
else
$this->change_date = $a_date;
}

+ Here is the caller graph for this function:

ilPaymentCoupons::setCouponUser (   $a_user_id)

Definition at line 227 of file class.ilPaymentCoupons.php.

Referenced by getCouponById().

{
$this->coupon_user = $a_user_id;
}

+ Here is the caller graph for this function:

ilPaymentCoupons::setCurrentCoupon (   $coupon = array())

Definition at line 412 of file class.ilPaymentCoupons.php.

Referenced by getCouponByCode().

{
$this->current_coupon = $coupon;
}

+ Here is the caller graph for this function:

ilPaymentCoupons::setDescription (   $a_description)

Definition at line 243 of file class.ilPaymentCoupons.php.

Referenced by getCouponById().

{
$this->description = $a_description;
}

+ Here is the caller graph for this function:

ilPaymentCoupons::setFromDate (   $a_from)

Definition at line 267 of file class.ilPaymentCoupons.php.

Referenced by getCouponById().

{
$this->from = $a_from;
}

+ Here is the caller graph for this function:

ilPaymentCoupons::setFromDateEnabled (   $a_from_date_enabled = 0)

Definition at line 283 of file class.ilPaymentCoupons.php.

Referenced by getCouponById().

{
if($a_from_date_enabled == NULL) $a_from_date_enabled = 0;
$this->from_date_enabled = $a_from_date_enabled;
}

+ Here is the caller graph for this function:

ilPaymentCoupons::setId (   $a_id)

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

Referenced by getCouponByCode(), and getCouponById().

{
return $this->id = $a_id;
}

+ Here is the caller graph for this function:

ilPaymentCoupons::setSearchFromDateEnabled (   $a_from_enabled)

Definition at line 395 of file class.ilPaymentCoupons.php.

{
$this->search_from_enabled = $a_from_enabled;
}
ilPaymentCoupons::setSearchFromDay (   $a_day)

Definition at line 346 of file class.ilPaymentCoupons.php.

{
$this->search_from_day = $a_day;
}
ilPaymentCoupons::setSearchFromMonth (   $a_month)

Definition at line 354 of file class.ilPaymentCoupons.php.

{
$this->search_from_month = $a_month;
}
ilPaymentCoupons::setSearchFromYear (   $a_year)

Definition at line 363 of file class.ilPaymentCoupons.php.

{
$this->search_from_year = $a_year;
}
ilPaymentCoupons::setSearchTillDateEnabled (   $a_till_enabled)

Definition at line 403 of file class.ilPaymentCoupons.php.

{
$this->search_till_enabled = $a_till_enabled;
}
ilPaymentCoupons::setSearchTillDay (   $a_day)

Definition at line 371 of file class.ilPaymentCoupons.php.

{
$this->search_till_day = $a_day;
}
ilPaymentCoupons::setSearchTillMonth (   $a_month)

Definition at line 379 of file class.ilPaymentCoupons.php.

{
$this->search_till_month = $a_month;
}
ilPaymentCoupons::setSearchTillYear (   $a_year)

Definition at line 387 of file class.ilPaymentCoupons.php.

{
$this->search_till_year = $a_year;
}
ilPaymentCoupons::setSearchTitleType (   $a_title_type)

Definition at line 322 of file class.ilPaymentCoupons.php.

{
$this->search_title_type = $a_title_type;
}
ilPaymentCoupons::setSearchTitleValue (   $a_title_value)

Definition at line 330 of file class.ilPaymentCoupons.php.

{
$this->search_title_value = $a_title_value;
}
ilPaymentCoupons::setSearchType (   $a_type)

Definition at line 338 of file class.ilPaymentCoupons.php.

{
$this->search_type = $a_type;
}
ilPaymentCoupons::setTillDate (   $a_till)

Definition at line 275 of file class.ilPaymentCoupons.php.

Referenced by getCouponById().

{
$this->till = $a_till;
}

+ Here is the caller graph for this function:

ilPaymentCoupons::setTillDateEnabled (   $a_till_date_enabled = 0)

Definition at line 292 of file class.ilPaymentCoupons.php.

Referenced by getCouponById().

{
if($a_till_date_enabled == NULL) $a_till_date_enabled = 0;
$this->till_date_enabled = $a_till_date_enabled;
}

+ Here is the caller graph for this function:

ilPaymentCoupons::setTitle (   $a_title)

Definition at line 235 of file class.ilPaymentCoupons.php.

Referenced by getCouponById().

{
$this->title = $a_title;
}

+ Here is the caller graph for this function:

ilPaymentCoupons::setType (   $a_type)

Definition at line 251 of file class.ilPaymentCoupons.php.

Referenced by getCouponById().

{
$this->type = $a_type;
}

+ Here is the caller graph for this function:

ilPaymentCoupons::setUses (   $a_uses)

Definition at line 312 of file class.ilPaymentCoupons.php.

Referenced by getCouponById().

{
$this->uses = $a_uses;
}

+ Here is the caller graph for this function:

ilPaymentCoupons::setValue (   $a_value)

Definition at line 259 of file class.ilPaymentCoupons.php.

Referenced by getCouponById().

{
$this->value = $a_value;
}

+ Here is the caller graph for this function:

ilPaymentCoupons::unassignObjectFromCoupon (   $a_ref_id)

Unassigns an object from the current coupon.

public

Returns
bool

Definition at line 879 of file class.ilPaymentCoupons.php.

References getId().

{
if ($a_ref_id && is_numeric($this->getId()))
{
$statement = $this->db->manipulateF('
DELETE FROM payment_coupons_obj
WHERE ref_id = %s
AND pco_pc_fk = %s',
array('integer', 'integer'),
array($a_ref_id, $this->getId()));
return true;
}
return false;
}

+ Here is the call graph for this function:

ilPaymentCoupons::update ( )

Definition at line 473 of file class.ilPaymentCoupons.php.

References getChangeDate(), getCouponUser(), getDescription(), getFromDate(), getFromDateEnabled(), getId(), getTillDate(), getTillDateEnabled(), getTitle(), getType(), getUses(), and getValue().

{
if ($this->getId())
{
$statement = $this->db->manipulateF('
UPDATE payment_coupons
SET pc_title = %s,
pc_description = %s,
pc_type = %s,
pc_value = %s,
pc_from = %s,
pc_till = %s,
pc_from_enabled = %s,
pc_till_enabled = %s,
pc_uses = %s,
pc_last_change_usr_id = %s,
pc_last_changed = %s
WHERE pc_pk = %s',
array( 'text',
'text',
'text',
'float',
'date',
'date',
'integer',
'integer',
'integer',
'integer',
'timestamp',
'integer'),
array( $this->getTitle(),
$this->getDescription(),
$this->getType(),
$this->getValue(),
$this->getFromDate(),
$this->getTillDate(),
$this->getUses(),
$this->getCouponUser(),
$this->getChangeDate(),
$this->getId()
));
return true;
}
return false;
}

+ Here is the call graph for this function:

Field Documentation

ilPaymentCoupons::$change_date = null
private

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

Referenced by getChangeDate().

ilPaymentCoupons::$codes = array()
private

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

Referenced by getCodesByCouponId().

ilPaymentCoupons::$coupon_user = null
private

Definition at line 28 of file class.ilPaymentCoupons.php.

Referenced by getCouponUser().

ilPaymentCoupons::$coupons = array()
private

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

Referenced by getCoupons().

ilPaymentCoupons::$current_coupon = array()
private

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

Referenced by addCouponForBookingId(), addTracking(), and getCurrentCoupon().

ilPaymentCoupons::$db = null
private

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

ilPaymentCoupons::$description = null
private

Definition at line 30 of file class.ilPaymentCoupons.php.

Referenced by getDescription().

ilPaymentCoupons::$from = null
private

Definition at line 33 of file class.ilPaymentCoupons.php.

Referenced by getCoupons(), and getFromDate().

ilPaymentCoupons::$from_date_enabled = null
private

Definition at line 35 of file class.ilPaymentCoupons.php.

Referenced by getFromDateEnabled().

ilPaymentCoupons::$id = null
private

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

Referenced by getId().

ilPaymentCoupons::$objects = array()
private

Definition at line 25 of file class.ilPaymentCoupons.php.

Referenced by getObjectsByCouponId().

ilPaymentCoupons::$search_from_day = null
private

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

Referenced by getSearchFromDay().

ilPaymentCoupons::$search_from_enabled = null
private

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

Referenced by getSearchFromDateEnabled().

ilPaymentCoupons::$search_from_month = null
private

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

Referenced by getSearchFromMonth().

ilPaymentCoupons::$search_from_year = null
private

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

Referenced by getSearchFromYear().

ilPaymentCoupons::$search_till_day = null
private

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

Referenced by getSearchTillDay().

ilPaymentCoupons::$search_till_enabled = null
private

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

Referenced by getSearchTillDateEnabled().

ilPaymentCoupons::$search_till_month = null
private

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

Referenced by getSearchTillMonth().

ilPaymentCoupons::$search_till_year = null
private

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

Referenced by getSearchTillYear().

ilPaymentCoupons::$search_title_type = null
private

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

Referenced by getSearchTitleType().

ilPaymentCoupons::$search_title_value = null
private

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

Referenced by getSearchTitleValue().

ilPaymentCoupons::$search_type = null
private

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

Referenced by getSearchType().

ilPaymentCoupons::$till = null
private

Definition at line 34 of file class.ilPaymentCoupons.php.

Referenced by getTillDate().

ilPaymentCoupons::$till_date_enabled = null
private

Definition at line 36 of file class.ilPaymentCoupons.php.

Referenced by getTillDateEnabled().

ilPaymentCoupons::$title = null
private

Definition at line 29 of file class.ilPaymentCoupons.php.

Referenced by getTitle().

ilPaymentCoupons::$type = null
private

Definition at line 31 of file class.ilPaymentCoupons.php.

Referenced by getType().

ilPaymentCoupons::$used_codes = array()
private

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

Referenced by getUsedCouponsByCouponId().

ilPaymentCoupons::$user_obj = null
private

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

Referenced by __construct().

ilPaymentCoupons::$uses = null
private

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

Referenced by getUses().

ilPaymentCoupons::$value = null
private

Definition at line 32 of file class.ilPaymentCoupons.php.

Referenced by getValue().

ilPaymentCoupons::$vendor_view = false
private

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


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