Discontinuous Galerkin is the name, not for a single method, but for an extremely broad family of methods. Consider the BVP $$\nabla \cdot a\nabla u = f \text{ in } \Omega \text{ and } u=0 \text{ on } \partial \Omega.$$
Assume $\bar{\Omega} = \cup_k \bar{K}_k$ is a triangulation of $\bar{\Omega}$. Multiply the BVP by a piecewise smooth test function $v$ and formally integrate by parts to arrive at:
$$\tag{1}
\sum_k \int_{\partial K_k} \left(\nabla u(x)\right) a(x) \nu_k(x) v(x) \, dx -
\sum_k \int_{K_k} (\nu(x)^T a(x) \nabla u(x))^T \, dx
= \int_{\Omega} fv.
$$
Here, $\nu_k(x)$ is the outer-pointing normal to $\partial K_k$.
Implied in the BVP is that $u$ is continuous, so the jump $[u]$ of $u$ must be zero along $\Gamma = \cup_k \partial K_k \cap \Omega$:
$$\tag{2} \int_\Gamma [u]v \, dx =0 \text{ on } \Gamma.$$
Furthermore, $u=0$ on $\partial \Omega$.
I have now answered your question 1, because I have integrated by parts. Nevertheless, I suspect that you are still not satisfied. In my humble opinion, this is because of the still large distance between (1),(2) and a MATLAB implementation.
In DG, the basis functions are not indexed by $\phi_{j}$, where $j$ indicates a vertex, but indeed by $\phi_{i,k}$, where $i \in \{1,2,3\}$ indicates a vertex and $k$ indicates a face. If there are $k=1\ldots K$ faces, then there are $3K$ basis functions in DG. If you combine (1), (2), as well as the b.c. $u=0$ on $\partial \Omega$, you obtain a fully-determined linear system for the coefficients $u_{i,k}$ of $u(x) = \sum_{i,k} u_{i,k} \phi_{i,k}(x)$.
The programming of this is tedious.