Public Member Functions | |
| __construct ($a_obj_id, $a_field_id=0) | |
| Constructor. | |
| getObjId () | |
| getId () | |
| getType () | |
| setType ($a_type) | |
| getName () | |
| setName ($a_name) | |
| getValues () | |
| setValues ($a_values) | |
| getValueById ($a_id) | |
| getIdByValue ($a_value) | |
| isRequired () | |
| enableRequired ($a_status) | |
| prepareSelectBox () | |
| Prepare an array of options for ilUtil::formSelect(). | |
| prepareValues ($a_values) | |
| Prepare values from POST. | |
| appendValues ($a_values) | |
| Append Values. | |
| deleteValue ($a_id) | |
| Delete value by id. | |
| save () | |
| Save. | |
| update () | |
| Update a field. | |
| delete () | |
| Delete a field. | |
Static Public Member Functions | |
| static | _clone ($a_source_id, $a_target_id) |
| Clone fields. | |
| static | _deleteByContainer ($a_container_id) |
| Delete all fields of a container. | |
| static | _hasFields ($a_container_id) |
| Check if there are any define fields. | |
| static | _getFields ($a_container_id, $a_sort=IL_CDF_SORT_NAME) |
| Get all fields of a container. | |
| static | _getRequiredFieldIds ($a_obj_id) |
| Get required filed id's. | |
| static | _fieldsToInfoString ($a_obj_id) |
| Fields to info string. | |
| static | _getFieldIds ($a_container_id, $a_sort=IL_CDF_SORT_ID) |
| Get all field ids of a container. | |
| static | _lookupName ($a_field_id) |
| Lookup field name. | |
Private Member Functions | |
| read () | |
| Read DB entries. | |
Private Attributes | |
| $db | |
| $obj_id | |
| $id | |
| $name | |
| $type | |
| $values | |
| $required | |
/
Definition at line 38 of file class.ilCourseDefinedFieldDefinition.php.
| ilCourseDefinedFieldDefinition::__construct | ( | $ | a_obj_id, | |
| $ | a_field_id = 0 | |||
| ) |
Constructor.
public
| int | course obj_id | |
| int | field_id |
Definition at line 57 of file class.ilCourseDefinedFieldDefinition.php.
References read().
{
global $ilDB;
$this->db = $ilDB;
$this->obj_id = $a_obj_id;
$this->id = $a_field_id;
if($this->id)
{
$this->read();
}
}
Here is the call graph for this function:| static ilCourseDefinedFieldDefinition::_clone | ( | $ | a_source_id, | |
| $ | a_target_id | |||
| ) | [static] |
Clone fields.
public
| int | source obj id | |
| int | target obj_id |
Definition at line 80 of file class.ilCourseDefinedFieldDefinition.php.
References _getFields().
Referenced by ilObjCourse::cloneObject().
{
foreach(ilCourseDefinedFieldDefinition::_getFields($a_source_id) as $field_obj)
{
$cdf = new ilCourseDefinedFieldDefinition($a_target_id);
$cdf->setName($field_obj->getName());
$cdf->setType($field_obj->getType());
$cdf->setValues($field_obj->getValues());
$cdf->enableRequired($field_obj->isRequired());
$cdf->save();
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| static ilCourseDefinedFieldDefinition::_deleteByContainer | ( | $ | a_container_id | ) | [static] |
Delete all fields of a container.
public
| int | container_id |
Definition at line 101 of file class.ilCourseDefinedFieldDefinition.php.
References ilCourseUserData::_deleteByField(), and _getFieldIds().
Referenced by ilObjCourse::delete().
{
global $ilDB;
// Delete user entries
include_once('Modules/Course/classes/Export/class.ilCourseUserData.php');
foreach(ilCourseDefinedFieldDefinition::_getFieldIds($a_container_id) as $field_id)
{
ilCourseUserData::_deleteByField($field_id);
}
$query = "DELETE FROM crs_defined_field_definitions ".
"WHERE obj_id = ".$ilDB->quote($a_container_id)." ";
$ilDB->query($query);
}
Here is the call graph for this function:
Here is the caller graph for this function:| static ilCourseDefinedFieldDefinition::_fieldsToInfoString | ( | $ | a_obj_id | ) | [static] |
Fields to info string.
public
| int | obj_id |
Definition at line 176 of file class.ilCourseDefinedFieldDefinition.php.
References $res.
Referenced by ilObjCourseGUI::infoScreen().
{
global $ilDB;
$query = "SELECT field_name FROM crs_defined_field_definitions ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id);
$res = $ilDB->query($query);
$fields = array();
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$fields[] = $row->field_name;
}
return implode('<br />',$fields);
}
Here is the caller graph for this function:| static ilCourseDefinedFieldDefinition::_getFieldIds | ( | $ | a_container_id, | |
| $ | a_sort = IL_CDF_SORT_ID | |||
| ) | [static] |
Get all field ids of a container.
public
| int | container obj_id |
Definition at line 201 of file class.ilCourseDefinedFieldDefinition.php.
References $res.
Referenced by _deleteByContainer(), _getFields(), and ilCourseUserData::_getValuesByObjId().
{
global $ilDB;
$query = "SELECT field_id FROM crs_defined_field_definitions ".
"WHERE obj_id = ".$ilDB->quote($a_container_id)." ".
"ORDER BY ".$ilDB->quote($a_sort);
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$field_ids[] = $row->field_id;
}
return $field_ids ? $field_ids : array();
}
Here is the caller graph for this function:| static ilCourseDefinedFieldDefinition::_getFields | ( | $ | a_container_id, | |
| $ | a_sort = IL_CDF_SORT_NAME | |||
| ) | [static] |
Get all fields of a container.
public
| int | container obj_id |
Definition at line 136 of file class.ilCourseDefinedFieldDefinition.php.
References _getFieldIds().
Referenced by _clone(), _hasFields(), ilMemberExport::addCourseField(), ilMemberExport::addUserDefinedField(), ilCourseRegisterGUI::checkCourseDefinedFields(), ilCourseAgreementGUI::checkCourseDefinedFields(), ilMemberExport::createCSV(), ilExportUserSettings::getOrderedExportableFields(), ilObjCourseGUI::infoScreen(), ilCourseUserFieldsGUI::save(), ilMemberExportGUI::show(), ilCourseUserFieldsGUI::show(), ilCourseRegisterGUI::showCourseDefinedFields(), and ilCourseAgreementGUI::showCourseDefinedFields().
{
foreach(ilCourseDefinedFieldDefinition::_getFieldIds($a_container_id,$a_sort) as $field_id)
{
$fields[] = new ilCourseDefinedFieldDefinition($a_container_id,$field_id);
}
return $fields ? $fields : array();
}
Here is the call graph for this function:
Here is the caller graph for this function:| static ilCourseDefinedFieldDefinition::_getRequiredFieldIds | ( | $ | a_obj_id | ) | [static] |
Get required filed id's.
public
| int | container id |
Definition at line 153 of file class.ilCourseDefinedFieldDefinition.php.
References $res.
Referenced by ilCourseUserData::_checkRequired().
{
global $ilDB;
$query = "SELECT * FROM crs_defined_field_definitions ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id)." ".
"AND field_required = 1";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$req_fields[] = $row->field_id;
}
return $req_fields ? $req_fields : array();
}
Here is the caller graph for this function:| static ilCourseDefinedFieldDefinition::_hasFields | ( | $ | a_container_id | ) | [static] |
Check if there are any define fields.
public
| int | container_id |
Definition at line 123 of file class.ilCourseDefinedFieldDefinition.php.
References _getFields().
Referenced by ilCourseAgreement::__construct(), ilCourseAgreement::agreementRequired(), ilObjCourseGUI::checkAgreement(), ilCourseRegisterGUI::checkAgreement(), ilCourseAgreementGUI::checkAgreement(), ilExportUserSettings::getOrderedExportableFields(), ilCourseRegisterGUI::setAccepted(), ilObjCourseGUI::setSubTabs(), ilCourseRegisterGUI::showAgreement(), and ilCourseAgreementGUI::showAgreement().
{
return count(ilCourseDefinedFieldDefinition::_getFields($a_container_id));
}
Here is the call graph for this function:
Here is the caller graph for this function:| static ilCourseDefinedFieldDefinition::_lookupName | ( | $ | a_field_id | ) | [static] |
Lookup field name.
public
| int | field_id |
Definition at line 224 of file class.ilCourseDefinedFieldDefinition.php.
References $res.
Referenced by ilMemberExport::createCSV().
{
global $ilDB;
$query = "SELECT * FROM crs_defined_field_definitions ".
"WHERE field_id = ".$ilDB->quote($a_field_id);
$res = $ilDB->query($query);
$row = $res->fetchRow(DB_FETCHMODE_OBJECT);
return $row->field_name ? $row->field_name : '';
}
Here is the caller graph for this function:| ilCourseDefinedFieldDefinition::appendValues | ( | $ | a_values | ) |
Append Values.
public
Definition at line 343 of file class.ilCourseDefinedFieldDefinition.php.
{
if(!is_array($a_values))
{
return false;
}
$this->values = array_unique(array_merge($this->values,$a_values));
sort($this->values);
return true;
}
| ilCourseDefinedFieldDefinition::delete | ( | ) |
Delete a field.
public
Definition at line 420 of file class.ilCourseDefinedFieldDefinition.php.
References ilCourseUserData::_deleteByField(), and getId().
{
global $ilDB;
include_once('Modules/Course/classes/Export/class.ilCourseUserData.php');
ilCourseUserData::_deleteByField($this->getId());
$query = "DELETE FROM crs_defined_field_definitions ".
"WHERE field_id = ".$this->db->quote($this->getId())." ";
$this->db->query($query);
}
Here is the call graph for this function:| ilCourseDefinedFieldDefinition::deleteValue | ( | $ | a_id | ) |
Delete value by id.
public
Definition at line 359 of file class.ilCourseDefinedFieldDefinition.php.
References update().
{
if(!isset($this->values[$a_id]))
{
return false;
}
unset($this->values[$a_id]);
array_merge($this->values);
$this->update();
return true;
}
Here is the call graph for this function:| ilCourseDefinedFieldDefinition::enableRequired | ( | $ | a_status | ) |
Definition at line 286 of file class.ilCourseDefinedFieldDefinition.php.
Referenced by read().
{
$this->required = $a_status;
}
Here is the caller graph for this function:| ilCourseDefinedFieldDefinition::getId | ( | ) |
Definition at line 241 of file class.ilCourseDefinedFieldDefinition.php.
Referenced by delete(), read(), and update().
{
return $this->id;
}
Here is the caller graph for this function:| ilCourseDefinedFieldDefinition::getIdByValue | ( | $ | a_value | ) |
Definition at line 277 of file class.ilCourseDefinedFieldDefinition.php.
{
return ($pos = array_search($a_value,$this->values) === false) ? -1 : $pos;
}
| ilCourseDefinedFieldDefinition::getName | ( | ) |
Definition at line 253 of file class.ilCourseDefinedFieldDefinition.php.
Referenced by save(), and update().
{
return $this->name;
}
Here is the caller graph for this function:| ilCourseDefinedFieldDefinition::getObjId | ( | ) |
Definition at line 237 of file class.ilCourseDefinedFieldDefinition.php.
Referenced by read(), save(), and update().
{
return $this->obj_id;
}
Here is the caller graph for this function:| ilCourseDefinedFieldDefinition::getType | ( | ) |
Definition at line 245 of file class.ilCourseDefinedFieldDefinition.php.
Referenced by save(), and update().
{
return $this->type;
}
Here is the caller graph for this function:| ilCourseDefinedFieldDefinition::getValueById | ( | $ | a_id | ) |
Definition at line 269 of file class.ilCourseDefinedFieldDefinition.php.
{
if(is_array($this->values) and array_key_exists($a_id,$this->values))
{
return $this->values[$a_id];
}
return '';
}
| ilCourseDefinedFieldDefinition::getValues | ( | ) |
Definition at line 261 of file class.ilCourseDefinedFieldDefinition.php.
Referenced by save(), and update().
{
return $this->values ? $this->values : array();
}
Here is the caller graph for this function:| ilCourseDefinedFieldDefinition::isRequired | ( | ) |
Definition at line 282 of file class.ilCourseDefinedFieldDefinition.php.
Referenced by save(), and update().
{
return (bool) $this->required;
}
Here is the caller graph for this function:| ilCourseDefinedFieldDefinition::prepareSelectBox | ( | ) |
Prepare an array of options for ilUtil::formSelect().
public
Definition at line 298 of file class.ilCourseDefinedFieldDefinition.php.
References $lng.
{
global $lng;
$options = array();
$options[-1] = $lng->txt('select_one');
foreach($this->values as $value)
{
$options[$value] = $value;
}
return $options;
}
| ilCourseDefinedFieldDefinition::prepareValues | ( | $ | a_values | ) |
Prepare values from POST.
| array | array of values public |
Definition at line 318 of file class.ilCourseDefinedFieldDefinition.php.
References ilUtil::stripSlashes().
{
$tmp_values = array();
if(!is_array($a_values))
{
return false;
}
foreach($a_values as $value)
{
$value = trim(ilUtil::stripSlashes($value));
if(strlen($value))
{
$tmp_values[] = $value;
}
}
sort($tmp_values);
return $tmp_values ? $tmp_values : array();
}
Here is the call graph for this function:| ilCourseDefinedFieldDefinition::read | ( | ) | [private] |
Read DB entries.
private
Definition at line 438 of file class.ilCourseDefinedFieldDefinition.php.
References $res, enableRequired(), getId(), getObjId(), setName(), setType(), and setValues().
Referenced by __construct().
{
$query = "SELECT * FROM crs_defined_field_definitions ".
"WHERE field_id = ".$this->db->quote($this->getId())." ".
"AND obj_id = ".$this->db->quote($this->getObjId())." ";
$res = $this->db->query($query);
$row = $res->fetchRow(DB_FETCHMODE_OBJECT);
$this->setName($row->field_name);
$this->setType($row->field_type);
$this->setValues(unserialize($row->field_values));
$this->enableRequired($row->field_required);
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilCourseDefinedFieldDefinition::save | ( | ) |
Save.
public
Definition at line 377 of file class.ilCourseDefinedFieldDefinition.php.
References $res, getName(), getObjId(), getType(), getValues(), and isRequired().
{
global $ilDB;
$query = "INSERT INTO crs_defined_field_definitions ".
"SET obj_id = ".$this->db->quote($this->getObjId()).", ".
"field_name = ".$this->db->quote($this->getName()).", ".
"field_type = ".$this->db->quote($this->getType()).", ".
"field_values = ".$this->db->quote(serialize($this->getValues())).", ".
"field_required = ".$ilDB->quote($this->isRequired())." ";
$res = $this->db->query($query);
$this->id = $this->db->getLastInsertId();
return true;
}
Here is the call graph for this function:| ilCourseDefinedFieldDefinition::setName | ( | $ | a_name | ) |
Definition at line 257 of file class.ilCourseDefinedFieldDefinition.php.
Referenced by read().
{
$this->name = $a_name;
}
Here is the caller graph for this function:| ilCourseDefinedFieldDefinition::setType | ( | $ | a_type | ) |
Definition at line 249 of file class.ilCourseDefinedFieldDefinition.php.
Referenced by read().
{
$this->type = $a_type;
}
Here is the caller graph for this function:| ilCourseDefinedFieldDefinition::setValues | ( | $ | a_values | ) |
Definition at line 265 of file class.ilCourseDefinedFieldDefinition.php.
Referenced by read().
{
$this->values = $a_values;
}
Here is the caller graph for this function:| ilCourseDefinedFieldDefinition::update | ( | ) |
Update a field.
public
Definition at line 398 of file class.ilCourseDefinedFieldDefinition.php.
References getId(), getName(), getObjId(), getType(), getValues(), and isRequired().
Referenced by deleteValue().
{
global $ilDB;
$query = "UPDATE crs_defined_field_definitions ".
"SET field_name = ".$this->db->quote($this->getName()).", ".
"field_type = ".$this->db->quote($this->getType()).", ".
"field_values = ".$this->db->quote(serialize($this->getValues())).", ".
"field_required = ".$ilDB->quote($this->isRequired())." ".
"WHERE field_id = ".$this->db->quote($this->getId())." ".
"AND obj_id = ".$this->db->quote($this->getObjId());
$this->db->query($query);
return true;
}
Here is the call graph for this function:
Here is the caller graph for this function:ilCourseDefinedFieldDefinition::$db [private] |
Definition at line 40 of file class.ilCourseDefinedFieldDefinition.php.
ilCourseDefinedFieldDefinition::$id [private] |
Definition at line 43 of file class.ilCourseDefinedFieldDefinition.php.
ilCourseDefinedFieldDefinition::$name [private] |
Definition at line 44 of file class.ilCourseDefinedFieldDefinition.php.
ilCourseDefinedFieldDefinition::$obj_id [private] |
Definition at line 41 of file class.ilCourseDefinedFieldDefinition.php.
ilCourseDefinedFieldDefinition::$required [private] |
Definition at line 47 of file class.ilCourseDefinedFieldDefinition.php.
ilCourseDefinedFieldDefinition::$type [private] |
Definition at line 45 of file class.ilCourseDefinedFieldDefinition.php.
ilCourseDefinedFieldDefinition::$values [private] |
Definition at line 46 of file class.ilCourseDefinedFieldDefinition.php.
1.7.1