ILIAS  Release_4_0_x_branch Revision 61816
 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 _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@da.nosp@m.tabay.nosp@m..de
Version
Id:
class.ilParameterAppender.php 21678 2009-09-15 12:39:01Z smeyer

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

Member Function Documentation

static ilParameterAppender::_append (   $a_link_data)
static

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

References $params, _getParams(), LINKS_LOGIN, 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;
}
}
}
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 249 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 264 of file class.ilParameterAppender.php.

References $lng, LINKS_LOGIN, 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'));
}

+ 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 210 of file class.ilParameterAppender.php.

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

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

{
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 115 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 142 of file class.ilParameterAppender.php.

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

{
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:

ilParameterAppender::getErrorCode ( )

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

References $err.

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

Definition at line 81 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 72 of file class.ilParameterAppender.php.

References $webr_id.

Referenced by add(), and delete().

{
}

+ Here is the caller graph for this function:

ilParameterAppender::getValue ( )

Definition at line 89 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 53 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 231 of file class.ilParameterAppender.php.

References LINKS_LOGIN, 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 '';
}

+ Here is the caller graph for this function:

ilParameterAppender::setName (   $a_name)

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

{
$this->name = $a_name;
}
ilParameterAppender::setObjId (   $a_obj_id)

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

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

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

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

Definition at line 94 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 44 of file class.ilParameterAppender.php.

ilParameterAppender::$err = null

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

Referenced by getErrorCode().

ilParameterAppender::$webr_id = null

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

Referenced by getObjId(), and ilParameterAppender().


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