/**
  *	Fill a table row.
  *
  *	This method is called internally by ilias to
  *	fill a table row according to the row template.
  *
  *	@param stdClass $item
  */
 protected function fillRow(stdClass $item)
 {
     /* Configure template rendering. */
     $this->tpl->setVariable('VAL_CHECKBOX', ilUtil::formCheckbox(false, 'test_ids[]', $item->ref_id));
     $this->tpl->setVariable('OBJECT_TITLE', $item->title);
     $this->tpl->setVariable('OBJECT_INFO', $this->getTestPath($item));
 }
 protected function fillRow($a_data)
 {
     $this->tpl->setVariable("PERCENTAGE", $a_data["percentage"] . "%");
     $this->tpl->setVariable("VAL_CHKBOX", ilUtil::formCheckbox((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();
 }
 /**
  * @param array $row
  */
 public function fillRow(array $row)
 {
     /**
      * @var $ilCtrl ilCtrl
      */
     global $ilCtrl;
     if ($this->getParentObject()->isCRUDContext()) {
         $row['chb'] = ilUtil::formCheckbox(false, 'unit_ids[]', $row['unit_id']);
         $sequence = new ilNumberInputGUI('', 'sequence[' . $row['unit_id'] . ']');
         $sequence->setValue($this->position++ * 10);
         $sequence->setMinValue(0);
         $sequence->setSize(3);
         $row['sequence'] = $sequence->render();
         $action = new ilAdvancedSelectionListGUI();
         $action->setId('asl_content_' . $row['unit_id']);
         $action->setAsynch(false);
         $action->setListTitle($this->lng->txt('actions'));
         $ilCtrl->setParameter($this->getParentObject(), 'unit_id', $row['unit_id']);
         $action->addItem($this->lng->txt('edit'), '', $ilCtrl->getLinkTarget($this->getParentObject(), 'showUnitModificationForm'));
         $action->addItem($this->lng->txt('delete'), '', $ilCtrl->getLinkTarget($this->getParentObject(), 'confirmDeleteUnit'));
         $ilCtrl->setParameter($this->getParentObject(), 'unit_id', '');
         $row['actions'] = $action->getHtml();
     }
     if ($row['unit_id'] == $row['baseunit_id']) {
         $row['baseunit'] = '';
     }
     parent::fillRow($row);
 }
 /**
  * @param array $row
  * @return array
  */
 protected function prepareRow(array &$row)
 {
     if ((int) $row['user_id']) {
         $this->ctrl->setParameter($this->parent_obj, 'usr_id', '');
         if ($row['user_id'] == $this->parent_obj->object->getOwner()) {
             $row['checkbox'] = ilUtil::formCheckbox(false, 'usr_id[]', $row['user_id'], true);
         } else {
             $row['checkbox'] = ilUtil::formCheckbox(false, 'usr_id[]', $row['user_id'], (int) $row['user_id'] ? false : true);
         }
     } else {
         $row['checkbox'] = '';
     }
     $user_name = '';
     if (strlen($row['lastname']) > 0) {
         $user_name .= $row['lastname'] . ', ';
     }
     if (strlen($row['firstname']) > 0) {
         $user_name .= $row['firstname'];
     }
     $row['user_name'] = $user_name;
     if ($row['xavc_status']) {
         $xavc_options = array("host" => $this->parent_obj->pluginObj->txt("presenter"), "mini-host" => $this->parent_obj->pluginObj->txt("moderator"), "view" => $this->parent_obj->pluginObj->txt("participant"), "denied" => $this->parent_obj->pluginObj->txt("denied"));
         if ($row['xavc_status']) {
             if ($row['user_id'] == $this->parent_obj->object->getOwner()) {
                 $row['xavc_status'] = $this->lng->txt("owner");
             } else {
                 $row['xavc_status'] = ilUtil::formSelect($row['xavc_status'], 'xavc_status[' . $row['user_id'] . ']', $xavc_options);
             }
         } else {
             $row['xavc_status'] = $this->parent_obj->pluginObj->txt('user_only_exists_at_ac_server');
         }
     }
 }
 /**
  *    Fill a table row.
  *
  *    This method is called internally by ilias to
  *    fill a table row according to the row template.
  *
  * @param stdClass $container
  * @internal param \ilObjTest $test
  *
  */
 protected function fillRow(stdClass $container)
 {
     $members = $this->getMembersObject($container)->getCountMembers();
     $label = $this->lng->txt('rep_robj_xtov_membership_count_members');
     $this->tpl->setVariable('VAL_CHECKBOX', ilUtil::formCheckbox(false, 'membership_ids[]', $container->obj_id));
     $this->tpl->setVariable('OBJECT_TITLE', $container->title);
     $this->tpl->setVariable('OBJECT_INFO', sprintf("%d %s", $members, $label));
     $this->tpl->setVariable('OBJECT_IMG_PATH', $this->isAddedContainer($container) ? ilUtil::getImagePath('icon_ok.svg') : ilUtil::getImagePath('icon_not_ok.svg'));
 }
 /**
  * @param array $file_data
  */
 protected function fillRow(array $file_data)
 {
     /**
      * We need to encode this because of filenames with the following format: "anystring".txt (with ")
      */
     $this->tpl->setVariable('VAL_CHECKBOX', ilUtil::formCheckbox($file_data['checked'], 'filename[]', urlencode($file_data['filename'])));
     $this->tpl->setVariable('VAL_FILENAME', $this->formatValue('filename', $file_data['filename']));
     $this->tpl->setVariable('VAL_FILESIZE', $this->formatValue('filesize', $file_data['filesize']));
     $this->tpl->setVariable('VAL_FILECREATEDATE', $this->formatValue('filecreatedate', $file_data['filecreatedate']));
 }
 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;
     }
 }
 /**
  * @param array $row
  * @return array
  */
 protected function prepareRow(array &$row)
 {
     if ((int) $row['user_id']) {
         //			$action = new ilAdvancedSelectionListGUI();
         //			$action->setId('asl_' . $row['user_id']);
         //			$action->setListTitle($this->lng->txt('actions'));
         //			$this->ctrl->setParameter($this->parent_obj, 'user_id', $row['user_id']);
         $this->ctrl->setParameter($this->parent_obj, 'usr_id', '');
         //			$row['actions']  = $action->getHtml();
         if ($row['user_id'] == $this->parent_obj->object->getOwner()) {
             $row['checkbox'] = ilUtil::formCheckbox(false, 'usr_id[]', $row['user_id'], true);
         } else {
             $row['checkbox'] = ilUtil::formCheckbox(false, 'usr_id[]', $row['user_id'], (int) $row['user_id'] ? false : true);
         }
     } else {
         //			$row['actions'] = '';
         $row['checkbox'] = '';
     }
     $user_name = '';
     if (strlen($row['lastname']) > 0) {
         $user_name .= $row['lastname'] . ', ';
     }
     if (strlen($row['firstname']) > 0) {
         $user_name .= $row['firstname'];
     }
     $row['user_name'] = $user_name;
     if ($row['xavc_status']) {
         $xavc_options = array("host" => $this->parent_obj->pluginObj->txt("presenter"), "mini-host" => $this->parent_obj->pluginObj->txt("moderator"), "view" => $this->parent_obj->pluginObj->txt("participant"), "denied" => $this->parent_obj->pluginObj->txt("denied"));
         //			$user_status = ilXAVCMembers::_lookupStatus($row['user_id'], $this->parent_obj->object->getRefId());
         if ($row['xavc_status']) {
             if ($row['user_id'] == $this->parent_obj->object->getOwner()) {
                 $row['xavc_status'] = $this->lng->txt("owner");
             } else {
                 $row['xavc_status'] = ilUtil::formSelect($row['xavc_status'], 'xavc_status[' . $row['user_id'] . ']', $xavc_options);
             }
         } else {
             $row['xavc_status'] = $this->parent_obj->pluginObj->txt('user_only_exists_at_ac_server');
         }
     }
 }
 /**
  * @param array $row
  */
 public function fillRow(array $row)
 {
     /**
      * @var $ilCtrl ilCtrl
      */
     global $ilCtrl;
     $row['chb'] = ilUtil::formCheckbox(false, 'category_ids[]', $row['category_id']);
     $action = new ilAdvancedSelectionListGUI();
     $action->setId('asl_content_' . $row['category_id']);
     $action->setAsynch(false);
     $action->setListTitle($this->lng->txt('actions'));
     $ilCtrl->setParameter($this->getParentObject(), 'category_id', $row['category_id']);
     $action->addItem($this->lng->txt('un_show_units'), '', $ilCtrl->getLinkTarget($this->getParentObject(), 'showUnitsOfCategory'));
     if ($this->getParentObject()->isCRUDContext()) {
         $action->addItem($this->lng->txt('edit'), '', $ilCtrl->getLinkTarget($this->getParentObject(), 'showUnitCategoryModificationForm'));
         $action->addItem($this->lng->txt('delete'), '', $ilCtrl->getLinkTarget($this->getParentObject(), 'confirmDeleteCategory'));
     } else {
         $action->addItem($this->lng->txt('import'), '', $ilCtrl->getLinkTarget($this->getParentObject(), 'confirmImportGlobalCategory'));
     }
     $row['title_href'] = $ilCtrl->getLinkTarget($this->getParentObject(), 'showUnitsOfCategory');
     $ilCtrl->setParameter($this->getParentObject(), 'category_id', '');
     $row['actions'] = $action->getHtml();
     parent::fillRow($row);
 }
 function editAppliedUsersObject()
 {
     global $rbacsystem;
     if (!$rbacsystem->checkAccess("write", $this->ref_id)) {
         $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"), $this->ilias->error_obj->MESSAGE);
     }
     $this->lng->loadLanguageModule('crs');
     $_POST['users'] = $_SESSION['applied_users'] = $_SESSION['applied_users'] ? $_SESSION['applied_users'] : $_POST['users'];
     if (!isset($_SESSION['error_post_vars'])) {
         ilUtil::sendInfo($this->lng->txt('time_limit_add_time_limit_for_selected'));
     }
     if (!count($_POST["users"])) {
         ilUtil::sendFailure($this->lng->txt("time_limit_no_users_selected"));
         $this->appliedUsersObject();
         return false;
     }
     $counter = 0;
     foreach ($_POST['users'] as $usr_id) {
         if ($counter) {
             $title .= ', ';
         }
         $tmp_user =& ilObjectFactory::getInstanceByObjId($usr_id);
         $title .= $tmp_user->getLogin();
         ++$counter;
     }
     if (strlen($title) > 79) {
         $title = substr($title, 0, 80);
         $title .= '...';
     }
     $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.usr_edit_applied_users.html", "Services/User");
     $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
     // LOAD SAVED DATA IN CASE OF ERROR
     $time_limit_unlimited = $_SESSION["error_post_vars"]["au"]["time_limit_unlimited"] ? 1 : 0;
     $time_limit_start = $_SESSION["error_post_vars"]["au"]["time_limit_start"] ? $this->__toUnix($_SESSION["error_post_vars"]["au"]["time_limit_start"]) : time();
     $time_limit_end = $_SESSION["error_post_vars"]["au"]["time_limit_end"] ? $this->__toUnix($_SESSION["error_post_vars"]["au"]["time_limit_end"]) : time();
     // SET TEXT VARIABLES
     $this->tpl->setVariable("ALT_IMG", $this->lng->txt("obj_usr"));
     $this->tpl->setVariable("TYPE_IMG", ilUtil::getImagePath("icon_usr_b.png"));
     $this->tpl->setVariable("TITLE", $title);
     $this->tpl->setVariable("TXT_TIME_LIMIT", $this->lng->txt("time_limit"));
     $this->tpl->setVariable("TXT_TIME_LIMIT_START", $this->lng->txt("crs_start"));
     $this->tpl->setVariable("TXT_TIME_LIMIT_END", $this->lng->txt("crs_end"));
     $this->tpl->setVariable("CMD_SUBMIT", "updateAppliedUsers");
     $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
     $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt("submit"));
     $this->tpl->setVariable("SELECT_TIME_LIMIT_START_DAY", $this->__getDateSelect("day", "au[time_limit_start][day]", date("d", $time_limit_start)));
     $this->tpl->setVariable("SELECT_TIME_LIMIT_START_MONTH", $this->__getDateSelect("month", "au[time_limit_start][month]", date("m", $time_limit_start)));
     $this->tpl->setVariable("SELECT_TIME_LIMIT_START_YEAR", $this->__getDateSelect("year", "au[time_limit_start][year]", date("Y", $time_limit_start)));
     $this->tpl->setVariable("SELECT_TIME_LIMIT_START_HOUR", $this->__getDateSelect("hour", "au[time_limit_start][hour]", date("G", $time_limit_start)));
     $this->tpl->setVariable("SELECT_TIME_LIMIT_START_MINUTE", $this->__getDateSelect("minute", "au[time_limit_start][minute]", date("i", $time_limit_start)));
     $this->tpl->setVariable("SELECT_TIME_LIMIT_END_DAY", $this->__getDateSelect("day", "au[time_limit_end][day]", date("d", $time_limit_end)));
     $this->tpl->setVariable("SELECT_TIME_LIMIT_END_MONTH", $this->__getDateSelect("month", "au[time_limit_end][month]", date("m", $time_limit_end)));
     $this->tpl->setVariable("SELECT_TIME_LIMIT_END_YEAR", $this->__getDateSelect("year", "au[time_limit_end][year]", date("Y", $time_limit_end)));
     $this->tpl->setVariable("SELECT_TIME_LIMIT_END_HOUR", $this->__getDateSelect("hour", "au[time_limit_end][hour]", date("G", $time_limit_end)));
     $this->tpl->setVariable("SELECT_TIME_LIMIT_END_MINUTE", $this->__getDateSelect("minute", "au[time_limit_end][minute]", date("i", $time_limit_end)));
     if ($this->ilias->account->getTimeLimitUnlimited()) {
         $this->tpl->setVariable("ROWSPAN", 3);
         $this->tpl->setCurrentBlock("unlimited");
         $this->tpl->setVariable("TXT_TIME_LIMIT_UNLIMITED", $this->lng->txt("crs_unlimited"));
         $this->tpl->setVariable("TIME_LIMIT_UNLIMITED", ilUtil::formCheckbox($time_limit_unlimited, "au[time_limit_unlimited]", 1));
         $this->tpl->parseCurrentBlock();
     } else {
         $this->tpl->setVariable("ROWSPAN", 2);
     }
 }
 public function mailMembersObject()
 {
     global $rbacreview, $ilObjDataCache;
     include_once 'Services/AccessControl/classes/class.ilObjRole.php';
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_members.html', 'Services/Contact');
     $this->__setSubTabs('members');
     include_once "./Services/Link/classes/class.ilLink.php";
     $link_to_seminar = ilLink::_getLink($this->object->getRefId());
     include_once 'Services/Mail/classes/class.ilMail.php';
     require_once 'Services/Mail/classes/class.ilMailFormCall.php';
     $this->tpl->setVariable("MAILACTION", ilMailFormCall::getLinkTarget($this, 'mailMembers', array(), array('type' => 'role')));
     $this->tpl->setVariable('ADDITIONAL_MESSAGE_TEXT', $link_to_seminar);
     $this->tpl->setVariable('IMG_ARROW', ilUtil::getImagePath('arrow_downright.png'));
     $this->tpl->setVariable('OK', $this->lng->txt('ok'));
     $role_folder = $rbacreview->getRoleFolderOfObject($this->object->getRefId());
     $role_ids = $rbacreview->getRolesOfRoleFolder($role_folder['ref_id'], false);
     foreach ($role_ids as $role_id) {
         $this->tpl->setCurrentBlock('mailbox_row');
         $role_addr = $rbacreview->getRoleMailboxAddress($role_id);
         $this->tpl->setVariable('CHECK_MAILBOX', ilUtil::formCheckbox(1, 'roles[]', htmlspecialchars($role_addr)));
         if (ilMail::_usePearMail()) {
             // if pear mail is enabled, mailbox addresses are already localized in the language of the user
             $this->tpl->setVariable('MAILBOX', $role_addr);
         } else {
             // if pear mail is not enabled, we need to localize mailbox addresses in the language of the user
             $this->tpl->setVariable('MAILBOX', ilObjRole::_getTranslation($ilObjDataCache->lookupTitle($role_id)) . ' (' . $role_addr . ')');
         }
         $this->tpl->parseCurrentBlock();
     }
 }
 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::formDisabledRadioButton((int) $this->isItemChecked($a_node_id), $this->post_var, $a_node_id, $disabled);
             break;
     }
 }
 function view()
 {
     global $ilAccess, $ilErr;
     // MINIMUM ACCESS LEVEL = 'write'
     if (!$ilAccess->checkAccess("read", '', $this->course_obj->getRefId())) {
         $ilErr->raiseError($this->lng->txt('msg_no_perm_write'), $ilErr->MESSAGE);
     }
     $this->is_tutor = $ilAccess->checkAccess('write', '', $this->course_obj->getRefId());
     $this->download_allowed = ($this->is_tutor or $this->course_obj->getArchiveType() == $this->course_obj->ARCHIVE_DOWNLOAD);
     $this->course_obj->initCourseArchiveObject();
     $this->course_obj->archives_obj->initCourseFilesObject();
     $archives = $this->is_tutor ? $this->course_obj->archives_obj->getArchives() : $this->course_obj->archives_obj->getPublicArchives();
     require_once "./Services/Table/classes/class.ilTableGUI.php";
     $tbl = new ilTableGUI();
     $this->__showArchivesMenu();
     $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
     $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.crs_archives_row.html", 'Modules/Course');
     $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
     $tbl->setTitle($this->lng->txt("crs_header_archives"));
     if ($this->download_allowed or $this->is_tutor) {
         $header_names = array('', $this->lng->txt("type"), $this->lng->txt("crs_file_name"), $this->lng->txt("crs_size"), $this->lng->txt("crs_create_date"), $this->lng->txt("crs_archive_lang"));
         $header_vars = array("", "type", "name", "size", "date", "lang");
         $column_width = array("1%", "9%", "30%", "20%", "20%", "20%");
         $this->tpl->setVariable("COLUMN_COUNTS", 6);
     } else {
         $header_names = array($this->lng->txt("type"), $this->lng->txt("crs_file_name"), $this->lng->txt("crs_create_date"), $this->lng->txt("crs_size"), $this->lng->txt("crs_archive_lang"));
         $header_vars = array("type", "name", "date", "size", "lang");
         $column_width = array("10%", "30%", "20%", "20%", "20%");
         $this->tpl->setVariable("COLUMN_COUNTS", 5);
     }
     $tbl->setHeaderNames($header_names);
     $tbl->setHeaderVars($header_vars, array("ref_id" => $this->course_obj->getRefId(), "cmd" => "view", "cmdClass" => strtolower(get_class($this))));
     $tbl->setColumnWidth($column_width);
     // control
     $tbl->setOrderColumn($_GET["sort_by"]);
     $tbl->setOrderDirection($_GET["sort_order"]);
     $tbl->setLimit($_GET["limit"]);
     $tbl->setOffset($_GET["offset"]);
     $tbl->disable("sort");
     if ($this->download_allowed) {
         $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.png"));
         if ($this->is_tutor) {
             // delete
             $this->tpl->setCurrentBlock("tbl_action_btn");
             $this->tpl->setVariable("BTN_NAME", "confirmDeleteArchives");
             $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("delete"));
             $this->tpl->parseCurrentBlock();
         }
         // download
         $this->tpl->setCurrentBlock("tbl_action_btn");
         $this->tpl->setVariable("BTN_NAME", "downloadArchives");
         $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("download"));
         $this->tpl->parseCurrentBlock();
     }
     $tbl->setFooter("tblfooter", $this->lng->txt("previous"), $this->lng->txt("next"));
     $tbl->setMaxCount(count($archives));
     $archives = array_slice($archives, $_GET['offset'], $_GET['limit']);
     $tbl->render();
     if (!count($archives)) {
         $this->tpl->setCurrentBlock("notfound");
         $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
         $this->tpl->setVariable("NUM_COLS", 6);
         $this->tpl->parseCurrentBlock();
     }
     $counter = 0;
     foreach ($archives as $archive_data) {
         $this->tpl->setCurrentBlock("tbl_content");
         $this->tpl->setVariable("CSS_ROW", ilUtil::switchColor($counter++, 'tblrow1', 'tblrow2'));
         if ($this->download_allowed) {
             $this->tpl->setVariable("VAL_CHECK", ilUtil::formCheckbox(0, "archives[]", $archive_data['archive_id']));
         }
         // Type
         switch ($archive_data["archive_type"]) {
             case $this->course_obj->archives_obj->ARCHIVE_XML:
                 $type = $this->lng->txt("crs_xml");
                 break;
             case $this->course_obj->archives_obj->ARCHIVE_HTML:
                 $type = $this->lng->txt("crs_html");
                 break;
             case $this->course_obj->archives_obj->ARCHIVE_PDF:
                 $type = $this->lng->txt("crs_pdf");
                 break;
         }
         $this->tpl->setVariable("VAL_TYPE", $type);
         // Name
         if ($archive_data['archive_type'] == $this->course_obj->archives_obj->ARCHIVE_HTML) {
             $link = '<a href="' . $this->course_obj->archives_obj->course_files_obj->getOnlineLink($archive_data['archive_name']) . '"' . ' target="_blank">' . $archive_data["archive_name"] . '</a>';
         } else {
             $link = $archive_data['archive_name'];
         }
         $this->tpl->setVariable("VAL_NAME", $link);
         $this->tpl->setVariable("VAL_SIZE", $archive_data['archive_size']);
         $this->tpl->setVariable('VAL_DATE', ilDatePresentation::formatDate(new ilDateTime($archive_data['archive_name'], IL_CAL_UNIX)));
         if ($archive_data["archive_lang"]) {
             $this->tpl->setVariable("VAL_LANG", $this->lng->txt('lang_' . $archive_data["archive_lang"]));
         } else {
             $this->tpl->setVariable("VAL_LANG", $this->lng->txt('crs_not_available'));
         }
         $this->tpl->parseCurrentBlock();
     }
     $this->tpl->parseCurrentBlock();
 }
 public function vatsObject()
 {
     global $ilAccess;
     if (!$ilAccess->checkAccess('read', '', $this->object->getRefId())) {
         $this->ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $this->ilErr->MESSAGE);
     }
     include_once 'Services/Table/classes/class.ilTable2GUI.php';
     $tbl = new ilTable2GUI($this, 'vats');
     $tbl->setId('pay_vats_tbl');
     $tbl->setFormAction($this->ctrl->getFormAction($this), 'createVat');
     $tbl->setTitle($this->lng->txt('payment_tax_rates'));
     $tbl->setRowTemplate('tpl.shop_vats_list_row.html', 'Services/Payment');
     $tbl->setDefaultOrderField('title');
     $tbl->addColumn('', 'check', '1%');
     $tbl->addColumn($this->lng->txt('vat_title'), 'vat_title', '33%');
     $tbl->addColumn($this->lng->txt('vat_rate'), 'vat_rate', '33%');
     $tbl->addColumn('', 'commands', '33%');
     $oShopVatsList = new ilShopVatsList();
     $oShopVatsList->read();
     $result = array();
     $_SESSION['count_vats'] = $oShopVatsList->getNumItems();
     if ($oShopVatsList->hasItems()) {
         $tbl->enable('select_all');
         $tbl->setSelectAllCheckbox('vat_id');
         $counter = 0;
         foreach ($oShopVatsList as $oVAT) {
             $result[$counter]['check'] = ilUtil::formCheckbox(0, 'vat_id[]', $oVAT->getId());
             $result[$counter]['vat_title'] = $oVAT->getTitle();
             $result[$counter]['vat_rate'] = ilShopUtils::_formatVAT((double) $oVAT->getRate());
             $this->ctrl->setParameter($this, 'vat_id', $oVAT->getId());
             $result[$counter]['edit_text'] = $this->lng->txt('edit');
             $result[$counter]['edit_url'] = $this->ctrl->getLinkTarget($this, 'editVat');
             $result[$counter]['delete_text'] = $this->lng->txt('delete');
             $result[$counter]['delete_url'] = $this->ctrl->getLinkTarget($this, 'confirmDeleteVat');
             $this->ctrl->clearParameters($this);
             ++$counter;
         }
         $tbl->addMultiCommand('confirmDeleteVat', $this->lng->txt('delete'));
     } else {
         $tbl->disable('header');
         $tbl->disable('footer');
         $tbl->setNoEntriesText($this->lng->txt('paya_no_vats_assigned'));
     }
     $tbl->setData($result);
     $tbl->addCommandButton('createVat', $this->lng->txt('paya_insert_vats'));
     $this->tpl->setContent($tbl->getHTML());
     return true;
 }
 /**
  * Show list of export files
  *
  * @access public
  * 
  */
 public function show($a_deliver_file = false)
 {
     $this->showFileList();
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.member_export.html', 'Modules/Course');
     $this->tpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this));
     $this->tpl->setVariable('TXT_EXPORT_SETTINGS', $this->lng->txt('ps_export_settings'));
     $this->tpl->setVariable('TXT_USER_SELECTION', $this->lng->txt('ps_user_selection'));
     $this->tpl->setVariable('TXT_EXPORT_ADMIN', $this->lng->txt('ps_export_admin'));
     $this->tpl->setVariable('TXT_EXPORT_MEMBER', $this->lng->txt('ps_export_member'));
     $this->tpl->setVariable('TXT_EXPORT_WAIT', $this->lng->txt('ps_export_wait'));
     $this->tpl->setVariable('TXT_EXPORT_SUB', $this->lng->txt('ps_export_sub'));
     // Check user selection
     $this->exportSettings = new ilUserFormSettings('memexp');
     $this->tpl->setVariable('CHECK_EXPORT_ADMIN', ilUtil::formCheckbox($this->exportSettings->enabled('admin'), 'export_members[admin]', 1));
     if ($this->type == 'crs') {
         $this->tpl->setVariable('CHECK_EXPORT_TUTOR', ilUtil::formCheckbox($this->exportSettings->enabled('tutor'), 'export_members[tutor]', 1));
         $this->tpl->setVariable('TXT_EXPORT_TUTOR', $this->lng->txt('ps_export_tutor'));
     }
     $this->tpl->setVariable('CHECK_EXPORT_MEMBER', ilUtil::formCheckbox($this->exportSettings->enabled('member'), 'export_members[member]', 1));
     $this->tpl->setVariable('CHECK_EXPORT_SUB', ilUtil::formCheckbox($this->exportSettings->enabled('subscribers'), 'export_members[subscribers]', 1));
     $this->tpl->setVariable('CHECK_EXPORT_WAIT', ilUtil::formCheckbox($this->exportSettings->enabled('waiting_list'), 'export_members[waiting_list]', 1));
     $this->tpl->setVariable('TXT_EXPORT', $this->lng->txt('ps_perform_export'));
     $this->tpl->setVariable('TXT_EXPORT_EXCEL', $this->lng->txt('ps_export_excel'));
     // User Data
     $this->tpl->setVariable('TXT_USER_DATA_SELECTION', $this->lng->txt('ps_export_data'));
     $this->tpl->setVariable('TXT_EXPORT_USER_DATA_HEADER', $this->lng->txt('ps_export_user_data'));
     include_once './Services/Booking/classes/class.ilBookingEntry.php';
     if (ilBookingEntry::hasObjectBookingEntries($this->obj_id, $GLOBALS['ilUser']->getId())) {
         $this->tpl->setCurrentBlock('consultation');
         $this->lng->loadLanguageModule('dateplaner');
         $this->tpl->setVariable('TXT_CH', $this->lng->txt('cal_ch_field_ch'));
         $this->tpl->setVariable('TXT_EXPORT_CH', $this->lng->txt('cal_ch_export_apps'));
         $this->tpl->setVariable('CHECK_EXPORT_CH', ilUtil::formCheckbox($this->exportSettings->enabled('consultation_hour'), 'export_members[consultation_hour]', 1));
         $this->tpl->parseCurrentBlock();
     }
     $fields = $this->fields_info->getFieldsInfo();
     foreach ($fields as $field => $exportable) {
         if (!$exportable) {
             continue;
         }
         $this->tpl->setCurrentBlock('user_data_row');
         $this->tpl->setVariable('CHECK_EXPORT_USER_DATA', ilUtil::formCheckbox($this->exportSettings->enabled($field), 'export_members[' . $field . ']', 1));
         $this->tpl->setVariable('TXT_EXPORT_USER_DATA', $this->lng->txt($field));
         $this->tpl->parseCurrentBlock();
     }
     $udf = ilUserDefinedFields::_getInstance();
     foreach ($exp = $udf->getExportableFields($this->obj_id) as $field_id => $udf_data) {
         $this->tpl->setCurrentBlock('user_data_row');
         $this->tpl->setVariable('CHECK_EXPORT_USER_DATA', ilUtil::formCheckbox($this->exportSettings->enabled('udf_' . $field_id), 'export_members[udf_' . $field_id . ']', 1));
         $this->tpl->setVariable('TXT_EXPORT_USER_DATA', $udf_data['field_name']);
         $this->tpl->parseCurrentBlock();
     }
     $cdf_fields = ilCourseDefinedFieldDefinition::_getFields($this->obj_id);
     foreach ($cdf_fields as $field_obj) {
         $this->tpl->setCurrentBlock('cdf_row');
         $this->tpl->setVariable('CHECK_CDF_DATA', ilUtil::formCheckbox($this->exportSettings->enabled('cdf_' . $field_obj->getId()), 'export_members[cdf_' . $field_obj->getId() . ']', 1));
         $this->tpl->setVariable('TXT_CDF_NAME', $field_obj->getName());
         $this->tpl->parseCurrentBlock();
     }
     if (count($cdf_fields)) {
         $this->tpl->setCurrentBlock('cdf_fields');
         $this->tpl->setVariable('TXT_CDF_SELECTION', $this->lng->txt('ps_' . $this->type . '_user_fields'));
         $this->tpl->parseCurrentBlock();
     }
     if ($a_deliver_file and 0) {
         $this->tpl->setCurrentBlock('iframe');
         $this->tpl->setVariable('SOURCE', $this->ctrl->getLinkTarget($this, 'deliverData'));
     }
 }
 function listUsersGroup()
 {
     global $rbacsystem, $rbacreview, $tree;
     $_SESSION["grp_group"] = $_POST["group"] = $_POST["group"] ? $_POST["group"] : $_SESSION["grp_group"];
     // 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);
     }
     if (!is_array($_POST["group"])) {
         ilUtil::sendFailure($this->lng->txt("grp_no_groups_selected"));
         $this->searchObject();
         return false;
     }
     $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.grp_usr_selection.html", "Modules/Group");
     $this->__showButton("searchUserForm", $this->lng->txt("grp_new_search"));
     // GET ALL MEMBERS
     $members = array();
     foreach ($_POST["group"] as $group_id) {
         if (!$tree->isInTree($group_id)) {
             continue;
         }
         if (!($tmp_obj = ilObjectFactory::getInstanceByRefId($group_id))) {
             continue;
         }
         $members = array_merge($tmp_obj->getGroupMemberIds(), $members);
         unset($tmp_obj);
     }
     $members = array_unique($members);
     // FORMAT USER DATA
     $counter = 0;
     $f_result = array();
     foreach ($members as $user) {
         if (!($tmp_obj = ilObjectFactory::getInstanceByObjId($user, false))) {
             continue;
         }
         $user_ids[$counter] = $user;
         $f_result[$counter][] = ilUtil::formCheckbox(0, "user[]", $user);
         $f_result[$counter][] = $tmp_obj->getLogin();
         $f_result[$counter][] = $tmp_obj->getLastname();
         $f_result[$counter][] = $tmp_obj->getFirstname();
         $f_result[$counter][] = ilFormat::formatDate($tmp_obj->getLastLogin());
         unset($tmp_obj);
         ++$counter;
     }
     $this->__showSearchUserTable($f_result, $user_ids, "listUsersGroup");
     return true;
 }
 public function showResults()
 {
     global $lng, $ilUser, $rbacreview, $ilObjDataCache;
     $form = $this->initSearchForm();
     $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.mail_search.html", "Services/Contact");
     $this->tpl->setVariable("ACTION", $this->ctrl->getFormAction($this));
     $this->tpl->setTitle($this->lng->txt("mail"));
     $this->tpl->setVariable('SEARCHFORM', $form->getHtml());
     // #14109
     if (strlen($_SESSION['mail_search_search']) < 3) {
         if ($_GET["ref"] != "wsp") {
             $this->tpl->show();
         }
         return;
     }
     $abook = new ilAddressbook($ilUser->getId());
     $entries = $abook->searchUsers(addslashes(urldecode($_SESSION['mail_search_search'])));
     // remove all contacts who are not registered users for personal workspace
     if ($_GET["ref"] == "wsp") {
         foreach ($entries as $idx => $entry) {
             if (!$entry["login"]) {
                 unset($entries[$idx]);
             }
         }
     }
     if (count($entries)) {
         $tbl_addr = new ilTable2GUI($this);
         $tbl_addr->setTitle($lng->txt('mail_addressbook'));
         $tbl_addr->setRowTemplate('tpl.mail_search_addr_row.html', 'Services/Contact');
         $result = array();
         $counter = 0;
         foreach ($entries as $entry) {
             if ($_GET["ref"] != "wsp") {
                 $result[$counter]['check'] = ilUtil::formCheckbox(0, 'search_name_to_addr[]', $entry['login'] ? $entry['login'] : $entry['email']) . ilUtil::formCheckbox(0, 'search_name_cc[]', $entry['login'] ? $entry['login'] : $entry['email']) . ilUtil::formCheckbox(0, 'search_name_bcc[]', $entry['login'] ? $entry['login'] : $entry['email']);
             } else {
                 $user_id = ilObjUser::_loginExists($entry["login"]);
                 $result[$counter]['check'] = ilUtil::formCheckbox(0, 'search_name_to_addr[]', $user_id);
             }
             $result[$counter]['login'] = $entry['login'];
             $result[$counter]['firstname'] = $entry['firstname'];
             $result[$counter]['lastname'] = $entry['lastname'];
             $id = ilObjUser::_lookupId($entry['login']);
             if (ilObjUser::_lookupPref($id, 'public_email') == 'y' || !$entry['login']) {
                 $has_mail_addr = true;
                 $result[$counter]['email'] = $entry['email'];
             }
             ++$counter;
         }
         if ($_GET["ref"] != "wsp") {
             $tbl_addr->addColumn($this->lng->txt('mail_to') . '/' . $this->lng->txt('cc') . '/' . $this->lng->txt('bc'), 'check', '10%');
         } else {
             $tbl_addr->addColumn("", "", "1%");
         }
         $tbl_addr->addColumn($this->lng->txt('login'), 'login', "15%");
         $tbl_addr->addColumn($this->lng->txt('firstname'), 'firstname', "15%");
         $tbl_addr->addColumn($this->lng->txt('lastname'), 'lastname', "15%");
         if ($has_mail_addr) {
             foreach ($result as $key => $val) {
                 if ($val['email'] == '') {
                     $result[$key]['email'] = '&nbsp;';
                 }
             }
             $tbl_addr->addColumn($this->lng->txt('email'), 'email', "15%");
         }
         $tbl_addr->setData($result);
         $tbl_addr->setDefaultOrderField('login');
         $tbl_addr->setPrefix('addr_');
         $tbl_addr->enable('select_all');
         $tbl_addr->setSelectAllCheckbox('search_name_to_addr');
         $tbl_addr->setFormName('recipients');
         $this->tpl->setVariable('TABLE_ADDR', $tbl_addr->getHTML());
     }
     include_once 'Services/Search/classes/class.ilQueryParser.php';
     include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
     include_once 'Services/Search/classes/class.ilSearchResult.php';
     $all_results = new ilSearchResult();
     $query_parser = new ilQueryParser(addcslashes($_SESSION['mail_search_search'], '%_'));
     $query_parser->setCombination(QP_COMBINATION_AND);
     $query_parser->setMinWordLength(3);
     $query_parser->parse();
     $user_search =& ilObjectSearchFactory::_getUserSearchInstance($query_parser);
     $user_search->enableActiveCheck(true);
     $user_search->setFields(array('login'));
     $result_obj = $user_search->performSearch();
     $all_results->mergeEntries($result_obj);
     $user_search->setFields(array('firstname'));
     $result_obj = $user_search->performSearch();
     $all_results->mergeEntries($result_obj);
     $user_search->setFields(array('lastname'));
     $result_obj = $user_search->performSearch();
     $all_results->mergeEntries($result_obj);
     $all_results->setMaxHits(100000);
     $all_results->preventOverwritingMaxhits(true);
     $all_results->filter(ROOT_FOLDER_ID, true);
     // Filter users (depends on setting in user accounts)
     include_once 'Services/User/classes/class.ilUserFilter.php';
     $users = ilUserFilter::getInstance()->filter($all_results->getResultIds());
     if (count($users)) {
         $tbl_users = new ilTable2GUI($this);
         $tbl_users->setTitle($lng->txt('system') . ': ' . $lng->txt('persons'));
         $tbl_users->setRowTemplate('tpl.mail_search_users_row.html', 'Services/Contact');
         $result = array();
         $counter = 0;
         foreach ($users as $user) {
             $login = ilObjUser::_lookupLogin($user);
             if ($_GET["ref"] != "wsp") {
                 $result[$counter]['check'] = ilUtil::formCheckbox(0, 'search_name_to_usr[]', $login) . ilUtil::formCheckbox(0, 'search_name_cc[]', $login) . ilUtil::formCheckbox(0, 'search_name_bcc[]', $login);
             } else {
                 $result[$counter]['check'] = ilUtil::formCheckbox(0, 'search_name_to_usr[]', $user);
             }
             $result[$counter]['login'] = $login;
             if (in_array(ilObjUser::_lookupPref($user, 'public_profile'), array('y', "g"))) {
                 $name = ilObjUser::_lookupName($user);
                 $result[$counter]['firstname'] = $name['firstname'];
                 $result[$counter]['lastname'] = $name['lastname'];
             } else {
                 $result[$counter]['firstname'] = '';
                 $result[$counter]['lastname'] = '';
             }
             if (ilObjUser::_lookupPref($user, 'public_email') == 'y') {
                 $has_mail_usr = true;
                 $result[$counter]['email'] = ilObjUser::_lookupEmail($user);
             }
             ++$counter;
         }
         if ($_GET["ref"] != "wsp") {
             $tbl_users->addColumn($this->lng->txt('mail_to') . '/' . $this->lng->txt('cc') . '/' . $this->lng->txt('bc'), 'check', '10%');
         } else {
             $tbl_users->addColumn("", "", "1%");
         }
         $tbl_users->addColumn($this->lng->txt('login'), 'login', '15%');
         $tbl_users->addColumn($this->lng->txt('firstname'), 'firstname', '15%');
         $tbl_users->addColumn($this->lng->txt('lastname'), 'lastname', '15%');
         if ($has_mail_usr == true) {
             foreach ($result as $key => $val) {
                 if ($val['email'] == '') {
                     $result[$key]['email'] = '&nbsp;';
                 }
             }
             $tbl_users->addColumn($this->lng->txt('email'), 'email', '15%');
         }
         $tbl_users->setData($result);
         $tbl_users->setDefaultOrderField('login');
         $tbl_users->setPrefix('usr_');
         $tbl_users->enable('select_all');
         $tbl_users->setSelectAllCheckbox('search_name_to_usr');
         $tbl_users->setFormName('recipients');
         $this->tpl->setVariable('TABLE_USERS', $tbl_users->getHTML());
     }
     include_once 'Services/Search/classes/class.ilQueryParser.php';
     include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
     include_once 'Services/Search/classes/class.ilSearchResult.php';
     include_once 'Services/Membership/classes/class.ilParticipants.php';
     $group_results = new ilSearchResult();
     $query_parser = new ilQueryParser(addcslashes($_SESSION['mail_search_search'], '%_'));
     $query_parser->setCombination(QP_COMBINATION_AND);
     $query_parser->setMinWordLength(3);
     $query_parser->parse();
     $search = ilObjectSearchFactory::_getObjectSearchInstance($query_parser);
     $search->setFilter(array('grp'));
     $result = $search->performSearch();
     $group_results->mergeEntries($result);
     $group_results->setMaxHits(PHP_INT_MAX);
     $group_results->preventOverwritingMaxhits(true);
     $group_results->setRequiredPermission('read');
     $group_results->filter(ROOT_FOLDER_ID, true);
     $visible_groups = array();
     if ($group_results->getResults()) {
         $tbl_grp = new ilTable2GUI($this);
         $tbl_grp->setTitle($lng->txt('system') . ': ' . $lng->txt('groups'));
         $tbl_grp->setRowTemplate('tpl.mail_search_groups_row.html', 'Services/Contact');
         $result = array();
         $counter = 0;
         $ilObjDataCache->preloadReferenceCache(array_keys($group_results->getResults()));
         $groups = $group_results->getResults();
         foreach ($groups as $grp) {
             if (!ilParticipants::hasParticipantListAccess($grp['obj_id'])) {
                 continue;
             }
             if ($_GET["ref"] != "wsp") {
                 $members = array();
                 $roles = $rbacreview->getAssignableChildRoles($grp['ref_id']);
                 foreach ($roles as $role) {
                     if (substr($role['title'], 0, 14) == 'il_grp_member_' || substr($role['title'], 0, 13) == 'il_grp_admin_') {
                         // does not work if Pear is enabled and Mailbox Address contain special chars!!
                         //array_push($members, $rbacreview->getRoleMailboxAddress($role['obj_id']));
                         // FIX for Mantis: 7523
                         array_push($members, '#' . $role['title']);
                     }
                 }
                 $str_members = implode(',', $members);
                 $result[$counter]['check'] = ilUtil::formCheckbox(0, 'search_name_to_grp[]', $str_members) . ilUtil::formCheckbox(0, 'search_name_cc[]', $str_members) . ilUtil::formCheckbox(0, 'search_name_bcc[]', $str_members);
             } else {
                 $result[$counter]['check'] = ilUtil::formCheckbox(0, 'search_name_to_grp[]', $grp['obj_id']);
             }
             $result[$counter]['title'] = $ilObjDataCache->lookupTitle($grp['obj_id']);
             $result[$counter]['description'] = $ilObjDataCache->lookupDescription($grp['obj_id']);
             ++$counter;
             $visible_groups[] = $grp;
         }
         if ($visible_groups) {
             $tbl_grp->setData($result);
             if ($_GET["ref"] != "wsp") {
                 $tbl_grp->addColumn($this->lng->txt('mail_to') . '/' . $this->lng->txt('cc') . '/' . $this->lng->txt('bc'), 'check', '10%');
             } else {
                 $tbl_grp->addColumn("", "", "1%");
             }
             $tbl_grp->addColumn($this->lng->txt('title'), 'title', '15%');
             $tbl_grp->addColumn($this->lng->txt('description'), 'description', '15%');
             $tbl_grp->setDefaultOrderField('title');
             $tbl_grp->setPrefix('grp_');
             $tbl_grp->enable('select_all');
             $tbl_grp->setSelectAllCheckbox('search_name_to_grp');
             $tbl_grp->setFormName('recipients');
             $this->tpl->setVariable('TABLE_GRP', $tbl_grp->getHTML());
         }
     }
     if (count($users) || count($visible_groups) || count($entries)) {
         $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
         $this->tpl->setVariable("ALT_ARROW", '');
         if ($_GET["ref"] != "wsp") {
             $this->tpl->setVariable('BUTTON_ADOPT', $this->lng->txt('adopt'));
         } else {
             $this->tpl->setVariable('BUTTON_ADOPT', $this->lng->txt('wsp_share_with_users'));
         }
     } else {
         $this->lng->loadLanguageModule('search');
         ilUtil::sendInfo($this->lng->txt('search_no_match'));
     }
     if ($_GET["ref"] != "wsp") {
         $this->tpl->show();
     }
 }
 /**
  * show material assignment
  *
  * @access protected
  * @param
  * @return
  */
 public function materialsObject()
 {
     global $tree, $objDefinition;
     $this->tabs_gui->setTabActive('crs_materials');
     // #11337 - support ANY parent container (crs, grp, fld)
     $parent_ref_id = $tree->getParentId($this->object->getRefId());
     include_once "Services/Object/classes/class.ilObjectAddNewItemGUI.php";
     $gui = new ilObjectAddNewItemGUI($parent_ref_id);
     $gui->setDisabledObjectTypes(array("itgr", "sess"));
     $gui->setAfterCreationCallback($this->ref_id);
     $gui->render();
     include_once 'Modules/Session/classes/class.ilEventItems.php';
     $this->event_items = new ilEventItems($this->object->getId());
     $items = $this->event_items->getItems();
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.sess_materials.html', 'Modules/Session');
     #$this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
     $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, 'materials'));
     $this->tpl->setVariable("COLL_TITLE_IMG", ilUtil::getImagePath('icon_sess.png'));
     $this->tpl->setVariable("COLL_TITLE_IMG_ALT", $this->lng->txt('events'));
     $this->tpl->setVariable("TABLE_TITLE", $this->lng->txt('event_assign_materials_table'));
     $this->tpl->setVariable("TABLE_INFO", $this->lng->txt('event_assign_materials_info'));
     $materials = array();
     $nodes = $tree->getSubTree($tree->getNodeData($parent_ref_id));
     foreach ($nodes as $node) {
         // No side blocks here
         if ($node['child'] == $parent_ref_id || $objDefinition->isSideBlock($node['type']) || in_array($node['type'], array('sess', 'itgr', 'rolf'))) {
             continue;
         }
         if ($node['type'] == 'rolf') {
             continue;
         }
         $node["sorthash"] = (int) (!in_array($node['ref_id'], $items)) . $node["title"];
         $materials[] = $node;
     }
     $materials = ilUtil::sortArray($materials, "sorthash", "ASC");
     $counter = 1;
     foreach ($materials as $node) {
         $counter++;
         $this->tpl->setCurrentBlock("material_row");
         $this->tpl->setVariable('TYPE_IMG', ilUtil::getImagePath('icon_' . $node['type'] . '_s.png'));
         $this->tpl->setVariable('IMG_ALT', $this->lng->txt('obj_' . $node['type']));
         $this->tpl->setVariable("ROW_CLASS", ilUtil::switchColor($counter, 'tblrow1', 'tblrow2'));
         $this->tpl->setVariable("CHECK_COLL", ilUtil::formCheckbox(in_array($node['ref_id'], $items) ? 1 : 0, 'items[]', $node['ref_id']));
         $this->tpl->setVariable("COLL_TITLE", $node['title']);
         if (strlen($node['description'])) {
             $this->tpl->setVariable("COLL_DESC", $node['description']);
         }
         $this->tpl->setVariable("ASSIGNED_IMG_OK", in_array($node['ref_id'], $items) ? ilUtil::getImagePath('icon_ok.png') : ilUtil::getImagePath('icon_not_ok.png'));
         $this->tpl->setVariable("ASSIGNED_STATUS", $this->lng->txt('event_material_assigned'));
         $this->tpl->setVariable("COLL_PATH", $this->formatPath($node['ref_id']));
         $this->tpl->parseCurrentBlock();
     }
     $this->tpl->setVariable("SELECT_ROW", ilUtil::switchColor(++$counter, 'tblrow1', 'tblrow2'));
     $this->tpl->setVariable("SELECT_ALL", $this->lng->txt('select_all'));
     $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath('arrow_downright.png'));
     $this->tpl->setVariable("BTN_SAVE", $this->lng->txt('save'));
 }
 /**
  * show material assignment
  *
  * @access protected
  * @param
  * @return
  */
 public function materialsObject()
 {
     global $tree, $objDefinition, $ilAccess;
     $this->tabs_gui->setTabActive('crs_materials');
     // #11337 - support ANY parent container (crs, grp, fld)
     $parent_ref_id = $tree->getParentId($this->object->getRefId());
     $parent_type = ilObject::_lookupType($parent_ref_id, true);
     // add new item
     $subtypes = $objDefinition->getCreatableSubObjects($parent_type, ilObjectDefinition::MODE_REPOSITORY);
     if ($subtypes) {
         $subobj = array();
         foreach ($subtypes as $type => $sub_item) {
             if (!in_array($type, array("itgr", "sess"))) {
                 // #9950
                 if ($ilAccess->checkAccess("create_" . $type, "", $parent_ref_id, $parent_type)) {
                     // #10787
                     $title = $this->lng->txt('obj_' . $type);
                     if ($sub_item["plugin"]) {
                         include_once "./Services/Component/classes/class.ilPlugin.php";
                         $title = ilPlugin::lookupTxt("rep_robj", $type, "obj_" . $type);
                     }
                     $subobj[] = array('value' => $type, 'title' => $title, 'img' => ilObject::_getIcon('', 'tiny', $type), 'alt' => $title);
                 }
             }
         }
         if (sizeof($subobj)) {
             // add new object to parent container instead
             $this->ctrl->setParameter($this, 'ref_id', $parent_ref_id);
             // $this->ctrl->setParameter($this, 'crtptrefid', $parent_ref_id);
             // force after creation callback
             $this->ctrl->setParameter($this, 'crtcb', $this->ref_id);
             $this->lng->loadLanguageModule('cntr');
             $this->tpl->setCreationSelector($this->ctrl->getFormAction($this), $subobj, 'create', $this->lng->txt('add'));
             $this->ctrl->setParameter($this, 'ref_id', $this->ref_id);
             // $this->ctrl->setParameter($this, 'crtptrefid', '');
             $this->ctrl->setParameter($this, 'crtcb', '');
         }
     }
     include_once 'Modules/Session/classes/class.ilEventItems.php';
     $this->event_items = new ilEventItems($this->object->getId());
     $items = $this->event_items->getItems();
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.sess_materials.html', 'Modules/Session');
     #$this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
     $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, 'materials'));
     $this->tpl->setVariable("COLL_TITLE_IMG", ilUtil::getImagePath('icon_sess.png'));
     $this->tpl->setVariable("COLL_TITLE_IMG_ALT", $this->lng->txt('events'));
     $this->tpl->setVariable("TABLE_TITLE", $this->lng->txt('event_assign_materials_table'));
     $this->tpl->setVariable("TABLE_INFO", $this->lng->txt('event_assign_materials_info'));
     $materials = array();
     $nodes = $tree->getSubTree($tree->getNodeData($parent_ref_id));
     foreach ($nodes as $node) {
         // No side blocks here
         if ($node['child'] == $parent_ref_id || $objDefinition->isSideBlock($node['type']) || in_array($node['type'], array('sess', 'itgr', 'rolf'))) {
             continue;
         }
         if ($node['type'] == 'rolf') {
             continue;
         }
         $node["sorthash"] = (int) (!in_array($node['ref_id'], $items)) . $node["title"];
         $materials[] = $node;
     }
     $materials = ilUtil::sortArray($materials, "sorthash", "ASC");
     $counter = 1;
     foreach ($materials as $node) {
         $counter++;
         $this->tpl->setCurrentBlock("material_row");
         $this->tpl->setVariable('TYPE_IMG', ilUtil::getImagePath('icon_' . $node['type'] . '_s.png'));
         $this->tpl->setVariable('IMG_ALT', $this->lng->txt('obj_' . $node['type']));
         $this->tpl->setVariable("ROW_CLASS", ilUtil::switchColor($counter, 'tblrow1', 'tblrow2'));
         $this->tpl->setVariable("CHECK_COLL", ilUtil::formCheckbox(in_array($node['ref_id'], $items) ? 1 : 0, 'items[]', $node['ref_id']));
         $this->tpl->setVariable("COLL_TITLE", $node['title']);
         if (strlen($node['description'])) {
             $this->tpl->setVariable("COLL_DESC", $node['description']);
         }
         $this->tpl->setVariable("ASSIGNED_IMG_OK", in_array($node['ref_id'], $items) ? ilUtil::getImagePath('icon_ok.png') : ilUtil::getImagePath('icon_not_ok.png'));
         $this->tpl->setVariable("ASSIGNED_STATUS", $this->lng->txt('event_material_assigned'));
         $this->tpl->setVariable("COLL_PATH", $this->formatPath($node['ref_id']));
         $this->tpl->parseCurrentBlock();
     }
     $this->tpl->setVariable("SELECT_ROW", ilUtil::switchColor(++$counter, 'tblrow1', 'tblrow2'));
     $this->tpl->setVariable("SELECT_ALL", $this->lng->txt('select_all'));
     $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath('arrow_downright.png'));
     $this->tpl->setVariable("BTN_SAVE", $this->lng->txt('save'));
 }
Example #20
0
 /**
  * Show terms of service
  */
 protected function showTermsOfService()
 {
     /**
      * @var $lng       ilLanguage
      * @var $tpl       ilTemplate
      * @var $ilUser    ilObjUser
      * @var $ilSetting ilSetting
      */
     global $lng, $tpl, $ilUser, $ilSetting;
     $back_to_login = '******' != $this->ctrl->getCmd();
     self::initStartUpTemplate('tpl.view_terms_of_service.html', $back_to_login, !$back_to_login);
     $tpl->setVariable('TXT_PAGEHEADLINE', $lng->txt('usr_agreement'));
     try {
         require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceSignableDocumentFactory.php';
         $document = ilTermsOfServiceSignableDocumentFactory::getByLanguageObject($lng);
         if ('getAcceptance' == $this->ctrl->getCmd()) {
             if (isset($_POST['status']) && 'accepted' == $_POST['status']) {
                 require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php';
                 ilTermsOfServiceHelper::trackAcceptance($ilUser, $document);
                 if (ilSession::get('orig_request_target')) {
                     $target = ilSession::get('orig_request_target');
                     ilSession::set('orig_request_target', '');
                     ilUtil::redirect($target);
                 } else {
                     ilUtil::redirect('index.php?target=' . $_GET['target'] . '&client_id=' . CLIENT_ID);
                 }
             }
             $tpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this, $this->ctrl->getCmd()));
             $tpl->setVariable('ACCEPT_CHECKBOX', ilUtil::formCheckbox(0, 'status', 'accepted'));
             $tpl->setVariable('ACCEPT_TERMS_OF_SERVICE', $lng->txt('accept_usr_agreement'));
             $tpl->setVariable('TXT_SUBMIT', $lng->txt('submit'));
         }
         $tpl->setVariable('TERMS_OF_SERVICE_CONTENT', $document->getContent());
     } catch (ilTermsOfServiceNoSignableDocumentFoundException $e) {
         $tpl->setVariable('TERMS_OF_SERVICE_CONTENT', sprintf($lng->txt('no_agreement_description'), 'mailto:' . ilUtil::prepareFormOutput($ilSetting->get('feedback_recipient'))));
     }
     $tpl->show();
 }
 /**
  * @param array $row
  */
 public function fillRow(array $row)
 {
     $short_name = new ilTextInputGUI('', 'mark_short_' . $row['mark_id']);
     $short_name->setValue($row['mark_short']);
     $short_name->setDisabled(!$this->is_editable);
     $short_name->setSize(10);
     $official_name = new ilTextInputGUI('', 'mark_official_' . $row['mark_id']);
     $official_name->setSize(20);
     $official_name->setDisabled(!$this->object->canEditMarks());
     $official_name->setValue($row['mark_official']);
     $percentage = new ilNumberInputGUI('', 'mark_percentage_' . $row['mark_id']);
     $percentage->allowDecimals(true);
     $percentage->setValue($row['mark_percentage']);
     $percentage->setSize(10);
     $percentage->setDisabled(!$this->is_editable);
     $percentage->setMinValue(0);
     $percentage->setMaxValue(100);
     $this->tpl->setVariable('VAL_MARK_ID', $row['mark_id']);
     $this->tpl->setVariable('VAL_CHECKBOX', ilUtil::formCheckbox(false, 'marks[]', $row['mark_id'], !$this->is_editable));
     $this->tpl->setVariable('VAL_SHORT_NAME', $short_name->render());
     $this->tpl->setVariable('VAL_OFFICIAL_NAME', $official_name->render());
     $this->tpl->setVariable('VAL_PERCENTAGE', $percentage->render());
     $this->tpl->setVariable('VAL_PASSED_CHECKBOX', ilUtil::formCheckbox((bool) $row['mark_passed'], 'passed_' . $row['mark_id'], '1', !$this->is_editable));
 }
 /**
  * @see ilTable2GUI::fillRow()
  */
 protected function fillRow($a_set)
 {
     global $ilCtrl, $lng;
     if (!stristr($a_set['target'], '|')) {
         $this->tpl->setCurrentBlock('external');
         $this->tpl->setVariable('VAL_ID', $a_set['id']);
         $this->tpl->setVariable('VAL_TARGET', $a_set['target']);
         $this->tpl->parseCurrentBlock();
     } else {
         $ilCtrl->setParameterByClass('ilinternallinkgui', 'postvar', 'tar_' . $a_set['id']);
         $trigger_link = array(get_class($this->parent_obj), 'ilinternallinkgui');
         $trigger_link = $ilCtrl->getLinkTargetByClass($trigger_link, '', false, true, false);
         $ilCtrl->setParameterByClass('ilinternallinkgui', 'postvar', '');
         $this->tpl->setCurrentBlock('internal');
         $this->tpl->setVariable('VAL_ID', $a_set['id']);
         $this->tpl->setVariable('VAL_TRIGGER_INTERNAL', $trigger_link);
         $this->tpl->setVariable('TXT_TRIGGER_INTERNAL', $this->lng->txt('edit'));
         // info about current link
         if ($a_set['target']) {
             $parts = explode('|', $a_set['target']);
             $this->tpl->setVariable('VAL_INTERNAL_TYPE', $parts[0]);
             $this->tpl->setVariable('VAL_INTERNAL_ID', $parts[1]);
             $parts = ilLinkInputGUI::getTranslatedValue($a_set['target']);
             $this->tpl->setVariable('TXT_TRIGGER_INFO', $parts['type'] . ' "' . $parts['name'] . '"');
         }
         $this->tpl->parseCurrentBlock();
     }
     $this->tpl->setVariable('TXT_LAST_CHECK', $this->lng->txt('webr_last_check_table'));
     $this->tpl->setVariable('LAST_CHECK', $a_set['last_check'] ? ilDatePresentation::formatDate(new ilDateTime($a_set['last_check'], IL_CAL_UNIX)) : $this->lng->txt('no_date'));
     // Valid
     $this->tpl->setVariable('VAL_VALID', ilUtil::formCheckbox($a_set['valid'], 'links[' . $a_set['id'] . '][vali]', 1));
     // Active
     $this->tpl->setVariable('VAL_ACTIVE', ilUtil::formCheckbox($a_set['active'], 'links[' . $a_set['id'] . '][act]', 1));
     // Valid
     $this->tpl->setVariable('VAL_CHECK', ilUtil::formCheckbox($a_set['disable_check'], 'links[' . $a_set['id'] . '][che]', 1));
     // Dynamic parameters
     foreach ($a_set['params'] as $param_id => $param) {
         $this->tpl->setCurrentBlock('dyn_del_row');
         $this->tpl->setVariable('TXT_DYN_DEL', $this->lng->txt('delete'));
         $ilCtrl->setParameterByClass(get_class($this->getParentObject()), 'param_id', $param_id);
         $this->tpl->setVariable('DYN_DEL_LINK', $ilCtrl->getLinkTarget($this->getParentObject(), 'deleteParameter'));
         $this->tpl->setVariable('VAL_DYN', ilParameterAppender::parameterToInfo($param['name'], $param['value']));
         $this->tpl->parseCurrentBlock();
     }
     if ($a_set['params']) {
         $this->tpl->setCurrentBlock('dyn_del_rows');
         $this->tpl->setVariable('TXT_EXISTING', $this->lng->txt('links_existing_params'));
         $this->tpl->parseCurrentBlock();
     }
     if (ilParameterAppender::_isEnabled()) {
         $this->tpl->setCurrentBlock('dyn_add');
         $this->tpl->setVariable('TXT_DYN_ADD', $this->lng->txt('links_add_param'));
         $this->tpl->setVariable('TXT_DYN_NAME', $this->lng->txt('links_name'));
         $this->tpl->setVariable('TXT_DYN_VALUE', $this->lng->txt('links_value'));
         $this->tpl->setVariable('VAL_DYN_NAME', $a_set['name']);
         $this->tpl->setVariable('DYN_ID', $a_set['id']);
         $this->tpl->setVariable('SEL_DYN_VAL', ilUtil::formSelect($a_set['value'] ? $a_set['value'] : 0, 'links[' . $a_set['id'] . '][val]', ilParameterAppender::_getOptionSelect(), false, true));
         $this->tpl->parseCurrentBlock();
     }
     if (in_array($a_set['id'], $this->getInvalidLinks())) {
         $this->tpl->setVariable('CSS_ROW', 'warn');
     }
     // Check
     $this->tpl->setVariable('VAL_ID', $a_set['id']);
     $this->tpl->setVariable('VAL_CHECKBOX', ilUtil::formCheckbox(false, 'link_ids[]', $a_set['id']));
     // Column title
     $this->tpl->setVariable('TXT_TITLE', $this->lng->txt('title'));
     $this->tpl->setVariable('VAL_TITLE', ilUtil::prepareFormOutput($a_set['title']));
     $this->tpl->setVariable('TXT_DESC', $this->lng->txt('description'));
     $this->tpl->setVariable('VAL_DESC', ilUtil::prepareFormOutput($a_set['description']));
     // Column Target
     $this->tpl->setVariable('TXT_TARGET', $this->lng->txt('target'));
 }
 public function showMembersList()
 {
     if (!$this->mlists->getCurrentMailingList()->getId()) {
         $this->showMailingLists();
         return true;
     }
     $this->ctrl->setParameter($this, 'cmd', 'post');
     $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
     $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_members.html', 'Services/Contact');
     $tbl = new ilTable2GUI($this);
     $tbl->setId('show_mlng_mmbrs_list_tbl');
     $tbl->setFormAction($this->ctrl->getFormAction($this), 'showMemberForm');
     $tbl->setTitle($this->lng->txt('mail_members_of_mailing_list') . ' ' . $this->mlists->getCurrentMailingList()->getTitle());
     $tbl->setRowTemplate('tpl.mail_mailing_lists_membersrow.html', 'Services/Contact');
     $this->ctrl->setParameter($this, 'cmd', 'showMembersList');
     $tbl->setDefaultOrderField('title');
     $result = array();
     $tbl->addColumn('', 'check', '10%');
     $tbl->addColumn($this->lng->txt('title'), 'title', '90%');
     $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
     if (count($assigned_entries)) {
         $tbl->enable('select_all');
         $tbl->setSelectAllCheckbox('a_id');
         $counter = 0;
         foreach ($assigned_entries as $entry) {
             $result[$counter]['check'] = ilUtil::formCheckbox(0, 'a_id[]', $entry['a_id']);
             $result[$counter]['title'] = $entry['login'] != '' ? $entry['login'] : $entry['email'];
             ++$counter;
         }
         $tbl->addMultiCommand('confirmDeleteMembers', $this->lng->txt('delete'));
     } else {
         $tbl->disable('header');
         $tbl->disable('footer');
         $tbl->setNoEntriesText($this->lng->txt('mail_search_no'));
     }
     $tbl->setData($result);
     $tbl->addCommandButton('showAssignmentForm', $this->lng->txt('add'));
     $tbl->addCommandButton('showMailingLists', $this->lng->txt('back'));
     $this->tpl->setVariable('MEMBERS_LIST', $tbl->getHTML());
     $this->tpl->show();
     return true;
 }
 /**
  * Configure social bookmark settings
  * 
  * @access	public
  */
 function editSocialBookmarksObject()
 {
     global $ilAccess, $rbacreview, $lng, $ilCtrl;
     if (!$ilAccess->checkAccess("write", "", $this->object->getRefId())) {
         $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
     }
     $this->__initSubTabs("editSocialBookmarks");
     include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
     include_once './Services/Administration/classes/class.ilSocialBookmarks.php';
     $rset = ilSocialBookmarks::_getEntry();
     $counter = 0;
     foreach ($rset as $row) {
         $current_selection_list = new ilAdvancedSelectionListGUI();
         $current_selection_list->setListTitle($lng->txt("actions"));
         $current_selection_list->setId("act_" . $counter++);
         $ilCtrl->setParameter($this, 'sbm_id', $row->sbm_id);
         $current_selection_list->addItem($lng->txt("edit"), '', $ilCtrl->getLinkTarget($this, "editSocialBookmark"));
         $current_selection_list->addItem($lng->txt("delete"), '', $ilCtrl->getLinkTarget($this, "deleteSocialBookmarks"));
         $toggle_action = '';
         if ($row->sbm_active) {
             $current_selection_list->addItem($lng->txt("socialbm_disable"), '', $toggle_action = $ilCtrl->getLinkTarget($this, "disableSocialBookmarks"));
         } else {
             $current_selection_list->addItem($lng->txt("socialbm_enable"), '', $toggle_action = $ilCtrl->getLinkTarget($this, "enableSocialBookmarks"));
         }
         $dset[] = array('CHECK' => ilUtil::formCheckbox(0, 'sbm_id[]', $row->sbm_id), 'ID' => $row->sbm_id, 'TITLE' => $row->sbm_title, 'LINK' => str_replace('{', '&#123;', $row->sbm_link), 'ICON' => $row->sbm_icon, 'ACTIVE' => $row->sbm_active ? $lng->txt('enabled') : $lng->txt('disabled'), 'ACTIONS' => $current_selection_list->getHTML(), 'TOGGLE_LINK' => $toggle_action);
         $ilCtrl->clearParameters($this);
     }
     require_once 'Services/Table/classes/class.ilTable2GUI.php';
     $table = new ilTable2GUI($this, 'editSocialBookmarks');
     $table->setFormName('smtable');
     $table->setId('smtable');
     $table->setPrefix('sm');
     $table->setFormAction($ilCtrl->getFormAction($this, 'saveSocialBookmarks'));
     $table->addColumn('', 'check', '', true);
     $table->addColumn($lng->txt('icon'), '');
     $table->addColumn($lng->txt('title'), 'TITLE');
     $table->addColumn($lng->txt('link'), 'LINK');
     $table->addColumn($lng->txt('active'), 'ACTIVE');
     $table->addColumn($lng->txt('actions'), '');
     $table->setTitle($lng->txt('bm_manage_social_bm'));
     $table->setData($dset);
     $table->setRowTemplate('tpl.social_bookmarking_row.html', 'Services/Administration');
     $table->setSelectAllCheckbox('sbm_id');
     $table->setDefaultOrderField("title");
     $table->setDefaultOrderDirection("asc");
     $table->addMultiCommand('enableSocialBookmarks', $lng->txt('socialbm_enable'));
     $table->addMultiCommand('disableSocialBookmarks', $lng->txt('socialbm_disable'));
     $table->addMultiCommand('deleteSocialBookmarks', $lng->txt('delete'));
     $table->addCommandButton('addSocialBookmark', $lng->txt('create'));
     $this->tpl->setVariable('ADM_CONTENT', $table->getHTML());
 }
 /**
  * Render item
  */
 function render()
 {
     foreach ($this->list_nodes as $id => $n) {
         if ($n["post_var"] == "") {
             $post_var = $this->getPostVar() . "[]";
             $value = $id;
         } else {
             $post_var = $n["post_var"];
             $value = $id;
         }
         $item_html = ilUtil::formCheckbox($n["checked"], $post_var, $value, $n["disabled"]);
         if ($n["img_src"] != "") {
             $item_html .= ilUtil::img($n["img_src"], $n["img_alt"]) . " ";
         }
         $item_html .= $n["text"];
         $this->list->addListNode($item_html, $id, $n["parent"]);
     }
     return $this->list->getHTML();
 }
 /**
  * show agreement
  *
  * @access private
  * 
  */
 private function showAgreement($send_info = true)
 {
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.crs_user_agreement.html', 'Modules/Course');
     $this->tpl->setVariable('FORMACTION', $this->ctrl->getFormAction($this));
     if ($send_info) {
         $this->sendInfoMessage();
     }
     $this->showCourseDefinedFields();
     include_once 'Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php';
     $fields_info = ilExportFieldsInfo::_getInstanceByType(ilObject::_lookupType($this->obj_id));
     foreach ($fields_info->getExportableFields() as $field) {
         $this->tpl->setCurrentBlock('field');
         $this->tpl->setVariable('FIELD_NAME', $this->lng->txt($field));
         $this->tpl->parseCurrentBlock();
     }
     $this->tpl->setVariable('AGREEMENT_HEADER', $this->lng->txt($this->type . '_agreement_header'));
     $this->tpl->setVariable('TXT_AGREEMENT', $this->lng->txt($this->type . '_user_agreement'));
     $this->tpl->setVariable('TXT_INFO_AGREEMENT', $this->lng->txt($this->type . '_info_agreement'));
     if ($this->privacy->confirmationRequired($this->type) or ilCourseDefinedFieldDefinition::_hasFields($this->obj_id)) {
         $this->tpl->setCurrentBlock('agreement');
         $this->tpl->setVariable('CHECK_AGREE', ilUtil::formCheckbox(0, 'agreed', 1));
         $this->tpl->setVariable('INFO_AGREE', $this->lng->txt($this->type . '_info_agree'));
         $this->tpl->setVariable('TXT_AGREE', $this->lng->txt($this->type . '_agree'));
         $this->tpl->parseCurrentBlock();
     }
     $this->tpl->setVariable('TXT_SAVE', $this->lng->txt('save'));
 }
 /**
  * @param $key
  * @param $value
  * @return string
  */
 public function formatCellValue($key, $value)
 {
     switch ($key) {
         case 'addr_id':
             $value = ilUtil::formCheckbox(0, 'addr_id[]', $value);
             break;
         case 'auto_update':
             if ($this->cron_upd_adrbook != 0) {
                 $value = $value == 1 ? $this->lng->txt('yes') : $this->lng->txt('no');
             } else {
                 $value = '';
             }
             break;
     }
     return $value;
 }
 /**
  * Fill table row
  */
 protected function fillRow($member)
 {
     global $lng, $ilCtrl;
     include_once "./Services/Object/classes/class.ilObjectFactory.php";
     $member_id = $member["usr_id"];
     if (!($mem_obj = ilObjectFactory::getInstanceByObjId($member_id, false))) {
         return;
     }
     // mail sent
     if ($this->sent_col) {
         if (ilExAssignment::lookupStatusSentOfUser($this->ass_id, $member_id)) {
             $this->tpl->setCurrentBlock("mail_sent");
             if (($st = ilExAssignment::lookupSentTimeOfUser($this->ass_id, $member_id)) > 0) {
                 $this->tpl->setVariable("TXT_MAIL_SENT", sprintf($lng->txt("exc_sent_at"), ilDatePresentation::formatDate(new ilDateTime($st, IL_CAL_DATE))));
             } else {
                 $this->tpl->setVariable("TXT_MAIL_SENT", $lng->txt("sent"));
             }
             $this->tpl->parseCurrentBlock();
         } else {
             $this->tpl->setCurrentBlock("mail_sent");
             $this->tpl->setVariable("TXT_MAIL_SENT", "&nbsp;");
             $this->tpl->parseCurrentBlock();
         }
     }
     // checkbox
     $this->tpl->setVariable("VAL_CHKBOX", ilUtil::formCheckbox(0, "member[{$member_id}]", 1));
     $this->tpl->setVariable("VAL_ID", $member_id);
     // name and login
     if (!isset($member["team"])) {
         $this->tpl->setVariable("TXT_NAME", $member["name"]);
         $this->tpl->setVariable("TXT_LOGIN", "[" . $member["login"] . "]");
         // image
         $this->tpl->setVariable("USR_IMAGE", $mem_obj->getPersonalPicturePath("xxsmall"));
         $this->tpl->setVariable("USR_ALT", $lng->txt("personal_picture"));
     } else {
         $this->tpl->setCurrentBlock("team_member");
         asort($member["team"]);
         foreach ($member["team"] as $member_name) {
             $this->tpl->setVariable("TXT_MEMBER_NAME", $member_name);
             $this->tpl->parseCurrentBlock();
         }
         $ilCtrl->setParameter($this->parent_obj, "lmem", $member_id);
         $this->tpl->setVariable("HREF_LOG", $ilCtrl->getLinkTarget($this->parent_obj, "showTeamLog"));
         $this->tpl->setVariable("TXT_LOG", $lng->txt("exc_team_log"));
         $ilCtrl->setParameter($this->parent_obj, "lmem", "");
     }
     // submission:
     // see if files have been resubmmited after solved
     $last_sub = ilExAssignment::getLastSubmission($this->ass_id, $member_id);
     if ($last_sub) {
         $last_sub = ilDatePresentation::formatDate(new ilDateTime($last_sub, IL_CAL_DATETIME));
     } else {
         $last_sub = "---";
     }
     if (ilExAssignment::lookupUpdatedSubmission($this->ass_id, $member_id) == 1) {
         $last_sub = "<b>" . $last_sub . "</b>";
     }
     $this->tpl->setVariable("VAL_LAST_SUBMISSION", $last_sub);
     $this->tpl->setVariable("TXT_LAST_SUBMISSION", $lng->txt("exc_last_submission"));
     switch ($this->type) {
         case ilExAssignment::TYPE_UPLOAD_TEAM:
             // data is merged by team - see above
             // fallthrough
         // data is merged by team - see above
         // fallthrough
         case ilExAssignment::TYPE_UPLOAD:
             // nr of submitted files
             $this->tpl->setVariable("TXT_SUBMITTED_FILES", $lng->txt("exc_files_returned"));
             //$sub_cnt = count($this->exc->getDeliveredFiles($member_id, $this->ass_id));
             $sub_cnt = count(ilExAssignment::getDeliveredFiles($this->exc_id, $this->ass_id, $member_id));
             $new = ilExAssignment::lookupNewFiles($this->ass_id, $member_id);
             if (count($new) > 0) {
                 $sub_cnt .= " " . sprintf($lng->txt("cnt_new"), count($new));
             }
             $this->tpl->setVariable("VAL_SUBMITTED_FILES", $sub_cnt);
             // download command
             $ilCtrl->setParameter($this->parent_obj, "member_id", $member_id);
             if ($sub_cnt > 0) {
                 $this->tpl->setCurrentBlock("download_link");
                 $this->tpl->setVariable("LINK_DOWNLOAD", $ilCtrl->getLinkTarget($this->parent_obj, "downloadReturned"));
                 if (count($new) <= 0) {
                     $this->tpl->setVariable("TXT_DOWNLOAD", $lng->txt("exc_download_files"));
                 } else {
                     $this->tpl->setVariable("TXT_DOWNLOAD", $lng->txt("exc_download_all"));
                 }
                 $this->tpl->parseCurrentBlock();
                 // download new files only
                 if (count($new) > 0) {
                     $this->tpl->setCurrentBlock("download_link");
                     $this->tpl->setVariable("LINK_NEW_DOWNLOAD", $ilCtrl->getLinkTarget($this->parent_obj, "downloadNewReturned"));
                     $this->tpl->setVariable("TXT_NEW_DOWNLOAD", $lng->txt("exc_download_new"));
                     $this->tpl->parseCurrentBlock();
                 }
             }
             break;
         case ilExAssignment::TYPE_BLOG:
             $has_submitted = false;
             $this->tpl->setVariable("TXT_SUBMITTED_FILES", $lng->txt("exc_blog_returned"));
             $blogs = ilExAssignment::getDeliveredFiles($this->exc_id, $this->ass_id, $member_id);
             if ($blogs) {
                 $blogs = array_pop($blogs);
                 if ($blogs && substr($blogs["filename"], -1) != "/") {
                     $has_submitted = true;
                     $this->tpl->setVariable("VAL_SUBMITTED_FILES", 1);
                     $ilCtrl->setParameter($this->parent_obj, "member_id", $member_id);
                     $this->tpl->setCurrentBlock("download_link");
                     $this->tpl->setVariable("LINK_DOWNLOAD", $ilCtrl->getLinkTarget($this->parent_obj, "downloadReturned"));
                     $this->tpl->setVariable("TXT_DOWNLOAD", $lng->txt("exc_download_files"));
                     $this->tpl->parseCurrentBlock();
                 }
             }
             if (!$has_submitted) {
                 $this->tpl->setVariable("VAL_SUBMITTED_FILES", "---");
             }
             break;
         case ilExAssignment::TYPE_PORTFOLIO:
             $has_submitted = false;
             $this->tpl->setVariable("TXT_SUBMITTED_FILES", $lng->txt("exc_portfolio_returned"));
             $portfolios = ilExAssignment::getDeliveredFiles($this->exc_id, $this->ass_id, $member_id);
             if ($portfolios) {
                 $portfolios = array_pop($portfolios);
                 if ($portfolios && substr($portfolios["filename"], -1) != "/") {
                     $has_submitted = true;
                     $this->tpl->setVariable("VAL_SUBMITTED_FILES", 1);
                     $ilCtrl->setParameter($this->parent_obj, "member_id", $member_id);
                     $this->tpl->setCurrentBlock("download_link");
                     $this->tpl->setVariable("LINK_DOWNLOAD", $ilCtrl->getLinkTarget($this->parent_obj, "downloadReturned"));
                     $this->tpl->setVariable("TXT_DOWNLOAD", $lng->txt("exc_download_files"));
                     $this->tpl->parseCurrentBlock();
                 }
             }
             if (!$has_submitted) {
                 $this->tpl->setVariable("VAL_SUBMITTED_FILES", "---");
             }
             break;
     }
     // note
     $this->tpl->setVariable("TXT_NOTE", $lng->txt("note"));
     $this->tpl->setVariable("NAME_NOTE", "notice[{$member_id}]");
     $this->tpl->setVariable("VAL_NOTE", ilUtil::prepareFormOutput(ilExAssignment::lookupNoticeOfUser($this->ass_id, $member_id)));
     // comment for learner
     $this->tpl->setVariable("TXT_LCOMMENT", $lng->txt("exc_comment_for_learner"));
     $this->tpl->setVariable("NAME_LCOMMENT", "lcomment[{$member_id}]");
     $lpcomment = ilExAssignment::lookupCommentForUser($this->ass_id, $member_id);
     $this->tpl->setVariable("VAL_LCOMMENT", ilUtil::prepareFormOutput($lpcomment));
     // solved
     //$this->tpl->setVariable("CHKBOX_SOLVED",
     //	ilUtil::formCheckbox($this->exc->members_obj->getStatusByMember($member_id),"solved[$member_id]",1));
     $status = ilExAssignment::lookupStatusOfUser($this->ass_id, $member_id);
     $this->tpl->setVariable("SEL_" . strtoupper($status), ' selected="selected" ');
     $this->tpl->setVariable("TXT_NOTGRADED", $lng->txt("exc_notgraded"));
     $this->tpl->setVariable("TXT_PASSED", $lng->txt("exc_passed"));
     $this->tpl->setVariable("TXT_FAILED", $lng->txt("exc_failed"));
     if (($sd = ilExAssignment::lookupStatusTimeOfUser($this->ass_id, $member_id)) > 0) {
         $this->tpl->setCurrentBlock("status_date");
         $this->tpl->setVariable("TXT_LAST_CHANGE", $lng->txt("last_change"));
         $this->tpl->setVariable('VAL_STATUS_DATE', ilDatePresentation::formatDate(new ilDateTime($sd, IL_CAL_DATETIME)));
         $this->tpl->parseCurrentBlock();
     }
     switch ($status) {
         case "passed":
             $pic = "scorm/passed.png";
             break;
         case "failed":
             $pic = "scorm/failed.png";
             break;
         default:
             $pic = "scorm/not_attempted.png";
             break;
     }
     $this->tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic));
     $this->tpl->setVariable("ALT_STATUS", $lng->txt("exc_" . $status));
     // mark
     $this->tpl->setVariable("TXT_MARK", $lng->txt("exc_mark"));
     $this->tpl->setVariable("NAME_MARK", "mark[{$member_id}]");
     $mark = ilExAssignment::lookupMarkOfUser($this->ass_id, $member_id);
     $this->tpl->setVariable("VAL_MARK", ilUtil::prepareFormOutput($mark));
     // feedback
     $ilCtrl->setParameter($this->parent_obj, "member_id", $member_id);
     if (($ft = ilExAssignment::lookupFeedbackTimeOfUser($this->ass_id, $member_id)) > 0) {
         $this->tpl->setCurrentBlock("feedback_date");
         $this->tpl->setVariable("TXT_FEEDBACK_MAIL_SENT", sprintf($lng->txt("exc_sent_at"), ilDatePresentation::formatDate(new ilDateTime($ft, IL_CAL_DATETIME))));
         $this->tpl->parseCurrentBlock();
     }
     // feedback mail
     $this->tpl->setVariable("LINK_FEEDBACK", $ilCtrl->getLinkTarget($this->parent_obj, "redirectFeedbackMail"));
     $this->tpl->setVariable("TXT_FEEDBACK", $lng->txt("exc_send_mail"));
     if ($this->type == ilExAssignment::TYPE_UPLOAD_TEAM) {
         $feedback_id = "t" . $member["team_id"];
     } else {
         $feedback_id = $member_id;
     }
     // file feedback
     $cnt_files = $this->storage->countFeedbackFiles($feedback_id);
     $ilCtrl->setParameter($this->parent_obj, "fsmode", "feedback");
     $this->tpl->setVariable("LINK_FILE_FEEDBACK", $ilCtrl->getLinkTargetByClass("ilfilesystemgui", "listFiles"));
     if ($cnt_files == 0) {
         $this->tpl->setVariable("TXT_FILE_FEEDBACK", $lng->txt("exc_add_feedback_file"));
     } else {
         $this->tpl->setVariable("TXT_FILE_FEEDBACK", $lng->txt("exc_fb_files") . " (" . $cnt_files . ")");
     }
     $this->tpl->parseCurrentBlock();
 }
Example #29
0
 function assignRoles()
 {
     global $rbacreview;
     if (!$this->ilAccess->checkAccess("cat_administrate_users", "", $_GET["ref_id"])) {
         ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
         $this->ctrl->redirect($this, "");
     }
     $offset = $_GET["offset"];
     // init sort_by (unfortunatly sort_by is preset with 'title'
     if ($_GET["sort_by"] == "title" or empty($_GET["sort_by"])) {
         $_GET["sort_by"] = "login";
     }
     $order = $_GET["sort_by"];
     $direction = $_GET["sort_order"];
     include_once './Services/User/classes/class.ilLocalUser.php';
     if (!isset($_GET['obj_id'])) {
         ilUtil::sendFailure('no_user_selected');
         $this->index();
         return true;
     }
     $roles = $this->__getAssignableRoles();
     $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.cat_role_assignment.html', "Modules/Category");
     $ass_roles = $rbacreview->assignedRoles($_GET['obj_id']);
     $counter = 0;
     foreach ($roles as $role) {
         $role_obj =& ilObjectFactory::getInstanceByObjId($role['obj_id']);
         $disabled = false;
         $f_result[$counter][] = ilUtil::formCheckbox(in_array($role['obj_id'], $ass_roles) ? 1 : 0, 'role_ids[]', $role['obj_id'], $disabled);
         $f_result[$counter][] = $role_obj->getTitle();
         $f_result[$counter][] = $role_obj->getDescription();
         $f_result[$counter][] = $role['role_type'] == 'global' ? $this->lng->txt('global') : $this->lng->txt('local');
         unset($role_obj);
         ++$counter;
     }
     $this->__showRolesTable($f_result, "assignRolesObject");
 }
 function listUsersRoleObject()
 {
     global $rbacsystem, $rbacreview;
     $_SESSION["role_role"] = $_POST["role"] = $_POST["role"] ? $_POST["role"] : $_SESSION["role_role"];
     if (!is_array($_POST["role"])) {
         ilUtil::sendFailure($this->lng->txt("role_no_roles_selected"));
         $this->searchObject();
         return false;
     }
     $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.role_usr_selection.html", "Services/AccessControl");
     $this->__showButton("searchUserForm", $this->lng->txt("role_new_search"));
     // GET ALL MEMBERS
     $members = array();
     foreach ($_POST["role"] as $role_id) {
         $members = array_merge($rbacreview->assignedUsers($role_id), $members);
     }
     $members = array_unique($members);
     // FORMAT USER DATA
     $counter = 0;
     $f_result = array();
     foreach ($members as $user) {
         if (!($tmp_obj = ilObjectFactory::getInstanceByObjId($user, false))) {
             continue;
         }
         $user_ids[$counter] = $user;
         // TODO: exclude anonymous user
         $f_result[$counter][] = ilUtil::formCheckbox(0, "user[]", $user);
         $f_result[$counter][] = $tmp_obj->getLogin();
         $f_result[$counter][] = $tmp_obj->getFirstname();
         $f_result[$counter][] = $tmp_obj->getLastname();
         unset($tmp_obj);
         ++$counter;
     }
     $this->__showSearchUserTable($f_result, $user_ids, "listUsersRole");
     return true;
 }