get_logic(); $this->def_tplfile('chronology.tpl.php'); $diary =& $game->get_diary(); //$actions = $diary->get_actions_to(3, $diary->get_week()); //echo ($this->name); $stay = @$_SESSION[$this->name.'.stay']; $last_beg_week = @$_SESSION[$this->name.'.beg_week']; $last_end_week = @$_SESSION[$this->name.'.end_week']; $last_cur_week = @$_SESSION[$this->name.'.cur_week']; $cur_week = $diary->get_week(); //kui tuleb GET päringuga signaal noolenuppudelt.. //stop: siin sama cache probleem if ((isset($_GET[$this->name]) and ($command = $_GET[$this->name]))) { if ($command == 'up' and isset($last_beg_week) and $last_beg_week > 1) { $actions = $diary->get_actions_to(3, $last_beg_week-1); $stay = 1; } elseif ($command == 'down' and isset($last_end_week) and $last_end_week < $cur_week) { $actions = $diary->get_actions_from(3, $last_end_week+1); $stay = 1; } else $actions = $diary->get_last_actions(3); } else { //... if ($last_cur_week != $cur_week) $stay = 0; if ($stay == 1 and isset($last_beg_week) and isset($last_end_week)) $actions = $diary->get_actions_between($last_beg_week, $last_end_week); else $actions = $diary->get_last_actions(3); } //assoc array $actions analüüs: $a =& reset($actions); //$button['up'] = ($a->week > 1 ? 1:0); if ($a->week > 1) { $this->set('btn_up', TRUE); $this->set('btn_up_link', $this->get_link('up') ); }else { $this->set('btn_up', FALSE); $this->set('btn_up_link', $this->get_link() ); } $_SESSION[$this->name.'.beg_week'] = $a->week; $a =& end($actions); //$button['down'] = ($a->week+$a->time_cost < $cur_week ? 1:0); //$this->set('btn_down', ($a->week+$a->time_cost < $cur_week ? 1:0)); if ($a->week+$a->time_cost < $cur_week) { $this->set('btn_down', TRUE); $this->set('btn_down_link', $this->get_link('down')); }else { $this->set('btn_down', FALSE); $this->set('btn_down_link', $this->get_link()); } $_SESSION[$this->name.'.end_week'] = $a->week; $arr = array(); foreach ($actions as $a) { $entry = array(); $week_nrs = array(); for ($week_nr = $a->week; $week_nr < $a->week + $a->time_cost; $week_nr++) $week_nrs[] = $week_nr; $entry['weeks'] = $week_nrs; $entry['subjects'] = $a->subjects; //NB! kunagi muutub $entry['heading'] = $a->name; if (is_a($a, 'activity')) { //var_dump($a); $entry['text'] = $a->result_text;//.'
'.$a->points_by_words; } if (is_a($a, 'person')) $entry['text'] = 'Hankisin personaalset informatsiooni.'; if (is_a($a, 'grouprelation')) $entry['text'] = "Hankisin informatsiooni grupisuhte '".$a->name."' kohta."; $arr[] = $entry; $_SESSION[$this->name.'.ending_with_week'] = $a->week; } $this->set('items', $arr); //var_dump($_SESSION); /* $this->set('items', array( 1=>array( 'weeks'=>array(12,13), 'subjects'=>array('tiina','tõnu'), 'text'=>'tore' ), 2=>array( 'weeks'=>array(14), 'subjects'=>array('tõnu'), 'text'=>'tore' ), 3=>array( 'weeks'=>array(15,16,17), 'subjects'=>array('tiina','tõnu','mare'), 'text'=>'läks hästi' ) ) ); */ } } ?>