Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
Class.ActionUsage.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5  * @package FDL
6 */
7 
8 /**
9  * Verify arguments for action function
10  *
11  * @brief Verify arguments for action function
12  * @class ActionUsage
13  * @code
14  $usage = new ActionUsage();
15  $usage->setText("Refresh documents ");
16  $usage->addNeeded("famid", "the family filter");
17  $usage->addOption("revision", "use all revision - default is no", array(
18  "yes",
19  "no"
20  ));
21  $usage->addOption("save", "use modify default is light", array(
22  "complete",
23  "light",
24  "none"
25  ));
26  $usage->verify();
27  * @endcode
28  */
29 class ActionUsage extends ApiUsage
30 {
31  /**
32  * init current action
33  *
34  * @param Action &$action current action
35  */
36  public function __construct(Action &$action)
37  {
38  $this->action = $action;
39  $this->setText(_($action->short_name));
40  $this->addNeeded('app', "application name");
41  $this->addNeeded('action', "action name");
42  $this->addHidden('sole', "display mode (deprecated)");
43  }
44  public function getUsage() {
45  $usage=parent::getUsage();
46  $usage=str_replace('--app=', '--app='.$this->action->parent->name.' : ' ,$usage);
47  $usage=str_replace('--action=', '--action='.$this->action->name.' : ',$usage);
48  return $usage;
49  }
50 
51 
52 }
53 ?>
← centre documentaire © anakeen - published under CC License - Dynacase