本文整理汇总了PHP中ilUtil类的典型用法代码示例。如果您正苦于以下问题:PHP ilUtil类的具体用法?PHP ilUtil怎么用?PHP ilUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ilUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getItems
/**
* Get user items
*/
function getItems()
{
global $lng, $rbacreview, $ilObjDataCache;
$this->determineOffsetAndOrder();
include_once "./Services/User/classes/class.ilAccountCode.php";
$codes_data = ilAccountCode::getCodesData(ilUtil::stripSlashes($this->getOrderField()), ilUtil::stripSlashes($this->getOrderDirection()), ilUtil::stripSlashes($this->getOffset()), ilUtil::stripSlashes($this->getLimit()), $this->filter["code"], $this->filter["valid_until"], $this->filter["generated"]);
if (count($codes_data["set"]) == 0 && $this->getOffset() > 0) {
$this->resetOffset();
$codes_data = ilAccountCode::getCodesData(ilUtil::stripSlashes($this->getOrderField()), ilUtil::stripSlashes($this->getOrderDirection()), ilUtil::stripSlashes($this->getOffset()), ilUtil::stripSlashes($this->getLimit()), $this->filter["code"], $this->filter["valid_until"], $this->filter["generated"]);
}
$result = array();
foreach ($codes_data["set"] as $k => $code) {
$result[$k]["generated"] = ilDatePresentation::formatDate(new ilDateTime($code["generated"], IL_CAL_UNIX));
if ($code["used"]) {
$result[$k]["used"] = ilDatePresentation::formatDate(new ilDateTime($code["used"], IL_CAL_UNIX));
} else {
$result[$k]["used"] = "";
}
if ($code["valid_until"] === "0") {
$valid = $lng->txt("user_account_code_valid_until_unlimited");
} else {
if (is_numeric($code["valid_until"])) {
$valid = $code["valid_until"] . " " . ($code["valid_until"] == 1 ? $lng->txt("day") : $lng->txt("days"));
} else {
$valid = ilDatePresentation::formatDate(new ilDate($code["valid_until"], IL_CAL_DATE));
}
}
$result[$k]["valid_until"] = $valid;
$result[$k]["code"] = $code["code"];
$result[$k]["code_id"] = $code["code_id"];
}
$this->setMaxCount($codes_data["cnt"]);
$this->setData($result);
}
示例2: saveSkillThresholdsCmd
private function saveSkillThresholdsCmd()
{
require_once 'Modules/Test/classes/class.ilTestSkillLevelThreshold.php';
if (is_array($_POST['threshold'])) {
$threshold = $_POST['threshold'];
$assignmentList = $this->buildSkillQuestionAssignmentList();
$assignmentList->loadFromDb();
foreach ($assignmentList->getUniqueAssignedSkills() as $data) {
$skill = $data['skill'];
$skillKey = $data['skill_base_id'] . ':' . $data['skill_tref_id'];
$levels = $skill->getLevelData();
foreach ($levels as $level) {
if (isset($threshold[$skillKey]) && isset($threshold[$skillKey][$level['id']])) {
$skillLevelThreshold = new ilTestSkillLevelThreshold($this->db);
$skillLevelThreshold->setTestId($this->testOBJ->getTestId());
$skillLevelThreshold->setSkillBaseId($data['skill_base_id']);
$skillLevelThreshold->setSkillTrefId($data['skill_tref_id']);
$skillLevelThreshold->setSkillLevelId($level['id']);
$skillLevelThreshold->setThreshold($threshold[$skillKey][$level['id']]);
$skillLevelThreshold->saveToDb();
}
}
}
}
ilUtil::sendSuccess($this->lng->txt('tst_msg_skl_lvl_thresholds_saved'), true);
$this->ctrl->redirect($this, self::CMD_SHOW_SKILL_THRESHOLDS);
}
示例3: buildExportFile
/**
* Build export file
*
* @param
* @return
*/
function buildExportFile()
{
global $ilias;
// create export file
include_once "./Services/Export/classes/class.ilExport.php";
ilExport::_createExportDirectory($this->wiki->getId(), "html", "wiki");
$exp_dir = ilExport::_getExportDirectory($this->wiki->getId(), "html", "wiki");
$this->subdir = $this->wiki->getType() . "_" . $this->wiki->getId();
$this->export_dir = $exp_dir . "/" . $this->subdir;
// initialize temporary target directory
ilUtil::delDir($this->export_dir);
ilUtil::makeDir($this->export_dir);
// system style html exporter
include_once "./Services/Style/classes/class.ilSystemStyleHTMLExport.php";
$this->sys_style_html_export = new ilSystemStyleHTMLExport($this->export_dir);
$this->sys_style_html_export->addImage("icon_wiki.svg");
$this->sys_style_html_export->export();
// init co page html exporter
include_once "./Services/COPage/classes/class.ilCOPageHTMLExport.php";
$this->co_page_html_export = new ilCOPageHTMLExport($this->export_dir);
$this->co_page_html_export->setContentStyleId($this->wiki->getStyleSheetId());
$this->co_page_html_export->createDirectories();
$this->co_page_html_export->exportStyles();
$this->co_page_html_export->exportSupportScripts();
// export pages
$this->exportHTMLPages();
// zip everything
if (true) {
// zip it all
$date = time();
$zip_file = ilExport::_getExportDirectory($this->wiki->getId(), "html", "wiki") . "/" . $date . "__" . IL_INST_ID . "__" . $this->wiki->getType() . "_" . $this->wiki->getId() . ".zip";
ilUtil::zip($this->export_dir, $zip_file);
ilUtil::delDir($this->export_dir);
}
}
示例4: testRbacUA
/**
* test rbac_ua
*/
public function testRbacUA()
{
global $rbacreview, $rbacadmin;
$obj = ilUtil::_getObjectsByOperations('crs', 'join');
$rbacreview->assignedUsers(4);
$rbacreview->assignedRoles(6);
}
示例5: doCreate
public function doCreate()
{
global $ilLog;
$message = "Standard fields cannot be written to DB";
ilUtil::sendFailure($message);
$ilLog->write("[ilDataCollectionStandardField] " . $message);
}
示例6: fillRow
/**
* Fill table row
*/
protected function fillRow($a_set)
{
global $lng, $ilCtrl, $ilUser;
include_once "./Services/Skill/classes/class.ilPersonalSkill.php";
$mat = ilPersonalSkill::getAssignedMaterial($ilUser->getId(), $this->tref_id, $a_set["id"]);
$ilCtrl->setParameter($this->parent_obj, "level_id", $a_set["id"]);
foreach ($mat as $m) {
$this->tpl->setCurrentBlock("mat");
$obj_id = $this->ws_tree->lookupObjectId($m["wsp_id"]);
$this->tpl->setVariable("MAT_TITLE", ilObject::_lookupTitle($obj_id));
$this->tpl->setVariable("MAT_IMG", ilUtil::img(ilUtil::getImagePath("icon_" . ilObject::_lookupType($obj_id) . ".svg")));
$this->tpl->setVariable("TXT_REMOVE", $lng->txt("remove"));
$ilCtrl->setParameter($this->parent_obj, "wsp_id", $m["wsp_id"]);
$this->tpl->setVariable("HREF_REMOVE", $ilCtrl->getLinkTarget($this->parent_obj, "removeMaterial"));
$obj_id = $this->ws_tree->lookupObjectId($m["wsp_id"]);
$url = $this->ws_access->getGotoLink($m["wsp_id"], $obj_id);
$this->tpl->setVariable("HREF_MAT", $url);
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock("cmd");
$this->tpl->setVariable("HREF_CMD", $ilCtrl->getLinkTarget($this->parent_obj, "assignMaterial"));
$this->tpl->setVariable("TXT_CMD", $lng->txt("skmg_assign_materials"));
$this->tpl->parseCurrentBlock();
$ilCtrl->setParameter($this->parent_obj, "level_id", "");
$this->tpl->setVariable("LEVEL_ID", $a_set["id"]);
$this->tpl->setVariable("SKILL_ID", $this->basic_skill_id);
$this->tpl->setVariable("TXT_SKILL", $a_set["title"]);
$this->tpl->setVariable("TXT_SKILL_DESC", $a_set["description"]);
}
示例7: fillRow
/**
* fill row
*
* @access public
* @param
* @return
*/
public function fillRow($data)
{
if (strlen($data['description'])) {
$this->tpl->setCurrentBlock('description');
$this->tpl->setVariable("DESCRIPTION", ilUtil::prepareFormOutput($data['description']));
$this->tpl->parseCurrentBlock();
}
if ($this->show_marker) {
if ($data['marked']) {
$this->tpl->setCurrentBlock('marked_img');
$this->tpl->setVariable("ALT_MARKED", $this->lng->txt("tst_question_marked"));
$this->tpl->setVariable("HREF_MARKED", ilUtil::getImagePath("marked.png"));
$this->tpl->parseCurrentBlock();
} else {
$this->tpl->touchBlock('marker');
}
}
// obligatory icon
if ($data["obligatory"]) {
$OBLIGATORY = "<img src=\"" . ilUtil::getImagePath("obligatory.gif", "Modules/Test") . "\" alt=\"" . $this->lng->txt("question_obligatory") . "\" title=\"" . $this->lng->txt("question_obligatory") . "\" />";
} else {
$OBLIGATORY = '';
}
$this->tpl->setVariable("QUESTION_OBLIGATORY", $OBLIGATORY);
$this->tpl->setVariable("ORDER", $data['order']);
$this->tpl->setVariable("TITLE", ilUtil::prepareFormOutput($data['title']));
$this->tpl->setVariable("HREF", $data['href']);
$this->tpl->setVariable("POSTPONED", $data['postponed']);
}
示例8: setTabs
function setTabs()
{
global $tpl, $lng;
parent::setTabs();
$tpl->setTitleIcon(ilUtil::getImagePath("icon_seqc_b.png"));
$tpl->setTitle($lng->txt("sahs_chapter") . ": " . $this->node_object->getTitle());
}
示例9: setTitleAndDescription
protected function setTitleAndDescription()
{
global $tpl, $lng;
$tpl->setTitle($lng->txt("wsp_personal_workspace"));
$tpl->setTitleIcon(ilUtil::getImagePath("icon_wsrt_b.png"), $title);
$tpl->setDescription($lng->txt("wsp_personal_workspace_description"));
}
示例10: handleCode
/**
* Handle target parameter
* @param object $a_target
* @return
*/
public static function handleCode($a_ref_id, $a_type, $a_code)
{
global $lng, $tree, $ilUser;
include_once './Services/Link/classes/class.ilLink.php';
$lng->loadLanguageModule($a_type);
try {
self::useCode($a_code, $a_ref_id);
$title = ilObject::_lookupTitle(ilObject::_lookupObjectId($a_ref_id));
ilUtil::sendSuccess(sprintf($lng->txt($a_type . "_admission_link_success_registration"), $title), true);
ilUtil::redirect(ilLink::_getLink($a_ref_id));
} catch (ilMembershipRegistrationException $e) {
switch ($e->getCode()) {
case 124:
//added to waiting list
ilUtil::sendSuccess($e->getMessage(), true);
break;
case 123:
//object is full
ilUtil::sendFailure($lng->txt($a_type . "_admission_link_failure_membership_limited"), true);
break;
case 789:
//out of registration period
ilUtil::sendFailure($lng->txt($a_type . "_admission_link_failure_registration_period"), true);
break;
default:
ilUtil::sendFailure($e->getMessage(), true);
break;
}
$GLOBALS['ilLog']->logStack();
$GLOBALS['ilLog']->write($e->getCode() . ': ' . $e->getMessage());
$parent_id = $tree->getParentId($a_ref_id);
ilUtil::redirect(ilLink::_getLink($parent_id));
}
}
示例11: setTabs
/**
* output tabs
*/
function setTabs()
{
global $ilTabs, $ilCtrl, $tpl, $lng;
// subelements
$ilTabs->addTarget("sahs_organization", $ilCtrl->getLinkTarget($this, 'showOrganization'), "showOrganization", get_class($this));
// questions
$ilTabs->addTarget("sahs_questions", $ilCtrl->getLinkTarget($this, 'sahs_questions'), "sahs_questions", get_class($this));
// resources
$ilTabs->addTarget("cont_files", $ilCtrl->getLinkTarget($this, 'sco_resources'), "sco_resources", get_class($this));
// metadata
$ilTabs->addTarget("meta_data", $ilCtrl->getLinkTargetByClass("ilmdeditorgui", ''), "", "ilmdeditorgui");
// export
/*
$ilTabs->addTarget("export",
$ilCtrl->getLinkTarget($this, "showExportList"), "showExportList",
get_class($this));
// import
$ilTabs->addTarget("import",
$ilCtrl->getLinkTarget($this, "import"), "import",
get_class($this));
*/
// preview
$ilTabs->addNonTabbedLink("preview", $lng->txt("cont_preview"), $ilCtrl->getLinkTarget($this, 'sco_preview'), "_blank");
$tpl->setTitleIcon(ilUtil::getImagePath("icon_ass.svg"));
$tpl->setTitle($lng->txt("obj_ass") . ": " . $this->node_object->getTitle());
}
示例12: fillRow
/**
* Fill a table row.
*
* This method is called internally by ilias to
* fill a table row according to the row template.
*
* @param stdClass $item
*/
protected function fillRow(stdClass $item)
{
/* Configure template rendering. */
$this->tpl->setVariable('VAL_CHECKBOX', ilUtil::formCheckbox(false, 'test_ids[]', $item->ref_id));
$this->tpl->setVariable('OBJECT_TITLE', $item->title);
$this->tpl->setVariable('OBJECT_INFO', $this->getTestPath($item));
}
示例13: renderImages
/**
* Renders the specified object into images.
* The images do not need to be of the preview image size.
*
* @param ilObjFile $obj The object to create images from.
* @return array An array of ilRenderedImage containing the absolute file paths to the images.
*/
protected function renderImages($obj)
{
$numOfPreviews = $this->getMaximumNumberOfPreviews();
// get file path
$filepath = $obj->getFile();
$inputFile = $this->prepareFileForExec($filepath);
// create a temporary file name and remove its extension
$output = str_replace(".tmp", "", ilUtil::ilTempnam());
// use '#' instead of '%' as it gets replaced by 'escapeShellArg' on windows!
$outputFile = $output . "_#02d.png";
// create images with ghostscript (we use PNG here as it has better transparency quality)
// gswin32c -dBATCH -dNOPAUSE -dSAFER -dFirstPage=1 -dLastPage=5 -sDEVICE=pngalpha -dEPSCrop -r72 -o $outputFile $inputFile
// gswin32c -dBATCH -dNOPAUSE -dSAFER -dFirstPage=1 -dLastPage=5 -sDEVICE=jpeg -dJPEGQ=90 -r72 -o $outputFile $inputFile
$args = sprintf("-dBATCH -dNOPAUSE -dSAFER -dFirstPage=1 -dLastPage=%d -sDEVICE=pngalpha -dEPSCrop -r72 -o %s %s", $numOfPreviews, str_replace("#", "%", ilUtil::escapeShellArg($outputFile)), ilUtil::escapeShellArg($inputFile));
ilUtil::execQuoted(PATH_TO_GHOSTSCRIPT, $args);
// was a temporary file created? then delete it
if ($filepath != $inputFile) {
@unlink($inputFile);
}
// check each file and add it
$images = array();
$outputFile = str_replace("#", "%", $outputFile);
for ($i = 1; $i <= $numOfPreviews; $i++) {
$imagePath = sprintf($outputFile, $i);
if (!file_exists($imagePath)) {
break;
}
$images[] = new ilRenderedImage($imagePath);
}
return $images;
}
示例14: fillRow
/**
* @param array $row
*/
public function fillRow(array $row)
{
/**
* @var $ilCtrl ilCtrl
*/
global $ilCtrl;
if ($this->getParentObject()->isCRUDContext()) {
$row['chb'] = ilUtil::formCheckbox(false, 'unit_ids[]', $row['unit_id']);
$sequence = new ilNumberInputGUI('', 'sequence[' . $row['unit_id'] . ']');
$sequence->setValue($this->position++ * 10);
$sequence->setMinValue(0);
$sequence->setSize(3);
$row['sequence'] = $sequence->render();
$action = new ilAdvancedSelectionListGUI();
$action->setId('asl_content_' . $row['unit_id']);
$action->setAsynch(false);
$action->setListTitle($this->lng->txt('actions'));
$ilCtrl->setParameter($this->getParentObject(), 'unit_id', $row['unit_id']);
$action->addItem($this->lng->txt('edit'), '', $ilCtrl->getLinkTarget($this->getParentObject(), 'showUnitModificationForm'));
$action->addItem($this->lng->txt('delete'), '', $ilCtrl->getLinkTarget($this->getParentObject(), 'confirmDeleteUnit'));
$ilCtrl->setParameter($this->getParentObject(), 'unit_id', '');
$row['actions'] = $action->getHtml();
}
if ($row['unit_id'] == $row['baseunit_id']) {
$row['baseunit'] = '';
}
parent::fillRow($row);
}
示例15: save
private function save()
{
global $tpl, $ilCtrl;
$form = $this->BuildForm();
// Formular bauen
// Eingaben prüfen (Abhängig von SetRequired)
if ($form->CheckInput()) {
$form->setValuesByPost();
// Lade die Benutzereingaben
$emails = $form->getInput('emails');
// Speichere die E-Mails in eine Variable
require_once "Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/UIExample/classes/class.ilEmailSubscriber.php";
$subscriber = new ilEmailSubscriber($_GET['ref_id']);
$emails = $subscriber->getEmailsFromString($emails);
foreach ($emails as $email) {
$subscriber->subscribeEmail($email);
}
//var_dump($subscriber->getEmailsFromString($emails));
//exit;
//$emails_untereinander = "";
//$eintremails_untereinander = ;
ilUtil::sendSuccess("Die Nutzer folgender E-Mail-Adressen sind jetzt Kursmitglieder: " . $this->werteuntereinander($subscriber->getEmailsFound()), true);
ilUtil::sendInfo("Die Nutzer folgender E-Mail-Adressen konnten nicht gefunden werden: " . $this->werteuntereinander($subscriber->getEmailsNotFound()), true);
$this->ctrl->redirect($this, 'show');
/*
$ausgabestr .= "Die Nutzer folgender E-Mail-Adressen sind jetzt Kursmitglieder: ".$this->werteuntereinander($subscriber->getEmailsFound());
$ausgabestr .= "<br /><br /><br />Die Nutzer folgender E-Mail-Adressen konnten nicht gefunden werden: ".$this->werteuntereinander($subscriber->getEmailsNotFound());
$this->tpl->setContent($ausgabestr); //Zeige die E-Mails im Content an
*/
} else {
$this->tpl->setContent("Nicht Speichern");
}
}