Source for file help.cmdline.php

Documentation is available at help.cmdline.php

  1. <?php
  2. /**
  3. * @package     jelix-modules
  4. * @subpackage  jelix
  5. * @author      Loic Mathaud
  6. * @contributor Christophe Thiriot
  7. * @copyright   2006 Loic Mathaud
  8. * @copyright   2008 Christophe Thiriot
  9. * @licence     http://www.gnu.org/licenses/gpl.html GNU General Public Licence, see LICENCE file
  10. */
  11.  
  12. /**
  13.  * @package    jelix-modules
  14.  * @subpackage jelix
  15.  */
  16. class helpCtrl extends jControllerCmdLine {
  17.     protected $allowed_options = array(
  18.             'index' => array());
  19.  
  20.     protected $allowed_parameters = array(
  21.             'index' => array('cmd_name' => false));
  22.  
  23.     /**
  24.     *
  25.     */
  26.     public function index() {
  27.         global $gJConfig;
  28.  
  29.         $rep = $this->getResponse();
  30.  
  31.         $cmd_name = $this->param('cmd_name');
  32.  
  33.         if (empty($cmd_name)) {
  34.             $rep->addContent("
  35. General purpose:
  36.     php cmdline.php help [COMMAND]
  37.  
  38.     COMMAND : name of the command to launch
  39.                'module~controller:action' or more simply
  40.                'controller:action' or 'action', depending of the app configuration
  41. ");
  42.         } else {
  43.             if (!preg_match('/(?:([\w\.]+)~)/', $cmd_name)) {
  44.                 $cmd_name = $gJConfig->startModule.'~'.$cmd_name;
  45.             }
  46.             $selector = new jSelectorAct($cmd_name);
  47.  
  48.             include($selector->getPath());
  49.             $ctrl = $selector->getClass();
  50.             $ctrl = new $ctrl(null);
  51.             $help = $ctrl->help;
  52.  
  53.             $rep->addContent("
  54. Use of the command ". $selector->method ." :
  55. ");
  56.             if (isset($help[$selector->method]) && $help[$selector->method] !='') {
  57.                 $rep->addContent($help[$selector->method]."\n\n");
  58.             } else {
  59.                 $rep->addContent("\tNo availabled help for this command\n\n");
  60.             }
  61.         }
  62.         return $rep;
  63.     }
  64. }

Documentation generated on Thu, 19 Sep 2013 00:01:49 +0200 by phpDocumentor 1.4.3