noalyss Version-9
Public Member Functions | Static Public Member Functions | Private Attributes
Mobile_Device_MTable Class Reference

Manage the table profile_mobile. More...

+ Inheritance diagram for Mobile_Device_MTable:
+ Collaboration diagram for Mobile_Device_MTable:

Public Member Functions

 __construct (Profile_Mobile_SQL $p_table)
 
 check ()
 before inserting or updating, check that the data are correct , 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...
 
 get_profile_id ()
 
 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...
 
 set_profile_id ($profile_id)
 
- Public Member Functions inherited from Manage_Table_SQL
 __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 ()
 

Static Public Member Functions

static build ($p_id, $profile_id)
 

Private Attributes

 $profile_id
 profile_mobile.p_id profile More...
 

Additional Inherited Members

- Data Fields inherited from Manage_Table_SQL
const UPDATABLE =1
 
const VISIBLE =2
 
- Protected Attributes inherited from Manage_Table_SQL
 $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

Manage the table profile_mobile.

Definition at line 31 of file mobile_device_mtable.class.php.

Constructor & Destructor Documentation

◆ __construct()

Mobile_Device_MTable::__construct ( Profile_Mobile_SQL  $p_table)

Definition at line 35 of file mobile_device_mtable.class.php.

36 {
37 parent::__construct($p_table);
38 $this->set_append_row(true);
39 $this->set_delete_row(true);
40 $this->set_col_label("me_code", _("Code Menu"));
41 $this->set_col_label("pmo_order", _("Ordre apparition"));
42 $this->set_col_label("pmo_default", _("EntĂȘtes standards"));
43 $this->set_col_tips("pmo_default",80 );
44 $this->set_property_visible("pmo_id", false);
45 $this->set_property_visible("p_id", false);
46 $this->set_col_type("pmo_default", "select",array(
47 ["value"=>1,"label"=>_("Oui")],
48 ["value"=>0,"label"=>_("Non")]
49 ));
50 $this->set_col_type("me_code","custom");
51 $this->set_col_type("pmo_order","numeric");
52 $this->set_header_option("pmo_order",'style="text-align:right;"');
53 $this->set_callback("ajax_misc.php");
54 $this->add_json_param("op","mobile_device_menu");
55 $this->set_sort_column("pmo_order");
56 $this->set_col_sort(1);
57 $this->set_order(["me_code","pmo_order","pmo_default"]);
58
59
60 $this->set_object_name("profile_menu_mtable");
61 }
set_delete_row($p_value)
Enable or disable the deletion of rows.
set_append_row($p_value)
Enable or disable the appending of rows.
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 ...
set_col_tips($p_key, $p_comment)
Set the info for a column, use Icon_Action::infobulle the message are in message_javascript....
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 po...
set_header_option($p_key, $p_value)
add extra to column Header, normally class or style
set_object_name($p_object_name)
Set the object_name.
set_sort_column($p_col)
set the column to sort by default
add_json_param($p_attribute, $p_value)
Add json parameter to the current one.
set_callback($p_file)
set the callback function that is passed to javascript
set_property_visible($p_key, $p_value)
set a column of the data row visible or not
set_col_label($p_key, $p_display)
set the name to display for a column

References Manage_Table_SQL\add_json_param(), Manage_Table_SQL\set_append_row(), Manage_Table_SQL\set_callback(), Manage_Table_SQL\set_col_label(), Manage_Table_SQL\set_col_sort(), Manage_Table_SQL\set_col_tips(), Manage_Table_SQL\set_col_type(), Manage_Table_SQL\set_delete_row(), Manage_Table_SQL\set_header_option(), Manage_Table_SQL\set_object_name(), Manage_Table_SQL\set_order(), Manage_Table_SQL\set_property_visible(), and Manage_Table_SQL\set_sort_column().

+ Here is the call graph for this function:

Member Function Documentation

◆ build()

static Mobile_Device_MTable::build (   $p_id,
  $profile_id 
)
static
Parameters
number$p_idprofile_mobile.pmo_id
number$profile_idprofile_mobile.p_id profile
Returns
\Mobile_Device_MTable

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

82 {
85 if ( $p_id== -1) {
86 $profile_mobile->setp("pmo_order",5);
87 $profile_mobile->setp("pmo_default",1);
88 }
89
90 $mobile_device_table=new Mobile_Device_MTable($profile_mobile);
91 /* $mobile_device_table->set_profile_id($profile_id);
92 $mobile_device_table->get_table()->setp('p_id',$profile_id);*/
93 return $mobile_device_table;
94 }
static connect()
Manage the table profile_mobile.
ORM abstract of the table public.profile_mobile.
$profile_mobile

References $cn, $p_id, $profile_mobile, and Dossier\connect().

Referenced by Profile_Menu\mobile_device().

+ Here is the call graph for this function:

◆ check()

Mobile_Device_MTable::check ( )

before inserting or updating, check that the data are correct ,

Reimplemented from Manage_Table_SQL.

Definition at line 122 of file mobile_device_mtable.class.php.

123 {
124 // DB connection
125 $cn=$this->get_table()->cn;
126 // object to insert
127 $profile_mobile_sql=$this->get_table();
128 $profile_mobile_sql->me_code=strtoupper($profile_mobile_sql->getp('me_code'));
129 $me_code=$profile_mobile_sql->me_code;
130
131 $profile_id=$profile_mobile_sql->getp("p_id");
132 $pmo_id=$profile_mobile_sql->getp("pmo_id");
133
134 // check for duplicate
135 if ( $cn->get_value("select count(*) from profile_mobile where p_id = $1 and me_code=$2 and pmo_id <> $3",
136 array($profile_id,$me_code,$pmo_id )) > 0
137 ) {
138 $this->set_error("me_code", _("Doublon"));
139 }
140
141 if (isNumber($profile_mobile_sql->getp("pmo_order")) != 1 ) {
142 $this->set_error("pmo_order", _("doit ĂȘtre un nombre"));
143 }
144
145 if ( $cn->get_value("select count(*) from menu_ref where me_code=$1",[$me_code]) == 0) {
146 $this->set_error ("me_code",_('Menu code invalide'));
147 }
148 if ($this->count_error() > 0) {
149 return false;
150 }
151 return true;
152 }
isNumber($p_int)
Definition: ac_common.php:215
count_error()
returns the nb of errors found
set_error($p_col, $p_message)
set the error message for a wrong input
$profile_id
profile_mobile.p_id profile

References $cn, $me_code, $profile_id, Manage_Table_SQL\count_error(), Manage_Table_SQL\get_table(), isNumber(), and Manage_Table_SQL\set_error().

+ Here is the call graph for this function:

◆ display_row_custom()

Mobile_Device_MTable::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 from Manage_Table_SQL.

Definition at line 111 of file mobile_device_mtable.class.php.

112 {
113 if ( $p_key == 'me_code') {
114 echo td($p_value);
115 return;
116 }
117 }
td($p_string='', $p_extra='')
surround the string with td
Definition: ac_common.php:83

References td().

+ Here is the call graph for this function:

◆ get_profile_id()

Mobile_Device_MTable::get_profile_id ( )

Definition at line 62 of file mobile_device_mtable.class.php.

63 {
64 return $this->profile_id;
65 }

References $profile_id.

◆ input_custom()

Mobile_Device_MTable::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 :
input_custom($p_key, $p_value)
this function let you create your own input , for example for a ITEXT , a IRADIO ,...
Parameters
string$p_keyname of the column
string$p_valuecurrent value
Returns
nothing

Reimplemented from Manage_Table_SQL.

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

96 {
97
98 if ( $p_key == "me_code") {
99 $select = new ISelect("me_code");
100 $cn=$this->get_table()->get_cn();
101 $select->value=$cn->make_array("select me_code , me_code ||' '||coalesce(me_description,'') from menu_ref
102 where
103 me_type in ('PL','ME') and trim(me_code) != 'new_line'
104 order by me_code");
105 $select->rowsize=17;
106 $select->selected=$p_value;
107 echo td($select->input());
108 return;
109 }
110 }
Html Input , create a tag <SELECT> ... </SELECT> if readonly == true then display the label correspon...

References $cn, $select, Manage_Table_SQL\get_table(), and td().

+ Here is the call graph for this function:

◆ set_profile_id()

Mobile_Device_MTable::set_profile_id (   $profile_id)

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

68 {
69 $this->profile_id=$profile_id;
70 $this->get_table()->setp('p_id',$profile_id);
71 $this->add_json_param("profile_id",$profile_id);
72 return $this;
73 }

References $profile_id, Manage_Table_SQL\add_json_param(), and Manage_Table_SQL\get_table().

+ Here is the call graph for this function:

Field Documentation

◆ $profile_id

Mobile_Device_MTable::$profile_id
private

profile_mobile.p_id profile

Definition at line 33 of file mobile_device_mtable.class.php.

Referenced by check(), get_profile_id(), and set_profile_id().


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