public function send() { debug("Action Send"); $this->set_status(ADVERTISEMENT_STATUS_SENT); $event = Event::get_from_id($this->get_field("event_id")->value); foreach ($event->get_guests() as $guest) { $task = new Task(); $task->hydrate(); $task->id = create_id(); $task->set_value("start_t", time()); $task->set_value("description", ""); $task->set_value("command", "mail_advertisement"); $task->set_value("parameters", $event->id . "," . $guest->get_value("email") . "," . $this->id); $task->set_value("status", TASK_STATUS_PENDING); $task->set_value("error_msg", ""); $task->set_value("event_id", $_SESSION["event_id"]); $task->store(); } }
public function get_description() { $event_id = $this->get_bill()->event_id; $event = Event::get_from_id($event_id); $result = <<<EOF ({$event_id}) <a href="?action=retrieve&type=event&id={$event_id}">{$this->event_name}</a><br/> {{Ticket}}: {$this->event_rate_name} EOF; if ($event->type == EVENT_TYPE_NOMINATIVE) { $result .= <<<EOF {{Attendee:}} {$this->attendee_title} {$this->attendee_firstname} {$this->attendee_lastname} EOF; } else { $result .= <<<EOF {{Unit Price}}: {$this->event_rate_amount}<br/> EOF; } return $result; }
public function get_event() { return Event::get_from_id($this->event_id); }
<?php $event = Event::get_from_id($_SESSION["event_id"]); ?> <a href="?action=retrieve&type=event&id=<?php echo $_SESSION["event_id"]; ?> ">Event title: <?php echo $event->title; ?> </a> <br/><br/> <div class="evt_sidebar"> <ul> <li><a href="?action=promote_event&id=<?php echo $event->id; ?> ">{{Help}}</a></li> <li><a href="?action=manage&type=guest">Manage guests</a></li> <li><a href="?action=manage&type=advertisement">Manage advertisements</a></li> <li><a href="?action=manage&type=task">Manage tasks</a></li> <li><a href="?action=run_tasks">Run tasks</a></li> </ul> </div>
public static function list_all($user_id = NULL) { global $g_pdo; $events = array(); $where_clause = ""; if ($user_id != NULL) { $where_clause = "WHERE `id_user`= :id"; } if (!is_admin_logged()) { if ($where_clause == "") { $where_clause = "WHERE `status`!=" . EVENT_STATUS_INACTIVATED; } else { $where_clause .= " AND `status`!=" . EVENT_STATUS_INACTIVATED; } } $request = <<<EOF SELECT `id` FROM `event` {$where_clause} ORDER BY `happening_t` EOF; debug($request); $pst = $g_pdo->prepare($request); if ($user_id != NULL) { $pst->execute(array(":id" => $user_id)); } else { $pst->execute(); } $event_record = $pst->fetch(); while (isset($event_record["id"])) { $event = Event::get_from_id($event_record["id"]); $events[] = $event; $event_record = $pst->fetch(); } return $events; }
<?php header("Content-Type: text/plain"); define("BASE_DIR", dirname(dirname(__FILE__))); require_once BASE_DIR . "/include/constants.inc"; require_once BASE_DIR . "/include/globals.inc"; require_once BASE_DIR . "/include/misc.inc"; $result = array(); $result['sent_data'] = $_GET; $event = Event::get_from_id($_GET['event_id']); $discount = $event->get_discount($_GET['code'], time()); $result['is_valid'] = false; if ($discount != null) { $result['is_valid'] = true; $result['discount'] = $discount; } echo json_encode($discount);
public static function import() { $event = Event::get_from_id($_SESSION["event_id"]); $file = Form::get_file("guest_filename"); $guest_array = file($file, FILE_IGNORE_NEW_LINES); debug('guest_array: ' . sprint_r($guest_array)); foreach ($guest_array as $line) { if (!Guest::valid_line($line)) { continue; } $guest = new Guest(); $guest->hydrate(); $guest->set_value("email", $line); $guest->store(); $guest->link_to_event($event->id); } }
public function get_remaining() { global $g_pdo; $event = Event::get_from_id($this->event_id); if ($event->is_cancelled()) { return 0; } $type = BILL_TYPE_QUOTATION; if ($event->is_confirmed()) { $type = BILL_TYPE_INVOICE; } $result = $this->max_quantity; $request = <<<EOF SELECT SUM(quantity) FROM item i, item_ticket it, bill b WHERE i.id_bill = b.id AND it.obj_id = i.id AND b.type = :type AND it.id_ticket = :id EOF; debug($request); $q = $g_pdo->prepare($request); $array = array(":type" => $type, ":id" => $this->id); $q->execute($array); $record = $q->fetch(); $count = $record[0]; $result = $result - $count; return $result; }
<?php define("BASE_DIR", dirname(dirname(__FILE__))); require_once BASE_DIR . "/include/constants.inc"; require_once BASE_DIR . "/include/globals.inc"; require_once BASE_DIR . "/include/misc.inc"; require_once BASE_DIR . "/include/deal.inc"; $event = Event::get_from_id(100022); $report = deal_generate_report($event); ?> <html> <head> <meta charset="utf-8"/> <style> table { border-collapse: collapse; border: 1px solid black; } td, th { padding: 5px; border: 1px solid black; } </style> </head> <body> <table> <tr> <th>Ticket name</th> <th>Ticket price</th> <th>Total invoice</th>