public function execute()
 {
     //SESSION
     $session = SessionFactory::create();
     $date = $session->get("selected-date");
     //VALIDATION
     $validator = ValidatorFactory::create();
     $validator->ifTrue($date == null)->respond(INCOMPLETE_FILTER_DATA);
     //SESSION DATA
     $sessionData = array('date' => $date);
     //PARAMETERS
     $params = RequestParametersFactory::create();
     $pageNumber = $params->get('page-number');
     $rowsPerPage = $params->get('rows-per-page');
     //PAGINATOR
     $paginator = PaginatorFactory::create();
     $paginator->pageNumber = $pageNumber;
     $datahandler = DatahandlerFactory::create('D_ClientRequestsRowsTotalNumber');
     $datahandler->setInData($sessionData);
     $rowsTotalNumber = $datahandler->getOutData();
     //Always force a single page
     $paginator->rowsPerPage = $rowsTotalNumber;
     //DATAHANDLERS
     $datahandler = DatahandlerFactory::create('D_FrequencyTableOfClientRequests');
     $datahandler->setInData($sessionData);
     $data = $datahandler->getOutData();
     //VALIDATION
     $validator->ifTrue($data == array())->respond('No activity for the day: ' . $date);
     //PAGINATOR
     $paginator->rowsTotalNumber = $rowsTotalNumber;
     //VIEW
     $view = ViewFactory::create('V_FrequencyTableOfClientRequests');
     $view->setInData($data);
     $view->display();
 }
 public function display()
 {
     $session = SessionFactory::create();
     $dom = DOMHandlerFactory::create();
     $dom->setDocumentFromFile(STATISTICAL_LOG_ANALIZER_HTML)->whereIdIs('login-user')->insertNode($session->get('session-user-name'));
     //TITLE
     $selectedClientIp = $session->get("selected-client-ip");
     $selectedDate = $session->get("selected-date");
     $beginTime = $this->data[0]['time'];
     $endTime = end($this->data)['time'];
     $title = "<h3>Client (" . $selectedClientIp . ") Data Consumption Table, \n                            at: " . $selectedDate . " between: " . $beginTime . " and " . $endTime . "</h3>\n                            <br><a href='index.php?A_ClientDataConsumptionTableOrdered'>Order from highest to lowest consumption</a>";
     $dom->whereIdIs("body-title")->insertNode($title);
     //TITLE
     $tableFactory = HtmlElementsFactory::create("table");
     $tableFactory->data = $this->data;
     $tableFactory->dataIds = array("time", "client_data", "url");
     $tableFactory->openTable();
     $tableFactory->addTheaderTitle("Time");
     $tableFactory->addTheaderTitle("Client Data Consumption In Kb");
     $tableFactory->addTheaderTitle("URL");
     $tableFactory->renderTableData();
     $tableFactory->closeTable();
     $table = $tableFactory->render();
     $dom->whereIdIs("squidDataContainer")->insertNode($table);
     $paginator = PaginatorFactory::create();
     $paginator->action = "A_ClientDataConsumptionTable";
     $dom->whereIdIs('ul-pagination')->insertNode($paginator->paginationSelect);
     $dom->display();
 }
 public function display()
 {
     $session = SessionFactory::create();
     $dom = DOMHandlerFactory::create();
     $dom->setDocumentFromFile(STATISTICAL_LOG_ANALIZER_HTML)->whereIdIs('login-user')->insertNode($session->get('session-user-name'));
     $tableFactory = HtmlElementsFactory::create("table");
     $tableFactory->data = $this->data;
     $tableFactory->dataIds = array("date", "time", "transaction_time", "client_ip", "squid_result_code", "client_data", "request_method", "mime_type");
     $tableFactory->openTable();
     $tableFactory->addTheaderTitle("Date");
     $tableFactory->addTheaderTitle("Time");
     $tableFactory->addTheaderTitle("Transaction Time");
     $tableFactory->addTheaderTitle("Client IP");
     $tableFactory->addTheaderTitle("Squid Code");
     $tableFactory->addTheaderTitle("Client Data");
     $tableFactory->addTheaderTitle("Request Method");
     $tableFactory->addTheaderTitle("Mime Type");
     $tableFactory->renderTableData();
     $tableFactory->closeTable();
     $table = $tableFactory->render();
     $dom->whereIdIs("squidDataContainer")->insertNode($table);
     $paginator = PaginatorFactory::create();
     $paginator->action = "A_ReadAllSquidData";
     $dom->whereIdIs('ul-pagination')->insertNode($paginator->paginationSelect);
     $dom->display();
 }
 public function display()
 {
     $session = SessionFactory::create();
     $dom = DOMHandlerFactory::create();
     $dom->setDocumentFromFile(STATISTICAL_LOG_ANALIZER_HTML)->whereIdIs('login-user')->insertNode($session->get('session-user-name'));
     //TITLE
     $selectedClientIp = $session->get("selected-client-ip");
     $selectedDate = $session->get("selected-date");
     $beginTime = $this->data[0]['time'];
     $endTime = end($this->data)['time'];
     $title = "<h3>Client (" . $selectedClientIp . ") Domains Request Frequency Table, \n                            at: " . $selectedDate . "</h3><br><h5>(Ordered from highest to lowest frequency)</h5>";
     $dom->whereIdIs("body-title")->insertNode($title);
     //TITLE
     $tableFactory = HtmlElementsFactory::create("table");
     $tableFactory->data = $this->data;
     $tableFactory->dataIds = array("time", "frequency", "url");
     $tableFactory->openTable();
     $tableFactory->addTheaderTitle("Time");
     $tableFactory->addTheaderTitle("Frequency");
     $tableFactory->addTheaderTitle("URL");
     $tableFactory->renderTableData();
     $tableFactory->closeTable();
     $table = $tableFactory->render();
     $dom->whereIdIs("squidDataContainer")->insertNode($table);
     $paginator = PaginatorFactory::create();
     $paginator->action = "A_DomainsRequestTableOrdered";
     $dom->whereIdIs('ul-pagination')->insertNode($paginator->paginationSelect);
     $dom->display();
 }
 public function execute()
 {
     //PARAMETERS
     $params = RequestParametersFactory::create();
     $roleId = $params->get('selected-role-id');
     $pageNumber = $params->get('page-number');
     $rowsPerPage = $params->get('rows-per-page');
     //PAGINATOR
     $paginator = PaginatorFactory::create();
     $paginator->pageNumber = $pageNumber;
     $datahandler = DatahandlerFactory::create('D_ActionsRowsTotalNumber');
     $actionsRowsTotalNumber = $datahandler->getOutData();
     $paginator->rowsPerPage = $actionsRowsTotalNumber;
     //Always force a single page
     $paginator->rowsPerPage = $actionsRowsTotalNumber;
     //SESSION
     $session = SessionFactory::create();
     $session->set('selected-role-id', $roleId);
     //DATAHANDLER
     $datahandler = DatahandlerFactory::create('D_ReadActionsWithStatus');
     $datahandler->setInData($roleId);
     $roleActions = $datahandler->getOutData();
     //DATAHANDLER
     $datahandler = DatahandlerFactory::create('D_ReadRoleById');
     $datahandler->setInData($roleId);
     $roleData = $datahandler->getOutData();
     //SESSION
     $session->set('selected-role-name', $roleData['name']);
     $data = array('role-actions' => $roleActions, 'role-name' => $roleData['name']);
     //VIEW
     $view = ViewFactory::create('V_ReadActionsWithStatus');
     $view->setInData($data);
     $view->display();
 }
 public function getOutData()
 {
     $paginator = PaginatorFactory::create();
     $beginning = $paginator->beginning;
     $rowsPerPage = $paginator->rowsPerPage;
     $query = "SELECT client_ip, url, COUNT(client_ip) as frequency FROM SquidData \n        \t\t\tGROUP BY client_ip \n        \t\t\t\tORDER BY frequency DESC \n        \t\t\t\t\tLIMIT {$beginning}, {$rowsPerPage}";
     $db = DatabaseFactory::create("SquidDatabase")->connect();
     return $db->SQLFetchAllArray($query);
 }
 public function getOutData()
 {
     $paginator = PaginatorFactory::create();
     $beginning = $paginator->beginning;
     $rowsPerPage = $paginator->rowsPerPage;
     $query = "SELECT * FROM Roles ORDER BY name LIMIT {$beginning}, {$rowsPerPage}";
     $db = DatabaseFactory::create("AAADatabase")->connect();
     return $db->SQLFetchAllArray($query);
 }
 public function getOutData()
 {
     $id = $this->data;
     $paginator = PaginatorFactory::create();
     $beginning = $paginator->beginning;
     $rowsPerPage = $paginator->rowsPerPage;
     $query = "SELECT actions.*, 1 as status\n                  FROM actions \n                  LEFT JOIN roles_actions\n                  ON roles_actions.action_name = actions.name\n                  WHERE roles_actions.role_id = {$id}\n\n\t\t\t\t  UNION\n\n\t\t\t\t  SELECT actions.*, 0 as status\n                  FROM actions \n                  WHERE actions.name NOT IN \n                  (\n                  \tSELECT actions.name\n\t\t\t      \tFROM actions\n\t\t    \t  \tLEFT JOIN roles_actions\n\t\t          \tON roles_actions.action_name = actions.name\n\t\t          \tWHERE roles_actions.role_id = {$id}\n\t\t          ) ORDER BY actions.name \n\t\t\t\t\tLIMIT {$beginning}, {$rowsPerPage}";
     $db = DatabaseFactory::create("AAADatabase")->connect();
     return $db->SQLFetchAllArray($query);
 }
 public function display()
 {
     $session = SessionFactory::create();
     $dom = DOMHandlerFactory::create();
     $dom->setDocumentFromFile(STATISTICAL_LOG_ANALIZER_HTML)->whereIdIs('login-user')->insertNode($session->get('session-user-name'));
     $tableFactory = HtmlElementsFactory::create("table");
     $tableFactory->data = $this->data;
     $tableFactory->dataIds = array("client_ip", "frequency");
     $tableFactory->openTable();
     $tableFactory->addTheaderTitle("Client IP");
     $tableFactory->addTheaderTitle("Frequency");
     $tableFactory->renderTableData();
     $tableFactory->closeTable();
     $table = $tableFactory->render();
     $dom->whereIdIs("squidDataContainer")->insertNode($table);
     $paginator = PaginatorFactory::create();
     $paginator->action = "A_ReadClientIpWithFrequency";
     $dom->whereIdIs('ul-pagination')->insertNode($paginator->paginationSelect);
     $dom->display();
 }
 public function execute()
 {
     //PARAMETERS
     $params = RequestParametersFactory::create();
     $pageNumber = $params->get('page-number');
     $rowsPerPage = $params->get('rows-per-page');
     $paginator = PaginatorFactory::create();
     $paginator->pageNumber = $pageNumber;
     $paginator->rowsPerPage = $rowsPerPage;
     //DATAHANDLERS
     $datahandler = DatahandlerFactory::create('D_ReadRolesPaginated');
     $roles = $datahandler->getOutData();
     $datahandler = DatahandlerFactory::create('D_RolesRowsTotalNumber');
     $roleRowsTotalNumber = $datahandler->getOutData();
     $paginator->rowsTotalNumber = $roleRowsTotalNumber;
     //VIEW
     $view = ViewFactory::create('V_ReadRolesPaginated');
     $view->setInData(array("roles" => $roles));
     $view->display();
 }
 public function display()
 {
     $session = SessionFactory::create();
     $dom = DOMHandlerFactory::create();
     $dom->setDocumentFromFile(USERS_HTML)->whereIdIs('login-user')->insertNode($session->get('session-user-name'))->whereIdIs('table')->removeAttribute('style="display: none;"');
     $trs = null;
     foreach ($this->data['users'] as $key => $user) {
         $trs .= "<tr><td>" . $user["name"] . "</td>";
         $trs .= "<td><a href='?user-id=" . $user["id"] . "&A_UpdateUserForm'";
         $trs .= "title='Update User' class='button'>";
         $trs .= "<i class='glyphicon glyphicon-pencil'></i></a> ";
         $trs .= "<a href='?user-id=" . $user["id"] . "&A_DeleteUserConfirmation'";
         $trs .= "title='Delete User' class='button'>";
         $trs .= "<i class='glyphicon glyphicon-trash'></i></a></td></tr>";
     }
     $dom->whereIdIs("tbody")->insertNode($trs);
     $paginator = PaginatorFactory::create();
     $paginator->action = "A_ReadUsersPaginated";
     $dom->whereIdIs('ul-pagination')->insertNode($paginator->paginationSelect);
     $dom->display();
 }
 public function execute()
 {
     //PARAMETERS
     $params = RequestParametersFactory::create();
     $pageNumber = $params->get('page-number');
     $rowsPerPage = $params->get('rows-per-page');
     //PAGINATOR
     $paginator = PaginatorFactory::create();
     $paginator->pageNumber = $pageNumber;
     $paginator->rowsPerPage = 10;
     //DATAHANDLERS
     $datahandler = DatahandlerFactory::create('D_ReadAllSquidData');
     $data = $datahandler->getOutData();
     $datahandler = DatahandlerFactory::create('D_SquidDataRowsTotalNumber');
     $rowsTotalNumber = $datahandler->getOutData();
     //PAGINATOR
     $paginator->rowsTotalNumber = $rowsTotalNumber;
     //VIEW
     $view = ViewFactory::create('V_ReadAllSquidData');
     $view->setInData($data);
     $view->display();
 }
 public function display()
 {
     $dom = DOMHandlerFactory::create();
     $dom->setDocumentFromFile(ACTIONS_ASSIGNMENT_HTML);
     $session = SessionFactory::create();
     $dom->whereIdIs('login-user')->insertNode($session->get('session-user-name'));
     $dom->whereIdIs('message-container')->insertNode('Actions Assignment for: ' . $this->data['role-name']);
     $dom->whereIdIs('actions-search-form')->removeAttribute('style="display: none;"');
     $dom->whereIdIs('actions-assignment-form')->removeAttribute('style="display: none;"');
     $trs = null;
     foreach ($this->data['role-actions'] as $actionRole) {
         if ($actionRole['status'] == 1) {
             $trs .= '<tr><td><div class="checkbox">
                 <label>
                     <b>' . $actionRole['name'] . '</b>
                 </label>
                 </td>
                 <td><input name="selected-actions-names[]" 
                     type="checkbox" 
                     value="' . $actionRole['name'] . '" checked
                 ></td>
             </div></tr>';
         } elseif ($actionRole['status'] == 0) {
             $trs .= '<tr><td><div class="checkbox">
                     <label>
                         <b>' . $actionRole['name'] . '</b>
                     </label>
                     </td>
                     <td><input name="selected-actions-names[]" 
                         type="checkbox" 
                         value="' . $actionRole['name'] . '"></td>
                 </div></tr>';
         }
     }
     $dom->whereIdIs('tbody')->insertNode($trs);
     // foreach($this->data['role-actions'] as $actionRole)
     // {
     //     if ($actionRole['status'] == 1)
     //     {
     //         $dom->whereIdIs('tbody')
     //             ->insertNode(
     //                             '<tr><td><div class="checkbox">
     //                                 <label>
     //                                     <b>'.$actionRole['name'].'</b>
     //                                 </label>
     //                                 </td>
     //                                 <td><input name="selected-actions-names[]"
     //                                     type="checkbox"
     //                                     value="'.$actionRole['name'].'" checked
     //                                 ></td>
     //                             </div></tr>'
     //                         );
     //     }
     //     elseif($actionRole['status'] == 0)
     //     {
     //         $dom->whereIdIs('tbody')
     //             ->insertNode(
     //                             '<tr><td><div class="checkbox">
     //                                 <label>
     //                                     <b>'.$actionRole['name'].'</b>
     //                                 </label>
     //                                 </td>
     //                                 <td><input name="selected-actions-names[]"
     //                                     type="checkbox"
     //                                     value="'.$actionRole['name'].'"></td>
     //                             </div></tr>'
     //                         );
     //     }
     // }
     $id = $session->get('selected-role-id');
     $paginator = PaginatorFactory::create();
     $paginator->action = "selected-role-id=" . $id . "&A_ReadActionsWithStatus";
     $dom->whereIdIs('ul-pagination')->insertNode($paginator->paginationSelect);
     $dom->display();
 }