noalyss Version-9
Public Member Functions | Data Fields | Protected 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_custom ($p_row)
 usually contain a link and calls another page, it must be overriden 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, all the rows contains the attribute ctl_pk_id , to retrieve in javascript , ie with the function afterSaveFct (see managetable.js) 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 , ... it must be override , there is not default 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, if the mod if custom , you have to override the function display_icon_custom. 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_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...
 
 $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...
 
 $button_add_top
 place of the button add on the top, by default true More...
 
 $callback
 Callback function. More...
 
 $col_sort
 when inserting, it is the column to sort,-1 to disable it and append only More...
 
 $cssclass
 < give the title of the diabox , default is Data More...
 
 $current_row
 CSS class for the dialog box. More...
 
 $dialog_box
 ID of the dialog box which display the result of the ajax calls. 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,custom column for mod 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
 

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" , without this the list cannot be updated
$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();
switch($op2) $xml
Definition: ajax_card.php:806
if(isset( $_REQUEST[ 'show'])) if(isset($_REQUEST['del'])) $ac
static id()
return the 'gDossier' value after a check
manage the http input (get , post, request) and extract from an array
$sb
Definition: upgrade.inc.php:37
See also
ManageTable.js
ajax_accounting.php
sorttable.js

If you need to add extra XML fields to manage them in the afterSaveFct then you can do like this in your php code answering the ajax call

header('Content-type: text/xml; charset=UTF-8');
$xml=$manage_table->ajax_save();
$s1=$xml->createElement("previous_id",$previous);
$data=$xml->getElementsByTagName("data");
$data[0]->append($s1);
echo $xml->saveXML();
$manage_table

The afterSaveFct is the function called after saving, the param is the HTML Element

PHP
// to redirect : we take the pk_id and redirect to another location
$url=DRIVINGSCHOOL_URL;
$script=<<<EOF
(function(){
{$obj}.afterSaveFct=function(p_param) {
let student=p_param.attributes["ctl_pk_id"].value;
window.location="{$url}/do.php?do=student&student_id="+student+"&act=detail";
}})();
EOF;
{$obj}.afterSaveFct=function(p_param) {
let student=p_param.attributes["ctl_pk_id"].value;
window.location="{$url}/do.php?do=student&student_id="+student+"&act=detail";
}})();
$url
create_script($p_string)
create the HTML for adding the script tags around of the script
$script
Definition: popup.php:125
Examples
ajax_manage_table_sql.php, and test_manage_table_sql.php.

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

Constructor & Destructor Documentation

◆ __construct()

Manage_Table_SQL::__construct ( Data_SQL  $p_table)

Reimplemented in Anc_Account_Table, Forecast_Category_MTable, and Forecast_Item_MTable.

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

142 {
143 $this->table=$p_table;
144 $order=0;
145 foreach ($this->table->name as $key=> $value)
146 {
147
148 $this->a_label_displaid[$value]=$key;
149 $this->a_order[$order]=$value;
150 $this->a_prop[$value]=self::UPDATABLE|self::VISIBLE;
151 $this->a_type[$value]=$this->table->type[$value];
152 $this->a_select[$value]=null;
153 $this->a_col_option[$value]="";
154 $this->a_header_option[$value]="";
155 $order++;
156 }
157 $this->object_name=uniqid("tbl");
158 $this->row_delete=TRUE;
159 $this->row_update=TRUE;
160 $this->row_append=TRUE;
161 $this->callback="ajax.php";
162 $this->json_parameter=json_encode(array("gDossier"=>Dossier::id(),
163 "op"=>"managetable"));
164 $this->aerror=[];
165 $this->icon_mod="right";
166 $this->icon_del="right";
167 $this->col_sort=0;
168 // By default no js sort
169 $this->sort_column="";
170 $this->dialog_box="dtr";
171 $this->dialogbox_style=array();
172 $this->search_table=true;
173 $this->button_add_top=true;
174 $this->title=_("Donnée");
175 $this->cssclass="inner_box";
176
177 }
$all table
$anc_filter title

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 503 of file manage_table_sql.class.php.

503 {
504 $x=json_decode($this->json_parameter,TRUE);
505 $x[$p_attribute]=$p_value;
506 $this->json_parameter=json_encode($x, JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES|JSON_NUMERIC_CHECK);
507 }

Referenced by Mobile_Device_MTable\__construct(), Document_State_MTable\build(), 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 1470 of file manage_table_sql.class.php.

1471 {
1472 $status="NOK";
1473 $xml=new DOMDocument('1.0', "UTF-8");
1474 try
1475 {
1476 $this->delete();
1477 $status="OK";
1478 $s1=$xml->createElement("status", $status);
1479 $ctl=$this->object_name."_".$this->table->get_pk_value();
1480 $s2=$xml->createElement("ctl_row", $ctl);
1481 $s3=$xml->createElement("html", _("Effacé"));
1482 $s4=$xml->createElement("ctl", $this->object_name);
1483
1484 $root=$xml->createElement("data");
1485 $root->appendChild($s1);
1486 $root->appendChild($s2);
1487 $root->appendChild($s3);
1488 $root->appendChild($s4);
1489 }
1490 catch (Exception $ex)
1491 {
1492 $s1=$xml->createElement("status", "NOK");
1493 $s2=$xml->createElement("ctl",
1494 $this->object_name."_".$this->table->get_pk_value());
1495 $s3=$xml->createElement("html", $ex->getMessage());
1496 $s4=$xml->createElement("ctl", $this->object_name);
1497
1498 $root=$xml->createElement("data");
1499 $root->appendChild($s1);
1500 $root->appendChild($s2);
1501 $root->appendChild($s3);
1502 $root->appendChild($s4);
1503 }
1504 $xml->appendChild($root);
1505 return $xml;
1506 }
$ex
Definition: balance.inc.php:45

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 1376 of file manage_table_sql.class.php.

1377 {
1378 $xml=new DOMDocument("1.0", "UTF-8");
1379 $xml->createElement("status", $p_status);
1380 try
1381 {
1382 $status=$p_status;
1383
1384 ob_start();
1385
1386 echo HtmlInput::title_box($this->getTitle(), $this->dialog_box,"close","","y","y");
1387 printf('<form id="frm%s_%s" method="POST" onsubmit="%s.save(\'frm%s_%s\');return false;">',
1388 $this->object_name, $this->table->get_pk_value(),
1389 $this->object_name, $this->object_name,
1390 $this->table->get_pk_value());
1391 $can_update=$this->input();
1392 $can_update =( $can_update===false) ? false:true;
1393 // JSON param to hidden
1394 echo HtmlInput::json_to_hidden($this->json_parameter);
1395 echo HtmlInput::hidden("p_id", $this->table->get_pk_value());
1396 // button Submit and cancel
1397 $close=sprintf("\$('%s').remove()", $this->dialog_box);
1398 // display error if any
1399 $this->display_error();
1400 echo '<ul class="aligned-block">';
1401 // form readonly
1402 if ( $can_update ) {
1403 echo '<li>',
1404 HtmlInput::submit('update', _("Sauver")),
1405 '</li>';
1406 }
1407 echo '<li>',
1408 HtmlInput::button_action(_("Annuler"), $close, "", "smallbutton"),
1409 '</li>',
1410 '</ul>';
1411 echo "</form>";
1412
1413
1414 $html=ob_get_contents();
1415 ob_end_clean();
1416
1417 $s1=$xml->createElement("status", $status);
1418 $ctl=$this->object_name."_".$this->table->get_pk_value();
1419 $s2=$xml->createElement("ctl_row", $ctl);
1420 $s4=$xml->createElement("ctl", $this->object_name);
1421 $s3=$xml->createElement("html");
1422 $s5=$xml->createElement("ctl_pk_id", $this->table->get_pk_value());
1423 $t1=$xml->createTextNode($html);
1424 $s3->appendChild($t1);
1425
1426 $root=$xml->createElement("data");
1427 $root->appendChild($s1);
1428 $root->appendChild($s2);
1429 $root->appendChild($s3);
1430 $root->appendChild($s4);
1431 $root->appendChild($s5);
1432
1433 }
1434 catch (Exception $ex)
1435 {
1436 $s1=$xml->createElement("status", "NOK");
1437 $s3=$xml->createElement("ctl", $this->object_name);
1438 $s2=$xml->createElement("ctl_row",
1439 $this->object_name."_".$this->table->get_pk_value());
1440 $s4=$xml->createElement("html", $ex->getTraceAsString());
1441 $s5=$xml->createElement("ctl_pk_id", $this->table->get_pk_value());
1442 $root=$xml->createElement("data");
1443 $root->appendChild($s1);
1444 $root->appendChild($s2);
1445 $root->appendChild($s3);
1446 $root->appendChild($s4);
1447 $root->appendChild($s5);
1448
1449
1450 }
1451 $xml->appendChild($root);
1452 return $xml;
1453 }
if(headers_sent() &&DEBUGNOALYSS > 0) $html
static button_action($action, $javascript, $id=NULL, $p_class="button", $p_symbole="")
button Html with javascript
static hidden($p_name, $p_value, $p_id="")
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".
static json_to_hidden($p_json)
transform a json to hidden
static submit($p_name, $p_value, $p_javascript="", $p_class="smallbutton")
display_error()
Display a list of the error collected.
input()
display into a dialog box the datarow in order to be appended or modified.

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 1299 of file manage_table_sql.class.php.

1300 {
1301
1302 $status="NOK";
1303 $xml=new DOMDocument('1.0', "UTF-8");
1304 try
1305 {
1306 // fill up object with $_REQUEST
1307 $this->from_request();
1308 // Check if the data are valid , if not then display the
1309 // input values with the error message
1310 //
1311 if ($this->check()==false)
1312 {
1313 $xml=$this->ajax_input("NOK");
1314 return $xml;
1315 }
1316 else
1317 {
1318 // Data are valid so we can save them
1319 $this->save();
1320 // compose the answer
1321 $status="OK";
1322 $s1=$xml->createElement("status", $status);
1323 $ctl=$this->object_name."_".$this->table->get_pk_value();
1324 $s2=$xml->createElement("ctl_row", $ctl);
1325 $s4=$xml->createElement("ctl", $this->object_name);
1326 $s5=$xml->createElement("ctl_pk_id", $this->table->get_pk_value());
1327 ob_start();
1328 $this->table->load();
1329 $array=$this->table->to_array();
1330 $this->display_row($array);
1331 $html=ob_get_contents();
1332 ob_end_clean();
1333 $s3=$xml->createElement("html");
1334 $t1=$xml->createTextNode($html);
1335 $s3->appendChild($t1);
1336 }
1337
1338 $root=$xml->createElement("data");
1339 $root->appendChild($s1);
1340 $root->appendChild($s2);
1341 $root->appendChild($s3);
1342 $root->appendChild($s4);
1343 $root->appendChild($s5);
1344 $xml->appendChild($root);
1345 }
1346 catch (Exception $ex)
1347 {
1348 $s1=$xml->createElement("status", "NOK");
1349 $s2=$xml->createElement("ctl_row",
1350 $this->object_name."_".$this->table->get_pk_value());
1351 $s4=$xml->createElement("ctl", $this->object_name);
1352 $s3=$xml->createElement("html", $ex->getTraceAsString());
1353 $root=$xml->createElement("data");
1354 $root->appendChild($s1);
1355 $root->appendChild($s2);
1356 $root->appendChild($s3);
1357 $root->appendChild($s4);
1358 $root->appendChild($s5);
1359 $xml->appendChild($root);
1360 }
1361 return $xml;
1362 }
display_row($p_row)
display a data row in the table, with the order defined in a_order and depending of the visibility of...
ajax_input($p_status="OK")
send an xml with input of the object, create an xml answer.
save()
save the Data_SQL Object The noalyss_SQL is not empty
from_request()
get the data from http request strip the not update or not visible data to their initial value.

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 635 of file manage_table_sql.class.php.

636 {
637
638 return $this->row_append;
639 }
$row_append
Flag to indicate if rows can be added.

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 677 of file manage_table_sql.class.php.

678 {
679 return $this->row_delete;
680 }
$row_delete
Flag to indicate if rows can be deleted.

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 605 of file manage_table_sql.class.php.

606 {
607
608 return $this->row_update;
609 }
$row_update
Flag to indicate if rows can be updated.

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;
}
set_error($p_col, $p_message)
set the error message for a wrong input
$count

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

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

387 {
388 return true;
389 }

Referenced by ajax_save().

◆ count_error()

Manage_Table_SQL::count_error ( )

returns the nb of errors found

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

332 {
333 return count($this->aerror);
334 }

Referenced by Acc_Other_Tax_MTable\check(), Card_Attribut_MTable\check(), Forecast_Item_MTable\check(), Mobile_Device_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 551 of file manage_table_sql.class.php.

552 {
553 $style=json_encode($this->dialogbox_style);
554 echo "
555 <script>
556 var {$this->object_name}=new ManageTable(\"{$this->table->table}\");
557 {$this->object_name}.set_callback(\"{$this->callback}\");
558 {$this->object_name}.param_add({$this->json_parameter});
559 {$this->object_name}.set_sort({$this->get_col_sort()});
560 {$this->object_name}.set_control(\"{$this->get_dialog_box()}\");
561 {$this->object_name}.set_style($style);
562 {$this->object_name}.cssclass=\"{$this->cssclass}\";
563 </script>
564
565 ";
566 }

References $style.

◆ delete()

Manage_Table_SQL::delete ( )

delete a datarow , the id must be have set before

See also
from_request

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

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

1460 {
1461 $this->table->delete();
1462 }

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 1560 of file manage_table_sql.class.php.

1561 {
1562 $nb_order=count($this->a_order);
1563 if (count($this->aerror)==0)
1564 return;
1565 echo "<span class=\"notice\">Liste erreurs :</span>";
1566 for ($i=0; $i<$nb_order; $i++)
1567 {
1568 $key=$this->a_order[$i];
1569 $label=$this->a_label_displaid[$key];
1570 $error=$this->get_error($key);
1571 $error=($error=="")?"":"<span class=\"notice\" style=\"font-weight:normal;font-style:normal;display:block\">".h($label)." : ".h($this->get_error($key))."</span>";
1572
1573 echo $error;
1574 }
1575 echo "</ul>";
1576 }
h( $row[ 'oa_description'])
get_error($p_col)
retrieve the error message

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

Referenced by ajax_input().

+ Here is the call graph for this function:

◆ display_icon_custom()

Manage_Table_SQL::display_icon_custom (   $p_row)

usually contain a link and calls another page, it must be overriden

Parameters
array$p_rowis the current database row
Returns
void

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

1584 {
1585 echo '<td>'.'<a href="#">';
1586 print_r($p_row);
1587 echo '</a></td>';
1588 }

Referenced by display_row().

◆ display_icon_del()

Manage_Table_SQL::display_icon_del (   $p_row)

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

995 {
996 if ($this->can_delete_row())
997 {
998 echo "<td>";
999 $js=sprintf("%s.remove('%s','%s');", $this->object_name,
1000 $p_row[$this->table->primary_key], $this->object_name
1001 );
1002 echo Icon_Action::trash(uniqid(), $js);
1003 echo "</td>";
1004 }
1005 }
static trash($p_id, $p_javascript)
Display the icon of a trashbin.
can_delete_row()
return false if the delete of the row is forbidden

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

Referenced by Acc_Plan_MTable\display_row(), and display_row().

+ Here is the call graph for this function:

◆ display_icon_mod()

Manage_Table_SQL::display_icon_mod (   $p_row)

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

982 {
983 if ($this->can_update_row())
984 {
985 echo "<td>";
986 $js=sprintf("%s.input('%s','%s');", $this->object_name,
987 $p_row[$this->table->primary_key], $this->object_name
988 );
989 echo Icon_Action::modify(uniqid(), $js);
990 echo "</td>";
991 }
992 }
static modify($p_id, $p_javascript)
Display the icon to modify a idem.
can_update_row()
return false if the update of the row is forbidden

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, all the rows contains the attribute ctl_pk_id , to retrieve in javascript , ie with the function afterSaveFct (see managetable.js)

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

From database

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

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

1019 {
1020
1021 $pk_id=$p_row[$this->table->primary_key];
1022 printf('<tr id="%s_%s" ctl_pk_id="%s">', $this->object_name,
1023 $pk_id,$pk_id)
1024 ;
1025
1026 if ($this->icon_mod=="left")
1027 $this->display_icon_mod($p_row);
1028 if ($this->icon_del=="left")
1029 $this->display_icon_del($p_row);
1030 if ( $this->icon_mod == "custom")
1031 $this->display_icon_custom($p_row);
1032
1033 $nb_order=count($this->a_order);
1034 for ($i=0; $i<$nb_order; $i++)
1035 {
1036 $this->current_row=$p_row;
1037 $v=$this->a_order[$i];
1038
1039 if ($i==0&&$this->icon_mod=="first"&&$this->can_update_row())
1040 {
1041 $js=sprintf("onclick=\"%s.input('%s','%s');\"", $this->object_name,
1042 $pk_id, $this->object_name);
1043 $td=($i == $this->col_sort ) ? sprintf('<td sorttable_customkey="X%s" class="%s">',
1044 $p_row[$v],$this->a_col_option[$v]):"<td>";
1045 echo $td.HtmlInput::anchor($p_row[$v], "", $js).'</td>';
1046 }
1047 elseif ( $i == $this->col_sort && $this->get_property_visible($v) )
1048 {
1049 if ( $this->get_col_type($v) == 'text') {
1050 echo td($p_row[$v],sprintf(' sorttable_customkey="X%s" ',$p_row[$v]));
1051 } elseif ( $this->get_col_type($v) == 'numeric') {
1052 echo td($p_row[$v],$this->a_col_option[$v]);
1053 } elseif ( $this->get_col_type($v) == 'numeric2') {
1054 echo td(nbm($p_row[$v],2),$this->a_col_option[$v]);
1055 } elseif ( $this->get_col_type($v) == 'numeric4') {
1056 echo td(nbm($p_row[$v],4),$this->a_col_option[$v]);
1057 } elseif ( $this->get_col_type($v) == 'numeric6') {
1058 echo td(nbm($p_row[$v],6),$this->a_col_option[$v]);
1059 } elseif ($this->get_col_type($v)=="custom") {
1060 // For custom col
1061 echo $this->display_row_custom($v,$p_row[$v],$pk_id);
1062 }else {
1063 echo td($p_row[$v],sprintf(' sorttable_customkey="X%s" ',$p_row[$v]),$this->a_col_option[$v]);
1064
1065 }
1066 }
1067 elseif ( ! $this->get_property_visible($v)) {
1068 continue;
1069 }
1070 else
1071 {
1072 if ($this->get_col_type($v)=="select")
1073 {
1074 /**
1075 * From database
1076 */
1077 $idx=$p_row[$v];
1078 /*
1079 * Check if index exists
1080 */
1081 $array_to_search=$this->a_select[$v];
1082 $value=$p_row[$v];
1083
1084 $nb_search=(is_array($array_to_search))?count($array_to_search):0;
1085 $found=FALSE;
1086 for ($e=0; $e<$nb_search; $e++)
1087 {
1088 if (isset($array_to_search[$e]['value'])&&$array_to_search[$e]['value']==$value)
1089 {
1090 $found=TRUE;
1091 echo td($array_to_search[$e]['label'],$this->a_col_option[$v]);
1092 }
1093 }
1094
1095 if (!$found)
1096 {
1097 echo td("--");
1098 }
1099 } elseif ($this->get_col_type($v)=="custom") {
1100 // For custom col
1101 echo $this->display_row_custom($v,$p_row[$v],$pk_id);
1102 } elseif ( $this->get_col_type($v) == 'numeric') {
1103 echo td($p_row[$v],$this->a_col_option[$v]);
1104 } elseif ( $this->get_col_type($v) == 'numeric2') {
1105 echo td(nbm($p_row[$v],2),$this->a_col_option[$v]);
1106 }elseif ( $this->get_col_type($v) == 'numeric4') {
1107 echo td(nbm($p_row[$v],4),$this->a_col_option[$v]);
1108 }elseif ( $this->get_col_type($v) == 'numeric6') {
1109 echo td(nbm($p_row[$v],6),$this->a_col_option[$v]);
1110 }
1111 else {
1112 echo td($p_row[$v], $this->a_col_option[$v]);
1113 }
1114 }
1115 }
1116 if ($this->icon_mod=="right")
1117 $this->display_icon_mod($p_row);
1118 if ($this->icon_del=="right")
1119 $this->display_icon_del($p_row);
1120
1121
1122
1123 echo '</tr>';
1124 }
td($p_string='', $p_extra='')
surround the string with td
Definition: ac_common.php:83
nbm($p_number, $p_dec=2)
format the number with a sep.
Definition: ac_common.php:137
$idx
display_icon_custom($p_row)
usually contain a link and calls another page, it must be overriden
$col_sort
when inserting, it is the column to sort,-1 to disable it and append only
get_property_visible($p_key)
return True if the column is visible otherwise false
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...
get_col_type($p_key)
return the type of a column
if( $delta< 0) elseif( $delta==0)

References $col_sort, $e, $i, $idx, $js, $value, can_update_row(), display_icon_custom(), display_icon_del(), display_icon_mod(), display_row_custom(), elseif, get_col_type(), get_property_visible(), nbm(), 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 Acc_Other_Tax_MTable, Acc_Report_MTable, Card_Attribut_MTable, and Mobile_Device_MTable.

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

1157 {
1158 return td($p_value);
1159 }

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 Acc_Report_MTable, and Forecast_Item_MTable.

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

835 {
838 if ($this->can_append_row()==TRUE && $this->button_add_top == true)
839 {
840 echo HtmlInput::button_action(" "._("Ajout"),
841 sprintf("%s.input('-1','%s')",
842 $this->object_name,
843 $this->object_name), "xx", "smallbutton", BUTTONADD);
844 }
845 $nb_order=count($this->a_order);
846 $virg=""; $result="";
847
848 // filter only on visible column
849 $visible=($this->icon_mod=='left')?1:0;
850 $visible=$visible+( ($this->icon_del=='left')?1:0);
851 for ($e=0; $e<$nb_order; $e++)
852 {
853 if ($this->get_property_visible($this->a_order[$e])==TRUE)
854 {
855 $result.=$virg."$visible";
856 $virg=",";
857 $visible++;
858 }
859 }
860 if ( $this->get_search_table() )
861 {
862 echo _('Cherche')." ".HtmlInput::filter_table("tb".$this->object_name, $result, 1);
863 }
864
865 // Set a sort on a column if sort_column is not empty
866 if ( $this->sort_column =="")
867 {
868 printf('<table class="result" id="tb%s">', $this->object_name);
869 } else {
870 printf('<table class="result sortable" id="tb%s">', $this->object_name);
871 }
872 $this->display_table_header();
873 echo '<tbody>';
874 for ($i=0; $i<$nb; $i++)
875 {
877 $this->display_row($row);
878 }
879 echo '</tbody>';
880 echo "</table>";
881 if ($this->can_append_row()==TRUE)
882 {
883 echo HtmlInput::button_action(" "._("Ajout"),
884 sprintf("%s.input('-1','%s')",
885 $this->object_name,
886 $this->object_name), "xx", "smallbutton", BUTTONADD);
887 }
888 printf('<script> alternate_row_color("tb%s");</script>',
889 $this->object_name);
890 }
static fetch_array($ret, $p_indice=0, $p_mode=PGSQL_ASSOC)
wrapper for the function pg_fetch_array
static num_row($ret)
wrapper for the function pg_num_rows
static filter_table($p_table_id, $p_col, $start_row)
filter the rows in a table and keep the colored row in alternance
can_append_row()
return false if the append of the row is forbidden
execute_query($p_order="", $p_array=NULL)
execute the query (Data_SQL.seek), called by display_table
get_search_table()
Get if we can search in the table.
display_table_header()
display the column header excepted the not visible one and in the order defined with $this->a_order
const BUTTONADD
Definition: constant.php:102

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 896 of file manage_table_sql.class.php.

897 {
898 $nb=count($this->a_order);
899 echo '<thead>';
900 echo "<tr>";
901
902 if ($this->can_update_row() && $this->icon_mod=="left")
903 {
904 echo th(" ", 'style="width:40px" class="sorttable_nosort"');
905 }
906 if ($this->can_delete_row() && $this->icon_del=="left")
907 {
908 echo th(" ", 'style="width:40px" class="sorttable_nosort"');
909 }
910 for ($i=0; $i<$nb; $i++)
911 {
912
913 $key=$this->a_order[$i];
914 $sorted="";
915 if ( $key == $this->sort_column) {
916 $sorted=' class="sorttable_sorted"';
917 }
918
919 $style=$this->a_header_option[$key];
920 if ($this->get_property_visible($key)==true ) {
921 echo th("", $sorted.$style, $this->a_label_displaid[$key]);
922 }
923 }
924 if ($this->can_update_row() && $this->icon_mod=="right")
925 {
926 echo th(" ", 'style="width:40px" class="sorttable_nosort"');
927 }
928 if ($this->can_delete_row() && $this->icon_del=="right")
929 {
930 echo th(" ", 'style="width:40px" class="sorttable_nosort" ');
931 }
932 echo "</tr>";
933 echo '</thead>';
934 }
th($p_string, $p_extra='', $raw='')
Definition: ac_common.php:58

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 818 of file manage_table_sql.class.php.

819 {
820 if ($p_order=="")
821 {
822 $p_order="order by {$this->table->primary_key}";
823 }
824 $ret=$this->table->seek($p_order, $p_array);
825 return $ret;
826 }

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 Acc_Other_Tax_MTable, Action_Document_Type_MTable, Currency_MTable, Forecast_Item_MTable, and Operation_Predef_MTable.

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

965 {
966 $nb=count($this->a_order);
967 $http=new HttpInput();
968 for ($i=0; $i<$nb; $i++)
969 {
970
971 $key=$this->a_order[$i];
972 if ($this->get_property_visible($key)==TRUE&&$this->get_property_updatable($key)
973 ==TRUE)
974 {
975 $v=$http->request($this->a_order[$i],"string","");
976 $this->table->$key=strip_tags($v);
977 }
978 }
979 }
get_property_updatable($p_key)
return True if the column is updatable otherwise false

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 801 of file manage_table_sql.class.php.

802 {
804 }
$button_add_top
place of the button add on the top, by default true

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 395 of file manage_table_sql.class.php.

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

References $p_col.

◆ 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 266 of file manage_table_sql.class.php.

266 {
267 return $this->col_sort;
268 }

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 482 of file manage_table_sql.class.php.

483 {
484 if (!isset($this->a_type[$p_key]))
485 throw new Exception("invalid key");
486
487 return $this->a_type[$p_key];
488 }

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 741 of file manage_table_sql.class.php.

742 {
743 $nb_order=count($this->a_order);
744 for ($i=0; $i<$nb_order; $i++)
745 if ($this->a_order[$i]==$p_key)
746 return $i;
747 throw new Exception("COL INVAL ".$p_key);
748 }

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 1129 of file manage_table_sql.class.php.

1130 {
1131 return $this->current_row;
1132 }
$current_row
CSS class for the dialog box.

References $current_row.

◆ get_dialog_box()

Manage_Table_SQL::get_dialog_box ( )
Returns
mixed

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

248 {
249 return $this->dialog_box;
250 return $this;
251 }
$dialog_box
ID of the dialog box which display the result of the ajax calls.

References $dialog_box.

◆ get_dialogbox_style()

Manage_Table_SQL::get_dialogbox_style ( )

return the db_style

Returns
array

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

229 {
231 }
$dialogbox_style
style of the dialog box

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 341 of file manage_table_sql.class.php.

342 {
343 if (isset($this->aerror[$p_col]))
344 return $this->aerror[$p_col];
345 return "";
346 }

References $p_col.

Referenced by display_error(), Template_Card_Category\input(), Tva_Rate_MTable\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 428 of file manage_table_sql.class.php.

429 {
430 if (!isset($this->a_type[$p_key]))
431 throw new Exception("invalid key $p_key");
432
433 return $this->a_header_option[$p_col];
434 }

References $p_col.

◆ get_icon_del()

Manage_Table_SQL::get_icon_del ( )

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

296 {
297 return $this->icon_del;
298 }
$icon_del
place of right or left the icon update or mod, default right, accepted value=left,...

References $icon_del.

◆ get_icon_mod()

Manage_Table_SQL::get_icon_mod ( )

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

292 {
293 return $this->icon_mod;
294 }
$icon_mod
place of right or left the icon update or mod, default right, accepted value=left,...

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 496 of file manage_table_sql.class.php.

497 {
498 return $this->object_name;
499 }
$object_name
Object_name is used for the javascript , it is the row id to update or delete.

References $object_name.

◆ get_json()

Manage_Table_SQL::get_json ( )

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

509 {
511 }
$json_parameter
Default parameter to add (gDossier...), sent to the ajax callback.

References $json_parameter.

◆ get_object_name()

Manage_Table_SQL::get_object_name ( )

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

512 {
513 return $this->object_name;
514 }

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 308 of file manage_table_sql.class.php.

309 {
310 return $this->a_order;
311 }

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 686 of file manage_table_sql.class.php.

687 {
688 $val=$this->a_prop[$p_key]&self::UPDATABLE;
689 if ($val==self::UPDATABLE)
690 return true;
691 return false;
692 }

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 718 of file manage_table_sql.class.php.

719 {
720 $val=$this->a_prop[$p_key]&self::VISIBLE;
721 if ($val===self::VISIBLE)
722 return true;
723 return false;
724 }

References $val, and VISIBLE.

Referenced by Acc_Plan_MTable\display_row(), 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 200 of file manage_table_sql.class.php.

201 {
202 return $this->search_table;
203 }
$search_table
boolean , by default true ,it is possible to search in the table,

References $search_table.

Referenced by display_table().

◆ get_sort_column()

Manage_Table_SQL::get_sort_column ( )

return the column to sort

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

946 {
947 return $this->sort_column;
948 }
$sort_column
javascript sort on this column , if empty there is no js sort

References $sort_column.

◆ get_table()

Manage_Table_SQL::get_table ( )

◆ getCssClass()

Manage_Table_SQL::getCssClass ( )

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

181 {
182 return $this->cssclass;
183 }
$cssclass
< give the title of the diabox , default is Data

References $cssclass.

◆ getTitle()

Manage_Table_SQL::getTitle ( )

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

193 {
194 return $this->title;
195 }

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_Other_Tax_MTable, Acc_Plan_MTable, Action_Document_Type_MTable, Currency_MTable, Forecast_Category_MTable, Forecast_Item_MTable, Operation_Predef_MTable, Tag_Group_MTable, Template_Card_Category, and Tva_Rate_MTable.

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

1174 {
1175 $nb_order=count($this->a_order);
1176 echo "<table>";
1177 for ($i=0; $i<$nb_order; $i++)
1178 {
1179 echo "<tr>";
1180 $key=$this->a_order[$i];
1181 $label=$this->a_label_displaid[$key];
1182 $value=$this->table->get($key);
1183 $error=$this->get_error($key);
1185 if ($this->get_property_visible($key)===TRUE)
1186 {
1187 // Label
1188 $info="";
1189 if ( isset($this->a_info[$key])) {
1190 $info=Icon_Action::infobulle($this->a_info[$key]);
1191 }
1192 // Label
1193 echo "<td> {$label} {$info} {$error}</td>";
1194
1195 if ($this->get_property_updatable($key)==TRUE)
1196 {
1197 echo "<td>";
1198 if ($this->a_type[$key]=="select")
1199 {
1200 $select=new ISelect($key);
1201 $select->value=$this->a_select[$key];
1202 $select->selected=$value;
1203 echo $select->input();
1204 }
1205 elseif ($this->a_type[$key]=="text")
1206 {
1207 $text=new IText($key);
1208 $text->value=$value;
1209 $min_size=(noalyss_strlen($value)<30)?30:strlen($value)+5;
1210 $text->size=$min_size;
1211 echo $text->input();
1212 }
1213 elseif ($this->a_type[$key]=="numeric") // number from db
1214 {
1215 $text=new INum($key);
1216 $text->value=$value;
1217 $min_size=(noalyss_strlen($value)<10)?10:strlen($value)+1;
1218 $text->size=$min_size;
1219 echo $text->input();
1220 }
1221 elseif ($this->a_type[$key]=="numeric2") // number from db
1222 {
1223 $text=new INum($key);
1224 $this->prec=2;
1225 $text->value=round($value??"0",2);
1226 $min_size=(noalyss_strlen($value)<10)?10:strlen($value)+1;
1227 $text->size=$min_size;
1228 echo $text->input();
1229 }
1230 elseif ($this->a_type[$key]=="numeric4") // number 4 decimale
1231 {
1232 $text=new INum($key);
1233 $text->prec=4;
1234 $text->value=round($value??"0",4);;
1235 $min_size=(noalyss_strlen($value)<10)?10:strlen($value)+1;
1236 $text->size=$min_size;
1237 echo $text->input();
1238 }
1239 elseif ($this->a_type[$key]=="numeric6") // number 6 decimale
1240 {
1241 $text=new INum($key);
1242 $text->prec=6;
1243 $text->value=round($value??"0",6);
1244 $min_size=(noalyss_strlen($value)<10)?10:strlen($value)+1;
1245 $text->size=$min_size;
1246 echo $text->input();
1247 }
1248 elseif ($this->a_type[$key]=="date")
1249 {
1250 $text=new IDate($key);
1251 $text->value=$value;
1252 $min_size=10;
1253 $text->size=$min_size;
1254 echo $text->input();
1255 } elseif ($this->a_type[$key]=="custom")
1256 {
1257 $this->input_custom($key,$value);
1258 }
1259 echo "</td>";
1260 }
1261 else
1262 {
1263 printf('<td>%s %s</td>', h($value),
1265 );
1266 }
1267 }
1268 echo "</tr>";
1269 }
1270 echo "</table>";
1271 return true;
1272 }
noalyss_strlen($p_string)
Definition: ac_common.php:1541
static errorbulle($p_comment)
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:34
This class handles only the numeric input, the input will call a javascript to change comma to period...
Definition: inum.class.php:42
Html Input , create a tag <SELECT> ... </SELECT> if readonly == true then display the label correspon...
Html Input.
Definition: itext.class.php:30
static infobulle($p_comment)
Display a info in a bubble, text is in message_javascript.
input_custom($p_key, $p_value)
this function let you create your own input , for example for a ITEXT , a IRADIO ,...
$max_email_input prec

References $error, $i, $label, $select, $text, $value, elseif, HtmlInput\errorbulle(), get_error(), get_property_updatable(), get_property_visible(), h, HtmlInput\hidden(), Icon_Action\infobulle(), input_custom(), noalyss_strlen(), prec, 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;
}
}
foreach($array as $idx=> $m) $w
Input HTML for the card show buttons, in the file, you have to add card.js How to use :
Parameters
string$p_keyname of the column
string$p_valuecurrent value
Returns
nothing

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

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

1290 {
1291 throw new Exception(__FILE__.":".__LINE__."- input_custom "._("non implémenté"));
1292 }

Referenced by input().

◆ insert()

Manage_Table_SQL::insert ( )

insert a new value

See also
set_pk_value
from_request

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

1531 {
1532 $this->table->insert();
1533 }

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 760 of file manage_table_sql.class.php.

761 {
762 // get current position of p_key
763 $cur_pos=$this->get_current_pos($p_key);
764
765 if ($cur_pos==$p_idx)
766 return;
767
768 if ($cur_pos<$p_idx)
769 {
770 $nb_order=count($this->a_order);
771 for ($i=0; $i<$nb_order; $i++)
772 {
773 // if col_name is not the searched one we continue
774 if ($this->a_order[$i]!=$p_key)
775 continue;
776 if ($p_idx==$i)
777 continue;
778 // otherwise we swap with i+1
779 $old=$this->a_order[$i+1];
780 $this->a_order[$i]=$this->a_order[$i+1];
781 $this->a_order[$i+1]=$p_key;
782 }
783 } else
784 {
785
786 $nb_order=count($this->a_order)-1;
787 for ($i=$nb_order; $i>0; $i--)
788 {
789 // if col_name is not the searched one we continue
790 if ($this->a_order[$i]!=$p_key)
791 continue;
792 if ($p_idx==$i)
793 continue;
794 // otherwise we swap with i+1
795 $old=$this->a_order[$i-1];
796 $this->a_order[$i]=$this->a_order[$i-1];
797 $this->a_order[$i-1]=$p_key;
798 }
799 }
800 }
get_current_pos($p_key)
get the position of a column

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 523 of file manage_table_sql.class.php.

524 {
525 $this->set_json($p_json);
526 }
set_json($p_json)
Set the parameter of the object (gDossier, ac, plugin_code...) @detail By default ,...

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, Operation_Predef_MTable, and Tva_Rate_MTable.

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

1514 {
1515 if ($this->table->exist()==0)
1516 {
1517 $this->table->insert();
1518 }
1519 else
1520 {
1521 $this->table->update();
1522 }
1523 }

References table.

Referenced by ajax_save().

◆ send_header()

Manage_Table_SQL::send_header ( )

send the XML headers for the ajax call

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

220 {
221 header('Content-type:text/xml;charset="UTF-8"');
222 }

◆ 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 656 of file manage_table_sql.class.php.

657 {
658 if ($p_value!==True&&$p_value!==False)
659 throw new Exception("Valeur invalide set_append_row [$p_value]");
660 $this->row_append=$p_value;
661 }

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

◆ set_button_add_top()

Manage_Table_SQL::set_button_add_top (   $button_add_top)

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

807 {
808 $this->button_add_top=$button_add_top;
809 return $this;
810 }

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 542 of file manage_table_sql.class.php.

543 {
544 $this->callback=$p_file;
545 }

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

◆ 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 415 of file manage_table_sql.class.php.

416 {
417
418 if (!isset($this->a_type[$p_key]))
419 throw new Exception("invalid key $p_key");
420 $this->a_col_option[$p_key]=$p_value;
421 return $this;
422 }

◆ 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 288 of file manage_table_sql.class.php.

288 {
289 $this->col_sort=$p_num;
290 }

Referenced by Card_Attribut_MTable\__construct(), Anc_Account_Table\__construct(), Operation_Predef_MTable\__construct(), and Mobile_Device_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 278 of file manage_table_sql.class.php.

278 {
279 $this->a_info[$p_key]=$p_comment;
280 }

Referenced by Card_Attribut_MTable\__construct(), Payment_Method_MTable\__construct(), and Mobile_Device_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 460 of file manage_table_sql.class.php.

461 {
462 if (!isset($this->a_type[$p_key]))
463 throw new Exception("invalid key $p_key");
464
465 if (!in_array($p_value,
466 array("text", "numeric","numeric2", "numeric4","numeric6","date", "select", "timestamp","custom")))
467 throw new Exception("invalid type $p_value");
468
469 $this->a_type[$p_key]=$p_value;
470 $this->a_select[$p_key]=$p_array;
471 if ( in_array($p_value ,array("numeric","numeric2","numeric4","numeric6")) && $this->a_col_option[$p_key]=="") {
472 $this->a_col_option[$p_key]=' class="num" ';
473 }
474
475 }

References $p_array.

Referenced by Card_Attribut_MTable\__construct(), Payment_Method_MTable\__construct(), Acc_Plan_MTable\__construct(), Contact_Option_Ref_MTable\__construct(), Anc_Account_Table\__construct(), Document_State_MTable\__construct(), Operation_Predef_MTable\__construct(), Mobile_Device_MTable\__construct(), Currency_MTable\__construct(), and Tva_Rate_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 1138 of file manage_table_sql.class.php.

1139 {
1140 $this->current_row=$current_row;
1141 return $this;
1142 }

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 645 of file manage_table_sql.class.php.

646 {
647 if ($p_value!==True&&$p_value!==False)
648 throw new Exception("Valeur invalide set_delete_row [$p_value]");
649 $this->row_delete=$p_value;
650 }

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

◆ set_dialog_box()

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

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

257 {
258 $this->dialog_box = $dialog_box;
259 return $this;
260 }

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 238 of file manage_table_sql.class.php.

239 {
240 $this->dialogbox_style = $db_style;
241 return $this;
242 }

Referenced by Acc_Plan_MTable\__construct().

◆ 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 441 of file manage_table_sql.class.php.

442 {
443 if (!isset($this->a_type[$p_key]))
444 throw new Exception("invalid key $p_key");
445 $this->a_header_option[$p_key]=$p_value;
446 return $this;
447 }

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 627 of file manage_table_sql.class.php.

627 {
628 if ($pString != "right" && $pString != "left" )
629 throw new Exception('set_icon_del invalide '.$pString);
630 $this->icon_del=$pString;
631 }

◆ 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, if the mod if custom , you have to override the function display_icon_custom.

See also
Manage_Table_SQL::display_icon_custom($p_row)
Parameters
string$pStringdefault right, accepted value=left,right,first,custom column for mod
Exceptions
Exceptionif invalide choice

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

617 {
618 if (! in_array( $pString ,[ 'right','left','custom','first'] ) )
619 throw new Exception('set_icon_mod invalide '.$pString);
620 $this->icon_mod=$pString;
621 }

Referenced by Acc_Plan_MTable\__construct(), and 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 533 of file manage_table_sql.class.php.

534 {
535 $this->json_parameter=$p_json;
536
537 }

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 578 of file manage_table_sql.class.php.

579 {
580 $this->object_name=$p_object_name;
581 }

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

◆ set_order()

Manage_Table_SQL::set_order (   $p_order)

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

313 {
314 if (! is_array($p_order) )
315 throw new Exception("set_order, parameter is not an array");
316 $this->a_order=$p_order;
317 }

References $p_order.

Referenced by Card_Attribut_MTable\__construct(), Payment_Method_MTable\__construct(), Action_Document_Type_MTable\__construct(), Operation_Predef_MTable\__construct(), and Mobile_Device_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 953 of file manage_table_sql.class.php.

954 {
955 $this->table->set_pk_value($p_id);
956 $this->table->load();
957 }

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 588 of file manage_table_sql.class.php.

589 {
590 if (! isset($this->a_prop[$p_key]))
591 throw new Exception(__FILE__.":".__LINE__."$p_key invalid index");
592 // if already done returns
593 if ( $this->get_property_updatable($p_key) == $p_value)return;
594 if ($p_value==False)
595 $this->a_prop[$p_key]=$this->a_prop[$p_key]-self::UPDATABLE;
596 elseif ($p_value==True)
597 $this->a_prop[$p_key]=$this->a_prop[$p_key]|self::UPDATABLE;
598 else
599 throw new Exception("set_property_updatable [ $p_value ] incorrect");
600 }

References elseif, get_property_updatable(), and UPDATABLE.

Referenced by Card_Attribut_MTable\__construct(), Acc_Plan_MTable\__construct(), Anc_Account_Table\__construct(), Document_State_MTable\__construct(), Action_Document_Type_MTable\__construct(), Template_Card_Category\__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 699 of file manage_table_sql.class.php.

700 {
701 if (!isset ($this->a_prop[$p_key]) )
702 throw new Exception(__FILE__.":".__LINE__."$p_key invalid index");
703 // if already done return
704 if ( $this->get_property_visible($p_key) == $p_value)return;
705
706 if ($p_value==False)
707 $this->a_prop[$p_key]=$this->a_prop[$p_key]-self::VISIBLE;
708 elseif ($p_value==True)
709 $this->a_prop[$p_key]=$this->a_prop[$p_key]|self::VISIBLE;
710 else
711 throw new Exception("set_property_updatable [ $p_value ] incorrect");
712 }

References elseif, get_property_visible(), and VISIBLE.

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

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

211 {
212 $this->search_table=$search_table;
213 return $this;
214 }

References $search_table.

◆ set_sort_column()

Manage_Table_SQL::set_sort_column (   $p_col)

set the column to sort by default

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

939 {
940 $this->sort_column=$p_col;
941 }

References $p_col.

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

◆ set_table()

Manage_Table_SQL::set_table ( Data_SQL  $p_noalyss_sql)

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

305 {
306 $this->table=$p_noalyss_sql;
307 }

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 667 of file manage_table_sql.class.php.

668 {
669 if ($p_value!==True&&$p_value!==False)
670 throw new Exception("Valeur invalide set_update_row [$p_value]");
671 $this->row_update=$p_value;
672 }

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

◆ set_value()

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

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

1551 {
1552 $this->table->set($p_key, $p_value);
1553 }

References table.

◆ setCssClass()

Manage_Table_SQL::setCssClass (   $p_class)

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

178 {
179 $this->cssclass=$p_class;
180 }

◆ setTitle()

Manage_Table_SQL::setTitle (   $p_title)

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

Parameters
type$p_title

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

189 {
190 $this->title=$p_title;
191 }

References title.

◆ show_error()

Manage_Table_SQL::show_error (   $p_col)

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

568 {
569 $error=$this->get_error($p_col);
570 if ($error == "") { return "";}
572 }

References $error, $p_col, 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 1540 of file manage_table_sql.class.php.

1541 {
1542 $this->table->update();
1543 }

References table.

Field Documentation

◆ $a_col_option

Manage_Table_SQL::$a_col_option
protected

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 130 of file manage_table_sql.class.php.

◆ $a_header_option

Manage_Table_SQL::$a_header_option
protected

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

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

◆ $a_info

Manage_Table_SQL::$a_info
protected

Array with the infotip.

Definition at line 116 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 104 of file manage_table_sql.class.php.

◆ $a_order

Manage_Table_SQL::$a_order
protected

order of the col

Definition at line 105 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 106 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 108 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 107 of file manage_table_sql.class.php.

◆ $aerror

Manage_Table_SQL::$aerror
protected

Array containing the error of the input data.

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

◆ $button_add_top

Manage_Table_SQL::$button_add_top
protected

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

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

Referenced by get_button_add_top(), and set_button_add_top().

◆ $callback

Manage_Table_SQL::$callback
protected

Callback function.

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

◆ $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 115 of file manage_table_sql.class.php.

Referenced by display_row(), and get_col_sort().

◆ $cssclass

Manage_Table_SQL::$cssclass
protected

< give the title of the diabox , default is Data

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

Referenced by getCssClass().

◆ $current_row

Manage_Table_SQL::$current_row
protected

CSS class for the dialog box.

Definition at line 129 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 118 of file manage_table_sql.class.php.

Referenced by get_dialog_box(), and set_dialog_box().

◆ $dialogbox_style

Manage_Table_SQL::$dialogbox_style
protected

style of the dialog box

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

Referenced by get_dialogbox_style().

◆ $icon_del

Manage_Table_SQL::$icon_del
protected

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

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

Referenced by get_icon_del().

◆ $icon_mod

Manage_Table_SQL::$icon_mod
protected

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

Definition at line 123 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 113 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 109 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 112 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 110 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 111 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 119 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 117 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 127 of file manage_table_sql.class.php.

Referenced by getTitle().

◆ UPDATABLE

const Manage_Table_SQL::UPDATABLE =1

Definition at line 120 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: