public function hydrate_from_form($i)
 {
     $this->code = $_GET['discount_code_a'][$i];
     $this->class = $_GET['discount_class_a'][$i];
     if (!is_null_or_empty($_GET['discount_date_a'][$i])) {
         $this->expiration_t = s2t($_GET['discount_date_a'][$i]);
     } else {
         $this->expiration_t = null;
     }
     if ($this->class == DISCOUNT_CLASS_FIXED) {
         $this->amount = $_GET['discount_value_a'][$i];
     } else {
         $this->percentage = $_GET['discount_value_a'][$i];
     }
 }
Exemple #2
0
 public function init($locale = null)
 {
     global $g_default_locale;
     if ($locale != null) {
         $this->locale = $locale;
     } else {
         if (is_null_or_empty($_SESSION["locale"])) {
             $_SESSION["locale"] = I18n::guess_locale();
         }
         if (is_null_or_empty($_SESSION["locale"])) {
             $_SESSION["locale"] = $g_default_locale;
         }
         $this->locale = $_SESSION["locale"];
     }
     debug("load with locale: " . $this->locale);
     $this->load();
 }
Exemple #3
0
    action();
} catch (Exception $e) {
    $_SESSION["state"] = "error";
    message_set_error($e->getMessage());
    debug(sprint_r($e->getTrace()));
}
if (!in_array($_SESSION["state"], $g_states)) {
    message_set_error("Undeclared state: " . $_SESSION["state"] . ".");
    $_SESSION["state"] = "error";
}
debug("SESSION['state']=" . $_SESSION["state"]);
debug("g_page=" . $g_page);
if ($_SESSION["state"] == "not_allowed") {
    $g_page = "error";
}
if (!is_null_or_empty($g_page)) {
    $g_state = $g_page;
    $g_page = SKIN_DIR . "/" . $g_page . ".php";
} else {
    $g_state = $_SESSION["state"];
    $g_page = SKIN_DIR . "/" . $_SESSION["state"] . ".php";
}
if (!file_exists($g_page)) {
    $g_page = SKIN_DIR . "/error.php";
    message_set_error(_t("Page not existing."));
}
debug("Session after: " . $_SESSION["state"]);
//message_set_info("This is an info message.");
//message_set_error("This is an error message.");
message_process();
layout_i18n(SKIN_DIR . "/layout.php");
Exemple #4
0
 public function is_really_paid()
 {
     return !is_null_or_empty($this->payment_info);
 }
Exemple #5
0
    public function html()
    {
        $result = <<<EOF
<div class="{$this->css}">
EOF;
        if (!is_null_or_empty($this->title)) {
            $result .= <<<EOF
<div class="evt_title"><p>
\t{$this->title}
EOF;
            $result .= <<<EOF
</p></div>
EOF;
        }
        if ($this->cancel) {
            $result .= <<<EOF
<div class="{$this->css}_cancel"><a href="{$this->cancel_url}">{{Cancel}}</a></div>
EOF;
        }
        $result .= <<<EOF
<form class="{$this->css}" action="{$this->action}" method="{$this->method}" {$this->other_attrs}>
EOF;
        $autofocus = "autofocus";
        foreach ($this->elements as $item) {
            $result .= $this->get_element_html($item, $autofocus);
            $autofocus = "";
        }
        $result .= "</form></div>";
        $_SESSION["form"] = $this;
        return $result;
    }
Exemple #6
0
 public function get_confirmation_date()
 {
     $first_ticket_t = $this->get_first_booked_ticket_ts();
     if (is_null_or_empty($first_ticket_t)) {
         if (is_null_or_empty($this->confirmation_t)) {
             return $this->happening_t;
         } else {
             return $this->confirmation_t;
         }
     }
     $first_ticket_29_t = strtotime('+29 days', $first_ticket_t);
     $confirmation_t = "";
     if (is_null_or_empty($this->confirmation_t)) {
         $confirmation_t = min($first_ticket_29_t, s2t($this->happening_t));
     } else {
         $confirmation_t = min($first_ticket_29_t, s2t($this->happening_t), s2t($this->confirmation_t));
     }
     return t2s($confirmation_t);
 }
        $content .= <<<EOF
\t<li>{{This event is published.}}</li>
EOF;
    } else {
        $content .= '<li>{{This event is not published.}}</li>';
    }
    $report = deal_generate_report($event);
    $content .= '<li>' . curr($report['total']) . '€/' . $event->funding_needed . '€ ' . _t('funding acquired') . '.</li>';
    $id = $event->id;
    if ($event->type == EVENT_TYPE_NOMINATIVE) {
        $content .= '<li>{{Tickets indicate attendee name.}}</li>';
    } else {
        $content .= '<li>{{Tickets do not indicate attendee name.}}</li>';
    }
    $phone = $event->phone;
    if (!is_null_or_empty($phone)) {
        $content .= <<<EOF
\t<li>{{Organizer phone}}: {$phone}</li>
EOF;
    }
    $billing_address = Address::get_from_id($event->billing_address_id);
    $typed_billing_address = nl2br($billing_address->address);
    $content .= <<<EOF
\t<li>{{Billing:}} <br/>{$event->organizer_name}<br/>{$typed_billing_address}</li>
EOF;
    if ($event->type == EVENT_TYPE_NOMINATIVE) {
        $content .= '<li><a href="?action=list&amp;type=participation&amp;id=' . $id . '">{{View registrations}}</a></li>';
    }
    $content .= <<<EOF
\t<li><a href="?action=generate&amp;type=report&amp;id={$id}">{{View report}}</a></li>
\t<li><a href="?action=get_form&amp;type=event&amp;id={$id}">{{Edit event}}</a></li>
Exemple #8
0
 public function sync_phone($phone)
 {
     if (is_null_or_empty($this->phone)) {
         $this->phone = $phone;
         $this->update();
     }
 }
Exemple #9
0
 public function is_empty()
 {
     return is_null_or_empty($this->address) || is_null_or_empty($this->lat) || is_null_or_empty($this->lng) || is_null_or_empty($this->street_number) || is_null_or_empty($this->route) || is_null_or_empty($this->postal_code) || is_null_or_empty($this->locality) || is_null_or_empty($this->administrative_area_level_2) || is_null_or_empty($this->administrative_area_level_1) || is_null_or_empty($this->country);
 }