ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilParameterAppender Class Reference

Class ilParameterAppender. More...

+ Collaboration diagram for ilParameterAppender:

Public Member Functions

 ilParameterAppender ($webr_id)
 Constructor public.
 getErrorCode ()
 setObjId ($a_obj_id)
 getObjId ()
 setName ($a_name)
 getName ()
 setValue ($a_value)
 getValue ()
 validate ()
 add ($a_link_id)
 delete ($a_param_id)
 _deleteAll ($a_webr_id)

Static Public Member Functions

static getParameterIds ($a_webr_id, $a_link_id)
 Get Parameter ids of link.
static _isEnabled ()
 Check if dynamic parameters are enabled.
static _append ($a_link_data)
static _getParams ($a_link_id)
 Get dynamic parameter definitions.
static parameterToInfo ($a_name, $a_value)
 Get info text describing an existing dynamic link.
static _getOptionSelect ()
 Get options as array.

Data Fields

 $webr_id = null
 $db = null
 $err = null

Detailed Description

Class ilParameterAppender.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
Id:
class.ilParameterAppender.php 25692 2010-09-15 09:44:16Z mwarkus

Definition at line 42 of file class.ilParameterAppender.php.

Member Function Documentation

static ilParameterAppender::_append (   $a_link_data)
static

Definition at line 186 of file class.ilParameterAppender.php.

References _getParams(), LINKS_LOGIN, LINKS_MATRICULATION, LINKS_SESSION_ID, and LINKS_USER_ID.

Referenced by ilObjLinkResourceListGUI\__readLink(), ilObjLinkResourceSubItemListGUI\getHTML(), and ilWebResourceLinkTableGUI\parse().

{
global $ilUser;
if(!is_array($a_link_data))
{
return false;
}
if(count($params = ilParameterAppender::_getParams($a_link_data['link_id'])))
{
// Check for prefix
foreach($params as $param_data)
{
if(!strpos($a_link_data['target'],'?'))
{
$a_link_data['target'] .= "?";
}
else
{
$a_link_data['target'] .= "&";
}
$a_link_data['target'] .= ($param_data['name']."=");
switch($param_data['value'])
{
$a_link_data['target'] .= (urlencode($ilUser->getLogin()));
break;
$a_link_data['target'] .= (session_id());
break;
$a_link_data['target'] .= ($ilUser->getId());
break;
$a_link_data['target'] .= ($ilUser->getMatriculation());
break;
}
}
}
return $a_link_data;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilParameterAppender::_deleteAll (   $a_webr_id)

Definition at line 278 of file class.ilParameterAppender.php.

References $ilDB, $query, and $res.

{
global $ilDB;
$query = "DELETE FROM webr_params WHERE webr_id = ".
$ilDB->quote((int) $a_webr_id ,'integer');
$res = $ilDB->manipulate($query);
return true;
}
static ilParameterAppender::_getOptionSelect ( )
static

Get options as array.

Returns

Definition at line 293 of file class.ilParameterAppender.php.

References $lng, LINKS_LOGIN, LINKS_MATRICULATION, LINKS_SESSION_ID, and LINKS_USER_ID.

Referenced by ilWebResourceEditableLinkTableGUI\fillRow(), and ilObjLinkResourceGUI\initFormLink().

{
global $lng;
return array(0 => $lng->txt('links_select_one'),
LINKS_USER_ID => $lng->txt('links_user_id'),
LINKS_LOGIN => $lng->txt('links_user_name'),
LINKS_SESSION_ID => $lng->txt('links_session_id'),
LINKS_MATRICULATION => $lng->txt('matriculation')
);
}

+ Here is the caller graph for this function:

static ilParameterAppender::_getParams (   $a_link_id)
static

Get dynamic parameter definitions.

Parameters
int$a_link_id
Returns

Definition at line 236 of file class.ilParameterAppender.php.

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

Referenced by _append(), ilLinkResourceItems\cloneItems(), ilObjLinkResourceGUI\initFormLink(), ilWebResourceEditableLinkTableGUI\parse(), ilwebresourceTest\testWebResourceParameters(), and ilLinkResourceItems\toXML().

{
global $ilDB;
$res = $ilDB->query("SELECT * FROM webr_params WHERE link_id = ".
$ilDB->quote((int) $a_link_id ,'integer'));
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$params[$row->param_id]['name'] = $row->name;
$params[$row->param_id]['value'] = $row->value;
}
return count($params) ? $params : array();
}

+ Here is the caller graph for this function:

static ilParameterAppender::_isEnabled ( )
static
ilParameterAppender::add (   $a_link_id)

Definition at line 137 of file class.ilParameterAppender.php.

References $ilDB, $query, $res, getName(), getObjId(), and getValue().

{
global $ilDB;
if(!$a_link_id)
{
return false;
}
if(!strlen($this->getName() or !strlen($this->getValue())))
{
return false;
}
$next_id = $ilDB->nextId('webr_params');
$query = "INSERT INTO webr_params (param_id,webr_id,link_id,name,value) ".
"VALUES( ".
$ilDB->quote($next_id,'integer').", ".
$ilDB->quote($this->getObjId() ,'integer').", ".
$ilDB->quote($a_link_id ,'integer').", ".
$ilDB->quote($this->getName() ,'text').", ".
$ilDB->quote($this->getValue() ,'integer').
")";
$res = $ilDB->manipulate($query);
return $next_id;
}

+ Here is the call graph for this function:

ilParameterAppender::delete (   $a_param_id)

Definition at line 164 of file class.ilParameterAppender.php.

References $ilDB, $query, $res, and getObjId().

Referenced by ilObjLinkResourceGUI\deleteParameterFormObject(), and ilObjLinkResourceGUI\deleteParameterObject().

{
global $ilDB;
$query = "DELETE FROM webr_params ".
"WHERE param_id = ".$ilDB->quote($a_param_id ,'integer')." ".
"AND webr_id = ".$ilDB->quote($this->getObjId(),'integer');
$res = $ilDB->manipulate($query);
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilParameterAppender::getErrorCode ( )

Definition at line 83 of file class.ilParameterAppender.php.

References $err.

{
return $this->err;
}
ilParameterAppender::getName ( )

Definition at line 103 of file class.ilParameterAppender.php.

References $name.

Referenced by add(), and validate().

{
return $this->name;
}

+ Here is the caller graph for this function:

ilParameterAppender::getObjId ( )

Definition at line 94 of file class.ilParameterAppender.php.

References $webr_id.

Referenced by add(), and delete().

{
}

+ Here is the caller graph for this function:

static ilParameterAppender::getParameterIds (   $a_webr_id,
  $a_link_id 
)
static

Get Parameter ids of link.

Parameters
int$a_webr_id
int$a_link_id
Returns

Definition at line 68 of file class.ilParameterAppender.php.

References $ilDB, $query, $res, $row, and DB_FETCHMODE_ASSOC.

Referenced by ilWebLinkXmlParser\handlerBeginTag().

{
global $ilDB;
$query = "SELECT * FROM webr_params ".
"WHERE webr_id = ".$ilDB->quote($a_webr_id,'integer')." ".
"AND link_id = ".$ilDB->quote($a_link_id,'integer');
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
{
$params[] = $row['param_id'];
}
return (array) $params;
}

+ Here is the caller graph for this function:

ilParameterAppender::getValue ( )

Definition at line 111 of file class.ilParameterAppender.php.

Referenced by add(), and validate().

{
return $this->value;
}

+ Here is the caller graph for this function:

ilParameterAppender::ilParameterAppender (   $webr_id)

Constructor public.

Definition at line 54 of file class.ilParameterAppender.php.

References $ilDB, and $webr_id.

{
global $ilDB;
$this->webr_id = $webr_id;
$this->db =& $ilDB;
}
static ilParameterAppender::parameterToInfo (   $a_name,
  $a_value 
)
static

Get info text describing an existing dynamic link.

Parameters
string$a_name
int$a_value
Returns

Definition at line 257 of file class.ilParameterAppender.php.

References LINKS_LOGIN, LINKS_MATRICULATION, LINKS_SESSION_ID, and LINKS_USER_ID.

Referenced by ilWebResourceEditableLinkTableGUI\fillRow(), and ilObjLinkResourceGUI\initFormLink().

{
$info = $a_name;
switch($a_value)
{
return $info.'=USER_ID';
return $info.'=SESSION_ID';
return $info.'=LOGIN';
return $info.'=MATRICULATION';
}
return '';
}

+ Here is the caller graph for this function:

ilParameterAppender::setName (   $a_name)

Definition at line 99 of file class.ilParameterAppender.php.

Referenced by ilObjLinkResourceGUI\updateLinksObject().

{
$this->name = $a_name;
}

+ Here is the caller graph for this function:

ilParameterAppender::setObjId (   $a_obj_id)

Definition at line 89 of file class.ilParameterAppender.php.

{
$this->webr_id = $a_obj_id;
}
ilParameterAppender::setValue (   $a_value)

Definition at line 107 of file class.ilParameterAppender.php.

{
$this->value = $a_value;
}
ilParameterAppender::validate ( )

Definition at line 116 of file class.ilParameterAppender.php.

References getName(), getValue(), LINKS_ERR_NO_NAME, LINKS_ERR_NO_NAME_VALUE, and LINKS_ERR_NO_VALUE.

{
if(!strlen($this->getName()) and !$this->getValue())
{
return false;
}
if(!strlen($this->getName()))
{
$this->err = LINKS_ERR_NO_NAME;
return false;
}
if(!$this->getValue())
{
$this->err = LINKS_ERR_NO_VALUE;
return false;
}
return true;
}

+ Here is the call graph for this function:

Field Documentation

ilParameterAppender::$db = null

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

ilParameterAppender::$err = null

Definition at line 47 of file class.ilParameterAppender.php.

Referenced by getErrorCode().

ilParameterAppender::$webr_id = null

Definition at line 44 of file class.ilParameterAppender.php.

Referenced by getObjId(), and ilParameterAppender().


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