/** * Get string from label. * * @param string $_label */ public function getFromLabel($_label) { $db = new DB(); $return = null; $item = $db->query("SELECT id FROM {$this->table} WHERE label LIKE '{$_label}' ORDER BY language"); $result = $item->fetchAll(); if ($result) { foreach ($result as $item) { $l = new self(); $return[] = $l->getFromId($item['id']); } } return $return; }
/** * getList. * * @param bool $_all * @param bool $_byPriority */ public function getList($_all = true, $_byPriority = false) { static $languages; if (!isset($languages)) { $db = new DB(); $where = ''; $order = ''; if ($_byPriority) { $order = 'ORDER BY priority ASC'; } else { $order = 'ORDER BY id ASC'; } if ($_all) { $where = 'WHERE active = 1'; } $items = $db->query("SELECT id FROM {$this->table} {$where} {$order}"); if ($items) { $result = $items->fetchAll(); foreach ($result as $item) { $ob_lang = new self(); $languages[] = $ob_lang->getFromId($item['id'], true); } } } return $languages; }