Skip to content

Commit

Permalink
Merge branch 'trunk' of https://github.com/ILIAS-eLearning/ILIAS into…
Browse files Browse the repository at this point in the history
… trunk
  • Loading branch information
jluetzen-ilias committed Aug 20, 2015
2 parents e53beb2 + 465485a commit 3425a31
Show file tree
Hide file tree
Showing 8 changed files with 239 additions and 72 deletions.
87 changes: 87 additions & 0 deletions Modules/ItemGroup/classes/class.ilItemGroupAR.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?php

/* Copyright (c) 1998-2014 ILIAS open source, Extended GPL, see docs/LICENSE */

include_once("./Services/ActiveRecord/class.ActiveRecord.php");

/**
* Item group active record class
*
* @author Alex Killing <[email protected]>
* @version $Id$
* @ingroup
*/
class ilItemGroupAR extends ActiveRecord
{
/**
* @return string
*/
static function returnDbTableName() {
return 'itgr_data';
}

/**
* @var int
*
* @con_is_primary true
* @con_is_unique true
* @con_has_field true
* @con_fieldtype integer
* @con_is_notnull true
* @con_length 4
* @con_sequence false
*/
protected $id;

/**
* @var string
*
* @con_has_field true
* @con_fieldtype integer
* @con_length 1
* @con_is_notnull false
*/
protected $hide_title = '';

/**
* Get ID
*
* @return int ID
*/
public function getId() {
return $this->id;
}


/**
* Set ID
*
* @param int $id ID
*/
public function setId($id) {
$this->id = $id;
}

/**
* Set hide title
*
* @param bool $a_hide_title hide title
*/
public function setHideTitle($a_hide_title)
{
$this->hide_title = $a_hide_title;
}


/**
* Get hide title
*
* @return bool hide title
*/
public function getHideTitle()
{
return $this->hide_title;
}
}

?>
128 changes: 63 additions & 65 deletions Modules/ItemGroup/classes/class.ilObjItemGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
require_once "Services/Object/classes/class.ilObject2.php";
require_once "Services/Object/classes/class.ilObjectActivation.php";

include_once("./Modules/ItemGroup/classes/class.ilItemGroupAR.php");


/**
* Class ilObjItemGroup
*
Expand All @@ -19,6 +22,7 @@ class ilObjItemGroup extends ilObject2
protected $access_begin; // [timestamp]
protected $access_end; // [timestamp]
protected $access_visibility; // [bool]
protected $item_data_ar = null; // active record

/**
* Constructor
Expand All @@ -29,72 +33,73 @@ class ilObjItemGroup extends ilObject2
*/
function __construct($a_id = 0, $a_reference = true)
{
global $tree, $objDefinition;
global $tree, $objDefinition, $ilDB;

$this->tree = $tree;
$this->obj_def = $objDefinition;

$this->db = $ilDB;

$this->item_data_ar = new ilItemGroupAR();

parent::__construct($a_id, $a_reference);
}


/**
* Set ID
*
* @param int $a_val ID
*/
function setId($a_val)
{
parent::setId($a_val);
$this->item_data_ar->setId($a_val);
}

/**
* Init type
*/
function initType()
{
$this->type = "itgr";
}

/**
* Read
* Set hide title
*
* @param bool $a_val hide title
*/
protected function doRead()
function setHideTitle($a_val)
{
global $ilDB;
$this->item_data_ar->setHideTitle($a_val);
}

/*$set = $ilDB->query("SELECT * FROM il_poll".
" WHERE id = ".$ilDB->quote($this->getId(), "integer"));
$row = $ilDB->fetchAssoc($set);*/

if ($this->ref_id)
{
/* $activation = ilObjectActivation::getItem($this->ref_id);
$this->setAccessType($activation["timing_type"]);
$this->setAccessBegin($activation["timing_start"]);
$this->setAccessEnd($activation["timing_end"]);
$this->setAccessVisibility($activation["visible"]);*/
}
/**
* Get hide title
*
* @return bool hide title
*/
function getHideTitle()
{
return $this->item_data_ar->getHideTitle();
}

/**
* Get properties array
* Read
*/
protected function propertiesToDB()
protected function doRead()
{
$fields = array(
);

return $fields;
$this->item_data_ar = new ilItemGroupAR($this->getId());
}

/**
* Creation
*/
protected function doCreate()
{
global $ilDB;

if($this->getId())
{
$fields = $this->propertiesToDB();
// $fields["id"] = array("integer", $this->getId());

// $ilDB->insert("il_poll", $fields);


// object activation default entry will be created on demand


$this->item_data_ar->setId($this->getId());
$this->item_data_ar->create();
}
}

Expand All @@ -103,26 +108,9 @@ protected function doCreate()
*/
protected function doUpdate()
{
global $ilDB;

if($this->getId())
{
$fields = $this->propertiesToDB();

// $ilDB->update("il_poll", $fields,
// array("id"=>array("integer", $this->getId())));


if($this->ref_id)
{
/* $activation = new ilObjectActivation();
$activation->setTimingType($this->getAccessType());
$activation->setTimingStart($this->getAccessBegin());
$activation->setTimingEnd($this->getAccessEnd());
$activation->toggleVisible($this->getAccessVisibility());
$activation->update($this->ref_id);*/
}

$this->item_data_ar->update();
}
}

Expand All @@ -131,17 +119,9 @@ protected function doUpdate()
*/
protected function doDelete()
{
global $ilDB;

if($this->getId())
{
if($this->ref_id)
{
// ilObjectActivation::deleteAllEntries($this->ref_id);
}

// $ilDB->manipulate("DELETE FROM il_poll".
// " WHERE id = ".$ilDB->quote($this->id, "integer"));
{
$this->item_data_ar->delete();
}
}

Expand Down Expand Up @@ -211,6 +191,24 @@ static function fixContainerItemGroupRefsAfterCloning($a_source_container, $a_co
}
$ilLog->write(__METHOD__.': 5');
}

/**
* Lookup hide title
*
* @param int $a_id ID
* @return bool
*/
static function lookupHideTitle($a_id)
{
global $ilDB;

$set = $ilDB->query("SELECT hide_title FROM itgr_data ".
" WHERE id = ".$ilDB->quote($a_id, "integer")
);
$rec = $ilDB->fetchAssoc($set);
return $rec["hide_title"];
}

}

?>
36 changes: 35 additions & 1 deletion Modules/ItemGroup/classes/class.ilObjItemGroupGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,41 @@ public function afterSaveCallback(ilObject $a_obj)
$items = new ilItemGroupItems($this->object->getRefId());
$items->addItem($a_obj->getRefId());
$items->update();
}
}

/**
* Init object edit form
*
* @param ilPropertyFormGUI $a_form form
*/
protected function initEditCustomForm(ilPropertyFormGUI $a_form)
{
// hide title
$cb = new ilCheckboxInputGUI($this->lng->txt("itgr_hide_title"), "hide_title");
$cb->setInfo($this->lng->txt("itgr_hide_title_info"));
$a_form->addItem($cb);
}

/**
* Get edit form values (custom part)
*
* @param array $a_values form values
*/
function getEditFormCustomValues(&$a_values)
{
$a_values["hide_title"] = $this->object->getHideTitle();
}

/**
* Update (custom part)
*
* @param ilPropertyFormGUI $a_form form
*/
function updateCustom(ilPropertyFormGUI $a_form)
{
$this->object->setHideTitle($a_form->getInput("hide_title"));
}


}
?>
13 changes: 11 additions & 2 deletions Services/Container/classes/class.ilContainerContentGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -742,8 +742,17 @@ function renderItemGroup($a_itgr)
$item_list_gui->getListItemHTML($a_itgr["ref_id"], $a_itgr["obj_id"],
$a_itgr["title"], $a_itgr["description"]);
$commands_html = $item_list_gui->getCommandsHTML();

$this->renderer->addCustomBlock($a_itgr["ref_id"], $a_itgr["title"], $commands_html);

include_once("./Modules/ItemGroup/classes/class.ilObjItemGroup.php");
if (ilObjItemGroup::lookupHideTitle($a_itgr["obj_id"]) &&
!$this->getContainerGUI()->isActiveAdministrationPanel())
{
$this->renderer->addCustomBlock($a_itgr["ref_id"], "", $commands_html);
}
else
{
$this->renderer->addCustomBlock($a_itgr["ref_id"], $a_itgr["title"], $commands_html);
}


// render item group sub items
Expand Down
4 changes: 2 additions & 2 deletions Services/Object/classes/class.ilObject2.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ protected function doRead()

}

final function getId() { return parent::getId(); }
final function setId($a_id) { return parent::setId($a_id); }
function getId() { return parent::getId(); }
function setId($a_id) { return parent::setId($a_id); }
final function setRefId($a_id) { return parent::setRefId($a_id); }
final function getRefId() { return parent::getRefId(); }
final function getType() { return parent::getType(); }
Expand Down
4 changes: 3 additions & 1 deletion lang/ilias_de.lang
Original file line number Diff line number Diff line change
Expand Up @@ -15673,4 +15673,6 @@ mail#:#mail_tpl_deleted_s#:#Die Textvorlage wurde erfolgreich gelöscht.
mail#:#mail_template_missing_id#:#Die Aktion kann nicht ausgeführt werden, da die ID der Textvorlage nicht korrekt übertragen wurde.
mail#:#mail_template_no_valid_context#:#Der gewählte Kontext ist nicht gültig.
mail#:#mail_template_client#:#Textvorlage
mail#:#mail_template_client_info#:#Wählen Sie zwischen einer der verfügbaren Textvorlagen. Sie haben die Möglichkeit, die durch die Textvorlage angebotenen Platzhalter zu nutzen. Beim Wahl einer Textvorlage werden Nachrichte und Betreff in diesem Formular (falls in der Vorlage definiert) ersetzt.
mail#:#mail_template_client_info#:#Wählen Sie zwischen einer der verfügbaren Textvorlagen. Sie haben die Möglichkeit, die durch die Textvorlage angebotenen Platzhalter zu nutzen. Beim Wahl einer Textvorlage werden Nachrichte und Betreff in diesem Formular (falls in der Vorlage definiert) ersetzt.
itgr#:#itgr_hide_title#:#Titel verbergen
itgr#:#itgr_hide_title_info#:#Der Titel des Objektblocks wird in der Präsentation für Lerner nicht angezeigt.
4 changes: 3 additions & 1 deletion lang/ilias_en.lang
Original file line number Diff line number Diff line change
Expand Up @@ -15678,4 +15678,6 @@ mail#:#mail_tpl_deleted_s#:#The text template was successfully deleted.
mail#:#mail_template_missing_id#:#Can't execute the action because the text template id is missing.
mail#:#mail_template_no_valid_context#:#The given context is not valid.
mail#:#mail_template_client#:#Text Template
mail#:#mail_template_client_info#:#Choose one of the available text templates and make use of it's placeholders. If you choose a text template, body and subject of this form (if defined in the text template) will be replaced.
mail#:#mail_template_client_info#:#Choose one of the available text templates and make use of it's placeholders. If you choose a text template, body and subject of this form (if defined in the text template) will be replaced.
itgr#:#itgr_hide_title#:#Hide Title
itgr#:#itgr_hide_title_info#:#Hides title of item group in presentation for learner.
Loading

0 comments on commit 3425a31

Please sign in to comment.