src\Controller\AppController.php line 184

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use App\Service\SqlConnect;
  5. use App\Service\ApiCalls;
  6. use Symfony\Component\HttpFoundation\RequestStack;
  7. use Psr\Log\LoggerInterface;
  8. use App\Service\WebsiteSetup;
  9. use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
  10. use App\Service\Breadcrumbs;
  11. /**
  12.  * Description of AppController
  13.  *
  14.  * @author FairyWilbury
  15.  */
  16. class AppController extends AbstractController{
  17.     
  18.     protected $SqlConnect;
  19.     protected $ApiCalls;
  20.     protected $Breadcrumbs;
  21.     protected $RequestStack;
  22.     protected $Http;
  23.     protected $Session;
  24.     protected $Cookie;
  25.     protected $Logger;
  26.     protected $WebsiteSetup;
  27.     protected $SecurityToken;
  28.     
  29.     protected $data;
  30.     protected $entityUrl;
  31.     protected $mode;
  32.     protected $site;
  33.     protected $page;
  34.     protected $customJSFlag;
  35.     protected $defaultHomePage;
  36.     
  37.     protected $RedirectHandle NULL;
  38.     
  39.     protected $commonItems = [];
  40.     
  41.     private $footerItems = [
  42.         '_settings' => [],
  43.         'prefooter'=> [],
  44.         'footer'=> [],
  45.         'subfooter'=> [],     
  46.     ];
  47.     private $functionChecks = [
  48.         'mainNavRes' => FALSE,
  49.         'getPageText' => FALSE,
  50.         'getAttentionMsg' => FALSE,
  51.         'cards' => FALSE,
  52.         'getFooter' => FALSE
  53.     ];
  54.     public function __construct(
  55.             SqlConnect $SqlConnect
  56.             ApiCalls $ApiCalls
  57.             Breadcrumbs $Breadcrumbs
  58.             RequestStack $RequestStack
  59.             LoggerInterface $Logger
  60.             WebsiteSetup $WebsiteSetup
  61.             TokenStorageInterface $Security
  62.             ) {
  63.         
  64.               
  65.         
  66.         
  67.         $this->Logger $Logger;
  68.         
  69.         $this->RequestStack $RequestStack;        
  70.         $this->Http $this->RequestStack->getCurrentRequest();
  71.         $this->Session $this->RequestStack->getSession();
  72.         $this->Cookie $this->Http->cookies;
  73.         $this->SecurityToken $Security;
  74.         
  75.         
  76.         $this->entityUrl $WebsiteSetup->entityUrl;
  77.         
  78.         $this->site $WebsiteSetup->site;
  79.         $this->mode $WebsiteSetup->mode;
  80.         
  81.         $this->SqlConnect $SqlConnect;
  82.         $this->SqlConnect->init($this->site$this->mode$this->entityUrl); 
  83.         
  84.         $this->page $this->Http->attributes->get('_route');
  85.         if($this->page == 'page'){
  86.                $params $this->Http->attributes->get('_route_params');
  87.                $this->page $params ["pageName"];
  88.         }
  89.         
  90.         $this->ApiCalls $ApiCalls;
  91.         $this->ApiCalls->setSqlConnect($this->SqlConnect);
  92.         
  93.         $this->setData('site'$this->site);
  94.         $this->setData('entityUrl'$this->entityUrl);
  95.         $this->setData('mode'$this->mode);
  96.         $this->setData('page'$this->page);
  97.         $this->setData('imageSingleFlag'TRUE);
  98.         
  99.         $this->Breadcrumbs $Breadcrumbs;   
  100.         
  101.         
  102.         $this-> setSubPath();
  103.     }
  104.     
  105.     public function switchConnection($connectionName){
  106.         $this->SqlConnect $SqlConnect;
  107.         $this->SqlConnect->init($connectionName);
  108.     }
  109.     
  110.     protected function setData($key$value){
  111.         $this->data[$key] = $value;
  112.     }
  113.     
  114.     protected function getData($key NULL){
  115.         if($key===NULL){
  116.             return $this->data;
  117.         }
  118.         else{
  119.             if(isset($this->data[$key])){
  120.                 return $this->data[$key];
  121.             }
  122.             else{
  123.                 return FALSE;
  124.             }
  125.         }
  126.     }
  127.     
  128.     protected function setDataItem($array){
  129.         $this->data[key($array)] = $array[key($array)];
  130.     } 
  131.     
  132.     private function setSubPath(){
  133. //        $uri = $this->RequestStack->getCurrentRequest()->getRequestURI();        
  134. //        $uriArr = explode('/', trim($uri, '/'));
  135. //        if(count($uriArr)>0){
  136. //            $this->setData('subPath', '/'.$uriArr[0]);
  137. //        }
  138. //        $this->setData('subPath', '');
  139.         
  140.         $subpath strtolower($this->site);
  141.         $this->setData('subPath'$subpath);
  142.     }
  143.     
  144.     public function handleDbErrors($res){       
  145.         if(isset($res[0]['apiReturnStatus'])){
  146.             switch ($res[0]['apiReturnStatus']){
  147.                 case -1:
  148.                     $this->SecurityToken->setToken();
  149.                     return $this->redirectToRoute('signin');
  150.                 case 1:
  151.                     return FALSE;
  152.                 default:
  153.                     return FALSE;
  154.             }
  155.         }
  156.         else{
  157.             return FALSE;
  158.         }
  159.     }
  160.         public function customRenderPath($path$isCustom){
  161.         //'course/index.html.twig'
  162.         if ($isCustom){
  163.             return $this->site.'/'.$path;
  164.         }
  165.         else{
  166.             return $path;
  167.         }
  168.         
  169.     }
  170.     
  171.     protected function search(){
  172.         $searchTerms NULL;
  173.         if($this->Http->request->get("searchTerms")){
  174.             $searchTerms $this->Http->request->get("searchTerms"); 
  175.             $this->Session->set('searchTerms'$searchTerms);
  176.         }
  177.         if($this->Session->get('searchTerms'$searchTerms)){
  178.             $searchTerms $this->Session->get('searchTerms'$searchTerms);
  179.         }
  180.         $searchID NULL;
  181.         if($this->Session->get('searchID')){
  182.             if($this->page==='courseList'){
  183.                 $searchID $this->Session->get('searchID');
  184.                 $this->setData('searchID'$searchID);
  185.             }
  186.             else{
  187.                 $this->Session->remove('searchID');
  188.             }
  189.         }
  190.         if($searchTerms!==NULL){
  191.             $this->setData('searchTerms'$searchTerms);
  192.         }
  193.         
  194.         if($this->page==='categories' || $this->page==='courseList'){ #no redirect
  195.             if($this->Session->get('search'
  196.                     || ($this->Http->request->all() && $this->Http->request->get("searchTerms"))
  197.                     || $searchID!==NULL
  198.                ){               
  199.                 if(!$this->Session->get('search')){ #not redirected - make a new call
  200.                     $resSearch $this->makeSearchCall($searchTerms$searchID); 
  201.                     $check $this->handleDbErrors($resSearch);
  202.                 }
  203.                 elseif($resSearch $this->Session->get('search')){
  204.                     $resSearch $this->Session->get('search');
  205.                     $check TRUE;
  206.                     $this->Session->remove('search');
  207.                 }
  208.                 else{
  209.                     $this->Session->remove('search');
  210.                 }
  211.                 if($this->page==='courseList'){
  212.                     $this->Session->remove('searchID');
  213.                 }
  214.                 $this->Session->remove('searchTerms');
  215.                 if($check===FALSE){
  216.                     if(isset($resSearch[0]["card_btn_route_params"]) && !empty($resSearch[0]["card_btn_route_params"])){
  217.                         foreach($resSearch as $key=>$card){
  218.                             $resSearch[$key]["card_btn_route_params"] = json_decode($card["card_btn_route_params"], TRUE); 
  219.                         }                    
  220.                        $this->setData('search'$resSearch);
  221.                     }
  222.                     else{
  223.                         $this->setData('search'$resSearch);
  224.                     }
  225.                     
  226.                 }
  227.                 else{
  228.                     return $check;
  229.                 } 
  230.             }
  231.             else{
  232.                 return FALSE;
  233.             }
  234.         }                            
  235.         elseif($this->Http->request->all() && $this->Http->request->get("searchTerms")){ #redirect                
  236.                 $resSearch $this->makeSearchCall($searchTerms$searchID);
  237.                 $this->Session->set('search'$resSearch);
  238.                 $redirectTo $this->searchRedirectPage($resSearch);                
  239.                 if($redirectTo){
  240.                     $this->setData('searchRedirect'$redirectTo);                    
  241.                 }
  242.                 else{
  243.                     $this->setData('searchEmpty'TRUE);                        
  244.                 }
  245.         }
  246.         else{
  247.             if($this->Session->get('searchID')||$this->Session->get('search')||$this->Session->get('searchTerms')){
  248.                 $this->Session->remove('searchID');
  249.                 $this->Session->remove('search');
  250.                 $this->Session->remove('searchTerms');
  251.             }
  252.         }
  253.         
  254.     }
  255.     
  256.     private function makeSearchCall($searchTerms$searchID NULL){        
  257.         if($this->page!=='courseList'){
  258.             $searchID NULL;
  259.         }
  260.         
  261.         if($this->getUser()){
  262.             $resSearch $this->ApiCalls->search($this->page$searchTerms$this->getUser()->getEmail(), $searchID);
  263.         }
  264.         else{            
  265.             $resSearch $this->ApiCalls->search($this->page$searchTermsNULL$searchID);            
  266.         }
  267.        
  268.         if(isset($resSearch[0]['searchID'])){
  269.             $this->Session->set('searchID'$resSearch[0]['searchID']);
  270.         }
  271.         return $resSearch;
  272.     }
  273.     
  274.     private function searchRedirectPage($resSearch){
  275.         if(isset($resSearch[0]) && (!isset($resSearch[0]['apiReturnStatus']) || $resSearch[0]['apiReturnStatus'] !== 0)){            
  276.             if(isset($resSearch[0]['courseCode'])){
  277.                 return 'courseList';
  278.             }
  279.             else{
  280.                 return 'categories';
  281.             }
  282.         }
  283.         else{
  284.             $this->setData('searchMsgIcon'$resSearch[0]['icon']);
  285.             $this->setData('searchMsgTitle'$resSearch[0]['title']);
  286.             $this->setData('searchMsgHtml'$resSearch[0]['html']);
  287.             $this->setData('searchMsgFooter'$resSearch[0]['footer']);
  288.             return FALSE;
  289.         }
  290.     }
  291.     
  292.     protected function commonCalls($functionNames NULL){
  293.         $toolsFlag $this->Session->get('toolsFlag');        
  294.         if($toolsFlag===NULL){
  295.             $this->setData('toolsFlag'FALSE);
  296.         }
  297.         else{
  298.             $this->setData('toolsFlag'$toolsFlag);
  299.         }
  300.         
  301.         if($this->getUser()!==NULL){
  302.             $username $this->getUser()->getEmail();
  303.             $anonymousID NULL;
  304.         }
  305.         else{
  306.             $username NULL;
  307.             $anonymousID $this->getAnonymousID();
  308.         }
  309.         
  310.         if($functionNames === NULL || in_array('getHomeNav',$functionNames)){
  311.             $res $this->getHomeNav($username$this->getAnonymousID());
  312.             if($res == NULL){
  313.                if($functionNames === NULL || in_array('getPageTexts',$functionNames)){
  314.                     $this->getPageTexts($username$this->getAnonymousID());
  315.                 }
  316.                 if($functionNames === NULL || in_array('getAttentionMessage',$functionNames)){
  317.                     $this->getAttentionMessage($username);
  318.                 }
  319.                 if($functionNames === NULL || in_array('getCards',$functionNames)){
  320.                     $this->getCards($username);
  321.                 }
  322.                 if($functionNames === NULL || in_array('getFooter',$functionNames)){
  323.                     $this->getFooter($username);
  324.                 }
  325.                 if($functionNames === NULL || in_array('getSearch',$functionNames)){
  326.                     $this->getSearch();
  327.                 }
  328.                 return $this->multipleChecks($this->functionChecks);
  329.             }
  330.             else{
  331.                 $this->RedirectHandle $this->redirectToRoute($res);
  332.             }
  333.             
  334.         }
  335.         
  336.         
  337.     }
  338.     
  339.     private function multipleChecks($checks){
  340.         $flag TRUE;
  341.         foreach($checks as $key=>$check){
  342.             if(!$check){
  343.                 return $flag;
  344.             }
  345.         }
  346.     }
  347.     
  348.     private function getHomeNav($userEmail NULL$sessionID NULL){
  349.         $mainNavRes $this->ApiCalls->getHomeNav($this->page$userEmail$sessionID);          
  350.         $check $this->handleDbErrors($mainNavRes);        
  351.         if($check===FALSE){
  352.             $this->setData('mainMenu'$mainNavRes);
  353.             if(isset($mainNavRes[0])){
  354.                 $this->setData('webenrolPass'$mainNavRes[0]["webenrolPasscode"]);                
  355.                 $this->setData('defaultHomePage',  $mainNavRes[0]["defaultHomePage"]);
  356.                 
  357.                 $this->defaultHomePage $mainNavRes[0]["defaultHomePage"];
  358.                 $this->Breadcrumbs->setDefaultHomePage($this->defaultHomePage);
  359.                 if($this->getData('defaultHomePage')){                    
  360. //                    $this->Session->set('defaultHomePage', $this->getData('defaultHomePage'));
  361.                     if($this->defaultHomePage!=='index' && $this->page === 'index'){                       
  362.                         return $this->defaultHomePage;
  363.                     }
  364.                 }
  365.                 
  366.                 
  367. //                if($this->Session->get('defaultHomePage')){
  368. //                    $this->defaultHomePage = $this->Session->get('defaultHomePage');                      
  369. //                    $this->Breadcrumbs->setDefaultHomePage($this->defaultHomePage);
  370. //                    if($this->page==='index' && $this->defaultHomePage !== 'index'){
  371. //                        return $this->defaultHomePage;
  372. //                    }
  373. //                }
  374.             }
  375.             else{
  376.                 // error handling here
  377.             }
  378.         }
  379.         else{
  380.             $this->functionChecks['mainNavRes'] = $check;
  381.         }
  382.         return NULL;
  383.     }
  384.     
  385.     protected function getAttentionMessage($userEmail NULL$courseCode NULL){
  386.         $msgData $this->ApiCalls->getAttentionMessage($this->page,$userEmail$courseCode);            
  387.             $check $this->handleDbErrors($msgData);
  388.             if($check===FALSE){
  389.                 $this->setData('alerts'$msgData); 
  390.             }
  391.             else{
  392.                 $this->functionChecks['getAttentionMsg'] = $check;
  393.             }
  394.     }
  395.     
  396.     private function getSearch(){
  397.         $this->search();         
  398.         if($this->getData('searchRedirect')){
  399.             $this->RedirectHandle $this->redirectToRoute($this->getData('searchRedirect'));
  400.         }
  401.     }
  402.     
  403.     protected function getPageTexts($userEmail NULL$sessionID NULL$courseCode NULL$sectionID NULL){
  404.        
  405.         if($this->getAnonymousID() && !$this->getUser()){
  406.             $sessionID $this->getAnonymousID();
  407.         }
  408.         $pageText $this->ApiCalls->getPageText($this->page$userEmail$sessionID$courseCode$sectionID);
  409.         
  410.         
  411.         
  412.         $check $this->handleDbErrors($pageText);
  413.         if($check===FALSE){
  414.             if($pageText!==FALSE){
  415.                 foreach($pageText as $key=>$textItem){
  416.                     if(isset($textItem['css']) &&!empty($textItem['css'])){
  417.                         $pageText[$key]['css'] = json_decode($textItem['css'], TRUE);
  418.                     }
  419.                 }
  420.             }
  421.             $this->setData('pageText'$pageText);
  422.         }
  423.         else{
  424.             $this->functionChecks['getPageText'] = $check;
  425.         }
  426.     }
  427.     
  428.     private function getFooter($userEmail){
  429.         $resFooter $this->ApiCalls->getFooter($userEmail);
  430.         $check $this->handleDbErrors($resFooter);
  431.         if($check===FALSE){
  432.             $this->parseFooterData($resFooter);
  433.             $this->setData('footer'$this->commonItems["footerItems"]);
  434.         }
  435.         else{
  436.             $this->functionChecks['getFooter'] = $check;
  437.         }
  438.     }
  439.     
  440.     private function getCards($userEmail NULL){        
  441.         $resCards $this->ApiCalls->getHomePageData($this->page$userEmail);            
  442.         $check $this->handleDbErrors($resCards);
  443.         if($check===FALSE){
  444.             foreach($resCards as $key=>$cardsItem){
  445.                 if(isset($cardsItem['css']) &&!empty($cardsItem['css'])){
  446.                     $resCards[$key]['css'] = json_decode($cardsItem['css'], TRUE);
  447.                                     }
  448.             }
  449.             if(isset($resCards[0]["card_btn_route_params"]) && !empty($resCards[0]["card_btn_route_params"])){
  450.                 foreach($resCards as $key=>$card){
  451.                     $resCards[$key]["card_btn_route_params"] = json_decode($card["card_btn_route_params"], TRUE); 
  452.                 }                
  453.                 $this->setData('cards'$resCards);
  454.             }
  455.             else{
  456.                 $this->setData('cards'$resCards);
  457.             }
  458.             
  459.         }
  460.         else{
  461.             $this->functionChecks['cards'] = $check;
  462.         }
  463.     }
  464.     protected function parseFooterData($footerData){
  465.         if($footerData){
  466.             $footerTypesSwitches = [];
  467.             foreach($footerData as $footerItem){
  468.                 $footerTypesSwitches $this->setFooterTypesSwitches($footerItem$footerTypesSwitches);
  469.                 switch ($footerItem["footerType"]){                
  470.                     case 'prefooter':
  471.                         if(!isset($this->footerItems['prefooter'][$footerItem['column']])){
  472.                             $this->footerItems['prefooter'][$footerItem['column']] = [];
  473.                         }
  474.                         $footerItem['inner-classes'] = json_decode($footerItem['inner-classes'], TRUE);
  475.                         $footerItem['outer-classes'] = json_decode($footerItem['outer-classes'], TRUE);
  476.                         $footerItem['column-classes'] = json_decode($footerItem['column-classes'], TRUE);
  477.                         $footerItem['empty'] = FALSE;
  478.                         if($footerItem['column']>0){
  479.                             for($i=0$i $footerItem['column']; $i++){
  480.                                 if(!isset($this->footerItems['footer'][$i])){
  481.                                     $this->footerItems['prefooter'][$i] = [
  482.                                         => [
  483.                                             "css-footerType-switch" => $footerItem["css-footerType-switch"],
  484.                                             "empty" => TRUE,
  485.                                             'inner-classes' =>  $footerItem['inner-classes'],
  486.                                             'outer-classes' => $footerItem['outer-classes'],
  487.                                             'column-classes' => $footerItem['column-classes'],
  488.                                             "css-footerType-background-color" => $footerItem["css-footerType-background-color"],
  489.                                             "css-footerType-color" => $footerItem["css-footerType-color"]
  490.                                         ]
  491.                                     ];
  492.                                 }
  493.                             }
  494.                         }
  495.                         array_push($this->footerItems['prefooter'][$footerItem['column']],$footerItem);
  496.                         break;
  497.                     case 'footer':
  498.                         if(!isset($this->footerItems['footer'][$footerItem['column']])){
  499.                             $this->footerItems['footer'][$footerItem['column']] = [];
  500.                         }
  501.                         $footerItem['inner-classes'] = json_decode($footerItem['inner-classes'], TRUE);
  502.                         $footerItem['outer-classes'] = json_decode($footerItem['outer-classes'], TRUE);
  503.                         $footerItem['column-classes'] = json_decode($footerItem['column-classes'], TRUE);
  504.                         $footerItem['empty'] = FALSE;
  505.                         if($footerItem['column']>0){
  506.                             for($i=0$i $footerItem['column']; $i++){
  507.                                 if(!isset($this->footerItems['footer'][$i])){
  508.                                     $this->footerItems['footer'][$i] = [
  509.                                         => [
  510.                                             "css-footerType-switch" => $footerItem["css-footerType-switch"],
  511.                                             "empty" => TRUE,
  512.                                             'inner-classes' =>  $footerItem['inner-classes'],
  513.                                             'outer-classes' => $footerItem['outer-classes'],
  514.                                             'column-classes' => $footerItem['column-classes'],
  515.                                             "css-footerType-background-color" => $footerItem["css-footerType-background-color"],
  516.                                             "css-footerType-color" => $footerItem["css-footerType-color"]
  517.                                         ]
  518.                                     ];
  519.                                 }
  520.                             }
  521.                         }
  522.                         array_push($this->footerItems['footer'][$footerItem['column']],$footerItem);
  523.                         break;
  524.                     case 'subfooter':
  525.                         if(!isset($this->footerItems['subfooter'][$footerItem['column']])){
  526.                             $this->footerItems['subfooter'][$footerItem['column']] = [];
  527.                         }
  528.                         $footerItem['inner-classes'] = json_decode($footerItem['inner-classes'], TRUE);
  529.                         $footerItem['outer-classes'] = json_decode($footerItem['outer-classes'], TRUE);
  530.                         $footerItem['column-classes'] = json_decode($footerItem['column-classes'], TRUE);
  531.                         $footerItem['empty'] = FALSE;
  532.                         if($footerItem['column']>0){
  533.                             for($i=0$i $footerItem['column']; $i++){
  534.                                 if(!isset($this->footerItems['footer'][$i])){
  535.                                     $this->footerItems['subfooter'][$i] = [
  536.                                         => [
  537.                                             "css-footerType-switch" => $footerItem["css-footerType-switch"],
  538.                                             "empty" => TRUE,
  539.                                             'inner-classes' =>  $footerItem['inner-classes'],
  540.                                             'outer-classes' => $footerItem['outer-classes'],
  541.                                             'column-classes' => $footerItem['column-classes'],
  542.                                             "css-footerType-background-color" => $footerItem["css-footerType-background-color"],
  543.                                             "css-footerType-color" => $footerItem["css-footerType-color"]
  544.                                         ]
  545.                                     ];
  546.                                 }
  547.                             }
  548.                         }
  549.                         array_push($this->footerItems['subfooter'][$footerItem['column']],$footerItem);
  550.                         break;
  551.                     case 'aside':
  552.                         if(!isset($this->footerItems['aside'][$footerItem['column']])){
  553.                             $this->footerItems['aside'][$footerItem['column']] = [];
  554.                         }
  555.                         $footerItem['inner-classes'] = json_decode($footerItem['inner-classes'], TRUE);
  556.                         $footerItem['outer-classes'] = json_decode($footerItem['outer-classes'], TRUE);
  557.                         $footerItem['column-classes'] = json_decode($footerItem['column-classes'], TRUE);
  558.                         $footerItem['empty'] = FALSE;
  559.                         if($footerItem['column']>0){
  560.                             for($i=0$i $footerItem['column']; $i++){
  561.                                 if(!isset($this->footerItems['footer'][$i])){
  562.                                     $this->footerItems['aside'][$i] = [
  563.                                         => [
  564.                                             "css-footerType-switch" => $footerItem["css-footerType-switch"],
  565.                                             "empty" => TRUE,
  566.                                             'inner-classes' =>  $footerItem['inner-classes'],
  567.                                             'outer-classes' => $footerItem['outer-classes'],
  568.                                             'column-classes' => $footerItem['column-classes'],
  569.                                             "css-footerType-background-color" => $footerItem["css-footerType-background-color"],
  570.                                             "css-footerType-color" => $footerItem["css-footerType-color"]
  571.                                         ]
  572.                                     ];
  573.                                 }
  574.                             }
  575.                         }
  576.                         array_push($this->footerItems['aside'][$footerItem['column']],$footerItem);
  577.                         break;
  578.                 }
  579.             }
  580.             $this->footerItems['_settings']['switches'] = $footerTypesSwitches;
  581.         }
  582.         else{
  583.             $this->commonItems['footerItems'] = NULL;
  584.         }
  585. //        echo '<pre>';
  586. //        var_dump($this->footerItems);
  587. //        echo '</pre>';
  588.         $this->commonItems['footerItems'] = $this->footerItems;
  589.     }    
  590.     
  591.     private function setFooterTypesSwitches($footerItem$footerTypesSwitches){
  592.         if(!array_key_exists($footerItem["footerType"], $footerTypesSwitches)){
  593.             $footerTypesSwitches[$footerItem["footerType"]] = $footerItem["css-footerType-switch"];
  594.         }
  595.         return $footerTypesSwitches;
  596.     }
  597.    
  598.     
  599.     protected function getAnonymousID(){
  600.         return $this->Cookie->get("PHPSESSID");
  601.     }
  602.     
  603. }