ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilTaxMDGUI Class Reference
+ Collaboration diagram for ilTaxMDGUI:

Public Member Functions

 __construct ($a_md_rbac_id, $a_md_obj_id, $a_md_obj_type)
 Constructor.
 addToMDForm (ilPropertyFormGUI $a_form)
 Add taxonomy selector to MD (quick edit) form.
 updateFromMDForm ()
 Import settings from MD (quick edit) form.

Protected Member Functions

 getSelectableTaxonomies ()
 Get selectable taxonomies for current object.
 initTaxNodeAssignment ($a_tax_id)
 Init tax node assignment.

Protected Attributes

 $md_rbac_id
 $md_obj_id
 $md_obj_type

Detailed Description

Definition at line 12 of file class.ilTaxMDGUI.php.

Constructor & Destructor Documentation

ilTaxMDGUI::__construct (   $a_md_rbac_id,
  $a_md_obj_id,
  $a_md_obj_type 
)

Constructor.

Parameters
int$a_md_rbac_id
int$a_md_obj_id
int$a_md_obj_type
Returns
self

Definition at line 26 of file class.ilTaxMDGUI.php.

{
$this->md_rbac_id = $a_md_rbac_id;
$this->md_obj_id = $a_md_obj_id;
$this->md_obj_type = $a_md_obj_type;
}

Member Function Documentation

ilTaxMDGUI::addToMDForm ( ilPropertyFormGUI  $a_form)

Add taxonomy selector to MD (quick edit) form.

Parameters
ilPropertyFormGUI$a_form

Definition at line 96 of file class.ilTaxMDGUI.php.

References ilPropertyFormGUI\addItem(), getSelectableTaxonomies(), and initTaxNodeAssignment().

Referenced by ilMDEditorGUI\initQuickEditForm().

{
$tax_ids = $this->getSelectableTaxonomies();
if(is_array($tax_ids))
{
include_once "Services/Taxonomy/classes/class.ilTaxSelectInputGUI.php";
foreach($tax_ids as $tax_id)
{
// get existing assignments
$node_ids = array();
$ta = $this->initTaxNodeAssignment($tax_id);
foreach($ta->getAssignmentsOfItem($this->md_obj_id) as $ass)
{
$node_ids[] = $ass["node_id"];
}
$tax_sel = new ilTaxSelectInputGUI($tax_id, "md_tax_".$tax_id, true);
$tax_sel->setValue($node_ids);
$a_form->addItem($tax_sel);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTaxMDGUI::getSelectableTaxonomies ( )
protected

Get selectable taxonomies for current object.

Returns
array

Definition at line 38 of file class.ilTaxMDGUI.php.

References $_REQUEST, $res, ilContainer\_lookupContainerSetting(), ilObjTaxonomy\getUsageOfObject(), and ilObjectServiceSettingsGUI\TAXONOMIES.

Referenced by addToMDForm(), and updateFromMDForm().

{
global $objDefinition, $tree;
if($objDefinition->isRBACObject($this->md_obj_type))
{
$res = array();
// see ilTaxonomyBlockGUI::getActiveTaxonomies()
// get all active taxonomies of parent objects
foreach($tree->getPathFull((int)$_REQUEST["ref_id"]) as $node)
{
// currently only active for categories
if($node["type"] == "cat")
{
include_once "Services/Object/classes/class.ilObjectServiceSettingsGUI.php";
include_once "Services/Container/classes/class.ilContainer.php";
$node["obj_id"],
false
))
{
include_once "Services/Taxonomy/classes/class.ilObjTaxonomy.php";
$tax_ids = ilObjTaxonomy::getUsageOfObject($node["obj_id"]);
if(sizeof($tax_ids))
{
$res = array_merge($res, $tax_ids);
}
}
}
}
if(sizeof($res))
{
return $res;
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTaxMDGUI::initTaxNodeAssignment (   $a_tax_id)
protected

Init tax node assignment.

Parameters
int$a_tax_id
Returns
ilTaxNodeAssignment

Definition at line 85 of file class.ilTaxMDGUI.php.

Referenced by addToMDForm(), and updateFromMDForm().

{
include_once("./Services/Taxonomy/classes/class.ilTaxNodeAssignment.php");
return new ilTaxNodeAssignment($this->md_obj_type, $this->md_obj_id, "obj", $a_tax_id);
}

+ Here is the caller graph for this function:

ilTaxMDGUI::updateFromMDForm ( )

Import settings from MD (quick edit) form.

Definition at line 122 of file class.ilTaxMDGUI.php.

References $_POST, getSelectableTaxonomies(), and initTaxNodeAssignment().

Referenced by ilMDEditorGUI\updateQuickEdit().

{
$tax_ids = $this->getSelectableTaxonomies();
if(is_array($tax_ids))
{
include_once("./Services/Taxonomy/classes/class.ilTaxNodeAssignment.php");
foreach($tax_ids as $tax_id)
{
$ta = $this->initTaxNodeAssignment($tax_id);
// delete existing assignments
$ta->deleteAssignmentsOfItem($this->md_obj_id);
// set current assignment
if(is_array($_POST["md_tax_".$tax_id]))
{
foreach($_POST["md_tax_".$tax_id] as $node_id)
{
$ta->addAssignment($node_id, $this->md_obj_id);
}
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilTaxMDGUI::$md_obj_id
protected

Definition at line 15 of file class.ilTaxMDGUI.php.

ilTaxMDGUI::$md_obj_type
protected

Definition at line 16 of file class.ilTaxMDGUI.php.

ilTaxMDGUI::$md_rbac_id
protected

Definition at line 14 of file class.ilTaxMDGUI.php.


The documentation for this class was generated from the following file: