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.  
  28.         $rep = $this->getResponse();
  29.  
  30.         $cmd_name = $this->param('cmd_name');
  31.  
  32.         if (empty($cmd_name)) {
  33.             $rep->addContent("
  34. General purpose:
  35.     php cmdline.php help [COMMAND]
  36.  
  37.     COMMAND : name of the command to launch
  38.                'module~controller:action' or more simply
  39.                'controller:action' or 'action', depending of the app configuration
  40. ");
  41.         } else {
  42.             if (!preg_match('/(?:([\w\.]+)~)/', $cmd_name)) {
  43.                 $cmd_name = jApp::config()->startModule.'~'.$cmd_name;
  44.             }
  45.             $selector = new jSelectorAct($cmd_name);
  46.  
  47.             include($selector->getPath());
  48.             $ctrl = $selector->getClass();
  49.             $ctrl = new $ctrl(null);
  50.             $help = $ctrl->help;
  51.  
  52.             $rep->addContent("
  53. Use of the command ". $selector->method ." :
  54. ");
  55.             if (isset($help[$selector->method]) && $help[$selector->method] !='') {
  56.                 $rep->addContent($help[$selector->method]."\n\n");
  57.             } else {
  58.                 $rep->addContent("\tNo availabled help for this command\n\n");
  59.             }
  60.         }
  61.         return $rep;
  62.     }
  63. }

Documentation generated on Wed, 04 Jan 2017 22:51:45 +0100 by phpDocumentor 1.4.3