示例#1
0
 public function matrixnavigation_action()
 {
     $tag_matrix_entries_number = 9;
     $tag_subtags_number = 6;
     if (!Request::get("tags")) {
         $this->topics = LernmarktplatzTag::findBest($tag_matrix_entries_number);
         $this->materialien = array();
     } else {
         $tags = $this->tag_history = explode(",", Request::get("tags"));
         $this->without_tags = array();
         $tag_to_search_for = array_pop($tags);
         foreach (LernmarktplatzTag::findBest($tag_matrix_entries_number, true) as $related_tag) {
             if ($related_tag['tag_hash'] !== $this->tag_history[0]) {
                 $this->without_tags[] = $related_tag['tag_hash'];
             }
         }
         //array_shift($this->tag_history);
         foreach ($tags as $tag) {
             foreach (LernmarktplatzTag::findRelated($tag, $this->without_tags, $tag_subtags_number, true) as $related_tag) {
                 $this->without_tags[] = $related_tag['tag_hash'];
             }
         }
         $this->topics = LernmarktplatzTag::findRelated($tag_to_search_for, $this->without_tags, $tag_subtags_number);
         $this->materialien = LernmarktplatzMaterial::findByTagHash($tag_to_search_for);
     }
     $output = array();
     $output['breadcrumb'] = $this->render_template_as_string("market/_breadcrumb");
     $output['matrix'] = $this->render_template_as_string("market/_matrix");
     $output['materials'] = $this->render_template_as_string("market/_materials");
     $this->render_json($output);
 }