public function printArray($all)
 {
     if (is_array($all)) {
         // Kint::dump($all);
         echo "<table border=1px>";
         echo "\r\n\t\t\t\t<thead>\r\n\t\t\t\t\t<th></th>\r\n    \t\t\t\t<th>id</th>\r\n \t\t\t\t\t<th>Задание</th>\r\n \t\t\t\t\t<th>Описание</th>\r\n \t\t\t\t\t<th>Поручено</th>\r\n \t\t\t\t\t<th>Срок</th>\r\n \t\t\t\t\t<th>Окончено</th>\r\n \t\t\t\t\t<th>Кто поручил</th>\r\n \t\t\t\t\t<th>Кому поручено</th>\r\n \t\t\t\t\t<th>Приоритет</th>\r\n \t\t\t\t\t<th>Статус</th>\r\n \t\t\t\t\t<th>Сайт</th>\r\n\t\t\t\t</thead>";
         foreach ($all as $x) {
             $id = $x->id;
             $hostingName = hosting::GET($x->hostingID)->name;
             $managerName = manager::GET($x->managerID)->name;
             $registratorName = registrator::GET($x->registratorID)->name;
             $from = $_SERVER['REQUEST_URI'];
             echo "\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t<a href=\"/task/edit/{$id}?return-url={$from}\">\r\n\t\t\t\t\t\t\t\tE\r\n\t\t\t\t\t\t\t</a>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t<a href=\"/task/view/{$id}\">\r\n\t\t\t\t\t\t\t\t{$id}\r\n\t\t\t\t\t\t\t</a>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t<td><a href=\"/task/view/{$id}\">\r\n\t\t\t\t\t\t\t{$x->name}\r\n\t\t\t\t\t\t</td></a>\r\n\t\t\t\t\t\t<td>{$x->description}</td>\r\n\t\t\t\t\t\t<td>";
             if (!is_null($x->insert_datetime)) {
                 echo DateTime::createFromFormat("M d Y h:i:s:uA", $x->insert_datetime)->format("Y-m-d H:i");
             }
             echo "</td>\r\n\t\t\t\t\t\t<td>";
             if (!is_null($x->deadlineDate)) {
                 echo DateTime::createFromFormat("M d Y h:i:s:uA", $x->deadlineDate)->format("Y-m-d H:i");
             }
             echo "</td>\r\n\t\t\t\t\t\t<td>";
             if (!is_null($x->finishedDate)) {
                 echo DateTime::createFromFormat("M d Y h:i:s:uA", $x->finishedDate)->format("Y-m-d H:i");
             }
             echo "</td>\r\n\t\t\t\t\t\t<td><a href=\"/user/view/{$x->giver_userID}\">\r\n\t\t\t\t\t\t\t" . user::GET($x->giver_userID)->username . "\r\n\t\t\t\t\t\t</a></td>\r\n\t\t\t\t\t\t<td><a href=\"/user/view/{$x->doer_userID}\">\r\n\t\t\t\t\t\t\t" . user::GET($x->doer_userID)->username . "\r\n\t\t\t\t\t\t</a></td>\r\n\t\t\t\t\t\t<td>" . priority::GET($x->priorityID)->name . "</td>\r\n\t\t\t\t\t\t<td>" . status::GET($x->statusID)->name . "</td>\r\n\t\t\t\t\t\t<td><a href=\"/site/view/{$x->siteID}\">" . site::GET($x->siteID)->name . "</a></td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t";
         }
         echo "</table>";
     }
 }
 public function newEntry()
 {
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         hosting::INSERT($_POST['name'], $_POST['adminPanelLink'], $_POST['login'], $_POST['password'], $_POST['emailID'], $_POST['ip'], $_POST['phpMyAdminLink'], $_POST['NS1'], $_POST['NS2'], $_POST['NS3'], $_POST['NS4']);
         //header("Location: /hosting/view/$id");
     } else {
         hostingController::loadView('_form', $args = array());
     }
 }
 public function GET($id)
 {
     if (!hosting::IFDELETED($id)) {
         $getQuery = "SELECT id, name, adminPanelLink, login, password, emailID, ip, phpMyAdminLink, NS1, NS2, NS3, NS4 FROM [dbo].[hosting] WHERE id={$id};";
         $row = mssql_fetch_array(mssql_query($getQuery));
         $result = new hosting($row["id"], $row["name"], $row["adminPanelLink"], $row["login"], $row["password"], $row["emailID"], $row["ip"], $row["phpMyAdminLink"], $row["NS1"], $row["NS2"], $row["NS3"], $row["NS4"]);
         return $result;
     }
 }
 public function GET($id)
 {
     if (!hosting::IFDELETED($id)) {
         $getQuery = "SELECT id, username, hash, accessID FROM [dbo].[user] WHERE id={$id};";
         $result = mssql_query($getQuery);
         $row = mssql_fetch_array($result);
         $x = new user($row["id"], $row["username"], $row["hash"], $row["accessID"]);
         return $x;
     }
 }
	ip:<input name="ip" type="text" value="<?php 
echo hosting::GET($args['id'])->ip;
?>
">
	phpMyAdminLink:<input name="phpMyAdminLink" type="text" value="<?php 
echo hosting::GET($args['id'])->phpMyAdminLink;
?>
">
	NS1:<input name="NS1" type="text" value="<?php 
echo hosting::GET($args['id'])->NS1;
?>
">
	NS2:<input name="NS2" type="text" value="<?php 
echo hosting::GET($args['id'])->NS2;
?>
">
	NS3:<input name="NS3" type="text" value="<?php 
echo hosting::GET($args['id'])->NS3;
?>
">
	NS4:<input name="NS4" type="text" value="<?php 
echo hosting::GET($args['id'])->NS4;
?>
">
	<input type="submit">
</form>

<!-- <a href="/hosting/view/<?php 
echo $args['id'];
?>
">VIEW</a> -->
<h2>INDEX</h2>
<?php 
global $menuHover;
$menuHover->Add("Все", "/hosting");
$menuHover->Add("Новый", "/hosting/new");
?>
<!-- <a href="/hosting/new">ADD</a><br><br> -->
<?php 
hosting::printArray(hosting::GETALL());
<!-- <a href="/hosting">INDEX</a><br><br> -->
<?php 
global $menuHover;
$menuHover->Add("Все", "/hosting");
$menuHover->Add("Новый", "/hosting/new");
$menuHover->Add("Изменить", "/hosting/edit/" . $args['id']);
$menuHover->Add("Удалить", "/hosting/delete/" . $args['id'], "return confirm('Are you sure?');");
?>

<?php 
$current = hosting::GET($args['id']);
hosting::printOne($current);
?>
<br><br>
<!-- <a href="/hosting/edit/<?php 
echo $args['id'];
?>
">EDIT</a><br> -->
<!-- <a href="/hosting/delete/<?php 
echo $args['id'];
?>
" onclick="return confirm('Are you sure?');">DELETE</a><br> -->
<br><br><h3>hostings of site</h3>
<?php 
site::printArray(site::GETSQL("SELECT * FROM site WHERE deleted = 0 AND hostingID=" . $current->id));
		<textarea name="name"><?php 
echo $current->name;
?>
</textarea>
		<script type="text/javascript">
	   		CKEDITOR.replace('name',
	   		{
	   	        filebrowserBrowseUrl :		'/js/fileman/index.html',
                filebrowserImageBrowseUrl:	'/js/fileman/index.html?type=image',
	   		});
		</script><br>
	
	hostingID:<select name="hostingID">
		<option disabled selected>Выберите хостинг</option>
		<?php 
$hostings = hosting::GETALL();
foreach ($hostings as $hosting) {
    echo " <option ";
    if ($current->hostingID == $hosting->id) {
        echo " selected ";
    }
    echo ' value="' . $hosting->id . '" ';
    echo " > ";
    echo $hosting->name;
    echo " </option> ";
}
?>
	</select>
	
	managerID:<select name="managerID">
		<option disabled selected>Выберите менеджера</option>
 public function printOne($site)
 {
     $id = $site->id;
     $hostingName = hosting::GET($site->hostingID)->name;
     $managerName = manager::GET($site->managerID)->name;
     $registratorName = registrator::GET($site->registratorID)->name;
     echo "<table>";
     echo "<tr><td><b>\tid\t\t\t</b></td><td>\t\t\t\t\t\t\t\t\t\t\t\t\t\t{$site->id}\t\t\t</a></td></tr>";
     echo "<tr><td><b>\tИмя\t\t\t</b></td><td>\t\t\t\t\t\t\t\t\t\t\t\t\t\t{$site->name}\t\t\t</a></td></tr>";
     echo "<tr><td><b>\tХостинг\t\t</b></td><td><a \thref=\"/hosting/view/{$site->hostingID}\">\t\t{$hostingName}\t\t</a></td></tr>";
     echo "<tr><td><b>\tМенеджер\t</b></td><td><a \thref=\"/manager/view/{$site->managerID}\">\t\t{$managerName}\t\t</a></td></tr>";
     echo "<tr><td><b>\tРегистратор\t</b></td><td><a href=\"/registrator/view/{$site->registratorID}\">\t{$registratorName}\t</a></td></tr>";
     echo "</table>";
 }