| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?php
- Lib::loadClass('RouteBase');
- /*
- ## Url Actions (to replace Typespecial's):
- - new Zasob type: 'URL_ACTION'
- ## Config in Zasoby tree (TODO: upload from gui xml file or php):
- [100] - TYPESPECIALS
- [110] - URL_ACTION ProjektyKosztyWstepnychRobot
- [111] - PARAM_IN ID_PROJECT
- [200] - TABELA IN7_MK_BAZA_DYSTRYBUCJI Projekty
- [210] - KOMORKA ID
- [220] - (ALIAS to [110]) URL_ACTION action name/label
- [221] - (ALIAS to [210]) PARAM_IN ID_PROJECT
- class Route_UrlAction_ProjektyKosztyWstepnychRobot extends RouteBase {
- public function defaultAction() {
- $args = array();
- $args['ID_PROJECT'] = V::get('ID_PROJECT', '', $_REQUEST);// [111]
- }
- }
- ## Process - Create:
- - 1. define action name in Zasoby tree (URL_ACTION) and expected args (PARAM_IN) - `ActionDefinition`
- - 2. create action alias inside TABLE - `ActionInstance`
- - 3. set perms for `ActionInstance`
- ## Process - Install ActionDefinitio's:
- - class UrlActionBase :: installZasobAction
- - create required Zasoby in Zasob Tree if not exists
- */
- class Route_UrlAction extends RouteBase {// TODO: UrlActionBase
- public function handleAuth() {
- if (!User::logged()) {
- throw new HttpException('Unauthorized', 401);
- }
- }
- public function defaultAction() {
- SE_Layout::gora();
- ?>
- <div class="container">
- <h1>UrlActions system</h1>
- ...
- </div>
- <?php
- SE_Layout::dol();
- }
- public function getArgsList() {
- $args = array();
- return $args;
- }
- public function reinstallAction() {
- $jsonData = new stdClass();
- $jsonData->type = 'success';
- $jsonData->msg = 'Gotowe';
- try {
- $this->reinstall();
- } catch (Exception $e) {
- $jsonData->type = 'danger';
- $jsonData->msg = $e->getMessage();
- }
- echo json_encode($jsonData);
- }
- public function reinstall() {
- $sqlList = array();
- // alter table enum add URL_ACTION
- //$sqlList['RemoveTable'] = "DROP TABLE IF EXISTS `CRM_UI_MSGS`";
- $pdo = DB::getPDO();
- foreach ($sqlList as $sqlName => $sql) {
- $pdo->exec($sql);
- }
- }
- }
|