1: <?php
2: namespace Sphp\tools {
3: /**
4: * Description of ConsoleGate
5: *
6: * @author Sartaj Singh
7: */
8: class ConsoleGate {
9: /** @var \Sphp\kit\Page $page */
10: public $page = "";
11: /** @var string $gate_dir_path Gate folder path */
12: public $gate_dir_path = "";
13: /** @var string $phppath res folder path */
14: public $phppath = "";
15: /** @var string $respath res browser url */
16: public $respath = "";
17: /** @var \Sphp\kit\JSServer $JSServer */
18: public $JSServer = null;
19: /** @var \Sphp\core\Request $Client */
20: public $Client = null;
21: /** @var \MySQL $dbEngine */
22: public $dbEngine = null;
23: /** @var \Sphp\core\DebugProfiler $debug */
24: public $debug = null;
25: /** @var \Sphp\core\SphpApi $sphp_api */
26: public $sphp_api = null;
27: /** @var string $sphp_api */
28: public $scriptname = "";
29: /** @var array $argv */
30: public $argv = array();
31: /** @var boolean $isRunning */
32: protected $isRunning = false;
33: /** @var array $wait_interval default value 1000000 */
34: public $wait_interval = 1000000;
35: /**
36: * Set Password for Sudo command
37: * @param string $pas password
38: */
39: public function setPassword($pas) {}
40: /**
41: * enable stdout print
42: */
43: public function enableStdout() {}
44: /**
45: * Disbale stdout print
46: */
47: public function disableStdout() {}
48: /**
49: * Create Command Que
50: * @param array &$ar1 pass by reference to fill command
51: * @param string $cmd shell command
52: * @param string $msg Message to display command help
53: * @param boolean $sudo true = sudo command
54: * @param boolean $critical true = stop execution if error in this command
55: * @param function $callbackerr callback if error in this command
56: */
57: public function createQue(&$ar1, $cmd, $msg = "", $sudo = false, $critical = false, $callbackerr = null) {}
58: /**
59: * Call Command and wait to finish
60: * @param string $cmd shell command
61: * @param string &$str1 output text from command
62: * @param string $msg help text with command
63: * @param boolean $sudo true = run as sudo
64: * @return boolean true = run succesfull
65: */
66: public function callSync($cmd, &$str1, $msg = "", $sudo = false) {}
67: /**
68: * Call Command and process callback without wait to end.
69: * @param string $cmd shell command
70: * @param string $msg help text with command
71: * @param function $fun2 callback on data
72: * @param function $funer2 callback on error
73: * @param function $fun_ready2 callback process ready
74: * @return boolean true = run successful
75: */
76: public function callf($cmd, $msg = "", $fun2 = null, $funer2 = null, $fun_ready2 = null) {}
77: /**
78: * Call Shell Command With Sudo without wait for end.
79: * @param string $cmd command
80: * @param string $msg command help text
81: * @param function $fun2 callback on data
82: * @param function $funer2 callback on error
83: * @param function $fun_ready2 callback on process ready
84: * @return boolean true = run successful
85: */
86: public function callSudo($cmd, $msg = "", $fun2 = null, $funer2 = null, $fun_ready2 = null) {}
87: public function calla($cmd, $msg = "", $fun = null, $funer = null, $callback_ready = null, $statuscall = null) {}
88: /**
89: * Print Error Message on terminal
90: * @param string $str1 error msg
91: */
92: public function printer($str1) {}
93: /**
94: * Print Message on terminal
95: * @param string $str1 error msg
96: */
97: public function println($str1) {}
98: public function processCmdQue(&$ar1) {}
99: public function processIAQue(&$ar1, $cmd, $msg1 = '', $sudo = false, $fune = null) {}
100: /**
101: * print error on console or send to browser
102: * @param string $msg
103: * @param string $type 'i' mean info other mean error
104: */
105: public function sendMsg($msg, $type = 'i') {}
106: public function execShellAsync($cmd, $callback, $funer, $callback_ready = null, $cwd = "", $env = null, $options = null) {}
107: /**
108: * Remove Extra Spaces from text
109: * @param string $v1 data
110: * @return string
111: */
112: public function removeExtraSpaces($v1) {}
113: /**
114: * get Gate event name trigger by browser
115: * @return string
116: */
117: public function getEvent() {}
118: /**
119: * get Gate event parameter post by browser
120: * @return string
121: */
122: public function getEventParameter() {}
123: /**
124: * override this event handler in your Gate to handle it.
125: * trigger when Gate start
126: */
127: public function onstart() {}
128: /**
129: * override this event handler in your Gate to handle it.
130: * trigger when Gate finish process of default FrontFile
131: */
132: public function onready() {}
133: /**
134: * override this event handler in your Gate to handle it.
135: * trigger when Gate initialize FrontFile Object
136: */
137: public function onfrontinit($frontobj) {}
138: /**
139: * override this event handler in your Gate to handle it.
140: * trigger when Gate start process on FrontFile Object
141: */
142: public function onfrontprocess($frontobj) {}
143: /** Inbuilt Event
144: * override this event handler in your Gate to handle it.
145: * trigger when browser get (url=index-delete.html)
146: * where index is Gate of Gate and Gate path is in reg.php file
147: */
148: public function page_delete() {}
149: /** Inbuilt Event
150: * override this event handler in your Gate to handle it.
151: * trigger when browser get (url=index-view-19.html)
152: * where index is Gate of Gate and Gate path is in reg.php file
153: * view = event name
154: * 19 = recid of database table or any other value.
155: */
156: public function page_view() {}
157: /** Inbuilt Event
158: * override this event handler in your Gate to handle it.
159: * trigger when browser post form (url=index.html)
160: * where index is Gate of Gate and Gate path is in reg.php file
161: */
162: public function page_submit() {}
163: /** Inbuilt Event
164: * override this event handler in your Gate to handle it.
165: * trigger when browser post form (url=index.html) as new form
166: * where index is Gate of Gate and Gate path is in reg.php file
167: */
168: public function page_insert() {}
169: /** Inbuilt Event
170: * override this event handler in your Gate to handle it.
171: * trigger when browser post form (url=index.html) as filled form
172: * from database with view_data function
173: * where index is Gate of Gate and Gate path is in reg.php file
174: */
175: public function page_update() {}
176: /** Inbuilt Event
177: * override this event handler in your Gate to handle it.
178: * trigger when browser get (url=index.html) first time
179: * where index is Gate of Gate and Gate path is in reg.php file
180: */
181: public function page_new() {}
182: /** Inbuilt Event
183: * override this event handler in your Gate to handle it.
184: * trigger when Gate run after ready event and before trigger any event handler
185: */
186: public function onrun() {}
187: /** Inbuilt Event
188: * override this event handler in your Gate to handle it.
189: * trigger when Gate render after run FrontFile but before start master
190: * file process. You can't manage FrontFile output here but you can replace FrontFile
191: * output in SphpBase::$dynData or change master file or add front place for master filepath
192: */
193: public function onrender() {}
194: /**
195: * Stop exit Automatically after end of processing. It turn on wait event time loop.
196: * For exit manually then you need to call ExitMe
197: */
198: public function setDontExit() {}
199: /**
200: * Exit Manually
201: */
202: public function ExitMe() {}
203: /**
204: * Handle Wait Event when Gate is running in manually exit mode
205: */
206: public function onwait() {}
207: /**
208: * Set wait loop interval time
209: * @param int $microsec time in microsecond for wait loop
210: */
211: public function setWaitInterval($microsec = 100000) {}
212: /**
213: * Set which user can access this Gate. Default user is GUEST.
214: * You can set session variable in login Gate
215: * SphpBase::sphp_request()->session('logType','ADMIN');
216: * If user is not login with specific type then Gate exit and
217: * redirect according to the getWelcome function in comp.php
218: * @param string $authenticates <p>
219: * comma separated list of string. Example:- getAuthenticate("GUEST,ADMIN") or getAuthenticate("ADNIN")
220: * </p>
221: */
222: public function getAuthenticate($authenticates) {}
223: /**
224: * Set default table of Database to Sphp\Page object and this Gate.
225: * This information is important for Components and other database users objects.
226: * @param string $dbtable
227: */
228: public function setTableName($dbtable) {}
229: /**
230: * get default database table assigned to Gate
231: * @return string
232: */
233: public function getTableName() {}
234: /**
235: * Write on Console
236: * @param string $param
237: */
238: public function consoleWrite($param) {}
239: /**
240: * Write on Console with end line
241: * @param string $param
242: */
243: public function consoleWriteln($param) {}
244: /**
245: * Read a line from Console with message print on console
246: * @param string $msg message print on console
247: */
248: public function consoleReadln($msg) {}
249: /**
250: * Write error on console
251: * @param string $err
252: */
253: public function consoleError($err) {}
254: /**
255: * Read command line argument
256: * $v = consoleReadArgument('--dest')
257: * @param string $argkey key like --ctrl
258: * @return string
259: */
260: public function consoleReadArgument($argkey) {}
261: /**
262: * Execute shell command and print output directly
263: * @param string $command
264: * @return array return from command exit code
265: */
266: public function execute($command) {}
267: /**
268: * Execute Shell command With output
269: * @param type $cmd Command
270: * @param string &$out Reference var to fill output text
271: * @return boolean true if execute succesfully
272: */
273: public function execShell($cmd, &$out) {}
274: /**
275: * Convert argv to string
276: * @return string
277: */
278: public function argvToArgs() {}
279: /**
280: * Only work on Windows, get COM object
281: * @return \COM
282: */
283: public function getWScript() {}
284: public function runWScript($strCommand, $intWindowStyle = 3, $bWaitOnReturn = true) {}
285: /**
286: * Execute shell command in Background
287: * @param string $cmd
288: */
289: public function execInBackground($cmd) {}
290: /**
291: * Exit Gate Forcefully, Not safe
292: */
293: public function exitApp() {}
294: /**
295: * Advance Function
296: * @ignore
297: */
298: /**
299: * Register FrontFile with Gate
300: * @param \Sphp\tools\FrontFile $frontobj
301: */
302: /**
303: * Advance Function
304: * @ignore
305: */
306: /**
307: * Advance Function
308: * @ignore
309: */
310: /**
311: * Advance Function
312: * @ignore
313: */
314: /**
315: * Advance Function
316: * @ignore
317: */
318: protected function _processEvent() {}
319: /**
320: * Advance Function
321: * @ignore
322: */
323: protected function _render() {}
324: }
325: }
326: