public static function dispatch($shellArray) { //knl_lib_Perm::verificaDomain(isset($_REQUEST['domain'])?$_REQUEST['domain']:''); $shell = knl_lib_Registry::getShellArgs(); $shell->setShellArgs($shellArray); $shellArg1 = $shell->getShellArg(1); $request = knl_lib_Registry::getRequestObj()->getInstance(); $domain = !empty($shellArg1) ? $domain = $shell->getShellArg(1) : $request->getRequest('domain'); $extdm = $request->getRequest('extdm'); switch ($domain) { case "Doc": knl_domain_Doc::getInstance()->handle(); break; case "Deptos": knl_domain_Deptos::getInstance()->handle(); break; case "RegCred": knl_domain_RegraCred::getInstance()->handle(); break; case "RegPend": knl_domain_RegraPend::getInstance()->handle(); break; case "DocTpCred": knl_domain_DocTipoCred::getInstance()->handle(); break; case "Users": knl_domain_Usuarios::getInstance()->handle(); break; case "Grupos": knl_domain_Grupos::getInstance()->handle(); break; case "Acesso": knl_domain_Acesso::getInstance()->handle(); break; case "Empresa": knl_domain_Empresa::getInstance()->handle(); break; case "Extension": knl_domain_Extension::getInstance()->handle(); break; case "Shell": if (empty($shellArg1)) { throw new Exception("Domain Shell somente acessivel no console do host"); } knl_domain_Shell::getInstance()->handle(); break; case "Entrada": require "view/entrada.php"; break; default: if (empty($extdm)) { knl_domain_Index::getInstance()->handle(); } else { $chamada = 'knl_extensions_' . $extdm . '_Domain::getInstance'; $objdm = call_user_func($chamada); $objdm->handle(); } //require("view/index.php"); break; } }
public function addPagDoc() { /* * arg 3: id_doc * arg 4: /path_completo/nome_do_arquivo.jpg gerado pelo imagemagick * arg 5: vazio, 1 se for jpg direto sem numero de paginas */ $path_sistema = str_replace("index.php", "", $_SERVER["SCRIPT_FILENAME"]) . "img/doc/"; //echo $path_sistema; $shell = knl_lib_Registry::getShellArgs(); $onde_ini = strrpos($shell->getShellArg(4), '-') + 1; $onde_fim = strpos($shell->getShellArg(4), ".") - $onde_ini; $num_pag = 1; if ($shell->getShellArg(5) == "") { $num_pag = substr($shell->getShellArg(4), $onde_ini, $onde_fim) + 1; } copy($shell->getShellArg(4), $path_sistema . $shell->getShellArg(3) . "_" . $num_pag . ".jpg"); /* adaptação para pedVendas que vem do fs... implementar outra solução que venha do banco com angulo do subtipo*/ //$Doc = knl_dao_doc::getinstance(); //$mDoc= $Doc->selectById($shell->getShellArg(3)); //if ($mDoc->get_id_doc_sub_tipo() == 8){ // shell_exec("convert -rotate 90 -geometry 1000x9000 ".$path_sistema.$shell->getShellArg(3)."_".$num_pag.".jpg ".$path_sistema.$shell->getShellArg(3)."_".$num_pag.".jpg"); //} }