Пример #1
0
 protected function fillRow($a_set)
 {
     $this->tpl->setVariable("DATE", ilDatePresentation::formatDate(new ilDateTime($a_set["created"], IL_CAL_UNIX)));
     $name = ilObjUser::_lookupName($a_set["user_id"]);
     $this->tpl->setVariable("LASTNAME", $name["lastname"]);
     $this->tpl->setVariable("FIRSTNAME", $name["firstname"]);
     $this->tpl->setVariable("LOGIN", $name["login"]);
     $this->tpl->setVariable("ACTION", $this->action_map[$a_set["action"]]);
     if ($a_set["action"] == ilRbacLog::CHANGE_OWNER) {
         $user = ilObjUser::_lookupFullname($a_set["data"][0]);
         $changes = array(array("action" => $this->lng->txt("rbac_log_changed_owner"), "operation" => $user));
     } else {
         if ($a_set["action"] == ilRbacLog::EDIT_TEMPLATE) {
             $changes = $this->parseChangesTemplate($a_set["data"]);
         } else {
             $changes = $this->parseChangesFaPa($a_set["data"]);
         }
     }
     $this->tpl->setCurrentBlock("changes");
     foreach ($changes as $change) {
         $this->tpl->setVariable("CHANGE_ACTION", $change["action"]);
         $this->tpl->setVariable("CHANGE_OPERATION", $change["operation"]);
         $this->tpl->parseCurrentBlock();
     }
 }
 function ilEphorusReportHeaderTableGUI($a_parent_obj, $a_parent_cmd, $document)
 {
     global $ilCtrl, $lng;
     parent::__construct($a_parent_obj, $a_parent_cmd);
     $this->setTopCommands(false);
     $this->addColumn($lng->txt("rep_robj_xeph_document_info"));
     $this->addColumn("");
     $this->setEnableHeader(true);
     $this->setRowTemplate("tpl.eph_report_header.html", "Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus");
     $this->disable("footer");
     $member = ilObjUser::_lookupName($document->user_id);
     $a_data = array();
     $student = array();
     $student["key"] = "student";
     $student["value"] = $member["firstname"] . " " . $member["lastname"];
     array_push($a_data, $student);
     $ilCtrl->setParameter($this->parent_obj, "filename", $document->filename);
     $ilCtrl->setParameter($this->parent_obj, "filetitle", $document->filetitle);
     $ilCtrl->setParameter($this->parent_obj, "part_id", $document->user_id);
     $doc = array();
     $doc["key"] = "document";
     $doc["value"] = "<a href=\"" . $ilCtrl->getLinkTarget($this->parent_obj, "downloadSubmittedFile") . "\">" . $document->filetitle . "</a>";
     array_push($a_data, $doc);
     $ilCtrl->setParameter($this->parent_obj, "filename", "");
     $ilCtrl->setParameter($this->parent_obj, "filetitle", "");
     $submission_date = array();
     $submission_date["key"] = "submission_date";
     $submission_date["value"] = ilDatePresentation::formatDate(new ilDateTime($document->date_created, IL_CAL_DATETIME));
     array_push($a_data, $submission_date);
     $this->setData($a_data);
 }
 /**
  * Get participants and responsible users
  */
 function getParticipantsAndResponsibles()
 {
     $participants = array();
     if ($this->app_id > 0) {
         include_once "./Services/Calendar/classes/class.ilCalendarEntry.php";
         $app = new ilCalendarEntry($this->app_id);
         $resp_users = $app->readResponsibleUsers();
         foreach ($resp_users as $v) {
             $n = ilObjUser::_lookupName($v["user_id"]);
             $participants[$v["user_id"]] = array_merge($n, array("type" => "non-member"));
             $this->resp_users[] = $v["user_id"];
         }
     }
     include_once './Modules/Group/classes/class.ilGroupParticipants.php';
     $part = ilGroupParticipants::_getInstanceByObjId($this->grp_id);
     $admins = $part->getAdmins();
     $members = $part->getMembers();
     foreach ($members as $v) {
         $n = ilObjUser::_lookupName($v);
         $participants[$v] = array_merge($n, array("type" => "member"));
     }
     foreach ($admins as $v) {
         $n = ilObjUser::_lookupName($v);
         $participants[$v] = array_merge($n, array("type" => "admin"));
     }
     $this->setData($participants);
 }
 /** 
  * Called from fetchData after successful login.
  *
  * @param string username
  */
 public function loginObserver($a_username, $a_auth)
 {
     $GLOBALS['ilLog']->write('Called login observer');
     $name = ilObjUser::_lookupName($this->current_user_id);
     $a_auth->setAuth($name['login']);
     return true;
 }
 /**
  * Constructor
  */
 function __construct($a_parent_obj, $a_parent_cmd, $a_exc, $a_mem_obj)
 {
     global $ilCtrl, $lng, $ilAccess, $lng;
     $this->exc = $a_exc;
     $this->exc_id = $this->exc->getId();
     include_once "./Modules/Exercise/classes/class.ilExAssignment.php";
     $this->setId("exc_grades_" . $this->exc_id);
     $this->mem_obj = $a_mem_obj;
     $mems = $this->mem_obj->getMembers();
     $data = array();
     foreach ($mems as $d) {
         $data[$d] = ilObjUser::_lookupName($d);
         $data[$d]["user_id"] = $d;
     }
     parent::__construct($a_parent_obj, $a_parent_cmd);
     $this->setData($data);
     $this->ass_data = ilExAssignment::getAssignmentDataOfExercise($this->exc_id);
     //var_dump($data);
     $this->setTitle($lng->txt("exc_grades"));
     $this->setTopCommands(true);
     //$this->setLimit(9999);
     //		$this->addColumn("", "", "1", true);
     $this->addColumn($this->lng->txt("name"), "lastname");
     $cnt = 1;
     foreach ($this->ass_data as $ass) {
         $ilCtrl->setParameter($this->parent_obj, "ass_id", $ass["id"]);
         $cnt_str = '<a href="' . $ilCtrl->getLinkTarget($this->parent_obj, "members") . '">' . $cnt . '</a>';
         if ($ass["mandatory"]) {
             $this->addColumn("<u>" . $cnt_str . "</u>", "", "", false, "", $ass["title"] . " " . "(" . $lng->txt("exc_mandatory") . ")");
         } else {
             $this->addColumn($cnt_str, "", "", false, "", $ass["title"]);
         }
         $cnt++;
     }
     $ilCtrl->setParameter($this->parent_obj, "ass_id", "");
     $this->addColumn($this->lng->txt("exc_total_exc"), "");
     $this->addColumn($this->lng->txt("exc_comment_for_learner"), "", "1%");
     //		$this->addColumn($this->lng->txt("exc_grading"), "solved_time");
     //		$this->addColumn($this->lng->txt("mail"), "feedback_time");
     $this->setDefaultOrderField("lastname");
     $this->setDefaultOrderDirection("asc");
     $this->setEnableHeader(true);
     $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
     $this->setRowTemplate("tpl.exc_grades_row.html", "Modules/Exercise");
     //$this->disable("footer");
     $this->setEnableTitle(true);
     //		$this->setSelectAllCheckbox("assid");
     // START PATCH RUBRIC CPKN 2015
     include_once 'Services/Object/classes/class.ilObjectLP.php';
     $olp = ilObjectLP::getInstance($this->exc_id);
     $lp_mode = $olp->getCurrentMode();
     if (count($mems) > 0 && $lp_mode != 92) {
         $this->addCommandButton("saveGrades", $lng->txt("exc_save_changes"));
     }
     // END PATCH RUBRIC CPKN 2015
 }
 /**
  * Constructor
  */
 function __construct($a_parent_obj, $a_parent_cmd, $a_exc, $a_part_id)
 {
     global $ilCtrl, $lng, $ilAccess, $lng;
     $this->exc = $a_exc;
     $this->exc_id = $this->exc->getId();
     include_once "./Modules/Exercise/classes/class.ilExAssignment.php";
     $this->part_id = $a_part_id;
     $this->setId("exc_part_" . $this->exc_id . "_" . $this->part_id);
     include_once "./Services/User/classes/class.ilObjUser.php";
     if ($this->part_id > 0) {
         $name = ilObjUser::_lookupName($this->part_id);
         if (trim($name["login"])) {
             $this->user = new ilObjUser($this->part_id);
         } else {
             $ilCtrl->setParameter($a_parent_obj, "part_id", "");
             $ilCtrl->redirect($a_parent_obj, $a_parent_cmd);
         }
     }
     parent::__construct($a_parent_obj, $a_parent_cmd);
     //$this->setData(ilExAssignment::getMemberListData($this->exc_id, $this->ass_id));
     $data = ilExAssignment::getAssignmentDataOfExercise($this->exc_id);
     $this->setData($data);
     //var_dump($data);
     if ($this->part_id > 0) {
         $this->setTitle($lng->txt("exc_participant") . ": " . $name["lastname"] . ", " . $name["firstname"] . " [" . $name["login"] . "]");
     } else {
         $this->setTitle($lng->txt("exc_participant"));
     }
     $this->setTopCommands(true);
     //$this->setLimit(9999);
     //		$this->addColumn("", "", "1", true);
     $this->addColumn($this->lng->txt("exc_assignment"), "order_val");
     $this->addColumn($this->lng->txt("exc_submission"), "submission");
     $this->addColumn($this->lng->txt("exc_grading"), "solved_time");
     //		$this->addColumn($this->lng->txt("mail"), "feedback_time");
     $this->addColumn($this->lng->txt("feedback"), "feedback_time");
     $this->setDefaultOrderField("order_val");
     $this->setDefaultOrderDirection("asc");
     $this->setEnableHeader(true);
     $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
     $this->setRowTemplate("tpl.exc_participant_row.html", "Modules/Exercise");
     //$this->disable("footer");
     $this->setEnableTitle(true);
     //		$this->setSelectAllCheckbox("assid");
     if ($this->part_id > 0) {
         $this->addCommandButton("saveStatusParticipant", $lng->txt("exc_save_changes"));
     }
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     include_once "Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php";
     $this->overlay_tpl = new ilTemplate("tpl.exc_learner_comment_overlay.html", true, true, "Modules/Exercise");
 }
 /**
  * Constructor
  */
 function __construct($a_parent_obj, $a_parent_cmd, $a_eph, $a_mem_obj)
 {
     global $ilCtrl, $lng, $ilAccess, $lng;
     $this->eph = $a_eph;
     $this->eph_id = $this->eph->getId();
     include_once "./Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus/classes/class.ilEphAssignment.php";
     $this->setId("eph_grades_" . $this->eph_id);
     $this->mem_obj = $a_mem_obj;
     $mems = $this->mem_obj->getMembers();
     $data = array();
     foreach ($mems as $d) {
         $data[$d] = ilObjUser::_lookupName($d);
         $data[$d]["user_id"] = $d;
     }
     parent::__construct($a_parent_obj, $a_parent_cmd);
     $this->setData($data);
     $this->ass_data = ilEphAssignment::getAssignmentDataOfEphorus($this->eph_id);
     //var_dump($data);
     $this->setTitle($lng->txt("rep_robj_xeph_grades_overview"));
     $this->setTopCommands(true);
     //$this->setLimit(9999);
     //		$this->addColumn("", "", "1", true);
     $this->addColumn($this->lng->txt("name"), "lastname");
     $cnt = 1;
     foreach ($this->ass_data as $ass) {
         $ilCtrl->setParameter($this->parent_obj, "ass_id", $ass["id"]);
         $cnt_str = '<a href="' . $ilCtrl->getLinkTarget($this->parent_obj, "showSubmissions") . '">' . $cnt . '</a>';
         if ($ass["mandatory"]) {
             $this->addColumn("<u>" . $cnt_str . "</u>", "", "", false, "", $ass["title"] . " " . "(" . $lng->txt("rep_robj_xeph_mandatory") . ")");
         } else {
             $this->addColumn($cnt_str, "", "", false, "", $ass["title"]);
         }
         $cnt++;
     }
     $ilCtrl->setParameter($this->parent_obj, "ass_id", "");
     $this->addColumn($this->lng->txt("rep_robj_xeph_total_exc"), "");
     $this->addColumn($this->lng->txt("rep_robj_xeph_comment_for_learner"), "", "1%");
     //		$this->addColumn($this->lng->txt("eph_grading"), "solved_time");
     //		$this->addColumn($this->lng->txt("mail"), "feedback_time");
     $this->setDefaultOrderField("lastname");
     $this->setDefaultOrderDirection("asc");
     $this->setEnableHeader(true);
     $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
     $this->setRowTemplate("tpl.eph_grades_row.html", "Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus");
     //$this->disable("footer");
     $this->setEnableTitle(true);
     //		$this->setSelectAllCheckbox("assid");
     if (count($mems) > 0) {
         $this->addCommandButton("saveGrades", $lng->txt("rep_robj_xeph_save"));
     }
 }
 /**
  * fill row 
  *
  * @access public
  * @param
  * @return
  */
 public function fillRow($data)
 {
     $this->tpl->setVariable("DATE", ilDatePresentation::formatDate(new ilDate($data['tstamp'], IL_CAL_UNIX)));
     $user = ilObjUser::_lookupName($data["user_fi"]);
     $this->tpl->setVariable("USER", ilUtil::prepareFormOutput(trim($user["title"] . " " . $user["firstname"] . " " . $user["lastname"])));
     $title = "";
     if ($data["question_fi"] || $data["original_fi"]) {
         include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
         $title = assQuestion::_getQuestionTitle($data["question_fi"]);
         if (strlen($title) == 0) {
             $title = assQuestion::_getQuestionTitle($data["original_fi"]);
         }
         $title = $this->lng->txt("assessment_log_question") . ": " . $title;
     }
     $this->tpl->setVariable("MESSAGE", ilUtil::prepareFormOutput($data['logtext']) . (strlen($title) ? " (" . $title . ")" : ''));
 }
 /**
  * Standard Version of Fill Row. Most likely to
  * be overwritten by derived class.
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl, $ilAccess;
     // rollback command
     if ($a_set["nr"] > 0) {
         $ilCtrl->setParameter($this->getParentObject(), "old_nr", $a_set["nr"]);
         $this->tpl->setCurrentBlock("command");
         $this->tpl->setVariable("TXT_COMMAND", $lng->txt("cont_rollback"));
         $this->tpl->setVariable("HREF_COMMAND", $ilCtrl->getLinkTarget($this->getParentObject(), "rollbackConfirmation"));
         $this->tpl->parseCurrentBlock();
         $ilCtrl->setParameter($this->getParentObject(), "old_nr", "");
     }
     if (!$this->rselect) {
         $this->tpl->setVariable("RSELECT", 'checked="checked"');
         $this->rselect = true;
     } else {
         if (!$this->lselect) {
             $this->tpl->setVariable("LSELECT", 'checked="checked"');
             $this->lselect = true;
         }
     }
     $this->tpl->setVariable("NR", $a_set["nr"]);
     $this->tpl->setVariable("TXT_HDATE", ilDatePresentation::formatDate(new ilDateTime($a_set["hdate"], IL_CAL_DATETIME)));
     $ilCtrl->setParameter($this->getParentObject(), "old_nr", $a_set["nr"]);
     $ilCtrl->setParameter($this->getParentObject(), "history_mode", "1");
     $this->tpl->setVariable("HREF_OLD_PAGE", $ilCtrl->getLinkTarget($this->getParentObject(), "preview"));
     $ilCtrl->setParameter($this->getParentObject(), "history_mode", "");
     if (ilObject::_exists($a_set["user"])) {
         // user name
         $user = ilObjUser::_lookupName($a_set["user"]);
         $login = ilObjUser::_lookupLogin($a_set["user"]);
         //$this->tpl->setVariable("TXT_LINKED_USER",
         //	$user["lastname"].", ".$user["firstname"]." [".$login."]");
         // profile link
         include_once "./Services/User/classes/class.ilUserUtil.php";
         $name_pres = ilUserUtil::getNamePresentation($a_set["user"], true, true, $ilCtrl->getLinkTarget($this->getParentObject(), $this->getParentCmd()));
         //$ilCtrl->setParameterByClass("ilpublicuserprofilegui", "user", $a_set["user"]);
         //$ilCtrl->setParameterByClass("ilpublicuserprofilegui", "back_url",
         //	rawurlencode($ilCtrl->getLinkTarget($this->getParentObject(), $this->getParentCmd())));
         //$this->tpl->setVariable("USER_LINK",
         //	$ilCtrl->getLinkTargetByClass("ilpublicuserprofilegui", "getHTML"));
         //$img = ilObjUser::_getPersonalPicturePath($a_set["user"], "xxsmall");
         //$this->tpl->setVariable("IMG_USER", $img);
         $this->tpl->setVariable("TXT_USER", $name_pres);
     }
     $ilCtrl->setParameter($this->getParentObject(), "old_nr", "");
 }
 /**
  * 
  *
  * @access public
  * @param array row data
  * @return
  */
 public function fillRow($a_set)
 {
     $this->tpl->setVariable('VAL_ID', $a_set['cal_id']);
     $this->tpl->setVariable('CALENDAR_NAME', $a_set['name']);
     $this->tpl->setVariable('TXT_FROM', $this->lng->txt('owner'));
     $name = ilObjUser::_lookupName($a_set['owner']);
     $this->tpl->setVariable('LASTNAME', $name['lastname']);
     $this->tpl->setVariable('FIRSTNAME', $name['firstname']);
     $this->tpl->setVariable('APPS_COUNT', $a_set['apps']);
     $this->tpl->setVariable('CREATE_DATE', ilDatePresentation::formatDate(new ilDateTime($a_set['create_date'], IL_CAL_DATETIME)));
     if ($a_set['accepted']) {
         $this->tpl->setVariable('ACC_IMG', ilUtil::getImagePath('icon_ok.svg'));
         $this->tpl->setVariable('ALT_ACC', $this->lng->txt('cal_accepted'));
     }
     if ($a_set['declined']) {
         $this->tpl->setVariable('DEC_IMG', ilUtil::getImagePath('icon_ok.svg'));
         $this->tpl->setVariable('ALT_DEC', $this->lng->txt('cal_declined'));
     }
 }
 /**
  * Init Table
  */
 public function init()
 {
     $name = ilObjUser::_lookupName($this->getUserId());
     if (strlen($name['firstname']) and strlen($name['lastname'])) {
         $name_string = $name['lastname'] . ', ' . $name['firstname'] . ' [' . $name['login'] . ']';
     } elseif (strlen($name['lastname'])) {
         $name_string = $name['lastname'] . ' [' . $name['login'] . ']';
     } else {
         $name_string = $name['login'];
     }
     $this->setTitle($GLOBALS['lng']->txt('crs_loc_test_results_of') . ' ' . $name_string);
     $this->addColumn($GLOBALS['lng']->txt('crs_objectives'), 'title', '50%');
     if ($this->getSettings()->worksWithInitialTest()) {
         $this->addColumn($GLOBALS['lng']->txt('crs_loc_itest_info'), 'it', '25%');
         $this->addColumn($GLOBALS['lng']->txt('crs_loc_qtest_info'), 'qt', '25%');
     } else {
         $this->addColumn($GLOBALS['lng']->txt('crs_loc_qtest_info'), 'qt', '25%');
     }
     $this->setRowTemplate('tpl.crs_objectives_usr_result_row.html', 'Modules/Course');
     $this->disable('sort');
     $this->disable('num_info');
 }
 /**
  * Constructor
  */
 function __construct($a_parent_obj, $a_parent_cmd, $a_eph, $a_part_id)
 {
     global $ilCtrl, $lng, $ilAccess, $lng;
     $this->eph = $a_eph;
     $this->eph_id = $this->eph->getId();
     include_once "./Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus/classes/class.ilEphAssignment.php";
     $this->part_id = $a_part_id;
     $this->setId("eph_part_" . $this->eph_id . "_" . $this->part_id);
     include_once "./Services/User/classes/class.ilObjUser.php";
     if ($this->part_id > 0) {
         $name = ilObjUser::_lookupName($this->part_id);
         $this->user = new ilObjUser($this->part_id);
     }
     parent::__construct($a_parent_obj, $a_parent_cmd);
     $data = ilEphAssignment::getAssignmentDataOfEphorus($this->eph_id);
     $this->setData($data);
     if ($this->part_id > 0) {
         $this->setTitle($lng->txt("rep_robj_xeph_participant") . ": " . $name["lastname"] . ", " . $name["firstname"] . " [" . $name["login"] . "]");
     } else {
         $this->setTitle($lng->txt("rep_robj_xeph_participant"));
     }
     $this->setTopCommands(true);
     $this->addColumn($this->lng->txt("rep_robj_xeph_assignment"), "order_val");
     $this->addColumn($this->lng->txt("rep_robj_xeph_submission"), "submission");
     $this->addColumn($this->lng->txt("rep_robj_xeph_reports"), "reports");
     $this->addColumn($this->lng->txt("rep_robj_xeph_grading"), "solved_time");
     $this->addColumn($this->lng->txt("feedback"), "feedback_time");
     $this->setDefaultOrderField("order_val");
     $this->setDefaultOrderDirection("asc");
     $this->setEnableHeader(true);
     $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
     $this->setRowTemplate("tpl.eph_participant_row.html", "Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus");
     $this->setEnableTitle(true);
     if ($this->part_id > 0) {
         $this->addCommandButton("saveStatusParticipant", $lng->txt("rep_robj_xeph_save"));
     }
 }
Пример #13
0
 /**
  * Returns the full name of a test user according to the anonymity status
  *
  * @param int $user_id The database ID of the user
  * @param boolean $overwrite_anonymity Indicates if the anonymity status should be ignored
  * @return string The full name of the user or UNKNOWN if the anonymity status is affected
  * @access public
  * 
  * @deprecated: use ilTestParticipantData instead
  */
 function userLookupFullName($user_id, $overwrite_anonymity = FALSE, $sorted_order = FALSE, $suffix = "")
 {
     if ($this->getAnonymity() && !$overwrite_anonymity) {
         return $this->lng->txt("anonymous") . $suffix;
     } else {
         include_once './Services/User/classes/class.ilObjUser.php';
         $uname = ilObjUser::_lookupName($user_id);
         if (strlen($uname["firstname"] . $uname["lastname"]) == 0) {
             $uname["firstname"] = $this->lng->txt("deleted_user");
         }
         if ($sorted_order) {
             return trim($uname["lastname"] . ", " . $uname["firstname"]) . $suffix;
         } else {
             return trim($uname["firstname"] . " " . $uname["lastname"]) . $suffix;
         }
     }
 }
 /**
  * get member list data
  */
 function getMemberListData($a_eph_id, $a_ass_id)
 {
     global $ilDB;
     $mem = array();
     // first get list of members from member table
     $set = $ilDB->query("SELECT * FROM rep_robj_xeph_members " . "WHERE obj_id = " . $ilDB->quote($a_eph_id, "integer"));
     while ($rec = $ilDB->fetchAssoc($set)) {
         if (ilObject::_exists($rec["user_id"]) && ilObject::_lookupType($rec["user_id"]) == "usr") {
             $name = ilObjUser::_lookupName($rec["user_id"]);
             $login = ilObjUser::_lookupLogin($rec["user_id"]);
             $mem[$rec["user_id"]] = array("name" => $name["lastname"] . ", " . $name["firstname"], "login" => $login, "user_id" => $rec["user_id"], "lastname" => $name["lastname"], "firstname" => $name["firstname"]);
         }
     }
     $q = "SELECT * FROM rep_robj_xeph_ass_stat " . "WHERE ass_id = " . $ilDB->quote($a_ass_id, "integer");
     $set = $ilDB->query($q);
     while ($rec = $ilDB->fetchAssoc($set)) {
         if (isset($mem[$rec["user_id"]])) {
             $mem[$rec["user_id"]]["sent_time"] = $rec["sent_time"];
             $mem[$rec["user_id"]]["submission"] = ilEphAssignment::getLastSubmission($a_ass_id, $rec["user_id"]);
             $mem[$rec["user_id"]]["status_time"] = $rec["status_time"];
             $mem[$rec["user_id"]]["feedback_time"] = $rec["feedback_time"];
             $mem[$rec["user_id"]]["notice"] = $rec["notice"];
             $mem[$rec["user_id"]]["status"] = $rec["status"];
         }
     }
     return $mem;
 }
 /**
  * parse
  *
  * @access public
  * @return
  */
 public function parse()
 {
     $this->shared_obj = new ilCalendarShared($this->calendar_id);
     $items = array();
     foreach ($this->shared_obj->getShared() as $item) {
         switch ($item['obj_type']) {
             case ilCalendarShared::TYPE_USR:
                 $data['type'] = 'usr';
                 $name = ilObjUser::_lookupName($item['obj_id']);
                 $data['title'] = $name['lastname'] . ', ' . $name['firstname'];
                 $data['description'] = '';
                 break;
             case ilCalendarShared::TYPE_ROLE:
                 $data['type'] = 'role';
                 $data['title'] = ilObject::_lookupTitle($item['obj_id']);
                 $data['description'] = ilObject::_lookupDescription($item['obj_id']);
                 break;
         }
         $data['obj_id'] = $item['obj_id'];
         $data['create_date'] = $item['create_date'];
         $data['writable'] = $item['writable'];
         $items[] = $data;
     }
     $this->setData($items ? $items : array());
     return true;
 }
Пример #16
0
 /**
  * Init survey settings form
  * 
  * @return ilPropertyFormGUI
  */
 function initPropertiesForm()
 {
     $template_settings = $hide_rte_switch = null;
     $template = $this->object->getTemplate();
     if ($template) {
         include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
         $template = new ilSettingsTemplate($template);
         $template_settings = $template->getSettings();
         $hide_rte_switch = $template_settings["rte_switch"]["hide"];
     }
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTableWidth("100%");
     $form->setId("survey_properties");
     // general properties
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("settings"));
     $form->addItem($header);
     // title & description (meta data)
     include_once 'Services/MetaData/classes/class.ilMD.php';
     $md_obj = new ilMD($this->object->getId(), 0, "svy");
     $md_section = $md_obj->getGeneral();
     $title = new ilTextInputGUI($this->lng->txt("title"), "title");
     $title->setRequired(true);
     $title->setValue($md_section->getTitle());
     $form->addItem($title);
     $ids = $md_section->getDescriptionIds();
     if ($ids) {
         $desc_obj = $md_section->getDescription(array_pop($ids));
         $desc = new ilTextAreaInputGUI($this->lng->txt("description"), "description");
         $desc->setCols(50);
         $desc->setRows(4);
         $desc->setValue($desc_obj->getDescription());
         $form->addItem($desc);
     }
     // pool usage
     $pool_usage = new ilRadioGroupInputGUI($this->lng->txt("survey_question_pool_usage"), "use_pool");
     $opt = new ilRadioOption($this->lng->txt("survey_question_pool_usage_active"), 1);
     $opt->setInfo($this->lng->txt("survey_question_pool_usage_active_info"));
     $pool_usage->addOption($opt);
     $opt = new ilRadioOption($this->lng->txt("survey_question_pool_usage_inactive"), 0);
     $opt->setInfo($this->lng->txt("survey_question_pool_usage_inactive_info"));
     $pool_usage->addOption($opt);
     $pool_usage->setValue($this->object->getPoolUsage());
     $form->addItem($pool_usage);
     // 360°: appraisees
     if ($this->object->get360Mode()) {
         $self_eval = new ilCheckboxInputGUI($this->lng->txt("survey_360_self_evaluation"), "self_eval");
         $self_eval->setInfo($this->lng->txt("survey_360_self_evaluation_info"));
         $self_eval->setChecked($this->object->get360SelfEvaluation());
         $form->addItem($self_eval);
         $self_rate = new ilCheckboxInputGUI($this->lng->txt("survey_360_self_raters"), "self_rate");
         $self_rate->setInfo($this->lng->txt("survey_360_self_raters_info"));
         $self_rate->setChecked($this->object->get360SelfRaters());
         $form->addItem($self_rate);
         $self_appr = new ilCheckboxInputGUI($this->lng->txt("survey_360_self_appraisee"), "self_appr");
         $self_appr->setInfo($this->lng->txt("survey_360_self_appraisee_info"));
         $self_appr->setChecked($this->object->get360SelfAppraisee());
         $form->addItem($self_appr);
     }
     // activation
     include_once "Services/Object/classes/class.ilObjectActivation.php";
     $this->lng->loadLanguageModule('rep');
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('rep_activation_availability'));
     $form->addItem($section);
     // additional info only with multiple references
     $act_obj_info = $act_ref_info = "";
     if (sizeof(ilObject::_getAllReferences($this->object->getId())) > 1) {
         $act_obj_info = ' ' . $this->lng->txt('rep_activation_online_object_info');
         $act_ref_info = $this->lng->txt('rep_activation_access_ref_info');
     }
     $online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'), 'online');
     $online->setInfo($this->lng->txt('svy_activation_online_info') . $act_obj_info);
     $online->setChecked($this->object->isOnline());
     $form->addItem($online);
     $act_type = new ilCheckboxInputGUI($this->lng->txt('rep_visibility_until'), 'access_type');
     // $act_type->setInfo($this->lng->txt('svy_availability_until_info'));
     $act_type->setChecked($this->object->isActivationLimited());
     $this->tpl->addJavaScript('./Services/Form/js/date_duration.js');
     include_once "Services/Form/classes/class.ilDateDurationInputGUI.php";
     $dur = new ilDateDurationInputGUI($this->lng->txt('rep_time_period'), "access_period");
     $dur->setShowTime(true);
     $date = $this->object->getActivationStartDate();
     $dur->setStart(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
     $dur->setStartText($this->lng->txt('rep_activation_limited_start'));
     $date = $this->object->getActivationEndDate();
     $dur->setEnd(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
     $dur->setEndText($this->lng->txt('rep_activation_limited_end'));
     $act_type->addSubItem($dur);
     $visible = new ilCheckboxInputGUI($this->lng->txt('rep_activation_limited_visibility'), 'access_visiblity');
     $visible->setInfo($this->lng->txt('svy_activation_limited_visibility_info'));
     $visible->setChecked($this->object->getActivationVisibility());
     $act_type->addSubItem($visible);
     $form->addItem($act_type);
     // before start
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('svy_settings_section_before_start'));
     $form->addItem($section);
     // introduction
     $intro = new ilTextAreaInputGUI($this->lng->txt("introduction"), "introduction");
     $intro->setValue($this->object->prepareTextareaOutput($this->object->getIntroduction()));
     $intro->setRows(10);
     $intro->setCols(80);
     $intro->setUseRte(TRUE);
     $intro->setInfo($this->lng->txt("survey_introduction_info"));
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $intro->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
     $intro->addPlugin("latex");
     $intro->addButton("latex");
     $intro->addButton("pastelatex");
     $intro->setRTESupport($this->object->getId(), "svy", "survey", null, $hide_rte_switch);
     $form->addItem($intro);
     // access
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('svy_settings_section_access'));
     $form->addItem($section);
     // enable start date
     $start = $this->object->getStartDate();
     $enablestartingtime = new ilCheckboxInputGUI($this->lng->txt("start_date"), "enabled_start_date");
     $enablestartingtime->setValue(1);
     // $enablestartingtime->setOptionTitle($this->lng->txt("enabled"));
     $enablestartingtime->setChecked($start);
     // start date
     $startingtime = new ilDateTimeInputGUI('', 'start_date');
     $startingtime->setShowTime(true);
     if ($start) {
         $startingtime->setDate(new ilDate($start, IL_CAL_TIMESTAMP));
     }
     $enablestartingtime->addSubItem($startingtime);
     $form->addItem($enablestartingtime);
     // enable end date
     $end = $this->object->getEndDate();
     $enableendingtime = new ilCheckboxInputGUI($this->lng->txt("end_date"), "enabled_end_date");
     $enableendingtime->setValue(1);
     // $enableendingtime->setOptionTitle($this->lng->txt("enabled"));
     $enableendingtime->setChecked($end);
     // end date
     $endingtime = new ilDateTimeInputGUI('', 'end_date');
     $endingtime->setShowTime(true);
     if ($end) {
         $endingtime->setDate(new ilDate($end, IL_CAL_TIMESTAMP));
     }
     $enableendingtime->addSubItem($endingtime);
     $form->addItem($enableendingtime);
     // anonymization
     if (!$this->object->get360Mode()) {
         $codes = new ilCheckboxInputGUI($this->lng->txt("survey_access_codes"), "acc_codes");
         $codes->setInfo($this->lng->txt("survey_access_codes_info"));
         $codes->setChecked(!$this->object->isAccessibleWithoutCode());
         $form->addItem($codes);
         if ($this->object->_hasDatasets($this->object->getSurveyId())) {
             $codes->setDisabled(true);
         }
     }
     // question behaviour
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('svy_settings_section_question_behaviour'));
     $form->addItem($section);
     // show question titles
     $show_question_titles = new ilCheckboxInputGUI($this->lng->txt("svy_show_questiontitles"), "show_question_titles");
     $show_question_titles->setValue(1);
     $show_question_titles->setChecked($this->object->getShowQuestionTitles());
     $form->addItem($show_question_titles);
     // finishing
     $info = new ilFormSectionHeaderGUI();
     $info->setTitle($this->lng->txt("svy_settings_section_finishing"));
     $form->addItem($info);
     $view_own = new ilCheckboxInputGUI($this->lng->txt("svy_results_view_own"), "view_own");
     $view_own->setInfo($this->lng->txt("svy_results_view_own_info"));
     $view_own->setChecked($this->object->hasViewOwnResults());
     $form->addItem($view_own);
     $mail_own = new ilCheckboxInputGUI($this->lng->txt("svy_results_mail_own"), "mail_own");
     $mail_own->setInfo($this->lng->txt("svy_results_mail_own_info"));
     $mail_own->setChecked($this->object->hasMailOwnResults());
     $form->addItem($mail_own);
     // final statement
     $finalstatement = new ilTextAreaInputGUI($this->lng->txt("outro"), "outro");
     $finalstatement->setValue($this->object->prepareTextareaOutput($this->object->getOutro()));
     $finalstatement->setRows(10);
     $finalstatement->setCols(80);
     $finalstatement->setUseRte(TRUE);
     $finalstatement->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
     $finalstatement->addPlugin("latex");
     $finalstatement->addButton("latex");
     $finalstatement->addButton("pastelatex");
     $finalstatement->setRTESupport($this->object->getId(), "svy", "survey", null, $hide_rte_switch);
     $form->addItem($finalstatement);
     // mail notification
     $mailnotification = new ilCheckboxInputGUI($this->lng->txt("mailnotification"), "mailnotification");
     // $mailnotification->setOptionTitle($this->lng->txt("activate"));
     $mailnotification->setInfo($this->lng->txt("svy_result_mail_notification_info"));
     // #11762
     $mailnotification->setValue(1);
     $mailnotification->setChecked($this->object->getMailNotification());
     // addresses
     $mailaddresses = new ilTextInputGUI($this->lng->txt("mailaddresses"), "mailaddresses");
     $mailaddresses->setValue($this->object->getMailAddresses());
     $mailaddresses->setSize(80);
     $mailaddresses->setInfo($this->lng->txt('mailaddresses_info'));
     $mailaddresses->setRequired(true);
     // participant data
     $participantdata = new ilTextAreaInputGUI($this->lng->txt("mailparticipantdata"), "mailparticipantdata");
     $participantdata->setValue($this->object->getMailParticipantData());
     $participantdata->setRows(6);
     $participantdata->setCols(80);
     $participantdata->setUseRte(false);
     $participantdata->setInfo($this->lng->txt("mailparticipantdata_info"));
     // #12755 - because of privacy concerns we restrict user data to a minimum
     $placeholders = array("FIRST_NAME" => "firstname", "LAST_NAME" => "lastname", "LOGIN" => "login");
     $txt = array();
     foreach ($placeholders as $placeholder => $caption) {
         $txt[] = "[" . strtoupper($placeholder) . "]: " . $this->lng->txt($caption);
     }
     $txt = implode("<br />", $txt);
     $participantdatainfo = new ilNonEditableValueGUI($this->lng->txt("mailparticipantdata_placeholder"), "", true);
     $participantdatainfo->setValue($txt);
     $mailnotification->addSubItem($mailaddresses);
     $mailnotification->addSubItem($participantdata);
     $mailnotification->addSubItem($participantdatainfo);
     $form->addItem($mailnotification);
     // tutor notification - currently not available for 360°
     if (!$this->object->get360Mode()) {
         // parent course?
         global $tree;
         $has_parent = $tree->checkForParentType($this->object->getRefId(), "grp");
         if (!$has_parent) {
             $has_parent = $tree->checkForParentType($this->object->getRefId(), "crs");
         }
         $num_inv = sizeof($this->object->getInvitedUsers());
         // notification
         $tut = new ilCheckboxInputGUI($this->lng->txt("survey_notification_tutor_setting"), "tut");
         $tut->setChecked($this->object->getTutorNotificationStatus());
         $form->addItem($tut);
         $tut_logins = array();
         $tuts = $this->object->getTutorNotificationRecipients();
         if ($tuts) {
             foreach ($tuts as $tut_id) {
                 $tmp = ilObjUser::_lookupName($tut_id);
                 if ($tmp["login"]) {
                     $tut_logins[] = $tmp["login"];
                 }
             }
         }
         $tut_ids = new ilTextInputGUI($this->lng->txt("survey_notification_tutor_recipients"), "tut_ids");
         $tut_ids->setDataSource($this->ctrl->getLinkTarget($this, "doAutoComplete", "", true));
         $tut_ids->setRequired(true);
         $tut_ids->setMulti(true);
         $tut_ids->setMultiValues($tut_logins);
         $tut_ids->setValue(array_shift($tut_logins));
         $tut->addSubItem($tut_ids);
         $tut_grp = new ilRadioGroupInputGUI($this->lng->txt("survey_notification_target_group"), "tut_grp");
         $tut_grp->setRequired(true);
         $tut_grp->setValue($this->object->getTutorNotificationTarget());
         $tut->addSubItem($tut_grp);
         $tut_grp_crs = new ilRadioOption($this->lng->txt("survey_notification_target_group_parent_course"), ilObjSurvey::NOTIFICATION_PARENT_COURSE);
         if (!$has_parent) {
             $tut_grp_crs->setInfo($this->lng->txt("survey_notification_target_group_parent_course_inactive"));
         }
         $tut_grp->addOption($tut_grp_crs);
         $tut_grp_inv = new ilRadioOption($this->lng->txt("survey_notification_target_group_invited"), ilObjSurvey::NOTIFICATION_INVITED_USERS);
         $tut_grp_inv->setInfo(sprintf($this->lng->txt("survey_notification_target_group_invited_info"), $num_inv));
         $tut_grp->addOption($tut_grp_inv);
     }
     // reminders
     // reminder - currently not available for 360°
     if (!$this->object->get360Mode()) {
         $info = new ilFormSectionHeaderGUI();
         $info->setTitle($this->lng->txt("svy_settings_section_reminders"));
         $form->addItem($info);
         $rmd = new ilCheckboxInputGUI($this->lng->txt("survey_reminder_setting"), "rmd");
         $rmd->setChecked($this->object->getReminderStatus());
         $form->addItem($rmd);
         $rmd_start = new ilDateTimeInputGUI($this->lng->txt("survey_reminder_start"), "rmd_start");
         $rmd_start->setRequired(true);
         $start = $this->object->getReminderStart();
         if ($start) {
             $rmd_start->setDate($start);
         }
         $rmd->addSubItem($rmd_start);
         $end = $this->object->getReminderEnd();
         $rmd_end = new ilDateTimeInputGUI($this->lng->txt("survey_reminder_end"), "rmd_end");
         $rmd_end->enableDateActivation("", "rmd_end_tgl", (bool) $end);
         if ($end) {
             $rmd_end->setDate($end);
         }
         $rmd->addSubItem($rmd_end);
         $rmd_freq = new ilNumberInputGUI($this->lng->txt("survey_reminder_frequency"), "rmd_freq");
         $rmd_freq->setRequired(true);
         $rmd_freq->setSize(3);
         $rmd_freq->setSuffix($this->lng->txt("survey_reminder_frequency_days"));
         $rmd_freq->setValue($this->object->getReminderFrequency());
         $rmd_freq->setMinValue(1);
         $rmd->addSubItem($rmd_freq);
         $rmd_grp = new ilRadioGroupInputGUI($this->lng->txt("survey_notification_target_group"), "rmd_grp");
         $rmd_grp->setRequired(true);
         $rmd_grp->setValue($this->object->getReminderTarget());
         $rmd->addSubItem($rmd_grp);
         $rmd_grp_crs = new ilRadioOption($this->lng->txt("survey_notification_target_group_parent_course"), ilObjSurvey::NOTIFICATION_PARENT_COURSE);
         if (!$has_parent) {
             $rmd_grp_crs->setInfo($this->lng->txt("survey_notification_target_group_parent_course_inactive"));
         }
         $rmd_grp->addOption($rmd_grp_crs);
         $rmd_grp_inv = new ilRadioOption($this->lng->txt("survey_notification_target_group_invited"), ilObjSurvey::NOTIFICATION_INVITED_USERS);
         $rmd_grp_inv->setInfo(sprintf($this->lng->txt("survey_notification_target_group_invited_info"), $num_inv));
         $rmd_grp->addOption($rmd_grp_inv);
     }
     // results
     $results = new ilFormSectionHeaderGUI();
     $results->setTitle($this->lng->txt("results"));
     $form->addItem($results);
     // evaluation access
     if (!$this->object->get360Mode()) {
         $evaluation_access = new ilRadioGroupInputGUI($this->lng->txt('evaluation_access'), "evaluation_access");
         $option = new ilCheckboxOption($this->lng->txt("evaluation_access_off"), ilObjSurvey::EVALUATION_ACCESS_OFF, '');
         $option->setInfo($this->lng->txt("svy_evaluation_access_off_info"));
         $evaluation_access->addOption($option);
         $option = new ilCheckboxOption($this->lng->txt("evaluation_access_all"), ilObjSurvey::EVALUATION_ACCESS_ALL, '');
         $option->setInfo($this->lng->txt("svy_evaluation_access_all_info"));
         $evaluation_access->addOption($option);
         $option = new ilCheckboxOption($this->lng->txt("evaluation_access_participants"), ilObjSurvey::EVALUATION_ACCESS_PARTICIPANTS, '');
         $option->setInfo($this->lng->txt("svy_evaluation_access_participants_info"));
         $evaluation_access->addOption($option);
         $evaluation_access->setValue($this->object->getEvaluationAccess());
         $form->addItem($evaluation_access);
         $anonymization_options = new ilRadioGroupInputGUI($this->lng->txt("survey_results_anonymization"), "anonymization_options");
         $option = new ilCheckboxOption($this->lng->txt("survey_results_personalized"), "statpers");
         $option->setInfo($this->lng->txt("survey_results_personalized_info"));
         $anonymization_options->addOption($option);
         $option = new ilCheckboxOption($this->lng->txt("survey_results_anonymized"), "statanon");
         $option->setInfo($this->lng->txt("survey_results_anonymized_info"));
         $anonymization_options->addOption($option);
         $anonymization_options->setValue($this->object->hasAnonymizedResults() ? "statanon" : "statpers");
         $form->addItem($anonymization_options);
         if ($this->object->_hasDatasets($this->object->getSurveyId())) {
             $anonymization_options->setDisabled(true);
         }
     } else {
         $ts_results = new ilRadioGroupInputGUI($this->lng->txt("survey_360_results"), "ts_res");
         $ts_results->setValue($this->object->get360Results());
         $option = new ilRadioOption($this->lng->txt("survey_360_results_none"), ilObjSurvey::RESULTS_360_NONE);
         $option->setInfo($this->lng->txt("survey_360_results_none_info"));
         $ts_results->addOption($option);
         $option = new ilRadioOption($this->lng->txt("survey_360_results_own"), ilObjSurvey::RESULTS_360_OWN);
         $option->setInfo($this->lng->txt("survey_360_results_own_info"));
         $ts_results->addOption($option);
         $option = new ilRadioOption($this->lng->txt("survey_360_results_all"), ilObjSurvey::RESULTS_360_ALL);
         $option->setInfo($this->lng->txt("survey_360_results_all_info"));
         $ts_results->addOption($option);
         $form->addItem($ts_results);
     }
     // competence service activation for 360 mode
     include_once "./Services/Skill/classes/class.ilSkillManagementSettings.php";
     $skmg_set = new ilSkillManagementSettings();
     if ($this->object->get360Mode() && $skmg_set->isActivated()) {
         $other = new ilFormSectionHeaderGUI();
         $other->setTitle($this->lng->txt("other"));
         $form->addItem($other);
         $skill_service = new ilCheckboxInputGUI($this->lng->txt("survey_activate_skill_service"), "skill_service");
         $skill_service->setInfo($this->lng->txt("survey_activate_skill_service_info"));
         $skill_service->setChecked($this->object->get360SkillService());
         $form->addItem($skill_service);
     }
     $form->addCommandButton("saveProperties", $this->lng->txt("save"));
     // remove items when using template
     if ($template_settings) {
         foreach ($template_settings as $id => $item) {
             if ($item["hide"]) {
                 $form->removeItemByPostVar($id);
             }
         }
     }
     return $form;
 }
Пример #17
0
 /**
  * Save status of selecte members 
  */
 function saveStatusObject($a_part_view = false, $a_force_all = false)
 {
     global $ilCtrl;
     $this->checkPermission("write");
     include_once "./Modules/Exercise/classes/class.ilExAssignment.php";
     //		include_once 'Services/Tracking/classes/class.ilLPMarks.php';
     $saved_for = array();
     foreach ($_POST["id"] as $key => $value) {
         if (!$a_part_view) {
             if (!$a_force_all && $_POST["member"][$key] != "1") {
                 continue;
             } else {
                 $uname = ilObjUser::_lookupName($key);
                 $saved_for[] = $uname["lastname"] . ", " . $uname["firstname"];
             }
         }
         if (!$a_part_view) {
             $ass_id = (int) $_GET["ass_id"];
             $user_id = (int) $key;
         } else {
             $ass_id = (int) $key;
             $user_id = (int) $_GET["part_id"];
         }
         // team upload?
         if (is_object($this->ass) and $this->ass->getType() == ilExAssignment::TYPE_UPLOAD_TEAM) {
             $team_id = $this->ass->getTeamId($user_id);
             $user_ids = $this->ass->getTeamMembers($team_id);
             if (count($_POST["member"]) > 0) {
                 foreach ($user_ids as $user_id) {
                     if ($user_id != $key) {
                         $uname = ilObjUser::_lookupName($user_id);
                         $saved_for[] = $uname["lastname"] . ", " . $uname["firstname"];
                     }
                 }
             }
         } else {
             $user_ids = array($user_id);
         }
         foreach ($user_ids as $user_id) {
             ilExAssignment::updateStatusOfUser($ass_id, $user_id, ilUtil::stripSlashes($_POST["status"][$key]));
             ilExAssignment::updateNoticeForUser($ass_id, $user_id, ilUtil::stripSlashes($_POST["notice"][$key]));
             if (ilUtil::stripSlashes($_POST['mark'][$key]) != ilExAssignment::lookupMarkOfUser($ass_id, $user_id)) {
                 ilExAssignment::updateStatusTimeOfUser($ass_id, $user_id);
             }
             ilExAssignment::updateMarkOfUser($ass_id, $user_id, ilUtil::stripSlashes($_POST['mark'][$key]));
             /*
             ilExAssignment::updateCommentForUser($ass_id, $user_id,
             	ilUtil::stripSlashes($_POST['lcomment'][$key]));				 
             */
         }
     }
     if (count($saved_for) > 0) {
         $save_for_str = "(" . implode($saved_for, " - ") . ")";
     }
     if ($save_for_str || $a_part_view) {
         ilUtil::sendSuccess($this->lng->txt("exc_status_saved") . " " . $save_for_str, true);
     }
     if (!$a_part_view) {
         $ilCtrl->redirect($this, "members");
     } else {
         $ilCtrl->redirect($this, "showParticipant");
     }
 }
 /**
  * Take over course members to addressbook
  */
 public function adoptMembers()
 {
     global $lng;
     $ids = (int) $_GET['search_members'] ? array((int) $_GET['search_members']) : $_POST['search_members'];
     if ($ids) {
         foreach ($ids as $member) {
             $login = ilObjUser::_lookupLogin($member);
             if (!$this->abook->checkEntry($login)) {
                 $name = ilObjUser::_lookupName($member);
                 $email = '';
                 if (ilObjUser::_lookupPref((int) $member, 'public_email') == 'y') {
                     $email = ilObjUser::_lookupEmail($member);
                 }
                 $this->abook->addEntry($login, $name["firstname"], $name["lastname"], $email);
             }
         }
         ilUtil::sendInfo($lng->txt("mail_members_added_addressbook"));
     } else {
         ilUtil::sendInfo($lng->txt("mail_select_one_entry"));
     }
     $this->showMembers();
 }
Пример #19
0
 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();
     }
 }
Пример #20
0
 /**
  * Get salutation
  * @param int $a_usr_id
  * @return
  */
 public static function getSalutation($a_usr_id, $a_language = null)
 {
     global $lng;
     $lang = $a_language ? $a_language : $lng;
     $lang->loadLanguageModule('mail');
     $gender = ilObjUser::_lookupGender($a_usr_id);
     $gender = $gender ? $gender : 'n';
     $name = ilObjUser::_lookupName($a_usr_id);
     if (!strlen($name['firstname'])) {
         return $lang->txt('mail_salutation_anonymous') . ',';
     }
     return $lang->txt('mail_salutation_' . $gender) . ' ' . ($name['title'] ? $name['title'] . ' ' : '') . ($name['firstname'] ? $name['firstname'] . ' ' : '') . $name['lastname'] . ',';
 }
Пример #21
0
 /**
  * Render banner, user name
  * 
  * @param object  $a_tpl
  * @param int $a_user_id 
  * @param bool $a_export_path
  */
 protected function renderFullscreenHeader($a_tpl, $a_user_id, $a_export = false)
 {
     // repository blogs are multi-author
     $name = null;
     if ($this->id_type != self::REPOSITORY_NODE_ID) {
         $name = ilObjUser::_lookupName($a_user_id);
         $name = $name["lastname"] . ", " . ($t = $name["title"] ? $t . " " : "") . $name["firstname"];
     }
     // show banner?
     $banner = false;
     $blga_set = new ilSetting("blga");
     if ($blga_set->get("banner")) {
         $banner = $this->object->getImageFullPath();
         $banner_width = $blga_set->get("banner_width");
         $banner_height = $blga_set->get("banner_height");
         if ($a_export) {
             $banner = basename($banner);
         }
     }
     $ppic = null;
     if ($this->object->hasProfilePicture()) {
         $ppic = ilObjUser::_getPersonalPicturePath($a_user_id, "big");
         if ($a_export) {
             $ppic = basename($ppic);
         }
     }
     include_once "./Services/User/classes/class.ilUserUtil.php";
     $a_tpl->setFullscreenHeader($this->object->getTitle(), $name, $ppic, $banner, $this->object->getBackgroundColor(), $this->object->getFontColor(), $banner_width, $banner_height, $a_export);
     $a_tpl->setBodyClass("std ilExternal ilBlog");
 }
 /**
  * Build item rows for given object and filter(s)
  */
 function getItems()
 {
     if ($this->groups) {
         include_once './Modules/Course/classes/class.ilCourseParticipants.php';
         $part = ilCourseParticipants::_getInstanceByObjId($this->obj_id);
         $members = $part->getMembers();
         if (count($members)) {
             include_once './Services/User/classes/class.ilUserUtil.php';
             $usr_data = array();
             foreach ($members as $usr_id) {
                 $name = ilObjUser::_lookupName($usr_id);
                 // #9984
                 $user_groups = array("members" => array(), "admins" => array());
                 $user_groups_number = 0;
                 foreach (array_keys($this->participants) as $group_id) {
                     if (in_array($usr_id, $this->participants[$group_id]["members"])) {
                         $user_groups["members"][$group_id] = $this->groups[$group_id];
                         $user_groups_number++;
                     } else {
                         if (in_array($usr_id, $this->participants[$group_id]["admins"])) {
                             $user_groups["admins"][$group_id] = $this->groups[$group_id];
                             $user_groups_number++;
                         }
                     }
                 }
                 if ((!$this->filter["name"] || stristr(implode("", $name), $this->filter["name"])) && (!$this->filter["group"] || array_key_exists($this->filter["group"], $user_groups["members"]) || array_key_exists($this->filter["group"], $user_groups["admins"]))) {
                     $usr_data[] = array("usr_id" => $usr_id, "name" => $name["lastname"] . ", " . $name["firstname"], "groups" => $user_groups, "groups_number" => $user_groups_number, "login" => $name["login"]);
                 }
             }
             // ???
             $usr_data = array_slice($usr_data, (int) $this->getOffset(), (int) $this->getLimit());
             $this->setMaxCount(sizeof($members));
             $this->setData($usr_data);
         }
         return $titles;
     }
 }
Пример #23
0
 /**
  * Get all contributors for parent object
  *
  * @param	string	$a_parent_type	Parent Type
  * @param	int		$a_parent_id	Parent ID
  */
 static function getPageContributors($a_parent_type, $a_page_id, $a_lang = "-")
 {
     global $ilDB;
     $and_lang = "";
     if ($a_lang != "") {
         $and_lang = " AND lang = " . $ilDB->quote($a_lang, "text");
     }
     $contributors = array();
     $set = $ilDB->queryF("SELECT last_change_user, lang FROM page_object " . " WHERE page_id = %s AND parent_type = %s " . " AND last_change_user != %s" . $and_lang, array("integer", "text", "integer"), array($a_page_id, $a_parent_type, 0));
     while ($page = $ilDB->fetchAssoc($set)) {
         if ($a_lang == "") {
             $contributors[$page["last_change_user"]][$page["lang"]] = 1;
         } else {
             $contributors[$page["last_change_user"]] = 1;
         }
     }
     $set = $ilDB->queryF("SELECT count(DISTINCT page_id, parent_type, hdate, lang) as cnt, lang, page_id, user_id FROM page_history " . " WHERE page_id = %s AND parent_type = %s AND user_id != %s " . $and_lang . " GROUP BY user_id, page_id, lang ", array("integer", "text", "integer"), array($a_page_id, $a_parent_type, 0));
     while ($hpage = $ilDB->fetchAssoc($set)) {
         if ($a_lang == "") {
             $contributors[$hpage["user_id"]][$page["lang"]] = $contributors[$hpage["user_id"]][$page["lang"]] + $hpage["cnt"];
         } else {
             $contributors[$hpage["user_id"]] = $contributors[$hpage["user_id"]] + $hpage["cnt"];
         }
     }
     $c = array();
     foreach ($contributors as $k => $co) {
         $name = ilObjUser::_lookupName($k);
         $c[] = array("user_id" => $k, "pages" => $co, "lastname" => $name["lastname"], "firstname" => $name["firstname"]);
     }
     return $c;
 }
 /**
  * get versions table
  */
 function getVersionsTable($a_header_params, $a_user_comment = false)
 {
     global $ilCtrl;
     $ref_id = $a_header_params["ref_id"];
     require_once "./Services/Table/classes/class.ilTableGUI.php";
     $tbl = new ilTableGUI(0, false);
     // table header
     $tbl->setTitle($this->lng->txt("versions"));
     $tbl->setHeaderNames(array($this->lng->txt("date") . "/" . $this->lng->txt("user"), $this->lng->txt("action")));
     $tbl->setColumnWidth(array("40%", "60%"));
     $cols = array("date_user", "action");
     if ($a_header_params == "") {
         $a_header_params = array();
     }
     $header_params = $a_header_params;
     $tbl->setHeaderVars($cols, $header_params);
     // table variables
     $tbl->setOrderColumn($_GET["sort_by"]);
     $tbl->setOrderDirection($_GET["sort_order"]);
     $tbl->setLimit($_GET["limit"]);
     $tbl->setOffset($_GET["offset"]);
     $tbl->setMaxCount($this->maxcount);
     // ???
     $tbl->disable("header");
     // footer
     $tbl->setFooter("tblfooter", $this->lng->txt("previous"), $this->lng->txt("next"));
     // get history entries
     $entries = ilHistory::_getEntriesForObject($this->obj_id, $this->obj_type);
     $tbl->setMaxCount(count($entries));
     $entries = array_slice($entries, $_GET["offset"], $_GET["limit"]);
     $this->tpl =& $tbl->getTemplateObject();
     $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.history_row.html", "Services/History");
     if (count($entries) > 0) {
         $i = 0;
         foreach ($entries as $entry) {
             $this->tpl->setCurrentBlock("tbl_content");
             $css_row = $css_row != "tblrow1" ? "tblrow1" : "tblrow2";
             $this->tpl->setVariable("CSS_ROW", $css_row);
             $this->tpl->setVariable('TXT_DATE', ilDatePresentation::formatDate(new ilDateTime($entry['date'], IL_CAL_DATETIME)));
             $name = ilObjUser::_lookupName($entry["user_id"]);
             $this->tpl->setVariable("TXT_USER", $name["title"] . " " . $name["firstname"] . " " . $name["lastname"] . " [" . $entry["user_id"] . "]");
             $info_params = explode(",", $entry["info_params"]);
             $info_text = $this->lng->txt("hist_" . $this->obj_type . "_" . $entry["action"]);
             $i = 1;
             foreach ($info_params as $info_param) {
                 $info_text = str_replace("%" . $i, $info_param, $info_text);
                 $i++;
             }
             $this->tpl->setVariable("TXT_ACTION", $info_text);
             if ($a_user_comment) {
                 $this->tpl->setCurrentBlock("user_comment");
                 $this->tpl->setVariable("TXT_USER_COMMENT", $entry["user_comment"]);
                 $this->tpl->parseCurrentBlock();
                 $this->tpl->setCurrentBlock("tbl_content");
             }
             $this->tpl->setCurrentBlock("dl_link");
             $this->tpl->setVariable("TXT_DL", $this->lng->txt("download"));
             $ilCtrl->setParameterByClass("ilobjfilegui", "hist_id", $entry["hist_entry_id"]);
             $this->tpl->setVariable("DL_LINK", $ilCtrl->getLinkTargetByClass("ilobjfilegui", "sendfile"));
             $this->tpl->setCurrentBlock("tbl_content");
             $this->tpl->parseCurrentBlock();
         }
     } else {
         $this->tpl->setCurrentBlock("tbl_content_cell");
         $this->tpl->setVariable("TBL_CONTENT_CELL", $this->lng->txt("hist_no_entries"));
         $this->tpl->setVariable("TBL_COL_SPAN", 4);
         $this->tpl->parseCurrentBlock();
         $this->tpl->setCurrentBlock("tbl_content_row");
         $this->tpl->setVariable("ROWCOLOR", "tblrow1");
         $this->tpl->parseCurrentBlock();
     }
     $tbl->render();
     //$this->tpl->parseCurrentBlock();
     return $this->tpl->get();
 }
 public function addStatisticWorksheet(&$pewa)
 {
     include_once './Services/Excel/classes/class.ilExcelUtils.php';
     include_once './Services/Payment/classes/class.ilPaymentVendors.php';
     $this->__initBookingObject();
     $workbook = $pewa->getWorkbook();
     $worksheet = $workbook->addWorksheet(utf8_decode($this->lng->txt('bookings')));
     $worksheet->mergeCells(0, 0, 0, 3);
     $worksheet->setColumn(0, 0, 16);
     $worksheet->setColumn(0, 1, 32);
     $worksheet->setColumn(0, 2, 32);
     $worksheet->setColumn(0, 3, 16);
     $worksheet->setColumn(0, 4, 16);
     $worksheet->setColumn(0, 5, 16);
     $worksheet->setColumn(0, 6, 24);
     $worksheet->setColumn(0, 7, 8);
     $worksheet->setColumn(0, 8, 12);
     $worksheet->setColumn(0, 9, 16);
     $title = $this->lng->txt('bookings');
     $title .= ' ' . $this->lng->txt('as_of') . ' ';
     $title .= strftime('%Y-%m-%d %R', time());
     $worksheet->writeString(0, 0, $title, $pewa->getFormatTitle());
     $worksheet->writeString(1, 0, $this->lng->txt('payment_system'), $pewa->getFormatHeader());
     $worksheet->writeString(1, 1, $this->lng->txt('paya_transaction'), $pewa->getFormatHeader());
     $worksheet->writeString(1, 2, $this->lng->txt('title'), $pewa->getFormatHeader());
     $worksheet->writeString(1, 3, $this->lng->txt('paya_vendor'), $pewa->getFormatHeader());
     $worksheet->writeString(1, 4, $this->lng->txt('pays_cost_center'), $pewa->getFormatHeader());
     $worksheet->writeString(1, 5, $this->lng->txt('paya_customer'), $pewa->getFormatHeader());
     $worksheet->writeString(1, 6, $this->lng->txt('email'), $pewa->getFormatHeader());
     $worksheet->writeString(1, 7, $this->lng->txt('paya_order_date'), $pewa->getFormatHeader());
     $worksheet->writeString(1, 8, $this->lng->txt('duration'), $pewa->getFormatHeader());
     $worksheet->writeString(1, 9, $this->lng->txt('price_a'), $pewa->getFormatHeader());
     $worksheet->writeString(1, 10, $this->lng->txt('paya_payed_access'), $pewa->getFormatHeader());
     $worksheet->writeString(1, 11, $this->lng->txt('street'), $pewa->getFormatHeader());
     $worksheet->writeString(1, 12, $this->lng->txt('pay_bmf_po_box'), $pewa->getFormatHeader());
     $worksheet->writeString(1, 13, $this->lng->txt('zipcode'), $pewa->getFormatHeader());
     $worksheet->writeString(1, 14, $this->lng->txt('city'), $pewa->getFormatHeader());
     $worksheet->writeString(1, 15, $this->lng->txt('country'), $pewa->getFormatHeader());
     if (!count($bookings = $this->booking_obj->getBookings())) {
         return false;
     }
     include_once 'Services/User/classes/class.ilObjUser.php';
     $object_title_cache = array();
     $user_title_cache = array();
     $counter = 2;
     foreach ($bookings as $booking) {
         if (array_key_exists($booking['ref_id'], $object_title_cache)) {
             $tmp_obj = $object_title_cache[$booking['ref_id']];
         } else {
             $tmp_obj = ilObject::_lookupTitle(ilObject::_lookupObjId($booking['ref_id']));
             $object_title_cache[$booking['ref_id']] = $tmp_obj;
         }
         if (array_key_exists($booking['b_vendor_id'], $user_title_cache)) {
             $tmp_vendor = $user_title_cache[$booking['b_vendor_id']];
         } else {
             $tmp_vendor = ilObjUser::_lookupLogin($booking['b_vendor_id']);
             $user_title_cache[$booking['b_vendor_id']] = $tmp_vendor;
         }
         if (array_key_exists($booking['customer_id'], $user_title_cache)) {
             $tmp_purchaser = $user_title_cache[$booking['customer_id']];
         } else {
             $tmp_purchaser_name = ilObjUser::_lookupName($booking['customer_id']);
             $tmp_purchaser_login = ilObjUser::_lookupLogin($booking['customer_id']);
             $tmp_purchaser_email = ilObjUser::_lookupEmail($booking['customer_id']);
             $tmp_purchaser = '' . $tmp_purchaser_name['firstname'] . ' ' . $tmp_purchaser_name['lastname'] . ' [' . $tmp_purchaser_login . ']';
             $user_title_cache[$booking['customer_id']] = $tmp_purchaser;
         }
         include_once './Services/Payment/classes/class.ilPayMethods.php';
         $str_paymethod = ilPayMethods::getStringByPaymethod($booking['b_pay_method']);
         $worksheet->writeString($counter, 0, $str_paymethod);
         $worksheet->writeString($counter, 1, $booking['transaction']);
         $worksheet->writeString($counter, 2, $tmp_obj != '' ? $tmp_obj : $this->lng->txt('object_deleted'));
         $worksheet->writeString($counter, 3, $tmp_vendor != '' ? $tmp_vendor : $this->lng->txt('user_deleted'));
         $worksheet->writeString($counter, 4, ilPaymentVendors::_getCostCenter($booking['b_vendor_id']));
         $worksheet->writeString($counter, 5, $tmp_purchaser != '' ? $tmp_purchaser : $this->lng->txt('user_deleted'));
         $worksheet->writeString($counter, 6, $tmp_purchaser_email);
         $worksheet->writeString($counter, 7, strftime('%Y-%m-%d %R', $booking['order_date']));
         $worksheet->writeString($counter, 8, $booking['duration']);
         $worksheet->writeString($counter, 9, $booking['price']);
         $payed_access = $booking['payed'] ? $this->lng->txt('yes') : $this->lng->txt('no');
         $payed_access .= '/';
         $payed_access .= $booking['access_granted'] ? $this->lng->txt('yes') : $this->lng->txt('no');
         $worksheet->writeString($counter, 10, $payed_access);
         $worksheet->writeString($counter, 11, $booking['street']);
         $worksheet->writeString($counter, 12, $booking['po_box']);
         $worksheet->writeString($counter, 13, $booking['zipcode']);
         $worksheet->writeString($counter, 14, $booking['city']);
         $worksheet->writeString($counter, 15, $booking['country']);
         unset($tmp_obj);
         unset($tmp_vendor);
         unset($tmp_purchaser);
         ++$counter;
     }
     return true;
 }
 /**
  * render attendance list
  *
  * @return string
  */
 public function getHTML()
 {
     $tpl = new ilTemplate('tpl.attendance_list_print.html', true, true, 'Services/Membership');
     // title
     $time = ilFormat::formatUnixTime(time(), true);
     $tpl->setVariable('TXT_TITLE', $this->title);
     if ($this->description) {
         $tpl->setVariable('TXT_DESCRIPTION', $this->description . " (" . $time . ")");
     } else {
         $tpl->setVariable('TXT_DESCRIPTION', $time);
     }
     // header
     $tpl->setCurrentBlock('head_item');
     foreach ($this->presets as $id => $item) {
         if ($item[1]) {
             $tpl->setVariable('TXT_HEAD', $item[0]);
             $tpl->parseCurrentBlock();
         }
     }
     if ($this->blank_columns) {
         foreach ($this->blank_columns as $blank) {
             $tpl->setVariable('TXT_HEAD', $blank);
             $tpl->parseCurrentBlock();
         }
     }
     // handle members
     $member_ids = array();
     if ($this->show_admins) {
         $member_ids = array_merge((array) $member_ids, $this->participants->getAdmins());
     }
     if ($this->show_tutors) {
         $member_ids = array_merge((array) $member_ids, $this->participants->getTutors());
     }
     if ($this->show_members) {
         $member_ids = array_merge((array) $member_ids, $this->participants->getMembers());
     }
     $member_ids = ilUtil::_sortIds((array) $member_ids, 'usr_data', 'lastname', 'usr_id');
     // rows
     foreach ($member_ids as $user_id) {
         if ($this->callback) {
             $user_data = call_user_func_array($this->callback, array($user_id));
             $tpl->setCurrentBlock("row_preset");
             foreach ($this->presets as $id => $item) {
                 if ($item[1]) {
                     switch ($id) {
                         case "name":
                             if (!$user_data[$id]) {
                                 $name = ilObjUser::_lookupName($user_id);
                                 $value = $name["lastname"] . ", " . $name["firstname"];
                                 break;
                             }
                         case "email":
                             if (!$user_data[$id]) {
                                 $value = ilObjUser::_lookupEmail($user_id);
                                 break;
                             }
                         case "login":
                             if (!$user_data[$id]) {
                                 $value = ilObjUser::_lookupLogin($user_id);
                                 break;
                             }
                         default:
                             $value = (string) $user_data[$id];
                             break;
                     }
                     $tpl->setVariable("TXT_PRESET", $value);
                     $tpl->parseCurrentBlock();
                 }
             }
         }
         if ($this->blank_columns) {
             for ($loop = 0; $loop < sizeof($this->blank_columns); $loop++) {
                 $tpl->touchBlock('row_blank');
             }
         }
         $tpl->touchBlock("member_row");
     }
     return $tpl->get();
 }
 function showUserTimings()
 {
     $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.crs_user_timings.html', 'Modules/Course');
     $this->tabs_gui->clearSubTabs();
     $this->tabs_gui->setTabActive('members');
     if (!$_GET['member_id']) {
         ilUtil::sendFailure($this->lng->txt('no_checkbox'), true);
         $this->ctrl->returnToParent($this);
     }
     // Back button
     $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
     $this->tpl->setCurrentBlock("btn_cell");
     $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, 'returnToMembers'));
     $this->tpl->setVariable("BTN_TXT", $this->lng->txt("back"));
     $this->tpl->parseCurrentBlock();
     include_once 'Modules/Course/classes/Timings/class.ilTimingAccepted.php';
     $usr_accepted = new ilTimingAccepted($this->course_obj->getId(), (int) $_GET['member_id']);
     if ($usr_accepted->isAccepted()) {
         $this->tpl->setVariable("ACC_IMG", ilUtil::getImagePath('icon_ok.png'));
         $this->tpl->setVariable("ACC_ALT", $this->lng->txt('timing_accepted'));
     } else {
         $this->tpl->setVariable("ACC_IMG", ilUtil::getImagePath('icon_not_ok.png'));
         $this->tpl->setVariable("ACC_ALT", $this->lng->txt('timing_not_accepted'));
     }
     if ($usr_accepted->isVisible() and strlen($usr_accepted->getRemark())) {
         $this->tpl->setVariable("REMARK", nl2br($usr_accepted->getRemark()));
     } else {
         $this->tpl->setVariable("REMARK", $this->lng->txt('not_available'));
     }
     $this->tpl->setVariable("TIMING_ACCEPT", $this->lng->txt('timing_accept_table'));
     $this->tpl->setVariable("TXT_ACCEPTED", $this->lng->txt('timing_user_accepted'));
     $this->tpl->setVariable("TXT_REMARK", $this->lng->txt('timing_remark'));
     $this->tpl->setVariable("HEADER_IMG", ilUtil::getImagePath('icon_usr.png'));
     $this->tpl->setVariable("HEADER_ALT", $this->lng->txt('obj_usr'));
     $this->tpl->setVariable("TABLE_HEADER", $this->lng->txt('timings_of'));
     $name = ilObjUser::_lookupName($_GET['member_id']);
     $this->tpl->setVariable("USER_NAME", $name['lastname'] . ', ' . $name['firstname']);
     $this->tpl->setVariable("TXT_TITLE", $this->lng->txt('title'));
     $this->tpl->setVariable("TXT_START_END", $this->lng->txt('crs_timings_short_start_end'));
     $this->tpl->setVariable("TXT_INFO_START_END", $this->lng->txt('crs_timings_start_end_info'));
     $this->tpl->setVariable("TXT_CHANGED", $this->lng->txt('crs_timings_changed'));
     $this->tpl->setVariable("TXT_OWN_PRESETTING", $this->lng->txt('crs_timings_planed_start'));
     $this->tpl->setVariable("TXT_INFO_OWN_PRESETTING", $this->lng->txt('crs_timings_from_until'));
     include_once 'Services/Object/classes/class.ilObjectActivation.php';
     $items = ilObjectActivation::getTimingsAdministrationItems($this->course_obj->getRefId());
     foreach ($items as $item) {
         if ($item['timing_type'] == ilObjectActivation::TIMINGS_PRESETTING or ilObjectActivation::hasChangeableTimings($item['ref_id'])) {
             $this->__renderUserItem($item, 0);
         }
     }
 }
Пример #28
0
 /**
  * Read responsible users
  */
 function readResponsibleUsers()
 {
     global $ilDB;
     $set = $ilDB->queryF("SELECT * FROM cal_entry_responsible WHERE cal_id = %s", array("integer"), array($this->getEntryId()));
     $return = array();
     while ($rec = $ilDB->fetchAssoc($set)) {
         $n = ilObjUser::_lookupName($rec["user_id"]);
         $return[] = array_merge($n, array("login" => ilObjUser::_lookupLogin($rec["user_id"])));
     }
     return $return;
 }
Пример #29
0
 function deleteUsersObject()
 {
     $this->checkPermission("cat_administrate_users");
     if (!count($_POST['id'])) {
         ilUtil::sendFailure($this->lng->txt('no_users_selected'));
         $this->index();
         return true;
     }
     include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
     $confirm = new ilConfirmationGUI();
     $confirm->setFormAction($this->ctrl->getFormAction($this));
     $confirm->setHeaderText($this->lng->txt('sure_delete_selected_users'));
     $confirm->setConfirm($this->lng->txt('delete'), 'performDeleteUsers');
     $confirm->setCancel($this->lng->txt('cancel'), 'index');
     foreach ($_POST['id'] as $user) {
         $name = ilObjUser::_lookupName($user);
         $confirm->addItem('user_ids[]', $user, $name['lastname'] . ', ' . $name['firstname'] . ' [' . $name['login'] . ']');
     }
     $this->tpl->setContent($confirm->getHTML());
 }
Пример #30
0
 /**
  * Creates a user, sets preferences, lookups data, delete user
  * @group IL_Init
  */
 public function testCreateSetLookupDelete()
 {
     include_once "./Services/User/classes/class.ilObjUser.php";
     // delete all aatestuser from previous runs
     while (($i = ilObjUser::_lookupId("aatestuser")) > 0) {
         $user = new ilObjUser($i);
         $user->delete();
     }
     $user = new ilObjUser();
     // creation
     $d = array("login" => "aatestuser", "passwd_type" => IL_PASSWD_PLAIN, "passwd" => "password", "gender" => "m", "firstname" => "Max", "lastname" => "Mutzke", "email" => "*****@*****.**", "client_ip" => "1.2.3.4", "ext_account" => "ext_mutzke");
     $user->assignData($d);
     $user->create();
     $user->saveAsNew();
     $user->setLanguage("no");
     $user->writePrefs();
     $id = $user->getId();
     $value .= $user->getFirstname() . "-";
     // update
     $user->setFirstname("Maxi");
     $user->update();
     $value .= $user->getFirstname() . "-";
     // other update methods
     $user->refreshLogin();
     // lookups
     $value .= ilObjUser::_lookupEmail($id) . "-";
     $value .= ilObjUser::_lookupGender($id) . "-";
     $value .= ilObjUser::_lookupClientIP($id) . "-";
     $n = ilObjUser::_lookupName($id);
     $value .= $n["lastname"] . "-";
     ilObjUser::_lookupFields($id);
     $value .= ilObjUser::_lookupLogin($id) . "-";
     $value .= ilObjUser::_lookupExternalAccount($id) . "-";
     $value .= ilObjUser::_lookupId("aatestuser") . "-";
     ilObjUser::_lookupLastLogin($id);
     $value .= ilObjUser::_lookupLanguage($id) . "-";
     ilObjUser::_readUsersProfileData(array($id));
     if (ilObjUser::_loginExists("aatestuser")) {
         $value .= "le-";
     }
     // preferences...
     $user->writePref("testpref", "pref1");
     $value .= ilObjUser::_lookupPref($id, "testpref") . "-";
     $user->deletePref("testpref");
     if (ilObjUser::_lookupPref($id, "testpref") == "") {
         $value .= "pref2" . "-";
     }
     // activation
     $user->setActive(false);
     if (!ilObjUser::getStoredActive($id)) {
     }
     $value .= "act1-";
     $user->setActive(true);
     if (ilObjUser::getStoredActive($id)) {
     }
     $value .= "act2-";
     ilObjUser::_toggleActiveStatusOfUsers(array($id), false);
     if (!ilObjUser::getStoredActive($id)) {
     }
     $value .= "act3-";
     // deletion
     $user->delete();
     $this->assertEquals("Max-Maxi-de@de.de-m-1.2.3.4-Mutzke-aatestuser-ext_mutzke-{$id}-no-le-" . "pref1-pref2-act1-act2-act3-", $value);
 }