Skip to content
This repository has been archived by the owner on Jul 25, 2022. It is now read-only.

Commit

Permalink
Merge pull request #17 from studer-raimann/develop
Browse files Browse the repository at this point in the history
fixed db-update-script on install from scratch & added a few more checks to make sure, get-parameters are arrays
  • Loading branch information
chfsx committed Jul 15, 2015
2 parents 3a74a47 + 7a979bb commit 0d25129
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 16 deletions.
8 changes: 5 additions & 3 deletions classes/EntryTypes/Ctrl/class.ctrlmmEntryCtrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,11 @@ public function getLink() {
$link .= '&ref_id=' . $this->getRefId();
}

foreach($this->getGetParams() as $entry) {
if($entry[self::PARAM_NAME] != "") {
$link .= '&'.$entry[self::PARAM_NAME].'='.ctrlmmUserDataReplacer::parse($entry[self::PARAM_VALUE]);
if(is_array($this->getGetParams())) {
foreach($this->getGetParams() as $entry) {
if($entry[self::PARAM_NAME] != "") {
$link .= '&'.$entry[self::PARAM_NAME].'='.ctrlmmUserDataReplacer::parse($entry[self::PARAM_VALUE]);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion classes/EntryTypes/Ctrl/class.ctrlmmEntryCtrlGUI.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
require_once('./Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/CtrlMainMenu/classes/Entry/class.ctrlmmEntryGUI.php');
require_once('Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/CtrlMainMenu/classes/Helper/class.ctrlmmMultiLIneInputGUI.php');
require_once('./Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/CtrlMainMenu/classes/Helper/class.ctrlmmMultiLineInputGUI.php');
require_once('./Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/CtrlMainMenu/classes/Helper/class.ctrlmmUserDataReplacer.php');

/**
Expand Down
10 changes: 7 additions & 3 deletions classes/EntryTypes/Link/class.ctrlmmEntryLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,15 @@ public function __construct($primary_key = 0) {

public function getLink() {
$param_string = "";
foreach($this->getGetParams() as $entry) {
if($entry[self::PARAM_NAME] != "") {
$param_string .= '&'.$entry[self::PARAM_NAME].'='.ctrlmmUserDataReplacer::parse($entry[self::PARAM_VALUE]);

if(is_array($this->getGetParams())) {
foreach($this->getGetParams() as $entry) {
if($entry[self::PARAM_NAME] != "") {
$param_string .= '&'.$entry[self::PARAM_NAME].'='.ctrlmmUserDataReplacer::parse($entry[self::PARAM_VALUE]);
}
}
}

return $this->link.$param_string;
}

Expand Down
8 changes: 5 additions & 3 deletions classes/EntryTypes/Refid/class.ctrlmmEntryRefid.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,11 @@ public function isActive() {
*/
public function getLink() {
$param_array = array();
foreach($this->getGetParams() as $entry) {
if($entry[self::PARAM_NAME] != "") {
$param_array[$entry[self::PARAM_NAME]] = ctrlmmUserDataReplacer::parse($entry[self::PARAM_VALUE]);
if(is_array($this->getGetParams())) {
foreach($this->getGetParams() as $entry) {
if($entry[self::PARAM_NAME] != "") {
$param_array[$entry[self::PARAM_NAME]] = ctrlmmUserDataReplacer::parse($entry[self::PARAM_VALUE]);
}
}
}

Expand Down
5 changes: 3 additions & 2 deletions classes/Helper/class.ctrlmmMultiLineInputGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,9 @@ public function insert(&$a_tpl) {
$tpl->addCss($this->getTemplateDir() . '/templates/css/multi_line_input.css');

$output .= $this->render(0, true);
if ($this->getMulti() && count($this->line_values) > 0) {
foreach ($this->line_values as $run => $data) {

if($this->getMulti() && is_array($this->line_values) && count($this->line_values) > 0) {
foreach ($this->line_values as $run=>$data) {
$object = $this;
$object->setValue($data);
$output .= $object->render($run);
Expand Down
1 change: 0 additions & 1 deletion classes/class.ctrlmmData.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ class ctrlmmData extends ActiveRecord {
/**
* @return string
* @description Return the Name of your Database Table
* @deprecated
*/
static function returnDbTableName() {
return self::TABLE_NAME;
Expand Down
2 changes: 1 addition & 1 deletion plugin.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
$id = 'ctrlmm';
$version = '3.2.00';
$version = '3.2.01';
$ilias_min_version = '4.4.000';
$ilias_max_version = '5.1.999';
$responsible = 'Fabian Schmid';
Expand Down
16 changes: 14 additions & 2 deletions sql/dbupdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,19 @@

require_once('./Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/CtrlMainMenu/classes/class.ctrlmmData.php');

$query = "ALTER TABLE `".ctrlmmData::returnDbTableName()."` ADD `data_type` VARCHAR(10) NOT NULL DEFAULT '".ctrlmmData::DATA_TYPE_STRING."' AFTER `data_value`;";
$ilDB->query($query);
if ($ilDB->tableColumnExists(ctrlmmData::returnDbTableName(), 'data_type')) {
$ilDB->modifyTableColumn(ctrlmmData::returnDbTableName(), 'data_type', array(
'notnull' => true,
'default' => ctrlmmData::DATA_TYPE_STRING,
));
} else {
$ilDB->addTableColumn(ctrlmmData::returnDbTableName(), 'data_type', array(
'type' => 'text',
'notnull' => true,
'length' => 10,
'default' => ctrlmmData::DATA_TYPE_STRING,
));
}


?>

0 comments on commit 0d25129

Please sign in to comment.