ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilECSCategoryMapping Class Reference
+ Collaboration diagram for ilECSCategoryMapping:

Static Public Member Functions

static getActiveRules ()
 get active rules
static getMatchingCategory (ilECSEContent $econtent)
 get matching category
static handleUpdate (ilECSEContent $econtent, $a_obj_id)
 Handle update of ecs content and create references.
static lookupHandledCategories ()
static getPossibleFields ()

Static Private Attributes

static $cached_active_rules = null

Detailed Description

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 35 of file class.ilECSCategoryMapping.php.

Member Function Documentation

static ilECSCategoryMapping::getActiveRules ( )
static

get active rules

Returns
array

Definition at line 45 of file class.ilECSCategoryMapping.php.

References $ilDB, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by getMatchingCategory(), and ilECSSettingsGUI\showRulesTable().

{
global $ilDB;
$res = $ilDB->query('SELECT mapping_id FROM ecs_container_mapping');
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$rules[] = new ilECSCategoryMappingRule($row->mapping_id);
}
return $rules ? $rules : array();
}

+ Here is the caller graph for this function:

static ilECSCategoryMapping::getMatchingCategory ( ilECSEContent  $econtent)
static

get matching category

Parameters
object$econtentilECSEcontent
Returns

Definition at line 64 of file class.ilECSCategoryMapping.php.

References $ilLog, ilECSSettings\_getInstance(), and getActiveRules().

Referenced by ilObjRemoteCourse\_createFromECSEContent(), and handleUpdate().

{
global $ilLog;
if(is_null(self::$cached_active_rules))
{
self::$cached_active_rules = self::getActiveRules();
}
foreach(self::$cached_active_rules as $rule)
{
if($rule->matches($econtent))
{
$ilLog->write(__METHOD__.': Found assignment for field type: '.$rule->getFieldName());
return $rule->getContainerId();
}
$ilLog->write(__METHOD__.': Category assignment failed for field: '.$rule->getFieldName());
}
// Return default container
$ilLog->write(__METHOD__.': Using default container');
return ilECSSettings::_getInstance()->getImportId();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilECSCategoryMapping::getPossibleFields ( )
static
Returns

Definition at line 171 of file class.ilECSCategoryMapping.php.

Referenced by ilECSSettingsGUI\initCategoryMappingForm().

{
return array(
'part_id',
'study_courses',
'courseType',
'term',
'credits',
'begin');
}

+ Here is the caller graph for this function:

static ilECSCategoryMapping::handleUpdate ( ilECSEContent  $econtent,
  $a_obj_id 
)
static

Handle update of ecs content and create references.

Returns

Definition at line 92 of file class.ilECSCategoryMapping.php.

References $ilLog, $ref_id, ilObject\_getAllReferences(), ilObject\_lookupObjId(), ilObjectFactory\getInstanceByRefId(), getMatchingCategory(), and lookupHandledCategories().

Referenced by ilObjRemoteCourse\updateFromECSContent().

{
global $tree,$ilLog;
$a_ref_id = current(ilObject::_getAllReferences($a_obj_id));
$cat = self::getMatchingCategory($econtent);
$exists = false;
foreach($references as $ref_id => $null)
{
if($tree->getParentId($ref_id) == $cat)
{
$exists = true;
}
}
$ilLog->write(__METHOD__.': Creating/Deleting references...');
include_once './classes/class.ilObjectFactory.php';
if(!$exists)
{
$ilLog->write(__METHOD__.': Add new reference. STEP 1');
if($obj_data = ilObjectFactory::getInstanceByRefId($a_ref_id,false))
{
$new_ref_id = $obj_data->createReference();
$obj_data->putInTree($cat);
$obj_data->setPermissions($cat);
$ilLog->write(__METHOD__.': Add new reference.');
}
}
// Now delete old references
foreach($references as $ref_id => $null)
{
$parent = $tree->getParentId($ref_id);
if($parent == $cat)
{
continue;
}
if(!in_array($parent,$all_cats))
{
continue;
}
{
$to_delete->delete();
$ilLog->write(__METHOD__.': Deleted deprecated reference.');
}
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilECSCategoryMapping::lookupHandledCategories ( )
static
Returns

Definition at line 153 of file class.ilECSCategoryMapping.php.

References $ilDB, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by handleUpdate().

{
global $ilDB;
$res = $ilDB->query("SELECT container_id FROM ecs_container_mapping ");
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$ref_ids[] = $row->container_id;
}
return $ref_ids ? $ref_ids : array();
}

+ Here is the caller graph for this function:

Field Documentation

ilECSCategoryMapping::$cached_active_rules = null
staticprivate

Definition at line 37 of file class.ilECSCategoryMapping.php.


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