コード例 #1
0
 /**
  * @param $a_parent_obj
  * @param string $a_parent_cmd
  * @param ilObjUser $user The user from whom the certificates are displayed
  * @param array $options
  */
 public function __construct($a_parent_obj, $a_parent_cmd = "", ilObjUser $user, array $options = array())
 {
     $this->_user = $user;
     $options['user_id'] = $user->getId();
     $options['columns'] = isset($options['columns']) ? $options['columns'] : $this->columns;
     parent::__construct($a_parent_obj, $a_parent_cmd, $options);
 }
コード例 #2
0
 /**
  * @return boolean
  */
 public function adjust()
 {
     if (defined('IL_CERT_SSO')) {
         return false;
     } else {
         if (!ilContext::supportsRedirects()) {
             return false;
         } else {
             if ($this->ctrl->isAsynch()) {
                 return false;
             } else {
                 if (in_array(basename($_SERVER['PHP_SELF']), array('logout.php'))) {
                     return false;
                 } else {
                     if (!$this->user->getId() || $this->user->isAnonymous()) {
                         return false;
                     }
                 }
             }
         }
     }
     foreach ($this->cases as $case) {
         if ($case->isInFulfillment()) {
             return false;
         }
         if ($case->shouldAdjustRequest()) {
             if ($case->shouldStoreRequestTarget()) {
                 $this->storeRequest();
             }
             $case->adjust();
             return true;
         }
     }
     return false;
 }
コード例 #3
0
 /**
  * @static
  * @param array $usr_ids
  */
 public static function preloadUserObjects(array $usr_ids)
 {
     /**
      * @var $ilDB ilDB
      */
     global $ilDB;
     $usr_ids_to_request = array_diff($usr_ids, self::$requested_usr_ids);
     self::$requested_usr_ids = array_merge(self::$requested_usr_ids, $usr_ids_to_request);
     self::$requested_usr_ids_key_map = array_flip(self::$requested_usr_ids);
     if ($usr_ids_to_request) {
         $in = $ilDB->in('ud.usr_id', $usr_ids_to_request, false, 'integer');
         $query = "\n\t\t\t\tSELECT ud.usr_id, login, firstname, lastname, title, gender, pprof.value public_profile,pup.value public_upload, pupgen.value public_gender\n\t\t\t\tFROM usr_data ud\n\t\t\t\tLEFT JOIN usr_pref pprof ON pprof.usr_id = ud.usr_id AND pprof.keyword = %s\n\t\t\t\tLEFT JOIN usr_pref pupgen ON pupgen.usr_id = ud.usr_id AND pupgen.keyword = %s\n\t\t\t\tLEFT JOIN usr_pref pup ON pup.usr_id = ud.usr_id AND pup.keyword = %s\n\t\t\t\tWHERE {$in}\n\t\t\t";
         $res = $ilDB->queryF($query, array('text', 'text', 'text'), array('public_profile', 'public_gender', 'public_upload'));
         while ($row = $ilDB->fetchAssoc($res)) {
             $user = new ilObjUser();
             $user->setId($row['usr_id']);
             $user->setLogin($row['login']);
             $user->setGender($row['gender']);
             $user->setTitle($row['title']);
             $user->setFirstname($row['firstname']);
             $user->setLastname($row['lastname']);
             $user->setPref('public_profile', $row['public_profile']);
             $user->setPref('public_upload', $row['public_upload']);
             $user->setPref('public_gender', $row['public_gender']);
             self::$user_instances[$row['usr_id']] = $user;
         }
     }
 }
コード例 #4
0
 /**
  * Standard Version of Fill Row. Most likely to
  * be overwritten by derived class.
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl, $ilAccess;
     $news_set = new ilSetting("news");
     $enable_internal_rss = $news_set->get("enable_rss_for_internal");
     // user
     if ($a_set["user_id"] > 0) {
         $this->tpl->setCurrentBlock("user_info");
         $user_obj = new ilObjUser($a_set["user_id"]);
         $this->tpl->setVariable("VAL_AUTHOR", $user_obj->getLogin());
         $this->tpl->setVariable("TXT_AUTHOR", $lng->txt("author"));
         $this->tpl->parseCurrentBlock();
     }
     // access
     if ($enable_internal_rss) {
         $this->tpl->setCurrentBlock("access");
         $this->tpl->setVariable("TXT_ACCESS", $lng->txt("news_news_item_visibility"));
         if ($a_set["visibility"] == NEWS_PUBLIC || $a_set["priority"] == 0 && ilBlockSetting::_lookup("news", "public_notifications", 0, $a_set["context_obj_id"])) {
             $this->tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_public"));
         } else {
             $this->tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_users"));
         }
         $this->tpl->parseCurrentBlock();
     }
     // last update
     if ($a_set["creation_date"] != $a_set["update_date"]) {
         $this->tpl->setCurrentBlock("ni_update");
         $this->tpl->setVariable("TXT_LAST_UPDATE", $lng->txt("last_update"));
         $this->tpl->setVariable("VAL_LAST_UPDATE", ilDatePresentation::formatDate(new ilDateTime($a_set["update_date"], IL_CAL_DATETIME)));
         $this->tpl->parseCurrentBlock();
     }
     // creation date
     $this->tpl->setVariable("VAL_CREATION_DATE", ilDatePresentation::formatDate(new ilDateTime($a_set["creation_date"], IL_CAL_DATETIME)));
     $this->tpl->setVariable("TXT_CREATED", $lng->txt("created"));
     // title
     $this->tpl->setVariable("VAL_TITLE", $a_set["title"]);
     // content
     if ($a_set["content"] != "") {
         $this->tpl->setCurrentBlock("content");
         $this->tpl->setVariable("VAL_CONTENT", ilUtil::shortenText($a_set["content"], 80, true, true), true);
         $this->tpl->parseCurrentBlock();
     }
     $perm_ref_id = $this->perm_ref_id > 0 ? $this->perm_ref_id : $a_set["ref_id"];
     if ($ilAccess->checkAccess("write", "", $perm_ref_id)) {
         $this->tpl->setCurrentBlock("edit");
         $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit"));
         $ilCtrl->setParameterByClass("ilnewsitemgui", "news_item_id", $a_set["id"]);
         $this->tpl->setVariable("CMD_EDIT", $ilCtrl->getLinkTargetByClass("ilnewsitemgui", "editNewsItem"));
         $this->tpl->parseCurrentBlock();
     }
     // context
     $this->tpl->setVariable("CONTEXT", $lng->txt("obj_" . $a_set["context_obj_type"]) . ":<br />" . ilObject::_lookupTitle($a_set["context_obj_id"]));
     $this->tpl->setVariable("VAL_ID", $a_set["id"]);
 }
コード例 #5
0
 public static function checkIfReminderMailShouldBeSend(ilObjUser $user, $reminderTime)
 {
     global $ilDB;
     $query = "SELECT ts FROM " . self::TABLE_NAME . " WHERE usr_id = %s";
     $res = $ilDB->queryF($query, array('integer'), array($user->getId()));
     $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
     if ($row->ts == null) {
         self::sendReminder($user, $reminderTime);
         return true;
     }
     return false;
 }
 public function run()
 {
     if (!$this->enabled) {
         return;
     }
     global $rbacreview;
     $usr_ids = ilObjUser::_getUserIdsByInactivationPeriod($this->period);
     foreach ($usr_ids as $usr_id) {
         if ($usr_id == ANONYMOUS_USER_ID || $usr_id == SYSTEM_USER_ID) {
             continue;
         }
         $continue = true;
         foreach ($this->include_roles as $role_id) {
             if ($rbacreview->isAssigned($usr_id, $role_id)) {
                 $continue = false;
                 break;
             }
         }
         if ($continue) {
             continue;
         }
         $user = ilObjectFactory::getInstanceByObjId($usr_id);
         $user->delete();
     }
 }
 protected function initForm()
 {
     $this->setFormAction($this->ctrl->getFormAction($this->parent_gui));
     $this->setTitle($this->pl->txt('certificate_placeholders'));
     // Each placeholder can define values for each language defined in the type
     $languages = $this->definition->getType()->getLanguages();
     $label_lang = in_array($this->user->getLanguage(), $languages) ? $this->user->getLanguage() : $this->definition->getDefaultLanguage();
     /** @var $placeholder_value srCertificatePlaceholderValue */
     foreach ($this->definition->getPlaceholderValues() as $placeholder_value) {
         $section = new ilFormSectionHeaderGUI();
         $section->setTitle($placeholder_value->getPlaceholder()->getLabel($label_lang));
         $this->addItem($section);
         foreach ($languages as $lang) {
             $this->addItem($this->getInputField($placeholder_value, $lang));
         }
     }
     if ($signatures = $this->definition->getType()->getSignatures()) {
         $section = new ilFormSectionHeaderGUI();
         $section->setTitle($this->pl->txt('signature'));
         $this->addItem($section);
         $select_input = new ilSelectInputGUI($this->pl->txt('signature'), 'signature');
         $options = array(0 => '');
         foreach ($signatures as $signature) {
             $options[$signature->getId()] = $signature->getFirstName() . ' ' . $signature->getLastName();
         }
         $select_input->setOptions($options);
         $select_input->setValue($this->definition->getSignatureId());
         $this->addItem($select_input);
     }
     $this->addCommandButton('updatePlaceholders', $this->pl->txt('save'));
     return;
 }
コード例 #8
0
 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);
 }
コード例 #9
0
 function changeOwner()
 {
     global $rbacsystem, $ilObjDataCache;
     if (!($user_id = ilObjUser::_lookupId($_POST['owner']))) {
         ilUtil::sendFailure($this->lng->txt('user_not_known'));
         $this->owner();
         return true;
     }
     // no need to change?
     if ($user_id != $this->gui_obj->object->getOwner()) {
         $this->gui_obj->object->setOwner($user_id);
         $this->gui_obj->object->updateOwner();
         $ilObjDataCache->deleteCachedEntry($this->gui_obj->object->getId());
         include_once "Services/AccessControl/classes/class.ilRbacLog.php";
         if (ilRbacLog::isActive()) {
             ilRbacLog::add(ilRbacLog::CHANGE_OWNER, $this->gui_obj->object->getRefId(), array($user_id));
         }
     }
     ilUtil::sendSuccess($this->lng->txt('owner_updated'), true);
     if (!$rbacsystem->checkAccess("edit_permission", $this->gui_obj->object->getRefId())) {
         $this->ctrl->redirect($this->gui_obj);
         return true;
     }
     $this->ctrl->redirect($this, 'owner');
     return true;
 }
コード例 #10
0
 /** 
  * 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;
 }
コード例 #11
0
 public function run()
 {
     global $rbacreview;
     $status = ilCronJobResult::STATUS_NO_ACTION;
     $usr_ids = ilObjUser::_getUserIdsByInactivityPeriod($this->period);
     $counter = 0;
     foreach ($usr_ids as $usr_id) {
         if ($usr_id == ANONYMOUS_USER_ID || $usr_id == SYSTEM_USER_ID) {
             continue;
         }
         $continue = true;
         foreach ($this->include_roles as $role_id) {
             if ($rbacreview->isAssigned($usr_id, $role_id)) {
                 $continue = false;
                 break;
             }
         }
         if ($continue) {
             continue;
         }
         $user = ilObjectFactory::getInstanceByObjId($usr_id);
         $user->delete();
         $counter++;
     }
     if ($counter) {
         $status = ilCronJobResult::STATUS_OK;
     }
     $result = new ilCronJobResult();
     $result->setStatus($status);
     return $result;
 }
コード例 #12
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();
     }
 }
コード例 #13
0
 /**
  * @param array $a_set
  */
 protected function fillRow(array $a_set)
 {
     // For checkboxes in first column
     if (count($this->getOption('actions_multi')) && $a_set['status'] == 3) {
         $this->tpl->setCurrentBlock('CHECKBOXES');
         $this->tpl->setVariable('VALUE', $a_set['id']);
         $this->tpl->parseCurrentBlock();
     } else {
         $this->tpl->setCurrentBlock('COL');
         $this->tpl->setVariable('VALUE', '');
         $this->tpl->parseCurrentBlock();
     }
     $utc = ilCertificateConfig::get('time_format_utc');
     $date_function = $utc ? 'gmdate' : 'date';
     foreach ($this->columns as $k => $column) {
         $value = is_null($a_set[$column]) ? '' : $a_set[$column];
         if ($this->isColumnSelected($column)) {
             // Format dates
             if (in_array($column, array('valid_from', 'valid_to')) && $value != '') {
                 $time = strtotime($value);
                 $time = $utc ? $time + srCertificate::TIME_ZONE_CORRECTION : $time;
                 switch ($this->user->getDateFormat()) {
                     case ilCalendarSettings::DATE_FORMAT_DMY:
                         $value = $date_function('d.m.Y', $time);
                         break;
                     case ilCalendarSettings::DATE_FORMAT_MDY:
                         $value = $date_function('m/d/Y', $time);
                         break;
                 }
             } elseif (in_array($column, array('valid_from', 'valid_to')) && $value == '') {
                 $value = $this->pl->txt('unlimited');
             }
             if ($column == 'status') {
                 $value = $this->pl->txt("cert_status_" . (int) $value);
             }
             // Set value
             $this->tpl->setCurrentBlock('COL');
             $this->tpl->setVariable('VALUE', $value);
             $this->tpl->parseCurrentBlock();
         }
     }
     // Actions
     if (count($this->getOption('actions'))) {
         if ($this->hasAction($a_set)) {
             $this->ctrl->setParameterByClass(get_class($this->parent_obj), 'cert_id', $a_set['id']);
             $this->ctrl->setParameterByClass(get_class($this->parent_obj), 'status', $a_set['status']);
             $async_url = $this->ctrl->getLinkTargetByClass(array(ilCertificatePlugin::getBaseClass(), get_class($this->parent_obj)), 'buildActions', '', true);
             $actions = new ilAdvancedSelectionListGUI();
             $actions->setId('action_list_' . $a_set['id']);
             $actions->setAsynchUrl($async_url);
             $actions->setAsynch(true);
             $actions->setListTitle($this->pl->txt('actions'));
         } else {
             $actions = '&nbsp;';
         }
         $this->tpl->setCurrentBlock('ACTIONS');
         $this->tpl->setVariable('ACTIONS', is_string($actions) ? $actions : $actions->getHTML());
         $this->tpl->parseCurrentBlock();
     }
 }
コード例 #14
0
 /**
  * Constructor
  * @access	public
  */
 function ilObjectStatusGUI(&$a_obj)
 {
     global $ilUser, $ilCtrl, $ilias, $ilErr, $lng, $rbacreview;
     $this->ctrl =& $ilCtrl;
     $this->object =& $a_obj;
     $this->tpl = new ilTemplate("tpl.info_layout.html", false, false, "Services/AccessControl");
     $this->tpl->setVariable("INFO_REMARK_INTERRUPTED", $lng->txt('info_remark_interrupted'));
     if (empty($_POST['Fuserid'])) {
         $this->user =& $ilUser;
     } else {
         if ($_POST['Fselect_type'] == "id") {
             $this->user = $ilias->obj_factory->getInstanceByObjId($_POST['Fuserid'], false);
         } else {
             include_once 'Services/User/classes/class.ilObjUser.php';
             $user_id = ilObjUser::_lookupId($_POST['Fuserid']);
             $this->user = $ilias->obj_factory->getInstanceByObjId($user_id, false);
         }
         if ($this->user === false or $this->user->getType() != 'usr') {
             $this->user =& $ilUser;
             ilUtil::sendFailure($lng->txt('info_err_user_not_exist'));
         } else {
             ilUtil::sendInfo($lng->txt('info_user_view_changed'));
         }
     }
     // get all user roles and all valid roles in scope
     $this->user_roles = $rbacreview->assignedRoles($this->user->getId());
     $this->global_roles = $rbacreview->getGlobalRoles();
     $this->valid_roles = $rbacreview->getParentRoleIds($this->object->getRefId());
     $this->assigned_valid_roles = $this->getAssignedValidRoles();
     $this->getPermissionInfo();
     $this->getRoleAssignmentInfo();
     $this->getObjectSummary();
 }
コード例 #15
0
 public function send()
 {
     switch ($this->getType()) {
         case self::TYPE_NOTIFICATION_ACTIVATION:
             $additional_information = $this->getAdditionalInformation();
             /**
              * @var $user ilObjUser
              */
             $user = $additional_information['usr'];
             foreach ($this->getRecipients() as $rcp) {
                 try {
                     $this->handleCurrentRecipient($rcp);
                 } catch (ilMailException $e) {
                     continue;
                 }
                 $this->initMimeMail();
                 $this->setSubject($this->getLanguage()->txt('reg_mail_subject_confirmation'));
                 $this->setBody($this->getLanguage()->txt('reg_mail_body_salutation') . ' ' . $user->getFullname() . ',');
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguage()->txt('reg_mail_body_confirmation'));
                 $this->appendBody("\n");
                 $this->appendBody(ILIAS_HTTP_PATH . '/confirmReg.php?client_id=' . CLIENT_ID . '&rh=' . ilObjUser::_generateRegistrationHash($user->getId()));
                 $this->appendBody("\n\n");
                 $this->appendBody(sprintf($this->getLanguage()->txt('reg_mail_body_2_confirmation'), ilFormat::_secondsToString($additional_information['hash_lifetime'])));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguage()->txt('reg_mail_body_3_confirmation'));
                 $this->appendBody(ilMail::_getInstallationSignature());
                 $this->sendMimeMail($this->getCurrentRecipient());
             }
             break;
     }
 }
コード例 #16
0
 /**
  * Get all completed tests
  */
 protected function getItems()
 {
     $data = array();
     foreach (ilExAssignment::getTeamLog($this->team_id) as $item) {
         switch ($item["action"]) {
             case ilExAssignment::TEAM_LOG_CREATE_TEAM:
                 $mess = "create_team";
                 break;
             case ilExAssignment::TEAM_LOG_ADD_MEMBER:
                 $mess = "add_member";
                 break;
             case ilExAssignment::TEAM_LOG_REMOVE_MEMBER:
                 $mess = "remove_member";
                 break;
             case ilExAssignment::TEAM_LOG_ADD_FILE:
                 $mess = "add_file";
                 break;
             case ilExAssignment::TEAM_LOG_REMOVE_FILE:
                 $mess = "remove_file";
                 break;
         }
         $details = $this->lng->txt("exc_team_log_" . $mess);
         if ($item["details"]) {
             $details = sprintf($details, $item["details"]);
         }
         $data[] = array("tstamp" => $item["tstamp"], "user" => ilObjUser::_lookupFullname($item["user_id"]), "details" => $details);
     }
     $this->setData($data);
 }
コード例 #17
0
 protected function setRowForUser(&$set, $user_id)
 {
     $user = new ilObjUser($user_id);
     $set["first_name"] = $user->getFirstname();
     $set["last_name"] = $user->getLastname();
     $set["user_object"] = $user;
     $set["user_id"] = $user_id;
 }
コード例 #18
0
 /**
  * Replace owner callback (preg_replace_callback)
  */
 protected function replaceOwnerCallback($matches)
 {
     if (isset($matches[2])) {
         if ($usr_id = ilObjUser::_loginExists($matches[2])) {
             return $matches[1] . $usr_id;
         }
     }
     return $matches[0];
 }
コード例 #19
0
 /**
  * @param ilObjUser                        $user
  * @param ilTermsOfServiceSignableDocument $document
  */
 public static function trackAcceptance(ilObjUser $user, ilTermsOfServiceSignableDocument $document)
 {
     if (self::isEnabled()) {
         $entity = self::getEntityFactory()->getByName('ilTermsOfServiceAcceptanceEntity');
         $data_gateway = self::getDataGatewayFactory()->getByName('ilTermsOfServiceAcceptanceDatabaseGateway');
         $entity->setUserId($user->getId());
         $entity->setTimestamp(time());
         $entity->setIso2LanguageCode($document->getIso2LanguageCode());
         $entity->setSource($document->getSource());
         $entity->setSourceType($document->getSourceType());
         $entity->setText($document->getContent());
         $entity->setHash(md5($document->getContent()));
         $data_gateway->trackAcceptance($entity);
         $user->writeAccepted();
         // <- Has to be refactored in future releases
         $user->hasToAcceptTermsOfServiceInSession(false);
     }
 }
コード例 #20
0
 public function preload()
 {
     global $objDefinition, $tree, $ilObjDataCache, $ilUser, $rbacsystem;
     if (!$this->obj_ids) {
         return;
     }
     $this->obj_ids = array_unique($this->obj_ids);
     $this->types = array_unique($this->types);
     if ($this->ref_ids) {
         $this->ref_ids = array_unique($this->ref_ids);
     }
     // type specific preloads
     include_once "./Services/AccessControl/classes/class.ilConditionHandler.php";
     foreach ($this->types as $type) {
         $this->obj_ids_by_type[$type] = array_unique($this->obj_ids_by_type[$type]);
         if (is_array($this->ref_ids_by_type[$type])) {
             $this->ref_ids_by_type[$type] = array_unique($this->ref_ids_by_type[$type]);
         }
         if ($this->context == ilObjectListGUI::CONTEXT_REPOSITORY || $this->context == ilObjectListGUI::CONTEXT_PERSONAL_DESKTOP || $this->context == ilObjectListGUI::CONTEXT_SEARCH) {
             ilConditionHandler::preloadConditionsForTargetRecords($type, $this->obj_ids_by_type[$type]);
         }
         $class = $objDefinition->getClassName($type);
         $location = $objDefinition->getLocation($type);
         if ($class && $location) {
             $full_class = "ilObj" . $class . "Access";
             include_once $location . "/class." . $full_class . ".php";
             if (class_exists($full_class)) {
                 call_user_func(array($full_class, "_preloadData"), $this->obj_ids_by_type[$type], $this->ref_ids_by_type[$type]);
             }
         }
     }
     if ($this->ref_ids) {
         $tree->preloadDeleted($this->ref_ids);
         $tree->preloadDepthParent($this->ref_ids);
         $ilObjDataCache->preloadReferenceCache($this->ref_ids, false);
         $rbacsystem->preloadRbacPaCache($this->ref_ids, $ilUser->getId());
         if ($ilUser->getId != ANONYMOUS_USER_ID && $this->context != ilObjectListGUI::CONTEXT_PERSONAL_DESKTOP) {
             ilObjUser::preloadIsDesktopItem($ilUser->getId(), $this->ref_ids);
         }
         include_once "./Services/Object/classes/class.ilObjectActivation.php";
         ilObjectActivation::preloadData($this->ref_ids);
     }
     include_once "./Services/Object/classes/class.ilObjectListGUI.php";
     ilObjectListGUI::preloadCommonProperties($this->obj_ids, $this->context);
     if ($this->context == ilObjectListGUI::CONTEXT_REPOSITORY) {
         include_once "./Services/Rating/classes/class.ilRating.php";
         include_once "./Services/Rating/classes/class.ilRatingGUI.php";
         ilRating::preloadListGUIData($this->obj_ids);
         include_once "./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php";
         ilAdvancedMDValues::preloadByObjIds($this->obj_ids);
     }
     if ($this->context == ilObjectListGUI::CONTEXT_REPOSITORY || $this->context == ilObjectListGUI::CONTEXT_PERSONAL_DESKTOP || $this->context == ilObjectListGUI::CONTEXT_SEARCH) {
         include_once "./Services/Tracking/classes/class.ilLPStatus.php";
         ilLPStatus::preloadListGUIData($this->obj_ids);
     }
 }
コード例 #21
0
 /**
  * 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
 }
コード例 #22
0
 /**
  * Standard Version of Fill Row. Most likely to
  * be overwritten by derived class.
  */
 protected function fillRow($a_set)
 {
     global $ilCtrl;
     include_once "./Services/User/classes/class.ilObjUser.php";
     $user = ilObjUser::_lookupFields($a_set);
     $ilCtrl->setParameterByClass("ilObjSurveyAdministrationGUI", "item_id", $user["usr_id"]);
     $this->tpl->setVariable("USER_ID", $user["usr_id"]);
     $this->tpl->setVariable("LOGIN", $user["login"]);
     $this->tpl->setVariable("FIRSTNAME", $user["firstname"]);
     $this->tpl->setVariable("LASTNAME", $user["lastname"]);
 }
コード例 #23
0
 /**
  * Init table
  */
 protected function initTable()
 {
     global $ilCtrl;
     $this->setFormAction($ilCtrl->getFormAction($this->getParentObject()));
     $this->setRowTemplate('tpl.scorm_track_item.html', 'Modules/ScormAicc');
     $this->setTitle(ilObjUser::_lookupFullname($this->getUserId()));
     $this->addColumn($this->lng->txt('title'), 'title', '35%');
     $this->addColumn($this->lng->txt('cont_status'), 'status', '25%');
     $this->addColumn($this->lng->txt('cont_time'), 'time', '20%');
     $this->addColumn($this->lng->txt('cont_score'), 'score', '20%');
 }
コード例 #24
0
 function _getUserData($a_filter)
 {
     include_once './Services/User/classes/class.ilObjUser.php';
     $users_data = ilObjUser::_getAllUserData(array("login", "firstname", "lastname", "time_limit_owner"), -1);
     foreach ($users_data as $usr_data) {
         if (!$a_filter or $a_filter == $usr_data['time_limit_owner']) {
             $users[] = $usr_data;
         }
     }
     return $users ? $users : array();
 }
コード例 #25
0
 public static function replaceBillingMailPlaceholders($a_message, $a_user_id)
 {
     global $lng;
     $user = new ilObjUser($a_user_id);
     // determine salutation
     switch ($user->getGender()) {
         case 'f':
             $gender_salut = $lng->txt('salutation_f');
             break;
         case 'm':
             $gender_salut = $lng->txt('salutation_m');
             break;
     }
     $a_message = str_replace('[MAIL_SALUTATION]', $gender_salut, $a_message);
     $a_message = str_replace('[LOGIN]', $user->getLogin(), $a_message);
     $a_message = str_replace('[FIRST_NAME]', $user->getFirstname(), $a_message);
     $a_message = str_replace('[LAST_NAME]', $user->getLastname(), $a_message);
     $a_message = str_replace('[ILIAS_URL]', ILIAS_HTTP_PATH . '/login.php?client_id=' . CLIENT_ID, $a_message);
     $a_message = str_replace('[CLIENT_NAME]', CLIENT_NAME, $a_message);
     include_once './Services/Payment/classes/class.ilShopLinkBuilder.php';
     $shopLB = new ilShopLinkBuilder();
     $bought_objects_url = $shopLB->buildLink('ilShopBoughtObjectsGUI');
     $shop_url = $shopLB->buildLink('ilShopGUI');
     $a_message = str_replace('[SHOP_BOUGHT_OBJECTS_URL]', $bought_objects_url, $a_message);
     $a_message = str_replace('[SHOP_URL]', $shop_url, $a_message);
     unset($user);
     return $a_message;
 }
コード例 #26
0
    /**
     * 
     * Send notifications	 
     *  
     * @access	public
     *  
     */
    public function send()
    {
        global $ilDB;
        // parent::send();
        if (count($this->getRecipients())) {
            $res = $ilDB->queryf("SELECT u.usr_id,u.gender,u.firstname,u.lastname,u.login,u.email,u.last_login,u.active," . "u.time_limit_unlimited, " . $ilDB->fromUnixtime("u.time_limit_from") . ", " . $ilDB->fromUnixtime("u.time_limit_until") . "," . "CASE WHEN u.active = 0 THEN '0001-01-01' ELSE CASE WHEN u.time_limit_unlimited=1 THEN '9999-12-31' ELSE " . $ilDB->fromUnixtime("u.time_limit_until") . " END END access_until," . " CASE WHEN " . $ilDB->unixTimestamp() . " BETWEEN u.time_limit_from AND u.time_limit_until THEN 0 ELSE 1 END expired," . "rq.role_disk_quota, system_role.rol_id role_id, " . "p1.value+0 user_disk_quota," . "p2.value+0 disk_usage, " . "p3.value last_update, " . "p5.value language, " . "CASE WHEN rq.role_disk_quota>p1.value+0 OR p1.value IS NULL THEN rq.role_disk_quota ELSE p1.value+0 END disk_quota\t" . "FROM usr_data u  " . "JOIN (SELECT u.usr_id usr_id,MAX(rd.disk_quota) role_disk_quota " . "FROM usr_data u " . "JOIN rbac_ua ua ON ua.usr_id=u.usr_id " . "JOIN rbac_fa fa ON fa.rol_id=ua.rol_id AND fa.parent=%s  " . "JOIN role_data rd ON rd.role_id=ua.rol_id WHERE u.usr_id=ua.usr_id GROUP BY u.usr_id) rq ON rq.usr_id=u.usr_id " . "LEFT JOIN rbac_ua system_role ON system_role.usr_id=u.usr_id AND system_role.rol_id = %s " . "LEFT JOIN usr_pref p1 ON p1.usr_id=u.usr_id AND p1.keyword = 'disk_quota'  " . "LEFT JOIN usr_pref p2 ON p2.usr_id=u.usr_id AND p2.keyword = 'disk_usage'  " . "LEFT JOIN usr_pref p3 ON p3.usr_id=u.usr_id AND p3.keyword = 'disk_usage.last_update'  " . "LEFT JOIN usr_pref p5 ON p5.usr_id=u.usr_id AND p5.keyword = 'language'  " . 'WHERE (((p1.value+0 > rq.role_disk_quota OR rq.role_disk_quota IS NULL) AND p2.value+0 > p1.value+0) OR 
					((rq.role_disk_quota > p1.value+0 OR p1.value IS NULL) AND p2.value+0 > rq.role_disk_quota)) ' . 'AND (u.active=1 AND (u.time_limit_unlimited = 1 OR ' . $ilDB->unixTimestamp() . ' BETWEEN u.time_limit_from AND u.time_limit_until)) ', array('integer', 'integer'), array(ROLE_FOLDER_ID, SYSTEM_ROLE_ID));
            $users = array();
            $counter = 0;
            while ($row = $ilDB->fetchAssoc($res)) {
                $details = ilDiskQuotaChecker::_lookupDiskUsage($row['usr_id']);
                $users[$counter]['disk_quota'] = $row['disk_quota'];
                $users[$counter]['disk_usage'] = $details['disk_usage'];
                $users[$counter]['email'] = $row['email'];
                $users[$counter]['firstname'] = $row['firstname'];
                $users[$counter]['lastname'] = $row['lastname'];
                ++$counter;
            }
            if (count($users)) {
                foreach ($this->getRecipients() as $rcp) {
                    $usrId = ilObjUser::_lookupId($rcp);
                    $this->initLanguage($usrId);
                    $this->initMail();
                    $this->setSubject($this->getLanguage()->txt('disk_quota_summary_subject'));
                    $this->setBody(ilMail::getSalutation($usrId, $this->getLanguage()));
                    $this->appendBody("\n\n");
                    $this->appendBody($this->getLanguage()->txt('disk_quota_exceeded_headline'));
                    $this->appendBody("\n\n");
                    $first = true;
                    $counter = 0;
                    $numUsers = count($users);
                    foreach ($users as $user) {
                        if (!$first) {
                            $this->appendBody("\n---------------------------------------------------\n\n");
                        }
                        $this->appendBody($this->getLanguage()->txt('fullname') . ': ' . $user['lastname'] . ', ' . $user['firstname'] . "\n");
                        $this->appendBody($this->getLanguage()->txt('email') . ': ' . $user['email'] . "\n");
                        $this->appendBody($this->getLanguage()->txt('disk_quota') . ': ' . ilFormat::formatSize($user['disk_quota'], 'short', $this->getLanguage()) . "\n");
                        $this->appendBody($this->getLanguage()->txt('currently_used_disk_space') . ': ' . ilFormat::formatSize($user['disk_usage'], 'short', $this->getLanguage()) . "\n");
                        $this->appendBody($this->getLanguage()->txt('usrf_profile_link') . ': ' . ilUtil::_getHttpPath() . '/goto.php?target=usrf&client_id=' . CLIENT_ID);
                        if ($counter < $numUsers - 1) {
                            $this->appendBody("\n");
                        }
                        ++$counter;
                        $first = false;
                    }
                    $this->getMail()->appendInstallationSignature(true);
                    $this->sendMail(array($rcp), array('system'), false);
                }
            }
        }
    }
コード例 #27
0
 public function run()
 {
     global $rbacreview, $ilLog;
     $status = ilCronJobResult::STATUS_NO_ACTION;
     $reminder_time = (int) $this->reminderTimer;
     $checkMail = (int) $this->period - $reminder_time;
     $usr_ids = ilObjUser::_getUserIdsByInactivityPeriod($checkMail);
     $counter = 0;
     $userDeleted = 0;
     $userMailsDelivered = 0;
     foreach ($usr_ids as $usr_id) {
         if ($usr_id == ANONYMOUS_USER_ID || $usr_id == SYSTEM_USER_ID) {
             continue;
         }
         $continue = true;
         foreach ($this->include_roles as $role_id) {
             if ($rbacreview->isAssigned($usr_id, $role_id)) {
                 $continue = false;
                 break;
             }
         }
         if ($continue) {
             continue;
         }
         /**
          * @var $user ilObjUser
          */
         $user = ilObjectFactory::getInstanceByObjId($usr_id);
         $last_login_timestamp = strtotime($user->getLastLogin());
         $grace_period_over = time() - (int) $this->period * 24 * 60 * 60;
         if ($last_login_timestamp < $grace_period_over) {
             $user->delete();
             $userDeleted++;
         } else {
             if ($reminder_time > 0) {
                 $mailSent = ilCronDeleteInactiveUserReminderMail::checkIfReminderMailShouldBeSend($user, $reminder_time);
                 if ($mailSent) {
                     $userMailsDelivered++;
                 }
             }
         }
         $counter++;
     }
     if ($counter) {
         $status = ilCronJobResult::STATUS_OK;
     }
     ilCronDeleteInactiveUserReminderMail::removeEntriesFromTableIfLastLoginIsNewer();
     $ilLog->write("CRON - ilCronDeleteInactiveUserAccounts::run(), deleted => {$userDeleted} User(s), sent reminder mail to {$userMailsDelivered} User(s)");
     $result = new ilCronJobResult();
     $result->setStatus($status);
     return $result;
 }
コード例 #28
0
 /**
  * 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"));
     }
 }
コード例 #29
0
 private function showConfirmation(ilPropertyFormGUI $form, $oldQuestionSetType, $newQuestionSetType, $hasQuestionsWithoutQuestionpool)
 {
     require_once 'Modules/Test/classes/confirmations/class.ilTestSettingsChangeConfirmationGUI.php';
     $confirmation = new ilTestSettingsChangeConfirmationGUI($this->lng, $this->testOBJ);
     $confirmation->setFormAction($this->ctrl->getFormAction($this));
     $confirmation->setCancel($this->lng->txt('cancel'), self::CMD_SHOW_FORM);
     $confirmation->setConfirm($this->lng->txt('confirm'), self::CMD_CONFIRMED_SAVE_FORM);
     $confirmation->setOldQuestionSetType($oldQuestionSetType);
     $confirmation->setNewQuestionSetType($newQuestionSetType);
     $confirmation->setQuestionLossInfoEnabled($hasQuestionsWithoutQuestionpool);
     $confirmation->build();
     $confirmation->populateParametersFromPropertyForm($form, $this->activeUser->getTimeZone());
     $this->tpl->setContent($this->ctrl->getHTML($confirmation));
 }
コード例 #30
0
 /**
  * Update title and description for the default language of translation
  */
 protected function updateTranslation()
 {
     $translations = $this->obj_orgu->getTranslations();
     $lang_code_default = '';
     $lang_codes = array();
     foreach ($translations['Fobject'] as $translation) {
         if ($translation['lang_default']) {
             $lang_code_default = $translation['lang'];
         }
         $lang_codes[] = $translation['lang'];
     }
     $lang_code = in_array($this->user->getLanguage(), $lang_codes) ? $this->user->getLanguage() : $lang_code_default;
     $this->obj_orgu->updateTranslation($this->getInput('title'), $this->getInput('description'), $lang_code, 0);
 }