public function currenciesObject()
 {
     $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment');
     $currency_res = ilPaymentCurrency::_getAvailableCurrencies();
     // currency table
     $counter = 0;
     foreach ($currency_res as $cur) {
         $f_result[$counter]['currency_id'] = ilUtil::formRadioButton(0, 'currency_id', $cur['currency_id']);
         $f_result[$counter]['is_default'] = $cur['is_default'] == 1 ? $this->lng->txt('yes') : $this->lng->txt('no');
         $f_result[$counter]['currency_unit'] = $cur['unit'];
         $f_result[$counter]['iso_code'] = $cur['iso_code'];
         $f_result[$counter]['currency_symbol'] = $cur['symbol'];
         $f_result[$counter]['conversion_rate'] = $cur['conversion_rate'];
         $counter++;
     }
     $tbl = new ilShopTableGUI($this);
     $tbl->setTitle($this->lng->txt("currencies"));
     $tbl->setId('tbl_show_currencies');
     $tbl->setRowTemplate("tpl.shop_currencies_row.html", "Services/Payment");
     $tbl->addColumn(' ', 'currency_id', '1%', true);
     $tbl->addColumn($this->lng->txt('is_default'), 'is_default', '5%');
     $tbl->addColumn($this->lng->txt('currency_unit'), 'currency_unit', '10%');
     $tbl->addColumn($this->lng->txt('iso_code'), 'iso_code', '20%');
     $tbl->addColumn($this->lng->txt('currency_symbol'), 'currency_symbol', '20%');
     $tbl->addColumn($this->lng->txt('conversion_rate'), 'conversion_rate', '15%');
     $tbl->addColumn('', 'options', '5%');
     $this->ctrl->setParameter($this, 'cmd', 'currencies');
     $tbl->addMultiCommand('updateDefaultCurrency', $this->lng->txt('paya_set_default_currency'));
     $tbl->addMultiCommand("editCurrency", $this->lng->txt('edit'));
     $tbl->addMultiCommand("deleteCurrency", $this->lng->txt('delete'));
     $tbl->addCommandButton('addCurrency', $this->lng->txt('add_currency'));
     $tbl->setData($f_result);
     $this->tpl->setVariable('TABLE', $tbl->getHTML());
     return true;
 }
 /**
  * displays form in which the member-status can be changed
  * @access public
  */
 function changeMemberObject()
 {
     global $rbacreview, $ilUser;
     $this->__setSubTabs('members');
     $member_ids = array();
     if (isset($_POST['user_id'])) {
         $member_ids = $_POST['user_id'];
     } else {
         if (isset($_GET['mem_id'])) {
             $member_ids[0] = $_GET['mem_id'];
         } else {
             if (isset($_GET['mem_id_arr'])) {
                 $member_ids = explode(',', $_GET['mem_id_arr']);
             }
         }
     }
     if (empty($member_ids[0])) {
         $this->ilErr->raiseError($this->lng->txt('no_checkbox'), $this->ilErr->MESSAGE);
     }
     if (!$rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID) && !in_array($ilUser->getId(), $this->object->getAdminIds())) {
         $this->ilErr->raiseError($this->lng->txt('grp_err_no_permission'), $this->ilErr->MESSAGE);
     }
     $stati = array_flip($this->object->getLocalRoles(true));
     // fetch docent or student assignment form all coursemembers from iLinc server
     $docent_ids = $this->object->getiLincMemberIds(true);
     $student_ids = $this->object->getiLincMemberIds(false);
     $data = array();
     //build data structure
     foreach ($member_ids as $member_id) {
         $member = ilObjectFactory::getInstanceByObjId($member_id);
         $mem_status = $this->object->getMemberRoles($member_id);
         include_once 'Modules/ILinc/classes/class.ilObjiLincUser.php';
         $ilinc_user = new ilObjiLincUser($member);
         $ilinc_status = $this->object->checkiLincMemberStatus($ilinc_user->id, $docent_ids, $student_ids);
         $docent = 0;
         $student = 0;
         if ($ilinc_status == ILINC_MEMBER_DOCENT) {
             $docent = 1;
         } else {
             if ($ilinc_status == ILINC_MEMBER_STUDENT) {
                 $student = 1;
             }
         }
         $radio1 = ilUtil::formRadioButton($docent, 'ilinc_member_status_select[' . $member->getId() . '][' . $ilinc_user->id . ']', ILINC_MEMBER_DOCENT);
         $radio2 = ilUtil::formRadioButton($student, 'ilinc_member_status_select[' . $member->getId() . '][' . $ilinc_user->id . ']', ILINC_MEMBER_STUDENT);
         $data[$member->getId()] = array('login' => $member->getLogin(), 'firstname' => $member->getFirstname(), 'lastname' => $member->getLastname(), 'attending_as' => $radio1 . ' ' . $this->lng->txt('ilinc_docent') . '<br />' . $radio2 . ' ' . $this->lng->txt('ilinc_student'), 'grp_role' => ilUtil::formSelect($mem_status, 'member_status_select[' . $member->getId() . '][]', $stati, true, true, 3));
     }
     unset($member);
     unset($ilinc_user);
     include_once 'Modules/ILinc/classes/class.iliLinkMembersTableGUI.php';
     $this->ctrl->setParameter($this, 'mem_id_arr', implode(',', $member_ids));
     $oTable = new iliLinkMembersTableGUI($this, $data, 'change', 'changeMember', 'changeMember');
     $oTable->setTitle($this->lng->txt('grp_mem_change_status'), 'icon_usr_b.png', $this->lng->txt('grp_mem_change_status'));
     return $this->tpl->setContent($oTable->getHTML());
 }
 protected function fillRow($a_data)
 {
     $this->tpl->setVariable("PERCENTAGE", $a_data["percentage"] . "%");
     $this->tpl->setVariable("VAL_CHKBOX", ilUtil::formRadioButton((int) $a_data['input']['checked'], $a_data['input']['name'], $a_data["input"]["value"]));
     $this->tpl->setVariable("SOURCE", $a_data["source"]["link"] ? "<a href=\"" . $a_data["source"]["link"] . "\" target=\"_blank\">" . $a_data["source"]["title"] . "</a>" : "<span>" . $a_data["source"]["title"] . "</span>");
     $this->tpl->parseCurrentBlock();
 }
 /**
 add users
 */
 function searchUserForm()
 {
     global $rbacsystem;
     $this->lng->loadLanguageModule('search');
     // MINIMUM ACCESS LEVEL = 'administrate'
     if (!$rbacsystem->checkAccess("write", $this->ref_id)) {
         $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"), $this->ilias->error_obj->MESSAGE);
     }
     $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.grp_members_search.html", "Modules/Group");
     $this->tpl->setVariable("F_ACTION", $this->ctrl->getFormAction($this));
     $this->tpl->setVariable("SEARCH_ASSIGN_USR", $this->lng->txt("grp_search_members"));
     $this->tpl->setVariable("SEARCH_SEARCH_TERM", $this->lng->txt("search_search_term"));
     $this->tpl->setVariable("SEARCH_VALUE", $_SESSION["grp_search_str"] ? $_SESSION["grp_search_str"] : "");
     $this->tpl->setVariable("SEARCH_FOR", $this->lng->txt("exc_search_for"));
     $this->tpl->setVariable("SEARCH_ROW_TXT_USER", $this->lng->txt("exc_users"));
     $this->tpl->setVariable("SEARCH_ROW_TXT_ROLE", $this->lng->txt("exc_roles"));
     $this->tpl->setVariable("SEARCH_ROW_TXT_GROUP", $this->lng->txt("exc_groups"));
     $this->tpl->setVariable("BTN2_VALUE", $this->lng->txt("cancel"));
     $this->tpl->setVariable("BTN1_VALUE", $this->lng->txt("search"));
     $usr = $_POST["search_for"] == "usr" || $_POST["search_for"] == "" ? 1 : 0;
     $grp = $_POST["search_for"] == "grp" ? 1 : 0;
     $role = $_POST["search_for"] == "role" ? 1 : 0;
     $this->tpl->setVariable("SEARCH_ROW_CHECK_USER", ilUtil::formRadioButton($usr, "search_for", "usr"));
     $this->tpl->setVariable("SEARCH_ROW_CHECK_ROLE", ilUtil::formRadioButton($role, "search_for", "role"));
     $this->tpl->setVariable("SEARCH_ROW_CHECK_GROUP", ilUtil::formRadioButton($grp, "search_for", "grp"));
 }
 public function buildFormItem($a_node_id, $a_type)
 {
     if (!array_key_exists($a_type, $this->form_items) || !$this->form_items[$a_type]) {
         return '';
     }
     switch ($this->type) {
         case self::SEL_TYPE_CHECK:
             return ilUtil::formCheckbox((int) $this->isItemChecked($a_node_id), $this->post_var, $a_node_id);
             break;
         case self::SEL_TYPE_RADIO:
             return ilUtil::formRadioButton((int) $this->isItemChecked($a_node_id), $this->post_var, $a_node_id, "document.getElementById('map').submit(); return false;");
             break;
     }
 }
 protected function adoptPermObject()
 {
     global $rbacreview;
     $output = array();
     $parent_role_ids = $rbacreview->getParentRoleIds($this->rolf_ref_id, true);
     $ids = array();
     foreach ($parent_role_ids as $id => $tmp) {
         $ids[] = $id;
     }
     // Sort ids
     $sorted_ids = ilUtil::_sortIds($ids, 'object_data', 'type,title', 'obj_id');
     $key = 0;
     foreach ($sorted_ids as $id) {
         $par = $parent_role_ids[$id];
         if ($par["obj_id"] != SYSTEM_ROLE_ID && $this->object->getId() != $par["obj_id"]) {
             $radio = ilUtil::formRadioButton(0, "adopt", $par["obj_id"]);
             $output["adopt"][$key]["css_row_adopt"] = $key % 2 == 0 ? "tblrow1" : "tblrow2";
             $output["adopt"][$key]["check_adopt"] = $radio;
             $output["adopt"][$key]["role_id"] = $par["obj_id"];
             $output["adopt"][$key]["type"] = $par["type"] == 'role' ? $this->lng->txt('obj_role') : $this->lng->txt('obj_rolt');
             $output["adopt"][$key]["role_name"] = ilObjRole::_getTranslation($par["title"]);
             $output["adopt"][$key]["role_desc"] = $par["desc"];
             $key++;
         }
     }
     $output["formaction_adopt"] = $this->ctrl->getFormAction($this);
     $output["message_middle"] = $this->lng->txt("adopt_perm_from_template");
     $tpl = new ilTemplate("tpl.adm_copy_role.html", true, true, "Services/AccessControl");
     $tpl->setCurrentBlock("ADOPT_PERM_ROW");
     foreach ($output["adopt"] as $key => $value) {
         $tpl->setVariable("CSS_ROW_ADOPT", $value["css_row_adopt"]);
         $tpl->setVariable("CHECK_ADOPT", $value["check_adopt"]);
         $tpl->setVariable("LABEL_ID", $value["role_id"]);
         $tpl->setVariable("TYPE", $value["type"]);
         $tpl->setVariable("ROLE_NAME", $value["role_name"]);
         if (strlen($value['role_desc'])) {
             $tpl->setVariable('ROLE_DESC', $value['role_desc']);
         }
         $tpl->parseCurrentBlock();
     }
     $tpl->setVariable("TPLPATH", $this->tpl->tplPath);
     $tpl->setVariable("MESSAGE_MIDDLE", $output["message_middle"]);
     $tpl->setVariable("FORMACTION_ADOPT", $output["formaction_adopt"]);
     $tpl->setVariable("ADOPT", $this->lng->txt('copy'));
     $tpl->setVariable("CANCEL", $this->lng->txt('cancel'));
     $tpl->setVariable('HEAD_ROLE', $this->lng->txt('title'));
     $tpl->setVariable('HEAD_TYPE', $this->lng->txt('type'));
     $this->tpl->setContent($tpl->get());
 }
 public function buildFormItem($a_node_id, $a_type)
 {
     if (!array_key_exists($a_type, $this->form_items) || !$this->form_items[$a_type]) {
         return '';
     }
     $disabled = false;
     if (is_array($_SESSION["clipboard"]["ref_ids"])) {
         $disabled = in_array($a_node_id, $_SESSION["clipboard"]["ref_ids"]);
     } else {
         if ((int) $_SESSION["clipboard"]["ref_ids"]) {
             $disabled = $a_node_id == $_SESSION["clipboard"]["ref_ids"];
         } else {
             if ($_SESSION["clipboard"]["cmd"] == 'copy' && $a_node_id == $_SESSION["clipboard"]["parent"]) {
                 $disabled = true;
             }
         }
     }
     switch ($this->type) {
         case self::SEL_TYPE_CHECK:
             return ilUtil::formCheckbox((int) $this->isItemChecked($a_node_id), $this->post_var, $a_node_id, $disabled);
             break;
         case self::SEL_TYPE_RADIO:
             return ilUtil::formRadioButton((int) $this->isItemChecked($a_node_id), $this->post_var, $a_node_id, '', $disabled);
             break;
     }
 }
 function showBarometer()
 {
     global $ilUser;
     include_once 'Services/Feedback/classes/class.ilFeedback.php';
     $ilfeedback = new ilFeedback();
     $ilfeedback->setRefId($_GET['ref_id']);
     $feedbacks = $ilfeedback->getAllBarometer();
     //There can be more then 1 Barometer for a ref_id so we show show always only the first_vote_best
     //Barometer a user can vote, the next time he acceses this page, he will get the next barometer a.s.o.
     foreach ($feedbacks as $feedback) {
         //Show only if there is no vote yet or enough time has passed since the last vote
         if ($feedback->getId() && $feedback->canVote($ilUser->getId(), $feedback->getId()) == 1) {
             $tpl = new ilTemplate("tpl.feedback_vote.html", true, true, "Services/Feedback");
             $tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this) . '&fb_id=' . $feedback->getId());
             $tpl->setVariable("TXT_TITLE", $feedback->getTitle());
             $tpl->setVariable("TXT_DESCRIPTION", $feedback->getDescription());
             $votes = unserialize($feedback->getVotes());
             $checked = 1;
             foreach ($votes as $vote => $votetext) {
                 $radios .= ilUtil::formRadioButton($checked, 'vote', $vote) . $votetext . '<br>';
                 $checked = 0;
             }
             $tpl->setVariable("TXT_SAVE", $this->lng->txt('save_vote'));
             $tpl->setVariable("RADIO_VOTES", $radios);
             if ($feedback->getTextAnswer()) {
                 $tpl->setCurrentBlock("text_answer");
                 $tpl->setVariable("TXT_NOTE", $this->lng->txt('note'));
             }
             $tpl->parseCurrentBlock();
             return $tpl->get();
         }
     }
 }
 /**
  * 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();
 }
 /**
  * Shows $results in a table
  *
  * @param array $results
  * @access public
  */
 public function showFileSearchResult($results = null)
 {
     global $tree;
     if (!$results && isset($_SESSION['contents']['search_result'])) {
         // this is for table sorting
         $results = $_SESSION['contents']['search_result'];
     }
     if (!$results) {
         return $this->showAddContent();
     }
     include_once 'Services/Table/classes/class.ilTable2GUI.php';
     $this->tabs->activateTab('contents');
     $table = new ilTable2GUI($this, 'showFileSearchResult');
     $table->setLimit(2147483647);
     $table->setTitle($this->txt('files'));
     $table->setDefaultOrderField('path');
     $table->addColumn('', '', '1%', true);
     $table->addColumn($this->txt('title'), 'title', '30%');
     $table->addColumn($this->lng->txt('path'), 'path', '70%');
     $table->setFormAction($this->ctrl->getFormAction($this, 'addContentFromILIAS'));
     $table->setRowTemplate('tpl.content_file_row.html', $this->pluginObj->getDirectory());
     $table->setId('xavc_cs_' . $this->object->getId());
     $table->setPrefix('xavc_cs_' . $this->object->getId());
     $table->addCommandButton('addContentFromILIAS', $this->txt('add'));
     $table->addCommandButton('cancelSearchContentFile', $this->txt('cancel'));
     $data = array();
     $i = 0;
     foreach ($results as $file_id) {
         $title = ilObject::_lookupTitle($file_id);
         $file_ref = array_shift(ilObject::_getAllReferences($file_id));
         $path_arr = $tree->getPathFull($file_ref);
         $counter = 0;
         $path = '';
         foreach ($path_arr as $element) {
             if ($counter++) {
                 $path .= " > ";
                 $path .= $element['title'];
             } else {
                 $path .= $this->lng->txt('repository');
             }
         }
         $data[$i]['check_box'] = ilUtil::formRadioButton(0, 'file_id', $file_id);
         $data[$i]['title'] = $title;
         $data[$i]['path'] = $path;
         ++$i;
     }
     $table->setData($data);
     $this->tpl->setContent($table->getHTML());
 }
 public function buildFormItem($a_node_id, $a_type)
 {
     if (!array_key_exists($a_type, $this->form_items) || !$this->form_items[$a_type]) {
         return;
     }
     switch ($this->type) {
         case self::SEL_TYPE_CHECK:
             return ilUtil::formCheckbox((int) $this->isItemChecked($a_node_id), $this->post_var, $a_node_id);
         case self::SEL_TYPE_RADIO:
             return ilUtil::formRadioButton((int) $this->isItemChecked($a_node_id), $this->post_var, $a_node_id);
     }
 }
 public function buildFormItem($a_node_id, $a_type)
 {
     global $ilObjDataCache, $ilAccess;
     if (!array_key_exists($a_type, $this->form_items) || !$this->form_items[$a_type]) {
         return '';
     }
     if ($ilObjDataCache->lookupObjId($a_node_id) == $this->getExcludeObjId()) {
         return '';
     }
     if (!$ilAccess->checkAccess('moderate_frm', '', $a_node_id)) {
         return '';
     }
     return ilUtil::formRadioButton((int) $this->isItemChecked($a_node_id), $this->post_var, $a_node_id);
 }
 /**
  * @param ilForumTopic $thread
  */
 public function fillRow(ilForumTopic $thread)
 {
     /**
      * @var $ilUser ilObjUser
      */
     global $ilUser;
     $this->ctrl->setParameter($this->getParentObject(), 'thr_pk', $thread->getId());
     if ('mergeThreads' == $this->parent_cmd) {
         $checked = $this->max_count == 1 || isset($_POST['thread_ids']) && in_array($thread->getId(), $_POST['thread_ids']);
         $this->tpl->setVariable('VAL_CHECK', ilUtil::formRadioButton($checked, 'thread_ids[]', $thread->getId()));
     } else {
         if ('showThreads' == $this->parent_cmd) {
             $this->tpl->setVariable('VAL_CHECK', ilUtil::formCheckbox(isset($_POST['thread_ids']) && in_array($thread->getId(), $_POST['thread_ids']) ? true : false, 'thread_ids[]', $thread->getId()));
         } else {
             if ($thread->isSticky()) {
                 $this->tpl->setVariable('VAL_SORTING_NAME', 'thread_sorting[' . $thread->getId() . ']');
                 $this->tpl->setVariable('VAL_SORTING', (int) $this->position * 10);
             } else {
                 $this->tpl->setVariable('VAL_CHECK', '');
             }
             $this->position++;
         }
     }
     $subject = '';
     if ($thread->isSticky()) {
         $subject .= '<span class="light">[' . $this->lng->txt('sticky') . ']</span> ';
     }
     if ($thread->isClosed()) {
         $subject .= '<span class="light">[' . $this->lng->txt('topic_close') . ']</span> ';
     }
     if (!$ilUser->isAnonymous() && $this->ilias->getSetting('forum_notification') != 0 && $thread->getUserNotificationEnabled()) {
         $subject .= '<span class="light">[' . $this->lng->txt('forums_notification_enabled') . ']</span> ';
     }
     $num_posts = $thread->getNumPosts();
     $num_unread = $thread->getNumUnreadPosts();
     $num_new = $thread->getNumNewPosts();
     if ($num_posts > 0) {
         $subject = '<div><a href="' . $this->ctrl->getLinkTarget($this->getParentObject(), 'viewThread') . '">' . $thread->getSubject() . '</a></div>' . $subject;
     } else {
         $subject = $thread->getSubject() . $subject;
     }
     $this->tpl->setVariable('VAL_SUBJECT', $subject);
     // Author
     $this->ctrl->setParameter($this->getParentObject(), 'backurl', urlencode($this->ctrl->getLinkTargetByClass("ilrepositorygui", "")));
     $this->ctrl->setParameter($this->getParentObject(), 'user', $thread->getUserId());
     $authorinfo = new ilForumAuthorInformation($thread->getUserId(), $thread->getUserAlias(), $thread->getImportName(), array('class' => 'il_ItemProperty', 'href' => $this->ctrl->getLinkTarget($this->getParentObject(), 'showUser')));
     $this->tpl->setVariable('VAL_AUTHOR', $authorinfo->getLinkedAuthorName());
     $topicStats = $num_posts;
     if (!$ilUser->isAnonymous()) {
         if ($num_unread > 0) {
             $topicStats .= '<br /><span class="alert ilWhiteSpaceNowrap">' . $this->lng->txt('unread') . ': ' . $num_unread . '</span>';
         }
         if ($num_new > 0 && $this->getOverviewSetting() == 0) {
             $topicStats .= '<br /><span class="alert ilWhiteSpaceNowrap">' . $this->lng->txt('new') . ': ' . $num_new . '</span>';
         }
     }
     $this->tpl->setVariable('VAL_ARTICLE_STATS', $topicStats);
     $this->tpl->setVariable('VAL_NUM_VISIT', $thread->getVisits());
     // Last posting
     if ($num_posts > 0) {
         if ($this->getIsModerator()) {
             $objLastPost = $thread->getLastPost();
         } else {
             $objLastPost = $thread->getLastActivePost();
         }
         if (is_object($objLastPost)) {
             $authorinfo = new ilForumAuthorInformation($objLastPost->getUserId(), $objLastPost->getUserAlias(), $objLastPost->getImportName(), array('href' => $this->ctrl->getLinkTarget($this->getParentObject(), 'viewThread') . '#' . $objLastPost->getId()));
             $this->tpl->setVariable('VAL_LP_DATE', '<div class="ilWhiteSpaceNowrap">' . ilDatePresentation::formatDate(new ilDateTime($objLastPost->getCreateDate(), IL_CAL_DATETIME)) . '</div>' . '<div class="ilWhiteSpaceNowrap">' . $this->lng->txt('from') . ' ' . $authorinfo->getLinkedAuthorName() . '</div>');
         }
     }
     // Row style
     $css_row = $this->css_row;
     if ($thread->isSticky()) {
         $css_row = $css_row == 'tblrow1' ? 'tblstickyrow1' : 'tblstickyrow2';
     }
     $this->tpl->setVariable('CSS_ROW', $css_row);
     $this->ctrl->setParameter($this->getParentObject(), 'thr_pk', '');
     $this->ctrl->setParameter($this->getParentObject(), 'user', '');
     $this->ctrl->setParameter($this->getParentObject(), 'backurl', '');
 }
 public function showDetails()
 {
     global $ilMainMenu, $ilTabs, $ilToolbar, $ilUser;
     $this->__initPaymentObject();
     $this->__initPricesObject();
     $this->__initShoppingCartObject();
     $ilToolbar->addButton($this->lng->txt('payment_back_to_shop'), 'ilias.php?baseClass=ilShopController');
     $this->tpl->getStandardTemplate();
     $ilTabs->setTabActive('buy');
     $ilMainMenu->setActive('shop');
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.pay_purchase_details.html', 'Services/Payment');
     if ($this->pobject->getStatus() == $this->pobject->STATUS_EXPIRES) {
         ilUtil::sendInfo($this->lng->txt('pay_expires_info'));
         return false;
     }
     $extension_prices = array();
     if ($ilUser->getId() != ANONYMOUS_USER_ID) {
         include_once './Services/Payment/classes/class.ilPaymentBookings.php';
         $has_extension_price = ilPaymentBookings::_hasAccesstoExtensionPrice($ilUser->getId(), $this->pobject->getPobjectId());
         if ($has_extension_price) {
             $extension_prices = $this->price_obj->getExtensionPrices();
         }
     }
     $org_prices = $this->price_obj->getPrices();
     $tmp_prices = array_merge($org_prices, $extension_prices);
     $prices = array();
     foreach ($tmp_prices as $price) {
         // expired prices must be filtered out
         if ($price['price_type'] == ilPaymentPrices::TYPE_DURATION_DATE && $price['duration_until'] < date('Y-m-d')) {
             //do nothing
         } else {
             $prices[] = $price;
         }
     }
     $buyedObject = "";
     if ($this->sc_obj->isInShoppingCart($this->pobject->getPobjectId())) {
         $buyedObject = $this->sc_obj->getEntry($this->pobject->getPobjectId());
         if (is_array($prices) && count($prices) > 1) {
             ilUtil::sendInfo($this->lng->txt('pay_item_already_in_sc_choose_another'));
         } else {
             ilUtil::sendInfo($this->lng->txt('pay_item_already_in_sc'));
         }
         $this->tpl->setCurrentBlock("shopping_cart_1");
         $this->tpl->setVariable("LINK_GOTO_SHOPPING_CART", 'ilias.php?baseClass=ilShopController&cmd=redirect&redirect_class=ilShopShoppingCartGUI');
         $this->tpl->setVariable("TXT_GOTO_SHOPPING_CART", $this->lng->txt('pay_goto_shopping_cart'));
         $this->tpl->parseCurrentBlock("shopping_cart_1");
     }
     $this->ctrl->setParameter($this, "ref_id", $this->pobject->getRefId());
     $subtype = '';
     if ($this->object) {
         if ($this->object->getType() == 'exc') {
             $subtype = ' (' . $this->lng->txt($this->pobject->getSubtype()) . ')';
         }
         $this->tpl->setVariable("DETAILS_FORMACTION", $this->ctrl->getFormAction($this));
         $this->tpl->setVariable("TYPE_IMG", ilUtil::getImagePath('icon_' . $this->object->getType() . '_b.png'));
         $this->tpl->setVariable("ALT_IMG", $this->lng->txt('obj_' . $this->object->getType()));
         $this->tpl->setVariable("TITLE", $this->object->getTitle() . ' ' . $subtype);
     } else {
         $this->tpl->setVariable("DETAILS_FORMACTION", $this->ctrl->getFormAction($this));
         $this->tpl->setVariable("TITLE", $this->lng->txt('object_not_found'));
     }
     // payment infos
     $this->tpl->setVariable("TXT_INFO", $this->lng->txt('info'));
     $this->tpl->setVariable("INFO_PAY", $this->lng->txt('pay_info'));
     if (is_array($buyedObject)) {
         if (is_array($prices) && count($prices) > 1) {
             $this->tpl->setVariable("INPUT_CMD", 'addToShoppingCart');
             $this->tpl->setVariable("INPUT_VALUE", $this->lng->txt('pay_change_price'));
         } else {
             $this->tpl->setVariable("INPUT_CMD", 'addToShoppingCart');
             $this->tpl->setVariable("INPUT_VALUE", $this->lng->txt('pay_add_to_shopping_cart'));
         }
     } else {
         $this->tpl->setVariable("INPUT_CMD", 'addToShoppingCart');
         $this->tpl->setVariable("INPUT_VALUE", $this->lng->txt('pay_add_to_shopping_cart'));
     }
     $this->tpl->setVariable("ROWSPAN", count($prices));
     $this->tpl->setVariable("TXT_PRICES", $this->lng->txt('prices'));
     if (is_array($prices)) {
         $counter = 0;
         foreach ($prices as $price) {
             if ($counter == 0) {
                 $placeholderCheckbox = "CHECKBOX";
                 $placeholderDuration = "DURATION";
                 $placeholderPrice = "PRICE";
                 $placeholderDescription = "DESCRIPTION";
             } else {
                 $placeholderCheckbox = "ROW_CHECKBOX";
                 $placeholderDuration = "ROW_DURATION";
                 $placeholderPrice = "ROW_PRICE";
                 $placeholderDescription = "ROW_DESCRIPTION";
             }
             $this->tpl->setCurrentBlock("price_row");
             if ($buyedObject["price_id"] == $price['price_id']) {
                 $this->tpl->setVariable($placeholderCheckbox, ilUtil::formRadioButton(1, 'price_id', $price['price_id']));
             } else {
                 if (count($prices) == 1) {
                     $this->tpl->setVariable($placeholderCheckbox, ilUtil::formRadioButton(1, 'price_id', $price['price_id']));
                 } else {
                     $this->tpl->setVariable($placeholderCheckbox, ilUtil::formRadioButton(0, 'price_id', $price['price_id']));
                 }
             }
             switch ($price['price_type']) {
                 case ilPaymentPrices::TYPE_DURATION_MONTH:
                     $this->tpl->setVariable($placeholderDuration, $price['duration'] . ' ' . $this->lng->txt('paya_months') . ': ');
                     break;
                 case ilPaymentPrices::TYPE_DURATION_DATE:
                     ilDatePresentation::setUseRelativeDates(false);
                     $this->tpl->setVariable($placeholderDuration, 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:
                     $this->tpl->setVariable($placeholderDuration, $this->lng->txt('unlimited_duration') . ': ');
                     break;
             }
             $tmp_price = $price['price'];
             if ($price['extension'] == 1) {
                 $extension_txt = '(' . $this->lng->txt('extension_price') . ')';
             } else {
                 $extension_txt = '';
             }
             $this->tpl->setVariable($placeholderPrice, ilPaymentPrices::_formatPriceToString((double) $tmp_price) . ' ' . $extension_txt);
             if ($price['description'] != NULL) {
                 $this->tpl->setVariable($placeholderDescription, $price['description']);
             }
             $this->tpl->parseCurrentBlock();
             $counter++;
         }
     }
     return true;
 }
 public function buildFormItem($a_node_id, $a_type)
 {
     if (!array_key_exists($a_type, $this->form_items) || !$this->form_items[$a_type]) {
         return '';
     }
     include_once './Services/WebServices/ECS/classes/Tree/class.ilECSCmsData.php';
     $status = ilECSCmsData::lookupStatusByObjId($this->server_id, $this->mid, $this->tree_id, $a_node_id);
     if ($status == ilECSCmsData::MAPPING_DELETED) {
         return ilUtil::formCheckbox((int) $this->isItemChecked($a_node_id), $this->post_var, $a_node_id, true);
     }
     switch ($this->type) {
         case self::SEL_TYPE_CHECK:
             return ilUtil::formCheckbox((int) $this->isItemChecked($a_node_id), $this->post_var, $a_node_id);
             break;
         case self::SEL_TYPE_RADIO:
             return ilUtil::formRadioButton((int) $this->isItemChecked($a_node_id), $this->post_var, $a_node_id);
             break;
     }
 }
 /**
  * show sorting settings
  *
  * @access protected
  */
 protected function showSortingSettings()
 {
     $this->tpl->setVariable('TXT_SORTING', $this->lng->txt('sorting_header'));
     $this->tpl->setVariable('TXT_SORT_TITLE', $this->lng->txt('sorting_title_header'));
     $this->tpl->setVariable('INFO_SORT_TITLE', $this->lng->txt('sorting_info_title'));
     $this->tpl->setVariable('TXT_SORT_MANUAL', $this->lng->txt('sorting_manual_header'));
     $this->tpl->setVariable('INFO_SORT_MANUAL', $this->lng->txt('sorting_info_manual'));
     include_once 'Services/Container/classes/class.ilContainerSortingSettings.php';
     if ($this->getCreationMode()) {
         $settings = new ilContainerSortingSettings(0);
     } else {
         $settings = new ilContainerSortingSettings($this->object->getId());
     }
     $this->tpl->setVariable('RADIO_SORT_TITLE', ilUtil::formRadioButton($settings->getSortMode() == ilContainer::SORT_TITLE, 'sorting', ilContainer::SORT_TITLE));
     $this->tpl->setVariable('RADIO_SORT_MANUAL', ilUtil::formRadioButton($settings->getSortMode() == ilContainer::SORT_MANUAL, 'sorting', ilContainer::SORT_MANUAL));
 }