class_html_input.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003  *   This file is part of PhpCompta.
00004  *
00005  *   PhpCompta is free software; you can redistribute it and/or modify
00006  *   it under the terms of the GNU General Public License as published by
00007  *   the Free Software Foundation; either version 2 of the License, or
00008  *   (at your option) any later version.
00009  *
00010  *   PhpCompta is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU General Public License
00016  *   along with PhpCompta; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 
00020 /* $Revision: 5092 $ */
00021 
00022 // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
00023 
00024 /*! \file
00025  * \brief This class is used to create all the HTML INPUT TYPE
00026  */
00027 
00028 /*!
00029  * \brief class widget This class is used to create all the HTML INPUT TYPE
00030  *        and some specials which works with javascript like
00031  *        js_search.
00032  *
00033  * special value
00034  *    js_search and js_search_only :you need to add a span widget the name
00035  *    of the js_* widget + '_label' , the member extra contains cred,deb to
00036  *    filter the search of cred of deb of a jrn or contains a string with
00037  *    a list of frd_id.
00038  *    Possible type
00039  *    $type
00040  *      - TEXT
00041  *      - HIDDEN
00042  *      - BUTTON in this->js you have the javascript code
00043  *      - SELECT the options are passed via this->value, this array is
00044  *        build thanks the make_array function, each array (of the
00045  *        array) aka row must contains a field value and a field label
00046  *      - PASSWORD
00047  *      - CHECKBOX
00048  *      - RADIO
00049  *      - TEXTAREA
00050  *      - RICHTEXT
00051  *      - FILE
00052  *      - SPAN
00053  */
00054 class HtmlInput
00055 {
00056 
00057     var $type;                      /*!<  $type type of the widget */
00058     var $name;                      /*!<  $name field NAME of the INPUT */
00059     var $value;                     /*!<  $value what the INPUT contains */
00060     var $readOnly;                  /*!<  $readonly true : we cannot change value */
00061     var $size;                      /*!<  $size size of the input */
00062     var $selected;                  /*!<  $selected for SELECT RADIO and CHECKBOX the selected value */
00063     var $table;                     /*!<  $table =1 add the table tag */
00064     var $label;                     /*!<  $label the question before the input */
00065     var $disabled;                  /*!<  $disabled poss. value == true or nothing, to disable INPUT*/
00066     var $extra;                     /*!<  $extra different usage, it depends of the $type */
00067     var $extra2;                    /*!<  $extra2 different usage,
00068                                                                                 it depends of the $type */
00069     var $javascript;                               /*!< $javascript  is the javascript to add to the widget */
00070     var $ctrl;                                          /*!<$ctrl is the control to update (see js_search_card_control) */
00071 
00072     var $tabindex;
00073     function __construct($p_name="",$p_value="")
00074     {
00075         $this->name=$p_name;
00076         $this->readOnly=false;
00077         $this->size=20;
00078         $this->width=50;
00079         $this->heigh=20;
00080         $this->value=$p_value;
00081         $this->selected="";
00082         $this->table=0;
00083         $this->disabled=false;
00084         $this->javascript="";
00085         $this->extra2="all";
00086         $this->attribute=array();
00087 
00088     }
00089     function setReadOnly($p_read)
00090     {
00091         $this->readOnly=$p_read;
00092     }
00093     /*!\brief set the extra javascript property for the INPUT field
00094      *\param $p_name name of the parameter
00095      *\param $p_value default value of this parameter
00096      */
00097     public function set_attribute($p_name,$p_value)
00098     {
00099         $this->attribute[]=array($p_name,$p_value);
00100         $this->$p_name=$p_value;
00101     }
00102     /**
00103      *@brief you can add attribute to this in javascript
00104      * this function is a wrapper and create a script (in js) to modify
00105      * "this" (in javascript) with the value of obj->attribute from PHP
00106      *@return return string with the javascript code
00107      */
00108     public function get_js_attr()
00109     {
00110         require_once('function_javascript.php');
00111         $attr="";
00112         if ( count($this->attribute) == 0) return "";
00113 
00114         /* Add properties at the widget */
00115         for ($i=0;$i< count($this->attribute);$i++)
00116         {
00117             list($name,$value)=$this->attribute[$i];
00118             $tmp1=sprintf("$('%s').%s='%s';",
00119                           $this->name,
00120                           $name,
00121                           $value);
00122             $attr.=$tmp1;
00123         }
00124         $attr=create_script($attr);
00125         return $attr;
00126     }
00127     /**
00128      * Make a JSON object, this method create a javascript object
00129      * with the attribute set, it returns a javascript string with the object
00130      * @param $p_name : name of the object, can be null. If the name is not null, return
00131      * $p_name={} otherwise only the object {}
00132      * @return javascript string with the object
00133      * @note: there is not check on the key->value, so you could need to escape
00134      * special char as quote, single-quote...
00135      * @code
00136     $a=new IButton()
00137     $a->set_attribute('prop','1');
00138     $a->set_attribute('prop','2');
00139     $a->set_attribute('prop','3');
00140     $string = $a->make_object('property');
00141     echo $string => property={'prop':'1','prop2':'2','prop3':'3'};
00142     $string = $a->make_object(null);
00143     echo $string => {'prop':'1','prop2':'2','prop3':'3'};
00144     @endcode
00145     */
00146     public function make_object($p_name=null)
00147     {
00148         $name=($p_name != null)?$p_name.'=':'';
00149         if ( count($this->attribute) == 0) return $name."{}";
00150         $ret=$name."{";
00151         $and='';
00152 
00153         for ($i=0;$i< count($this->attribute);$i++)
00154         {
00155             list($name,$value)=$this->attribute[$i];
00156             $tmp1=sprintf($and."'%s':'%s'",
00157                           $name,
00158                           $value);
00159             $ret.=$tmp1;
00160             $and=',';
00161         }
00162 
00163         $ret.='}';
00164         return $ret;
00165     }
00166     //#####################################################################
00167     /* Debug
00168      */
00169     function debug()
00170     {
00171         echo "Type ".$this->type."<br>";
00172         echo "name ".$this->name."<br>";
00173         echo "value". $this->value."<br>";
00174         $readonly=($this->readonly==false)?"false":"true";
00175         echo "read only".$readonly."<br>";
00176     }
00177     static   function submit ($p_name,$p_value,$p_javascript="")
00178     {
00179 
00180         return '<INPUT TYPE="SUBMIT" class="button" NAME="'.$p_name.'" VALUE="'.$p_value.'" '.$p_javascript.'>';
00181     }
00182     static   function button ($p_name,$p_value,$p_javascript="")
00183     {
00184 
00185         return '<INPUT TYPE="button" class="button" NAME="'.$p_name.'" ID="'.$p_name.'" VALUE="'.$p_value.'" '.$p_javascript.'>';
00186     }
00187 
00188     static function reset ($p_value)
00189     {
00190         return '<INPUT TYPE="RESET" class="button" VALUE="'.$p_value.'">';
00191     }
00192     static function hidden($p_name,$p_value,$p_id="")
00193     {
00194                 if ($p_id=="") $p_id=$p_name;
00195         return '<INPUT TYPE="hidden" id="'.$p_id.'" NAME="'.$p_name.'" VALUE="'.$p_value.'">';
00196     }
00197 
00198     static function extension()
00199     {
00200         return self::hidden('plugin_code',$_REQUEST['plugin_code']);
00201     }
00202 
00203     /*!\brief create a button with a ref
00204      *\param $p_label the text
00205      *\param $p_value the location of the window,
00206      *\param $p_name the id of the span
00207      *\param $p_javascript javascript for this button
00208      *\return string with htmlcode
00209      */
00210     static function button_anchor($p_label,$p_value,$p_name="",$p_javascript="")
00211     {
00212         $r=sprintf('<span id="%s" > <A class="button" style="display:inline;"  href="%s" %s >%s</A></span>',
00213                    $p_name,
00214                    $p_value,
00215                    $p_javascript,
00216                    $p_label);
00217         return $r;
00218     }
00219     static function infobulle($p_comment)
00220     {
00221         $r='<A HREF="#" style="display:inline;color:black;background-color:yellow;padding-left:4px;width:2em;padding-right:4px;text-decoration:none;" onmouseover="showBulle(\''.$p_comment.'\')"  onclick="showBulle(\''.$p_comment.'\')" onmouseout="hideBulle(0)">?</A>';
00222         return $r;
00223     }
00224     static function warnbulle($p_comment)
00225     {
00226         $r='<A HREF="#" style="display:inline;color:red;background-color:white;padding-left:4px;padding-right:4px;text-decoration:none;" onmouseover="showBulle(\''.$p_comment.'\')"  onclick="showBulle(\''.$p_comment.'\')" onmouseout="hideBulle(0)">&Delta;</A>';
00227         return $r;
00228     }
00229     /**
00230      * return a string containing the html code for calling the modifyOperation
00231      */
00232     static function detail_op($p_jr_id,$p_mesg)
00233     {
00234         return sprintf('<A class="detail" style="text-decoration:underline;display:inline" HREF="javascript:modifyOperation(%d,%d)">%s</A>',
00235                        $p_jr_id,dossier::id(),$p_mesg);
00236     }
00237     /**
00238      * return a string containing the html code for calling the modifyModeleDocument
00239      */
00240     static function detail_modele_document($p_id,$p_mesg)
00241     {
00242         return sprintf('<A class="detail" style="text-decoration:underline" HREF="javascript:modifyModeleDocument(%d,%d)">%s</A>',
00243                        $p_id,dossier::id(),$p_mesg);
00244     }
00245 
00246     /**
00247      * return a string containing the html code for calling the removeStock
00248      */
00249     static function remove_stock($p_id,$p_mesg)
00250     {
00251         return sprintf('<A class="detail" style="text-decoration:underline" HREF="javascript:removeStock(%d,%d)">%s</A>',
00252                        $p_id,dossier::id(),$p_mesg);
00253     }
00254 
00255     /**
00256      * display a div with the history of the card
00257      */
00258     static function history_card($f_id,$p_mesg,$p_style="")
00259     {
00260         $view_history= sprintf('<A class="detail"  style="text-decoration:underline;%s" HREF="javascript:view_history_card(\'%s\',\'%s\')" >%s</A>',
00261                                $p_style,$f_id, dossier::id(), $p_mesg);
00262         return $view_history;
00263     }
00264     /**
00265      * display a div with the history of the card
00266      */
00267     static function history_card_button($f_id,$p_mesg)
00268     {
00269       static $e=0;
00270       $e++;
00271       $js= sprintf('onclick="view_history_card(\'%s\',\'%s\')"',
00272                                $f_id, dossier::id());
00273       $view_history=HtmlInput::button("hcb"+$e,$p_mesg,$js);
00274       return $view_history;
00275     }
00276 
00277     /**
00278      * display a div with the history of the account
00279      */
00280     static function history_account($p_account,$p_mesg,$p_style="")
00281     {
00282         $view_history= sprintf('<A class="detail" style="text-decoration:underline;%s" HREF="javascript:view_history_account(\'%s\',\'%s\')" >%s</A>',
00283                                $p_style,$p_account, dossier::id(), $p_mesg);
00284         return $view_history;
00285     }
00286 
00287     /**
00288      * return the html code to create an hidden div and a button
00289      * to show this DIV. This contains all the available ledgers
00290      * for the user in READ or RW
00291      *@param $p_array is an array obtains thanks User::get_ledger
00292      *@param $selected is an array of checkbox
00293      *@note the choosen ledger are stored in the array r_jrn (_GET)
00294      */
00295     static function select_ledger($p_array,$p_selected,$div='')
00296     {
00297         ob_start();
00298         $ledger=new IButton('l');
00299         $ledger->label="choix des journaux";
00300         $ledger->javascript=" show_ledger_choice()";
00301         echo $ledger->input();
00302 
00303         /* create a hidden div for the ledger */
00304         echo '<div id="div_jrn'.$div.'" >';
00305         echo '<h2 class="info">Choix des journaux</h2>';
00306 
00307         echo '<ul>';
00308         for ($e=0;$e<count($p_array);$e++)
00309         {
00310             $row=$p_array[$e];
00311             $r=new ICheckBox('r_jrn['.$e.']',$row['jrn_def_id']);
00312             $idx=$row['jrn_def_id'];
00313             if ( $p_selected != null && isset($p_selected[$e]))
00314             {
00315                 $r->selected=true;
00316             }
00317             echo '<li style="list-style-type: none;">'.$r->input().$row['jrn_def_name'].'('.$row['jrn_def_type'].')</li>';
00318 
00319         }
00320         echo '</ul>';
00321         $hide=new IButton('l');
00322         $hide->label="Valider";
00323         $hide->javascript=" hide_ledger_choice() ";
00324         echo $hide->input();
00325 
00326         echo '</div>';
00327         $ret=ob_get_contents();
00328         ob_clean();
00329         return $ret;
00330     }
00331     /**
00332      *create a hidden plus button to select the cat of ledger
00333      *@note the selected value is stored in the array p_cat
00334      */
00335     static function select_cat($array_cat)
00336     {
00337         ob_start();
00338         $ledger=new IButton('l');
00339         $ledger->label="Catégorie";
00340         $ledger->javascript=" show_cat_choice()";
00341         echo $ledger->input();
00342 
00343         /* create a hidden div for the ledger */
00344         echo '<div id="div_cat">';
00345         echo '<h2 class="info">Choix des categories</h2>';
00346         $selected=(isset($_GET['r_cat']))?$_GET['r_cat']:null;
00347 
00348         echo '<ul>';
00349         for ($e=0;$e<count($array_cat);$e++)
00350         {
00351             $row=$array_cat[$e];
00352             $re=new ICheckBox('r_cat['.$e.']',$row['cat']);
00353 
00354             if ( $selected != null && isset($selected[$e]))
00355             {
00356                 $re->selected=true;
00357             }
00358             echo '<li style="list-style-type: none;">'.$re->input().$row['name'].'('.$row['cat'].')</li>';
00359 
00360         }
00361         echo '</ul>';
00362         $hide=new IButton('l');
00363         $hide->label="Valider";
00364         $hide->javascript=" hide_cat_choice() ";
00365         echo $hide->input();
00366 
00367         echo '</div>';
00368         $r=ob_get_contents();
00369         ob_clean();
00370         return $r;
00371     }
00372     static function display_periode($p_id)
00373     {
00374       $r=sprintf('<a href="javascript:void(0)" onclick="display_periode(%d,%d)">Modifier</a>',
00375                  dossier::id(),
00376                  $p_id);
00377       return $r;
00378     }
00379     /**
00380      *close button for the HTML popup
00381      *@see add_div modify_operation
00382      *@param $div_name is the name of the div to remove
00383      */
00384     static function button_close($div_name)
00385     {
00386       $a=new IButton('Fermer','Fermer');
00387       $a->label="Fermer";
00388       $a->javascript="removeDiv('".$div_name."')";
00389       $html=$a->input();
00390 
00391       return $html;
00392 
00393     }
00394     /**
00395      * Return a html string with an anchor which close the inside popup. (top-right corner)
00396      *@param name of the DIV to close
00397      */
00398     static function anchor_close($div)
00399     {
00400         $r='';
00401         $r.='<div style="float:right;margin-right:2px;margin-top:1px;padding:0">';
00402         $r.= '<A id="close_div" HREF="javascript:void(0)" onclick="removeDiv(\''.$div.'\');">Fermer</A>';
00403         $r.='</div>';
00404         return $r;
00405     }
00406     /**
00407      * button Html
00408      *@param $action action action to perform (message) without onclick
00409      *@param $javascript javascript to execute
00410      */
00411     static function button_action($action,$javascript,$id="xx")
00412     {
00413                 $r="";
00414                 $r.='<input type="button" id="'.$id.'"class="button" onclick="'.$javascript.'" value="'.h($action).'">';
00415                 return $r;
00416 
00417     }
00418     /**
00419      * Return a html string with an anchor to hide a div, put it in the right corner
00420      *@param $action action action to perform (message)
00421      *@param $javascript javascript
00422      *@note not protected against html
00423      *@see Acc_Ledger::display_search_form
00424      */
00425     static function anchor_hide($action,$javascript)
00426     {
00427         $r='';
00428         $r.='<div style="float:right;right;margin:2;">';
00429         $r.= '<A id="close_div" HREF="javascript:void(0)" onclick="'.$javascript.'">'.$action.'</A>';
00430         $r.='</div>';
00431         return $r;
00432     }
00433 
00434     /**
00435      * Javascript to print the current window
00436      */
00437     static function print_window()
00438     {
00439         $r='';
00440         $r.=HtmlInput::button('print','Imprimer','onclick="window.print();"');
00441         return $r;
00442     }
00443     /**
00444      *show the detail of a card
00445      */
00446     static function card_detail($p_qcode,$pname='',$p_style="")
00447     {
00448       //if ($pname=='')$pname=$p_qcode;
00449       $r="";
00450       $r.=sprintf('<a href="javascript:void(0)" %s onclick="fill_ipopcard({qcode:\'%s\'})">%s [%s]</a>',
00451                   $p_style,$p_qcode,$pname,$p_qcode);
00452       return $r;
00453     }
00454     /**
00455      *transform request data  to hidden
00456      *@param $array is an of indices
00457      *@param $request name of the superglobal $_POST $_GET $_REQUEST(default)
00458      *@return html string with the hidden data
00459      */
00460     static function array_to_hidden($array,$global_array )
00461     {
00462 
00463       $r="";
00464 
00465       if ( count($global_array )==0) return '';
00466       foreach ($array  as $a)
00467         {
00468           if (isset($global_array [$a])) $r.=HtmlInput::hidden($a,$global_array [$a]);
00469         }
00470 
00471       return $r;
00472     }
00473     /**
00474      *transform $_GET   data  to hidden
00475      *@param $array is an of indices
00476      *@see HtmlInput::request_to_hidden
00477      *@return html string with the hidden data
00478      */
00479     static function get_to_hidden($array)
00480     {
00481       $r=self::array_to_hidden($array,$_GET );
00482       return $r;
00483     }
00484 
00485     /**
00486      *transform $_POST  data  to hidden
00487      *@param $array is an of indices
00488      *@see HtmlInput::request_to_hidden
00489      *@return html string with the hidden data
00490      */
00491     static function post_to_hidden($array)
00492     {
00493       $r=self::array_to_hidden($array,$_POST );
00494       return $r;
00495     }
00496 
00497     /**
00498      *transform $_REQUEST   data  to hidden
00499      *@param $array is an of indices
00500      *@see HtmlInput::request_to_hidden
00501      *@return html string with the hidden data
00502      */
00503     static function request_to_hidden($array)
00504     {
00505       $r=self::array_to_hidden($array,$_REQUEST  );
00506       return $r;
00507     }
00508 
00509     /**
00510      *transform request data  to string
00511      *@param $array is an of indices
00512      *@param $request name of the superglobal $_POST $_GET $_REQUEST(default)
00513      *@return html string with the string data
00514      */
00515     static function array_to_string($array,$global_array,$start="?" )
00516     {
00517 
00518       $r=$start;
00519 
00520       if ( count($global_array )==0) return '';
00521       $and="";
00522       foreach ($array  as $a)
00523         {
00524           if (isset($global_array [$a]))
00525              $r.=$and."$a=".$global_array [$a];
00526           $and="&amp;";
00527         }
00528 
00529       return $r;
00530     }
00531     /**
00532      *transform $_GET   data  to string
00533      *@param $array is an of indices
00534      *@see HtmlInput::request_to_string
00535      *@return html string with the string data
00536      */
00537     static function get_to_string($array,$start="?")
00538     {
00539       $r=self::array_to_string($array,$_GET ,$start);
00540       return $r;
00541     }
00542 
00543     /**
00544      *transform $_POST  data  to string
00545      *@param $array is an of indices
00546      *@see HtmlInput::request_to_string
00547      *@return html string with the string data
00548      */
00549     static function post_to_string($array)
00550     {
00551       $r=self::array_to_string($array,$_POST );
00552       return $r;
00553     }
00554 
00555     /**
00556      *transform $_REQUEST   data  to string
00557      *@param $array is an of indices
00558      *@see HtmlInput::request_to_string
00559      *@return html string with the string data
00560      */
00561     static function request_to_string($array,$start="?")
00562     {
00563       $r=self::array_to_string($array,$_REQUEST,$start  );
00564       return $r;
00565     }
00566 
00567     /**
00568      * generate an unique id for a widget,
00569      *@param $p_prefix prefix
00570      *@see HtmlInput::IDate
00571      *@return string with a unique id
00572      */
00573     static function generate_id($p_prefix)
00574     {
00575       $r=sprintf('%s_%d',$p_prefix,mt_rand(0,999999));
00576       return $r;
00577     }
00578     /**
00579      * return default if the value if the value doesn't exist in the array
00580      *@param $ind the index to check
00581      *@param $default the value to return
00582      *@param $array the array
00583      */
00584     static function default_value($ind,$default,$array)
00585     {
00586       if ( ! isset($array[$ind]))
00587         {
00588           return $default;
00589         }
00590       return $array[$ind];
00591     }
00592         /**
00593          *  return default if the value if the value doesn't exist in $_GET
00594          * @param  $ind name of the variable
00595          * @param type $default
00596          * @return type
00597          */
00598         static function default_value_get($ind, $default)
00599         {
00600                 if (!isset($_GET[$ind]))
00601                 {
00602                         return $default;
00603                 }
00604                 return $_GET[$ind];
00605         }
00606         /**
00607          *  return default if the value if the value doesn't exist in $_POST
00608          * @param  $ind name of the variable
00609          * @param type $default
00610          * @return type
00611          */
00612         static function default_value_post($ind, $default)
00613         {
00614                 if (!isset($_POST[$ind]))
00615                 {
00616                         return $default;
00617                 }
00618                 return $_POST[$ind];
00619         }
00620         /**
00621          *  return default if the value if the value doesn't exist in $_REQUEST
00622          * @param  $ind name of the variable
00623          * @param type $default
00624          * @return type
00625          */
00626         static function default_value_request($ind, $default)
00627         {
00628                 if (!isset($_REQUEST[$ind]))
00629                 {
00630                         return $default;
00631                 }
00632                 return $_REQUEST[$ind];
00633         }
00634         static function title_box($name,$div,$mod="close")
00635         {
00636                 if ($mod=='close')              $r=HtmlInput::anchor_close($div);
00637                 if ($mod=='hide')               $r=HtmlInput::anchor_hide(_('Fermer'),"$('$div').hide()");
00638                 $r.=h2info($name);
00639                 return $r;
00640         }
00641         /**
00642          *Return a simple anchor with a url or a javascript
00643          * if $p_js is not null then p_url will be javascript:void(0)
00644          * we don't add the event onclick. You must give p_url OR p_js
00645          * default CSS class=line
00646          * @param string $p_text text of the anchor
00647          * @param string $p_url  url
00648          * @param string $p_js javascript
00649          */
00650       static function anchor($p_text,$p_url="",$p_js="")
00651       {
00652           if ($p_js != "")
00653           {
00654               $p_url="javascript:void(0)";
00655           }
00656 
00657 
00658           $str=sprintf('<a class="line" href="%s" %s>%s</a>',
00659                   $p_url,$p_js,$p_text);
00660           return $str;
00661       }
00662       /**
00663        *Create an ISelect object containing the available repository for reading
00664        * or writing
00665        * @global $g_user
00666        * @param $p_cn db object
00667        * @param $p_name name of the select
00668        * @param $p_mode is 'R' for reading, 'W' for writinh
00669        * @return ISelect
00670        * @throws Exception if p_mode is wrong
00671        */
00672       static function select_stock( $p_cn, $p_name,$p_mode)
00673       {
00674           global $g_user;
00675           if ( ! in_array($p_mode,array('R','W') ) )
00676           {
00677               throw  new Exception  (__FILE__.":".__LINE__." $p_mode invalide");
00678           }
00679           $profile=$g_user->get_profile();
00680           $sel=new ISelect($p_name);
00681 
00682                   if ($p_mode == 'W')
00683                         {
00684                           $sel->value=$p_cn->make_array("
00685                 select r_id,r_name
00686                                   from stock_repository join profile_sec_repository using (r_id)
00687                 where
00688                  ur_right='W' and  p_id=".sql_string($profile).
00689                 " order by 2" );
00690                       return $sel;
00691                         }
00692                           if ($p_mode == 'R')
00693                         {
00694                           $sel->value=$p_cn->make_array("
00695                 select r_id,r_name
00696                                   from stock_repository join profile_sec_repository using (r_id)
00697                 where
00698                   p_id=".sql_string($profile).
00699                 " order by 2" );
00700                       return $sel;
00701                         }
00702         }
00703 }