$glob_id = 0; if (isset($_POST['glob_id'])) { $glob_id = $_POST['glob_id']; } if (Direction::InsertToDB($direction, $_POST['language'], $glob_id)) { $content = AlertMessage('alert-success', Language::Word('direction is successfully added')); } else { $content = AlertMessage('alert-danger', Language::Word('error during direction inserting')); } } break; case Project::$type: $assoc = $_POST; $assoc['author_id'] = $_POST['id']; unset($assoc['id']); $project = Project::FetchFromAssoc($assoc); if ($project === NULL) { $content = AlertMessage('alert-danger', Language::Word('error during project adding')); } else { $glob_id = 0; if (isset($_POST['glob_id'])) { $glob_id = $_POST['glob_id']; } if (Project::InsertToDB($project, $_POST['language'], $glob_id)) { $content = AlertMessage('alert-success', Language::Word('project is successfully added')); } else { $content = AlertMessage('alert-danger', Language::Word('error during project inserting')); } } break; case TextPart::$type:
public static function FetchAll() { global $db_connection; $res = array(); $from_table = Project::$table; $lang = GetLanguage(); if ($lang !== 'rus') { $from_table .= '_' . $lang; } $result = $db_connection->query("SELECT * FROM `" . $from_table . "` ORDER BY direction_id DESC, id DESC"); if (!$result) { return NULL; } while ($row = $result->fetch_assoc()) { $row['language'] = $lang; array_push($res, Project::FetchFromAssoc($row)); } return $res; }