Ignore:
Timestamp:
May 13, 2010, 10:12:38 PM (14 years ago)
Author:
grum
Message:

Improve functionnalities for GPCTabSheet and GPCRequestBuilder classes

Location:
extensions/GrumPluginClasses/classes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/GrumPluginClasses/classes/GPCRequestBuilder.class.inc.php

    r6106 r6174  
    100100
    101101
     102  /**
     103   * this function is called by the request builder to make the search page, and
     104   * must return the HTML & JS code of the dialogbox used to select criterion
     105   *
     106   * Notes :
     107   *  - the dialogbox is a JS object with a public method 'show'
     108   *  - when the method show is called, one parameter is given by the request
     109   *    builder ; the parameter is an object defined as this :
     110   *      {
     111   *        cBuilder: an instance of the criteriaBuilder object used in the page,
     112   *      }
     113   *
     114   *
     115   *
     116   *
     117   * @param String $mode : can take 'admin' or 'public' values, allowing to
     118   *                       return different interface if needed
     119   * @return String : HTML formatted value
     120   */
     121  static public function getInterfaceContent($mode='admin')
     122  {
     123    return("");
     124  }
     125
     126  /**
     127   * this function returns the label displayed in the criterion menu
     128   *
     129   * @return String : label displayed in the criterions menu
     130   */
     131  static public function getInterfaceLabel()
     132  {
     133    return(l10n('gpc_rb_unknown_interface'));
     134  }
     135
     136  /**
     137   * this function returns the name of the dialog box class
     138   *
     139   * @return String : name of the dialogbox class
     140   */
     141  static public function getInterfaceDBClass()
     142  {
     143    return('');
     144  }
     145
     146
    102147}
    103148
     
    119164   * @return Boolean : true if registering is Ok, otherwise false
    120165   */
    121   static public function register($pluginName, $fileName)
     166  static public function register($pluginName, $fileName, $dialogBoxObject)
    122167  {
    123168    $config=Array();
     
    127172        'name' => $pluginName,
    128173        'fileName' => $fileName,
     174        'dialogBox' => $dialogBoxObject,
    129175        'date' => date("Y-m-d H:i:s"),
    130176        'version' => self::$version,
     
    880926
    881927
     928
     929  /**
     930   * display search page
     931   */
     932  static public function displaySearchPage()
     933  {
     934    global $template, $lang;
     935
     936    load_language('rbuilder.lang', GPC_PATH);
     937
     938    $template->set_filename('gpc_search_page',
     939                dirname(dirname(__FILE__)).'/templates/GPCRequestBuilder_search.tpl');
     940
     941    $registeredPlugin=self::getRegistered();
     942    $dialogBox=Array();
     943    foreach($registeredPlugin as $key=>$val)
     944    {
     945      if(array_key_exists($key, $registeredPlugin))
     946      {
     947        if(file_exists($registeredPlugin[$key]['fileName']))
     948        {
     949          include_once($registeredPlugin[$key]['fileName']);
     950
     951          $dialogBox[]=Array(
     952            'handle' => $val['name'].'DB',
     953            'dialogBoxClass' => call_user_func(Array('RBCallBack'.$key, 'getInterfaceDBClass')),
     954            'label' => call_user_func(Array('RBCallBack'.$key, 'getInterfaceLabel')),
     955            'content' => call_user_func(Array('RBCallBack'.$key, 'getInterfaceContent')),
     956          );
     957        }
     958      }
     959    }
     960
     961    $datas=Array(
     962      'dialogBox' => $dialogBox,
     963      'themeName' => $template->get_themeconf('name'),
     964    );
     965
     966    $template->assign('datas', $datas);
     967
     968    return($template->parse('gpc_search_page', true));
     969  } //displaySearchPage
     970
    882971}
    883972
  • extensions/GrumPluginClasses/classes/GPCTabSheet.class.inc.php

    r5918 r6174  
    6262  }
    6363
     64
     65  function add($name, $caption, $url, $selected = false, $onClick='')
     66  {
     67    if(parent::add($name,$caption,$url,$selected))
     68    {
     69      $this->sheets[$name]['onClick'] = $onClick;
     70      return(true);
     71    }
     72    return(false);
     73  }
    6474
    6575  public function setClasses($classes)
Note: See TracChangeset for help on using the changeset viewer.