当前位置: 首页>>代码示例>>PHP>>正文


PHP ilFormat::formatSize方法代码示例

本文整理汇总了PHP中ilFormat::formatSize方法的典型用法代码示例。如果您正苦于以下问题:PHP ilFormat::formatSize方法的具体用法?PHP ilFormat::formatSize怎么用?PHP ilFormat::formatSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ilFormat的用法示例。


在下文中一共展示了ilFormat::formatSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: formatValue

 /**
  * @param string $column
  * @param string $value
  * @return string
  */
 protected function formatValue($column, $value)
 {
     switch ($column) {
         case 'filecreatedate':
             return ilDatePresentation::formatDate(new ilDateTime($value, IL_CAL_UNIX));
         case 'filesize':
             return ilFormat::formatSize($value);
         default:
             return $value;
     }
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:16,代码来源:class.ilMailAttachmentTableGUI.php

示例2: send

    /**
     * 
     * 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);
                }
            }
        }
    }
开发者ID:arlendotcn,项目名称:ilias,代码行数:59,代码来源:class.ilDiskQuotaSummaryNotification.php

示例3: showForm


//.........这里部分代码省略.........
                     $mailData[$key] = ilUtil::securePlainString($value);
                 }
             }
             break;
     }
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     $form_gui = new ilPropertyFormGUI();
     $form_gui->setTitle($this->lng->txt('compose'));
     $form_gui->setOpenTag(false);
     $this->tpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this, 'sendMessage'));
     $this->tpl->setVariable('BUTTON_TO', $lng->txt("search_recipients"));
     $this->tpl->setVariable('BUTTON_COURSES_TO', $lng->txt("mail_my_courses"));
     $this->tpl->setVariable('BUTTON_GROUPS_TO', $lng->txt("mail_my_groups"));
     $this->tpl->setVariable('BUTTON_MAILING_LISTS_TO', $lng->txt("mail_my_mailing_lists"));
     $dsDataLink = $ilCtrl->getLinkTarget($this, 'lookupRecipientAsync', '', true);
     // RECIPIENT
     $inp = new ilTextInputGUI($this->lng->txt('mail_to'), 'rcp_to');
     $inp->setRequired(true);
     $inp->setSize(50);
     $inp->setValue($mailData["rcp_to"]);
     $inp->setDataSource($dsDataLink, ",");
     $inp->setMaxLength(null);
     $form_gui->addItem($inp);
     // CC
     $inp = new ilTextInputGUI($this->lng->txt('cc'), 'rcp_cc');
     $inp->setSize(50);
     $inp->setValue($mailData["rcp_cc"]);
     $inp->setDataSource($dsDataLink, ",");
     $inp->setMaxLength(null);
     $form_gui->addItem($inp);
     // BCC
     $inp = new ilTextInputGUI($this->lng->txt('bc'), 'rcp_bcc');
     $inp->setSize(50);
     $inp->setValue($mailData["rcp_bcc"]);
     $inp->setDataSource($dsDataLink, ",");
     $inp->setMaxLength(null);
     $form_gui->addItem($inp);
     // SUBJECT
     $inp = new ilTextInputGUI($this->lng->txt('subject'), 'm_subject');
     $inp->setSize(50);
     $inp->setRequired(true);
     $inp->setValue($mailData["m_subject"]);
     $form_gui->addItem($inp);
     // Attachments
     include_once 'Services/Mail/classes/class.ilMailFormAttachmentFormPropertyGUI.php';
     $att = new ilMailFormAttachmentPropertyGUI($this->lng->txt($mailData["attachments"] ? 'edit' : 'add'));
     if (is_array($mailData["attachments"]) && count($mailData["attachments"])) {
         foreach ($mailData["attachments"] as $data) {
             if (is_file($this->mfile->getMailPath() . '/' . $ilUser->getId() . "_" . $data)) {
                 $hidden = new ilHiddenInputGUI('attachments[]');
                 $form_gui->addItem($hidden);
                 $size = filesize($this->mfile->getMailPath() . '/' . $ilUser->getId() . "_" . $data);
                 $label = $data . " [" . ilFormat::formatSize($size) . "]";
                 $att->addItem($label);
                 $hidden->setValue(urlencode($data));
             }
         }
     }
     $form_gui->addItem($att);
     // ONLY IF SYSTEM MAILS ARE ALLOWED
     if ($rbacsystem->checkAccess("system_message", $this->umail->getMailObjectReferenceId())) {
         $chb = new ilCheckboxInputGUI($this->lng->txt('type'), 'm_type[]');
         $chb->setOptionTitle($this->lng->txt('system_message'));
         $chb->setValue('system');
         $chb->setChecked(false);
         if (is_array($mailData["m_type"]) and in_array('system', $mailData["m_type"])) {
             $chb->setChecked(true);
         }
         $form_gui->addItem($chb);
     }
     // MESSAGE
     $inp = new ilTextAreaInputGUI($this->lng->txt('message_content'), 'm_message');
     //$inp->setValue(htmlspecialchars($mailData["m_message"], false));
     $inp->setValue($mailData["m_message"]);
     $inp->setRequired(false);
     $inp->setCols(60);
     $inp->setRows(10);
     // PLACEHOLDERS
     $chb = new ilCheckboxInputGUI($this->lng->txt('activate_serial_letter_placeholders'), 'use_placeholders');
     $chb->setOptionTitle($this->lng->txt('activate_serial_letter_placeholders'));
     $chb->setValue(1);
     $chb->setChecked(false);
     $form_gui->addItem($inp);
     include_once 'Services/Mail/classes/class.ilMailFormPlaceholdersPropertyGUI.php';
     $prop = new ilMailFormPlaceholdersPropertyGUI();
     $chb->addSubItem($prop);
     if ($mailData['use_placeholders']) {
         $chb->setChecked(true);
     }
     $form_gui->addItem($chb);
     $form_gui->addCommandButton('sendMessage', $this->lng->txt('send_mail'));
     $form_gui->addCommandButton('saveDraft', $this->lng->txt('save_message'));
     if (ilMailFormCall::isRefererStored()) {
         $form_gui->addCommandButton('cancelMail', $this->lng->txt('cancel'));
     }
     $this->tpl->parseCurrentBlock();
     $this->tpl->setVariable('FORM', $form_gui->getHTML());
     $this->tpl->addJavaScript('Services/Mail/js/ilMailComposeFunctions.js');
     $this->tpl->show();
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:101,代码来源:class.ilMailFormGUI.php

示例4: fillRow

 /**
  * Standard Version of Fill Row. Most likely to
  * be overwritten by derived class.
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl, $ilAccess;
     $hist_id = $a_set["hist_entry_id"];
     // split params
     $filename = $a_set["filename"];
     $version = $a_set["version"];
     $rollback_version = $a_set["rollback_version"];
     $rollback_user_id = $a_set["rollback_user_id"];
     // get user name
     $name = ilObjUser::_lookupName($a_set["user_id"]);
     $username = trim($name["title"] . " " . $name["firstname"] . " " . $name["lastname"]);
     // get file size
     $filepath = $this->parent_obj->object->getDirectory($version) . "/" . $filename;
     $filesize = filesize($filepath);
     // get action text
     $action = $lng->txt("file_version_" . $a_set["action"]);
     // create, replace, new_version, rollback
     if ($a_set["action"] == "rollback") {
         $name = ilObjUser::_lookupName($rollback_user_id);
         $rollback_username = trim($name["title"] . " " . $name["firstname"] . " " . $name["lastname"]);
         $action = sprintf($action, $rollback_version, $rollback_username);
     }
     // get download link
     $ilCtrl->setParameter($this->parent_obj, "hist_id", $hist_id);
     $link = $ilCtrl->getLinkTarget($this->parent_obj, "sendfile");
     // build actions
     include_once "Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
     $actions = new ilAdvancedSelectionListGUI();
     $actions->setId($hist_id);
     $actions->setListTitle($lng->txt("actions"));
     $actions->addItem($lng->txt("delete"), "", $ilCtrl->getLinkTarget($this->parent_obj, "deleteVersions"));
     if ($this->current_version != $version) {
         $actions->addItem($lng->txt("file_rollback"), "", $ilCtrl->getLinkTarget($this->parent_obj, "rollbackVersion"));
     }
     // reset history parameter
     $ilCtrl->setParameter($this->parent_obj, "hist_id", "");
     // fill template
     $this->tpl->setVariable("TXT_VERSION", $version);
     $this->tpl->setVariable("TXT_DATE", ilDatePresentation::formatDate(new ilDateTime($a_set['date'], IL_CAL_DATETIME)));
     $this->tpl->setVariable("TXT_UPLOADED_BY", $username);
     $this->tpl->setVariable("DL_LINK", $link);
     $this->tpl->setVariable("TXT_FILENAME", $filename);
     $this->tpl->setVariable("TXT_FILESIZE", ilFormat::formatSize($filesize));
     // columns depending on confirmation
     if (!$this->confirmDelete) {
         $this->tpl->setCurrentBlock("version_selection");
         $this->tpl->setVariable("OBJ_ID", $hist_id);
         $this->tpl->parseCurrentBlock();
         $this->tpl->setCurrentBlock("version_txt_actions");
         $this->tpl->setVariable("TXT_ACTION", $action);
         $this->tpl->parseCurrentBlock();
         $this->tpl->setCurrentBlock("version_actions");
         $this->tpl->setVariable("ACTIONS", $actions->getHTML());
         $this->tpl->parseCurrentBlock();
     } else {
         $this->tpl->setCurrentBlock("version_id");
         $this->tpl->setVariable("OBJ_ID", $hist_id);
         $this->tpl->parseCurrentBlock();
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:65,代码来源:class.ilFileVersionTableGUI.php

示例5: getStatusLegend

 public static function getStatusLegend()
 {
     global $ilUser, $lng;
     include_once "Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php";
     if (!ilDiskQuotaActivationChecker::_isPersonalWorkspaceActive()) {
         return;
     }
     include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
     $usage = ilDiskQuotaHandler::getFilesizeByOwner($ilUser->getId());
     include_once "Services/WebDAV/classes/class.ilDiskQuotaChecker.php";
     $quota = ilDiskQuotaChecker::_lookupPersonalWorkspaceDiskQuota($ilUser->getId());
     $quota = $quota["disk_quota"];
     // administrator
     if (is_infinite($quota) || !(int) $quota) {
         return;
     }
     $lng->loadLanguageModule("file");
     return sprintf($lng->txt("personal_workspace_quota_status_legend"), ilFormat::formatSize($usage), ilFormat::formatSize($quota), $quota ? round($usage / $quota * 100) : 0);
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:19,代码来源:class.ilDiskQuotaHandler.php

示例6: uploadFile

 public function uploadFile()
 {
     if (strlen(trim($_FILES['userfile']['name']))) {
         if ($this->mfile->storeUploadedFile($_FILES['userfile']) == 1) {
             ilUtil::sendFailure($this->lng->txt('mail_maxsize_attachment_error') . ' ' . ilFormat::formatSize($this->mfile->getUploadLimit()));
         }
     }
     $this->showAttachments();
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:9,代码来源:class.ilMailAttachmentGUI.php

示例7: getProperties

 /**
  * Get item properties
  *
  * @return	array		array of property arrays:
  *						"alert" (boolean) => display as an alert property (usually in red)
  *						"property" (string) => property name
  *						"value" (string) => property value
  */
 function getProperties()
 {
     global $lng, $ilUser;
     // BEGIN WebDAV: Get parent properties
     $props = parent::getProperties();
     // END WebDAV: Get parent properties
     // to do: implement extra smaller file info object
     include_once "./Modules/File/classes/class.ilObjFileAccess.php";
     // Display a warning if a file is not a hidden Unix file, and
     // the filename extension is missing
     if (!preg_match('/^\\.|\\.[a-zA-Z0-9]+$/', $this->title)) {
         $props[] = array("alert" => false, "property" => $lng->txt("filename_interoperability"), "value" => $lng->txt("filename_extension_missing"), 'propertyNameVisible' => false);
     }
     // BEGIN WebDAV: Only display relevant information.
     $props[] = array("alert" => false, "property" => $lng->txt("type"), "value" => ilObjFileAccess::_getFileExtension($this->title), 'propertyNameVisible' => false);
     $fileData = ilObjFileAccess::getListGUIData($this->obj_id);
     if (is_array($fileData)) {
         $props[] = array("alert" => false, "property" => $lng->txt("size"), "value" => ilFormat::formatSize($fileData['size'], 'short'), 'propertyNameVisible' => false);
         $version = $fileData['version'];
         if ($version > 1) {
             // add versions link
             if (parent::checkCommandAccess("write", "versions", $this->ref_id, $this->type)) {
                 $link = $this->getCommandLink("versions");
                 $value = "<a href=\"{$link}\">" . $lng->txt("version") . ": {$version}</a>";
             } else {
                 $value = $lng->txt("version") . ": {$version}";
             }
             $props[] = array("alert" => false, "property" => $lng->txt("version"), "value" => $value, "propertyNameVisible" => false);
         }
         // #6040
         if ($fileData["date"]) {
             $props[] = array("alert" => false, "property" => $lng->txt("last_update"), "value" => ilDatePresentation::formatDate(new ilDateTime($fileData["date"], IL_CAL_DATETIME)), 'propertyNameVisible' => false);
         }
     }
     // END WebDAV: Only display relevant information.
     return $props;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:45,代码来源:class.ilObjFileListGUI.php

示例8: outMobImageParams

function outMobImageParams()
{
    global $arr_tinyMCE_image_files;
    global $tpl;
    for ($k = 0; $k < count($arr_tinyMCE_image_files); $k++) {
        $tpl->setCurrentBlock('imageparams');
        $entry = $arr_tinyMCE_image_files[$k]['file_name'];
        $size = getimagesize($arr_tinyMCE_image_files[$k]['file_dir'] . $entry);
        $fsize = filesize($arr_tinyMCE_image_files[$k]['file_dir'] . $entry);
        $tpl->setVariable('IMG_WIDTH', $size[0]);
        $tpl->setVariable('IMG_HEIGHT', $size[1]);
        $tpl->setVariable('IMG_PATH', $arr_tinyMCE_image_files[$k]['http_dir']);
        $tpl->setVariable('F_SIZE', ilFormat::formatSize($fsize));
        $tpl->parseCurrentBlock();
    }
}
开发者ID:arlendotcn,项目名称:ilias,代码行数:16,代码来源:imagemanager.php

示例9: infoScreenForward

 /**
  * show information screen
  */
 function infoScreenForward()
 {
     global $ilTabs, $ilErr;
     $ilTabs->activateTab("id_info");
     if (!$this->checkPermissionBool("visible")) {
         $ilErr->raiseError($this->lng->txt("msg_no_perm_read"));
     }
     include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php";
     $info = new ilInfoScreenGUI($this);
     if ($this->checkPermissionBool("read", "sendfile")) {
         // 9876
         $this->lng->loadLanguageModule("file");
         $info->addButton($this->lng->txt("file_download"), $this->ctrl->getLinkTarget($this, "sendfile"));
     }
     $info->enablePrivateNotes();
     if ($this->checkPermissionBool("read")) {
         $info->enableNews();
     }
     // no news editing for files, just notifications
     $info->enableNewsEditing(false);
     if ($this->checkPermissionBool("write")) {
         $news_set = new ilSetting("news");
         $enable_internal_rss = $news_set->get("enable_rss_for_internal");
         if ($enable_internal_rss) {
             $info->setBlockProperty("news", "settings", true);
             $info->setBlockProperty("news", "public_notifications_option", true);
         }
     }
     // standard meta data
     $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
     $info->addSection($this->lng->txt("file_info"));
     $info->addProperty($this->lng->txt("filename"), $this->object->getFileName());
     // BEGIN WebDAV Guess file type.
     $info->addProperty($this->lng->txt("type"), $this->object->guessFileType());
     // END WebDAV Guess file type.
     $info->addProperty($this->lng->txt("size"), ilFormat::formatSize(ilObjFile::_lookupFileSize($this->object->getId()), 'long'));
     $info->addProperty($this->lng->txt("version"), $this->object->getVersion());
     include_once "./Services/History/classes/class.ilHistory.php";
     $uploader = ilHistory::_getEntriesForObject($this->object->getId(), $this->object->getType());
     $uploader = array_shift($uploader);
     $uploader = $uploader["user_id"];
     $this->lng->loadLanguageModule("file");
     include_once "Services/User/classes/class.ilUserUtil.php";
     $info->addProperty($this->lng->txt("file_uploaded_by"), ilUserUtil::getNamePresentation($uploader));
     if ($this->id_type == self::WORKSPACE_NODE_ID) {
         $info->addProperty($this->lng->txt("perma_link"), $this->getPermanentLinkWidget());
     }
     // forward the command
     // $this->ctrl->setCmd("showSummary");
     // $this->ctrl->setCmdClass("ilinfoscreengui");
     $this->ctrl->forwardCommand($info);
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:55,代码来源:class.ilObjFileGUI.php

示例10: showDownloadList

 /**
  * show download list
  */
 function showDownloadList()
 {
     if (!$this->lm->isActiveDownloads() || !$this->lm->isActiveLMMenu()) {
         return;
     }
     //$this->tpl = new ilTemplate("tpl.lm_toc.html", true, true, true);
     $this->tpl->setCurrentBlock("ContentStyle");
     if (!$this->offlineMode()) {
         $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId()));
     } else {
         $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content_style/content.css");
     }
     $this->tpl->parseCurrentBlock();
     $this->renderPageTitle();
     $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
     $this->tpl->getStandardTemplate();
     $this->tpl->setVariable("TABS", $this->lm_gui->setilLMMenu($this->offlineMode(), $this->getExportFormat(), "download", true));
     $this->ilLocator();
     //$this->tpl->stopTitleFloating();
     $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lm_download_list.html", "Modules/LearningModule");
     // set title header
     $this->tpl->setTitle($this->lm->getTitle());
     $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm.svg"));
     /*
     		$this->tpl->setVariable("TXT_BACK", $this->lng->txt("back"));
     		$this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
     		$this->tpl->setVariable("LINK_BACK",
     			$this->ctrl->getLinkTarget($this, "")); */
     // output copyright information
     include_once 'Services/MetaData/classes/class.ilMD.php';
     $md = new ilMD($this->lm->getId(), 0, $this->lm->getType());
     if (is_object($md_rights = $md->getRights())) {
         $copyright = $md_rights->getDescription();
         include_once 'Services/MetaData/classes/class.ilMDUtils.php';
         $copyright = ilMDUtils::_parseCopyright($copyright);
         if ($copyright != "") {
             $this->lng->loadLanguageModule("meta");
             $this->tpl->setCurrentBlock("copyright");
             $this->tpl->setVariable("TXT_COPYRIGHT", $this->lng->txt("meta_copyright"));
             $this->tpl->setVariable("LM_COPYRIGHT", $copyright);
             $this->tpl->parseCurrentBlock();
         }
     }
     // create table
     require_once "./Services/Table/classes/class.ilTableGUI.php";
     $tbl = new ilTableGUI();
     // load files templates
     $this->tpl->addBlockfile("DOWNLOAD_TABLE", "download_table", "tpl.table.html");
     // load template for table content data
     $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.download_file_row.html", "Modules/LearningModule");
     $export_files = array();
     $types = array("xml", "html", "scorm");
     foreach ($types as $type) {
         if ($this->lm->getPublicExportFile($type) != "") {
             if (is_file($this->lm->getExportDirectory($type) . "/" . $this->lm->getPublicExportFile($type))) {
                 $dir = $this->lm->getExportDirectory($type);
                 $size = filesize($this->lm->getExportDirectory($type) . "/" . $this->lm->getPublicExportFile($type));
                 $export_files[] = array("type" => $type, "file" => $this->lm->getPublicExportFile($type), "size" => $size);
             }
         }
     }
     $num = 0;
     $tbl->setTitle($this->lng->txt("download"));
     $tbl->setHeaderNames(array($this->lng->txt("cont_format"), $this->lng->txt("cont_file"), $this->lng->txt("size"), $this->lng->txt("date"), ""));
     $cols = array("format", "file", "size", "date", "download");
     $header_params = array("ref_id" => $_GET["ref_id"], "obj_id" => $_GET["obj_id"], "cmd" => "showDownloadList", "cmdClass" => strtolower(get_class($this)));
     $tbl->setHeaderVars($cols, $header_params);
     $tbl->setColumnWidth(array("10%", "30%", "20%", "20%", "20%"));
     $tbl->disable("sort");
     // control
     $tbl->setOrderColumn($_GET["sort_by"]);
     $tbl->setOrderDirection($_GET["sort_order"]);
     $tbl->setLimit($_GET["limit"]);
     $tbl->setOffset($_GET["offset"]);
     $tbl->setMaxCount($this->maxcount);
     // ???
     //$this->tpl->setVariable("COLUMN_COUNTS", 5);
     // footer
     //$tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
     $tbl->disable("footer");
     $tbl->setMaxCount(count($export_files));
     $export_files = array_slice($export_files, $_GET["offset"], $_GET["limit"]);
     if (count($export_files) > 0) {
         $tbl->render();
         $i = 0;
         foreach ($export_files as $exp_file) {
             if (!$exp_file["size"] > 0) {
                 continue;
             }
             $this->tpl->setCurrentBlock("tbl_content");
             $this->tpl->setVariable("TXT_FILENAME", $exp_file["file"]);
             $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2");
             $this->tpl->setVariable("CSS_ROW", $css_row);
             include_once "./Services/Utilities/classes/class.ilFormat.php";
             $this->tpl->setVariable("TXT_SIZE", ilFormat::formatSize($exp_file["size"]));
             $this->tpl->setVariable("TXT_FORMAT", strtoupper($exp_file["type"]));
             $this->tpl->setVariable("CHECKBOX_ID", $exp_file["type"] . ":" . $exp_file["file"]);
//.........这里部分代码省略.........
开发者ID:arlendotcn,项目名称:ilias,代码行数:101,代码来源:class.ilLMPresentationGUI.php

示例11: fillRow

 /**
  * fill row 
  *
  * @access public
  * @param
  * @return
  */
 public function fillRow($data)
 {
     if (!$this->confirmdelete) {
         $this->tpl->setCurrentBlock('checkbox');
         $this->tpl->setVariable('CB_ID', $this->counter);
         $this->tpl->setVariable("CB_FILE", $data['file']);
         $this->tpl->parseCurrentBlock();
     } else {
         $this->tpl->setCurrentBlock('hidden');
         $this->tpl->setVariable('HIDDEN_FILE', $data["file"]);
         $this->tpl->parseCurrentBlock();
     }
     $this->tpl->setVariable("ID", $this->counter++);
     $this->tpl->setVariable("FILE", $data['file']);
     $this->tpl->setVariable("SIZE", ilFormat::formatSize($data['size'], 'long'));
     $this->tpl->setVariable("DATE", ilDatePresentation::formatDate(new ilDateTime($data['date'], IL_CAL_UNIX)));
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:24,代码来源:class.ilTestExportTableGUI.php

示例12: getProperties

 /**
  * Get item properties
  *
  * @return	array		array of property arrays:
  *						"alert" (boolean) => display as an alert property (usually in red)
  *						"property" (string) => property name
  *						"value" (string) => property value
  */
 function getProperties()
 {
     global $lng, $ilUser;
     // BEGIN WebDAV: Get parent properties
     $props = parent::getProperties();
     // END WebDAV: Get parent properties
     // to do: implement extra smaller file info object
     include_once "./Modules/File/classes/class.ilObjFileAccess.php";
     // Display a warning if a file is not a hidden Unix file, and
     // the filename extension is missing
     if (!preg_match('/^\\.|\\.[a-zA-Z0-9]+$/', $this->title)) {
         $props[] = array("alert" => false, "property" => $lng->txt("filename_interoperability"), "value" => $lng->txt("filename_extension_missing"), 'propertyNameVisible' => false);
     }
     // BEGIN WebDAV: Only display relevant information.
     $props[] = array("alert" => false, "property" => $lng->txt("type"), "value" => ilObjFileAccess::_getFileExtension($this->title), 'propertyNameVisible' => false);
     $fileData = ilObjFileAccess::_lookupFileData($this->obj_id);
     $props[] = array("alert" => false, "property" => $lng->txt("size"), "value" => ilFormat::formatSize($fileData['file_size'], 'short'), 'propertyNameVisible' => false);
     $version = $fileData['version'];
     if ($version > 1) {
         $props[] = array("alert" => false, "property" => $lng->txt("version"), "value" => $version);
     }
     $props[] = array("alert" => false, "property" => $lng->txt("last_update"), "value" => ilObject::_lookupLastUpdate($this->obj_id, true), 'propertyNameVisible' => false);
     // END WebDAV: Only display relevant information.
     return $props;
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:33,代码来源:class.ilObjFileListGUI.php

示例13: uploadFile

 public function uploadFile()
 {
     /**
      * @var $lng ilLanguage
      */
     global $lng;
     if (strlen(trim($_FILES['userfile']['name']))) {
         $form = $this->getToolbarForm();
         if ($form->checkInput()) {
             $this->mfile->storeUploadedFile($_FILES['userfile']);
             ilUtil::sendSuccess($lng->txt('saved_successfully'));
         } else {
             if ($form->getItemByPostVar('userfile')->getAlert() != $lng->txt("form_msg_file_size_exceeds")) {
                 ilUtil::sendFailure($form->getItemByPostVar('userfile')->getAlert());
             } else {
                 ilUtil::sendFailure($this->lng->txt('mail_maxsize_attachment_error') . ' ' . ilFormat::formatSize($this->mfile->getUploadLimit()));
             }
         }
     } else {
         ilUtil::sendFailure($this->lng->txt('mail_select_one_file'));
     }
     $this->showAttachments();
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:23,代码来源:class.ilMailAttachmentGUI.php

示例14: infoScreenForward

 /**
  * show information screen
  */
 function infoScreenForward()
 {
     global $ilTabs, $ilErr, $ilToolbar;
     $ilTabs->activateTab("id_info");
     if (!$this->checkPermissionBool("visible")) {
         $ilErr->raiseError($this->lng->txt("msg_no_perm_read"));
     }
     include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php";
     $info = new ilInfoScreenGUI($this);
     if ($this->checkPermissionBool("read", "sendfile")) {
         // #9876
         $this->lng->loadLanguageModule("file");
         // #14378
         include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
         $button = ilLinkButton::getInstance();
         $button->setCaption("file_download");
         $button->setPrimary(true);
         // get permanent download link for repository
         if ($this->id_type == self::REPOSITORY_NODE_ID) {
             $button->setUrl(ilObjFileAccess::_getPermanentDownloadLink($this->node_id));
         } else {
             $button->setUrl($this->ctrl->getLinkTarget($this, "sendfile"));
         }
         $ilToolbar->addButtonInstance($button);
     }
     $info->enablePrivateNotes();
     if ($this->checkPermissionBool("read")) {
         $info->enableNews();
     }
     // no news editing for files, just notifications
     $info->enableNewsEditing(false);
     if ($this->checkPermissionBool("write")) {
         $news_set = new ilSetting("news");
         $enable_internal_rss = $news_set->get("enable_rss_for_internal");
         if ($enable_internal_rss) {
             $info->setBlockProperty("news", "settings", true);
             $info->setBlockProperty("news", "public_notifications_option", true);
         }
     }
     // standard meta data
     $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
     $info->addSection($this->lng->txt("file_info"));
     $info->addProperty($this->lng->txt("filename"), $this->object->getFileName());
     // BEGIN WebDAV Guess file type.
     $info->addProperty($this->lng->txt("type"), $this->object->guessFileType());
     // END WebDAV Guess file type.
     $info->addProperty($this->lng->txt("size"), ilFormat::formatSize(ilObjFile::_lookupFileSize($this->object->getId()), 'long'));
     $info->addProperty($this->lng->txt("version"), $this->object->getVersion());
     // using getVersions function instead of ilHistory direct
     $uploader = $this->object->getVersions();
     $uploader = array_shift($uploader);
     $uploader = $uploader["user_id"];
     $this->lng->loadLanguageModule("file");
     include_once "Services/User/classes/class.ilUserUtil.php";
     $info->addProperty($this->lng->txt("file_uploaded_by"), ilUserUtil::getNamePresentation($uploader));
     // download link added in repository
     if ($this->id_type == self::REPOSITORY_NODE_ID && $this->checkPermissionBool("read", "sendfile")) {
         $tpl = new ilTemplate("tpl.download_link.html", true, true, "Modules/File");
         $tpl->setVariable("LINK", ilObjFileAccess::_getPermanentDownloadLink($this->node_id));
         $info->addProperty($this->lng->txt("download_link"), $tpl->get());
     }
     if ($this->id_type == self::WORKSPACE_NODE_ID) {
         $info->addProperty($this->lng->txt("perma_link"), $this->getPermanentLinkWidget());
     }
     // display previews
     include_once "./Services/Preview/classes/class.ilPreview.php";
     if (!$this->ctrl->isAsynch() && ilPreview::hasPreview($this->object->getId(), $this->object->getType()) && $this->checkPermissionBool("read")) {
         include_once "./Services/Preview/classes/class.ilPreviewGUI.php";
         // get context for access checks later on
         $context;
         switch ($this->id_type) {
             case self::WORKSPACE_NODE_ID:
             case self::WORKSPACE_OBJECT_ID:
                 $context = ilPreviewGUI::CONTEXT_WORKSPACE;
                 break;
             default:
                 $context = ilPreviewGUI::CONTEXT_REPOSITORY;
                 break;
         }
         $preview = new ilPreviewGUI($this->node_id, $context, $this->object->getId(), $this->access_handler);
         $info->addProperty($this->lng->txt("preview"), $preview->getInlineHTML());
     }
     // forward the command
     // $this->ctrl->setCmd("showSummary");
     // $this->ctrl->setCmdClass("ilinfoscreengui");
     $this->ctrl->forwardCommand($info);
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:90,代码来源:class.ilObjFileGUI.php

示例15: initForm


//.........这里部分代码省略.........
     $radg->addOption($op2);
     //		$ac = new ilCheckboxInputGUI($lng->txt("time_limit"), "time_limit_unlimited");
     //		$ac->setChecked(true);
     //		$ac->setOptionTitle($lng->txt("crs_unlimited"));
     // access.from
     $acfrom = new ilDateTimeInputGUI($this->lng->txt("crs_from"), "time_limit_from");
     $acfrom->setShowTime(true);
     //		$ac->addSubItem($acfrom);
     $op2->addSubItem($acfrom);
     // access.to
     $acto = new ilDateTimeInputGUI($this->lng->txt("crs_to"), "time_limit_until");
     $acto->setShowTime(true);
     //		$ac->addSubItem($acto);
     $op2->addSubItem($acto);
     //		$this->form_gui->addItem($ac);
     $this->form_gui->addItem($radg);
     require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
     if (ilDiskQuotaActivationChecker::_isActive()) {
         $lng->loadLanguageModule("file");
         $quota_head = new ilFormSectionHeaderGUI();
         $quota_head->setTitle($lng->txt("repository_disk_quota"));
         $this->form_gui->addItem($quota_head);
         // disk quota
         $disk_quota = new ilTextInputGUI($lng->txt("disk_quota"), "disk_quota");
         $disk_quota->setSize(10);
         $disk_quota->setMaxLength(11);
         $disk_quota->setInfo($this->lng->txt("enter_in_mb_desc"));
         $this->form_gui->addItem($disk_quota);
         if ($a_mode == "edit") {
             // show which disk quota is in effect, and explain why
             require_once 'Services/WebDAV/classes/class.ilDiskQuotaChecker.php';
             $dq_info = ilDiskQuotaChecker::_lookupDiskQuota($this->object->getId());
             if ($dq_info['user_disk_quota'] > $dq_info['role_disk_quota']) {
                 $info_text = sprintf($lng->txt('disk_quota_is_1_instead_of_2_by_3'), ilFormat::formatSize($dq_info['user_disk_quota'], 'short'), ilFormat::formatSize($dq_info['role_disk_quota'], 'short'), $dq_info['role_title']);
             } else {
                 if (is_infinite($dq_info['role_disk_quota'])) {
                     $info_text = sprintf($lng->txt('disk_quota_is_unlimited_by_1'), $dq_info['role_title']);
                 } else {
                     $info_text = sprintf($lng->txt('disk_quota_is_1_by_2'), ilFormat::formatSize($dq_info['role_disk_quota'], 'short'), $dq_info['role_title']);
                 }
             }
             $disk_quota->setInfo($this->lng->txt("enter_in_mb_desc") . '<br>' . $info_text);
             // disk usage
             $du_info = ilDiskQuotaChecker::_lookupDiskUsage($this->object->getId());
             $disk_usage = new ilNonEditableValueGUI($lng->txt("disk_usage"), "disk_usage");
             if ($du_info['last_update'] === null) {
                 $disk_usage->setValue($lng->txt('unknown'));
             } else {
                 require_once './Services/Utilities/classes/class.ilFormat.php';
                 $disk_usage->setValue(ilFormat::formatSize($du_info['disk_usage'], 'short'));
                 $info = '<table class="il_user_quota_disk_usage_overview">';
                 // write the count and size of each object type
                 foreach ($du_info['details'] as $detail_data) {
                     $info .= '<tr>' . '<td class="std">' . $detail_data['count'] . '</td>' . '<td class="std">' . $lng->txt($detail_data['type']) . '</td>' . '<td class="std">' . ilFormat::formatSize($detail_data['size'], 'short') . '</td>' . '</tr>';
                 }
                 $info .= '</table>';
                 $info .= '<br>' . $this->lng->txt('last_update') . ': ' . ilDatePresentation::formatDate(new ilDateTime($du_info['last_update'], IL_CAL_DATETIME));
                 $disk_usage->setInfo($info);
             }
             $this->form_gui->addItem($disk_usage);
             // date when the last disk quota reminder was sent to the user
             if (true || $dq_info['last_reminder']) {
                 $reminder = new ilNonEditableValueGUI($lng->txt("disk_quota_last_reminder_sent"), "last_reminder");
                 $reminder->setValue(ilDatePresentation::formatDate(new ilDateTime($dq_info['last_reminder'], IL_CAL_DATETIME)));
                 $reminder->setInfo($this->lng->txt("disk_quota_last_reminder_sent_desc"));
                 $this->form_gui->addItem($reminder);
开发者ID:arlendotcn,项目名称:ilias,代码行数:67,代码来源:class.ilObjUserGUI.php


注:本文中的ilFormat::formatSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。