Esempio n. 1
0
 public function detail($targetid)
 {
     $this->targetid = $targetid;
     $sparams2 = array('id' => $this->targetid, 'module' => $this->module, 'customerid' => $_SESSION["loggeduser"]['id'], 'sessionid' => $_SESSION["loggeduser"]['sessionid']);
     $lmod2 = $GLOBALS["sclient"]->call('get_project_tickets', $sparams2);
     if (isset($lmod2) && count($lmod2) > 0 && $lmod2 != "") {
         $data['relatedticketlist'] = $lmod2[1][$this->module]['data'];
         $data['relatedtickettableheader'] = $lmod2[0][$this->module]['head'][0];
     }
     $sparams3 = array('id' => $this->targetid, 'block' => "ProjectTask", 'contactid' => $_SESSION["loggeduser"]['id'], 'sessionid' => $_SESSION["loggeduser"]['sessionid']);
     $lmod3 = $GLOBALS["sclient"]->call('get_project_components', $sparams3);
     if (isset($lmod3) && count($lmod3) > 0 && $lmod3 != "") {
         $data['relatedtaskslist'] = $lmod3[1]['ProjectTask']['data'];
         $data['relatedtaskstableheader'] = $lmod3[0]['ProjectTask']['head'][0];
     }
     $sparams4 = array('id' => $this->targetid, 'block' => "ProjectMilestone", 'contactid' => $_SESSION["loggeduser"]['id'], 'sessionid' => $_SESSION["loggeduser"]['sessionid']);
     $lmod4 = $GLOBALS["sclient"]->call('get_project_components', $sparams4);
     if (isset($lmod4) && count($lmod4) > 0 && $lmod4 != "") {
         $data['relatedmilestoneslist'] = $lmod4[1]['ProjectMilestone']['data'];
         $data['relatedmilestonestableheader'] = $lmod4[0]['ProjectMilestone']['head'][0];
     }
     $data['recordinfo'] = parent::detail($this->targetid, false);
     $data['recordid'] = $this->targetid;
     Template::display($this->module, $data, 'detail');
 }
Esempio n. 2
0
 public static function start()
 {
     global $avmod, $modulesNames, $targetmodule;
     $targetmoduleacces = true;
     $targetmodule = $_REQUEST['module'];
     $targetaction = $_REQUEST['action'];
     //Get a list of available module for this user
     $params = array($_SESSION["loggeduser"]['id']);
     $avmod = $GLOBALS["sclient"]->call('get_modules', $params);
     //echo '<h2>response</h2><pre>' . htmlspecialchars($GLOBALS["sclient"]->response, ENT_QUOTES) . '</pre>';
     //if no target module specified set HelpDesk as the default index module
     if (!isset($targetmodule) || $targetmodule == "") {
         $targetmodule = "HelpDesk";
     }
     //if a download for a file is requested call the function to retrieve the desired file
     if (isset($_REQUEST['downloadfile']) && $_REQUEST['downloadfile'] === "true") {
         User::download_file();
     }
     //Check if the requested module is Available
     foreach ($avmod as $key => $value) {
         if ($targetmodule == $value['name']) {
             $targetmoduleacces = false;
         }
         $modulesNames[$value['name']] = $value['translated_name'];
     }
     if ($targetmoduleacces && $targetmodule != 'Home') {
         $targetmodule = "HelpDesk";
         //die("Not Autorized!");
     }
     //Require the base module class
     require_once "modules/Module/index.php";
     //if isset a specific file and a specific class for the requested module include the extended class and create the object
     if (file_exists("modules/" . $targetmodule . "/index.php")) {
         require_once "modules/" . $targetmodule . "/index.php";
     }
     if (class_exists($targetmodule)) {
         $mod = new $targetmodule();
     } else {
         $mod = new BaseModule($targetmodule);
     }
     //if is pesent a target id show the corrispondent entity else show a list of entities for the target module
     if (isset($_REQUEST['id'])) {
         $mod->detail($_REQUEST['id']);
     } else {
         if (isset($_REQUEST['productid'])) {
             $mod->detail($_REQUEST['productid']);
         } else {
             if (isset($_REQUEST['faqid'])) {
                 $mod->detail($_REQUEST['faqid']);
             } else {
                 if ($targetmodule == "HelpDesk" && $targetaction == "new") {
                     $mod->create_new();
                 } else {
                     $mod->get_list();
                 }
             }
         }
     }
     //if there is a request for change password call the modal again and show the request resault
     if (isset($GLOBALS["opresult"]) && $GLOBALS["opresult"] != "") {
         echo "<script> \$(function(){ \$('#changePassModal').modal('show'); })</script>";
     }
 }
 public static function start()
 {
     global $avmod;
     $targetmodule = $_REQUEST['module'];
     $targetaction = $_REQUEST['action'];
     //Get a list of available module for this user
     $params = array($_SESSION["loggeduser"]['id']);
     $avmod = $GLOBALS["sclient"]->call('get_modules', $params);
     //If the dashboard is enabled show them as the index module of the portal
     if ($GLOBALS["show_dashboard"] == "true") {
         $avmod = array_merge(array("Home"), $avmod);
     }
     //If the vtlib api are configured add the configured module to the enabled modules array
     if (isset($GLOBALS['api_user']) && $GLOBALS['api_user'] != "" && isset($GLOBALS['api_pass']) && $GLOBALS['api_pass'] != "") {
         if (Api::connect() != 'API_LOGIN_FAILED') {
             if (isset($GLOBALS['api_modules']) && count($GLOBALS['api_modules']) > 0) {
                 foreach ($GLOBALS['api_modules'] as $modname => $modfields) {
                     if (isset($modfields["is_enabled"]) && $modfields["is_enabled"] == "true") {
                         $avmod[] = $modname;
                     }
                 }
             }
         }
         //if(in_array($modname, $GLOBALS['enabled_api_modules'])) $avmod[]=$modname;
     }
     Plugins::runall("PortalBase", "base", "preTemplateLoad", $_REQUEST);
     //if no target module specified set the first module defined in the CRM portal settings as the default index module
     if (!isset($targetmodule) || $targetmodule == "") {
         $targetmodule = $avmod[0];
     }
     //if a download for a file is requested call the function to retrieve the desired file
     if (isset($_REQUEST['downloadfile']) && $_REQUEST['downloadfile'] === "true") {
         User::download_file();
     }
     //Check if the requested module is Available
     if (!in_array($targetmodule, $avmod)) {
         Template::display($targetmodule, array(), 'not-authorized');
         die;
     }
     //Require the base module class
     require_once "modules/Module/index.php";
     //if isset a specific file and a specific class for the requested module include the extended class and create the object
     if (file_exists("modules/" . $targetmodule . "/index.php")) {
         require_once "modules/" . $targetmodule . "/index.php";
     }
     if (class_exists($targetmodule)) {
         $mod = new $targetmodule();
     } else {
         $mod = new BaseModule($targetmodule);
     }
     //if is pesent a target id show the corrispondent entity else show a list of entities for the target module
     if (isset($_REQUEST['ticketid'])) {
         $mod->detail($_REQUEST['ticketid']);
     } else {
         if (isset($_REQUEST['productid'])) {
             $mod->detail($_REQUEST['productid']);
         } else {
             if (isset($_REQUEST['faqid'])) {
                 $mod->detail($_REQUEST['faqid']);
             } else {
                 if (isset($_REQUEST['id'])) {
                     $mod->detail($_REQUEST['id']);
                 } else {
                     if ($targetmodule == "HelpDesk" && $targetaction == "new") {
                         $mod->create_new();
                     } else {
                         if ($targetmodule == "Home" || $targetaction == "dashboard") {
                             $mod->dashboard();
                         } else {
                             $mod->get_list();
                         }
                     }
                 }
             }
         }
     }
     //if there is a request for change password call the modal again and show the request resault
     if (isset($GLOBALS["opresult"]) && $GLOBALS["opresult"] != "") {
         echo "<script> \$(function(){ \$('#changePassModal').modal('show'); })</script>";
     }
 }