noalyss  Version-9
Public Member Functions | Data Fields | Protected Attributes | Private Attributes
Manage_Table_SQL Class Reference

Purpose is to propose a librairy to display a table content and allow to update and delete row , handle also the ajax call thanks the script managetable.js. More...

+ Inheritance diagram for Manage_Table_SQL:
+ Collaboration diagram for Manage_Table_SQL:

Public Member Functions

 __construct (Data_SQL $p_table)
 
 add_json_param ($p_attribute, $p_value)
 Add json parameter to the current one. More...
 
 ajax_delete ()
 Delete a record and return an XML answer for ajax. More...
 
 ajax_input ($p_status="OK")
 send an xml with input of the object, create an xml answer. More...
 
 ajax_save ()
 Save the record from Request into the DB and returns an XML to update the Html Element. More...
 
 can_append_row ()
 return false if the append of the row is forbidden More...
 
 can_delete_row ()
 return false if the delete of the row is forbidden More...
 
 can_update_row ()
 return false if the update of the row is forbidden More...
 
 check ()
 
 count_error ()
 returns the nb of errors found More...
 
 create_js_script ()
 we must create first the javascript if we want to update, insert or delete rows. More...
 
 delete ()
 delete a datarow , the id must be have set before More...
 
 display_error ()
 Display a list of the error collected. More...
 
 display_icon_del ($p_row)
 
 display_icon_mod ($p_row)
 
 display_row ($p_row)
 display a data row in the table, with the order defined in a_order and depending of the visibility of the column More...
 
 display_row_custom ($p_key, $p_value, $p_id=0)
 When displaying a row, if a column has the type "custom" , we can call this function to display properly the value including the tag "<td>". More...
 
 display_table ($p_order="", $p_array=NULL)
 display the data of the table More...
 
 display_table_header ()
 display the column header excepted the not visible one and in the order defined with $this->a_order More...
 
 execute_query ($p_order="", $p_array=NULL)
 execute the query (Data_SQL.seek), called by display_table More...
 
 from_request ()
 get the data from http request strip the not update or not visible data to their initial value. More...
 
 get_button_add_top ()
 
 get_col_option ($p_key)
 add extra to column, normally class , javascript or style More...
 
 get_col_sort ()
 When adding an element , it is column we checked to insert before,. More...
 
 get_col_type ($p_key)
 return the type of a column More...
 
 get_current_pos ($p_key)
 get the position of a column More...
 
 get_current_row ()
 Return the current row printed in display_row. More...
 
 get_dialog_box ()
 
 get_dialogbox_style ()
 return the db_style More...
 
 get_error ($p_col)
 retrieve the error message More...
 
 get_header_option ($p_key)
 add extra to column Header, normally class , javascript or style More...
 
 get_icon_del ()
 
 get_icon_mod ()
 
 get_js_variable ()
 Get the object name. More...
 
 get_json ()
 
 get_object_name ()
 
 get_order ()
 
 get_property_updatable ($p_key)
 return True if the column is updatable otherwise false More...
 
 get_property_visible ($p_key)
 return True if the column is visible otherwise false More...
 
 get_search_table ()
 Get if we can search in the table. More...
 
 get_sort_column ()
 return the column to sort More...
 
 get_table ()
 
 getCssClass ()
 
 getTitle ()
 
 input ()
 display into a dialog box the datarow in order to be appended or modified. More...
 
 input_custom ($p_key, $p_value)
 this function let you create your own input , for example for a ITEXT , a IRADIO , ... More...
 
 insert ()
 insert a new value More...
 
 move ($p_key, $p_idx)
 if we change a column order , the order of the other columns is impacted. More...
 
 param_set ($p_json)
 Set the parameter of the object (gDossier, ac, plugin_code...) @detail By default , only gDossier will be set . More...
 
 save ()
 save the Data_SQL Object The noalyss_SQL is not empty More...
 
 send_header ()
 send the XML headers for the ajax call More...
 
 set_append_row ($p_value)
 Enable or disable the appending of rows. More...
 
 set_button_add_top ($button_add_top)
 
 set_callback ($p_file)
 set the callback function that is passed to javascript More...
 
 set_col_label ($p_key, $p_display)
 set the name to display for a column More...
 
 set_col_option ($p_key, $p_value)
 add extra to column, normally class or style More...
 
 set_col_sort ($p_num)
 When adding an element ,we place it thanks the DOM Attribute sort_value set it to -1 if you want one to append. More...
 
 set_col_tips ($p_key, $p_comment)
 Set the info for a column, use Icon_Action::infobulle the message are in message_javascript.php. More...
 
 set_col_type ($p_key, $p_value, $p_array=NULL)
 set the type of a column , it will change in the input db box , the select must supply an array of possible values [val=> , label=>] with the variable $this->key_name->a_value More...
 
 set_current_row ($current_row)
 set the current row printed in display_row More...
 
 set_delete_row ($p_value)
 Enable or disable the deletion of rows. More...
 
 set_dialog_box ($dialog_box)
 
 set_dialogbox_style ($db_style)
 Dialog box style , by default {position: "fixed", top: '15', width: "auto", "margin-left": "20%"}. More...
 
 set_error ($p_col, $p_message)
 set the error message for a wrong input More...
 
 set_header_option ($p_key, $p_value)
 add extra to column Header, normally class or style More...
 
 set_icon_del ($pString)
 Set the icon to delete at the right or left of the row. More...
 
 set_icon_mod ($pString)
 Set the icon to modify at the right ,the first col or left of the row. More...
 
 set_json ($p_json)
 Set the parameter of the object (gDossier, ac, plugin_code...) @detail By default , only gDossier will be set . More...
 
 set_object_name ($p_object_name)
 Set the object_name. More...
 
 set_order ($p_order)
 
 set_pk ($p_id)
 set the id value of a data row and load from the db More...
 
 set_property_updatable ($p_key, $p_value)
 set a column of the data row updatable or not More...
 
 set_property_visible ($p_key, $p_value)
 set a column of the data row visible or not More...
 
 set_search_table ($search_table)
 Set the table searchable or not. More...
 
 set_sort_column ($p_col)
 set the column to sort by default More...
 
 set_table (Data_SQL $p_noalyss_sql)
 
 set_update_row ($p_value)
 Enable or disable the updating of rows. More...
 
 set_value ($p_key, $p_value)
 
 setCssClass ($p_class)
 
 setTitle ($p_title)
 Set the title of the diabox , default is Donnée. More...
 
 show_error ($p_col)
 
 update ()
 

Data Fields

const UPDATABLE =1
 
const VISIBLE =2
 

Protected Attributes

 $a_info
 Array with the infotip. More...
 
 $a_label_displaid
 Label of the col. of the datarow. More...
 
 $a_order
 order of the col More...
 
 $a_prop
 property for each col. More...
 
 $a_select
 Possible value if a_type is a SELECT. More...
 
 $a_type
 Type of the column : date , select ... Only in input. More...
 
 $aerror
 Array containing the error of the input data. More...
 
 $col_sort
 when inserting, it is the column to sort,-1 to disable it and append only More...
 
 $dialog_box
 ID of the dialog box which display the result of the ajax calls. More...
 
 $json_parameter
 Default parameter to add (gDossier...), sent to the ajax callback. More...
 
 $object_name
 Object_name is used for the javascript , it is the row id to update or delete. More...
 
 $row_append
 Flag to indicate if rows can be added. More...
 
 $row_delete
 Flag to indicate if rows can be deleted. More...
 
 $row_update
 Flag to indicate if rows can be updated. More...
 
 $search_table
 boolean , by default true ,it is possible to search in the table, More...
 
 $sort_column
 javascript sort on this column , if empty there is no js sort More...
 
 $table
 Object Data_SQL. More...
 
 $title
 

Private Attributes

 $a_col_option
 in display_row and display_custom_row, it is the current row which is used More...
 
 $a_header_option
 Extra to add to the column Header : CSS Style , CSS class, javascript ,... More...
 
 $button_add_top
 place of the button add on the top, by default true More...
 
 $cssclass
 < give the title of the diabox , default is Data More...
 
 $current_row
 CSS class for the dialog box. More...
 
 $dialogbox_style
 style of the dialog box More...
 
 $icon_del
 place of right or left the icon update or mod, default right, accepted value=left,right More...
 
 $icon_mod
 place of right or left the icon update or mod, default right, accepted value=left,right,first column for mod More...
 

Detailed Description

Purpose is to propose a librairy to display a table content and allow to update and delete row , handle also the ajax call thanks the script managetable.js.

Code for ajax , here we see the ajax_input for creating a dg box

$objet->set_pk($p_id);
// It is very important to set the name of the javascript variable
// Contained in the http_input variable "ctl"
$objet->set_object_name($objet_name);
// Set the ajax to call
$objet->set_callback("ajax.php");
// Build the json object for JS
$plugin_code=$http->request("plugin_code");
$ac=$http->request("ac");
$sa=$http->request("sa");
$aJson=array("gDossier"=>Dossier::id(),
"ac"=>$ac,
"plugin_code"=>$plugin_code,
"sa"=>$sa,
"sb"=>$sb
);
$json=json_encode($aJson);
$objet->param_set($json);
// Display the box
header('Content-type: text/xml; charset=UTF-8');
$xml=$objet->ajax_input();
echo $xml->save_XML();
See also
ManageTable.js
ajax_accounting.php
sorttable.js
Examples
ajax_manage_table_sql.php, and test_manage_table_sql.php.

Definition at line 65 of file manage_table_sql.class.php.

Constructor & Destructor Documentation

◆ __construct()

Manage_Table_SQL::__construct ( Data_SQL  $p_table)

Reimplemented in Forecast_Item_MTable, Anc_Account_Table, and Forecast_Category_MTable.

Definition at line 106 of file manage_table_sql.class.php.

107  {
108  $this->table=$p_table;
109  $order=0;
110  foreach ($this->table->name as $key=> $value)
111  {
112 
113  $this->a_label_displaid[$value]=$key;
114  $this->a_order[$order]=$value;
115  $this->a_prop[$value]=self::UPDATABLE|self::VISIBLE;
116  $this->a_type[$value]=$this->table->type[$value];
117  $this->a_select[$value]=null;
118  $this->a_col_option[$value]="";
119  $this->a_header_option[$value]="";
120  $order++;
121  }
122  $this->object_name=uniqid("tbl");
123  $this->row_delete=TRUE;
124  $this->row_update=TRUE;
125  $this->row_append=TRUE;
126  $this->callback="ajax.php";
127  $this->json_parameter=json_encode(array("gDossier"=>Dossier::id(),
128  "op"=>"managetable"));
129  $this->aerror=[];
130  $this->icon_mod="right";
131  $this->icon_del="right";
132  $this->col_sort=0;
133  // By default no js sort
134  $this->sort_column="";
135  $this->dialog_box="dtr";
136  $this->dialogbox_style=array();
137  $this->search_table=true;
138  $this->button_add_top=true;
139  $this->title=_("Donnée");
140  $this->cssclass="inner_box";
141 
142  }

References $order, $value, Dossier\id(), table, title, and VISIBLE.

+ Here is the call graph for this function:

Member Function Documentation

◆ add_json_param()

Manage_Table_SQL::add_json_param (   $p_attribute,
  $p_value 
)

Add json parameter to the current one.

Definition at line 468 of file manage_table_sql.class.php.

468  {
469  $x=json_decode($this->json_parameter,TRUE);
470  $x[$p_attribute]=$p_value;
471  $this->json_parameter=json_encode($x, JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES|JSON_NUMERIC_CHECK);
472  }

Referenced by Mobile_Device_MTable\__construct(), Forecast_Category_MTable\set_forecast_id(), Forecast_Item_MTable\set_forecast_id(), and Mobile_Device_MTable\set_profile_id().

◆ ajax_delete()

Manage_Table_SQL::ajax_delete ( )

Delete a record and return an XML answer for ajax.

If a check is needed before deleting you can override this->delete and throw an exception if the deleting is not allowed

Returns
\DOMDocument

Definition at line 1396 of file manage_table_sql.class.php.

1397  {
1398  $status="NOK";
1399  $xml=new DOMDocument('1.0', "UTF-8");
1400  try
1401  {
1402  $this->delete();
1403  $status="OK";
1404  $s1=$xml->createElement("status", $status);
1405  $ctl=$this->object_name."_".$this->table->get_pk_value();
1406  $s2=$xml->createElement("ctl_row", $ctl);
1407  $s3=$xml->createElement("html", _("Effacé"));
1408  $s4=$xml->createElement("ctl", $this->object_name);
1409 
1410  $root=$xml->createElement("data");
1411  $root->appendChild($s1);
1412  $root->appendChild($s2);
1413  $root->appendChild($s3);
1414  $root->appendChild($s4);
1415  }
1416  catch (Exception $ex)
1417  {
1418  $s1=$xml->createElement("status", "NOK");
1419  $s2=$xml->createElement("ctl",
1420  $this->object_name."_".$this->table->get_pk_value());
1421  $s3=$xml->createElement("html", $ex->getMessage());
1422  $s4=$xml->createElement("ctl", $this->object_name);
1423 
1424  $root=$xml->createElement("data");
1425  $root->appendChild($s1);
1426  $root->appendChild($s2);
1427  $root->appendChild($s3);
1428  $root->appendChild($s4);
1429  }
1430  $xml->appendChild($root);
1431  return $xml;
1432  }

References $ctl, $ex, $root, $status, $xml, and table.

◆ ajax_input()

Manage_Table_SQL::ajax_input (   $p_status = "OK")

send an xml with input of the object, create an xml answer.

It will call Manage_Table_SQL.input to display the input , but if that function returns false, the "save" button will disappear but the form can be submitted with enter.

See also
input XML tag
Returns
DomDocument

Definition at line 1308 of file manage_table_sql.class.php.

1309  {
1310  $xml=new DOMDocument("1.0", "UTF-8");
1311  $xml->createElement("status", $p_status);
1312  try
1313  {
1314  $status=$p_status;
1315 
1316  ob_start();
1317 
1318  echo HtmlInput::title_box($this->getTitle(), $this->dialog_box,"close","","y","y");
1319  printf('<form id="frm%s_%s" method="POST" onsubmit="%s.save(\'frm%s_%s\');return false;">',
1320  $this->object_name, $this->table->get_pk_value(),
1321  $this->object_name, $this->object_name,
1322  $this->table->get_pk_value());
1323  $can_update=$this->input();
1324  $can_update =( $can_update===false) ? false:true;
1325  // JSON param to hidden
1326  echo HtmlInput::json_to_hidden($this->json_parameter);
1327  echo HtmlInput::hidden("p_id", $this->table->get_pk_value());
1328  // button Submit and cancel
1329  $close=sprintf("\$('%s').remove()", $this->dialog_box);
1330  // display error if any
1331  $this->display_error();
1332  echo '<ul class="aligned-block">';
1333  // form readonly
1334  if ( $can_update ) {
1335  echo '<li>',
1336  HtmlInput::submit('update', _("Sauver")),
1337  '</li>';
1338  }
1339  echo '<li>',
1340  HtmlInput::button_action(_("Annuler"), $close, "", "smallbutton"),
1341  '</li>',
1342  '</ul>';
1343  echo "</form>";
1344 
1345 
1346  $html=ob_get_contents();
1347  ob_end_clean();
1348 
1349  $s1=$xml->createElement("status", $status);
1350  $ctl=$this->object_name."_".$this->table->get_pk_value();
1351  $s2=$xml->createElement("ctl_row", $ctl);
1352  $s4=$xml->createElement("ctl", $this->object_name);
1353  $s3=$xml->createElement("html");
1354  $t1=$xml->createTextNode($html);
1355  $s3->appendChild($t1);
1356 
1357  $root=$xml->createElement("data");
1358  $root->appendChild($s1);
1359  $root->appendChild($s2);
1360  $root->appendChild($s3);
1361  $root->appendChild($s4);
1362  }
1363  catch (Exception $ex)
1364  {
1365  $s1=$xml->createElement("status", "NOK");
1366  $s3=$xml->createElement("ctl", $this->object_name);
1367  $s2=$xml->createElement("ctl_row",
1368  $this->object_name."_".$this->table->get_pk_value());
1369  $s4=$xml->createElement("html", $ex->getTraceAsString());
1370 
1371  $root=$xml->createElement("data");
1372  $root->appendChild($s1);
1373  $root->appendChild($s2);
1374  $root->appendChild($s3);
1375  $root->appendChild($s4);
1376  }
1377  $xml->appendChild($root);
1378  return $xml;
1379  }

References $close, $ctl, $ex, $html, $root, $status, $xml, HtmlInput\button_action(), display_error(), getTitle(), HtmlInput\hidden(), input(), HtmlInput\json_to_hidden(), HtmlInput\submit(), table, and HtmlInput\title_box().

Referenced by ajax_save().

+ Here is the call graph for this function:

◆ ajax_save()

Manage_Table_SQL::ajax_save ( )

Save the record from Request into the DB and returns an XML to update the Html Element.

The function check() will be called before saving

See also
check
Returns
\DOMDocument

Definition at line 1234 of file manage_table_sql.class.php.

1235  {
1236 
1237  $status="NOK";
1238  $xml=new DOMDocument('1.0', "UTF-8");
1239  try
1240  {
1241  // fill up object with $_REQUEST
1242  $this->from_request();
1243  // Check if the data are valid , if not then display the
1244  // input values with the error message
1245  //
1246  if ($this->check()==false)
1247  {
1248  $xml=$this->ajax_input("NOK");
1249  return $xml;
1250  }
1251  else
1252  {
1253  // Data are valid so we can save them
1254  $this->save();
1255  // compose the answer
1256  $status="OK";
1257  $s1=$xml->createElement("status", $status);
1258  $ctl=$this->object_name."_".$this->table->get_pk_value();
1259  $s2=$xml->createElement("ctl_row", $ctl);
1260  $s4=$xml->createElement("ctl", $this->object_name);
1261  ob_start();
1262  $this->table->load();
1263  $array=$this->table->to_array();
1264  $this->display_row($array);
1265  $html=ob_get_contents();
1266  ob_end_clean();
1267  $s3=$xml->createElement("html");
1268  $t1=$xml->createTextNode($html);
1269  $s3->appendChild($t1);
1270  }
1271 
1272  $root=$xml->createElement("data");
1273  $root->appendChild($s1);
1274  $root->appendChild($s2);
1275  $root->appendChild($s3);
1276  $root->appendChild($s4);
1277  $xml->appendChild($root);
1278  }
1279  catch (Exception $ex)
1280  {
1281  $s1=$xml->createElement("status", "NOK");
1282  $s2=$xml->createElement("ctl_row",
1283  $this->object_name."_".$this->table->get_pk_value());
1284  $s4=$xml->createElement("ctl", $this->object_name);
1285  $s3=$xml->createElement("html", $ex->getTraceAsString());
1286  $root=$xml->createElement("data");
1287  $root->appendChild($s1);
1288  $root->appendChild($s2);
1289  $root->appendChild($s3);
1290  $root->appendChild($s4);
1291  $xml->appendChild($root);
1292  }
1293  return $xml;
1294  }

References $array, $ctl, $ex, $html, $root, $status, $xml, ajax_input(), check(), display_row(), from_request(), save(), and table.

+ Here is the call graph for this function:

◆ can_append_row()

Manage_Table_SQL::can_append_row ( )

return false if the append of the row is forbidden

Definition at line 599 of file manage_table_sql.class.php.

600  {
601 
602  return $this->row_append;
603  }

References $row_append.

Referenced by display_table().

◆ can_delete_row()

Manage_Table_SQL::can_delete_row ( )

return false if the delete of the row is forbidden

Definition at line 641 of file manage_table_sql.class.php.

642  {
643  return $this->row_delete;
644  }

References $row_delete.

Referenced by display_icon_del(), and display_table_header().

◆ can_update_row()

Manage_Table_SQL::can_update_row ( )

return false if the update of the row is forbidden

Definition at line 570 of file manage_table_sql.class.php.

571  {
572 
573  return $this->row_update;
574  }

References $row_update.

Referenced by display_icon_mod(), display_row(), and display_table_header().

◆ check()

Manage_Table_SQL::check ( )
   @brief This function can be overrided to check the data before 
   inserting , updating or removing, above an example of an overidden check.

   Usually , you get the row of the table (get_table) , you check the conditions
   if an condition is not met then you set the error with $this->set_error 

   if there are error (returns false otherwise true

   @see set_error get_error count_error
   @return boolean
function check()
{
global $cn;
$table=$this->get_table();
$is_error=0;
$insert=false;
// sect_codename must be unique
if ( $table->exist() > 0) {
$insert=1;
}
$count=$cn->get_value(" select count(*) from syndicat.treasurer where tr_login=$1 and sect_id=$2 and tr_id<>$3",
array(
$table->tr_login,
$table->section_full_name,
$table->tr_id
));
if ($count > 0 ) {
$this->set_error("section_full_name",_("Ce trésorier a déjà accès à cette section"));
$is_error++;
}
if ( $is_error > 0 ) return false;
return true;
}

Reimplemented in Tva_Rate_MTable, Forecast_Item_MTable, Acc_Plan_MTable, Card_Attribut_MTable, Mobile_Device_MTable, Currency_MTable, Acc_Report_MTable, Action_Document_Type_MTable, Forecast_Category_MTable, Anc_Account_Table, Payment_Method_MTable, Template_Card_Category, and Parameter_Extra_MTable.

Definition at line 351 of file manage_table_sql.class.php.

352  {
353  return true;
354  }

Referenced by ajax_save().

◆ count_error()

Manage_Table_SQL::count_error ( )

returns the nb of errors found

Definition at line 296 of file manage_table_sql.class.php.

297  {
298  return count($this->aerror);
299  }

Referenced by Mobile_Device_MTable\check(), Card_Attribut_MTable\check(), Forecast_Item_MTable\check(), and Tva_Rate_MTable\check().

◆ create_js_script()

Manage_Table_SQL::create_js_script ( )

we must create first the javascript if we want to update, insert or delete rows.

It is the default script .

Definition at line 516 of file manage_table_sql.class.php.

517  {
518  $style=json_encode($this->dialogbox_style);
519  echo "
520  <script>
521  var {$this->object_name}=new ManageTable(\"{$this->table->table}\");
522  {$this->object_name}.set_callback(\"{$this->callback}\");
523  {$this->object_name}.param_add({$this->json_parameter});
524  {$this->object_name}.set_sort({$this->get_col_sort()});
525  {$this->object_name}.set_control(\"{$this->get_dialog_box()}\");
526  {$this->object_name}.set_style($style);
527  {$this->object_name}.cssclass=\"{$this->cssclass}\";
528  </script>
529 
530  ";
531  }

References $style.

◆ delete()

Manage_Table_SQL::delete ( )

delete a datarow , the id must be have set before

See also
from_request

Reimplemented in Currency_MTable, Tva_Rate_MTable, Card_Attribut_MTable, Action_Document_Type_MTable, Anc_Account_Table, and Template_Card_Category.

Definition at line 1385 of file manage_table_sql.class.php.

1386  {
1387  $this->table->delete();
1388  }

References table.

◆ display_error()

Manage_Table_SQL::display_error ( )

Display a list of the error collected.

See also
get_error set_error

Definition at line 1486 of file manage_table_sql.class.php.

1487  {
1488  $nb_order=count($this->a_order);
1489  if (count($this->aerror)==0)
1490  return;
1491  echo "<span class=\"notice\">Liste erreurs :</span>";
1492  for ($i=0; $i<$nb_order; $i++)
1493  {
1494  $key=$this->a_order[$i];
1495  $label=$this->a_label_displaid[$key];
1496  $error=$this->get_error($key);
1497  $error=($error=="")?"":"<span class=\"notice\" style=\"font-weight:normal;font-style:normal;display:block\">".h($label)." : ".h($this->get_error($key))."</span>";
1498 
1499  echo $error;
1500  }
1501  echo "</ul>";
1502  }

References $error, $i, $label, get_error(), and h.

Referenced by ajax_input().

+ Here is the call graph for this function:

◆ display_icon_del()

Manage_Table_SQL::display_icon_del (   $p_row)

Definition at line 956 of file manage_table_sql.class.php.

957  {
958  if ($this->can_delete_row())
959  {
960  echo "<td>";
961  $js=sprintf("%s.remove('%s','%s');", $this->object_name,
962  $p_row[$this->table->primary_key], $this->object_name
963  );
964  echo Icon_Action::trash(uniqid(), $js);
965  echo "</td>";
966  }
967  }

References $js, can_delete_row(), table, and Icon_Action\trash().

Referenced by display_row().

+ Here is the call graph for this function:

◆ display_icon_mod()

Manage_Table_SQL::display_icon_mod (   $p_row)

Definition at line 943 of file manage_table_sql.class.php.

944  {
945  if ($this->can_update_row())
946  {
947  echo "<td>";
948  $js=sprintf("%s.input('%s','%s');", $this->object_name,
949  $p_row[$this->table->primary_key], $this->object_name
950  );
951  echo Icon_Action::modify(uniqid(), $js);
952  echo "</td>";
953  }
954  }

References $js, can_update_row(), Icon_Action\modify(), and table.

Referenced by display_row().

+ Here is the call graph for this function:

◆ display_row()

Manage_Table_SQL::display_row (   $p_row)

display a data row in the table, with the order defined in a_order and depending of the visibility of the column

Parameters
array$p_rowcontains a row from the database
See also
set_col_type
input_custom
display_table
display_row_custom

From database

Reimplemented in Card_Attribut_MTable, Currency_MTable, Forecast_Item_MTable, Anc_Account_Table, and Acc_Plan_MTable.

Definition at line 978 of file manage_table_sql.class.php.

979  {
980 
981  $pk_id=$p_row[$this->table->primary_key];
982  printf('<tr id="%s_%s">', $this->object_name,
983  $pk_id)
984  ;
985 
986  if ($this->icon_mod=="left")
987  $this->display_icon_mod($p_row);
988  if ($this->icon_del=="left")
989  $this->display_icon_del($p_row);
990 
991  $nb_order=count($this->a_order);
992  for ($i=0; $i<$nb_order; $i++)
993  {
994  $this->current_row=$p_row;
995  $v=$this->a_order[$i];
996 
997  if ($i==0&&$this->icon_mod=="first"&&$this->can_update_row())
998  {
999  $js=sprintf("onclick=\"%s.input('%s','%s');\"", $this->object_name,
1000  $pk_id, $this->object_name);
1001  $td=($i == $this->col_sort ) ? sprintf('<td sorttable_customkey="X%s" class="%s">',
1002  $p_row[$v],$this->a_col_option[$v]):"<td>";
1003  echo $td.HtmlInput::anchor($p_row[$v], "", $js).'</td>';
1004  }
1005  elseif ( $i == $this->col_sort && $this->get_property_visible($v) )
1006  {
1007  if ( $this->get_col_type($v) == 'text') {
1008  echo td($p_row[$v],sprintf(' sorttable_customkey="X%s" ',$p_row[$v]));
1009  } elseif ( $this->get_col_type($v) == 'numeric') {
1010  echo td($p_row[$v],$this->a_col_option[$v],$p_row[$v]);
1011  } elseif ($this->get_col_type($v)=="custom") {
1012  // For custom col
1013  echo $this->display_row_custom($v,$p_row[$v],$pk_id);
1014  }else {
1015  echo td($p_row[$v],sprintf(' sorttable_customkey="X%s" ',$p_row[$v]),$this->a_col_option[$v]);
1016 
1017  }
1018  }
1019  elseif ( ! $this->get_property_visible($v)) {
1020  continue;
1021  }
1022  else
1023  {
1024  if ($this->get_col_type($v)=="select")
1025  {
1026  /**
1027  * From database
1028  */
1029  $idx=$p_row[$v];
1030  /*
1031  * Check if index exists
1032  */
1033  $array_to_search=$this->a_select[$v];
1034  $value=$p_row[$v];
1035 
1036  $nb_search=(is_array($array_to_search))?count($array_to_search):0;
1037  $found=FALSE;
1038  for ($e=0; $e<$nb_search; $e++)
1039  {
1040  if (isset($array_to_search[$e]['value'])&&$array_to_search[$e]['value']==$value)
1041  {
1042  $found=TRUE;
1043  echo td($array_to_search[$e]['label'],$this->a_col_option[$v]);
1044  }
1045  }
1046 
1047  if (!$found)
1048  {
1049  echo td("--");
1050  }
1051  } elseif ($this->get_col_type($v)=="custom") {
1052  // For custom col
1053  echo $this->display_row_custom($v,$p_row[$v],$pk_id);
1054  }
1055  else {
1056  echo td($p_row[$v], $this->a_col_option[$v]);
1057  }
1058  }
1059  }
1060  if ($this->icon_mod=="right")
1061  $this->display_icon_mod($p_row);
1062  if ($this->icon_del=="right")
1063  $this->display_icon_del($p_row);
1064 
1065 
1066 
1067  echo '</tr>';
1068  }

References $col_sort, $e, $i, $idx, $js, $value, can_update_row(), display_icon_del(), display_icon_mod(), display_row_custom(), get_col_type(), get_property_visible(), table, and td().

Referenced by ajax_save(), and display_table().

+ Here is the call graph for this function:

◆ display_row_custom()

Manage_Table_SQL::display_row_custom (   $p_key,
  $p_value,
  $p_id = 0 
)

When displaying a row, if a column has the type "custom" , we can call this function to display properly the value including the tag "<td>".

You can get the full array from display_row via get_current_row() or reload from db thanks $p_id

Parameters
$p_keystring key name
$p_valuestring value
int$p_idid of the row , usually the pk of Data_SQL (optional default 0)
See also
input_custom
set_type
Note
must return a string which will be in surrounded by td in the function display_row
Returns
string

Reimplemented in Mobile_Device_MTable, Acc_Report_MTable, and Card_Attribut_MTable.

Definition at line 1101 of file manage_table_sql.class.php.

1101  {
1102  return td($p_value);
1103  }

References td().

Referenced by display_row().

+ Here is the call graph for this function:

◆ display_table()

Manage_Table_SQL::display_table (   $p_order = "",
  $p_array = NULL 
)

display the data of the table

Parameters
$p_orderis the cond or order of the rows, if empty the primary key will be used
$p_arrayarray of the bind variables
Note
the function create_js_script MUST be called before this function

Reimplemented in Forecast_Item_MTable, and Acc_Report_MTable.

Definition at line 798 of file manage_table_sql.class.php.

799  {
802  if ($this->can_append_row()==TRUE && $this->button_add_top == true)
803  {
804  echo HtmlInput::button_action(" "._("Ajout"),
805  sprintf("%s.input('-1','%s')",
806  $this->object_name,
807  $this->object_name), "xx", "smallbutton", BUTTONADD);
808  }
809  $nb_order=count($this->a_order);
810  $virg=""; $result="";
811  // filter only on visible column
812  $visible=0;
813  for ($e=0; $e<$nb_order; $e++)
814  {
815  if ($this->get_property_visible($this->a_order[$e])==TRUE)
816  {
817  $result.=$virg."$visible";
818  $virg=",";
819  $visible++;
820  }
821  }
822  if ( $this->get_search_table() )
823  {
824  echo _('Cherche')." ".HtmlInput::filter_table("tb".$this->object_name, $result, 1);
825  }
826 
827  // Set a sort on a column if sort_column is not empty
828  if ( $this->sort_column =="")
829  {
830  printf('<table class="result" id="tb%s">', $this->object_name);
831  } else {
832  printf('<table class="result sortable" id="tb%s">', $this->object_name);
833  }
834  $this->display_table_header();
835  echo '<tbody>';
836  for ($i=0; $i<$nb; $i++)
837  {
839  $this->display_row($row);
840  }
841  echo '</tbody>';
842  echo "</table>";
843  if ($this->can_append_row()==TRUE)
844  {
845  echo HtmlInput::button_action(" "._("Ajout"),
846  sprintf("%s.input('-1','%s')",
847  $this->object_name,
848  $this->object_name), "xx", "smallbutton", BUTTONADD);
849  }
850  printf('<script> alternate_row_color("tb%s");</script>',
851  $this->object_name);
852  }

References $e, $i, $nb, $p_array, $p_order, $result, $ret, $row, HtmlInput\button_action(), BUTTONADD, can_append_row(), display_row(), display_table_header(), execute_query(), DatabaseCore\fetch_array(), HtmlInput\filter_table(), get_property_visible(), get_search_table(), and DatabaseCore\num_row().

+ Here is the call graph for this function:

◆ display_table_header()

Manage_Table_SQL::display_table_header ( )

display the column header excepted the not visible one and in the order defined with $this->a_order

Definition at line 858 of file manage_table_sql.class.php.

859  {
860  $nb=count($this->a_order);
861  echo '<thead>';
862  echo "<tr>";
863 
864  if ($this->can_update_row() && $this->icon_mod=="left")
865  {
866  echo th(" ", 'style="width:40px" class="sorttable_nosort"');
867  }
868  if ($this->can_delete_row() && $this->icon_del=="left")
869  {
870  echo th(" ", 'style="width:40px" class="sorttable_nosort"');
871  }
872  for ($i=0; $i<$nb; $i++)
873  {
874 
875  $key=$this->a_order[$i];
876  $sorted="";
877  if ( $key == $this->sort_column) {
878  $sorted=' class="sorttable_sorted"';
879  }
880 
881  $style=$this->a_header_option[$key];
882  if ($this->get_property_visible($key)==true ) {
883  echo th("", $sorted.$style, $this->a_label_displaid[$key]);
884  }
885  }
886  if ($this->can_update_row() && $this->icon_mod=="right")
887  {
888  echo th(" ", 'style="width:40px" class="sorttable_nosort"');
889  }
890  if ($this->can_delete_row() && $this->icon_del=="right")
891  {
892  echo th(" ", 'style="width:40px" class="sorttable_nosort" ');
893  }
894  echo "</tr>";
895  echo '</thead>';
896  }

References $i, $nb, $style, can_delete_row(), can_update_row(), get_property_visible(), and th().

Referenced by display_table().

+ Here is the call graph for this function:

◆ execute_query()

Manage_Table_SQL::execute_query (   $p_order = "",
  $p_array = NULL 
)

execute the query (Data_SQL.seek), called by display_table

Parameters
string(default empty) $p_order SQL string added to DatabaseCore::seek
array(default null) $p_array Array for the SQL string
See also
Data_SQL.seek
Returns
pgsql resource

Definition at line 782 of file manage_table_sql.class.php.

783  {
784  if ($p_order=="")
785  {
786  $p_order="order by {$this->table->primary_key}";
787  }
788  $ret=$this->table->seek($p_order, $p_array);
789  return $ret;
790  }

References $p_array, $p_order, $ret, and table.

Referenced by display_table().

◆ from_request()

Manage_Table_SQL::from_request ( )

get the data from http request strip the not update or not visible data to their initial value.

Before saving , it is important to set the pk and load from db

See also
set_pk

Reimplemented in Currency_MTable, Forecast_Item_MTable, Operation_Predef_MTable, and Action_Document_Type_MTable.

Definition at line 926 of file manage_table_sql.class.php.

927  {
928  $nb=count($this->a_order);
929  $http=new HttpInput();
930  for ($i=0; $i<$nb; $i++)
931  {
932 
933  $key=$this->a_order[$i];
934  if ($this->get_property_visible($key)==TRUE&&$this->get_property_updatable($key)
935  ==TRUE)
936  {
937  $v=$http->request($this->a_order[$i],"string","");
938  $this->table->$key=strip_tags($v);
939  }
940  }
941  }

References $http, $i, $nb, get_property_updatable(), get_property_visible(), and table.

Referenced by ajax_save().

+ Here is the call graph for this function:

◆ get_button_add_top()

Manage_Table_SQL::get_button_add_top ( )

Definition at line 765 of file manage_table_sql.class.php.

766  {
767  return $this->button_add_top;
768  }

References $button_add_top.

◆ get_col_option()

Manage_Table_SQL::get_col_option (   $p_key)

add extra to column, normally class , javascript or style

Parameters
string$p_keycolumn name
See also
set_col_option

Definition at line 360 of file manage_table_sql.class.php.

361  {
362  if (!isset($this->a_type[$p_key]))
363  throw new Exception("invalid key $p_key");
364 
365  return $this->a_col_option[$p_col];
366  }

◆ get_col_sort()

Manage_Table_SQL::get_col_sort ( )

When adding an element , it is column we checked to insert before,.

Returns
none

Definition at line 231 of file manage_table_sql.class.php.

231  {
232  return $this->col_sort;
233  }

References $col_sort.

◆ get_col_type()

Manage_Table_SQL::get_col_type (   $p_key)

return the type of a column

Parameters
$p_keycol name
See also
set_col_type

Definition at line 447 of file manage_table_sql.class.php.

448  {
449  if (!isset($this->a_type[$p_key]))
450  throw new Exception("invalid key");
451 
452  return $this->a_type[$p_key];
453  }

Referenced by display_row().

◆ get_current_pos()

Manage_Table_SQL::get_current_pos (   $p_key)

get the position of a column

Parameters
$p_keydata column

Definition at line 705 of file manage_table_sql.class.php.

706  {
707  $nb_order=count($this->a_order);
708  for ($i=0; $i<$nb_order; $i++)
709  if ($this->a_order[$i]==$p_key)
710  return $i;
711  throw new Exception("COL INVAL ".$p_key);
712  }

References $i.

Referenced by move().

◆ get_current_row()

Manage_Table_SQL::get_current_row ( )

Return the current row printed in display_row.

Returns
array

Definition at line 1073 of file manage_table_sql.class.php.

1074  {
1075  return $this->current_row;
1076  }

References $current_row.

◆ get_dialog_box()

Manage_Table_SQL::get_dialog_box ( )
Returns
mixed

Definition at line 212 of file manage_table_sql.class.php.

213  {
214  return $this->dialog_box;
215  return $this;
216  }

References $dialog_box.

◆ get_dialogbox_style()

Manage_Table_SQL::get_dialogbox_style ( )

return the db_style

Returns
array

Definition at line 193 of file manage_table_sql.class.php.

194  {
195  return $this->dialogbox_style;
196  }

References $dialogbox_style.

◆ get_error()

Manage_Table_SQL::get_error (   $p_col)

retrieve the error message

Parameters
$p_colcolumn name
Returns
string with message or empty if no error
See also
input

Definition at line 306 of file manage_table_sql.class.php.

307  {
308  if (isset($this->aerror[$p_col]))
309  return $this->aerror[$p_col];
310  return "";
311  }

Referenced by display_error(), Tva_Rate_MTable\input(), Template_Card_Category\input(), input(), and show_error().

◆ get_header_option()

Manage_Table_SQL::get_header_option (   $p_key)

add extra to column Header, normally class , javascript or style

Parameters
string$p_keycolumn name
See also
set_col_option

Definition at line 393 of file manage_table_sql.class.php.

394  {
395  if (!isset($this->a_type[$p_key]))
396  throw new Exception("invalid key $p_key");
397 
398  return $this->a_header_option[$p_col];
399  }

◆ get_icon_del()

Manage_Table_SQL::get_icon_del ( )

Definition at line 260 of file manage_table_sql.class.php.

261  {
262  return $this->icon_del;
263  }

References $icon_del.

◆ get_icon_mod()

Manage_Table_SQL::get_icon_mod ( )

Definition at line 256 of file manage_table_sql.class.php.

257  {
258  return $this->icon_mod;
259  }

References $icon_mod.

◆ get_js_variable()

Manage_Table_SQL::get_js_variable ( )

Get the object name.

: return the object name , it is useful it the javascript will return coded without the create_js_script function

See also
create_js_script

Definition at line 461 of file manage_table_sql.class.php.

462  {
463  return $this->object_name;
464  }

References $object_name.

◆ get_json()

Manage_Table_SQL::get_json ( )

Definition at line 473 of file manage_table_sql.class.php.

474  {
475  return $this->json_parameter;
476  }

References $json_parameter.

◆ get_object_name()

Manage_Table_SQL::get_object_name ( )

Definition at line 477 of file manage_table_sql.class.php.

477  {
478  return $this->object_name;
479  }

References $object_name.

Referenced by Operation_Predef_MTable\display_button_add(), and Template_Card_Category\input().

◆ get_order()

Manage_Table_SQL::get_order ( )

Definition at line 273 of file manage_table_sql.class.php.

274  {
275  return $this->a_order;
276  }

References $a_order.

◆ get_property_updatable()

Manage_Table_SQL::get_property_updatable (   $p_key)

return True if the column is updatable otherwise false

Parameters
$p_keydata column
Examples
test_manage_table_sql.php.

Definition at line 650 of file manage_table_sql.class.php.

651  {
652  $val=$this->a_prop[$p_key]&self::UPDATABLE;
653  if ($val==self::UPDATABLE)
654  return true;
655  return false;
656  }

References $val, and UPDATABLE.

Referenced by from_request(), Tva_Rate_MTable\input(), input(), and set_property_updatable().

◆ get_property_visible()

Manage_Table_SQL::get_property_visible (   $p_key)

return True if the column is visible otherwise false

Parameters
$p_keydata column
Examples
test_manage_table_sql.php.

Definition at line 682 of file manage_table_sql.class.php.

683  {
684  $val=$this->a_prop[$p_key]&self::VISIBLE;
685  if ($val===self::VISIBLE)
686  return true;
687  return false;
688  }

References $val, and VISIBLE.

Referenced by display_row(), display_table(), display_table_header(), from_request(), Tva_Rate_MTable\input(), input(), and set_property_visible().

◆ get_search_table()

Manage_Table_SQL::get_search_table ( )

Get if we can search in the table.

Returns
boolean

Definition at line 165 of file manage_table_sql.class.php.

166  {
167  return $this->search_table;
168  }

References $search_table.

Referenced by display_table().

◆ get_sort_column()

Manage_Table_SQL::get_sort_column ( )

return the column to sort

Definition at line 907 of file manage_table_sql.class.php.

908  {
909  return $this->sort_column;
910  }

References $sort_column.

◆ get_table()

Manage_Table_SQL::get_table ( )

◆ getCssClass()

Manage_Table_SQL::getCssClass ( )

Definition at line 146 of file manage_table_sql.class.php.

146  {
147  return $this->cssclass;
148  }

References $cssclass.

◆ getTitle()

Manage_Table_SQL::getTitle ( )

Definition at line 157 of file manage_table_sql.class.php.

158  {
159  return $this->title;
160  }

References $title.

Referenced by ajax_input().

◆ input()

Manage_Table_SQL::input ( )

display into a dialog box the datarow in order to be appended or modified.

Can be override if you need a more complex form or add elements with "set_order" before calling this function. This function does not add the form , only the table.

It returns true , if it is not readyonly and the form will have a "save" button, if it returns nothing or false then there is no save button, nor form, the content is then readonly

See also
get_error , set_error

Reimplemented in Acc_Plan_MTable, Action_Document_Type_MTable, Forecast_Item_MTable, Template_Card_Category, Operation_Predef_MTable, Currency_MTable, Forecast_Category_MTable, Tva_Rate_MTable, and Tag_Group_MTable.

Definition at line 1117 of file manage_table_sql.class.php.

1118  {
1119  $nb_order=count($this->a_order);
1120  echo "<table>";
1121  for ($i=0; $i<$nb_order; $i++)
1122  {
1123  echo "<tr>";
1124  $key=$this->a_order[$i];
1125  $label=$this->a_label_displaid[$key];
1126  $value=$this->table->get($key);
1127  $error=$this->get_error($key);
1129  if ($this->get_property_visible($key)===TRUE)
1130  {
1131  // Label
1132  $info="";
1133  if ( isset($this->a_info[$key])) {
1134  $info=Icon_Action::infobulle($this->a_info[$key]);
1135  }
1136  // Label
1137  echo "<td> {$label} {$info} {$error}</td>";
1138 
1139  if ($this->get_property_updatable($key)==TRUE)
1140  {
1141  echo "<td>";
1142  if ($this->a_type[$key]=="select")
1143  {
1144  $select=new ISelect($key);
1145  $select->value=$this->a_select[$key];
1146  $select->selected=$value;
1147  echo $select->input();
1148  }
1149  elseif ($this->a_type[$key]=="text")
1150  {
1151  $text=new IText($key);
1152  $text->value=$value;
1153  $min_size=(strlen($value)<30)?30:strlen($value)+5;
1154  $text->size=$min_size;
1155  echo $text->input();
1156  }
1157  elseif ($this->a_type[$key]=="numeric") // number 2 decimale
1158  {
1159  $text=new INum($key);
1160  $text->value=$value;
1161  $min_size=(strlen($value)<10)?10:strlen($value)+1;
1162  $text->size=$min_size;
1163  echo $text->input();
1164  }
1165  elseif ($this->a_type[$key]=="numeric4") // number 4 decimale
1166  {
1167  $text=new INum($key);
1168  $text->prec=4;
1169  $text->value=$value;
1170  $min_size=(strlen($value)<10)?10:strlen($value)+1;
1171  $text->size=$min_size;
1172  echo $text->input();
1173  }
1174  elseif ($this->a_type[$key]=="numeric6") // number 6 decimale
1175  {
1176  $text=new INum($key);
1177  $text->prec=6;
1178  $text->value=$value;
1179  $min_size=(strlen($value)<10)?10:strlen($value)+1;
1180  $text->size=$min_size;
1181  echo $text->input();
1182  }
1183  elseif ($this->a_type[$key]=="date")
1184  {
1185  $text=new IDate($key);
1186  $text->value=$value;
1187  $min_size=10;
1188  $text->size=$min_size;
1189  echo $text->input();
1190  } elseif ($this->a_type[$key]=="custom")
1191  {
1192  $this->input_custom($key,$value);
1193  }
1194  echo "</td>";
1195  }
1196  else
1197  {
1198  printf('<td>%s %s</td>', h($value),
1199  HtmlInput::hidden($key, $value)
1200  );
1201  }
1202  }
1203  echo "</tr>";
1204  }
1205  echo "</table>";
1206  return true;
1207  }

References $error, $i, $label, $select, $text, $value, HtmlInput\errorbulle(), get_error(), get_property_updatable(), get_property_visible(), h, HtmlInput\hidden(), Icon_Action\infobulle(), input_custom(), and table.

Referenced by ajax_input().

+ Here is the call graph for this function:

◆ input_custom()

Manage_Table_SQL::input_custom (   $p_key,
  $p_value 
)

this function let you create your own input , for example for a ITEXT , a IRADIO , ...

it must be override , there is not default

function input_custom($p_key,$p_value) {
switch ($p_key) {
case 'name':
$w=new ICard($p_key,$p_value);
$w->input();
break;
}
}
Parameters
string$p_keyname of the column
string$p_valuecurrent value
Returns
nothing

Reimplemented in Acc_Plan_MTable, Payment_Method_MTable, Card_Attribut_MTable, Mobile_Device_MTable, and Acc_Report_MTable.

Definition at line 1225 of file manage_table_sql.class.php.

1225  {
1226  throw new Exception(__FILE__.":".__LINE__."-"._("non implémenté"));
1227  }

Referenced by input().

◆ insert()

Manage_Table_SQL::insert ( )

insert a new value

See also
set_pk_value
from_request

Definition at line 1456 of file manage_table_sql.class.php.

1457  {
1458  $this->table->insert();
1459  }

References table.

◆ move()

Manage_Table_SQL::move (   $p_key,
  $p_idx 
)

if we change a column order , the order of the other columns is impacted.

With a_order[0,1,2,3]=[x,y,z,a] if we move the column x (idx=0) to 2
we must obtain [y,z,x,a]

Parameters
string$p_keydata column
integer$p_idxnew location

Definition at line 724 of file manage_table_sql.class.php.

725  {
726  // get current position of p_key
727  $cur_pos=$this->get_current_pos($p_key);
728 
729  if ($cur_pos==$p_idx)
730  return;
731 
732  if ($cur_pos<$p_idx)
733  {
734  $nb_order=count($this->a_order);
735  for ($i=0; $i<$nb_order; $i++)
736  {
737  // if col_name is not the searched one we continue
738  if ($this->a_order[$i]!=$p_key)
739  continue;
740  if ($p_idx==$i)
741  continue;
742  // otherwise we swap with i+1
743  $old=$this->a_order[$i+1];
744  $this->a_order[$i]=$this->a_order[$i+1];
745  $this->a_order[$i+1]=$p_key;
746  }
747  } else
748  {
749 
750  $nb_order=count($this->a_order)-1;
751  for ($i=$nb_order; $i>0; $i--)
752  {
753  // if col_name is not the searched one we continue
754  if ($this->a_order[$i]!=$p_key)
755  continue;
756  if ($p_idx==$i)
757  continue;
758  // otherwise we swap with i+1
759  $old=$this->a_order[$i-1];
760  $this->a_order[$i]=$this->a_order[$i-1];
761  $this->a_order[$i-1]=$p_key;
762  }
763  }
764  }

References $i, $old, and get_current_pos().

+ Here is the call graph for this function:

◆ param_set()

Manage_Table_SQL::param_set (   $p_json)

Set the parameter of the object (gDossier, ac, plugin_code...) @detail By default , only gDossier will be set .

The default value is given in the constructor

Parameters
stringwith json format $p_json
Deprecated:
since version 692
See also
set_json

Definition at line 488 of file manage_table_sql.class.php.

489  {
490  $this->set_json($p_json);
491  }

References set_json().

+ Here is the call graph for this function:

◆ save()

Manage_Table_SQL::save ( )

save the Data_SQL Object The noalyss_SQL is not empty

See also
from_request

Reimplemented in Action_Document_Type_MTable, Currency_MTable, Tva_Rate_MTable, and Operation_Predef_MTable.

Definition at line 1439 of file manage_table_sql.class.php.

1440  {
1441  if ($this->table->exist()==0)
1442  {
1443  $this->table->insert();
1444  }
1445  else
1446  {
1447  $this->table->update();
1448  }
1449  }

References table.

Referenced by ajax_save().

◆ send_header()

Manage_Table_SQL::send_header ( )

send the XML headers for the ajax call

Definition at line 184 of file manage_table_sql.class.php.

185  {
186  header('Content-type:text/xml;charset="UTF-8"');
187  }

◆ set_append_row()

Manage_Table_SQL::set_append_row (   $p_value)

Enable or disable the appending of rows.

Parameters
$p_valueBoolean : true enable the row to be appended

Definition at line 620 of file manage_table_sql.class.php.

621  {
622  if ($p_value!==True&&$p_value!==False)
623  throw new Exception("Valeur invalide set_append_row [$p_value]");
624  $this->row_append=$p_value;
625  }

Referenced by Mobile_Device_MTable\__construct(), and Operation_Predef_MTable\__construct().

◆ set_button_add_top()

Manage_Table_SQL::set_button_add_top (   $button_add_top)

Definition at line 770 of file manage_table_sql.class.php.

771  {
772  $this->button_add_top=$button_add_top;
773  return $this;
774  }

References $button_add_top.

◆ set_callback()

Manage_Table_SQL::set_callback (   $p_file)

set the callback function that is passed to javascript

Parameters
$p_file: callback file by default ajax.php

Definition at line 507 of file manage_table_sql.class.php.

508  {
509  $this->callback=$p_file;
510  }

Referenced by Mobile_Device_MTable\__construct(), and Operation_Predef_MTable\__construct().

◆ set_col_label()

Manage_Table_SQL::set_col_label (   $p_key,
  $p_display 
)

◆ set_col_option()

Manage_Table_SQL::set_col_option (   $p_key,
  $p_value 
)

add extra to column, normally class or style

Parameters
string$p_keycolumn name
string$p_valueextra info for this column (CSS, js, ...)
$manage_table->set_col_option("pcm_lib",'style="color:red;text-align:center"');
$manage_table->set_col_option("pcm_val", "onclick=\"alert('toto')\" style=\"text-decoration:underline\" onmouseover=\"this.style.cursor='pointer'\"");

Definition at line 380 of file manage_table_sql.class.php.

381  {
382 
383  if (!isset($this->a_type[$p_key]))
384  throw new Exception("invalid key $p_key");
385  $this->a_col_option[$p_key]=$p_value;
386  return $this;
387  }

◆ set_col_sort()

Manage_Table_SQL::set_col_sort (   $p_num)

When adding an element ,we place it thanks the DOM Attribute sort_value set it to -1 if you want one to append.

Parameters
numeric$pn_num
Note
you must be aware that the icon_mod or icon_del is in the first col, this column is skipped

Definition at line 253 of file manage_table_sql.class.php.

253  {
254  $this->col_sort=$p_num;
255  }

Referenced by Card_Attribut_MTable\__construct(), Mobile_Device_MTable\__construct(), Anc_Account_Table\__construct(), and Operation_Predef_MTable\__construct().

◆ set_col_tips()

Manage_Table_SQL::set_col_tips (   $p_key,
  $p_comment 
)

Set the info for a column, use Icon_Action::infobulle the message are in message_javascript.php.

Parameters
string$p_keyColumn name
integer$p_commentcomment idx
See also
message_javascript.php
Icon_Action::infobulle()

Definition at line 243 of file manage_table_sql.class.php.

243  {
244  $this->a_info[$p_key]=$p_comment;
245  }

Referenced by Card_Attribut_MTable\__construct(), Mobile_Device_MTable\__construct(), and Payment_Method_MTable\__construct().

◆ set_col_type()

Manage_Table_SQL::set_col_type (   $p_key,
  $p_value,
  $p_array = NULL 
)

set the type of a column , it will change in the input db box , the select must supply an array of possible values [val=> , label=>] with the variable $this->key_name->a_value

Parameters
$p_keycol name
$p_typeis "text", "numeric", "date", "select", "timestamp","custom"
$p_arrayif type is SELECT an array is expected
Note
if $p_type is custom then a function named input_custom($p_key,$p_value) must be implemented in the class
See also
Manage_Table_SQL:input_custom

Definition at line 425 of file manage_table_sql.class.php.

426  {
427  if (!isset($this->a_type[$p_key]))
428  throw new Exception("invalid key $p_key");
429 
430  if (!in_array($p_value,
431  array("text", "numeric", "date", "select", "timestamp","custom")))
432  throw new Exception("invalid type $p_value");
433 
434  $this->a_type[$p_key]=$p_value;
435  $this->a_select[$p_key]=$p_array;
436  if ( $p_value == "numeric" && $this->a_col_option[$p_key]=="") {
437  $this->a_col_option[$p_key]=' class="num" ';
438  }
439 
440  }

References $p_array.

Referenced by Card_Attribut_MTable\__construct(), Mobile_Device_MTable\__construct(), Contact_Option_Ref_MTable\__construct(), Anc_Account_Table\__construct(), Payment_Method_MTable\__construct(), Operation_Predef_MTable\__construct(), Tva_Rate_MTable\__construct(), and Currency_MTable\__construct().

◆ set_current_row()

Manage_Table_SQL::set_current_row (   $current_row)

set the current row printed in display_row

Parameters
type$current_row
Returns
this;

Definition at line 1082 of file manage_table_sql.class.php.

1083  {
1084  $this->current_row=$current_row;
1085  return $this;
1086  }

References $current_row.

◆ set_delete_row()

Manage_Table_SQL::set_delete_row (   $p_value)

Enable or disable the deletion of rows.

Parameters
$p_valueBoolean : true enable the row to be deleted

Definition at line 609 of file manage_table_sql.class.php.

610  {
611  if ($p_value!==True&&$p_value!==False)
612  throw new Exception("Valeur invalide set_delete_row [$p_value]");
613  $this->row_delete=$p_value;
614  }

Referenced by Mobile_Device_MTable\__construct(), Currency_MTable\__construct(), Card_Attribut_MTable\display_row(), and Currency_MTable\display_row().

◆ set_dialog_box()

Manage_Table_SQL::set_dialog_box (   $dialog_box)
Parameters
mixed$dialog_box

Definition at line 221 of file manage_table_sql.class.php.

222  {
223  $this->dialog_box = $dialog_box;
224  return $this;
225  }

References $dialog_box.

Referenced by Operation_Predef_MTable\__construct().

◆ set_dialogbox_style()

Manage_Table_SQL::set_dialogbox_style (   $db_style)

Dialog box style , by default {position: "fixed", top: '15', width: "auto", "margin-left": "20%"}.

Parameters
array$db_style,willbe transformed into a json object

Definition at line 203 of file manage_table_sql.class.php.

204  {
205  $this->dialogbox_style = $db_style;
206  return $this;
207  }

◆ set_error()

Manage_Table_SQL::set_error (   $p_col,
  $p_message 
)

◆ set_header_option()

Manage_Table_SQL::set_header_option (   $p_key,
  $p_value 
)

add extra to column Header, normally class or style

Parameters
string$p_keycolumn name
string$p_valueextra info for this column (CSS, js, ...)
See also
set_col_option

Definition at line 406 of file manage_table_sql.class.php.

407  {
408  if (!isset($this->a_type[$p_key]))
409  throw new Exception("invalid key $p_key");
410  $this->a_header_option[$p_key]=$p_value;
411  return $this;
412  }

Referenced by Mobile_Device_MTable\__construct().

◆ set_icon_del()

Manage_Table_SQL::set_icon_del (   $pString)

Set the icon to delete at the right or left of the row.

Parameters
type$pString
Exceptions
Exception

Definition at line 591 of file manage_table_sql.class.php.

591  {
592  if ($pString != "right" && $pString != "left" )
593  throw new Exception('set_icon_del invalide '.$pString);
594  $this->icon_del=$pString;
595  }

◆ set_icon_mod()

Manage_Table_SQL::set_icon_mod (   $pString)

Set the icon to modify at the right ,the first col or left of the row.

Parameters
type$pString
Exceptions
Exception

Definition at line 581 of file manage_table_sql.class.php.

581  {
582  if ($pString != "right" && $pString != "left" && $pString!="first")
583  throw new Exception('set_icon_mod invalide '.$pString);
584  $this->icon_mod=$pString;
585  }

Referenced by Currency_MTable\__construct().

◆ set_json()

Manage_Table_SQL::set_json (   $p_json)

Set the parameter of the object (gDossier, ac, plugin_code...) @detail By default , only gDossier will be set .

The default value is given in the constructor

Parameters
stringwith json format $p_json

Definition at line 498 of file manage_table_sql.class.php.

499  {
500  $this->json_parameter=$p_json;
501 
502  }

Referenced by param_set().

◆ set_object_name()

Manage_Table_SQL::set_object_name (   $p_object_name)

Set the object_name.

Parameters
string$p_object_namename of the JS var, used in ajax response,id of the part of the id DOMElement to modify

Definition at line 543 of file manage_table_sql.class.php.

544  {
545  $this->object_name=$p_object_name;
546  }

Referenced by Mobile_Device_MTable\__construct(), and Anc_Account_Table\__construct().

◆ set_order()

Manage_Table_SQL::set_order (   $p_order)

Definition at line 277 of file manage_table_sql.class.php.

278  {
279  if (! is_array($p_order) )
280  throw new Exception("set_order, parameter is not an array");
281  $this->a_order=$p_order;
282  }

References $p_order.

Referenced by Mobile_Device_MTable\__construct(), Payment_Method_MTable\__construct(), Action_Document_Type_MTable\__construct(), and Operation_Predef_MTable\__construct().

◆ set_pk()

Manage_Table_SQL::set_pk (   $p_id)

set the id value of a data row and load from the db

Definition at line 915 of file manage_table_sql.class.php.

916  {
917  $this->table->set_pk_value($p_id);
918  $this->table->load();
919  }

References $p_id, and table.

Referenced by Operation_Predef_MTable\save().

◆ set_property_updatable()

Manage_Table_SQL::set_property_updatable (   $p_key,
  $p_value 
)

set a column of the data row updatable or not

Parameters
string$p_keydata column
bool$p_valueBoolean False or True
Examples
test_manage_table_sql.php.

Definition at line 553 of file manage_table_sql.class.php.

554  {
555  if (! isset($this->a_prop[$p_key]))
556  throw new Exception(__FILE__.":".__LINE__."$p_key invalid index");
557  // if already done returns
558  if ( $this->get_property_updatable($p_key) == $p_value)return;
559  if ($p_value==False)
560  $this->a_prop[$p_key]=$this->a_prop[$p_key]-self::UPDATABLE;
561  elseif ($p_value==True)
562  $this->a_prop[$p_key]=$this->a_prop[$p_key]|self::UPDATABLE;
563  else
564  throw new Exception("set_property_updatable [ $p_value ] incorrect");
565  }

References get_property_updatable(), and UPDATABLE.

Referenced by Card_Attribut_MTable\__construct(), Template_Card_Category\__construct(), Anc_Account_Table\__construct(), Action_Document_Type_MTable\__construct(), Operation_Predef_MTable\__construct(), Tag_Group_MTable\__construct(), and Tva_Rate_MTable\__construct().

+ Here is the call graph for this function:

◆ set_property_visible()

Manage_Table_SQL::set_property_visible (   $p_key,
  $p_value 
)

set a column of the data row visible or not

Parameters
string$p_keydata column
bool$p_valueBoolean False or True
Examples
test_manage_table_sql.php.

Definition at line 663 of file manage_table_sql.class.php.

664  {
665  if (!isset ($this->a_prop[$p_key]) )
666  throw new Exception(__FILE__.":".__LINE__."$p_key invalid index");
667  // if already done return
668  if ( $this->get_property_visible($p_key) == $p_value)return;
669 
670  if ($p_value==False)
671  $this->a_prop[$p_key]=$this->a_prop[$p_key]-self::VISIBLE;
672  elseif ($p_value==True)
673  $this->a_prop[$p_key]=$this->a_prop[$p_key]|self::VISIBLE;
674  else
675  throw new Exception("set_property_updatable [ $p_value ] incorrect");
676  }

References get_property_visible(), and VISIBLE.

Referenced by Card_Attribut_MTable\__construct(), Mobile_Device_MTable\__construct(), Contact_Option_Ref_MTable\__construct(), Payment_Method_MTable\__construct(), Anc_Account_Table\__construct(), Action_Document_Type_MTable\__construct(), Operation_Predef_MTable\__construct(), Tag_Group_MTable\__construct(), and Currency_MTable\__construct().

+ Here is the call graph for this function:

◆ set_search_table()

Manage_Table_SQL::set_search_table (   $search_table)

Set the table searchable or not.

Parameters
boolean: true we can search
Returns
$this

Definition at line 175 of file manage_table_sql.class.php.

176  {
177  $this->search_table=$search_table;
178  return $this;
179  }

References $search_table.

◆ set_sort_column()

Manage_Table_SQL::set_sort_column (   $p_col)

set the column to sort by default

Definition at line 900 of file manage_table_sql.class.php.

901  {
902  $this->sort_column=$p_col;
903  }

Referenced by Mobile_Device_MTable\__construct(), Operation_Predef_MTable\__construct(), and Currency_MTable\__construct().

◆ set_table()

Manage_Table_SQL::set_table ( Data_SQL  $p_noalyss_sql)

Definition at line 269 of file manage_table_sql.class.php.

270  {
271  $this->table=$p_noalyss_sql;
272  }

References table.

◆ set_update_row()

Manage_Table_SQL::set_update_row (   $p_value)

Enable or disable the updating of rows.

Parameters
$p_valueBoolean : true enable the row to be updated

Definition at line 631 of file manage_table_sql.class.php.

632  {
633  if ($p_value!==True&&$p_value!==False)
634  throw new Exception("Valeur invalide set_update_row [$p_value]");
635  $this->row_update=$p_value;
636  }

Referenced by Card_Attribut_MTable\display_row(), and Currency_MTable\display_row().

◆ set_value()

Manage_Table_SQL::set_value (   $p_key,
  $p_value 
)
See also
set_pk_value
from_request

Definition at line 1476 of file manage_table_sql.class.php.

1477  {
1478  $this->table->set($p_key, $p_value);
1479  }

References table.

◆ setCssClass()

Manage_Table_SQL::setCssClass (   $p_class)

Definition at line 143 of file manage_table_sql.class.php.

143  {
144  $this->cssclass=$p_class;
145  }

◆ setTitle()

Manage_Table_SQL::setTitle (   $p_title)

Set the title of the diabox , default is Donnée.

Parameters
type$p_title

Definition at line 153 of file manage_table_sql.class.php.

154  {
155  $this->title=$p_title;
156  }

References title.

◆ show_error()

Manage_Table_SQL::show_error (   $p_col)

Definition at line 532 of file manage_table_sql.class.php.

533  {
534  $error=$this->get_error($p_col);
535  if ($error == "") { return "";}
537  }

References $error, HtmlInput\errorbulle(), and get_error().

+ Here is the call graph for this function:

◆ update()

Manage_Table_SQL::update ( )
See also
set_pk_value
from_request

Definition at line 1466 of file manage_table_sql.class.php.

1467  {
1468  $this->table->update();
1469  }

References table.

Field Documentation

◆ $a_col_option

Manage_Table_SQL::$a_col_option
private

in display_row and display_custom_row, it is the current row which is used

Extra to add to the column : CSS Style , CSS class, javascript ,...

Definition at line 95 of file manage_table_sql.class.php.

◆ $a_header_option

Manage_Table_SQL::$a_header_option
private

Extra to add to the column Header : CSS Style , CSS class, javascript ,...

Definition at line 96 of file manage_table_sql.class.php.

◆ $a_info

Manage_Table_SQL::$a_info
protected

Array with the infotip.

Definition at line 81 of file manage_table_sql.class.php.

◆ $a_label_displaid

Manage_Table_SQL::$a_label_displaid
protected

Label of the col. of the datarow.

Definition at line 69 of file manage_table_sql.class.php.

◆ $a_order

Manage_Table_SQL::$a_order
protected

order of the col

Definition at line 70 of file manage_table_sql.class.php.

Referenced by get_order().

◆ $a_prop

Manage_Table_SQL::$a_prop
protected

property for each col.

Definition at line 71 of file manage_table_sql.class.php.

◆ $a_select

Manage_Table_SQL::$a_select
protected

Possible value if a_type is a SELECT.

Definition at line 73 of file manage_table_sql.class.php.

◆ $a_type

Manage_Table_SQL::$a_type
protected

Type of the column : date , select ... Only in input.

Definition at line 72 of file manage_table_sql.class.php.

◆ $aerror

Manage_Table_SQL::$aerror
protected

Array containing the error of the input data.

Definition at line 79 of file manage_table_sql.class.php.

◆ $button_add_top

Manage_Table_SQL::$button_add_top
private

place of the button add on the top, by default true

Definition at line 91 of file manage_table_sql.class.php.

Referenced by get_button_add_top(), and set_button_add_top().

◆ $col_sort

Manage_Table_SQL::$col_sort
protected

when inserting, it is the column to sort,-1 to disable it and append only

Definition at line 80 of file manage_table_sql.class.php.

Referenced by display_row(), and get_col_sort().

◆ $cssclass

Manage_Table_SQL::$cssclass
private

< give the title of the diabox , default is Data

Definition at line 93 of file manage_table_sql.class.php.

Referenced by getCssClass().

◆ $current_row

Manage_Table_SQL::$current_row
private

CSS class for the dialog box.

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

Referenced by get_current_row(), and set_current_row().

◆ $dialog_box

Manage_Table_SQL::$dialog_box
protected

ID of the dialog box which display the result of the ajax calls.

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

Referenced by get_dialog_box(), and set_dialog_box().

◆ $dialogbox_style

Manage_Table_SQL::$dialogbox_style
private

style of the dialog box

Definition at line 90 of file manage_table_sql.class.php.

Referenced by get_dialogbox_style().

◆ $icon_del

Manage_Table_SQL::$icon_del
private

place of right or left the icon update or mod, default right, accepted value=left,right

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

Referenced by get_icon_del().

◆ $icon_mod

Manage_Table_SQL::$icon_mod
private

place of right or left the icon update or mod, default right, accepted value=left,right,first column for mod

Definition at line 88 of file manage_table_sql.class.php.

Referenced by get_icon_mod().

◆ $json_parameter

Manage_Table_SQL::$json_parameter
protected

Default parameter to add (gDossier...), sent to the ajax callback.

Definition at line 78 of file manage_table_sql.class.php.

Referenced by get_json().

◆ $object_name

Manage_Table_SQL::$object_name
protected

Object_name is used for the javascript , it is the row id to update or delete.

Definition at line 74 of file manage_table_sql.class.php.

Referenced by get_js_variable(), and get_object_name().

◆ $row_append

Manage_Table_SQL::$row_append
protected

Flag to indicate if rows can be added.

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

Referenced by can_append_row().

◆ $row_delete

Manage_Table_SQL::$row_delete
protected

Flag to indicate if rows can be deleted.

Definition at line 75 of file manage_table_sql.class.php.

Referenced by can_delete_row().

◆ $row_update

Manage_Table_SQL::$row_update
protected

Flag to indicate if rows can be updated.

Definition at line 76 of file manage_table_sql.class.php.

Referenced by can_update_row().

◆ $search_table

Manage_Table_SQL::$search_table
protected

boolean , by default true ,it is possible to search in the table,

Definition at line 84 of file manage_table_sql.class.php.

Referenced by get_search_table(), and set_search_table().

◆ $sort_column

Manage_Table_SQL::$sort_column
protected

javascript sort on this column , if empty there is no js sort

Definition at line 82 of file manage_table_sql.class.php.

Referenced by get_sort_column().

◆ $table

Manage_Table_SQL::$table
protected

◆ $title

Manage_Table_SQL::$title
protected

Definition at line 92 of file manage_table_sql.class.php.

Referenced by getTitle().

◆ UPDATABLE

const Manage_Table_SQL::UPDATABLE =1

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

Referenced by get_property_updatable(), and set_property_updatable().

◆ VISIBLE

const Manage_Table_SQL::VISIBLE =2

The documentation for this class was generated from the following file:
$xml
switch($op2) $xml
Definition: ajax_card.php:785
$w
foreach($array as $idx=> $m) $w
Definition: anc_group.inc.php:69
$ex
$ex
Definition: balance.inc.php:45
h
h( $row[ 'oa_description'])
Definition: ajax_anc_detail_operation.php:46
$ret
$ret
Definition: ajax_display_letter.php:51
$e
$e
Definition: result_cat_card_summary.php:26
Manage_Table_SQL\UPDATABLE
const UPDATABLE
Definition: manage_table_sql.class.php:85
$sa
$sa
Definition: ajax_report_definition.php:30
$old
$old
Definition: balance_card.inc.php:31
Manage_Table_SQL\save
save()
save the Data_SQL Object The noalyss_SQL is not empty
Definition: manage_table_sql.class.php:1439
Manage_Table_SQL\can_delete_row
can_delete_row()
return false if the delete of the row is forbidden
Definition: manage_table_sql.class.php:641
INum
This class handles only the numeric input, the input will call a javascript to change comma to period...
Definition: inum.class.php:41
Manage_Table_SQL\display_row
display_row($p_row)
display a data row in the table, with the order defined in a_order and depending of the visibility of...
Definition: manage_table_sql.class.php:978
Icon_Action\infobulle
static infobulle($p_comment)
Display a info in a bubble, text is in message_javascript.
Definition: icon_action.class.php:97
IText
Html Input.
Definition: itext.class.php:29
HttpInput
manage the http input (get , post, request) and extract from an array
Definition: http_input.class.php:37
Manage_Table_SQL\get_property_visible
get_property_visible($p_key)
return True if the column is visible otherwise false
Definition: manage_table_sql.class.php:682
Manage_Table_SQL\$search_table
$search_table
boolean , by default true ,it is possible to search in the table,
Definition: manage_table_sql.class.php:84
Manage_Table_SQL\$row_delete
$row_delete
Flag to indicate if rows can be deleted.
Definition: manage_table_sql.class.php:75
DatabaseCore\fetch_array
static fetch_array($ret, $p_indice=0)
wrapper for the function pg_fetch_array
Definition: database_core.class.php:745
Manage_Table_SQL\$row_append
$row_append
Flag to indicate if rows can be added.
Definition: manage_table_sql.class.php:77
HtmlInput\button_action
static button_action($action, $javascript, $id=NULL, $p_class="button", $p_symbole="")
button Html with javascript
Definition: html_input.class.php:494
Manage_Table_SQL\get_table
get_table()
Definition: manage_table_sql.class.php:264
Manage_Table_SQL\$current_row
$current_row
CSS class for the dialog box.
Definition: manage_table_sql.class.php:94
Icon_Action\trash
static trash($p_id, $p_javascript)
Display the icon of a trashbin.
Definition: icon_action.class.php:261
Manage_Table_SQL\$title
$title
Definition: manage_table_sql.class.php:92
IDate
Html Input : Input a date format dd.mm.yyyy The property title should be set to indicate what it is e...
Definition: idate.class.php:33
$ac
if(isset($_REQUEST['show'])) if(isset($_REQUEST['del'])) $ac
Definition: ajax_todo_list.php:85
Manage_Table_SQL\$sort_column
$sort_column
javascript sort on this column , if empty there is no js sort
Definition: manage_table_sql.class.php:82
Manage_Table_SQL\$icon_del
$icon_del
place of right or left the icon update or mod, default right, accepted value=left,...
Definition: manage_table_sql.class.php:89
Manage_Table_SQL\display_row_custom
display_row_custom($p_key, $p_value, $p_id=0)
When displaying a row, if a column has the type "custom" , we can call this function to display prope...
Definition: manage_table_sql.class.php:1101
HtmlInput\title_box
static title_box($p_name, $p_div, $p_mod="close", $p_js="", $p_draggable="n", $p_enlarge='n')
Title for boxes, you can customize the symbol thanks symbol with the mode "custom".
Definition: html_input.class.php:838
$text
$text
Definition: follow_up_detail_display.php:31
$result
$result
Definition: anc_great_ledger.inc.php:26
$manage_table
$manage_table
Definition: ajax_accounting.php:47
Manage_Table_SQL\display_icon_mod
display_icon_mod($p_row)
Definition: manage_table_sql.class.php:943
$array
$array
Definition: ajax_add_concerned_card.php:115
Manage_Table_SQL\ajax_input
ajax_input($p_status="OK")
send an xml with input of the object, create an xml answer.
Definition: manage_table_sql.class.php:1308
$p_order
$p_order
Definition: ajax_get_menu_detail.php:48
title
$anc_filter title
Definition: company.inc.php:118
$ctl
$ctl
Definition: ajax_action_remove_concerned.php:53
Manage_Table_SQL\$object_name
$object_name
Object_name is used for the javascript , it is the row id to update or delete.
Definition: manage_table_sql.class.php:74
$select
$select
Definition: ajax_add_concerned_card.php:65
HtmlInput\filter_table
static filter_table($p_table_id, $p_col, $start_row)
filter the rows in a table and keep the colored row in alternance
Definition: html_input.class.php:1001
$value
$value
Definition: export_document.php:41
$sb
$sb
Definition: upgrade.inc.php:37
Manage_Table_SQL\$col_sort
$col_sort
when inserting, it is the column to sort,-1 to disable it and append only
Definition: manage_table_sql.class.php:80
Manage_Table_SQL\set_error
set_error($p_col, $p_message)
set the error message for a wrong input
Definition: manage_table_sql.class.php:289
Manage_Table_SQL\set_json
set_json($p_json)
Set the parameter of the object (gDossier, ac, plugin_code...) @detail By default ,...
Definition: manage_table_sql.class.php:498
$i
$i
Definition: action_document_type_mtable_input.php:83
HtmlInput\errorbulle
static errorbulle($p_comment)
Definition: html_input.class.php:259
Manage_Table_SQL\$cssclass
$cssclass
< give the title of the diabox , default is Data
Definition: manage_table_sql.class.php:93
Manage_Table_SQL\$dialog_box
$dialog_box
ID of the dialog box which display the result of the ajax calls.
Definition: manage_table_sql.class.php:83
Manage_Table_SQL\get_error
get_error($p_col)
retrieve the error message
Definition: manage_table_sql.class.php:306
$root
$root
Definition: category_card.inc.php:36
Manage_Table_SQL\$icon_mod
$icon_mod
place of right or left the icon update or mod, default right, accepted value=left,...
Definition: manage_table_sql.class.php:88
DatabaseCore\num_row
static num_row($ret)
wrapper for the function pg_NumRows
Definition: database_core.class.php:734
$label
$label
Definition: impress_jrn.inc.php:115
Manage_Table_SQL\$dialogbox_style
$dialogbox_style
style of the dialog box
Definition: manage_table_sql.class.php:90
$http
$http
Definition: action.common.inc.php:33
Manage_Table_SQL\$a_order
$a_order
order of the col
Definition: manage_table_sql.class.php:70
$html
if(headers_sent() &&DEBUGNOALYSS > 0) $html
Definition: ajax_action_concerned_list.php:56
$order
$order
Definition: export_histo_csv.php:33
Icon_Action\modify
static modify($p_id, $p_javascript)
Display the icon to modify a idem.
Definition: icon_action.class.php:272
HtmlInput\submit
static submit($p_name, $p_value, $p_javascript="", $p_class="smallbutton")
Definition: html_input.class.php:199
$val
$val
Definition: test-tableau-postgres.php:23
$idx
$idx
Definition: ajax_bookmark.php:79
Manage_Table_SQL\execute_query
execute_query($p_order="", $p_array=NULL)
execute the query (Data_SQL.seek), called by display_table
Definition: manage_table_sql.class.php:782
$cn
$cn
Definition: ajax_anc_accounting.php:30
$count
$count
Definition: modele.inc.php:251
Dossier\id
static id()
return the $_REQUEST['gDossier'] after a check
Definition: dossier.class.php:55
Manage_Table_SQL\get_search_table
get_search_table()
Get if we can search in the table.
Definition: manage_table_sql.class.php:165
table
$all table
Definition: company.inc.php:138
Manage_Table_SQL\check
check()
Definition: manage_table_sql.class.php:351
BUTTONADD
const BUTTONADD
Definition: constant.php:91
Manage_Table_SQL\get_col_type
get_col_type($p_key)
return the type of a column
Definition: manage_table_sql.class.php:447
Manage_Table_SQL\$table
$table
Object Data_SQL.
Definition: manage_table_sql.class.php:68
Manage_Table_SQL\can_update_row
can_update_row()
return false if the update of the row is forbidden
Definition: manage_table_sql.class.php:570
Manage_Table_SQL\display_error
display_error()
Display a list of the error collected.
Definition: manage_table_sql.class.php:1486
$style
$style
Definition: ajax_preference.php:51
Manage_Table_SQL\$button_add_top
$button_add_top
place of the button add on the top, by default true
Definition: manage_table_sql.class.php:91
ICard
Input HTML for the card show buttons, in the file, you have to add card.js How to use :
Definition: icard.class.php:120
$nb
$nb
Definition: ajax_auto_anc_card.php:32
th
th($p_string, $p_extra='', $raw='')
Definition: ac_common.php:58
Manage_Table_SQL\display_table_header
display_table_header()
display the column header excepted the not visible one and in the order defined with $this->a_order
Definition: manage_table_sql.class.php:858
td
td($p_string='', $p_extra='')
surround the string with td
Definition: ac_common.php:83
Manage_Table_SQL\input
input()
display into a dialog box the datarow in order to be appended or modified.
Definition: manage_table_sql.class.php:1117
HtmlInput\hidden
static hidden($p_name, $p_value, $p_id="")
Definition: html_input.class.php:218
$close
$close
Definition: ajax_search_account_card.php:88
Manage_Table_SQL\from_request
from_request()
get the data from http request strip the not update or not visible data to their initial value.
Definition: manage_table_sql.class.php:926
$row
$row
Definition: ajax_anc_detail_operation.php:33
Manage_Table_SQL\VISIBLE
const VISIBLE
Definition: manage_table_sql.class.php:86
Manage_Table_SQL\$json_parameter
$json_parameter
Default parameter to add (gDossier...), sent to the ajax callback.
Definition: manage_table_sql.class.php:78
Manage_Table_SQL\input_custom
input_custom($p_key, $p_value)
this function let you create your own input , for example for a ITEXT , a IRADIO ,...
Definition: manage_table_sql.class.php:1225
Manage_Table_SQL\display_icon_del
display_icon_del($p_row)
Definition: manage_table_sql.class.php:956
Manage_Table_SQL\$row_update
$row_update
Flag to indicate if rows can be updated.
Definition: manage_table_sql.class.php:76
$p_array
$p_array
Definition: ajax_view_mod_stock.php:33
$p_id
$p_id
Definition: ajax_accounting.php:33
ISelect
Html Input , create a tag <SELECT> ... </SELECT> if readonly == true then display the label correspon...
Definition: iselect.class.php:39
Manage_Table_SQL\can_append_row
can_append_row()
return false if the append of the row is forbidden
Definition: manage_table_sql.class.php:599
$error
$error
Definition: currency_mtable_input.php:34
Manage_Table_SQL\get_property_updatable
get_property_updatable($p_key)
return True if the column is updatable otherwise false
Definition: manage_table_sql.class.php:650
$js
$js
Definition: ajax_tag_list.php:32
$status
$status
Definition: acc_ledger-input_extra_info.php:138
HtmlInput\json_to_hidden
static json_to_hidden($p_json)
transform a json to hidden
Definition: html_input.class.php:628
Manage_Table_SQL\getTitle
getTitle()
Definition: manage_table_sql.class.php:157
Manage_Table_SQL\get_current_pos
get_current_pos($p_key)
get the position of a column
Definition: manage_table_sql.class.php:705