private function forwardToDefault() { global $ilCtrl, $lng; $is_vendor = ilPaymentVendors::_isVendor($this->user_obj->getId()); $has_stat_perm = ilPaymentTrustees::_hasStatisticPermission($this->user_obj->getId()); $has_obj_perm = ilPaymentTrustees::_hasObjectPermission($this->user_obj->getId()); $has_coup_perm = ilPaymentTrustees::_hasCouponsPermission($this->user_obj->getId()); if ($is_vendor || $has_stat_perm) { $ilCtrl->redirectByClass('ilpaymentstatisticgui'); } else { if ($has_obj_perm) { $ilCtrl->redirectByClass('ilpaymentobjectgui'); } else { if ($has_coup_perm) { $ilCtrl->redirectByClass('ilpaymentcoupongui'); } } } ilUtil::sendInfo($lng->txt("no_permission")); return false; }
private function buildTabs() { global $ilTabs, $ilUser; // $shop_obj = new ilPaymentShoppingCart($ilUser); $obj = ilPaymentSettings::_getInstance(); $allSet = $obj->getAll(); $ilTabs->addTarget('content', $this->ctrl->getLinkTargetByClass('ilshopgui', 'firstpage'), '', '', ''); if (!(bool) $allSet['hide_advanced_search']) { $ilTabs->addTarget('advanced_search', $this->ctrl->getLinkTargetByClass('ilshopadvancedsearchgui'), '', '', ''); } if (!(bool) $allSet['hide_shop_info']) { $ilTabs->addTarget('shop_info', $this->ctrl->getLinkTargetByClass('ilshopinfogui'), '', '', ''); } if (!(bool) $allSet['hide_news']) { $ilTabs->addTarget('payment_news', $this->ctrl->getLinkTargetByClass('ilshopnewsgui'), '', '', ''); } if (ANONYMOUS_USER_ID != $ilUser->getId()) { if ((bool) ilPaymentSettings::_getInstance()->get('topics_allow_custom_sorting')) { $ilTabs->addTarget('pay_personal_settings', $this->ctrl->getLinkTargetByClass('ilshoppersonalsettingsgui'), '', '', ''); } // Only show if not empty $ilTabs->addTarget('paya_buyed_objects', $this->ctrl->getLinkTargetByClass('ilshopboughtobjectsgui'), '', '', ''); // Only show if user is vendor if (ilPaymentVendors::_isVendor($ilUser->getId()) || ilPaymentTrustees::_hasAccess($ilUser->getId())) { $ilTabs->addTarget('paya_header', $this->ctrl->getLinkTargetByClass('ilpaymentadmingui'), '', '', ''); } } // Only show cart if not empty $ilTabs->addTarget('paya_shopping_cart', $this->ctrl->getLinkTargetByClass('ilshopshoppingcartgui'), '', '', ''); $ilTabs->addTarget('terms_conditions', $this->ctrl->getLinkTargetByClass(array('iltermsconditionsgui'), '')); }
public function __getVendorIds() { if (ilPaymentVendors::_isVendor($this->user_id)) { $vendors[] = $this->user_id; } $vend = ilPaymentTrustees::_getVendorsForStatisticsByTrusteeId($this->user_id); if (isset($vend)) { foreach ($vend as $v) { if (ilPaymentTrustees::_hasStatisticPermissionByVendor($this->user_id, $v)) { $vendors[] = $v; } } } return $vendors ? $vendors : array(); }
private function getVendorIds() { $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; if ($trustees = ilPaymentTrustees::_getTrusteesForCouponsByVendorId($v)) { foreach ($trustees as $t) { $vendors[] = $t; } } } } return $vendors ? $vendors : array(); }
public static function _isPurchasable($a_ref_id, $a_vendor_id = 0, $a_check_trustee = false, $a_check_status = false) { global $ilDB; // In the moment it's not possible to sell one object twice $data = array(); $data_types = array(); $query = 'SELECT * FROM payment_objects WHERE ref_id = %s '; $data_types[] = 'integer'; $data[] = $a_ref_id; // check if object is buyable !! if ($a_check_status) { $query .= 'AND status > %s '; $data_types[] = 'integer'; $data[] = 0; } if ($a_vendor_id > 0) { $query .= 'AND vendor_id = %s'; $data_types[] = 'integer'; $data[] = $a_vendor_id; if ($a_check_trustee) { include_once './Services/Payment/classes/class.ilPaymentTrustees.php'; include_once './Services/Payment/classes/class.ilPaymentVendors.php'; $vendors = ilPaymentTrustees::_getVendorsForObjects($a_vendor_id); if (ilPaymentVendors::_isVendor($a_user_id)) { $vendors[] = $a_user_id; } if (is_array($vendors) && count($vendors)) { $query .= ' OR ' . $ilDB->in('vendor_id', $vendors, false, 'integer'); } } } $res = $ilDB->queryf($query, $data_types, $data); $rows = $ilDB->numRows($res); return $rows ? true : false; }
private function __getVendors() { include_once 'Services/Payment/classes/class.ilPaymentVendors.php'; $options = array(); $vendors = array(); if (ilPaymentVendors::_isVendor($this->user_obj->getId())) { $vendors[] = $this->user_obj->getId(); } if ($vend = ilPaymentTrustees::_getVendorsForObjects($this->user_obj->getId())) { $vendors = array_merge($vendors, $vend); } foreach ($vendors as $vendor) { /** @var $tmp_obj ilObjUser */ $tmp_obj = ilObjectFactory::getInstanceByObjId($vendor, false); $options[$vendor] = $tmp_obj->getFullname() . ' [' . $tmp_obj->getLogin() . ']'; } return $options; }
protected function buildSubTabs() { global $ilUser, $ilTabs; switch ($this->getSection()) { case 6: if (ilPaymentVendors::_isVendor($ilUser->getId()) || ilPaymentTrustees::_hasStatisticPermission($ilUser->getId())) { $ilTabs->addSubTabTarget('bookings', $this->ctrl->getLinkTargetByClass('ilpaymentstatisticgui'), '', '', ''); } if (ilPaymentVendors::_isVendor($ilUser->getId()) || ilPaymentTrustees::_hasObjectPermission($ilUser->getId())) { $ilTabs->addSubTabTarget('paya_object', $this->ctrl->getLinkTargetByClass('ilpaymentobjectgui'), '', '', ''); } if (ilPaymentVendors::_isVendor($ilUser->getId())) { $ilTabs->addSubTabTarget('paya_trustees', $this->ctrl->getLinkTargetByClass('ilpaymenttrusteegui'), '', '', ''); } if (!(bool) $this->oGeneralSettings->get('hide_coupons')) { if (ilPaymentVendors::_isVendor($ilUser->getId()) || ilPaymentTrustees::_hasCouponsPermission($ilUser->getId())) { $ilTabs->addSubTabTarget('paya_coupons_coupons', $this->ctrl->getLinkTargetByClass('ilpaymentcoupongui'), '', '', ''); } } break; default: break; } }