Пример #1
0
 public function makeSql($sql)
 {
     $wordsModel = new WordsModel();
     if ($this->category !== 'all' && $this->type === 'all') {
         $sql .= " WHERE a.category_id = '" . $wordsModel->getCategoryId($this->category) . "'";
     } else {
         if ($this->category === 'all' && $this->type !== 'all') {
             $sql .= " WHERE a.type_id = '" . $wordsModel->getTypeId($this->type) . "'";
         } else {
             if ($this->category !== 'all' && $this->type !== 'all') {
                 $sql .= " WHERE a.category_id = '" . $wordsModel->getCategoryId($this->category) . "'";
                 $sql .= " AND a.type_id = '" . $wordsModel->getTypeId($this->type) . "'";
             }
         }
     }
     $sql .= " ORDER BY a.word_id";
     return $sql;
 }