コード例 #1
0
 /**
  * Standard Version of Fill Row. Most likely to
  * be overwritten by derived class.
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl, $ilAccess;
     $i = $a_set["Nr"];
     $this->tpl->setVariable("CHECKBOX", ilUtil::formCheckBox("", "area[]", $i));
     $this->tpl->setVariable("VAR_NAME", "name_" . $i);
     $this->tpl->setVariable("VAL_NAME", $a_set["Link"]["Title"]);
     $this->tpl->setVariable("VAL_SHAPE", $a_set["Shape"]);
     $this->tpl->setVariable("VAL_HIGHL_MODE", ilUtil::formSelect($a_set["HighlightMode"], "hl_mode_" . $i, $this->highl_modes, false, true));
     $this->tpl->setVariable("VAL_HIGHL_CLASS", ilUtil::formSelect($a_set["HighlightClass"], "hl_class_" . $i, $this->highl_classes, false, true));
     $this->tpl->setVariable("VAL_COORDS", implode(explode(",", $a_set["Coords"]), ", "));
     switch ($a_set["Link"]["LinkType"]) {
         case "ExtLink":
             $this->tpl->setVariable("VAL_LINK", $a_set["Link"]["Href"]);
             break;
         case "IntLink":
             $link_str = $this->parent_obj->getMapAreaLinkString($a_set["Link"]["Target"], $a_set["Link"]["Type"], $a_set["Link"]["TargetFrame"]);
             $this->tpl->setVariable("VAL_LINK", $link_str);
             break;
     }
 }
コード例 #2
0
 public function editPricesObject($a_show_delete = false)
 {
     /** 
      * @var $ilToolbar ilToolbarGUI
      * */
     global $ilToolbar;
     if ($a_show_delete == false) {
         unset($_SESSION['price_ids']);
     }
     $_SESSION['price_ids'] = $_SESSION['price_ids'] ? $_SESSION['price_ids'] : array();
     if (!$_GET['pobject_id']) {
         ilUtil::sendInfo($this->lng->txt('paya_no_object_selected'));
         $this->objectsObject();
         return true;
     }
     $this->ctrl->setParameter($this, 'pobject_id', (int) $_GET['pobject_id']);
     $ilToolbar->addButton($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'objects'));
     $ilToolbar->addButton($this->lng->txt('paya_edit_details'), $this->ctrl->getLinkTarget($this, 'editDetails'));
     $ilToolbar->addButton($this->lng->txt('paya_edit_prices'), $this->ctrl->getLinkTarget($this, 'editPrices'));
     $ilToolbar->addButton($this->lng->txt('pay_edit_abstract'), $this->ctrl->getLinkTargetByClass(array('ilshoppagegui'), 'edit'));
     $this->__initPaymentObject((int) $_GET['pobject_id']);
     $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment');
     $price_obj = new ilPaymentPrices((int) $_GET['pobject_id']);
     $standard_prices = array();
     $extension_prices = array();
     $standard_prices = $price_obj->getPrices();
     $extension_prices = $price_obj->getExtensionPrices();
     $prices = array_merge($standard_prices, $extension_prices);
     // No prices created
     if (!count($prices)) {
         ilUtil::sendInfo($this->lng->txt('paya_no_price_available'));
         $ilToolbar->addButton($this->lng->txt('paya_add_price'), $this->ctrl->getLinkTarget($this, 'addPrice'));
         return true;
     }
     // Show confirm delete
     if ($a_show_delete) {
         $oConfirmationGUI = new ilConfirmationGUI();
         // set confirm/cancel commands
         $oConfirmationGUI->setFormAction($this->ctrl->getFormAction($this, "performDeletePrice"));
         $oConfirmationGUI->setHeaderText($this->lng->txt("paya_sure_delete_selected_prices"));
         $oConfirmationGUI->setCancel($this->lng->txt("cancel"), "editPrices");
         $oConfirmationGUI->setConfirm($this->lng->txt("confirm"), "performDeletePrice");
         foreach ($prices as $price) {
             $delete_row = '';
             $tmp_price = '';
             if (in_array($price['price_id'], $_SESSION['price_ids'])) {
                 switch ($price['price_type']) {
                     case ilPaymentPrices::TYPE_DURATION_DATE:
                         include_once './Services/Calendar/classes/class.ilDatePresentation.php';
                         $tmp_price = ilDatePresentation::formatDate(new ilDate($price['duration_from'], IL_CAL_DATE)) . ' - ' . ilDatePresentation::formatDate(new ilDate($price['duration_until'], IL_CAL_DATE));
                         break;
                     case ilPaymentPrices::TYPE_DURATION_MONTH:
                         $tmp_price = $price['duration'] . ' ' . $this->lng->txt('paya_months');
                         break;
                     case ilPaymentPrices::TYPE_UNLIMITED_DURATION:
                         $tmp_price = $this->lng->txt('unlimited_duration');
                         break;
                 }
                 $delete_row .= '' . $tmp_price . '  ->  ' . ilFormat::_getLocalMoneyFormat($price['price']) . ' ' . $this->genSetData->get('currency_unit');
                 $oConfirmationGUI->addItem('', $delete_row, $delete_row);
             }
         }
         $this->tpl->setVariable('CONFIRMATION', $oConfirmationGUI->getHTML());
         return true;
     }
     // Fill table cells
     /** 
      * @var object $tpl ilTemplate 
      */
     $tpl = new ilTemplate('tpl.table.html', true, true);
     // set table header
     $tpl->setCurrentBlock('tbl_form_header');
     $tpl->setVariable('FORMACTION', $this->ctrl->getFormAction($this));
     $tpl->parseCurrentBlock();
     $counter = 0;
     $data = array();
     foreach ($prices as $price) {
         $data[$counter]['price_id'] = ilUtil::formCheckBox(in_array($price['price_id'], $_SESSION['price_ids']) ? 1 : 0, 'price_ids[]', $price['price_id']);
         switch ($price['price_type']) {
             case ilPaymentPrices::TYPE_DURATION_MONTH:
                 $data[$counter]['duration'] = $price['duration'] . ' ' . $this->lng->txt('paya_months');
                 break;
             case ilPaymentPrices::TYPE_DURATION_DATE:
                 $data[$counter]['duration'] = ilDatePresentation::formatDate(new ilDate($price['duration_from'], IL_CAL_DATE)) . ' - ' . ilDatePresentation::formatDate(new ilDate($price['duration_until'], IL_CAL_DATE));
                 break;
             case ilPaymentPrices::TYPE_UNLIMITED_DURATION:
                 $data[$counter]['duration'] = $this->lng->txt('unlimited_duration');
                 break;
         }
         $data[$counter]['price'] = ilFormat::_getLocalMoneyFormat($price['price']);
         $data[$counter]['currency_unit'] = $this->genSetData->get('currency_unit');
         $data[$counter]['extension'] = ilUtil::formCheckBox($price['extension'] ? 1 : 0, 'extension_ids[]', (int) $price['price_id'], true);
         $this->ctrl->setParameter($this, "price_id", $price['price_id']);
         $data[$counter]['edit'] = "<div class=\"il_ContainerItemCommands\"><a class=\"il_ContainerItemCommand\" href=\"" . $this->ctrl->getLinkTarget($this, "editPrice") . "\">" . $this->lng->txt("edit") . "</a></div>";
         ++$counter;
     }
     $this->__editPricesTable($data);
     return true;
 }
コード例 #3
0
 /**
  * display group members
  */
 public function membersObject()
 {
     global $ilAccess, $ilBench, $lng, $ilToolbar, $ilUser;
     if (!$this->ilias->getSetting('ilinc_active')) {
         $this->ilias->raiseError($lng->txt('ilinc_server_not_active'), $this->ilias->error_obj->MESSAGE);
     }
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.icrs_members.html', 'Modules/ILinc');
     $this->__setSubTabs('members');
     $this->lng->loadLanguageModule('ilinc');
     // display member search button
     $is_admin = (bool) $ilAccess->checkAccess('write', '', $this->object->getRefId());
     if ($is_admin) {
         $ilToolbar->addButton($this->lng->txt('ilinc_add_user'), $this->ctrl->getLinkTargetByClass('ilRepositorySearchGUI', 'start'));
     }
     //if current user is admin he is able to add new members to group
     $val_contact = "<img src=\"" . ilUtil::getImagePath("icon_pencil_b.png") . "\" alt=\"" . $this->lng->txt("ilinc_mem_send_mail") . "\" title=\"" . $this->lng->txt("ilinc_mem_send_mail") . "\" border=\"0\" vspace=\"0\"/>";
     $val_change = "<img src=\"" . ilUtil::getImagePath("icon_change_b.png") . "\" alt=\"" . $this->lng->txt("ilinc_mem_change_status") . "\" title=\"" . $this->lng->txt("ilinc_mem_change_status") . "\" border=\"0\" vspace=\"0\"/>";
     $val_leave = "<img src=\"" . ilUtil::getImagePath("icon_group_out_b.png") . "\" alt=\"" . $this->lng->txt("ilinc_mem_leave") . "\" title=\"" . $this->lng->txt("ilinc_mem_leave") . "\" border=\"0\" vspace=\"0\"/>";
     // store access checks to improve performance
     $access_leave = $ilAccess->checkAccess('leave', '', $this->object->getRefId());
     $access_write = $ilAccess->checkAccess('write', '', $this->object->getRefId());
     $member_ids = $this->object->getMemberIds();
     // fetch all user data in one shot to improve performance (from ILIAS db)
     $members = $this->object->getMemberData($member_ids);
     // fetch docent or student assignment form all coursemembers from iLinc server
     $docent_ids = $this->object->getiLincMemberIds(true);
     $student_ids = $this->object->getiLincMemberIds(false);
     $counter = 0;
     $result_set = array();
     require_once 'Services/Mail/classes/class.ilMailFormCall.php';
     foreach ($members as $mem) {
         $link_contact = ilMailFormCall::getLinkTarget($this, 'members', array(), array('type' => 'new', 'rcp_to' => $mem['login']));
         $link_change = $this->ctrl->getLinkTarget($this, 'changeMember') . '&mem_id=' . $mem['id'];
         if ($mem['id'] == $ilUser->getId() && $access_leave || $access_delete) {
             $link_leave = $this->ctrl->getLinkTarget($this, 'removeMember') . '&mem_id=' . $mem['id'];
         }
         //build functions
         $member_functions = '';
         if ($access_write) {
             $member_functions = "<a href=\"{$link_change}\">{$val_change}</a>";
         }
         if ($mem['id'] == $ilUser->getId() && $access_leave || $access_write) {
             $link_leave = $this->ctrl->getLinkTarget($this, 'removeMember') . '&mem_id=' . $mem['id'];
             $member_functions .= "<a href=\"{$link_leave}\">{$val_leave}</a>";
         }
         // this is twice as fast than the code above
         $str_member_roles = $this->object->getMemberRolesTitle($mem['id']);
         if ($access_write) {
             $result_set[$counter]['checkbox'] = ilUtil::formCheckBox(0, 'user_id[]', $mem['id']);
         }
         $status = $this->object->checkiLincMemberStatus($mem['ilinc_id'], $docent_ids, $student_ids);
         if ($status == ILINC_MEMBER_NOTSET) {
             $status = "<span class='warning'>" . $this->lng->txt($status) . "</span>";
         } else {
             $status = $this->lng->txt($status);
         }
         $result_set[$counter]['login'] = $mem['login'];
         $result_set[$counter]['firstname'] = $mem['firstname'];
         $result_set[$counter]['lastname'] = $mem['lastname'];
         $result_set[$counter]['attending_as'] = $status;
         $result_set[$counter]['role'] = $str_member_roles;
         $result_set[$counter]['options'] = "<a href=\"{$link_contact}\">" . $val_contact . "</a>" . $member_functions;
         ++$counter;
         unset($member_functions);
     }
     include_once 'Modules/ILinc/classes/class.iliLinkMembersTableGUI.php';
     $oTable = new iliLinkMembersTableGUI($this, $result_set, 'show', 'members', 'members');
     $oTable->setTitle($this->lng->txt('ilinc_involved_users'), 'icon_usr_b.png', $this->lng->txt('ilinc_involved_users'));
     return $this->tpl->setVariable('MEMBER_TABLE', $oTable->getHTML());
 }
コード例 #4
0
 public function showItems()
 {
     global $ilObjDataCache, $ilUser, $ilToolbar;
     include_once './Services/Payment/classes/class.ilPaymentPrices.php';
     include_once './Services/Payment/classes/class.ilPaymentCurrency.php';
     $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.pay_shopping_cart.html', 'Services/Payment');
     //		var_dump($_SESSION['shop_user_id']);
     //		if(isset($_SESSION['shop_user_id']))
     //		{
     //
     //			$this->user_obj->_toggleActiveStatusOfUsers(array($this->user_obj->getId()), 1);
     //		}
     if ($_SESSION['forceShoppingCartRedirect'] == '1') {
         $_SESSION['forceShoppingCartRedirect'] = 0;
         $this->tpl->touchBlock("close_js");
         return true;
     }
     $this->initShoppingCartObject();
     include_once './Services/Payment/classes/class.ilPaymentSettings.php';
     $genSet = ilPaymentSettings::_getInstance();
     $pay_methods = $this->_getPayMethods(true);
     $num_items = 0;
     $desc = array();
     //course_objects
     $is_crs_object = false;
     $crs_obj_ids = array();
     //file_objects,exercise_objects
     $is_file_object = false;
     // learning_modules,
     $is_lm_object = false;
     $lm_obj_ids = array();
     if ($genSet->get('show_sr_shoppingcart') == 1) {
         require_once 'Services/RTE/classes/class.ilRTE.php';
         $regulations = ilRTE::_replaceMediaObjectImageSrc($genSet->get('statutory_regulations'), 1);
         $this->tpl->setVariable('REGULATIONS_TITLE', $this->lng->txt('statutory_regulations'));
         $this->tpl->setVariable('REGULATIONS', $regulations);
     }
     $ilToolbar->addButton($this->lng->txt('payment_back_to_shop'), 'ilias.php?baseClass=ilShopController');
     foreach ($pay_methods as $pay_method) {
         $this->totalVat = 0;
         $tpl = new ilTemplate($this->_getTemplateFilename($pay_method['pm_title']), true, 'Services/Payment');
         $coupon_session_id = $pay_method['pm_title'];
         if (count($items = $this->psc_obj->getEntries($pay_method['pm_id']))) {
             $counter = 0;
             $paypal_counter = 0;
             $total_price = 0;
             foreach ($items as $item) {
                 $tmp_pobject = new ilPaymentObject($this->user_obj, $item['pobject_id']);
                 $obj_id = $ilObjDataCache->lookupObjId($tmp_pobject->getRefId());
                 $obj_type = $ilObjDataCache->lookupType($obj_id);
                 $obj_title = $ilObjDataCache->lookupTitle($obj_id);
                 $desc[] = "[" . $obj_type . "] " . $obj_title;
                 $price_arr = ilPaymentPrices::_getPrice($item['price_id']);
                 # checks object_type: needed for purchasing file or crs objects without login
                 switch ($obj_type) {
                     case 'crs':
                         // if is_crs there an user-account will be autogenerated
                         $is_crs_object = true;
                         $_SESSION['is_crs_object'] = true;
                         $crs_obj_ids[] = $obj_id;
                         $_SESSION['crs_obj_ids'] = $crs_obj_ids;
                         break;
                     case 'lm':
                     case 'sahs':
                     case 'htlm':
                     case 'tst':
                         $is_lm_object = true;
                         $_SESSION['is_lm_object'] = true;
                         $lm_obj_ids[] = $obj_id;
                         $_SESSION['lm_obj_ids'] = $lm_obj_ids;
                         break;
                     case 'exc':
                     case 'file':
                         $is_file_object = true;
                         break;
                     default:
                         break;
                 }
                 $direct_paypal_info_output = true;
                 $assigned_coupons = '';
                 if (!empty($_SESSION['coupons'][$coupon_session_id])) {
                     $price = $price_arr['price'];
                     $item['math_price'] = (double) $price;
                     foreach ($_SESSION['coupons'][$coupon_session_id] as $key => $coupon) {
                         $this->coupon_obj->setId($coupon['pc_pk']);
                         $this->coupon_obj->setCurrentCoupon($coupon);
                         if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId())) {
                             $assigned_coupons .= $this->lng->txt('paya_coupons_coupon') . ': ' . $coupon['pcc_code'];
                             $_SESSION['coupons'][$coupon_session_id][$key]['total_objects_coupon_price'] += (double) $price;
                             $_SESSION['coupons'][$coupon_session_id][$key]['items'][] = $item;
                             $direct_paypal_info_output = false;
                         }
                     }
                 }
                 $f_result[$counter]['item'] = ilUtil::formCheckBox(0, 'item[]', $item['psc_id']);
                 $subtype = '';
                 if ($obj_type == 'exc') {
                     $subtype = ' (' . $this->lng->txt($tmp_pobject->getSubtype()) . ')';
                     $f_result[$counter]['title'] = "<a href=\"goto.php?target=" . $obj_type . "_" . $tmp_pobject->getRefId() . "\">" . $obj_title . "</a>" . $subtype;
                 } else {
                     $f_result[$counter]['title'] = "<a href=\"ilias.php?baseClass=ilRepositoryGUI&amp;ref_id=" . $tmp_pobject->getRefId() . "\">" . $obj_title . "</a>" . $subtype;
                 }
                 if ($assigned_coupons != '') {
                     // !!! $f_result[$counter][count($f_result[$counter]) - 1] .= $assigned_coupons;
                     $f_result[$counter]['assigned_coupons'] .= $assigned_coupons;
                 }
                 switch ($price_arr['price_type']) {
                     case ilPaymentPrices::TYPE_DURATION_MONTH:
                         $f_result[$counter]['duration'] = $price_arr['duration'] . ' ' . $this->lng->txt('paya_months');
                         break;
                     case ilPaymentPrices::TYPE_DURATION_DATE:
                         $f_result[$counter]['duration'] = ilDatePresentation::formatDate(new ilDate($price_arr['duration_from'], IL_CAL_DATE)) . ' - ' . ilDatePresentation::formatDate(new ilDate($price_arr['duration_until'], IL_CAL_DATE));
                         break;
                     case ilPaymentPrices::TYPE_UNLIMITED_DURATION:
                         $f_result[$counter]['duration'] = $this->lng->txt('unlimited_duration');
                         break;
                 }
                 $float_price = $price_arr['price'];
                 $total_price += $float_price;
                 $oVAT = new ilShopVats((int) $tmp_pobject->getVatId());
                 $f_result[$counter]['vat_rate'] = ilShopUtils::_formatVAT($oVAT->getRate());
                 $this->totalVat = $this->totalVat + $tmp_pobject->getVat($float_price);
                 $f_result[$counter]['price'] = ilPaymentPrices::_getPriceString($item['price_id']) . ' ' . $genSet->get('currency_unit');
                 $f_result[$counter]['vat_unit'] = ilPaymentPrices::_getGUIPrice($tmp_pobject->getVat($float_price, 'CALCULATION')) . ' ' . $genSet->get('currency_unit');
                 if ($pay_method['pm_title'] == 'paypal') {
                     if ($direct_paypal_info_output == true) {
                         $tpl->setCurrentBlock('loop_items');
                         $tpl->setVariable('LOOP_ITEMS_NO', ++$paypal_counter);
                         $tpl->setVariable('LOOP_ITEMS_NAME', "[" . $obj_id . "]: " . $obj_title);
                         $tpl->setVariable('LOOP_ITEMS_AMOUNT', $float_price);
                         $tpl->parseCurrentBlock('loop_items');
                     }
                 }
                 ++$counter;
                 unset($tmp_pobject);
             }
             // foreach
             $this->showItemsTable($tpl, $f_result, $pay_method);
             if (!(bool) $genSet->get('hide_coupons')) {
                 $tpl->setVariable('COUPON_TABLE', $this->showCouponInput($pay_method['pm_title']));
             }
             $tpl->setCurrentBlock('buy_link');
             #				$tpl->setCurrentBlock('terms_checkbox');
             $link_target = $this->ctrl->getLinkTargetByClass('iltermsconditionsgui', '');
             $terms_link = '<a href="' . $link_target . '">' . $this->lng->txt('terms_conditions') . '</a>';
             $tpl->setVariable('TERMS_CONDITIONS', sprintf($this->lng->txt('accept_terms_conditions'), $terms_link));
             switch ($pay_method['pm_title']) {
                 case 'bill':
                     if ($this->totalAmount[$pay_method['pm_id']] <= 0 && ANONYMOUS_USER_ID == $this->user_obj->getId()) {
                         $tpl->setVariable('TXT_UNLOCK', $this->lng->txt('pay_click_to_buy'));
                         $tpl->setVariable('LINK_UNLOCK', $this->ctrl->getLinkTarget($this, 'unlockBillObjectsInShoppingCart'));
                     } else {
                         # Anonymous user has to login
                         if (ANONYMOUS_USER_ID == $this->user_obj->getId()) {
                             ilUtil::sendInfo($this->lng->txt('click_to_continue_info'));
                             $tpl->touchBlock('attach_submit_event_bill');
                             $tpl->setVariable('TXT_BUY', $this->lng->txt('continue'));
                             $tpl->setVariable('SCRIPT_LINK', 'login.php?cmd=force_login&login_to_purchase_object=1&forceShoppingCartRedirect=1');
                         } else {
                             ilUtil::sendInfo($this->lng->txt('click_to_buy_info'));
                             $tpl->setVariable('TXT_BUY', $this->lng->txt('pay_click_to_buy'));
                             $tpl->setVariable('SCRIPT_LINK', $this->ctrl->getLinkTargetByClass('ilPurchaseBillGUI', ''));
                             $tpl->parseCurrentBlock('terms_checkbox');
                         }
                     }
                     break;
                 case 'bmf':
                     #$tpl->setVariable("SCRIPT_LINK", './payment.php?view=start_bmf');
                     if ($this->totalAmount[$pay_method['pm_id']] <= 0 && ANONYMOUS_USER_ID != $this->user_obj->getId()) {
                         $tpl->setVariable('TXT_UNLOCK', $this->lng->txt('pay_click_to_buy'));
                         $tpl->setVariable('LINK_UNLOCK', $this->ctrl->getLinkTarget($this, 'unlockBMFObjectsInShoppingCart'));
                     } else {
                         # Anonymous user has to login
                         if (ANONYMOUS_USER_ID == $this->user_obj->getId()) {
                             ilUtil::sendInfo($this->lng->txt('click_to_continue_info'));
                             $tpl->setVariable('TXT_BUY', $this->lng->txt('continue'));
                             $tpl->setVariable('SCRIPT_LINK', 'login.php?cmd=force_login&login_to_purchase_object=1&forceShoppingCartRedirect=1');
                         } else {
                             $tpl->setVariable('TXT_BUY', $this->lng->txt('pay_click_to_buy'));
                             $tpl->setVariable('SCRIPT_LINK', $this->ctrl->getLinkTargetByClass('ilPurchaseBMFGUI', ''));
                         }
                     }
                     break;
                 case 'epay':
                     # Anonymous user has to login
                     //						if(ANONYMOUS_USER_ID == $ilUser->getId())
                     //						{
                     //							$tpl->setVariable('TXT_BUY', $this->lng->txt('pay_click_to_buy'));
                     //							$tpl->setVariable('SCRIPT_LINK','login.php?cmd=force_login&login_to_purchase_object=1&forceShoppingCartRedirect=1');
                     //						}
                     //						else
                     //						{
                     //							/// http://uk.epay.dk/support/docs.asp?solution=2#pfinput
                     //							$tpl->setVariable('TXT_BUY', $this->lng->txt('pay_click_to_buy'));
                     //							$tpl->setVariable('SCRIPT_LINK', 'https://'.$this->epayConfig['server_host'].$this->epayConfig['server_path']);
                     //							$tpl->setVariable('MERCHANT_NUMBER', $this->epayConfig['merchant_number']);
                     //							$tpl->setVariable('AMOUNT', $total_price * 100);
                     //							$tpl->setVariable('CURRENCY', "208");
                     //							$tpl->setVariable('ORDERID', $ilUser->getId()."_".uniqid());
                     //							$tpl->setVariable('ACCEPT_URL', ILIAS_HTTP_PATH . "/" . $this->ctrl->getLinkTarget($this, 'finishEPay'));
                     //							$tpl->setVariable('DECLINE_URL', ILIAS_HTTP_PATH . "/" . $this->ctrl->getLinkTarget($this, 'cancelEPay'));
                     //							$tpl->setVariable('INSTANT_CAPTURE', $this->epayConfig['instant_capture'] ? "1" : "0");
                     //							$tpl->setVariable('ADDFEE', 1);
                     //							$tpl->setVariable('LANGUAGE', 1);
                     //							$tpl->setVariable('GROUP', "");
                     //							$tpl->setVariable('CARDTYPE', "");
                     //							$tpl->setVariable("CALLBACK_URL", ILIAS_HTTP_PATH . "/Services/Payment/classes/class.ilCallback.php?ilUser="******"&pay_method=". PAY_METHOD_EPAY);
                     //
                     //							$tpl->setVariable('DESCRIPTION', $ilUser->getFullName() . " (" . $ilUser->getEmail() . ") #" . $ilUser->getId() . " " . implode(",", $desc));
                     //							$tpl->setVariable('AUTH_MAIL', $this->epayConfig['auth_email']);
                     //							$tpl->setVariable('MD5KEY', $this->epSet->generateKeyForEpay(208, $total_price*100, $ilUser->getId()."_".uniqid()));
                     //						}
                     break;
                 case 'paypal':
                     if ($this->totalAmount[$pay_method['pm_id']] <= 0 && ANONYMOUS_USER_ID != $this->user_obj->getId()) {
                         $tpl->touchBlock('attach_submit_event');
                         $tpl->setVariable('TXT_BUY', $this->lng->txt('pay_click_to_buy'));
                         $tpl->setVariable('SCRIPT_LINK', $this->ctrl->getLinkTarget($this, 'unlockPAYPALObjectsInShoppingCart'));
                     } else {
                         if (ANONYMOUS_USER_ID == $this->user_obj->getId()) {
                             ilUtil::sendInfo($this->lng->txt('click_to_continue_info'));
                             $tpl->touchBlock('attach_submit_event');
                             $tpl->setVariable('TXT_BUY', $this->lng->txt('pay_click_to_buy'));
                             $tpl->setVariable('SCRIPT_LINK', 'login.php?cmd=force_login&login_to_purchase_object=1&forceShoppingCartRedirect=1');
                         } else {
                             $tpl->setCurrentBlock('terms_checkbox');
                             ilUtil::sendInfo($this->lng->txt('click_to_buy_info'));
                             $tpl->setVariable('TXT_BUY', $this->lng->txt('pay_click_to_buy'));
                             $tpl->setVariable('SCRIPT_LINK', 'https://' . $this->paypalConfig['server_host'] . $this->paypalConfig['server_path']);
                             $tpl->parseCurrentBlock('terms_checkbox');
                         }
                     }
                     $tpl->setVariable('POPUP_BLOCKER', $this->lng->txt('popup_blocker'));
                     $tpl->setVariable('VENDOR', $this->paypalConfig['vendor']);
                     $tpl->setVariable('RETURN', ILIAS_HTTP_PATH . "/" . $this->ctrl->getLinkTarget($this, 'finishPaypal'));
                     $tpl->setVariable('CANCEL_RETURN', ILIAS_HTTP_PATH . "/" . $this->ctrl->getLinkTarget($this, 'cancelPaypal'));
                     $tpl->setVariable('CUSTOM', $this->user_obj->getId());
                     $tpl->setVariable('CURRENCY', $genSet->get('currency_unit'));
                     $tpl->setVariable('PAGE_STYLE', $this->paypalConfig['page_style']);
                     if (!empty($_SESSION['coupons'][$coupon_session_id])) {
                         $coupon_discount_items = $this->psc_obj->calcDiscountPrices($_SESSION['coupons'][$coupon_session_id]);
                         if (is_array($coupon_discount_items) && !empty($coupon_discount_items)) {
                             foreach ($coupon_discount_items as $item) {
                                 $tmp_pobject = new ilPaymentObject($this->user_obj, $item['pobject_id']);
                                 $obj_id = $ilObjDataCache->lookupObjId($tmp_pobject->getRefId());
                                 $obj_title = $ilObjDataCache->lookupTitle($obj_id);
                                 $tmp_amount = round($item['discount_price'], 2);
                                 $loop_items_amount = str_replace(',', '.', $tmp_amount);
                                 $tpl->setCurrentBlock('loop_items');
                                 $tpl->setVariable('LOOP_ITEMS_NO', ++$paypal_counter);
                                 $tpl->setVariable('LOOP_ITEMS_NAME', "[" . $obj_id . "]: " . $obj_title);
                                 $tpl->setVariable('LOOP_ITEMS_AMOUNT', $loop_items_amount);
                                 $tpl->parseCurrentBlock('loop_items');
                                 unset($tmp_pobject);
                             }
                         }
                     }
                     break;
             }
             if ($pay_method['pm_title'] == 'paypal') {
                 $tpl->setVariable('PAYPAL_HINT', $this->lng->txt('pay_hint_paypal'));
                 $tpl->setVariable('PAYPAL_INFO', $this->lng->txt('pay_info_paypal'));
             } else {
                 if ($pay_method['pm_title'] == 'epay') {
                     $tpl->setVariable('EPAY_HINT', $this->lng->txt('pay_hint_epay'));
                     $tpl->setVariable('EPAY_INFO', $this->lng->txt('pay_info_epay'));
                 }
             }
             $tpl->parseCurrentBlock('buy_link');
             $tpl->setCurrentBlock('loop');
             unset($f_result);
             $tpl->parseCurrentBlock('loop');
             $this->tpl->setVariable('' . strtoupper($pay_method['pm_title']) . '', $tpl->get());
             $num_items += $counter;
         }
     }
     if ($num_items == 0) {
         #		ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
         return false;
     }
     return true;
 }
コード例 #5
0
 function listDesktopItemsObject()
 {
     global $rbacsystem, $rbacreview, $tree;
     #if(!$rbacsystem->checkAccess('edit_permission', $this->rolf_ref_id))
     /*
     if(!$this->checkAccess('edit_permission'))
     {
     	ilUtil::sendFailure()
     	$this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
     }
     */
     if (!$rbacreview->isAssignable($this->object->getId(), $this->rolf_ref_id) && $this->rolf_ref_id != ROLE_FOLDER_ID) {
         ilUtil::sendInfo($this->lng->txt('role_no_users_no_desk_items'));
         return true;
     }
     include_once 'Services/AccessControl/classes/class.ilRoleDesktopItem.php';
     $role_desk_item_obj =& new ilRoleDesktopItem($this->object->getId());
     if ($rbacsystem->checkAccess('push_desktop_items', USER_FOLDER_ID)) {
         $this->__showButton('selectDesktopItem', $this->lng->txt('role_desk_add'));
     }
     if (!count($items = $role_desk_item_obj->getAll())) {
         ilUtil::sendInfo($this->lng->txt('role_desk_none_created'));
         return true;
     }
     $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.role_desktop_item_list.html", "Services/AccessControl");
     $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
     $this->tpl->setVariable("TBL_TITLE_IMG", ilUtil::getImagePath('icon_role.png'));
     $this->tpl->setVariable("TBL_TITLE_IMG_ALT", $this->lng->txt('obj_role'));
     $this->tpl->setVariable("TBL_TITLE", $this->lng->txt('role_assigned_desk_items') . ' (' . $this->object->getTitle() . ')');
     $this->tpl->setVariable("HEADER_DESC", $this->lng->txt('description'));
     $this->tpl->setVariable("BTN_DELETE", $this->lng->txt('delete'));
     $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath('arrow_downright.png'));
     $counter = 0;
     foreach ($items as $role_item_id => $item) {
         $tmp_obj = ilObjectFactory::getInstanceByRefId($item['item_id']);
         if (strlen($desc = $tmp_obj->getDescription())) {
             $this->tpl->setCurrentBlock("description");
             $this->tpl->setVariable("DESCRIPTION_DESK", $desc);
             $this->tpl->parseCurrentBlock();
         }
         $this->tpl->setCurrentBlock("desk_row");
         $this->tpl->setVariable("DESK_TITLE", $tmp_obj->getTitle());
         $this->tpl->setVariable("ROW_CLASS", ilUtil::switchColor(++$counter, 'tblrow1', 'tblrow2'));
         $this->tpl->setVariable("CHECK_DESK", ilUtil::formCheckBox(0, 'del_desk_item[]', $role_item_id));
         $this->tpl->setVariable("TXT_PATH", $this->lng->txt('path') . ':');
         $this->tpl->setVariable("PATH", $this->__formatPath($tree->getPathFull($item['item_id'])));
         $this->tpl->parseCurrentBlock();
     }
     return true;
 }
コード例 #6
0
 /**
  * display permissions
  * 
  * @access	public
  */
 function permObject()
 {
     global $rbacadmin, $rbacreview, $rbacsystem, $objDefinition;
     if (!$rbacsystem->checkAccess('write', $this->rolf_ref_id)) {
         $this->ilias->raiseError($this->lng->txt("msg_no_perm_perm"), $this->ilias->error_obj->WARNING);
         exit;
     }
     $to_filter = $objDefinition->getSubobjectsToFilter();
     $tpl_filter = array();
     $internal_tpl = false;
     if ($internal_tpl = $this->object->isInternalTemplate()) {
         $tpl_filter = $this->object->getFilterOfInternalTemplate();
     }
     $operation_info = $rbacreview->getOperationAssignment();
     foreach ($operation_info as $info) {
         if ($objDefinition->getDevMode($info['type'])) {
             continue;
         }
         // FILTER SUBOJECTS OF adm OBJECT
         if (in_array($info['type'], $to_filter)) {
             continue;
         }
         if ($internal_tpl and $tpl_filter and !in_array($info['type'], $tpl_filter)) {
             continue;
         }
         $rbac_objects[$info['typ_id']] = array("obj_id" => $info['typ_id'], "type" => $info['type']);
         $txt = $objDefinition->isPlugin($info['type']) ? ilPlugin::lookupTxt("rep_robj", $info['type'], $info['type'] . "_" . $info['operation']) : $this->lng->txt($info['type'] . "_" . $info['operation']);
         if (substr($info['operation'], 0, 7) == "create_" && $objDefinition->isPlugin(substr($info['operation'], 7))) {
             $txt = ilPlugin::lookupTxt("rep_robj", substr($info['operation'], 7), $info['type'] . "_" . $info['operation']);
         } elseif (substr($info['operation'], 0, 6) == 'create') {
             $txt = $this->lng->txt('rbac_' . $info['operation']);
         }
         $rbac_operations[$info['typ_id']][$info['ops_id']] = array("ops_id" => $info['ops_id'], "title" => $info['operation'], "name" => $txt);
     }
     foreach ($rbac_objects as $key => $obj_data) {
         if ($objDefinition->isPlugin($obj_data["type"])) {
             $rbac_objects[$key]["name"] = ilPlugin::lookupTxt("rep_robj", $obj_data["type"], "obj_" . $obj_data["type"]);
         } else {
             $rbac_objects[$key]["name"] = $this->lng->txt("obj_" . $obj_data["type"]);
         }
         $rbac_objects[$key]["ops"] = $rbac_operations[$key];
     }
     sort($rbac_objects);
     foreach ($rbac_objects as $key => $obj_data) {
         sort($rbac_objects[$key]["ops"]);
     }
     // sort by (translated) name of object type
     $rbac_objects = ilUtil::sortArray($rbac_objects, "name", "asc");
     // BEGIN CHECK_PERM
     foreach ($rbac_objects as $key => $obj_data) {
         $arr_selected = $rbacreview->getOperationsOfRole($this->object->getId(), $obj_data["type"], $this->rolf_ref_id);
         $arr_checked = array_intersect($arr_selected, array_keys($rbac_operations[$obj_data["obj_id"]]));
         foreach ($rbac_operations[$obj_data["obj_id"]] as $operation) {
             $checked = in_array($operation["ops_id"], $arr_checked);
             $disabled = false;
             // Es wird eine 2-dim Post Variable �bergeben: perm[rol_id][ops_id]
             $box = ilUtil::formCheckBox($checked, "template_perm[" . $obj_data["type"] . "][]", $operation["ops_id"], $disabled);
             $output["perm"][$obj_data["obj_id"]][$operation["ops_id"]] = $box;
         }
     }
     // END CHECK_PERM
     $output["col_anz"] = count($rbac_objects);
     $output["txt_save"] = $this->lng->txt("save");
     $output["check_protected"] = ilUtil::formCheckBox($rbacreview->isProtected($this->rolf_ref_id, $this->object->getId()), "protected", 1);
     $output["text_protected"] = $this->lng->txt("role_protect_permissions");
     /************************************/
     /*		adopt permissions form		*/
     /************************************/
     $output["message_middle"] = $this->lng->txt("adopt_perm_from_template");
     // send message for system role
     if ($this->object->getId() == SYSTEM_ROLE_ID) {
         $output["adopt"] = array();
         ilUtil::sendFailure($this->lng->txt("msg_sysrole_not_editable"));
     } else {
         // BEGIN ADOPT_PERMISSIONS
         $parent_role_ids = $rbacreview->getParentRoleIds($this->rolf_ref_id, true);
         // sort output for correct color changing
         ksort($parent_role_ids);
         foreach ($parent_role_ids as $key => $par) {
             if ($par["obj_id"] != SYSTEM_ROLE_ID) {
                 $radio = ilUtil::formRadioButton(0, "adopt", $par["obj_id"]);
                 $output["adopt"][$key]["css_row_adopt"] = ilUtil::switchColor($key, "tblrow1", "tblrow2");
                 $output["adopt"][$key]["check_adopt"] = $radio;
                 $output["adopt"][$key]["type"] = $par["type"] == 'role' ? 'Role' : 'Template';
                 $output["adopt"][$key]["role_name"] = $par["title"];
             }
         }
         $output["formaction_adopt"] = $this->ctrl->getFormAction($this);
         // END ADOPT_PERMISSIONS
     }
     $output["formaction"] = $this->ctrl->getFormAction($this);
     $this->data = $output;
     /************************************/
     /*			generate output			*/
     /************************************/
     $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
     $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html", "Services/Locator");
     $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.adm_perm_role.html", "Services/AccessControl");
     foreach ($rbac_objects as $obj_data) {
         // BEGIN object_operations
         $this->tpl->setCurrentBlock("object_operations");
         foreach ($obj_data["ops"] as $operation) {
             $ops_ids[] = $operation["ops_id"];
             $css_row = ilUtil::switchColor($key, "tblrow1", "tblrow2");
             $this->tpl->setVariable("CSS_ROW", $css_row);
             $this->tpl->setVariable("PERMISSION", $operation["name"]);
             $this->tpl->setVariable("CHECK_PERMISSION", $this->data["perm"][$obj_data["obj_id"]][$operation["ops_id"]]);
             $this->tpl->parseCurrentBlock();
         }
         // END object_operations
         // BEGIN object_type
         $this->tpl->setCurrentBlock("object_type");
         $this->tpl->setVariable("TXT_OBJ_TYPE", $obj_data["name"]);
         // TODO: move this if in a function and query all objects that may be disabled or inactive
         if ($this->objDefinition->getDevMode($obj_data["type"])) {
             $this->tpl->setVariable("TXT_NOT_IMPL", "(" . $this->lng->txt("not_implemented_yet") . ")");
         } else {
             if ($obj_data["type"] == "icrs" and !$this->ilias->getSetting("ilinc_active")) {
                 $this->tpl->setVariable("TXT_NOT_IMPL", "(" . $this->lng->txt("not_enabled_or_configured") . ")");
             }
         }
         // js checkbox toggles
         $this->tpl->setVariable("JS_VARNAME", "template_perm_" . $obj_data["type"]);
         $this->tpl->setVariable("JS_ONCLICK", ilUtil::array_php2js($ops_ids));
         $this->tpl->setVariable("TXT_CHECKALL", $this->lng->txt("check_all"));
         $this->tpl->setVariable("TXT_UNCHECKALL", $this->lng->txt("uncheck_all"));
         $this->tpl->parseCurrentBlock();
         // END object_type
     }
     /* 
     // BEGIN ADOPT PERMISSIONS
     foreach ($this->data["adopt"] as $key => $value)
     {			
     	$this->tpl->setCurrentBlock("ADOPT_PERM_ROW");
     	$this->tpl->setVariable("CSS_ROW_ADOPT",$value["css_row_adopt"]);
     	$this->tpl->setVariable("CHECK_ADOPT",$value["check_adopt"]);
     	$this->tpl->setVariable("TYPE",$value["type"]);
     	$this->tpl->setVariable("ROLE_NAME",$value["role_name"]);
     	$this->tpl->parseCurrentBlock();
     }
     
     $this->tpl->setCurrentBlock("ADOPT_PERM_FORM");
     $this->tpl->setVariable("MESSAGE_MIDDLE",$this->data["message_middle"]);
     $this->tpl->setVariable("FORMACTION_ADOPT",$this->data["formaction_adopt"]);
     $this->tpl->setVariable("ADOPT",$this->lng->txt('copy'));
     $this->tpl->parseCurrentBlock();
     // END ADOPT PERMISSIONS 		
     */
     $this->tpl->setCurrentBlock("tblfooter_protected");
     $this->tpl->setVariable("COL_ANZ", 3);
     $this->tpl->setVariable("CHECK_BOTTOM", $this->data["check_protected"]);
     $this->tpl->setVariable("MESSAGE_TABLE", $this->data["text_protected"]);
     $this->tpl->parseCurrentBlock();
     $this->tpl->setVariable("COL_ANZ_PLUS", 4);
     $this->tpl->setVariable("TXT_SAVE", $this->data["txt_save"]);
     $this->tpl->setCurrentBlock("adm_content");
     $this->tpl->setVariable("TBL_TITLE_IMG", ilUtil::getImagePath("icon_" . $this->object->getType() . ".png"));
     $this->tpl->setVariable("TBL_TITLE_IMG_ALT", $this->lng->txt($this->object->getType()));
     $this->tpl->setVariable("TBL_HELP_IMG", ilUtil::getImagePath("icon_help.png"));
     $this->tpl->setVariable("TBL_HELP_LINK", "tbl_help.php");
     $this->tpl->setVariable("TBL_HELP_IMG_ALT", $this->lng->txt("help"));
     // compute additional information in title
     if (substr($this->object->getTitle(), 0, 3) == "il_") {
         $desc = $this->lng->txt("predefined_template");
         //$this->lng->txt("obj_".$parent_node['type'])." (".$parent_node['obj_id'].") : ".$parent_node['title'];
     }
     $description = "<br/>&nbsp;<span class=\"small\">" . $desc . "</span>";
     // translation for autogenerated roles
     if (substr($this->object->getTitle(), 0, 3) == "il_") {
         include_once './Services/AccessControl/classes/class.ilObjRole.php';
         $title = ilObjRole::_getTranslation($this->object->getTitle()) . " (" . $this->object->getTitle() . ")";
     } else {
         $title = $this->object->getTitle();
     }
     $this->tpl->setVariable("TBL_TITLE", $title . $description);
     $this->tpl->setVariable("TXT_PERMISSION", $this->data["txt_permission"]);
     $this->tpl->setVariable("FORMACTION", $this->data["formaction"]);
     $this->tpl->parseCurrentBlock();
 }
コード例 #7
0
 /**
  * Standard Version of Fill Row. Most likely to
  * be overwritten by derived class.
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl, $ilAccess;
     //var_dump($a_set);
     $i = $a_set["Nr"];
     // command: edit marker position
     if ($a_set["Overlay"] != "") {
         $this->tpl->setCurrentBlock("cmd");
         $this->tpl->setVariable("CMD_ID", "ov_" . $i);
         $this->tpl->setVariable("HREF_CMD", "#");
         $this->tpl->setVariable("CMD_CLASS", "ov_cmd");
         $this->tpl->setVariable("TXT_CMD", $lng->txt("cont_edit_overlay_position"));
         $this->tpl->parseCurrentBlock();
     }
     // command: edit marker position
     if ($a_set["PopupNr"] != "") {
         $this->tpl->setCurrentBlock("cmd");
         $this->tpl->setVariable("CMD_ID", "pop_" . $i);
         $this->tpl->setVariable("HREF_CMD", "#");
         $this->tpl->setVariable("CMD_CLASS", "pop_cmd");
         $this->tpl->setVariable("TXT_CMD", $lng->txt("cont_edit_popup_position"));
         $this->tpl->parseCurrentBlock();
     }
     if ($a_set["Type"] == ilPCInteractiveImage::AREA) {
         $this->tpl->setCurrentBlock("coords");
         $this->tpl->setVariable("VAL_COORDS", implode(explode(",", $this->area[$a_set["Nr"]]["Coords"]), ", "));
         $this->tpl->parseCurrentBlock();
         $this->tpl->setVariable("TYPE", $lng->txt("cont_" . $this->area[$a_set["Nr"]]["Shape"]));
     } else {
         // command: edit marker position
         $this->tpl->setCurrentBlock("cmd");
         $this->tpl->setVariable("CMD_ID", "mark_" . $i);
         $this->tpl->setVariable("HREF_CMD", "#");
         $this->tpl->setVariable("CMD_CLASS", "mark_cmd");
         $this->tpl->setVariable("TXT_CMD", $lng->txt("cont_edit_marker_position"));
         $this->tpl->parseCurrentBlock();
         // marker position
         $this->tpl->setCurrentBlock("marker_pos");
         $this->tpl->setVariable("VAR_MARK_POS", "markpos[" . $i . "]");
         $this->tpl->setVariable("ID_MARK_POS", "markpos_" . $i);
         $this->tpl->setVariable("VAL_MARK_POS", $a_set["MarkerX"] . "," . $a_set["MarkerY"]);
         $this->tpl->setVariable("TXT_MLEFT", $lng->txt("cont_left"));
         $this->tpl->setVariable("TXT_MTOP", $lng->txt("cont_top"));
         $this->tpl->parseCurrentBlock();
         $this->tpl->setVariable("TYPE", $lng->txt("cont_marker"));
     }
     $this->tpl->setVariable("CHECKBOX", ilUtil::formCheckBox("", "tr[]", $i));
     $this->tpl->setVariable("VAR_NAME", "title[" . $i . "]");
     $this->tpl->setVariable("VAL_NAME", $a_set["Title"]);
     $this->tpl->setVariable("VAR_POS", "ovpos[" . $i . "]");
     $this->tpl->setVariable("ID_OV_POS", "ovpos_" . $i);
     $this->tpl->setVariable("ID_POP_POS", "poppos_" . $i);
     $this->tpl->setVariable("VAR_POP_POS", "poppos[" . $i . "]");
     $this->tpl->setVariable("VAR_POP_SIZE", "popsize[" . $i . "]");
     $this->tpl->setVariable("VAL_POS", $a_set["OverlayX"] . "," . $a_set["OverlayY"]);
     $this->tpl->setVariable("VAL_POP_POS", $a_set["PopupX"] . "," . $a_set["PopupY"]);
     $this->tpl->setVariable("VAL_POP_SIZE", $a_set["PopupWidth"] . "," . $a_set["PopupHeight"]);
     $this->tpl->setVariable("TXT_IMG", $lng->txt("image"));
     $this->tpl->setVariable("TXT_TITLE", $lng->txt("title"));
     $this->tpl->setVariable("TXT_LEFT", $lng->txt("cont_left"));
     $this->tpl->setVariable("TXT_TOP", $lng->txt("cont_top"));
     $this->tpl->setVariable("TXT_WIDTH", $lng->txt("cont_width"));
     $this->tpl->setVariable("TXT_HEIGHT", $lng->txt("cont_height"));
     $this->tpl->setVariable("OVERLAY_IMAGE", ilUtil::formSelect($a_set["Overlay"], "ov[" . $i . "]", $this->ov_options, false, true));
     $this->tpl->setVariable("CONTENT_POPUP", ilUtil::formSelect($a_set["PopupNr"], "pop[" . $i . "]", $this->pop_options, false, true));
 }
コード例 #8
0
 function __showPermissionsCreateSection()
 {
     global $objDefinition, $ilSetting;
     // no create operation for roles/role templates in local role folders
     // access is controlled by 'administrate' (change permission settings) only
     if ($this->gui_obj->object->getType() == 'rolf' and $this->gui_obj->object->getRefId() != ROLE_FOLDER_ID) {
         return;
     }
     // create pointer to first role (only the permission list is needed)
     reset($this->roles);
     $first_role =& current($this->roles);
     if (count($first_role['permissions']['create'])) {
         $this->tpl->setCurrentBlock("perm_subtitle");
         $this->tpl->setVariable("TXT_PERM_CLASS", $this->lng->txt('perm_class_create'));
         $this->tpl->setVariable("TXT_PERM_CLASS_DESC", $this->lng->txt('perm_class_create_desc'));
         $this->tpl->setVariable("COLSPAN", $this->num_roles);
         $this->tpl->parseCurrentBlock();
         // add a checkbox 'select all' for create permissions of the following object types
         $container_arr = array('cat', 'grp', 'crs', 'fold');
         if (in_array($this->gui_obj->object->getType(), $container_arr)) {
             $chk_toggle_create = true;
         }
         foreach ($this->roles as $role) {
             $ops_ids = array();
             foreach ($role['permissions']['create'] as $perm) {
                 $ops_ids[] = $perm['ops_id'];
             }
             if ($chk_toggle_create) {
                 $this->tpl->setCurrentBlock('chk_toggle_create');
                 $this->tpl->setVariable('PERM_NAME', $this->lng->txt('check_all') . "/" . $this->lng->txt('uncheck_all'));
                 $this->tpl->setVariable('PERM_TOOLTIP', $this->lng->txt('check_all'));
                 $this->tpl->setVariable('ROLE_ID', $role['obj_id']);
                 $this->tpl->setVariable('JS_VARNAME', 'perm_' . $role['obj_id']);
                 $this->tpl->setVariable('JS_ONCLICK', ilUtil::array_php2js($ops_ids));
                 $this->tpl->parseCurrentBlock();
             }
             foreach ($role['permissions']['create'] as $perm) {
                 if ($perm["name"] == "create_icrs" and !$ilSetting->get("ilinc_active")) {
                     continue;
                 }
                 $box = ilUtil::formCheckBox($perm['checked'], "perm[" . $role["obj_id"] . "][]", $perm["ops_id"], $role["protected"]);
                 $this->tpl->setCurrentBlock("perm_item");
                 $this->tpl->setVariable("PERM_CHECKBOX", $box);
                 if ($objDefinition->isPlugin(substr($perm['name'], 7))) {
                     $this->tpl->setVariable("PERM_NAME", ilPlugin::lookupTxt("rep_robj", substr($perm['name'], 7), "obj_" . substr($perm['name'], 7)));
                     $this->tpl->setVariable("PERM_TOOLTIP", ilPlugin::lookupTxt("rep_robj", substr($perm['name'], 7), $this->gui_obj->object->getType() . "_" . $perm['name']));
                 } else {
                     $this->tpl->setVariable("PERM_NAME", $this->lng->txt("obj" . substr($perm['name'], 6)));
                     $this->tpl->setVariable("PERM_TOOLTIP", $this->lng->txt($this->gui_obj->object->getType() . "_" . $perm['name']));
                 }
                 $this->tpl->setVariable("PERM_LABEL", 'perm_' . $role['obj_id'] . '_' . $perm['ops_id']);
                 $this->tpl->parseCurrentBlock();
             }
             $this->tpl->setCurrentBlock("perm_table");
             $this->tpl->parseCurrentBlock();
         }
         $this->tpl->setCurrentBlock("perm_settings");
         $this->tpl->parseCurrentBlock();
     }
 }
コード例 #9
0
 /**
  * display roleassignment panel
  *
  * @access	public
  */
 function roleassignmentObject()
 {
     global $rbacreview, $rbacsystem, $ilUser, $ilTabs;
     $ilTabs->activateTab("role_assignment");
     if (!$rbacsystem->checkAccess("edit_roleassignment", $this->usrf_ref_id)) {
         $this->ilias->raiseError($this->lng->txt("msg_no_perm_assign_role_to_user"), $this->ilias->error_obj->MESSAGE);
     }
     $_SESSION['filtered_roles'] = isset($_POST['filter']) ? $_POST['filter'] : $_SESSION['filtered_roles'];
     if ($_SESSION['filtered_roles'] > 5) {
         $_SESSION['filtered_roles'] = 0;
     }
     $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.usr_role_assignment.html', 'Services/User');
     if (false) {
         $this->tpl->setCurrentBlock("filter");
         $this->tpl->setVariable("FILTER_TXT_FILTER", $this->lng->txt('filter'));
         $this->tpl->setVariable("SELECT_FILTER", $this->__buildFilterSelect());
         $this->tpl->setVariable("FILTER_ACTION", $this->ctrl->getFormAction($this));
         $this->tpl->setVariable("FILTER_NAME", 'roleassignment');
         $this->tpl->setVariable("FILTER_VALUE", $this->lng->txt('apply_filter'));
         $this->tpl->parseCurrentBlock();
     }
     // init table
     include_once "./Services/User/classes/class.ilRoleAssignmentTableGUI.php";
     $tab = new ilRoleAssignmentTableGUI($this, "roleassignment");
     // now get roles depending on filter settings
     $role_list = $rbacreview->getRolesByFilter($tab->filter["role_filter"], $this->object->getId());
     $assigned_roles = $rbacreview->assignedRoles($this->object->getId());
     $counter = 0;
     include_once './Services/AccessControl/classes/class.ilObjRole.php';
     $records = array();
     foreach ($role_list as $role) {
         // fetch context path of role
         $rolf = $rbacreview->getFoldersAssignedToRole($role["obj_id"], true);
         // only list roles that are not set to status "deleted"
         if ($rbacreview->isDeleted($rolf[0])) {
             continue;
         }
         // build context path
         $path = "";
         if ($this->tree->isInTree($rolf[0])) {
             if ($rolf[0] == ROLE_FOLDER_ID) {
                 $path = $this->lng->txt("global");
             } else {
                 $tmpPath = $this->tree->getPathFull($rolf[0]);
                 // count -1, to exclude the role folder itself
                 /*for ($i = 1; $i < (count($tmpPath)-1); $i++)
                 				    {
                 					    if ($path != "")
                 					    {
                 						    $path .= " > ";
                 					    }
                 
                 					    $path .= $tmpPath[$i]["title"];
                 				    }*/
                 $path = $tmpPath[count($tmpPath) - 1]["title"];
             }
         } else {
             $path = "<b>Rolefolder " . $rolf[0] . " not found in tree! (Role " . $role["obj_id"] . ")</b>";
         }
         $disabled = false;
         // disable checkbox for system role for the system user
         if ($this->object->getId() == SYSTEM_USER_ID and $role["obj_id"] == SYSTEM_ROLE_ID or !in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId())) and $role["obj_id"] == SYSTEM_ROLE_ID) {
             $disabled = true;
         }
         // protected admin role
         if ($role['obj_id'] == SYSTEM_ROLE_ID && !$rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID)) {
             include_once './Services/PrivacySecurity/classes/class.ilSecuritySettings.php';
             if (ilSecuritySettings::_getInstance()->isAdminRoleProtected()) {
                 $disabled = true;
             }
         }
         if (substr($role["title"], 0, 3) == "il_") {
             if (!$assignable) {
                 $rolf_arr = $rbacreview->getFoldersAssignedToRole($role["obj_id"], true);
                 $rolf2 = $rolf_arr[0];
             } else {
                 $rolf2 = $rolf;
             }
             $parent_node = $this->tree->getNodeData($rolf2);
             $role["description"] = $this->lng->txt("obj_" . $parent_node["type"]) . "&nbsp;(#" . $parent_node["obj_id"] . ")";
         }
         $role_ids[$counter] = $role["obj_id"];
         $result_set[$counter][] = $checkbox = ilUtil::formCheckBox(in_array($role["obj_id"], $assigned_roles), "role_id[]", $role["obj_id"], $disabled) . "<input type=\"hidden\" name=\"role_id_ctrl[]\" value=\"" . $role["obj_id"] . "\"/>";
         $this->ctrl->setParameterByClass("ilobjrolegui", "ref_id", $rolf[0]);
         $this->ctrl->setParameterByClass("ilobjrolegui", "obj_id", $role["obj_id"]);
         $result_set[$counter][] = $link = "<a href=\"" . $this->ctrl->getLinkTargetByClass("ilobjrolegui", "perm") . "\">" . ilObjRole::_getTranslation($role["title"]) . "</a>";
         $title = ilObjRole::_getTranslation($role["title"]);
         $result_set[$counter][] = $role["description"];
         // Add link to objector local Rores
         if ($role["role_type"] == "local") {
             // Get Object to the role
             $obj_id = ilRbacReview::getObjectOfRole($role["rol_id"]);
             $obj_type = ilObject::_lookupType($obj_id);
             $ref_ids = ilObject::_getAllReferences($obj_id);
             foreach ($ref_ids as $ref_id) {
             }
             require_once "./Services/Link/classes/class.ilLink.php";
             $result_set[$counter][] = $context = "<a href='" . ilLink::_getLink($ref_id, ilObject::_lookupType($obj_id)) . "' target='_top'>" . $path . "</a>";
         } else {
             $result_set[$counter][] = $path;
             $context = $path;
         }
         $records[] = array("path" => $path, "description" => $role["description"], "context" => $context, "checkbox" => $checkbox, "role" => $link, "title" => $title);
         ++$counter;
     }
     if (true) {
         $tab->setData($records);
         $this->tpl->setVariable("ROLES_TABLE", $tab->getHTML());
         return;
     }
 }
コード例 #10
0
 /**
  * Standard Version of Fill Row. Most likely to
  * be overwritten by derived class.
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl, $ilAccess;
     $area = $a_set["area"];
     $i = $a_set["nr"];
     $this->tpl->setVariable("CHECKBOX", ilUtil::formCheckBox("", "area[]", $i));
     $this->tpl->setVariable("VAR_NAME", "name_" . $i);
     $this->tpl->setVariable("VAL_NAME", $area->getTitle());
     $this->tpl->setVariable("VAL_SHAPE", $area->getShape());
     $this->tpl->setVariable("VAL_HIGHL_MODE", ilUtil::formSelect($area->getHighlightMode(), "hl_mode_" . $i, $this->highl_modes, false, true));
     $this->tpl->setVariable("VAL_HIGHL_CLASS", ilUtil::formSelect($area->getHighlightClass(), "hl_class_" . $i, $this->highl_classes, false, true));
     $this->tpl->setVariable("VAL_COORDS", implode(explode(",", $area->getCoords()), ", "));
     switch ($area->getLinkType()) {
         case "ext":
             $this->tpl->setVariable("VAL_LINK", $area->getHRef());
             break;
         case "int":
             $link_str = $this->parent_obj->getMapAreaLinkString($area->getTarget(), $area->getType(), $area->getTargetFrame());
             $this->tpl->setVariable("VAL_LINK", $link_str);
             break;
     }
 }