__construct() public method

架构函数
public __construct ( array $config = '' )
$config array 数据库配置数组
Example #1
0
 public function __construct(array $db_settings, RegistryInterface $registry)
 {
     $db_setting = array('server' => $db_settings['server'], 'database' => $db_settings['db'], 'username' => $db_settings['db_cred']['user']['user'], 'password' => $db_settings['db_cred']['user']['password']);
     //I know; the credentials seem too long
     parent::__construct($db_setting);
     $this->registry = $registry;
 }
Example #2
0
 public function __construct()
 {
     parent::__construct();
     if (!isset($_GET['action'])) {
         $this->drawTable();
     } else {
         switch ($_GET['action']) {
             case 'create':
                 $this->createPromo();
                 break;
             case 'save':
                 $this->savePromo($_GET['id']);
                 break;
             case 'edit':
                 $this->drawTableID($_GET['id']);
                 $this->selected_id = $_GET['id'];
                 break;
             case 'delete':
                 $this->deletePromo($_GET['id']);
                 break;
             default:
                 break;
         }
     }
     $this->drawList();
     $this->CKEditor();
     $this->bottomSpace();
 }
Example #3
0
 public function __construct()
 {
     parent::__construct();
     $this->action = isset($_GET['vis']) ? $_GET['vis'] : false;
     $this->artsgruppe = isset($_GET['artsgruppe']) ? $_GET['artsgruppe'] : false;
     switch ($this->action) {
         case 'total':
             $this->total();
             break;
         case 'arter':
             $this->arter();
             break;
         case 'select':
             $this->select();
             break;
         case 'klassifikation':
             $this->klassifikation();
             break;
         case 'referencer':
             $this->referencer();
             break;
         default:
             break;
     }
 }
 public function __construct()
 {
     parent::__construct();
     $this->drawHeader();
     $this->loadData();
     $this->populate();
 }
Example #5
0
 public function __construct($dbHost = null)
 {
     parent::__construct($dbHost);
     if (is_null($this->dbhost)) {
         die("MySQL hostname not set");
     } else {
         if (is_null($this->dbname)) {
             die("MySQL database not selected");
         } else {
             if (is_null($this->dbuser)) {
                 die("MySQL hostname not set");
             } else {
                 if (is_null($this->dbpwd)) {
                     die("MySQL pwd not currect");
                 }
             }
         }
     }
     if (!$this->link_id) {
         $this->link_id = mysql_connect($this->hostname, $this->dbuser, $this->dbpwd);
     }
     mysql_query("SET NAMES UTF-8", $this->link_id);
     if ($this->dbname) {
         mysql_select_db($this->dbname, $this->link_id);
     }
 }
Example #6
0
 public function __construct(array $db_settings, RegistryInterface $registry)
 {
     $db_setting = array("server" => $db_settings["server"], "database" => $db_settings["db"], "username" => $db_settings["db_cred"]["user"]["user"], "password" => $db_settings["db_cred"]["user"]["password"]);
     //I know; the credentials seem too long
     parent::__construct($db_setting);
     $this->registry = $registry;
 }
Example #7
0
 public function __construct()
 {
     parent::__construct();
     if (!isset($_GET['action'])) {
         echo 'Programfejl ..';
         return;
     }
     switch ($_GET['action']) {
         case 'backup':
             $this->createBackup();
             break;
         case 'showtables':
             $this->showTables();
             break;
         case 'updateDK':
             $this->updateDK();
             break;
         case 'updateCRLF':
             $this->updateCRLF();
             break;
         case 'restoreBackup':
             $this->restoreBackup();
             break;
         default:
             return;
     }
 }
Example #8
0
 public function __construct($ssTabaleName = '', $ssAlias = '', $ssPrimaryKey = '')
 {
     $this->ssTableName = $ssTabaleName;
     $this->ssAlias = $ssAlias;
     $this->ssPrimaryKey = $ssPrimaryKey;
     parent::__construct();
 }
Example #9
0
 public function __construct()
 {
     try {
         parent::__construct();
     } catch (MysqlException $e) {
         Html::showAll($e);
     }
 }
Example #10
0
 public function __construct()
 {
     parent::__construct();
     $this->createLog();
     $this->insertRequests();
     //return log_id as response, caller may use it to something ...
     echo $this->log_id;
 }
Example #11
0
 public function __construct()
 {
     parent::__construct();
     if (isset($_GET['artsgruppe']) || isset($_GET['artsgruppedk'])) {
         //$this->artsgruppe=$this->getArtsgruppe();
         $this->artsgruppe = isset($_GET['artsgruppe']) ? $_GET['artsgruppe'] : $_GET['artsgruppedk'];
     }
 }
Example #12
0
 public function __construct($name, $email, $password)
 {
     parent::__construct();
     $this->name = $name;
     $this->password = $password;
     $this->email = $email;
     $this->id = 0;
 }
Example #13
0
 public function __construct()
 {
     parent::__construct();
     $taxon = isset($_GET['taxon']) ? $_GET['taxon'] : '';
     if ($taxon != '') {
         $this->getCOF_URL($taxon);
     }
 }
Example #14
0
 public function __construct()
 {
     parent::__construct();
     $get = isset($_GET['get']) ? $_GET['get'] : 'Rige';
     $parent = isset($_GET['parent']) ? $_GET['parent'] : '';
     $base = isset($_GET['base']) ? $_GET['base'] : '';
     $this->load($get, $parent, $base);
 }
Example #15
0
 public function __construct()
 {
     parent::__construct();
     mysql_set_charset('utf8');
     if (!$this->getExclusive()) {
         $this->getRandom();
     }
     $this->getTeasers();
 }
Example #16
0
    public function __construct($char)
    {
        parent::__construct();
        $this->style();
        if (!isset($_GET['arter'])) {
            $this->arter = 'da';
            $this->ca = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'x', 'y', 'z', 'Æ', 'Ø', 'Å');
        } else {
            switch ($_GET['arter']) {
                case 'int':
                    $this->arter = 'int';
                    $this->ca = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'x', 'y', 'z');
                    break;
                default:
                    $this->arter = 'da';
                    $this->ca = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'x', 'y', 'z', 'Æ', 'Ø', 'Å');
                    break;
            }
        }
        echo '<div style="padding-left:20px;">';
        ?>
			<a href="/" id="show-search-simple" style="text-decoration:none;">&#171;&nbsp;Simpel søgning</a>
			&nbsp;>&nbsp;
			<a href="http://allearter.dk/" style="text-decoration:none;">Projekt Allearter Startside</a>
			<br><br>
			<h1>Artsregister - alle arter A - Å</h1>
			<br>
<?php 
        $this->arterMenu();
        $this->char = in_array($char, $this->ca) ? $char : 'a';
        if ($this->arter == 'da') {
            $SQL = 'select Videnskabeligt_navn, Dansk_navn from allearter where Dansk_navn like "' . $this->char . '%" order by Dansk_navn asc';
        } else {
            $SQL = 'select Videnskabeligt_navn, Dansk_navn from allearter where Dansk_navn="" and Videnskabeligt_navn like "' . $this->char . '%" order by Videnskabeligt_navn asc';
        }
        $header = '<h1 class="taksonomi">' . ucfirst($this->char) . '</h1>';
        //echo $SQL;
        mysql_set_charset('utf8');
        $result = $this->query($SQL);
        echo '<div class="header-cnt">';
        echo $header;
        $this->leftMenu();
        echo '</div>';
        echo '<div class="sitemap-cnt"><br/>';
        while ($row = mysql_fetch_array($result)) {
            $taxon = str_replace(' ', '+', $row['Videnskabeligt_navn']);
            if ($this->arter == 'da') {
                echo '<a class="taksonomi" href="?taxon=' . $taxon . '"><strong>' . $row['Dansk_navn'] . '</strong>&nbsp;&nbsp;<i style="font-family:times,serif;color:black;">' . $row['Videnskabeligt_navn'] . '</i></a><br>';
            } else {
                echo '<a class="taksonomi" href="?taxon=' . $taxon . '"><i style="font-size:1.1em;">' . $row['Videnskabeligt_navn'] . '</i></a><br>';
            }
        }
        echo '<br/></div>';
        //01032015
        echo '</div>';
    }
Example #17
0
 public function __construct()
 {
     try {
         parent::__construct();
     } catch (MysqlException $e) {
         Html::showAll($e);
     }
     //Noten alles Schueler werden übergeben
     //$notens = Noten::getAllAsObject();
 }
 public function __construct($lehrer_id = NULL)
 {
     try {
         parent::__construct();
     } catch (MysqlException $e) {
         Html::showAll($e);
     }
     if ($lehrer_id !== NULL) {
         $this->load($lehrer_id);
     }
 }
Example #19
0
 /**
  * DatabaseMap constructor.
  * Calls parent constructor, setting database settings
  *
  * @param array $params
  */
 public function __construct($params = array())
 {
     // ensure there is a log level to use, defaulting to WARNING
     if (!array_key_exists('log_level', $params)) {
         $params['log_level'] = Log::LOG_LEVEL_WARNING;
     }
     // set debug value
     if (array_key_exists('debug', $params)) {
         $this->debug = !!$params['debug'];
     }
     parent::__construct($params);
     $this->Log->write('done constructing ' . __METHOD__, Log::LOG_LEVEL_SYSTEM_INFORMATION);
 }
Example #20
0
 public function __construct()
 {
     parent::__construct();
     $this->target = $_GET['target'];
     $this->prior = $_GET['prior'];
     $this->value = $_GET['value'];
     $ex = $_GET['lang'] == 'da' ? '_dk' : '';
     mysql_set_charset('utf8');
     $SQL = 'select distinct ' . $this->target . $ex . ' from allearter where ' . $this->prior . $ex . '="' . $this->value . '"';
     $this->fileDebug($SQL);
     $row = $this->getRow($SQL);
     echo $row[$this->target . $ex];
 }
Example #21
0
 public function __construct($tableName = '', $db = 'DB')
 {
     $config = null;
     if (is_string($db)) {
         $config = config($db);
     }
     if (is_array($db)) {
         $config = $db;
     }
     if ($config === null) {
         trigger_error('找不到数据库配置,请检查配置文件!', E_USER_ERROR);
     }
     parent::__construct($config);
     $this->tableName = $tableName;
 }
Example #22
0
 public function __construct()
 {
     parent::__construct();
     $log_id = $_GET['log_id'];
     $SQL = 'select guid from userLog where log_id=' . $log_id;
     $row = $this->getRow($SQL);
     //should be changed when going to real domain, eg off /bif/
     /*
     $ip = getHostByName(php_uname('n')); 
     if ($ip=='127.0.1.1') $ip='localhost';
     $permalink=$ip.'/bif/?perma='.$row['guid'];
     */
     $permalink = 'allearter-databasen.dk/?perma=' . $row['guid'];
     echo $permalink;
 }
Example #23
0
 /**
  * Login constructor.
  *
  * @param array $params
  */
 public function __construct($params = array())
 {
     $this->Log->write(__METHOD__, Log::LOG_LEVEL_SYSTEM_INFORMATION);
     if (Helpers::is_array_ne($params)) {
         if (array_key_exists('log_level', $params)) {
             $this->logLevel($params['log_level']);
         }
         $this->Log->write('params', Log::LOG_LEVEL_USER, $params);
         // set properties based on parameters using magic method
         foreach ($params as $name => $value) {
             $this->__set($name, $value);
         }
     }
     parent::__construct($params);
 }
Example #24
0
 public function __construct()
 {
     parent::__construct();
     if (!isset($_GET['a']) && !isset($_GET['ad'])) {
         return '';
     }
     $p = isset($_GET['a']) ? 'Artsgruppe="' . $_GET['a'] . '"' : 'Artsgruppe_dk="' . $_GET['ad'] . '"';
     $SQL = 'select count(*) from allearter where ' . $p . ' and Sortering<>""';
     $row = $this->getRow($SQL);
     if ($row['count(*)'] > 0) {
         echo 'yes';
     } else {
         echo '';
     }
 }
Example #25
0
 public function __construct()
 {
     parent::__construct();
     $h = $_GET['historik'];
     $html = '';
     $historik = explode(',', $h);
     //reverse the array, so latest entry comes first
     $historik = array_reverse($historik);
     //$html='<table>';
     foreach ($historik as $id) {
         //$html.='<tr>'.$this->getSearchHistory($id).'</tr>';
         $html .= $this->getSearchHistory($id);
     }
     //$html.='</table>';
     echo $html;
 }
Example #26
0
 public function __construct()
 {
     parent::__construct();
     if (isset($_GET['action'])) {
         switch ($_GET['action']) {
             case 'get':
                 echo $this->get();
                 break;
             case 'put':
                 $this->put();
                 break;
             default:
                 return;
         }
     }
 }
Example #27
0
 public function __construct()
 {
     parent::__construct();
     if (!isset($_GET['all'])) {
         $file = file_exists('json/artsgruppe-links.json') ? 'json/artsgruppe-links.json' : '../json/artsgruppe-links.json';
         $JSON = file_get_contents($file);
         $this->artsgruppeLinks = json_decode($JSON);
         $this->loadData();
         $this->drawHeader();
         $this->populate();
     } else {
         $filename = $_GET['filename'];
         header('Content-type: application/text');
         header('Content-Disposition: attachment; filename="' . $filename . '"');
         $this->generateCSV();
     }
 }
Example #28
0
 public function __construct()
 {
     parent::__construct();
     switch ($_GET['action']) {
         case 'insert':
             $this->insert();
             break;
         case 'update':
             $this->update();
             break;
         case 'delete':
             $this->delete();
             break;
         default:
             break;
     }
     $this->drawList();
 }
Example #29
0
 public function __construct()
 {
     parent::__construct();
     $param = $_GET['name_startsWith'];
     mysql_set_charset('utf8');
     if ($param != ' ') {
         $SQL = 'select distinct Artsgruppe_dk from allearter where Artsgruppe_dk like "' . $param . '%"';
     } else {
         $SQL = 'select distinct Artsgruppe_dk from allearter order by Artsgruppe_dk';
     }
     $result = $this->query($SQL);
     $html = '';
     while ($row = mysql_fetch_array($result)) {
         if ($html != '') {
             $html .= ',';
         }
         $html .= '{"id" : "' . $row['Artsgruppe_dk'] . '", "taxon": "' . $row['Artsgruppe_dk'] . '"}';
     }
     $html = '[' . $html . ']';
     echo $html;
 }
Example #30
0
 public function __construct()
 {
     parent::__construct();
     $param = $_GET['name_startsWith'];
     if ($param != ' ') {
         $SQL = 'select distinct Videnskabeligt_navn from allearter ' . 'where Videnskabeligt_navn like "' . $param . '%" order by Videnskabeligt_navn asc';
     } else {
         //$SQL='select distinct Videnskabeligt_navn from allearter order by rand(), Videnskabeligt_navn asc limit 1000';
         $SQL = 'select * from (select Videnskabeligt_navn from allearter order by rand() limit 300) T1 order by Videnskabeligt_navn asc';
     }
     mysql_set_charset('utf8');
     $result = $this->query($SQL);
     $html = '';
     while ($row = mysql_fetch_array($result)) {
         if ($html != '') {
             $html .= ',';
         }
         $html .= '{"id" : "' . $row['Videnskabeligt_navn'] . '", "taxon": "' . $row['Videnskabeligt_navn'] . '"}';
     }
     $html = '[' . $html . ']';
     echo $html;
 }