コード例 #1
0
 /**
  * Get modules that run on this page
  *
  * @param \phpOMS\Message\Http\Request $request Request
  *
  * @return array
  *
  * @since  1.0.0
  * @author Dennis Eichhorn
  */
 public function getRoutedModules($request)
 {
     switch ($this->app->dbPool->get('core')->getType()) {
         case \phpOMS\DataStorage\Database\DatabaseType::MYSQL:
             $uri_hash = $request->getHash();
             $uri_pdo = '';
             $i = 1;
             foreach ($uri_hash as $hash) {
                 $uri_pdo .= ':pid' . $i . ',';
                 $i++;
             }
             $uri_pdo = rtrim($uri_pdo, ',');
             /* TODO: make join in order to see if they are active */
             $sth = $this->app->dbPool->get('core')->con->prepare('SELECT
                     `' . $this->app->dbPool->get('core')->prefix . 'module_load`.`module_load_type`, `' . $this->app->dbPool->get('core')->prefix . 'module_load`.*
                     FROM
                     `' . $this->app->dbPool->get('core')->prefix . 'module_load`
                     WHERE
                     `module_load_pid` IN(' . $uri_pdo . ')');
             $i = 1;
             foreach ($uri_hash as $hash) {
                 $sth->bindValue(':pid' . $i, $hash, \PDO::PARAM_STR);
                 $i++;
             }
             $sth->execute();
             return $sth->fetchAll(\PDO::FETCH_GROUP);
     }
     return null;
 }