00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00037 include_once "./classes/class.ilContainerGUI.php";
00038
00039 class ilObjiLincCourseGUI extends ilContainerGUI
00040 {
00045 function ilObjiLincCourseGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output = false)
00046 {
00047 $this->type = "icrs";
00048 $this->ilContainerGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
00049
00050 $this->ctrl->saveParameter($this,'ref_id');
00051
00052 $this->lng->loadLanguageModule('ilinc');
00053 }
00054
00060 function createObject()
00061 {
00062 global $rbacsystem;
00063
00064 $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];
00065
00066 if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], $new_type))
00067 {
00068 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00069 }
00070
00071
00072 $data = array();
00073 $data["fields"] = array();
00074 $data["fields"]["title"] = ilUtil::prepareFormOutput($_SESSION["error_post_vars"]["Fobject"]["title"],true);
00075 $data["fields"]["desc"] = ilUtil::stripSlashes($_SESSION["error_post_vars"]["Fobject"]["desc"]);
00076
00077
00078 $data["fields"]["activated"] = ilUtil::formCheckbox($_SESSION["error_post_vars"]["Fobject"]["activated"],"Fobject[activated]",1);
00079 $data["fields"]["akclassvalue1"] = ilUtil::prepareFormOutput($_SESSION["error_post_vars"]["Fobject"]["akclassvalue1"],true);
00080 $data["fields"]["akclassvalue2"] = ilUtil::prepareFormOutput($_SESSION["error_post_vars"]["Fobject"]["akclassvalue2"],true);
00081
00082 $checkbox_access = ilUtil::formCheckbox($this->object->activated,"Fobject[activated]",1);
00083
00084 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.icrs_edit.html","ilinc");
00085
00086
00087 if ($this->ilias->getSetting("ilinc_akclassvalues_active"))
00088 {
00089 $this->tpl->setVariable("TXT_AKCLASSVALUE1", $this->lng->txt("akclassvalue1"));
00090 $this->tpl->setVariable("TXT_AKCLASSVALUE2", $this->lng->txt("akclassvalue2"));
00091 $this->tpl->setVariable("TXT_AKCLASSVALUES",$this->lng->txt("akclassvalues"));
00092
00093 if ($this->ilias->getSetting("ilinc_akclassvalues_required"))
00094 {
00095 $this->tpl->setVariable("AKCLASSVALUE_REQUIRED",'*');
00096 }
00097 }
00098
00099 $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("title"));
00100 $this->tpl->setVariable("TITLE", $data["fields"]["title"]);
00101 $this->tpl->setVariable("TXT_DESC", $this->lng->txt("desc"));
00102 $this->tpl->setVariable("DESC", $data["fields"]["desc"]);
00103 $this->tpl->setVariable("TXT_ACCESS", $this->lng->txt("online"));
00104 $this->tpl->setVariable("CHKBOX_ACCESS", $data["fields"]["activated"]);
00105
00106
00107
00108
00109
00110
00111 $this->ctrl->setParameter($this, "mode", "create");
00112 $this->ctrl->setParameter($this, "new_type", $new_type);
00113 $this->tpl->setVariable("FORMACTION", $this->getFormAction("save",$this->ctrl->getFormAction($this)));
00114 $this->tpl->setVariable("TXT_HEADER", $this->lng->txt($new_type."_new"));
00115 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
00116 $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt($new_type."_add"));
00117 $this->tpl->setVariable("CMD_SUBMIT", "save");
00118 $this->tpl->setVariable("TARGET", $this->getTargetFrame("save"));
00119 $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
00120 }
00121
00122 function updateObject()
00123 {
00124 global $rbacsystem;
00125
00126 if (!$rbacsystem->checkAccess("write",$_GET["ref_id"]) )
00127 {
00128 $this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
00129 }
00130
00131
00132 if (empty($_POST["Fobject"]["title"]))
00133 {
00134 $this->ilErr->raiseError($this->lng->txt("fill_out_all_required_fields"),$this->ilErr->MESSAGE);
00135 }
00136
00137
00138 if (empty($_POST["Fobject"]["akclassvalue1"]) and $this->ilias->getSetting("ilinc_akclassvalues_active") and $this->ilias->getSetting("ilinc_akclassvalues_required"))
00139 {
00140 $this->ilErr->raiseError($this->lng->txt("fill_out_all_required_fields"),$this->ilErr->MESSAGE);
00141 }
00142
00143 $this->object->setTitle(ilUtil::prepareDBString($_POST["Fobject"]["title"]));
00144 $this->object->setDescription(ilUtil::prepareDBString($_POST["Fobject"]["desc"]));
00145 $this->object->activated = ilUtil::tf2yn($_POST["Fobject"]["activated"]);
00146
00147
00148 if ($this->ilias->getSetting("ilinc_akclassvalues_active"))
00149 {
00150 if ($this->object->getAKClassValue1() == $_POST["Fobject"]["akclassvalue1"])
00151 {
00152 unset($_POST["Fobject"]["akclassvalue1"]);
00153 }
00154 else
00155 {
00156 $this->object->setAKClassValue1(ilUtil::prepareDBString($_POST["Fobject"]["akclassvalue1"]));
00157 }
00158
00159 if ($this->object->getAKClassValue2() == $_POST["Fobject"]["akclassvalue2"])
00160 {
00161 unset($_POST["Fobject"]["akclassvalue2"]);
00162 }
00163 else
00164 {
00165 $this->object->setAKClassValue2(ilUtil::prepareDBString($_POST["Fobject"]["akclassvalue2"]));
00166 }
00167 }
00168
00169
00170 $success = $this->object->update();
00171
00172 if ($success == false)
00173 {
00174 $this->ilErr->raiseError($this->object->getErrorMsg(),$this->ilErr->MESSAGE);
00175 }
00176
00177
00178 if (array_key_exists('akclassvalue1',$_POST["Fobject"]) or array_key_exists('akclassvalue2',$_POST["Fobject"]))
00179 {
00180 if (!$this->object->updateClassrooms())
00181 {
00182 ilUtil::sendInfo($this->lng->txt($this->object->getErrorMsg()));
00183 return;
00184 }
00185 }
00186
00187 ilUtil::sendInfo($this->lng->txt("msg_obj_modified"),true);
00188 ilUtil::redirect($this->ctrl->getLinkTarget($this,"edit"));
00189 }
00190
00195 function saveObject()
00196 {
00197 global $rbacadmin,$rbacsystem;
00198
00199
00200 if (empty($_POST["Fobject"]["title"]))
00201 {
00202 $this->ilErr->raiseError($this->lng->txt("fill_out_all_required_fields"),$this->ilErr->MESSAGE);
00203 }
00204
00205
00206 if (empty($_POST["Fobject"]["akclassvalue1"]) and $this->ilias->getSetting("ilinc_akclassvalues_active") and $this->ilias->getSetting("ilinc_akclassvalues_required"))
00207 {
00208 $this->ilErr->raiseError($this->lng->txt("fill_out_all_required_fields"),$this->ilErr->MESSAGE);
00209 }
00210
00211
00212 include_once ('class.ilnetucateXMLAPI.php');
00213 $ilinc = new ilnetucateXMLAPI();
00214 $ilinc->addCourse($_POST["Fobject"]);
00215 $response = $ilinc->sendRequest();
00216
00217 if ($response->isError())
00218 {
00219 $this->ilErr->raiseError($response->getErrorMsg(),$this->ilErr->MESSAGE);
00220 }
00221
00222
00223 $icrsObj = parent::saveObject();
00224
00225
00226 $icrsObj->storeiLincId($response->getFirstID());
00227 $icrsObj->saveActivationStatus(ilUtil::tf2yn($_POST["Fobject"]["activated"]));
00228 $icrsObj->saveAKClassValues(ilUtil::prepareDBString($_POST["Fobject"]["akclassvalue1"]), ilUtil::prepareDBString($_POST["Fobject"]["akclassvalue2"]));
00229
00230
00231 $roles = $icrsObj->initDefaultRoles();
00232
00233
00234 $success = $icrsObj->addMember($this->ilias->account,$icrsObj->getDefaultAdminRole(),true);
00235
00236 if (!$success)
00237 {
00238 $this->ilErr->raiseError($icrsObj->getErrorMsg(),$this->ilErr->MESSAGE);
00239 }
00240
00241
00242
00243
00244
00245 $this->ilias->account->addDesktopItem($icrsObj->getRefId(),"icrs");
00246
00247
00248 ilUtil::sendInfo($this->lng->txt("icrs_added"),true);
00249
00250 $this->redirectToRefId($_GET["ref_id"]);
00251
00252 }
00253
00259 function getTabs(&$tabs_gui)
00260 {
00261 global $rbacsystem,$ilAccess;
00262
00263 $this->ctrl->setParameter($this,"ref_id",$this->ref_id);
00264
00265 if ($rbacsystem->checkAccess('read',$this->ref_id))
00266 {
00267 $tabs_gui->addTarget("ilinc_classrooms",
00268 $this->ctrl->getLinkTarget($this, ""),
00269 array("", "view")
00270 );
00271 }
00272
00273 if ($this->ilias->getSetting("ilinc_active"))
00274 {
00275 if ($rbacsystem->checkAccess('write',$this->ref_id))
00276 {
00277 $tabs_gui->addTarget("edit_properties",
00278 $this->ctrl->getLinkTarget($this, "edit"), "edit", get_class($this));
00279 }
00280
00281
00282
00283
00284
00285
00286
00287
00288 if($ilAccess->checkAccess('write','',$this->ref_id))
00289 {
00290 $tabs_gui->addTarget("ilinc_involved_users",
00291 $this->ctrl->getLinkTarget($this, "members"),
00292 array("members","mailMembers","membersGallery","showProfile"),
00293 get_class($this));
00294 }
00295 elseif ($ilAccess->checkAccess('read','',$this->ref_id))
00296 {
00297 $tabs_gui->addTarget("ilinc_involved_users",
00298 $this->ctrl->getLinkTarget($this, "membersGallery"),
00299 array("members","mailMembers","membersGallery","showProfile"),
00300 get_class($this));
00301 }
00302
00303 if ($rbacsystem->checkAccess('write',$this->ref_id) and $this->object->isDocent($this->ilias->account))
00304 {
00305
00306 $tabs_gui->addTarget("ilinc_manage_course_documents",
00307 $url = $this->object->userLogin($this->ilias->account), "agenda","","_blank");
00308
00309
00310
00311 }
00312 }
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322 if ($rbacsystem->checkAccess('edit_permission',$this->ref_id))
00323 {
00324 $tabs_gui->addTarget("perm_settings",
00325 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
00326 }
00327
00328
00329 if ($this->ctrl->getTargetScript() == "repository.php" and !empty($_SESSION['il_rep_clipboard']))
00330 {
00331 $tabs_gui->addTarget("clipboard",
00332 $this->ctrl->getLinkTarget($this, "clipboard"), "clipboard", get_class($this));
00333 }
00334
00335 if ($this->ctrl->getTargetScript() == "adm_object.php")
00336 {
00337 if ($this->tree->getSavedNodeData($this->ref_id))
00338 {
00339 $tabs_gui->addTarget("trash",
00340 $this->ctrl->getLinkTarget($this, "trash"), "trash", get_class($this));
00341 }
00342 }
00343 }
00344
00345 function __unsetSessionVariables()
00346 {
00347 unset($_SESSION["grp_delete_member_ids"]);
00348 unset($_SESSION["grp_delete_subscriber_ids"]);
00349 unset($_SESSION["grp_search_str"]);
00350 unset($_SESSION["grp_search_for"]);
00351 unset($_SESSION["grp_role"]);
00352 unset($_SESSION["grp_group"]);
00353 unset($_SESSION["grp_archives"]);
00354 }
00355
00356 function __search($a_search_string,$a_search_for)
00357 {
00358 include_once("classes/class.ilSearch.php");
00359
00360 $this->lng->loadLanguageModule("content");
00361 $search =& new ilSearch($_SESSION["AccountId"]);
00362 $search->setPerformUpdate(false);
00363 $search->setSearchString(ilUtil::stripSlashes($a_search_string));
00364 $search->setCombination("and");
00365 $search->setSearchFor(array(0 => $a_search_for));
00366 $search->setSearchType('new');
00367
00368 if($search->validate($message))
00369 {
00370 $search->performSearch();
00371 }
00372 else
00373 {
00374 ilUtil::sendInfo($message,true);
00375 $this->ctrl->redirect($this,"searchUserForm");
00376 }
00377
00378 return $search->getResultByType($a_search_for);
00379 }
00380
00381 function __showSearchUserTable($a_result_set,$a_user_ids = NULL, $a_cmd = "search")
00382 {
00383 $return_to = "searchUserForm";
00384
00385 if ($a_cmd == "listUsersRole" or $a_cmd == "listUsersGroup")
00386 {
00387 $return_to = "search";
00388 }
00389
00390 $tbl =& $this->__initTableGUI();
00391 $tpl =& $tbl->getTemplateObject();
00392
00393
00394 $tpl->setCurrentBlock("tbl_form_header");
00395 $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
00396 $tpl->parseCurrentBlock();
00397
00398 $tpl->setCurrentBlock("tbl_action_btn");
00399 $tpl->setVariable("BTN_NAME",$return_to);
00400 $tpl->setVariable("BTN_VALUE",$this->lng->txt("back"));
00401 $tpl->parseCurrentBlock();
00402
00403 $tpl->setCurrentBlock("tbl_action_btn");
00404 $tpl->setVariable("BTN_NAME","addUser");
00405 $tpl->setVariable("BTN_VALUE",$this->lng->txt("add"));
00406 $tpl->parseCurrentBlock();
00407
00408 if (!empty($a_user_ids))
00409 {
00410
00411 $tpl->setCurrentBlock("tbl_action_toggle_checkboxes");
00412 $tpl->setVariable("JS_VARNAME","user");
00413 $tpl->setVariable("JS_ONCLICK",ilUtil::array_php2js($a_user_ids));
00414 $tpl->setVariable("TXT_CHECKALL", $this->lng->txt("check_all"));
00415 $tpl->setVariable("TXT_UNCHECKALL", $this->lng->txt("uncheck_all"));
00416 $tpl->parseCurrentBlock();
00417 }
00418
00419 $tpl->setCurrentBlock("tbl_action_row");
00420 $tpl->setVariable("COLUMN_COUNTS",5);
00421 $tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.gif"));
00422 $tpl->parseCurrentBlock();
00423
00424 $tbl->setTitle($this->lng->txt("ilinc_header_edit_users"),"icon_usr_b.gif",$this->lng->txt("ilinc_header_edit_users"));
00425 $tbl->setHeaderNames(array("",
00426 $this->lng->txt("username"),
00427 $this->lng->txt("firstname"),
00428 $this->lng->txt("lastname"),
00429 $this->lng->txt("last_visit")));
00430 $tbl->setHeaderVars(array("",
00431 "login",
00432 "firstname",
00433 "lastname",
00434 "last_visit"),
00435 array("ref_id" => $this->object->getRefId(),
00436 "cmd" => $a_cmd,
00437 "cmdClass" => "ilobjilinccoursegui",
00438 "cmdNode" => $_GET["cmdNode"]));
00439
00440 $tbl->setColumnWidth(array("","33%","33%","33%"));
00441
00442 $this->__setTableGUIBasicData($tbl,$a_result_set);
00443 $tbl->render();
00444
00445 $this->tpl->setVariable("SEARCH_RESULT_TABLE",$tbl->tpl->get());
00446
00447 return true;
00448 }
00449
00450 function __showSearchRoleTable($a_result_set,$a_role_ids = NULL)
00451 {
00452 $tbl =& $this->__initTableGUI();
00453 $tpl =& $tbl->getTemplateObject();
00454
00455 $tpl->setCurrentBlock("tbl_form_header");
00456 $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
00457 $tpl->parseCurrentBlock();
00458
00459 $tpl->setCurrentBlock("tbl_action_btn");
00460 $tpl->setVariable("BTN_NAME","searchUserForm");
00461 $tpl->setVariable("BTN_VALUE",$this->lng->txt("back"));
00462 $tpl->parseCurrentBlock();
00463
00464 $tpl->setCurrentBlock("tbl_action_btn");
00465 $tpl->setVariable("BTN_NAME","listUsersRole");
00466 $tpl->setVariable("BTN_VALUE",$this->lng->txt("grp_list_users"));
00467 $tpl->parseCurrentBlock();
00468
00469 if (!empty($a_role_ids))
00470 {
00471
00472 $tpl->setCurrentBlock("tbl_action_toggle_checkboxes");
00473 $tpl->setVariable("JS_VARNAME","role");
00474 $tpl->setVariable("JS_ONCLICK",ilUtil::array_php2js($a_role_ids));
00475 $tpl->setVariable("TXT_CHECKALL", $this->lng->txt("check_all"));
00476 $tpl->setVariable("TXT_UNCHECKALL", $this->lng->txt("uncheck_all"));
00477 $tpl->parseCurrentBlock();
00478 }
00479
00480 $tpl->setCurrentBlock("tbl_action_row");
00481 $tpl->setVariable("COLUMN_COUNTS",5);
00482 $tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.gif"));
00483 $tpl->parseCurrentBlock();
00484
00485 $tbl->setTitle($this->lng->txt("ilinc_header_edit_users"),"icon_usr_b.gif",$this->lng->txt("ilinc_header_edit_users"));
00486 $tbl->setHeaderNames(array("",
00487 $this->lng->txt("obj_role"),
00488 $this->lng->txt("grp_count_members")));
00489 $tbl->setHeaderVars(array("",
00490 "title",
00491 "nr_members"),
00492 array("ref_id" => $this->object->getRefId(),
00493 "cmd" => "search",
00494 "cmdClass" => "ilobjilincoursegui",
00495 "cmdNode" => $_GET["cmdNode"]));
00496
00497 $tbl->setColumnWidth(array("","80%","19%"));
00498
00499
00500 $this->__setTableGUIBasicData($tbl,$a_result_set,"role");
00501 $tbl->render();
00502
00503 $this->tpl->setVariable("SEARCH_RESULT_TABLE",$tbl->tpl->get());
00504
00505 return true;
00506 }
00507
00508 function __showSearchGroupTable($a_result_set,$a_grp_ids = NULL)
00509 {
00510 $tbl =& $this->__initTableGUI();
00511 $tpl =& $tbl->getTemplateObject();
00512
00513 $tpl->setCurrentBlock("tbl_form_header");
00514 $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
00515 $tpl->parseCurrentBlock();
00516
00517 $tpl->setCurrentBlock("tbl_action_btn");
00518 $tpl->setVariable("BTN_NAME","searchUserForm");
00519 $tpl->setVariable("BTN_VALUE",$this->lng->txt("back"));
00520 $tpl->parseCurrentBlock();
00521
00522 $tpl->setCurrentBlock("tbl_action_btn");
00523 $tpl->setVariable("BTN_NAME","listUsersGroup");
00524 $tpl->setVariable("BTN_VALUE",$this->lng->txt("grp_list_users"));
00525 $tpl->parseCurrentBlock();
00526
00527 if (!empty($a_grp_ids))
00528 {
00529
00530 $tpl->setCurrentBlock("tbl_action_toggle_checkboxes");
00531 $tpl->setVariable("JS_VARNAME","group");
00532 $tpl->setVariable("JS_ONCLICK",ilUtil::array_php2js($a_grp_ids));
00533 $tpl->setVariable("TXT_CHECKALL", $this->lng->txt("check_all"));
00534 $tpl->setVariable("TXT_UNCHECKALL", $this->lng->txt("uncheck_all"));
00535 $tpl->parseCurrentBlock();
00536 }
00537
00538 $tpl->setCurrentBlock("tbl_action_row");
00539 $tpl->setVariable("COLUMN_COUNTS",5);
00540 $tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.gif"));
00541 $tpl->parseCurrentBlock();
00542
00543 $tbl->setTitle($this->lng->txt("ilinc_header_edit_users"),"icon_usr_b.gif",$this->lng->txt("ilinc_header_edit_users"));
00544 $tbl->setHeaderNames(array("",
00545 $this->lng->txt("obj_grp"),
00546 $this->lng->txt("grp_count_members")));
00547 $tbl->setHeaderVars(array("",
00548 "title",
00549 "nr_members"),
00550 array("ref_id" => $this->object->getRefId(),
00551 "cmd" => "search",
00552 "cmdClass" => "ilobjilinccoursegui",
00553 "cmdNode" => $_GET["cmdNode"]));
00554
00555 $tbl->setColumnWidth(array("","80%","19%"));
00556
00557
00558 $this->__setTableGUIBasicData($tbl,$a_result_set,"group");
00559 $tbl->render();
00560
00561 $this->tpl->setVariable("SEARCH_RESULT_TABLE",$tbl->tpl->get());
00562
00563 return true;
00564 }
00565
00566 function __showMembersTable($a_result_set,$a_user_ids = NULL)
00567 {
00568 global $rbacsystem,$ilBench;
00569
00570 $actions = array("RemoveMember" => $this->lng->txt("remove"),"changeMember" => $this->lng->txt("change"));
00571
00572 $tbl =& $this->__initTableGUI();
00573 $tpl =& $tbl->getTemplateObject();
00574
00575 $tpl->setCurrentBlock("tbl_form_header");
00576 $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
00577 $tpl->parseCurrentBlock();
00578
00579 $tpl->setCurrentBlock("tbl_action_row");
00580
00581
00582 if ($rbacsystem->checkAccess("write",$this->object->getRefId()))
00583 {
00584 $tpl->setVariable("COLUMN_COUNTS",7);
00585 $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
00586
00587 foreach ($actions as $name => $value)
00588 {
00589 $tpl->setCurrentBlock("tbl_action_btn");
00590 $tpl->setVariable("BTN_NAME",$name);
00591 $tpl->setVariable("BTN_VALUE",$value);
00592 $tpl->parseCurrentBlock();
00593 }
00594
00595 if (!empty($a_user_ids))
00596 {
00597
00598 $tpl->setCurrentBlock("tbl_action_toggle_checkboxes");
00599 $tpl->setVariable("JS_VARNAME","user_id");
00600 $tpl->setVariable("JS_ONCLICK",ilUtil::array_php2js($a_user_ids));
00601 $tpl->setVariable("TXT_CHECKALL", $this->lng->txt("check_all"));
00602 $tpl->setVariable("TXT_UNCHECKALL", $this->lng->txt("uncheck_all"));
00603 $tpl->parseCurrentBlock();
00604 }
00605
00606 $tpl->setVariable("TPLPATH",$this->tpl->tplPath);
00607 }
00608
00609 $this->ctrl->setParameter($this,"cmd","members");
00610
00611
00612
00613 $tbl->setTitle($this->lng->txt("ilinc_involved_users"),"icon_usr_b.gif",$this->lng->txt("ilinc_involved_users"));
00614
00615
00616 if ($rbacsystem->checkAccess("write",$this->object->getRefId()))
00617 {
00618
00619 $tbl->setHeaderNames(array("",$this->lng->txt("username"),$this->lng->txt("firstname"),$this->lng->txt("lastname"),$this->lng->txt("ilinc_coursemember_status"),$this->lng->txt("role"),$this->lng->txt("grp_options")));
00620 $tbl->setHeaderVars(array("","login","firstname","lastname","ilinc_coursemember_status","role","functions"),$this->ctrl->getParameterArray($this,"",false));
00621 $tbl->setColumnWidth(array("","20%","15%","15%","20%","20%","10%"));
00622 }
00623 else
00624 {
00625
00626 $tbl->setHeaderNames(array($this->lng->txt("username"),$this->lng->txt("firstname"),$this->lng->txt("lastname"),$this->lng->txt("ilinc_coursemember_status"),$this->lng->txt("role"),$this->lng->txt("grp_options")));
00627 $tbl->setHeaderVars(array("login","firstname","lastname","ilinc_coursemember_status","role","functions"),$this->ctrl->getParameterArray($this,"",false));
00628 $tbl->setColumnWidth(array("20%","15%","15%","20%","20%","10%"));
00629 }
00630
00631 $this->__setTableGUIBasicData($tbl,$a_result_set,"members");
00632 $tbl->render();
00633 $this->tpl->setVariable("MEMBER_TABLE",$tbl->tpl->get());
00634
00635 return true;
00636 }
00637
00638
00639 function &__initTableGUI()
00640 {
00641 include_once "./Services/Table/classes/class.ilTableGUI.php";
00642
00643 return new ilTableGUI(0,false);
00644 }
00645
00646 function __setTableGUIBasicData(&$tbl,&$result_set,$from = "")
00647 {
00648 switch($from)
00649 {
00650 case "subscribers":
00651 $offset = $_GET["update_subscribers"] ? $_GET["offset"] : 0;
00652 $order = $_GET["update_subscribers"] ? $_GET["sort_by"] : 'login';
00653 $direction = $_GET["update_subscribers"] ? $_GET["sort_order"] : '';
00654 break;
00655
00656 case "group":
00657 $offset = $_GET["offset"];
00658 $order = $_GET["sort_by"] ? $_GET["sort_by"] : "title";
00659 $direction = $_GET["sort_order"];
00660 break;
00661
00662 case "role":
00663 $offset = $_GET["offset"];
00664 $order = $_GET["sort_by"] ? $_GET["sort_by"] : "title";
00665 $direction = $_GET["sort_order"];
00666 break;
00667
00668 default:
00669 $offset = $_GET["offset"];
00670
00671 if ($_GET["sort_by"] == "title" or empty($_GET["sort_by"]))
00672 {
00673 $_GET["sort_by"] = "login";
00674 }
00675 $order = $_GET["sort_by"];
00676 $direction = $_GET["sort_order"];
00677 break;
00678 }
00679
00680 $tbl->setOrderColumn($order);
00681 $tbl->setOrderDirection($direction);
00682 $tbl->setOffset($offset);
00683 $tbl->setLimit($_GET["limit"]);
00684
00685 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00686 $tbl->setData($result_set);
00687 }
00688
00689 function listUsersRoleObject()
00690 {
00691 global $rbacsystem,$rbacreview;
00692
00693 $_SESSION["grp_role"] = $_POST["role"] = $_POST["role"] ? $_POST["role"] : $_SESSION["grp_role"];
00694
00695
00696 if(!$rbacsystem->checkAccess("write", $this->object->getRefId()))
00697 {
00698 $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilias->error_obj->MESSAGE);
00699 }
00700
00701 if(!is_array($_POST["role"]))
00702 {
00703 ilUtil::sendInfo($this->lng->txt("grp_no_roles_selected"));
00704 $this->searchObject();
00705
00706 return false;
00707 }
00708
00709 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.grp_usr_selection.html");
00710 $this->__showButton("searchUserForm",$this->lng->txt("grp_new_search"));
00711
00712
00713 $members = array();
00714 foreach($_POST["role"] as $role_id)
00715 {
00716 $members = array_merge($rbacreview->assignedUsers($role_id),$members);
00717 }
00718
00719 $members = array_unique($members);
00720
00721
00722 $counter = 0;
00723 $f_result = array();
00724 foreach($members as $user)
00725 {
00726 if(!$tmp_obj = ilObjectFactory::getInstanceByObjId($user,false))
00727 {
00728 continue;
00729 }
00730
00731 $user_ids[$counter] = $user;
00732
00733 $f_result[$counter][] = ilUtil::formCheckbox(0,"user[]",$user);
00734 $f_result[$counter][] = $tmp_obj->getLogin();
00735 $f_result[$counter][] = $tmp_obj->getLastname();
00736 $f_result[$counter][] = $tmp_obj->getFirstname();
00737 $f_result[$counter][] = ilFormat::formatDate($tmp_obj->getLastLogin());
00738
00739 unset($tmp_obj);
00740 ++$counter;
00741 }
00742 $this->__showSearchUserTable($f_result,$user_ids,"listUsersRole");
00743
00744 return true;
00745 }
00746
00747 function listUsersGroupObject()
00748 {
00749 global $rbacsystem,$rbacreview,$tree;
00750
00751 $_SESSION["grp_group"] = $_POST["group"] = $_POST["group"] ? $_POST["group"] : $_SESSION["grp_group"];
00752
00753
00754 if(!$rbacsystem->checkAccess("write", $this->object->getRefId()))
00755 {
00756 $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilias->error_obj->MESSAGE);
00757 }
00758
00759 if(!is_array($_POST["group"]))
00760 {
00761 ilUtil::sendInfo($this->lng->txt("grp_no_groups_selected"));
00762 $this->searchObject();
00763
00764 return false;
00765 }
00766
00767 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.grp_usr_selection.html");
00768 $this->__showButton("searchUserForm",$this->lng->txt("grp_new_search"));
00769
00770
00771 $members = array();
00772 foreach($_POST["group"] as $group_id)
00773 {
00774 if (!$tree->isInTree($group_id))
00775 {
00776 continue;
00777 }
00778 if (!$tmp_obj = ilObjectFactory::getInstanceByRefId($group_id))
00779 {
00780 continue;
00781 }
00782
00783 $members = array_merge($tmp_obj->getGroupMemberIds(),$members);
00784
00785 unset($tmp_obj);
00786 }
00787
00788 $members = array_unique($members);
00789
00790
00791 $counter = 0;
00792 $f_result = array();
00793 foreach($members as $user)
00794 {
00795 if(!$tmp_obj = ilObjectFactory::getInstanceByObjId($user,false))
00796 {
00797 continue;
00798 }
00799
00800 $user_ids[$counter] = $user;
00801
00802 $f_result[$counter][] = ilUtil::formCheckbox(0,"user[]",$user);
00803 $f_result[$counter][] = $tmp_obj->getLogin();
00804 $f_result[$counter][] = $tmp_obj->getLastname();
00805 $f_result[$counter][] = $tmp_obj->getFirstname();
00806 $f_result[$counter][] = ilFormat::formatDate($tmp_obj->getLastLogin());
00807
00808 unset($tmp_obj);
00809 ++$counter;
00810 }
00811 $this->__showSearchUserTable($f_result,$user_ids,"listUsersGroup");
00812
00813 return true;
00814 }
00815
00820 function canceledObject()
00821 {
00822 $return_location = $_GET["cmd_return_location"];
00823 if (strcmp($return_location, "") == 0)
00824 {
00825 $return_location = "members";
00826 }
00827
00828 ilUtil::sendInfo($this->lng->txt("action_aborted"),true);
00829 $this->ctrl->redirect($this, $return_location);
00830 }
00831
00836 function cancelMemberObject()
00837 {
00838 $return_location = "members";
00839
00840 ilUtil::sendInfo($this->lng->txt("action_aborted"),true);
00841 ilUtil::redirect($this->ctrl->getLinkTarget($this,$return_location));
00842 }
00843
00847 function membersObject()
00848 {
00849 global $rbacsystem,$ilBench,$ilDB,$lng;
00850
00851 if (!$this->ilias->getSetting("ilinc_active"))
00852 {
00853 $this->ilias->raiseError($lng->txt("ilinc_server_not_active"),$this->ilias->error_obj->MESSAGE);
00854 }
00855
00856 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.icrs_members.html","ilinc");
00857 $this->__setSubTabs('members');
00858
00859 $this->lng->loadLanguageModule('ilinc');
00860
00861
00862 $is_admin = (bool) $rbacsystem->checkAccess("write", $this->object->getRefId());
00863
00864 if ($is_admin)
00865 {
00866 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00867 $this->tpl->setCurrentBlock("btn_cell");
00868 $this->tpl->setVariable("BTN_LINK",$this->ctrl->getLinkTargetByClass('ilRepositorySearchGUI','start'));
00869 $this->tpl->setVariable("BTN_TXT",$this->lng->txt("ilinc_add_user"));
00870 $this->tpl->parseCurrentBlock();
00871 }
00872
00873
00874 $val_contact = "<img src=\"".ilUtil::getImagePath("icon_pencil_b.gif")."\" alt=\"".$this->lng->txt("ilinc_mem_send_mail")."\" title=\"".$this->lng->txt("ilinc_mem_send_mail")."\" border=\"0\" vspace=\"0\"/>";
00875 $val_change = "<img src=\"".ilUtil::getImagePath("icon_change_b.gif")."\" alt=\"".$this->lng->txt("ilinc_mem_change_status")."\" title=\"".$this->lng->txt("ilinc_mem_change_status")."\" border=\"0\" vspace=\"0\"/>";
00876 $val_leave = "<img src=\"".ilUtil::getImagePath("icon_group_out_b.gif")."\" alt=\"".$this->lng->txt("ilinc_mem_leave")."\" title=\"".$this->lng->txt("ilinc_mem_leave")."\" border=\"0\" vspace=\"0\"/>";
00877
00878
00879
00880 $access_leave = $rbacsystem->checkAccess("leave",$this->object->getRefId());
00881 $access_write = $rbacsystem->checkAccess("write",$this->object->getRefId());
00882
00883 $member_ids = $this->object->getMemberIds();
00884
00885
00886 $members = $this->object->getMemberData($member_ids);
00887
00888
00889 $docent_ids = $this->object->getiLincMemberIds(true);
00890 $student_ids = $this->object->getiLincMemberIds(false);
00891
00892 $account_id = $this->ilias->account->getId();
00893 $counter = 0;
00894
00895 foreach ($members as $mem)
00896 {
00897 $link_contact = "ilias.php?baseClass=ilMailGUI&type=new&rcp_to=".$mem["login"];
00898 $link_change = $this->ctrl->getLinkTarget($this,"changeMember")."&mem_id=".$mem["id"];
00899
00900 if (($mem["id"] == $account_id && $access_leave) || $access_delete)
00901 {
00902 $link_leave = $this->ctrl->getLinkTarget($this,"RemoveMember")."&mem_id=".$mem["id"];
00903 }
00904
00905
00906 if ($access_write)
00907 {
00908 $member_functions = "<a href=\"$link_change\">$val_change</a>";
00909 }
00910
00911 if (($mem["id"] == $account_id && $access_leave) || $access_write)
00912 {
00913 $link_leave = $this->ctrl->getLinkTarget($this,"RemoveMember")."&mem_id=".$mem["id"];
00914 $member_functions .="<a href=\"$link_leave\">$val_leave</a>";
00915 }
00916
00917
00918 $str_member_roles = $this->object->getMemberRolesTitle($mem["id"]);
00919
00920 if ($access_write)
00921 {
00922 $result_set[$counter][] = ilUtil::formCheckBox(0,"user_id[]",$mem["id"]);
00923 }
00924
00925 $user_ids[$counter] = $mem["id"];
00926
00927 $status = $this->object->checkiLincMemberStatus($mem['ilinc_id'],$docent_ids,$student_ids);
00928
00929 if ($status == ILINC_MEMBER_NOTSET)
00930 {
00931 $status = "<span class='warning'>".$this->lng->txt($status)."</span>";
00932 }
00933 else
00934 {
00935 $status = $this->lng->txt($status);
00936 }
00937
00938
00939
00940 $result_set[$counter][] = $mem["login"];
00941 $result_set[$counter][] = $mem["firstname"];
00942 $result_set[$counter][] = $mem["lastname"];
00943 $result_set[$counter][] = $status;
00944 $result_set[$counter][] = $str_member_roles;
00945 $result_set[$counter][] = "<a href=\"$link_contact\">".$val_contact."</a>".$member_functions;
00946
00947 ++$counter;
00948
00949 unset($member_functions);
00950 }
00951
00952 return $this->__showMembersTable($result_set,$user_ids);
00953 }
00954
00955 function &executeCommand()
00956 {
00957 global $ilUser,$rbacsystem,$ilAccess,$ilErr;
00958
00959 $next_class = $this->ctrl->getNextClass($this);
00960 $cmd = $this->ctrl->getCmd();
00961 $this->prepareOutput();
00962
00963 switch($next_class)
00964 {
00965 case "ilconditionhandlerinterface":
00966 include_once './classes/class.ilConditionHandlerInterface.php';
00967
00968 if($_GET['item_id'])
00969 {
00970 $new_gui =& new ilConditionHandlerInterface($this,(int) $_GET['item_id']);
00971 $this->ctrl->saveParameter($this,'item_id',$_GET['item_id']);
00972 $this->ctrl->forwardCommand($new_gui);
00973 }
00974 else
00975 {
00976 $new_gui =& new ilConditionHandlerInterface($this);
00977 $this->ctrl->forwardCommand($new_gui);
00978 }
00979 break;
00980
00981 case 'ilrepositorysearchgui':
00982 include_once('./Services/Search/classes/class.ilRepositorySearchGUI.php');
00983 $rep_search =& new ilRepositorySearchGUI();
00984 $rep_search->setCallback($this,'addUserObject');
00985
00986
00987 $this->tabs_gui->setTabActive('members');
00988 $this->ctrl->setReturn($this,'members');
00989 $ret =& $this->ctrl->forwardCommand($rep_search);
00990 $this->__setSubTabs('members');
00991 $this->tabs_gui->setSubTabActive('members');
00992 break;
00993
00994 case "ilregistergui":
00995 $this->ctrl->setReturn($this, "");
00996 $reg_gui = new ilRegisterGUI();
00997
00998 $ret =& $this->ctrl->forwardCommand($reg_gui);
00999 break;
01000
01001 case "ilobjilincclassroomgui":
01002 include_once ('class.ilObjiLincClassroomGUI.php');
01003 $icla_gui = new ilObjiLincClassroomGUI($_GET['class_id'],$this->ref_id);
01004 $ret =& $this->ctrl->forwardCommand($icla_gui);
01005 break;
01006
01007 case 'ilpermissiongui':
01008 include_once("./classes/class.ilPermissionGUI.php");
01009 $perm_gui =& new ilPermissionGUI($this);
01010 $ret =& $this->ctrl->forwardCommand($perm_gui);
01011 break;
01012
01013 case 'ilobjusergui':
01014 require_once './Services/User/classes/class.ilObjUserGUI.php';
01015 $user_gui = new ilObjUserGUI("",$_GET["user"], false, false);
01016 $html = $this->ctrl->forwardCommand($user_gui);
01017 $this->__setSubTabs('members');
01018 $this->tabs_gui->setTabActive('group_members');
01019 $this->tabs_gui->setSubTabActive('grp_members_gallery');
01020 $this->tpl->setVariable("ADM_CONTENT", $html);
01021 break;
01022
01023 default:
01024 if (!$this->getCreationMode() and !$ilAccess->checkAccess('visible','',$this->object->getRefId(),'icrs'))
01025 {
01026 $ilErr->raiseError($this->lng->txt("msg_no_perm_read"),$ilErr->MESSAGE);
01027 }
01028
01029
01030
01031
01032
01033
01034
01035
01036 if(!$cmd)
01037 {
01038 $cmd = 'view';
01039 }
01040 $cmd .= 'Object';
01041 $this->$cmd();
01042 break;
01043
01044
01045
01046
01047
01048
01049
01050
01051
01052
01053
01054
01055
01056
01057
01058
01059
01060
01061
01062
01063
01064
01065
01066 }
01067 }
01068
01069 function viewObject()
01070 {
01071 if ($this->ctrl->getTargetScript() == "adm_object.php")
01072 {
01073 parent::viewObject();
01074 return true;
01075 }
01076
01077 $this->renderObject();
01078 return true;
01079 }
01080
01085 function getSubItems()
01086 {
01087 $objects = array();
01088
01089 if (!($objects = $this->object->getClassrooms()))
01090 {
01091 ilUtil::sendInfo($this->lng->txt($this->object->getErrorMsg()));
01092 return;
01093 }
01094
01095 foreach ($objects as $key => $object)
01096 {
01097 $this->items['icla'][$key] = $object;
01098 }
01099 }
01100
01104 function renderItemList($a_type = "all")
01105 {
01106 global $objDefinition;
01107
01108 $html = "";
01109 $this->adminCommands = false;
01110
01111 $class = $objDefinition->getClassName("icla");
01112 $location = $objDefinition->getLocation("icla");
01113 $full_class = "ilObj".$class."ListGUI";
01114 include_once($location."/class.".$full_class.".php");
01115
01116 $item_list_gui = new $full_class();
01117 $item_list_gui->setContainerObject($this);
01118
01119 $tpl =& $this->newBlockTemplate();
01120 $first = true;
01121
01122 $item_html = array();
01123
01124 if (is_array($this->items['icla']))
01125 {
01126 foreach($this->items['icla'] as $key => $item)
01127 {
01128
01129 $html = $item_list_gui->getListItemHTML($this->object->getRefId(),
01130 $key, $item["name"], $item["description"],$item);
01131
01132 if ($html != "")
01133 {
01134 $item_html[] = array("html" => $html, "item_id" => $item["ref_id"]);
01135 }
01136 }
01137
01138
01139 if (count($item_html) > 0)
01140 {
01141
01142 if (!$first)
01143 {
01144 $this->addSeparatorRow($tpl);
01145 }
01146
01147 $first = false;
01148
01149
01150 $this->addHeaderRow($tpl, 'icla');
01151 $this->resetRowType();
01152
01153
01154 foreach($item_html as $item)
01155 {
01156 $this->addStandardRow($tpl, $item["html"], $item["item_id"]);
01157 }
01158 }
01159 }
01160
01161 $html = $tpl->get();
01162 return $html;
01163 }
01164
01165 function agendaObject()
01166 {
01167
01168 $url = $this->object->userLogin($this->ilias->account);
01169
01170 if (!$url)
01171 {
01172 $this->ilias->raiseError($this->object->getErrorMsg(),$this->ilias->error_obj->FATAL);
01173 }
01174
01175 ilUtil::redirect(trim($url));
01176 }
01177
01178 function searchUserFormObject()
01179 {
01180 global $rbacsystem;
01181
01182 $this->lng->loadLanguageModule('search');
01183
01184
01185 if(!$rbacsystem->checkAccess("write", $this->object->getRefId()))
01186 {
01187 $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilias->error_obj->MESSAGE);
01188 }
01189
01190 $this->tpl->addBlockFile("ADM_CONTENT","adm_content","tpl.grp_members_search.html");
01191
01192 $this->tpl->setVariable("F_ACTION",$this->ctrl->getFormAction($this));
01193 $this->tpl->setVariable("SEARCH_ASSIGN_USR",$this->lng->txt("grp_search_members"));
01194 $this->tpl->setVariable("SEARCH_SEARCH_TERM",$this->lng->txt("search_search_term"));
01195 $this->tpl->setVariable("SEARCH_VALUE",$_SESSION["grp_search_str"] ? $_SESSION["grp_search_str"] : "");
01196 $this->tpl->setVariable("SEARCH_FOR",$this->lng->txt("exc_search_for"));
01197 $this->tpl->setVariable("SEARCH_ROW_TXT_USER",$this->lng->txt("exc_users"));
01198 $this->tpl->setVariable("SEARCH_ROW_TXT_ROLE",$this->lng->txt("exc_roles"));
01199 $this->tpl->setVariable("SEARCH_ROW_TXT_GROUP",$this->lng->txt("exc_groups"));
01200 $this->tpl->setVariable("BTN2_VALUE",$this->lng->txt("cancel"));
01201 $this->tpl->setVariable("BTN1_VALUE",$this->lng->txt("search"));
01202
01203 $usr = ($_POST["search_for"] == "usr" || $_POST["search_for"] == "") ? 1 : 0;
01204 $grp = ($_POST["search_for"] == "grp") ? 1 : 0;
01205 $role = ($_POST["search_for"] == "role") ? 1 : 0;
01206
01207 $this->tpl->setVariable("SEARCH_ROW_CHECK_USER",ilUtil::formRadioButton($usr,"search_for","usr"));
01208 $this->tpl->setVariable("SEARCH_ROW_CHECK_ROLE",ilUtil::formRadioButton($role,"search_for","role"));
01209 $this->tpl->setVariable("SEARCH_ROW_CHECK_GROUP",ilUtil::formRadioButton($grp,"search_for","grp"));
01210
01211 $this->__unsetSessionVariables();
01212 }
01213
01214 function searchObject()
01215 {
01216 global $rbacsystem,$tree;
01217
01218 $_SESSION["grp_search_str"] = $_POST["search_str"] = $_POST["search_str"] ? $_POST["search_str"] : $_SESSION["grp_search_str"];
01219 $_SESSION["grp_search_for"] = $_POST["search_for"] = $_POST["search_for"] ? $_POST["search_for"] : $_SESSION["grp_search_for"];
01220
01221
01222 if(!$rbacsystem->checkAccess("write", $this->object->getRefId()))
01223 {
01224 $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilias->error_obj->MESSAGE);
01225 }
01226
01227 if(!isset($_POST["search_for"]) or !isset($_POST["search_str"]))
01228 {
01229 ilUtil::sendInfo($this->lng->txt("grp_search_enter_search_string"));
01230 $this->searchUserFormObject();
01231
01232 return false;
01233 }
01234
01235 if(!count($result = $this->__search(ilUtil::stripSlashes($_POST["search_str"]),$_POST["search_for"])))
01236 {
01237 ilUtil::sendInfo($this->lng->txt("grp_no_results_found"));
01238 $this->searchUserFormObject();
01239
01240 return false;
01241 }
01242
01243 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.grp_usr_selection.html");
01244 $this->__showButton("searchUserForm",$this->lng->txt("grp_new_search"));
01245
01246 $counter = 0;
01247 $f_result = array();
01248
01249 switch($_POST["search_for"])
01250 {
01251 case "usr":
01252 foreach($result as $user)
01253 {
01254 if(!$tmp_obj = ilObjectFactory::getInstanceByObjId($user["id"],false))
01255 {
01256 continue;
01257 }
01258
01259 $user_ids[$counter] = $user["id"];
01260
01261 $f_result[$counter][] = ilUtil::formCheckbox(0,"user[]",$user["id"]);
01262 $f_result[$counter][] = $tmp_obj->getLogin();
01263 $f_result[$counter][] = $tmp_obj->getFirstname();
01264 $f_result[$counter][] = $tmp_obj->getLastname();
01265 $f_result[$counter][] = ilFormat::formatDate($tmp_obj->getLastLogin());
01266
01267 unset($tmp_obj);
01268 ++$counter;
01269 }
01270 $this->__showSearchUserTable($f_result,$user_ids);
01271
01272 return true;
01273
01274 case "role":
01275 foreach($result as $role)
01276 {
01277
01278 if ($role["id"] == ANONYMOUS_ROLE_ID)
01279 {
01280 continue;
01281 }
01282
01283 if(!$tmp_obj = ilObjectFactory::getInstanceByObjId($role["id"],false))
01284 {
01285 continue;
01286 }
01287
01288
01289 if ($tmp_obj->getCountMembers() == 0)
01290 {
01291 continue;
01292 }
01293
01294 $role_ids[$counter] = $role["id"];
01295
01296 $f_result[$counter][] = ilUtil::formCheckbox(0,"role[]",$role["id"]);
01297 $f_result[$counter][] = array($tmp_obj->getTitle(),$tmp_obj->getDescription());
01298 $f_result[$counter][] = $tmp_obj->getCountMembers();
01299
01300 unset($tmp_obj);
01301 ++$counter;
01302 }
01303
01304 $this->__showSearchRoleTable($f_result,$role_ids);
01305
01306 return true;
01307
01308 case "grp":
01309 foreach($result as $group)
01310 {
01311 if(!$tree->isInTree($group["id"]))
01312 {
01313 continue;
01314 }
01315
01316 if(!$tmp_obj = ilObjectFactory::getInstanceByRefId($group["id"],false))
01317 {
01318 continue;
01319 }
01320
01321
01322 if ($tmp_obj->getId() == $this->object->getId())
01323 {
01324 continue;
01325 }
01326
01327 $grp_ids[$counter] = $group["id"];
01328
01329 $f_result[$counter][] = ilUtil::formCheckbox(0,"group[]",$group["id"]);
01330 $f_result[$counter][] = array($tmp_obj->getTitle(),$tmp_obj->getDescription());
01331 $f_result[$counter][] = $tmp_obj->getCountMembers();
01332
01333 unset($tmp_obj);
01334 ++$counter;
01335 }
01336
01337 if(!count($f_result))
01338 {
01339 ilUtil::sendInfo($this->lng->txt("grp_no_results_found"));
01340 $this->searchUserFormObject();
01341
01342 return false;
01343 }
01344
01345 $this->__showSearchGroupTable($f_result,$grp_ids);
01346
01347 return true;
01348 }
01349 }
01350
01355 function addUserObject()
01356 {
01357 $user_ids = $_POST["user"];
01358
01359 $mail = new ilMail($_SESSION["AccountId"]);
01360
01361 if (empty($user_ids[0]))
01362 {
01363
01364 $this->ilErr->raiseError($this->lng->txt("no_checkbox"),$this->ilErr->MESSAGE);
01365 }
01366
01367 foreach ($user_ids as $new_member)
01368 {
01369 $user_obj = $this->ilias->obj_factory->getInstanceByObjId($new_member);
01370
01371 if (!$this->object->addMember($user_obj,$this->object->getDefaultMemberRole(),false))
01372 {
01373
01374 $this->ilErr->raiseError($this->object->getErrorMsg(),$this->ilErr->MESSAGE);
01375 }
01376
01377 $user_obj->addDesktopItem($this->object->getRefId(),"icrs");
01378 $mail->sendMail($user_obj->getLogin(),"","",$this->lng->txtlng("common","ilinc_mail_subj_new_subscription",$user_obj->getLanguage()).": ".$this->object->getTitle(),$this->lng->txtlng("common","ilinc_mail_body_new_subscription",$user_obj->getLanguage()),array(),array('normal'));
01379
01380 unset($user_obj);
01381 }
01382
01383
01384
01385 unset($_SESSION["saved_post"]);
01386
01387 ilUtil::sendInfo($this->lng->txt("ilinc_msg_member_assigned"),true);
01388 ilUtil::redirect($this->ctrl->getLinkTarget($this,"members"));
01389 }
01390
01395 function removeMemberObject()
01396 {
01397 global $ilUser,$rbacreview;
01398
01399 $user_ids = array();
01400
01401 if (isset($_POST["user_id"]))
01402 {
01403 $user_ids = $_POST["user_id"];
01404 }
01405 else if (isset($_GET["mem_id"]))
01406 {
01407 $user_ids[] = $_GET["mem_id"];
01408 }
01409
01410 if (empty($user_ids[0]))
01411 {
01412 $this->ilErr->raiseError($this->lng->txt("no_checkbox"),$this->ilErr->MESSAGE);
01413 }
01414
01415 if (count($user_ids) == 1 and $this->ilias->account->getId() != $user_ids[0])
01416 {
01417 if (!in_array(SYSTEM_ROLE_ID,$rbacreview->assignedRoles($ilUser->getId()))
01418 and !in_array($this->ilias->account->getId(),$this->object->getAdminIds()))
01419 {
01420 $this->ilErr->raiseError($this->lng->txt("ilinc_err_no_permission"),$this->ilErr->MESSAGE);
01421 }
01422 }
01423
01424 $is_dismiss_me = array_search($this->ilias->account->getId(),$user_ids);
01425
01426 $confirm = "confirmedRemoveMember";
01427 $cancel = "canceled";
01428 $info = ($is_dismiss_me !== false) ? "ilinc_dismiss_myself" : "ilinc_dismiss_member";
01429 $status = "";
01430 $return = "members";
01431 $this->confirmationObject($user_ids, $confirm, $cancel, $info, $status, $return);
01432 }
01433
01438 function confirmationObject($user_id="", $confirm, $cancel, $info="", $status="",$a_cmd_return_location = "")
01439 {
01440 $this->data["cols"] = array("type", "title", "description", "last_change");
01441
01442 if (is_array($user_id))
01443 {
01444 foreach ($user_id as $id)
01445 {
01446 $obj_data =& $this->ilias->obj_factory->getInstanceByObjId($id);
01447
01448 $this->data["data"]["$id"] = array(
01449 "type" => $obj_data->getType(),
01450 "title" => $obj_data->getTitle(),
01451 "desc" => $obj_data->getDescription(),
01452 "last_update" => $obj_data->getLastUpdateDate(),
01453
01454 );
01455 }
01456 }
01457 else
01458 {
01459 $obj_data =& $this->ilias->obj_factory->getInstanceByObjId($user_id);
01460
01461 $this->data["data"]["$id"] = array(
01462 "type" => $obj_data->getType(),
01463 "title" => $obj_data->getTitle(),
01464 "desc" => $obj_data->getDescription(),
01465 "last_update" => $obj_data->getLastUpdateDate(),
01466 );
01467 }
01468
01469
01470 if(is_array($user_id))
01471 {
01472 $_SESSION["saved_post"]["user_id"] = $user_id;
01473 }
01474 else
01475 {
01476 $_SESSION["saved_post"]["user_id"][0] = $user_id;
01477 }
01478
01479 if (isset($status))
01480 {
01481 $_SESSION["saved_post"]["status"] = $status;
01482 }
01483
01484 $this->data["buttons"] = array( $cancel => $this->lng->txt("cancel"),
01485 $confirm => $this->lng->txt("confirm"));
01486
01487 $this->getTemplateFile("confirm");
01488
01489 $this->tpl->setVariable("TPLPATH",$this->tpl->tplPath);
01490
01491 ilUtil::infoPanel();
01492
01493 ilUtil::sendInfo($this->lng->txt($info));
01494
01495 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)."&cmd_return_location=".$a_cmd_return_location);
01496
01497
01498 foreach ($this->data["cols"] as $key)
01499 {
01500 $this->tpl->setCurrentBlock("table_header");
01501 $this->tpl->setVariable("TEXT",$this->lng->txt($key));
01502 $this->tpl->parseCurrentBlock();
01503 }
01504
01505
01506
01507 $counter = 0;
01508
01509 foreach ($this->data["data"] as $key => $value)
01510 {
01511
01512 foreach ($value as $key => $cell_data)
01513 {
01514 $this->tpl->setCurrentBlock("table_cell");
01515
01516
01517 if ($key == "type")
01518 {
01519 $this->tpl->setVariable("TEXT_CONTENT",ilUtil::getImageTagByType($cell_data,$this->tpl->tplPath));
01520 }
01521 else
01522 {
01523 $this->tpl->setVariable("TEXT_CONTENT",$cell_data);
01524 }
01525 $this->tpl->parseCurrentBlock();
01526 }
01527
01528 $this->tpl->setCurrentBlock("table_row");
01529 $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor(++$counter,"tblrow1","tblrow2"));
01530 $this->tpl->parseCurrentBlock();
01531
01532 }
01533
01534
01535
01536 foreach ($this->data["buttons"] as $name => $value)
01537 {
01538 $this->tpl->setCurrentBlock("operation_btn");
01539 $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("spacer.gif"));
01540 $this->tpl->setVariable("BTN_NAME",$name);
01541 $this->tpl->setVariable("BTN_VALUE",$value);
01542 $this->tpl->parseCurrentBlock();
01543 }
01544 }
01545
01552 function confirmedRemoveMemberObject()
01553 {
01554 $removed_self = false;
01555
01556 $mail = new ilMail($_SESSION["AccountId"]);
01557
01558
01559 foreach($_SESSION["saved_post"]["user_id"] as $member_id)
01560 {
01561 $user_obj = new ilObjUser($member_id);
01562
01563 if (!$this->object->removeMember($user_obj))
01564 {
01565 ilUtil::sendInfo($this->lng->txt($this->object->getErrorMsg()),true);
01566 ilUtil::redirect($this->ctrl->getLinkTarget($this,"members"));
01567 }
01568
01569 $user_obj->dropDesktopItem($this->object->getRefId(), "icrs");
01570
01571 if (!$removed_self and $user_obj->getId() == $this->ilias->account->getId())
01572 {
01573 $removed_self = true;
01574 }
01575 else
01576 {
01577 $mail->sendMail($user_obj->getLogin(),"","",$this->lng->txtlng("common","ilinc_mail_subj_subscription_cancelled",$user_obj->getLanguage()).": ".$this->object->getTitle(),$this->lng->txtlng("common","ilinc_mail_body_subscription_cancelled",$user_obj->getLanguage()),array(),array('normal'));
01578 }
01579 }
01580
01581 unset($_SESSION["saved_post"]);
01582
01583 ilUtil::sendInfo($this->lng->txt("ilinc_msg_membership_annulled"),true);
01584
01585 if ($removed_self)
01586 {
01587 ilUtil::redirect("repository.php?ref_id=".$this->tree->getParentId($this->ref_id));
01588 }
01589
01590 ilUtil::redirect($this->ctrl->getLinkTarget($this,"members"));
01591 }
01592
01597 function changeMemberObject()
01598 {
01599 global $rbacreview,$ilUser;
01600
01601 if ($_GET["sort_by"] == "title" or $_GET["sort_by"] == "")
01602 {
01603 $_GET["sort_by"] = "login";
01604 }
01605
01606 $member_ids = array();
01607
01608 if (isset($_POST["user_id"]))
01609 {
01610 $member_ids = $_POST["user_id"];
01611 }
01612 else if (isset($_GET["mem_id"]))
01613 {
01614 $member_ids[0] = $_GET["mem_id"];
01615 }
01616
01617 if (empty($member_ids[0]))
01618 {
01619 $this->ilErr->raiseError($this->lng->txt("no_checkbox"),$this->ilErr->MESSAGE);
01620 }
01621
01622 if (!in_array(SYSTEM_ROLE_ID,$rbacreview->assignedRoles($ilUser->getId()))
01623 and !in_array($this->ilias->account->getId(),$this->object->getAdminIds()))
01624 {
01625 $this->ilErr->raiseError($this->lng->txt("grp_err_no_permission"),$this->ilErr->MESSAGE);
01626 }
01627
01628 $stati = array_flip($this->object->getLocalRoles(true));
01629
01630
01631 $docent_ids = $this->object->getiLincMemberIds(true);
01632 $student_ids = $this->object->getiLincMemberIds(false);
01633
01634
01635 foreach ($member_ids as $member_id)
01636 {
01637 $member =& $this->ilias->obj_factory->getInstanceByObjId($member_id);
01638 $mem_status = $this->object->getMemberRoles($member_id);
01639
01640 include_once ('class.ilObjiLincUser.php');
01641 $ilinc_user = new ilObjiLincUser($member);
01642
01643 $ilinc_status = $this->object->checkiLincMemberStatus($ilinc_user->id,$docent_ids,$student_ids);
01644
01645 $docent = 0; $student = 0;
01646
01647 if ($ilinc_status == ILINC_MEMBER_DOCENT)
01648 {
01649 $docent = 1;
01650 }
01651 elseif ($ilinc_status == ILINC_MEMBER_STUDENT)
01652 {
01653 $student = 1;
01654 }
01655
01656 $radio1 = ilUtil::formRadioButton($docent,"ilinc_member_status_select[".$member->getId()."][".$ilinc_user->id."]",ILINC_MEMBER_DOCENT);
01657 $radio2 = ilUtil::formRadioButton($student,"ilinc_member_status_select[".$member->getId()."][".$ilinc_user->id."]",ILINC_MEMBER_STUDENT);
01658
01659
01660 $this->data["data"][$member->getId()]= array(
01661 "login" => $member->getLogin(),
01662 "firstname" => $member->getFirstname(),
01663 "lastname" => $member->getLastname(),
01664 "ilinc_coursemember_status" => $radio1." ".$this->lng->txt("ilinc_docent")."<br/>".$radio2." ".$this->lng->txt("ilinc_student"),
01665 "grp_role" => ilUtil::formSelect($mem_status,"member_status_select[".$member->getId()."][]",$stati,true,true,3)
01666 );
01667 }
01668
01669 unset($member);
01670 unset($ilinc_user);
01671
01672 ilUtil::infoPanel();
01673
01674 $this->tpl->addBlockfile("ADM_CONTENT", "member_table", "tpl.table.html");
01675
01676
01677 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
01678
01679 $this->data["buttons"] = array( "members" => $this->lng->txt("back"),
01680 "updateMemberStatus" => $this->lng->txt("confirm"));
01681
01682 $this->tpl->setCurrentBlock("tbl_action_row");
01683 $this->tpl->setVariable("COLUMN_COUNTS",5);
01684
01685 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
01686
01687 foreach ($this->data["buttons"] as $name => $value)
01688 {
01689 $this->tpl->setCurrentBlock("tbl_action_btn");
01690 $this->tpl->setVariable("BTN_NAME",$name);
01691 $this->tpl->setVariable("BTN_VALUE",$value);
01692 $this->tpl->parseCurrentBlock();
01693 }
01694
01695
01696 $this->data["data"] = ilUtil::sortArray($this->data["data"], $_GET["sort_by"], $_GET["sort_order"]);
01697 $output = array_slice($this->data["data"],$_GET["offset"],$_GET["limit"]);
01698
01699
01700 include_once "./Services/Table/classes/class.ilTableGUI.php";
01701
01702 $tbl = new ilTableGUI($output);
01703
01704
01705 $tbl->setTitle($this->lng->txt("grp_mem_change_status"),"icon_usr_b.gif",$this->lng->txt("grp_mem_change_status"));
01706
01707 $tbl->setHeaderNames(array($this->lng->txt("username"),$this->lng->txt("firstname"),$this->lng->txt("lastname"),$this->lng->txt("ilinc_coursemember_status"),$this->lng->txt("role")));
01708 $tbl->setHeaderVars(array("login","firstname","lastname","ilinc_coursemember_status","role"),$this->ctrl->getParameterArray($this,"",false));
01709
01710 $tbl->setColumnWidth(array("20%","15%","15%","15%","30%"));
01711
01712 $this->tpl->setCurrentBlock("tbl_action_row");
01713 $this->tpl->parseCurrentBlock();
01714
01715
01716 $tbl->setOrderColumn($_GET["sort_by"]);
01717 $tbl->setOrderDirection($_GET["sort_order"]);
01718 $tbl->setLimit($_GET["limit"]);
01719 $tbl->setOffset($_GET["offset"]);
01720 $tbl->setMaxCount(count($this->data["data"]));
01721
01722 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
01723
01724
01725 $tbl->render();
01726 }
01727
01732 function updateMemberStatusObject()
01733 {
01734 global $rbacsystem;
01735
01736 if (!$rbacsystem->checkAccess("write",$this->object->getRefId()) )
01737 {
01738 $this->ilErr->raiseError("permission_denied",$this->ilErr->MESSAGE);
01739 }
01740
01741 if (isset($_POST["member_status_select"]))
01742 {
01743 foreach ($_POST["member_status_select"] as $key=>$value)
01744 {
01745 $this->object->leave($key);
01746 $this->object->join($key,$value);
01747 }
01748 }
01749
01750 if (isset($_POST["ilinc_member_status_select"]))
01751 {
01752 $users_to_add = array();
01753 $users_to_register = array();
01754 $users_to_unregister = array();
01755
01756 foreach ($_POST["ilinc_member_status_select"] as $user_id => $ilinc_arr)
01757 {
01758 $ilinc_user_id = key($ilinc_arr);
01759 $ilinc_user_status = current($ilinc_arr);
01760
01761
01762
01763
01764
01765
01766 if ($ilinc_user_id == 0)
01767 {
01768
01769
01770
01771 $user_obj = new ilObjUser($user_id);
01772
01773 include_once ('class.ilObjiLincUser.php');
01774 $ilinc_user = new ilObjiLincUser($user_obj);
01775
01776 if (!$ilinc_user->id)
01777 {
01778
01779 $users_to_add[] =& $user_obj;
01780 }
01781 else
01782 {
01783 $users_to_register[$ilinc_user->id] = ILINC_MEMBER_STUDENT;
01784 }
01785
01786 continue;
01787 }
01788
01789
01790 $users_to_unregister[] = $ilinc_user_id;
01791 $users_to_register[$ilinc_user_id] = $ilinc_user_status;
01792
01793 }
01794
01795 if (!$this->object->unregisterUsers($users_to_unregister))
01796 {
01797
01798
01799 $this->ilErr->raiseError($this->object->getErrorMsg(),$this->ilErr->MESSAGE);
01800 }
01801
01802 if (count($users_to_add) > 0)
01803 {
01804
01805 foreach ($users_to_add as $user)
01806 {
01807 if (!$this->object->addUser($user))
01808 {
01809
01810
01811 $this->ilErr->raiseError($this->object->getErrorMsg(),$this->ilErr->MESSAGE);
01812 }
01813 else
01814 {
01815
01816 include_once ('class.ilObjiLincUser.php');
01817 $ilinc_user = new ilObjiLincUser($user);
01818 $users_to_register[$ilinc_user->id] = ILINC_MEMBER_STUDENT;
01819 }
01820 }
01821 }
01822
01823 if (!$this->object->registerUsers($users_to_register))
01824 {
01825
01826
01827 $this->ilErr->raiseError($this->object->getErrorMsg(),$this->ilErr->MESSAGE);
01828 }
01829 }
01830
01831
01832
01833 ilUtil::sendInfo($this->lng->txt("msg_obj_modified"),true);
01834 ilUtil::redirect($this->ctrl->getLinkTarget($this,"members"));
01835 }
01836
01837 function editObject()
01838 {
01839 if (!$this->ilias->getSetting("ilinc_active"))
01840 {
01841 $this->ilias->raiseError($this->lng->txt("ilinc_server_not_active"),$this->ilias->error_obj->MESSAGE);
01842 }
01843
01844 $fields = array();
01845 $akclassvalues = array();
01846
01847 if ($_SESSION["error_post_vars"])
01848 {
01849
01850 $fields["title"] = ilUtil::prepareFormOutput($_SESSION["error_post_vars"]["Fobject"]["title"],true);
01851 $fields["desc"] = ilUtil::stripSlashes($_SESSION["error_post_vars"]["Fobject"]["desc"]);
01852 $akclassvalues["akclassvalue1"] = ilUtil::stripSlashes($_SESSION["error_post_vars"]["Fobject"]["akclassvalue1"]);
01853 $akclassvalues["akclassvalue2"] = ilUtil::stripSlashes($_SESSION["error_post_vars"]["Fobject"]["akclassvalue2"]);
01854 }
01855 else
01856 {
01857 $fields["title"] = ilUtil::prepareFormOutput($this->object->getTitle());
01858 $fields["desc"] = ilUtil::stripSlashes($this->object->getDescription());
01859 $akclassvalues["akclassvalue1"] = ilUtil::stripSlashes($this->object->getAKClassValue1());
01860 $akclassvalues["akclassvalue2"] = ilUtil::stripSlashes($this->object->getAKClassValue2());
01861 }
01862
01863 $this->displayEditForm($fields,$akclassvalues);
01864 }
01865
01872 function displayEditForm($fields,$akclassvalues)
01873 {
01874 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.icrs_edit.html","ilinc");
01875
01876 foreach ($fields as $key => $val)
01877 {
01878 $this->tpl->setVariable("TXT_".strtoupper($key), $this->lng->txt($key));
01879 $this->tpl->setVariable(strtoupper($key), $val);
01880 $this->tpl->parseCurrentBlock();
01881 }
01882
01883 if ($this->ilias->getSetting("ilinc_akclassvalues_active"))
01884 {
01885 $this->tpl->setVariable("TXT_AKCLASSVALUES",$this->lng->txt('akclassvalues'));
01886
01887 if ($this->ilias->getSetting("ilinc_akclassvalues_required"))
01888 {
01889 $this->tpl->setVariable("AKCLASSVALUE_REQUIRED",'*');
01890 }
01891
01892 foreach ($akclassvalues as $key => $val)
01893 {
01894 $this->tpl->setVariable("TXT_".strtoupper($key), $this->lng->txt($key));
01895 $this->tpl->setVariable(strtoupper($key), $val);
01896 $this->tpl->parseCurrentBlock();
01897 }
01898 }
01899
01900 $checkbox_access = ilUtil::formCheckbox($this->object->activated,"Fobject[activated]",1);
01901
01902 $this->tpl->setVariable("TXT_ACCESS", $this->lng->txt("online"));
01903 $this->tpl->setVariable("CHKBOX_ACCESS", $checkbox_access);
01904
01905 $obj_str = ($this->call_by_reference) ? "" : "&obj_id=".$this->obj_id;
01906
01907 $this->tpl->setVariable("FORMACTION", $this->getFormAction("update",$this->ctrl->getFormAction($this).$obj_str));
01908 $this->tpl->setVariable("TXT_HEADER", $this->lng->txt($this->object->getType()."_edit"));
01909 $this->tpl->setVariable("TARGET", $this->getTargetFrame("update"));
01910 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
01911 $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt("save"));
01912 $this->tpl->setVariable("CMD_SUBMIT", "update");
01913 $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
01914
01915 }
01916
01917 function joinObject()
01918 {
01919 global $rbacsystem;
01920
01921 if (!$rbacsystem->checkAccess("join", $_GET["ref_id"]))
01922 {
01923 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
01924 }
01925
01926 if (!$this->object->addMember($this->ilias->account,$this->object->getDefaultMemberRole(),false))
01927 {
01928
01929 $this->ilErr->raiseError($this->object->getErrorMsg(),$this->ilErr->MESSAGE);
01930 }
01931
01932 $this->ilias->account->addDesktopItem($this->object->getRefId(),"icrs");
01933
01934 ilUtil::sendInfo($this->lng->txt("ilinc_msg_joined"),true);
01935 ilUtil::redirect($this->ctrl->getLinkTarget($this,"view"));
01936 }
01937
01938 function isActiveAdministrationPanel()
01939 {
01940 return false;
01941 }
01942
01946 function __setSubTabs($a_tab)
01947 {
01948 global $rbacsystem,$ilUser;
01949
01950 switch ($a_tab)
01951 {
01952 case 'members':
01953
01954 $this->tabs_gui->addSubTabTarget("members",
01955 $this->ctrl->getLinkTarget($this,'members'),
01956 "members", get_class($this));
01957
01958 $this->tabs_gui->addSubTabTarget("icrs_members_gallery",
01959 $this->ctrl->getLinkTarget($this,'membersGallery'),
01960 "membersGallery", get_class($this));
01961
01962 $this->tabs_gui->addSubTabTarget("mail_members",
01963 $this->ctrl->getLinkTarget($this,'mailMembers'),
01964 "mailMembers", get_class($this));
01965 break;
01966 }
01967 }
01968
01969 function mailMembersObject()
01970 {
01971 global $rbacreview;
01972
01973 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.mail_members.html');
01974
01975 $this->__setSubTabs('members');
01976
01977 $link_data = $this->object->_getLinkToObject($this->object->getRefId());
01978 $link_to_seminar = ILIAS_HTTP_PATH."/".$link_data[0];
01979
01980 $this->tpl->setVariable("MAILACTION",'ilias.php?baseClass=ilMailGUI&type=role');
01981 $this->tpl->setVariable("ADDITIONAL_MESSAGE_TEXT",$link_to_seminar);
01982 $this->tpl->setVariable("MAIL_MEMBERS",$this->lng->txt('send_mail_members'));
01983 $this->tpl->setVariable("MAIL_ADMIN",$this->lng->txt('send_mail_admins'));
01984 $this->tpl->setVariable("CHECK_MEMBER",ilUtil::formCheckbox(1,'roles[]','#il_icrs_member_'.$this->object->getRefId()));
01985 $this->tpl->setVariable("CHECK_ADMIN",ilUtil::formCheckbox(0,'roles[]','#il_icrs_admin_'.$this->object->getRefId()));
01986 $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath('arrow_downright.gif'));
01987 $this->tpl->setVariable("OK",$this->lng->txt('ok'));
01988 }
01989
01995 function membersGalleryObject()
01996 {
01997 global $rbacsystem;
01998
01999 $is_admin = (bool) $rbacsystem->checkAccess("write", $this->object->getRefId());
02000
02001 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.icrs_members_gallery.html','ilinc');
02002
02003 $this->__setSubTabs('members');
02004
02005 $this->lng->loadLanguageModule('ilinc');
02006
02007 $member_ids = $this->object->getMemberIds();
02008
02009
02010 $members = $this->object->getMemberData($member_ids);
02011
02012
02013 $admin_ids = $this->object->getiLincMemberIds(true);
02014
02015
02016 if (count($members))
02017 {
02018 foreach ($members as $member)
02019 {
02020
02021 if(!($usr_obj = ilObjectFactory::getInstanceByObjId($member["id"],false)))
02022 {
02023 continue;
02024 }
02025
02026 $public_profile = $usr_obj->getPref("public_profile");
02027
02028
02029 $this->ctrl->setParameterByClass("ilobjusergui", "user", $member["id"]);
02030 $profile_target = $this->ctrl->getLinkTargetByClass("ilobjusergui", "getPublicProfile");
02031
02032
02033 $file = $usr_obj->getPersonalPicturePath("xsmall");
02034
02035 switch(in_array($member["ilinc_id"],$admin_ids))
02036 {
02037
02038 case 1:
02039 if ($public_profile == "y")
02040 {
02041 $this->tpl->setCurrentBlock("tutor_linked");
02042 $this->tpl->setVariable("LINK_PROFILE", $profile_target);
02043 $this->tpl->setVariable("SRC_USR_IMAGE", $file);
02044 $this->tpl->parseCurrentBlock();
02045 }
02046 else
02047 {
02048 $this->tpl->setCurrentBlock("tutor_not_linked");
02049 $this->tpl->setVariable("SRC_USR_IMAGE", $file);
02050 $this->tpl->parseCurrentBlock();
02051 }
02052 $this->tpl->setCurrentBlock("tutor");
02053 break;
02054
02055 case 0:
02056 if ($public_profile == "y")
02057 {
02058 $this->tpl->setCurrentBlock("member_linked");
02059 $this->tpl->setVariable("LINK_PROFILE", $profile_target);
02060 $this->tpl->setVariable("SRC_USR_IMAGE", $file);
02061 $this->tpl->parseCurrentBlock();
02062 }
02063 else
02064 {
02065 $this->tpl->setCurrentBlock("member_not_linked");
02066 $this->tpl->setVariable("SRC_USR_IMAGE", $file);
02067 $this->tpl->parseCurrentBlock();
02068 }
02069 $this->tpl->setCurrentBlock("member");
02070 break;
02071 }
02072
02073
02074 if ($public_profile == "y")
02075 {
02076 $this->tpl->setVariable("FIRSTNAME", $member["firstname"]);
02077 $this->tpl->setVariable("LASTNAME", $member["lastname"]);
02078 }
02079
02080 $this->tpl->setVariable("LOGIN", $usr_obj->getLogin());
02081 $this->tpl->parseCurrentBlock();
02082 }
02083
02084 $this->tpl->setCurrentBlock("members");
02085 $this->tpl->setVariable("MEMBERS_TABLE_HEADER",$this->lng->txt('ilinc_involved_users'));
02086 $this->tpl->parseCurrentBlock();
02087 }
02088
02089 $this->tpl->setVariable("TITLE",$this->lng->txt('icrs_members_print_title'));
02090 $this->tpl->setVariable("CSS_PATH",ilUtil::getStyleSheetLocation());
02091
02092 $headline = $this->object->getTitle()."<br/>".$this->object->getDescription();
02093
02094 $this->tpl->setVariable("HEADLINE",$headline);
02095
02096 $this->tpl->show();
02097 exit;
02098 }
02099
02100 function showProfileObject()
02101 {
02102 include_once './Services/User/classes/class.ilObjUserGUI.php';
02103
02104 $this->__setSubTabs('members');
02105
02106 $user_gui = new ilObjUserGUI("",$_GET["user"], false, false);
02107
02108
02109 if (($out = $user_gui->getPublicProfile())!="")
02110 {
02111 $this->tpl->setVariable("ADM_CONTENT","<center>".$out."</center>");
02112 }
02113 else
02114 {
02115 ilUtil::sendInfo($this->lng->txt('public_profile_not_visible'));
02116 }
02117 }
02118 }
02119 ?>