Esempio n. 1
0
 /**
  *	Loads the language by it's iso name
  *	@param string $iso iso name of the language
  *	@return any result from the database operation
  */
 function createByISO($iso, $active = true)
 {
     $db = JFactory::getDBO();
     if ($iso === null) {
         return false;
     }
     $lang = new TableJFLanguage($db);
     $jfm = JoomFishManager::getInstance();
     $langdata = $jfm->getLanguageByCode($iso, $active);
     if (!$lang->bind($langdata)) {
         $lang = null;
     }
     return $lang;
 }
 /** Creates an array with all languages for the JoomFish
  *
  * @param boolean	indicates if those languages must be active or not
  * @return	Array of languages
  */
 function getLanguages($active = true)
 {
     $db = JFactory::getDBO();
     $langActive = null;
     $sql = 'SELECT * FROM #__languages';
     if ($active) {
         //sbou
         //$sql  .= ' WHERE active=1';
         $sql .= ' WHERE published=1';
         //fin sbou
     }
     $sql .= ' ORDER BY ordering';
     $db->setQuery($sql);
     //sbou
     $rows = $db->loadObjectList('lang_id');
     //$rows = $db->loadObjectList('id');
     //fin sbou
     // We will need this class defined to popuplate the table
     include_once FALANG_ADMINPATH . DS . 'tables' . DS . 'JFLanguage.php';
     if ($rows) {
         foreach ($rows as $row) {
             $lang = new TableJFLanguage($db);
             $lang->bind($row);
             $langActive[] = $lang;
         }
     }
     return $langActive;
 }