Skip to content

Commit

Permalink
Merge pull request #265 from Amstutz/System_Styles_Implementation
Browse files Browse the repository at this point in the history
System styles implementation
-->Feature has been accepted in FW. 
--> Comments/Reviews are still welcome! 
--> Activate in the setup menu, basic settings.
  • Loading branch information
Amstutz authored Aug 23, 2016
2 parents dd573ca + 96f4ac4 commit 7fe45d2
Show file tree
Hide file tree
Showing 294 changed files with 32,464 additions and 7,721 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ db_template_writer.php

# Directories
/data
#/Customizing/global
/Customizing/global
/setup/sql/ilDBTemplate
virtual-data

Expand Down
10 changes: 2 additions & 8 deletions Modules/Course/classes/Badges/class.ilCourseLPBadge.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,17 @@ public function getConfigGUIInstance()

public function evaluate($a_user_id, array $a_params, array $a_config)
{
$subitem_obj_ids = array();
foreach($a_config["subitems"] as $ref_id)
{
$subitem_obj_ids[$ref_id] = ilObject::_lookupObjId($ref_id);
}

$trigger_subitem_id = $a_params["obj_id"];

// relevant for current badge instance?
if(in_array($trigger_subitem_id, $subitem_obj_ids))
if(in_array($trigger_subitem_id, $a_config["subitems"]))
{
$completed = true;

// check if all subitems are completed now
foreach($a_config["subitems"] as $subitem_id)
{
$subitem_obj_id = $subitem_obj_ids[$subitem_id];
$subitem_obj_id = ilObject::_lookupObjId($subitem_id);
if(ilLPStatus::_lookupStatus($subitem_obj_id, $a_user_id) != ilLPStatus::LP_STATUS_COMPLETED_NUM)
{
$completed = false;
Expand Down
2 changes: 1 addition & 1 deletion Modules/Exercise/classes/class.ilExerciseLP.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static function getDefaultModes($a_lp_active)
{
return array(
ilLPObjSettings::LP_MODE_DEACTIVATED,
ilLPObjSettings::LP_MODE_EXERCISE_RETURNED
ilLPObjSettings::LP_MODE_MANUAL_BY_TUTOR
);
}

Expand Down
5 changes: 5 additions & 0 deletions Modules/Glossary/classes/class.ilGlossaryDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,11 @@ function delete()

// delete meta data
$this->deleteMetaData();
/*
$nested = new ilNestedSetXML();
$nested->init($this->getId(), $this->getType());
$nested->deleteAllDBData();
*/
}


Expand Down
5 changes: 5 additions & 0 deletions Modules/Glossary/classes/class.ilObjGlossary.php
Original file line number Diff line number Diff line change
Expand Up @@ -1149,6 +1149,11 @@ function delete()

// delete meta data
$this->deleteMetaData();
/*
$nested = new ilNestedSetXML();
$nested->init($this->getId(), $this->getType());
$nested->deleteAllDBData();
*/

return true;
}
Expand Down
42 changes: 41 additions & 1 deletion Modules/HTMLLearningModule/classes/class.ilObjFileBasedLM.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class ilObjFileBasedLM extends ilObject

protected $online; // [bool]
protected $show_license; // [bool]
protected $show_bib; // [bool]

/**
* Constructor
Expand All @@ -37,6 +38,7 @@ function __construct($a_id = 0,$a_call_by_reference = true)
parent::__construct($a_id,$a_call_by_reference);

$this->setShowLicense(false);
$this->setShowBibliographicalData(false);
}


Expand All @@ -57,6 +59,7 @@ function update()
" is_online = ".$ilDB->quote(ilUtil::tf2yn($this->getOnline()), "text").
", startfile = ".$ilDB->quote($this->getStartFile(), "text")." ".
", show_lic = ".$ilDB->quote($this->getShowLicense(), "integer")." ".
", show_bib = ".$ilDB->quote($this->getShowBibliographicalData(), "integer")." ".
" WHERE id = ".$ilDB->quote($this->getId(), "integer"));
return true;
}
Expand All @@ -76,8 +79,21 @@ function read()
$this->setOnline(ilUtil::yn2tf($lm_rec["is_online"]));
$this->setStartFile((string) $lm_rec["startfile"]);
$this->setShowLicense($lm_rec["show_lic"]);
$this->setShowBibliographicalData($lm_rec["show_bib"]);
}

/**
* init bib object (contains all bib item data)
*/
function initBibItemObject()
{
include_once("./Modules/LearningModule/classes/class.ilBibItem.php");

$this->bib_obj = new ilBibItem($this);
$this->bib_obj->read();

return true;
}


/**
Expand Down Expand Up @@ -145,6 +161,16 @@ function getShowLicense()
return $this->show_license;
}

function setShowBibliographicalData($a_value)
{
$this->show_bib = (bool)$a_value;
}

function getShowBibliographicalData()
{
return $this->show_bib;
}

/**
* check wether content object is online
*/
Expand Down Expand Up @@ -177,7 +203,7 @@ function getDiskUsage()
* delete object and all related data
*
* this method has been tested on may 9th 2004
* data directory, meta data, file based lm data
* data directory, meta data, file based lm data and bib items
* have been deleted correctly as desired
*
* @access public
Expand All @@ -193,9 +219,22 @@ function delete()
return false;
}

// delete meta data of content object
/*
$nested = new ilNestedSetXML();
$nested->init($this->getId(), $this->getType());
$nested->deleteAllDBData();
*/

// Delete meta data
$this->deleteMetaData();

// delete bibliographical items of object
include_once("./Services/Xml/classes/class.ilNestedSetXML.php");
$nested = new ilNestedSetXML();
$nested->init($this->getId(), "bib");
$nested->deleteAllDBData();

// delete file_based_lm record
$ilDB->manipulate("DELETE FROM file_based_lm WHERE id = ".
$ilDB->quote($this->getID(), "integer"));
Expand Down Expand Up @@ -250,6 +289,7 @@ public function cloneObject($a_target_id,$a_copy_id = 0)
$new_obj->setTitle($this->getTitle());
$new_obj->setDescription($this->getDescription());
$new_obj->setShowLicense($this->getShowLicense());
$new_obj->setShowBibliographicalData($this->getShowBibliographicalData());

// copy content
$new_obj->populateByDirectoy($this->getDataDirectory());
Expand Down
187 changes: 186 additions & 1 deletion Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,10 @@ public function initSettingsForm()
$lic->setDisabled(true);
}
}

$bib = new ilCheckboxInputGUI($lng->txt("cont_biblio"), "bib");
$bib->setInfo($lng->txt("cont_biblio_info"));
$this->form->addItem($bib);

$this->form->addCommandButton("saveProperties", $lng->txt("save"));
$this->form->addCommandButton("toFilesystem", $lng->txt("cont_set_start_file"));
Expand Down Expand Up @@ -338,6 +342,7 @@ public function getSettingsFormValues()
$values["title"] = $this->object->getTitle();
$values["desc"] = $this->object->getDescription();
$values["lic"] = $this->object->getShowLicense();
$values["bib"] = $this->object->getShowBibliographicalData();

$this->form->setValuesByArray($values);
}
Expand Down Expand Up @@ -368,7 +373,8 @@ public function saveProperties()
$this->object->setTitle($this->form->getInput("title"));
$this->object->setDescription($this->form->getInput("desc"));
$this->object->setOnline(ilUtil::yn2tf($_POST["cobj_online"]));

$this->object->setShowBibliographicalData($this->form->getInput("bib"));

$lic = $this->form->getItemByPostVar("lic");
if($lic && !$lic->getDisabled())
{
Expand Down Expand Up @@ -503,6 +509,179 @@ function perm()
$this->permObject();
}

/**
* save bib item (admin call)
*/
function saveBibItemObject($a_target = "")
{
global $ilTabs;

$ilTabs->activateTab("id_bib_data");

include_once "./Modules/LearningModule/classes/class.ilBibItemGUI.php";
$bib_gui = new ilBibItemGUI();
$bib_gui->setObject($this->object);
$bibItemIndex = $_POST["bibItemIndex"] ? $_POST["bibItemIndex"] : $_GET["bibItemIndex"];
$bibItemIndex *= 1;
if ($bibItemIndex < 0)
{
$bibItemIndex = 0;
}
$bibItemIndex = $bib_gui->save($bibItemIndex);

if ($a_target == "")
{
$a_target = "adm_object.php?ref_id=" . $this->object->getRefId();
}

$bib_gui->edit("ADM_CONTENT", "adm_content", $a_target, $bibItemIndex);
}

/**
* save bib item (module call)
*/
function saveBibItem()
{
// questionable workaround to make this old stuff work
$this->ctrl->setParameter($this, ilCtrl::IL_RTOKEN_NAME, $this->ctrl->getRequestToken());

//$this->setTabs();
$this->saveBibItemObject($this->ctrl->getLinkTarget($this));
}

/**
* edit bib items (admin call)
*/
function editBibItemObject($a_target = "")
{
global $ilTabs;

$ilTabs->activateTab("id_bib_data");

include_once "./Modules/LearningModule/classes/class.ilBibItemGUI.php";
$bib_gui = new ilBibItemGUI();
$bib_gui->setObject($this->object);
$bibItemIndex = $_POST["bibItemIndex"] ? $_POST["bibItemIndex"] : $_GET["bibItemIndex"];
$bibItemIndex *= 1;
if ($bibItemIndex < 0)
{
$bibItemIndex = 0;
}
if ($a_target == "")
{
$a_target = "adm_object.php?ref_id=" . $this->object->getRefId();
}

$bib_gui->edit("ADM_CONTENT", "adm_content", $a_target, $bibItemIndex);
}

/**
* edit bib items (module call)
*/
function editBibItem()
{
// questionable workaround to make this old stuff work
$this->ctrl->setParameter($this, ilCtrl::IL_RTOKEN_NAME, $this->ctrl->getRequestToken());

//$this->setTabs();
$this->editBibItemObject($this->ctrl->getLinkTarget($this));
}

/**
* delete bib item (admin call)
*/
function deleteBibItemObject($a_target = "")
{
global $ilTabs;

$ilTabs->activateTab("id_bib_data");

include_once "./Modules/LearningModule/classes/class.ilBibItemGUI.php";
$bib_gui = new ilBibItemGUI();
$bib_gui->setObject($this->object);
$bibItemIndex = $_POST["bibItemIndex"] ? $_POST["bibItemIndex"] : $_GET["bibItemIndex"];
$bib_gui->bib_obj->delete($_GET["bibItemName"], $_GET["bibItemPath"], $bibItemIndex);
if (strpos($bibItemIndex, ",") > 0)
{
$bibItemIndex = substr($bibItemIndex, 0, strpos($bibItemIndex, ","));
}
if ($a_target == "")
{
$a_target = "adm_object.php?ref_id=" . $this->object->getRefId();
}

$bib_gui->edit("ADM_CONTENT", "adm_content", $a_target, max(0, $bibItemIndex - 1));
}

/**
* delete bib item (module call)
*/
function deleteBibItem()
{
// questionable workaround to make this old stuff work
$this->ctrl->setParameter($this, ilCtrl::IL_RTOKEN_NAME, $this->ctrl->getRequestToken());

//$this->setTabs();
$this->deleteBibItemObject($this->ctrl->getLinkTarget($this));
}

/**
* add bib item (admin call)
*/
function addBibItemObject($a_target = "")
{
global $ilTabs;

$ilTabs->activateTab("id_bib_data");

$bibItemName = $_POST["bibItemName"] ? $_POST["bibItemName"] : $_GET["bibItemName"];
$bibItemIndex = $_POST["bibItemIndex"] ? $_POST["bibItemIndex"] : $_GET["bibItemIndex"];
if ($bibItemName == "BibItem")
{
include_once "./Modules/LearningModule/classes/class.ilBibItem.php";
$bib_item = new ilBibItem();
$bib_item->setId($this->object->getId());
$bib_item->setType($this->object->getType());
$bib_item->read();
}

include_once "./Modules/LearningModule/classes/class.ilBibItemGUI.php";
$bib_gui = new ilBibItemGUI();
$bib_gui->setObject($this->object);
if ($bibItemIndex == "")
$bibItemIndex = 0;
$bibItemPath = $_POST["bibItemPath"] ? $_POST["bibItemPath"] : $_GET["bibItemPath"];

//if ($bibItemName != "" && $bibItemName != "BibItem")
if ($bibItemName != "")
{
$bib_gui->bib_obj->add($bibItemName, $bibItemPath, $bibItemIndex);
$data = $bib_gui->bib_obj->getElement("BibItem");
$bibItemIndex = (count($data) - 1);
}
else
{
ilUtil::sendInfo($this->lng->txt("bibitem_choose_element"), true);
}
if ($a_target == "")
{
$a_target = "adm_object.php?ref_id=" . $this->object->getRefId();
}

$bib_gui->edit("ADM_CONTENT", "adm_content", $a_target, $bibItemIndex);
}

/**
* add bib item (module call)
*/
function addBibItem()
{
// questionable workaround to make this old stuff work
$this->ctrl->setParameter($this, ilCtrl::IL_RTOKEN_NAME, $this->ctrl->getRequestToken());

//$this->setTabs();
$this->addBibItemObject($this->ctrl->getLinkTarget($this));
}

/**
* Frameset -> Output list of files
Expand Down Expand Up @@ -697,6 +876,12 @@ function getTabs()
$mdtab);
}

if($this->object->getShowBibliographicalData())
{
$ilTabs->addTab("id_bib_data",
$lng->txt("bib_data"),
$this->ctrl->getLinkTarget($this, "editBibItem"));
}
}


Expand Down
Loading

0 comments on commit 7fe45d2

Please sign in to comment.