示例#1
0
 public function run()
 {
     $items = \Workshop::get_all()->fetch();
     for ($i = count($items); $i < 8; $i++) {
         $items[] = new \Workshop(array("name" => "Připravujeme", "desc" => 'Workshop ' . ($i + 1)));
     }
     $this->partial('pages/workshops', array("items" => $items));
 }
示例#2
0
 public function run()
 {
     $ws = \Workshop::get_all()->where(array('visible' => true))->fetch();
     foreach ($ws as $w) {
         $w->ass_total = $w->assignees->count();
         $w->ass_all = $w->assignees->fetch();
     }
     $this->partial('stats/workshops', array("workshops" => $ws));
 }
示例#3
0
 public function run()
 {
     $account_pay = \Workshop\Check::get_all()->reset_cols()->add_cols(array('SUM(amount) as `total`'))->where(array("is_paid" => false))->assoc_with(null)->fetch_one();
     $account_sum = \Workshop\Payment::get_all()->reset_cols()->add_cols(array('SUM(amount) as `total`'))->assoc_with(null)->fetch_one();
     $stats = array("total" => \Workshop\SignUp::get_all()->count(), "unpaid" => \Workshop\SignUp::get_all()->where(array('paid' => false, 'solved' => false))->count(), "paid" => \Workshop\SignUp::get_all()->where(array('paid' => true))->count(), "waiting" => \Workshop\SignUp::get_all()->where(array('paid' => true, 'solved' => false, 'canceled' => false))->count(), "solved" => \Workshop\SignUp::get_all()->where(array('solved' => true, 'canceled' => false))->count(), "meals" => \Workshop\SignUp::get_all()->where(array('solved' => true, 'lunch' => true, 'canceled' => false))->count(), "hotel" => \Workshop\SignUp::get_all()->where(array('solved' => true, 'hotel' => true, 'canceled' => false))->count(), "expected_cnt" => \Workshop\Check::get_all()->where(array("is_paid" => false))->count(), "expected_sum" => $account_pay['total'], "received_cnt" => \Workshop\Payment::get_all()->count(), "received_sum" => $account_sum['total']);
     $ws = \Workshop::get_all()->fetch();
     foreach ($ws as $w) {
         $w->sig_total = $w->signups->count();
         $w->ass_total = $w->assignees->count();
     }
     $this->partial('stats/signups', array("stats" => $stats, "workshops" => $ws));
 }
示例#4
0
 public function cmd_workshops()
 {
     \System\Init::full();
     $ws = \Workshop::get_all()->fetch();
     $dump = array();
     foreach ($ws as $workshop) {
         $signups = $workshop->assignees->where(array("solved" => true))->fetch();
         array_push($dump, $workshop->name, "------\n");
         foreach ($signups as $signup) {
             array_push($dump, $signup->toName() . ': ' . $signup->email . ' ' . $signup->phone);
         }
         array_push($dump, "\n");
     }
     echo implode("\n", $dump);
 }
示例#5
0
 public function get_form()
 {
     $opts = array();
     $f = $this->response->form();
     $ws = \Workshop::get_all();
     foreach ($ws as $w) {
         $opts[$w->id] = $w->name;
     }
     $f->input(array('name' => 'name_first', 'type' => 'text', 'required' => true));
     $f->input(array('name' => 'name_last', 'type' => 'text', 'required' => true));
     $f->input(array('name' => 'team', 'type' => 'text', 'required' => false));
     $f->input(array('name' => 'email', 'type' => 'email', 'required' => true));
     $f->input(array('name' => 'phone', 'type' => 'text', 'required' => true));
     $f->input(array('name' => 'birthday', 'type' => 'text', 'required' => true));
     $f->input(array('name' => 'lunch', 'type' => 'checkbox', 'required' => false));
     $f->input(array('name' => 'hotel', 'type' => 'checkbox', 'required' => false));
     $f->input(array('name' => 'workshop_0', 'type' => 'select', 'options' => $opts, 'required' => true));
     $f->input(array('name' => 'workshop_1', 'type' => 'select', 'options' => $opts));
     $f->input(array('name' => 'workshop_2', 'type' => 'select', 'options' => $opts));
     $f->input(array('name' => 'rules', 'type' => 'checkbox', 'required' => true));
     $f->input(array('name' => 'newsletter', 'type' => 'checkbox', 'required' => false));
     return $f;
 }