/** * Vise publiserte utgivelser */ protected function published() { ess::$b->page->add_title("Utgivelser"); // hent publiserte utvivelser $pagei = new pagei(pagei::ACTIVE_GET, "side", pagei::PER_PAGE, 10); $ffnp_q = login::$logged_in ? "ffnp_ffn_id = ffn_id AND ffnp_up_id = " . login::$user->player->id : "FALSE"; $result = $pagei->query("SELECT ffn_id, ffn_published_time, ffn_cost, ffn_title, ffn_sold, ffn_description, ffnp_time FROM ff_newspapers LEFT JOIN ff_newspapers_payments ON {$ffnp_q} WHERE ffn_ff_id = {$this->ff->id} AND ffn_published != 0 ORDER BY ffn_published_time DESC"); echo ' <p class="c">Utgivelser</p>'; // ingen publiserte utgivelser? if ($result->rowCount() == 0) { echo ' <p class="c">Ingen utgivelser er publisert.</p>'; } else { echo ' <p class="c">' . $pagei->total . ' utgivelse' . ($pagei->total == 1 ? '' : 'r') . ' er publisert:</p>'; #$i = $pagei->total - ($pagei->per_page*($pagei->active-1)); while ($row = $result->fetch()) { echo ' <div class="section center w200"> <h2><a href="avis?ff_id=' . $this->ff->id . '&ffn=' . $row['ffn_id'] . '">' . htmlspecialchars($row['ffn_title']) . '</a></h2> <dl class="dd_right"> <dt>Publisert</dt> <dd>' . ess::$b->date->get($row['ffn_published_time'])->format() . '</dd> <dt>Solgte utgivelser</dt> <dd>' . game::format_number($row['ffn_sold']) . '</dd> <dt>Pris</dt> <dd>' . game::format_cash($row['ffn_cost']) . '</dd> <dt>Kjøpt?</dt> <dd>' . ($row['ffnp_time'] ? '<a href="avis?ff_id=' . $this->ff->id . '&ffn=' . $row['ffn_id'] . '">Ja</a> (' . ess::$b->date->get($row['ffnp_time'])->format() . ')' : 'Nei [<a href="avis?ff_id=' . $this->ff->id . '&ffn=' . $row['ffn_id'] . '">Kjøp</a>]') . (access::is_nostat() ? ' (nostat)' : '') . '</dd> </dl> <div class="p">' . $this->ff->format_description($row['ffn_description']) . '</div> </div>'; #$i--; } // flere sider? if ($pagei->pages > 1) { echo ' <p class="c">Navigasjon: ' . $pagei->pagenumbers() . '</p>'; } } }
/** * Informasjon for avisfirma */ protected function type_avis() { // hent publiserte utvivelser $pagei = new pagei(pagei::ACTIVE, 1, pagei::PER_PAGE, 2); $ffnp_q = $this->up ? "ffnp_ffn_id = ffn_id AND ffnp_up_id = " . $this->up->id : "FALSE"; $result = $pagei->query("\n\t\t\tSELECT ffn_id, ffn_published_time, ffn_cost, ffn_title, ffn_sold, ffn_description, ffnp_time\n\t\t\tFROM ff_newspapers LEFT JOIN ff_newspapers_payments ON {$ffnp_q}\n\t\t\tWHERE ffn_ff_id = {$this->ff->id} AND ffn_published != 0\n\t\t\tORDER BY ffn_published_time DESC"); // ingen publiserte utgivelser? if ($result->rowCount() == 0) { echo ' <p class="c">Ingen avisutgivelser er publisert.</p>'; } else { echo ' <p class="c">' . $pagei->total . ' utgivelse' . ($pagei->total == 1 ? '' : 'r') . ' er publisert:</p>'; while ($row = $result->fetch()) { echo ' <div class="section center w200"> <h2><a href="avis?ff_id=' . $this->ff->id . '&ffn=' . $row['ffn_id'] . '">' . htmlspecialchars($row['ffn_title']) . '</a></h2> <dl class="dd_right"> <dt>Publisert</dt> <dd>' . ess::$b->date->get($row['ffn_published_time'])->format() . '</dd> <dt>Solgte utgaver</dt> <dd>' . game::format_number($row['ffn_sold']) . '</dd> <dt>Pris</dt> <dd>' . game::format_cash($row['ffn_cost']) . '</dd> <dt>Kjøpt?</dt> <dd>' . ($row['ffnp_time'] ? '<a href="avis?ff_id=' . $this->ff->id . '&ffn=' . $row['ffn_id'] . '">Ja</a> (' . ess::$b->date->get($row['ffnp_time'])->format() . ')' : 'Nei [<a href="avis?ff_id=' . $this->ff->id . '&ffn=' . $row['ffn_id'] . '">Kjøp</a>]') . '</dd> </dl> <div class="p">' . $this->ff->format_description($row['ffn_description']) . '</div> </div>'; } echo ' <p class="c"><a href="avis?ff_id=' . $this->ff->id . '">Vis alle publiserte utgivelser</a></p>'; } echo ' <div class="hr fhr"><hr /></div>'; }