Projekt

Obecné

Profil

« Předchozí | Další » 

Revize eadc983d

Přidáno uživatelem Jiří Noháč před asi 4 roky(ů)

Issue #8010 @3h

Uprava "Categories" podle specifikovaneho navrhu. Predelany ssytem vyberu categories, kde lze vybrat vice kategorii najednou a po stisknuti tlacitka ENTER se uzivatel prenese do seznamu vsech vybranych artefaktu.

Zobrazit rozdíly:

app/Http/Controllers/ArtefactController.php
53 53
        }
54 54
    }
55 55

  
56
    /**
57
     * Returns view of artefacts related to the chosen category
58
     *
59
     * @param $id string with categories ids
60
     * @return Factory|View
61
     */
62
    public function showCategories($id)
63
    {
64
        $textWithIds  = $id;
65
        $pieces = explode(",", $textWithIds);
66
        $artefacts = array();
67
        for($i = 0;$i < count($pieces); $i++)
68
        {
69
            if($pieces[$i] == null || !strcmp($pieces[$i], ""))
70
            {
71
                continue;
72
            }
73

  
74
            $categoryArtefacts = ArtefactCategory::where('category_id', $pieces[$i])->get();
75
            if(count($categoryArtefacts) > 0)
76
            {
77
                foreach($categoryArtefacts as $ar)
78
                {
79
                    array_push($artefacts, Artefact::where('id', $ar->artefact_id)->get());
80
                }
81
            }
82
        }
83

  
84
        if(count($artefacts) > 0)
85
        {
86
            return view('artefact.category', ['artefacts' => $artefacts]);
87
        }
88
        else
89
        {
90
            return view('artefact.category', ['artefacts' => array()]);
91
        }
92
    }
93

  
56 94
    /**
57 95
     * Returns view of single artefact given by its id.
58 96
     *

Také k dispozici: Unified diff