Skip to content
Permalink
Browse files

Fixes issue 133

  • Loading branch information...
Theophilix committed May 7, 2019
1 parent 07ec84d commit f670e27d6c2ebc126a50e3f7cc9da186e5e627ce
@@ -280,6 +280,4 @@ COM_EVENTTABLEEDIT_TABLE_HEIGHT_DESC="Tabellenhöhe (in px)"

COM_EVENTTABLEEDIT_ADD_OPTION_LIST="Vorgeschaltete Option einfügen"
COM_EVENTTABLEEDIT_GLOBAL_OPTIONS="Optionen eintragen"
COM_EVENTTABLEEDIT_CORRESPONDING_TABLE="Korrespondierende Tabelle auswählen"
COM_EVENTTABLEEDIT_SHOW_SELECTEDOPTION_TO_USER="Zeige ausgewählte Option dem User"
COM_EVENTTABLEEDIT_SHOW_SELECTEDOPTION_TO_ADMIN="Zeige ausgewählte Option dem Admin"
COM_EVENTTABLEEDIT_CORRESPONDING_TABLE="Korrespondierende Tabelle auswählen"
@@ -271,6 +271,4 @@ COM_EVENTTABLEEDIT_TABLE_HEIGHT_DESC="Table Height (in px)"

COM_EVENTTABLEEDIT_ADD_OPTION_LIST="Add Option List"
COM_EVENTTABLEEDIT_GLOBAL_OPTIONS="Enter global options"
COM_EVENTTABLEEDIT_CORRESPONDING_TABLE="Choose corresponding table"
COM_EVENTTABLEEDIT_SHOW_SELECTEDOPTION_TO_USER="Show selected global option to user"
COM_EVENTTABLEEDIT_SHOW_SELECTEDOPTION_TO_ADMIN="Show selected global option to admin"
COM_EVENTTABLEEDIT_CORRESPONDING_TABLE="Choose corresponding table"
@@ -84,29 +84,6 @@
value="0">JNO</option>
</field>

<field name="show_selected_option_to_user"
type="radio"
default="1"
class="inputbox"
label="COM_EVENTTABLEEDIT_SHOW_SELECTEDOPTION_TO_USER"
description="COM_EVENTTABLEEDIT_SHOW_SELECTEDOPTION_TO_USER">
<option
value="1">JYES</option>
<option
value="0">JNO</option>
</field>
<field name="show_selected_option_to_admin"
type="radio"
default="1"
class="inputbox"
label="COM_EVENTTABLEEDIT_SHOW_SELECTEDOPTION_TO_ADMIN"
description="COM_EVENTTABLEEDIT_SHOW_SELECTEDOPTION_TO_ADMIN">
<option
value="1">JYES</option>
<option
value="0">JNO</option>
</field>

<field id="published"
name="published"
type="list"
@@ -295,16 +295,8 @@ function checkics(val){
.correspond_delete{background: transparent;border: none;text-decoration: underline;cursor: pointer;}
</style>
</li>
<li class="show_selected_option_to_user">
<?php echo $this->form->getLabel('show_selected_option_to_user'); ?>
<?php echo $this->form->getInput('show_selected_option_to_user'); ?>
</li>

<li class="show_selected_option_to_admin">
<?php echo $this->form->getLabel('show_selected_option_to_admin'); ?>
<?php echo $this->form->getInput('show_selected_option_to_admin'); ?>
</li>



@@ -122,26 +122,6 @@ function update($parent)
$db->setQuery($query);
$db->query();
}
$query = "SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '".$prefix."eventtableedit_details' AND COLUMN_NAME = 'show_selected_option_to_user'";
$db->setQuery($query);
$data = $db->loadObject();
if(empty($data)){
$query = 'ALTER TABLE `#__eventtableedit_details`
ADD `show_selected_option_to_user` tinyint(1) NOT NULL AFTER `corresptable`,
COMMENT=""';
$db->setQuery($query);
$db->query();
}
$query = "SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '".$prefix."eventtableedit_details' AND COLUMN_NAME = 'show_selected_option_to_admin'";
$db->setQuery($query);
$data = $db->loadObject();
if(empty($data)){
$query = 'ALTER TABLE `#__eventtableedit_details`
ADD `show_selected_option_to_admin` tinyint(1) NOT NULL AFTER `show_selected_option_to_user`,
COMMENT=""';
$db->setQuery($query);
$db->query();
}
echo '<p>' . JText::_('COM_EVENTTABLEEDIT_UPDATE_TEXT') . '</p>';
}
@@ -109,7 +109,7 @@ function save(){
}
}
if($corresponding_table && $tableeditpostalldata->show_selected_option_to_admin){
if($corresponding_table){
$reserved_app = $reserved_app . ' (' . $corresponding_table_name . ')';
}
$Update = "UPDATE #__eventtableedit_rows_".$tableeditpost_option." SET ".$findupdatecell."='".$reserved_app."' WHERE id='".$rowupdates."'";
@@ -631,10 +631,15 @@ public function getCell($rowId, $cell) {
$ret = array();
$colName = $this->getColumnInfo($cell);
$query = 'SELECT ' . $colName['head'] . ' AS content FROM #__eventtableedit_rows_' . $this->id .
if($table = $this->checkAppointmentAndSession()){
$query = 'SELECT ' . $colName['head'] . ' AS content FROM #__eventtableedit_rows_' . $table .
' WHERE id = ' . $rowId;
//echo $query;
}else{
$query = 'SELECT ' . $colName['head'] . ' AS content FROM #__eventtableedit_rows_' . $this->id .
' WHERE id = ' . $rowId;
}
//echo $query;die;
$this->db->setQuery($query);
$cell = $this->db->loadResult();
@@ -660,9 +665,13 @@ public function getCell_save($rowId, $cell) {
$ret = array();
$colName = $this->getColumnInfo($cell);
$query = 'SELECT ' . $colName['head'] . ' AS content FROM #__eventtableedit_rows_' . $this->id .
if($table = $this->checkAppointmentAndSession()){
$query = 'SELECT ' . $colName['head'] . ' AS content FROM #__eventtableedit_rows_' . $table .
' WHERE id = ' . $rowId;
}else{
$query = 'SELECT ' . $colName['head'] . ' AS content FROM #__eventtableedit_rows_' . $this->id .
' WHERE id = ' . $rowId;
}
//echo $query;
$this->db->setQuery($query);
$cell = $this->db->loadResult();
@@ -699,10 +708,15 @@ public function saveCell($rowId, $cell, $content) {
$breaks = array("<br />","<br>","<br/>","<br /> ","<br> ","<br/> ");
$content = str_ireplace($breaks, "<br />", $content);
}
$query = 'UPDATE #__eventtableedit_rows_' . $this->id .
' SET ' . $headName . ' = ' . $content . ", timestamp = '" . $timestamp . "' WHERE id = " . $rowId;
if($table = $this->checkAppointmentAndSession()){
$breaks = array("<br />","<br>","<br/>","<br /> ","<br> ","<br/> ");
$content = str_ireplace($breaks, "", $content);
$query = 'UPDATE #__eventtableedit_rows_' . $table .
' SET ' . $headName . ' = ' . $content . ", timestamp = '" . $timestamp . "' WHERE id = " . $rowId;
}else{
$query = 'UPDATE #__eventtableedit_rows_' . $this->id .
' SET ' . $headName . ' = ' . $content . ", timestamp = '" . $timestamp . "' WHERE id = " . $rowId;
}
$this->db->setQuery($query);
$this->db->query();
@@ -763,10 +777,17 @@ public function deleteRow($rowId) {
* Get information about a column
*/
private function getColumnInfo($cell) {
$colQuery = 'SELECT CONCAT(\'head_\', a.id) AS head, datatype FROM #__eventtableedit_heads AS a' .
if($table = $this->checkAppointmentAndSession()){
$colQuery = 'SELECT CONCAT(\'head_\', a.id) AS head, datatype FROM #__eventtableedit_heads AS a' .
' WHERE a.table_id = ' . $table .
' ORDER BY a.ordering ASC' .
' LIMIT ' . $cell . ', 1';
}else{
$colQuery = 'SELECT CONCAT(\'head_\', a.id) AS head, datatype FROM #__eventtableedit_heads AS a' .
' WHERE a.table_id = ' . $this->id .
' ORDER BY a.ordering ASC' .
' LIMIT ' . $cell . ', 1';
}
//echo $colQuery;
$this->db->setQuery($colQuery);
@@ -809,4 +830,23 @@ public function getColumnInfoPublic($cell) {
return $this->db->loadAssoc();
}
public function checkAppointmentAndSession(){
$query = 'SELECT * ' .
' FROM #__eventtableedit_details' .
' WHERE id = ' . $this->id;
$this->db->setQuery($query);
$table = $this->db->loadObject();
if($table->normalorappointment){
$session = JFactory::getSession();
$corresponding_table = $session->get('corresponding_table');
if($corresponding_table){
return $corresponding_table;
}else{
return false;
}
}else{
return false;
}
}
}
@@ -38,6 +38,9 @@
}
?>
<style type="text/css">
th.evth50.tablesaw-priority-persist.tablesaw-sortable-head.sort_col {
display: none!important;
}
table#etetable-table tr td.highlighted {
background-color:#c4c1c1;
border: 1px solid #dddddd;
@@ -47,7 +50,7 @@
}
.eventtableedit{position:relative;}
#adminForm{position:relative;min-height: 100px;}
<?php if(!$this->option_id){
<?php if(!$this->option_id && $this->item->add_option_list){
?>
.etetable-outtable, input.btn.btn-primary.appointmentsbtn{display:none;}
<?php

0 comments on commit f670e27

Please sign in to comment.
You can’t perform that action at this time.