public static function FetchByRole($role) { global $db_connection; $res = array(); $from_table = TextPart::$table; $lang = GetLanguage(); if ($lang !== 'rus') { $from_table .= '_' . $lang; } $result = $db_connection->query("SELECT * FROM `" . $from_table . "` WHERE role=\"" . htmlspecialchars($role) . "\" ORDER BY priority DESC"); if (!$result) { echo $db_connection->error; return NULL; } while ($row = $result->fetch_assoc()) { $row['language'] = $lang; array_push($res, TextPart::FetchFromAssoc($row)); } return $res; }
$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: $assoc = $_POST; $assoc['author_id'] = $_POST['id']; unset($assoc['id']); $part = TextPart::FetchFromAssoc($assoc); if ($part === NULL) { $content = AlertMessage('alert-danger', Language::Word('error during text block adding')); } else { $glob_id = 0; if (isset($_POST['glob_id'])) { $glob_id = $_POST['glob_id']; } if (TextPart::InsertToDB($part, $_POST['language'], $glob_id)) { $content = AlertMessage('alert-success', Language::Word('text block is successfully added')); } else { $content = AlertMessage('alert-danger', Language::Word('error during text block inserting')); } } break; default: